LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bryan Wu <cooloney@kernel.org>
To: alan@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	Sonic Zhang <sonic.zhang@analog.com>,
	Bryan Wu <cooloney@kernel.org>
Subject: [PATCH 5/6] Blackfin Serial Driver: Fix bug - BF527-EZKIT unable to receive large files over UART in DMA mode
Date: Mon, 13 Oct 2008 17:46:24 +0800	[thread overview]
Message-ID: <1223891185-13924-6-git-send-email-cooloney@kernel.org> (raw)
In-Reply-To: <1223891185-13924-1-git-send-email-cooloney@kernel.org>

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

Add spin_lock_irqsave() when receive and transfer data.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/serial/bfin_5xx.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 44a0855..82854d7 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -82,7 +82,9 @@ static void bfin_serial_reset_irda(struct uart_port *port);
 static void bfin_serial_stop_tx(struct uart_port *port)
 {
 	struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
+#ifdef CONFIG_SERIAL_BFIN_DMA
 	struct circ_buf *xmit = &uart->port.info->xmit;
+#endif
 
 	while (!(UART_GET_LSR(uart) & TEMT))
 		cpu_relax();
@@ -413,7 +415,9 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
 
 void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
 {
-	int x_pos, pos;
+	int x_pos, pos, flags;
+
+	spin_lock_irqsave(&uart->port.lock, flags);
 
 	uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel);
 	x_pos = get_dma_curr_xcount(uart->rx_dma_channel);
@@ -431,6 +435,8 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
 		uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
 	}
 
+	spin_unlock_irqrestore(&uart->port.lock, flags);
+
 	mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES);
 }
 
@@ -465,10 +471,9 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
 	spin_lock(&uart->port.lock);
 	irqstat = get_dma_curr_irqstat(uart->rx_dma_channel);
 	clear_dma_irqstat(uart->rx_dma_channel);
+	bfin_serial_dma_rx_chars(uart);
 	spin_unlock(&uart->port.lock);
 
-	mod_timer(&(uart->rx_dma_timer), jiffies);
-
 	return IRQ_HANDLED;
 }
 #endif
-- 
1.5.6

  parent reply	other threads:[~2008-10-13 10:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13  9:46 [PATCH 0/6] Blackfin Serial Driver updates for 2.6.28 Bryan Wu
2008-10-13  9:46 ` [PATCH 1/6] Blackfin Serial Driver: updates kgdb over Blackfin serial driver with kgdb framework Bryan Wu
2008-10-13  9:46 ` [PATCH 2/6] Blackfin Serial Driver: Add a debug function to serial driver Bryan Wu
2008-10-14 13:27   ` Alan Cox
2008-10-15  2:23     ` gyang
2008-10-15  8:38       ` Alan Cox
2008-10-16 13:58         ` Bryan Wu
2008-10-13  9:46 ` [PATCH 3/6] Blackfin Serial Driver: fix bug - SIR driver stop receiving randomly Bryan Wu
2008-10-13  9:46 ` [PATCH 4/6] Blackfin Serial Driver: Clean serial console and early prink code` Bryan Wu
2008-10-13  9:46 ` Bryan Wu [this message]
2008-10-13  9:46 ` [PATCH 6/6] Blackfin Serial Driver: Remove BI status for known_good_char Bryan Wu
2008-10-13 10:16 ` [PATCH 0/6] Blackfin Serial Driver updates for 2.6.28 Alan Cox

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=1223891185-13924-6-git-send-email-cooloney@kernel.org \
    --to=cooloney@kernel.org \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sonic.zhang@analog.com \
    --subject='Re: [PATCH 5/6] Blackfin Serial Driver: Fix bug - BF527-EZKIT unable to receive large files over UART in DMA mode' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).