linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: pxa: work around for errata #20
  2011-07-30 10:01 [PATCH] serial: pxa: brief description Marcus Folkesson
@ 2011-07-30 10:01 ` Marcus Folkesson
  0 siblings, 0 replies; 3+ messages in thread
From: Marcus Folkesson @ 2011-07-30 10:01 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-serial, linux-kernel, Marcus Folkesson

Errata E20: UART: Character Timeout interrupt remains set under certain
software conditions.

Implication: The software servicing the UART can be trapped in an infinite loop.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/tty/serial/pxa.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 531931c..5c8e3bb 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -100,6 +100,16 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
 	int max_count = 256;
 
 	do {
+		/* work around Errata #20 according to
+		 * Intel(R) PXA27x Processor Family
+		 * Specification Update (May 2005)
+		 *
+		 * Step 2
+		 * Disable the Reciever Time Out Interrupt via IER[RTOEI]
+		 */
+		up->ier &= ~UART_IER_RTOIE;
+		serial_out(up, UART_IER, up->ier);
+
 		ch = serial_in(up, UART_RX);
 		flag = TTY_NORMAL;
 		up->port.icount.rx++;
@@ -156,6 +166,16 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
 		*status = serial_in(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
 	tty_flip_buffer_push(tty);
+
+	/* work around Errata #20 according to
+	 * Intel(R) PXA27x Processor Family
+	 * Specification Update (May 2005)
+	 *
+	 * Step 6:
+	 * No more data in FIFO: Re-enable RTO interrupt via IER[RTOIE]
+	 */
+	up->ier |= UART_IER_RTOIE;
+	serial_out(up, UART_IER, up->ier);
 }
 
 static void transmit_chars(struct uart_pxa_port *up)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* high speed (921.6 kbit/s).
@ 2011-08-30 11:53 marcus.folkesson
  2011-08-30 11:53 ` [PATCH] serial: pxa: work around for errata #20 marcus.folkesson
  0 siblings, 1 reply; 3+ messages in thread
From: marcus.folkesson @ 2011-08-30 11:53 UTC (permalink / raw)
  To: Alan Cox, linux-serial; +Cc: linux-kernel

After this work around was implemented the system seems to behave good.

In fact, I don't really see why the system should hang since there is a 
max counter, so the loop cannot run forever.

The patch is tested on kernel version 2.6.32, but the driver is allmost
the same.

Please take a look.
Feedback is very much appreciated

>From Marcus Folkesson <marcus.folkesson@combitech.se> # This line is ignored.
From: Marcus Folkesson <marcus.folkesson@combitech.se>
Subject: [PATCH] serial: pxa: a brief description
In-Reply-To: marcus.folkesson@gmail.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] serial: pxa: work around for errata #20
  2011-08-30 11:53 high speed (921.6 kbit/s) marcus.folkesson
@ 2011-08-30 11:53 ` marcus.folkesson
  0 siblings, 0 replies; 3+ messages in thread
From: marcus.folkesson @ 2011-08-30 11:53 UTC (permalink / raw)
  To: Alan Cox, linux-serial; +Cc: linux-kernel, Marcus Folkesson

From: Marcus Folkesson <marcus.folkesson@gmail.com>

Errata E20: UART: Character Timeout interrupt remains set under certain
software conditions.

Implication: The software servicing the UART can be trapped in an infinite loop.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 drivers/tty/serial/pxa.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 531931c..5c8e3bb 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -100,6 +100,16 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
 	int max_count = 256;
 
 	do {
+		/* work around Errata #20 according to
+		 * Intel(R) PXA27x Processor Family
+		 * Specification Update (May 2005)
+		 *
+		 * Step 2
+		 * Disable the Reciever Time Out Interrupt via IER[RTOEI]
+		 */
+		up->ier &= ~UART_IER_RTOIE;
+		serial_out(up, UART_IER, up->ier);
+
 		ch = serial_in(up, UART_RX);
 		flag = TTY_NORMAL;
 		up->port.icount.rx++;
@@ -156,6 +166,16 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status)
 		*status = serial_in(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
 	tty_flip_buffer_push(tty);
+
+	/* work around Errata #20 according to
+	 * Intel(R) PXA27x Processor Family
+	 * Specification Update (May 2005)
+	 *
+	 * Step 6:
+	 * No more data in FIFO: Re-enable RTO interrupt via IER[RTOIE]
+	 */
+	up->ier |= UART_IER_RTOIE;
+	serial_out(up, UART_IER, up->ier);
 }
 
 static void transmit_chars(struct uart_pxa_port *up)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-30 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-30 11:53 high speed (921.6 kbit/s) marcus.folkesson
2011-08-30 11:53 ` [PATCH] serial: pxa: work around for errata #20 marcus.folkesson
  -- strict thread matches above, loose matches on Subject: below --
2011-07-30 10:01 [PATCH] serial: pxa: brief description Marcus Folkesson
2011-07-30 10:01 ` [PATCH] serial: pxa: work around for errata #20 Marcus Folkesson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).