diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2007-02-05 19:10:16 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-02-11 11:46:19 -0500 |
commit | 8c0b254b7efaa7941b3acfe790dd16597b0964b3 (patch) | |
tree | 8e207bb396d9a1b04bda617139bf030c6da45edf /drivers/serial/imx.c | |
parent | ae0a846e411dc0b568e8ccda584896310ee5f369 (diff) |
[ARM] i.MX serial: fix tx buffer overflows
Fix 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
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/imx.c')
-rw-r--r-- | drivers/serial/imx.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index e216dcf29376..03b495c2de14 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -154,7 +154,7 @@ static inline void imx_transmit_buffer(struct imx_port *sport) | |||
154 | { | 154 | { |
155 | struct circ_buf *xmit = &sport->port.info->xmit; | 155 | struct circ_buf *xmit = &sport->port.info->xmit; |
156 | 156 | ||
157 | do { | 157 | while (!(UTS((u32)sport->port.membase) & UTS_TXFULL)) { |
158 | /* send xmit->buf[xmit->tail] | 158 | /* send xmit->buf[xmit->tail] |
159 | * out the port here */ | 159 | * out the port here */ |
160 | URTX0((u32)sport->port.membase) = xmit->buf[xmit->tail]; | 160 | URTX0((u32)sport->port.membase) = xmit->buf[xmit->tail]; |
@@ -163,7 +163,7 @@ static inline void imx_transmit_buffer(struct imx_port *sport) | |||
163 | sport->port.icount.tx++; | 163 | sport->port.icount.tx++; |
164 | if (uart_circ_empty(xmit)) | 164 | if (uart_circ_empty(xmit)) |
165 | break; | 165 | break; |
166 | } while (!(UTS((u32)sport->port.membase) & UTS_TXFULL)); | 166 | } |
167 | 167 | ||
168 | if (uart_circ_empty(xmit)) | 168 | if (uart_circ_empty(xmit)) |
169 | imx_stop_tx(&sport->port); | 169 | imx_stop_tx(&sport->port); |
@@ -178,8 +178,7 @@ static void imx_start_tx(struct uart_port *port) | |||
178 | 178 | ||
179 | UCR1((u32)sport->port.membase) |= UCR1_TXMPTYEN; | 179 | UCR1((u32)sport->port.membase) |= UCR1_TXMPTYEN; |
180 | 180 | ||
181 | if(UTS((u32)sport->port.membase) & UTS_TXEMPTY) | 181 | imx_transmit_buffer(sport); |
182 | imx_transmit_buffer(sport); | ||
183 | } | 182 | } |
184 | 183 | ||
185 | static irqreturn_t imx_rtsint(int irq, void *dev_id) | 184 | static irqreturn_t imx_rtsint(int irq, void *dev_id) |
@@ -678,7 +677,7 @@ static struct imx_port imx_ports[] = { | |||
678 | .mapbase = IMX_UART1_BASE, /* FIXME */ | 677 | .mapbase = IMX_UART1_BASE, /* FIXME */ |
679 | .irq = UART1_MINT_RX, | 678 | .irq = UART1_MINT_RX, |
680 | .uartclk = 16000000, | 679 | .uartclk = 16000000, |
681 | .fifosize = 8, | 680 | .fifosize = 32, |
682 | .flags = UPF_BOOT_AUTOCONF, | 681 | .flags = UPF_BOOT_AUTOCONF, |
683 | .ops = &imx_pops, | 682 | .ops = &imx_pops, |
684 | .line = 0, | 683 | .line = 0, |
@@ -694,7 +693,7 @@ static struct imx_port imx_ports[] = { | |||
694 | .mapbase = IMX_UART2_BASE, /* FIXME */ | 693 | .mapbase = IMX_UART2_BASE, /* FIXME */ |
695 | .irq = UART2_MINT_RX, | 694 | .irq = UART2_MINT_RX, |
696 | .uartclk = 16000000, | 695 | .uartclk = 16000000, |
697 | .fifosize = 8, | 696 | .fifosize = 32, |
698 | .flags = UPF_BOOT_AUTOCONF, | 697 | .flags = UPF_BOOT_AUTOCONF, |
699 | .ops = &imx_pops, | 698 | .ops = &imx_pops, |
700 | .line = 1, | 699 | .line = 1, |