#include <asm/ifxmips/ifx_ssc_defines.h>
#include <asm/ifxmips/ifx_ssc.h>
-#ifdef SSC_FRAME_INT_ENABLE
-#undef SSC_FRAME_INT_ENABLE
-#endif
-
-#define not_yet
-
-#define SPI_VINETIC
-
-
-
/* allow the user to set the major device number */
static int maj = 0;
*/
static struct ifx_ssc_port *isp;
-/* prototypes for fops */
-static ssize_t ifx_ssc_read (struct file *, char *, size_t, loff_t *);
-static ssize_t ifx_ssc_write (struct file *, const char *, size_t, loff_t *);
-//static unsigned int ifx_ssc_poll(struct file *, struct poll_table_struct *);
-int ifx_ssc_ioctl (struct inode *, struct file *, unsigned int,
- unsigned long);
-int ifx_ssc_open (struct inode *, struct file *);
-int ifx_ssc_close (struct inode *, struct file *);
-
/* other forward declarations */
static unsigned int ifx_ssc_get_kernel_clk (struct ifx_ssc_port *info);
static void tx_int (struct ifx_ssc_port *);
extern unsigned int ifxmips_get_fpi_hz (void);
extern void mask_and_ack_ifxmips_irq (unsigned int irq_nr);
-static struct file_operations ifx_ssc_fops = {
- .owner = THIS_MODULE,
- .read = ifx_ssc_read,
- .write = ifx_ssc_write,
- .ioctl = ifx_ssc_ioctl,
- .open = ifx_ssc_open,
- .release = ifx_ssc_close,
-};
-
static inline unsigned int
ifx_ssc_get_kernel_clk (struct ifx_ssc_port *info)
{
return ifxmips_get_fpi_hz () / rmc;
}
-#ifndef not_yet
-#ifdef IFX_SSC_INT_USE_BH
-/*
- * This routine is used by the interrupt handler to schedule
- * processing in the software interrupt portion of the driver
- * (also known as the "bottom half"). This can be called any
- * number of times for any channel without harm.
- */
-static inline void
-ifx_ssc_sched_event (struct ifx_ssc_port *info, int event)
-{
- info->event |= 1 << event; /* remember what kind of event and who */
- queue_task (&info->tqueue, &tq_cyclades); /* it belongs to */
- mark_bh (CYCLADES_BH); /* then trigger event */
-}
-
-static void
-do_softint (void *private_)
-{
- struct ifx_ssc_port *info = (struct ifx_ssc_port *) private_;
-
- if (test_and_clear_bit (Cy_EVENT_HANGUP, &info->event))
- {
- wake_up_interruptible (&info->open_wait);
- info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE);
- }
-
- if (test_and_clear_bit (Cy_EVENT_OPEN_WAKEUP, &info->event))
- wake_up_interruptible (&info->open_wait);
-
- if (test_and_clear_bit (Cy_EVENT_DELTA_WAKEUP, &info->event))
- wake_up_interruptible (&info->delta_msr_wait);
-
- if (test_and_clear_bit (Cy_EVENT_WRITE_WAKEUP, &info->event))
- wake_up_interruptible (&tty->write_wait);
-#ifdef Z_WAKE
- if (test_and_clear_bit (Cy_EVENT_SHUTDOWN_WAKEUP, &info->event))
- wake_up_interruptible (&info->shutdown_wait);
-#endif
-}
-#endif
-#endif
-
inline static void
rx_int (struct ifx_ssc_port *info)
{
// check if transfer is complete
if (info->rxbuf_ptr >= info->rxbuf_end)
{
- disable_irq(info->rxirq);
+ disable_irq(IFXMIPS_SSC_RIR);
wake_up_interruptible (&info->rwait);
} else if ((info->opts.modeRxTx == IFX_SSC_MODE_RX) && (readl(IFXMIPS_SSC_RXCNT) == 0))
{
// check if transmission complete
if (info->txbuf_ptr >= info->txbuf_end)
{
- disable_irq(info->txirq);
+ disable_irq(IFXMIPS_SSC_TIR);
kfree (info->txbuf);
info->txbuf = NULL;
}
local_irq_save (flags);
- disable_irq(info->rxirq);
- disable_irq(info->txirq);
- disable_irq(info->errirq);
+ disable_irq(IFXMIPS_SSC_RIR);
+ disable_irq(IFXMIPS_SSC_TIR);
+ disable_irq(IFXMIPS_SSC_EIR);
local_irq_restore (flags);
wake_up_interruptible (&info->rwait);
// clear pending int's
- mask_and_ack_ifxmips_irq(info->rxirq);
- mask_and_ack_ifxmips_irq(info->txirq);
- mask_and_ack_ifxmips_irq(info->errirq);
+ mask_and_ack_ifxmips_irq(IFXMIPS_SSC_RIR);
+ mask_and_ack_ifxmips_irq(IFXMIPS_SSC_TIR);
+ mask_and_ack_ifxmips_irq(IFXMIPS_SSC_EIR);
// clear error flags
writel(IFX_SSC_WHBSTATE_CLR_ALL_ERROR, IFXMIPS_SSC_WHBSTATE);
line = (int) inode;
} else {
line = MINOR (filp->f_dentry->d_inode->i_rdev);
- filp->f_op = &ifx_ssc_fops;
}
/* don't open more minor devices than we can support */
return -EBUSY;
info->port_is_open++;
- disable_irq(info->rxirq);
- disable_irq(info->txirq);
- disable_irq(info->errirq);
+ disable_irq(IFXMIPS_SSC_RIR);
+ disable_irq(IFXMIPS_SSC_TIR);
+ disable_irq(IFXMIPS_SSC_EIR);
/* Flush and enable TX/RX FIFO */
writel((IFX_SSC_DEF_TXFIFO_FL << IFX_SSC_XFCON_ITL_OFFSET) | IFX_SSC_XFCON_FIFO_FLUSH | IFX_SSC_XFCON_FIFO_ENABLE, IFXMIPS_SSC_TXFCON);
writel(IFX_SSC_WHBSTATE_CLR_ALL_ERROR, IFXMIPS_SSC_WHBSTATE);
// clear pending interrupts
- mask_and_ack_ifxmips_irq(info->rxirq);
- mask_and_ack_ifxmips_irq(info->txirq);
- mask_and_ack_ifxmips_irq(info->errirq);
+ mask_and_ack_ifxmips_irq(IFXMIPS_SSC_RIR);
+ mask_and_ack_ifxmips_irq(IFXMIPS_SSC_TIR);
+ mask_and_ack_ifxmips_irq(IFXMIPS_SSC_EIR);
writel(IFX_SSC_WHBSTATE_SET_ENABLE, IFXMIPS_SSC_WHBSTATE);
tx_int (info);
if (info->txbuf_ptr < info->txbuf_end)
- enable_irq(info->txirq);
+ enable_irq(IFXMIPS_SSC_TIR);
- enable_irq(info->rxirq);
+ enable_irq(IFXMIPS_SSC_RIR);
} else {
local_irq_restore(flags);
if (readl(IFXMIPS_SSC_RXCNT) & IFX_SSC_RXCNT_TODO_MASK)
return -EBUSY;
- enable_irq(info->rxirq);
+ enable_irq(IFXMIPS_SSC_RIR);
if (len < IFX_SSC_RXREQ_BLOCK_SIZE)
writel(len << IFX_SSC_RXREQ_RXCOUNT_OFFSET, IFXMIPS_SSC_RXREQ);
else
tx_int (info);
if (info->txbuf_ptr < info->txbuf_end)
{
- enable_irq(info->txirq);
+ enable_irq(IFXMIPS_SSC_TIR);
}
}
ret_val = ifx_ssc_read_helper_poll (info, kbuf, len, 1);
info->rxbuf = NULL;
- disable_irq(info->rxirq);
+ disable_irq(IFXMIPS_SSC_RIR);
return ret_val;
}
if (copy_to_user ((void *) ubuf, info->rxbuf, ret_val) != 0)
ret_val = -EFAULT;
- disable_irq(info->rxirq);
+ disable_irq(IFXMIPS_SSC_RIR);
kfree (info->rxbuf);
info->rxbuf = NULL;
{
unsigned long tmp;
- // check parameters
if ((info->frm_opts.DataLength > IFX_SSC_SFCON_DATA_LENGTH_MAX)
|| (info->frm_opts.DataLength < 1)
|| (info->frm_opts.PauseLength > IFX_SSC_SFCON_PAUSE_LENGTH_MAX)
}
EXPORT_SYMBOL(ifx_ssc_ioctl);
+static struct file_operations ifx_ssc_fops = {
+ .owner = THIS_MODULE,
+ .read = ifx_ssc_read,
+ .write = ifx_ssc_write,
+ .ioctl = ifx_ssc_ioctl,
+ .open = ifx_ssc_open,
+ .release = ifx_ssc_close,
+};
+
int __init
ifx_ssc_init (void)
{
/* values specific to SSC1 */
if (i == 0) {
info->mapbase = IFXMIPS_SSC_BASE_ADDR;
- info->txirq = IFXMIPS_SSC_TIR;
- info->rxirq = IFXMIPS_SSC_RIR;
- info->errirq = IFXMIPS_SSC_EIR;
}
writel(IFX_SSC_DEF_RMC << IFX_CLC_RUN_DIVIDER_OFFSET, IFXMIPS_SSC_CLC);
// init serial framing register
writel(IFX_SSC_DEF_SFCON, IFXMIPS_SSC_SFCON);
- ret_val = request_irq(info->txirq, ifx_ssc_tx_int, SA_INTERRUPT, "ifx_ssc_tx", info);
+ ret_val = request_irq(IFXMIPS_SSC_TIR, ifx_ssc_tx_int, IRQF_DISABLED, "ifx_ssc_tx", info);
if (ret_val)
{
- printk("%s: unable to get irq %d\n", __func__, info->txirq);
+ printk("%s: unable to get irq %d\n", __func__, IFXMIPS_SSC_TIR);
local_irq_restore(flags);
goto errout;
}
- ret_val = request_irq(info->rxirq, ifx_ssc_rx_int, SA_INTERRUPT, "ifx_ssc_rx", info);
+ ret_val = request_irq(IFXMIPS_SSC_RIR, ifx_ssc_rx_int, IRQF_DISABLED, "ifx_ssc_rx", info);
if (ret_val)
{
- printk ("%s: unable to get irq %d\n", __func__, info->rxirq);
+ printk ("%s: unable to get irq %d\n", __func__, IFXMIPS_SSC_RIR);
local_irq_restore (flags);
goto irqerr;
}
- ret_val = request_irq(info->errirq, ifx_ssc_err_int, SA_INTERRUPT,"ifx_ssc_err", info);
+ ret_val = request_irq(IFXMIPS_SSC_EIR, ifx_ssc_err_int, IRQF_DISABLED, "ifx_ssc_err", info);
if (ret_val)
{
- printk ("%s: unable to get irq %d\n", __func__, info->errirq);
+ printk ("%s: unable to get irq %d\n", __func__, IFXMIPS_SSC_EIR);
local_irq_restore (flags);
goto irqerr;
}
writel(IFX_SSC_DEF_IRNEN, IFXMIPS_SSC_IRN);
- enable_irq(info->txirq);
- enable_irq(info->rxirq);
- enable_irq(info->errirq);
+ //enable_irq(IFXMIPS_SSC_TIR);
+ //enable_irq(IFXMIPS_SSC_RIR);
+ //enable_irq(IFXMIPS_SSC_EIR);
local_irq_restore (flags);
}
return 0;
irqerr:
- free_irq(isp[0].txirq, &isp[0]);
- free_irq(isp[0].rxirq, &isp[0]);
- free_irq(isp[0].errirq, &isp[0]);
+ free_irq(IFXMIPS_SSC_TIR, &isp[0]);
+ free_irq(IFXMIPS_SSC_RIR, &isp[0]);
+ free_irq(IFXMIPS_SSC_EIR, &isp[0]);
errout:
kfree (isp);
return (ret_val);
for (i = 0; i < PORT_CNT; i++) {
writel(IFX_SSC_WHBSTATE_CLR_ENABLE, IFXMIPS_SSC_WHBSTATE);
- free_irq(isp[i].txirq, &isp[i]);
- free_irq(isp[i].rxirq, &isp[i]);
- free_irq(isp[i].errirq, &isp[i]);
+ free_irq(IFXMIPS_SSC_TIR, &isp[i]);
+ free_irq(IFXMIPS_SSC_RIR, &isp[i]);
+ free_irq(IFXMIPS_SSC_EIR, &isp[i]);
}
kfree (isp);
}