mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Trimarchi <trimarchimichael@yahoo.it>
To: linux-kernel@vger.kernel.org
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>,
	Michael Trimarchi <trimarchi@gandalf.sssup.it>
Subject: [PATCH]  atmel_serial
Date: Wed, 5 Mar 2008 19:01:14 +0000 (GMT)	[thread overview]
Message-ID: <457098.61467.qm@web26212.mail.ukl.yahoo.com> (raw)

[-- 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


                 reply	other threads:[~2008-03-05 19:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=457098.61467.qm@web26212.mail.ukl.yahoo.com \
    --to=trimarchimichael@yahoo.it \
    --cc=hskinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trimarchi@gandalf.sssup.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®