aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ipack
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>2012-12-10 05:50:07 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-15 21:24:39 -0500
commitb0d17fbdacb32f9f4b9ee1ad2b8f42f6a480d842 (patch)
tree35f703a72c975bee4f79d4505ec3667e18ca346b /drivers/ipack
parentb06073f963b7b00a628e58e87d02028e2c9e430d (diff)
ipack/devices/ipoctal: add rx_enable flag
Thus, we don't enable RX when a termios setup has been called, as it could be disabled previously. As the control registers (Rx, Tx flags specifically) cannot be read from the device, we keep this info in rx_enable. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ipack')
-rw-r--r--drivers/ipack/devices/ipoctal.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
index 34fcfce0cdd9..8666d2d05eef 100644
--- a/drivers/ipack/devices/ipoctal.c
+++ b/drivers/ipack/devices/ipoctal.c
@@ -43,6 +43,7 @@ struct ipoctal_channel {
43 unsigned int board_id; 43 unsigned int board_id;
44 u8 isr_rx_rdy_mask; 44 u8 isr_rx_rdy_mask;
45 u8 isr_tx_rdy_mask; 45 u8 isr_tx_rdy_mask;
46 unsigned int rx_enable;
46}; 47};
47 48
48struct ipoctal { 49struct ipoctal {
@@ -65,6 +66,7 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty)
65 * there is something to send 66 * there is something to send
66 */ 67 */
67 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr); 68 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
69 channel->rx_enable = 1;
68 return 0; 70 return 0;
69} 71}
70 72
@@ -309,6 +311,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
309 } 311 }
310 312
311 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); 313 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
314 channel->rx_enable = 0;
312 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); 315 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
313 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); 316 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
314 iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY, 317 iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY,
@@ -430,6 +433,7 @@ static int ipoctal_write_tty(struct tty_struct *tty,
430 /* As the IP-OCTAL 485 only supports half duplex, do it manually */ 433 /* As the IP-OCTAL 485 only supports half duplex, do it manually */
431 if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) { 434 if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) {
432 iowrite8(CR_DISABLE_RX, &channel->regs->w.cr); 435 iowrite8(CR_DISABLE_RX, &channel->regs->w.cr);
436 channel->rx_enable = 0;
433 iowrite8(CR_CMD_ASSERT_RTSN, &channel->regs->w.cr); 437 iowrite8(CR_CMD_ASSERT_RTSN, &channel->regs->w.cr);
434 } 438 }
435 439
@@ -589,8 +593,9 @@ static void ipoctal_set_termios(struct tty_struct *tty,
589 iowrite8(mr2, &channel->regs->w.mr); 593 iowrite8(mr2, &channel->regs->w.mr);
590 iowrite8(csr, &channel->regs->w.csr); 594 iowrite8(csr, &channel->regs->w.csr);
591 595
592 /* Enable again the RX */ 596 /* Enable again the RX, if it was before */
593 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr); 597 if (channel->rx_enable)
598 iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
594} 599}
595 600
596static void ipoctal_hangup(struct tty_struct *tty) 601static void ipoctal_hangup(struct tty_struct *tty)
@@ -610,6 +615,7 @@ static void ipoctal_hangup(struct tty_struct *tty)
610 tty_port_hangup(&channel->tty_port); 615 tty_port_hangup(&channel->tty_port);
611 616
612 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); 617 iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
618 channel->rx_enable = 0;
613 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); 619 iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
614 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); 620 iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
615 iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr); 621 iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);