mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: uclinux-dist-devel@blackfin.uclinux.org,
	Sonic Zhang <sonic.zhang@analog.com>
Subject: [PATCH 08/11] Blackfin Serial Driver: handle irregular DMA register status in auto start mode
Date: Tue,  2 Jun 2009 03:11:37 -0400	[thread overview]
Message-ID: <1243926700-30485-8-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1243926700-30485-1-git-send-email-vapier@gentoo.org>

From: Sonic Zhang <sonic.zhang@analog.com>

This bug is caused by irregular behavior of DMA register CURR_X_COUNT
and CURR_Y_COUNT when an auto restart uart rx DMA run to last byte in
DMA buffer, trigger the interrupt and stay at this possiton. The status
of current x and y is 0:7 instead of 512:8 or 0:8. The driver doesn't
take care of this case when calculating the position.

URL: http://blackfin.uclinux.org/gf/tracker/5063
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reported-by: Tomasz Motylewski <t.motylewski@bfad.de>
---
 drivers/serial/bfin_5xx.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 676efda..854e96d 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -490,7 +490,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
 	uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel);
 	x_pos = get_dma_curr_xcount(uart->rx_dma_channel);
 	uart->rx_dma_nrows = DMA_RX_YCOUNT - uart->rx_dma_nrows;
-	if (uart->rx_dma_nrows == DMA_RX_YCOUNT)
+	if (uart->rx_dma_nrows == DMA_RX_YCOUNT || x_pos == 0)
 		uart->rx_dma_nrows = 0;
 	x_pos = DMA_RX_XCOUNT - x_pos;
 	if (x_pos == DMA_RX_XCOUNT)
@@ -546,15 +546,16 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
 {
 	struct bfin_serial_port *uart = dev_id;
 	unsigned short irqstat;
-	int pos;
+	int x_pos, pos;
 
 	spin_lock(&uart->port.lock);
 	irqstat = get_dma_curr_irqstat(uart->rx_dma_channel);
 	clear_dma_irqstat(uart->rx_dma_channel);
 
 	uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel);
+	x_pos = get_dma_curr_xcount(uart->rx_dma_channel);
 	uart->rx_dma_nrows = DMA_RX_YCOUNT - uart->rx_dma_nrows;
-	if (uart->rx_dma_nrows == DMA_RX_YCOUNT)
+	if (uart->rx_dma_nrows == DMA_RX_YCOUNT || x_pos == 0)
 		uart->rx_dma_nrows = 0;
 
 	pos = uart->rx_dma_nrows * DMA_RX_XCOUNT;
-- 
1.6.3.1


  parent reply	other threads:[~2009-06-02  7:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02  7:11 [PATCH 01/11] Blackfin SPORT UART: fix typo in sport_set_termios prototype Mike Frysinger
2009-06-02  7:11 ` [PATCH 02/11] Blackfin SPORT UART: fix data misses while using transmit frame sync Mike Frysinger
2009-06-02  7:11 ` [PATCH 03/11] Blackfin SPORT UART: rewrite inline assembly Mike Frysinger
2009-06-02  7:11 ` [PATCH 04/11] Blackfin SPORT UART: fix overrun errors Mike Frysinger
2009-06-02  9:00   ` Alan Cox
2009-06-03  8:03     ` Mike Frysinger
2009-06-03  8:49       ` Cai, Cliff
2009-06-03  8:53       ` Alan Cox
2009-06-03  9:47         ` Mike Frysinger
2009-06-03  9:57           ` Alan Cox
2009-06-03 10:15             ` Mike Frysinger
2009-06-02  7:11 ` [PATCH 05/11] Blackfin Serial Driver: fix error while transferring large files Mike Frysinger
2009-06-02  7:11 ` [PATCH 06/11] Blackfin Serial Driver: fix baudrate for early_printk Mike Frysinger
2009-06-02  7:11 ` [PATCH 07/11] Blackfin Serial Driver: fix missing new lines when under load Mike Frysinger
2009-06-02  7:11 ` Mike Frysinger [this message]
2009-06-02  7:11 ` [PATCH 09/11] Blackfin Serial Driver: annotate anomalies 05000215 and 05000099 Mike Frysinger
2009-06-02  7:11 ` [PATCH 10/11] Blackfin Serial Driver: handle anomaly 05000231 Mike Frysinger
2009-06-02  7:11 ` [PATCH 11/11] Blackfin Serial Driver: disable dma rx interrupt only rather than all irqs Mike Frysinger

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=1243926700-30485-8-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sonic.zhang@analog.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /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®