LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* ARM i.MX serial: fix tx buffer overflows
@ 2007-01-05 15:51 Sascha Hauer
  2007-01-05 18:01 ` Pavel Pisa
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2007-01-05 15:51 UTC (permalink / raw)
  To: linux-kernel, Pavel Pisa

This patch fixes occasional tx buffer overflows in the i.MX serial
driver which came from the fact that space in the buffer was checked
after sending the first byte. Also, fifosize is 32 bytes, not 8.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de

---
 drivers/serial/imx.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Index: linux-2.6.20-rc3/drivers/serial/imx.c
===================================================================
--- linux-2.6.20-rc3.orig/drivers/serial/imx.c
+++ linux-2.6.20-rc3/drivers/serial/imx.c
@@ -154,7 +154,7 @@ static inline void imx_transmit_buffer(s
 {
 	struct circ_buf *xmit = &sport->port.info->xmit;
 
-	do {
+	while (!(UTS((u32)sport->port.membase) & UTS_TXFULL)) {
 		/* send xmit->buf[xmit->tail]
 		 * out the port here */
 		URTX0((u32)sport->port.membase) = xmit->buf[xmit->tail];
@@ -163,7 +163,7 @@ static inline void imx_transmit_buffer(s
 		sport->port.icount.tx++;
 		if (uart_circ_empty(xmit))
 			break;
-	} while (!(UTS((u32)sport->port.membase) & UTS_TXFULL));
+	}
 
 	if (uart_circ_empty(xmit))
 		imx_stop_tx(&sport->port);
@@ -178,8 +178,7 @@ static void imx_start_tx(struct uart_por
 
 	UCR1((u32)sport->port.membase) |= UCR1_TXMPTYEN;
 
-	if(UTS((u32)sport->port.membase) & UTS_TXEMPTY)
-		imx_transmit_buffer(sport);
+	imx_transmit_buffer(sport);
 }
 
 static irqreturn_t imx_rtsint(int irq, void *dev_id)
@@ -678,7 +677,7 @@ static struct imx_port imx_ports[] = {
 		.mapbase	= IMX_UART1_BASE, /* FIXME */
 		.irq		= UART1_MINT_RX,
 		.uartclk	= 16000000,
-		.fifosize	= 8,
+		.fifosize	= 32,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.ops		= &imx_pops,
 		.line		= 0,
@@ -694,7 +693,7 @@ static struct imx_port imx_ports[] = {
 		.mapbase	= IMX_UART2_BASE, /* FIXME */
 		.irq		= UART2_MINT_RX,
 		.uartclk	= 16000000,
-		.fifosize	= 8,
+		.fifosize	= 32,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.ops		= &imx_pops,
 		.line		= 1,


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

end of thread, other threads:[~2007-01-29 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-05 15:51 ARM i.MX serial: fix tx buffer overflows Sascha Hauer
2007-01-05 18:01 ` Pavel Pisa
2007-01-29 14:47   ` Konstantin Kletschke
2007-01-29 15:37     ` Russell King
2007-01-29 16:43       ` Konstantin Kletschke

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).