Commit 4e4732ac authored by Jens Taprogge's avatar Jens Taprogge Committed by Greg Kroah-Hartman

Staging: ipack/devices/ipoctal: Store isr masks in ipoctal_channel

This way interrupt handling becomes independent of the channel number.
Signed-off-by: default avatarJens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: default avatarSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef79de03
...@@ -44,6 +44,8 @@ struct ipoctal_channel { ...@@ -44,6 +44,8 @@ struct ipoctal_channel {
union scc2698_block __iomem *block_regs; union scc2698_block __iomem *block_regs;
unsigned int board_id; unsigned int board_id;
unsigned char *board_write; unsigned char *board_write;
u8 isr_rx_rdy_mask;
u8 isr_tx_rdy_mask;
}; };
struct ipoctal { struct ipoctal {
...@@ -166,7 +168,6 @@ static int ipoctal_irq_handler(void *arg) ...@@ -166,7 +168,6 @@ static int ipoctal_irq_handler(void *arg)
unsigned int ichannel; unsigned int ichannel;
unsigned char isr; unsigned char isr;
unsigned char sr; unsigned char sr;
unsigned char isr_tx_rdy, isr_rx_rdy;
unsigned char value; unsigned char value;
unsigned char flag; unsigned char flag;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -191,14 +192,6 @@ static int ipoctal_irq_handler(void *arg) ...@@ -191,14 +192,6 @@ static int ipoctal_irq_handler(void *arg)
isr = ioread8(&channel->block_regs->r.isr); isr = ioread8(&channel->block_regs->r.isr);
sr = ioread8(&channel->regs->r.sr); sr = ioread8(&channel->regs->r.sr);
if ((ichannel % 2) == 1) {
isr_tx_rdy = isr & ISR_TxRDY_B;
isr_rx_rdy = isr & ISR_RxRDY_FFULL_B;
} else {
isr_tx_rdy = isr & ISR_TxRDY_A;
isr_rx_rdy = isr & ISR_RxRDY_FFULL_A;
}
/* In case of RS-485, change from TX to RX when finishing TX. /* In case of RS-485, change from TX to RX when finishing TX.
* Half-duplex. * Half-duplex.
*/ */
...@@ -213,7 +206,7 @@ static int ipoctal_irq_handler(void *arg) ...@@ -213,7 +206,7 @@ static int ipoctal_irq_handler(void *arg)
} }
/* RX data */ /* RX data */
if (isr_rx_rdy && (sr & SR_RX_READY)) { if ((isr && channel->isr_rx_rdy_mask) && (sr & SR_RX_READY)) {
value = ioread8(&channel->regs->r.rhr); value = ioread8(&channel->regs->r.rhr);
flag = TTY_NORMAL; flag = TTY_NORMAL;
...@@ -244,7 +237,7 @@ static int ipoctal_irq_handler(void *arg) ...@@ -244,7 +237,7 @@ static int ipoctal_irq_handler(void *arg)
} }
/* TX of each character */ /* TX of each character */
if (isr_tx_rdy && (sr & SR_TX_READY)) { if ((isr & channel->isr_tx_rdy_mask) && (sr & SR_TX_READY)) {
unsigned int *pointer_write = &channel->pointer_write; unsigned int *pointer_write = &channel->pointer_write;
if (channel->nb_bytes <= 0) { if (channel->nb_bytes <= 0) {
...@@ -365,6 +358,13 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, ...@@ -365,6 +358,13 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
channel->block_regs = block_regs + (i >> 1); channel->block_regs = block_regs + (i >> 1);
channel->board_write = &ipoctal->write; channel->board_write = &ipoctal->write;
channel->board_id = ipoctal->board_id; channel->board_id = ipoctal->board_id;
if (i & 1) {
channel->isr_tx_rdy_mask = ISR_TxRDY_B;
channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_B;
} else {
channel->isr_tx_rdy_mask = ISR_TxRDY_A;
channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_A;
}
iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment