[PATCH] atmel_serial

From: Michael Trimarchi
Date: Wed Mar 05 2008 - 14:08:21 EST


Hi,
I find a problem related to loosing data during pdc trasmission in the atmel_serial. For now this patch seems to work for me,
but I think that is not the better solution. I do this test:

- connect ttyS1 with ttyS2 using a loopback cable, send 30 byte of packet from one to the other and waiting for 30 byte. On
the other side just read and echo the data received.

Regards Michael





___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.htmlAvoid stopping pdc during trasmission.

Signed-off-by: michael <trimarchi@xxxxxxxxxxxxxxxx>
---
drivers/serial/atmel_serial.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index d57bf3e..7107158 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -568,11 +568,16 @@ static void atmel_tx_dma(struct uart_port *port)
port->icount.tx += pdc->ofs;
pdc->ofs = 0;

- if (!uart_circ_empty(xmit)) {
- /* more to transmit - setup next transfer */
+ /* more to transmit - setup next transfer */

- /* disable PDC transmit */
- UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
+ /* nothing left to transmit? */
+ while (UART_GET_TCR(port))
+ cpu_relax();
+
+ /* disable PDC transmit */
+ UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
+
+ if (!uart_circ_empty(xmit)) {
dma_sync_single_for_device(port->dev,
pdc->dma_addr,
pdc->dma_size,
@@ -586,11 +591,6 @@ static void atmel_tx_dma(struct uart_port *port)
/* re-enable PDC transmit and interrupts */
UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);
UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
- } else {
- /* nothing left to transmit - disable the transmitter */
-
- /* disable PDC transmit */
- UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS);
}

if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
--
1.5.2.1.174.gcd03-dirty