Skip to contentSkip to conversation

atmel_serial

PATCH New Michael Trimarchi 1 participant 1 message Mar 5, 2008 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atmel_serial

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

Avoid stopping pdc during trasmission.

---
 drivers/serial/atmel_serial.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/serial/atmel_serial.c +9 -9
index d57bf3e..7107158 100644
@@ -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)
Signature · 1 line
1.5.2.1.174.gcd03-dirty