aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorchao bi <chao.bi@intel.com>2012-10-31 04:54:07 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-01 11:50:01 -0400
commit31fe99048859b13a87f476016e7bb5c2b5220c36 (patch)
tree425b1ce34168d16470530f21b87f92b1ec077093 /drivers/tty
parent2ac4ad2a1468123f6bb439a547880a9c0d302e0a (diff)
serial:ifx6x60:Prevent data transfer when IFX6x60 port is shutdown
This patch is to implement following 2 places to avoid potential error when IFX6x60 port shutdown: 1) Clear Flag IFX_SPI_STATE_IO_AVAILABLE to disable data transfer when Modem port is shutdown; 2) Clear Flag IFX_SPI_STATE_IO_IN_PROGRESS and IFX_SPI_STATE_IO_READY when reopen port. This is because last port shutdown may happen when SPI/DMA transfer is in progress, if the last data transfer is not completed(for example due to modem reset), the Flag IFX_SPI_STATE_IO_IN_PROGRESS will be set forever, so when IFX port is activated again, IFX_SPI_STATE_IO_IN_PROGRESS will prevent transferring data forever. And if don't clear IFX_SPI_STATE_IO_READY, it may cause one more SPI frame transferring in spit there is not data need to be transfer. cc: liu chuansheng <chuansheng.liu@intel.com> cc: Chen Jun <jun.d.chen@intel.com> Signed-off-by: channing <chao.bi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/ifx6x60.c11
-rw-r--r--drivers/tty/serial/ifx6x60.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index e595c832be20..fbda37415f01 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -569,12 +569,19 @@ static int ifx_port_activate(struct tty_port *port, struct tty_struct *tty)
569 /* clear any old data; can't do this in 'close' */ 569 /* clear any old data; can't do this in 'close' */
570 kfifo_reset(&ifx_dev->tx_fifo); 570 kfifo_reset(&ifx_dev->tx_fifo);
571 571
572 /* clear any flag which may be set in port shutdown procedure */
573 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags);
574 clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags);
575
572 /* put port data into this tty */ 576 /* put port data into this tty */
573 tty->driver_data = ifx_dev; 577 tty->driver_data = ifx_dev;
574 578
575 /* allows flip string push from int context */ 579 /* allows flip string push from int context */
576 tty->low_latency = 1; 580 tty->low_latency = 1;
577 581
582 /* set flag to allows data transfer */
583 set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags);
584
578 return 0; 585 return 0;
579} 586}
580 587
@@ -590,6 +597,7 @@ static void ifx_port_shutdown(struct tty_port *port)
590 struct ifx_spi_device *ifx_dev = 597 struct ifx_spi_device *ifx_dev =
591 container_of(port, struct ifx_spi_device, tty_port); 598 container_of(port, struct ifx_spi_device, tty_port);
592 599
600 clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags);
593 mrdy_set_low(ifx_dev); 601 mrdy_set_low(ifx_dev);
594 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); 602 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
595 tasklet_kill(&ifx_dev->io_work_tasklet); 603 tasklet_kill(&ifx_dev->io_work_tasklet);
@@ -745,7 +753,8 @@ static void ifx_spi_io(unsigned long data)
745 int retval; 753 int retval;
746 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data; 754 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data;
747 755
748 if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags)) { 756 if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) &&
757 test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) {
749 if (ifx_dev->gpio.unack_srdy_int_nb > 0) 758 if (ifx_dev->gpio.unack_srdy_int_nb > 0)
750 ifx_dev->gpio.unack_srdy_int_nb--; 759 ifx_dev->gpio.unack_srdy_int_nb--;
751 760
diff --git a/drivers/tty/serial/ifx6x60.h b/drivers/tty/serial/ifx6x60.h
index d8869f5a4632..4fbddc297839 100644
--- a/drivers/tty/serial/ifx6x60.h
+++ b/drivers/tty/serial/ifx6x60.h
@@ -41,6 +41,7 @@
41#define IFX_SPI_STATE_IO_IN_PROGRESS 1 41#define IFX_SPI_STATE_IO_IN_PROGRESS 1
42#define IFX_SPI_STATE_IO_READY 2 42#define IFX_SPI_STATE_IO_READY 2
43#define IFX_SPI_STATE_TIMER_PENDING 3 43#define IFX_SPI_STATE_TIMER_PENDING 3
44#define IFX_SPI_STATE_IO_AVAILABLE 4
44 45
45/* flow control bitfields */ 46/* flow control bitfields */
46#define IFX_SPI_DCD 0 47#define IFX_SPI_DCD 0