public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/24] omap 3/4: uart: fix full-fifo write abort
@ 2010-02-16 15:57 Santosh Shilimkar
  2010-02-16 15:57 ` [PATCH 02/24] omap2/3/4: ioremap omap_globals module Santosh Shilimkar
  0 siblings, 1 reply; 57+ messages in thread
From: Santosh Shilimkar @ 2010-02-16 15:57 UTC (permalink / raw)
  To: tony
  Cc: linux-omap, ben, sameo, lrg, paul, Santosh Shilimkar,
	Woodruff Richard, Ghorai Sukumar

This patch is addition to the already merged commit on non-empty
uart fifo read abort. "ce13d4716a276f4331d78ba28a5093a63822ab95"

OMAP3630 and OMAP4430 UART IP blocks have a restriction on TX FIFO
too. If you try to write to the tx fifo when it is full, the system aborts.

This can be easily reproducible by not suppressing interconnect errors or
long duration testing where continuous prints over console from multiple
threads. This patch is addressing the issue by ensuring that write is
not issued while fifo is full. A timeout is added to avoid any hang
on fifo-full for 10 mS which is unlikely case.

Patch is validated on OMAP3630 and OMAP4 SDP.

V2 version removed the additional 1 uS on every TX as per
Tony's suggestion

Signed-off-by: Woodruff Richard <r-woodruff2@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
CC: Ghorai Sukumar <s-ghorai@ti.com>
---
 arch/arm/mach-omap2/serial.c |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 5f3035e..b79bc89 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -23,6 +23,7 @@
 #include <linux/serial_reg.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/delay.h>
 
 #include <plat/common.h>
 #include <plat/board.h>
@@ -160,6 +161,13 @@ static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
 	return (unsigned int)__raw_readb(up->membase + offset);
 }
 
+static inline void __serial_write_reg(struct uart_port *up, int offset,
+		int value)
+{
+	offset <<= up->regshift;
+	__raw_writeb(value, up->membase + offset);
+}
+
 static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
 				    int value)
 {
@@ -620,6 +628,20 @@ static unsigned int serial_in_override(struct uart_port *up, int offset)
 	return __serial_read_reg(up, offset);
 }
 
+static void serial_out_override(struct uart_port *up, int offset, int value)
+{
+	unsigned int status, tmout = 10000;
+
+	status = __serial_read_reg(up, UART_LSR);
+	while (!(status & UART_LSR_THRE)) {
+		/* Wait up to 10ms for the character(s) to be sent. */
+		if (--tmout == 0)
+			break;
+		udelay(1);
+		status = __serial_read_reg(up, UART_LSR);
+	}
+	__serial_write_reg(up, offset, value);
+}
 void __init omap_serial_early_init(void)
 {
 	int i;
@@ -721,11 +743,14 @@ void __init omap_serial_init_port(int port)
 	 * omap3xxx: Never read empty UART fifo on UARTs
 	 * with IP rev >=0x52
 	 */
-	if (cpu_is_omap44xx())
+	if (cpu_is_omap44xx()) {
 		uart->p->serial_in = serial_in_override;
-	else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
-			>= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
+		uart->p->serial_out = serial_out_override;
+	} else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
+			>= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV) {
 		uart->p->serial_in = serial_in_override;
+		uart->p->serial_out = serial_out_override;
+	}
 }
 
 /**
-- 
1.6.0.4


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

end of thread, other threads:[~2010-02-19 22:32 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16 15:57 [PATCH 01/24] omap 3/4: uart: fix full-fifo write abort Santosh Shilimkar
2010-02-16 15:57 ` [PATCH 02/24] omap2/3/4: ioremap omap_globals module Santosh Shilimkar
2010-02-16 15:57   ` [PATCH 03/24] omap4: sdma: Enable the idle modes on omap4 Santosh Shilimkar
2010-02-16 15:57     ` [PATCH 04/24] omap: sdma: Limit the secure reserve channel fix for omap3 Santosh Shilimkar
2010-02-16 15:57       ` [PATCH 05/24] omap4: Add needed IRQ line into irqs.h Santosh Shilimkar
2010-02-16 15:57         ` [PATCH 06/24] omap4: Fix omap_type() for omap4 Santosh Shilimkar
2010-02-16 15:57           ` [PATCH 07/24] omap 3/4: Remove overlapping mapping of L4_WKUP io space Santosh Shilimkar
2010-02-16 15:57             ` [PATCH 08/24] omap4: clocks: Make Uart driver's clock calls OMAP4 compatible Santosh Shilimkar
2010-02-16 15:58               ` [PATCH 09/24] omap4: clocks: Make mcbsp " Santosh Shilimkar
2010-02-16 15:58                 ` [PATCH 10/24] omap4: clokcs: Make gpio " Santosh Shilimkar
2010-02-16 15:58                   ` [PATCH 11/24] omap4: clocks: Make watchdog " Santosh Shilimkar
2010-02-16 15:58                     ` [PATCH 12/24] omap4: clocks: Make dmtimer clocks " Santosh Shilimkar
2010-02-16 15:58                       ` [PATCH 13/24] omap4: clocks: Remove clock hacks from timer-gp.c Santosh Shilimkar
2010-02-16 15:58                         ` [PATCH 14/24] omap4: Enable WDT and McBSP support Santosh Shilimkar
2010-02-16 15:58                           ` [PATCH 15/24] omap4: clocks: Convert i2c clocks data to fclks Santosh Shilimkar
2010-02-16 15:58                             ` [PATCH 16/24] omap4: Add i2c support on omap4 platform Santosh Shilimkar
2010-02-16 15:58                               ` [PATCH 17/24] omap4: Add i2c board support for " Santosh Shilimkar
2010-02-16 15:58                                 ` [PATCH 18/24] omap4: clocks: Make i2c driver's clock calls OMAP4 compatible Santosh Shilimkar
2010-02-16 15:58                                   ` [PATCH 19/24] twl6030: Fix vsel calculations in set/get voltage api's Santosh Shilimkar
2010-02-16 15:58                                     ` [PATCH 20/24] twl6030: add base addr for ID0, ID1, ID2 Santosh Shilimkar
2010-02-16 15:58                                       ` [PATCH 21/24] omap4: add i2c1 peripherals data Santosh Shilimkar
2010-02-16 15:58                                         ` [PATCH 22/24] omap4: add regulator board data for TWL6030 Santosh Shilimkar
2010-02-16 15:58                                           ` [PATCH 23/24] omap4: Enable RTC and regulator support Santosh Shilimkar
2010-02-16 15:58                                             ` [PATCH 24/24] omap4: multi-omap: Allow build to work Santosh Shilimkar
2010-02-16 16:15                                               ` Shilimkar, Santosh
2010-02-17  9:12                                                 ` Gadiyar, Anand
2010-02-17 17:20                                                   ` Tony Lindgren
2010-02-16 18:53                                               ` Tony Lindgren
2010-02-17  5:05                                                 ` Shilimkar, Santosh
2010-02-16 23:30                                               ` Paul Walmsley
2010-02-19 11:41                                       ` [PATCH 20/24] twl6030: add base addr for ID0, ID1, ID2 Samuel Ortiz
2010-02-19 22:33                                         ` Tony Lindgren
2010-02-16 23:22                                   ` [PATCH 18/24] omap4: clocks: Make i2c driver's clock calls OMAP4 compatible Paul Walmsley
2010-02-16 18:50                               ` [PATCH 16/24] omap4: Add i2c support on omap4 platform Tony Lindgren
2010-02-17  5:04                                 ` Shilimkar, Santosh
2010-02-16 23:21                               ` Paul Walmsley
2010-02-17  5:23                                 ` Shilimkar, Santosh
2010-02-16 23:22                             ` [PATCH 15/24] omap4: clocks: Convert i2c clocks data to fclks Paul Walmsley
2010-02-16 18:42                           ` [PATCH 14/24] omap4: Enable WDT and McBSP support Tony Lindgren
2010-02-16 18:41                         ` [PATCH 13/24] omap4: clocks: Remove clock hacks from timer-gp.c Tony Lindgren
2010-02-17  5:02                           ` Shilimkar, Santosh
2010-02-17 17:21                             ` Tony Lindgren
2010-02-16 22:57                     ` [PATCH 11/24] omap4: clocks: Make watchdog driver's clock calls OMAP4 compatible Paul Walmsley
2010-02-16 22:34                 ` [PATCH 09/24] omap4: clocks: Make mcbsp " Paul Walmsley
2010-02-16 18:38               ` [PATCH 08/24] omap4: clocks: Make Uart " Tony Lindgren
2010-02-16 22:32               ` Paul Walmsley
2010-02-16 22:08         ` [PATCH 05/24] omap4: Add needed IRQ line into irqs.h Paul Walmsley
2010-02-17  5:01           ` Shilimkar, Santosh
2010-02-17  5:32             ` Paul Walmsley
2010-02-17  5:51               ` Shilimkar, Santosh
2010-02-17  6:02                 ` Shilimkar, Santosh
2010-02-17  6:45                   ` Paul Walmsley
2010-02-17  7:25                     ` Shilimkar, Santosh
2010-02-17  7:32                       ` Paul Walmsley
2010-02-17  7:36                         ` Shilimkar, Santosh
2010-02-16 22:04   ` [PATCH 02/24] omap2/3/4: ioremap omap_globals module Paul Walmsley
2010-02-17  5:30     ` Shilimkar, Santosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox