mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH]  atmel_serial
@ 2008-03-05 19:01 Michael Trimarchi
  0 siblings, 0 replies; only message in thread
From: Michael Trimarchi @ 2008-03-05 19:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Haavard Skinnemoen, Michael Trimarchi

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-disable-pdc-during-trasmission.patch --]
[-- Type: text/x-patch; name="0001-Don-t-disable-pdc-during-trasmission.patch", Size: 1423 bytes --]

Avoid stopping pdc during trasmission.

Signed-off-by: michael <trimarchi@gandalf.sssup.it>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-05 19:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 19:01 [PATCH] atmel_serial Michael Trimarchi

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

all inboxes | Powered by JetHome®