linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Alan Cox <alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
Cc: uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 01/13] serial: bfin_sport_uart: work around anomaly 05000473 (make 32bit fifo read atomic)
Date: Tue,  9 Mar 2010 12:25:28 -0500	[thread overview]
Message-ID: <1268155540-8241-2-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1268155540-8241-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>

From: Sonic Zhang <sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>

We cannot let a 32-bit RX FIFO read be interrupted otherwise a fake RX
underflow error might be generated.

URL: http://blackfin.uclinux.org/gf/tracker/5145
Signed-off-by: Sonic Zhang <sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
---
 drivers/serial/bfin_sport_uart.h |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/bfin_sport_uart.h b/drivers/serial/bfin_sport_uart.h
index abe0361..9791fcc 100644
--- a/drivers/serial/bfin_sport_uart.h
+++ b/drivers/serial/bfin_sport_uart.h
@@ -37,7 +37,21 @@
 #define SPORT_GET_TFSDIV(sport)		bfin_read16(((sport)->port.membase + OFFSET_TFSDIV))
 #define SPORT_GET_TX(sport)		bfin_read16(((sport)->port.membase + OFFSET_TX))
 #define SPORT_GET_RX(sport)		bfin_read16(((sport)->port.membase + OFFSET_RX))
-#define SPORT_GET_RX32(sport)		bfin_read32(((sport)->port.membase + OFFSET_RX))
+/*
+ * If another interrupt fires while doing a 32-bit read from RX FIFO,
+ * a fake RX underflow error will be generated.  So disable interrupts
+ * to prevent interruption while reading the FIFO.
+ */
+#define SPORT_GET_RX32(sport) \
+({ \
+	unsigned int __ret; \
+	if (ANOMALY_05000473) \
+		local_irq_disable(); \
+	__ret = bfin_read32((sport)->port.membase + OFFSET_RX); \
+	if (ANOMALY_05000473) \
+		local_irq_enable(); \
+	__ret; \
+})
 #define SPORT_GET_RCR1(sport)		bfin_read16(((sport)->port.membase + OFFSET_RCR1))
 #define SPORT_GET_RCR2(sport)		bfin_read16(((sport)->port.membase + OFFSET_RCR2))
 #define SPORT_GET_RCLKDIV(sport)	bfin_read16(((sport)->port.membase + OFFSET_RCLKDIV))
-- 
1.7.0.2

  parent reply	other threads:[~2010-03-09 17:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09 17:25 [PATCH 00/13] Blackfin SPORT UART updates Mike Frysinger
     [not found] ` <1268155540-8241-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2010-03-09 17:25   ` Mike Frysinger [this message]
2010-03-09 17:25   ` [PATCH 02/13] serial: bfin_sport_uart: shorten the SPORT TX waiting loop Mike Frysinger
2010-03-09 17:25   ` [PATCH 05/13] serial: bfin_sport_uart: rename early platform driver class string Mike Frysinger
2010-03-09 17:25   ` [PATCH 07/13] serial: bfin_sport_uart: protect changes to uart_port Mike Frysinger
2010-03-09 17:25   ` [PATCH 08/13] serial: bfin_sport_uart: zero sport_uart_port if allocated dynamically Mike Frysinger
2010-03-09 17:25   ` [PATCH 09/13] serial: bfin_sport_uart: drop useless status masks Mike Frysinger
2010-03-09 17:25   ` [PATCH 12/13] serial: bfin_sport_uart: drop the experimental markings Mike Frysinger
2010-03-09 17:25   ` [PATCH 13/13] serial: bfin_sport_uart: drop redundant cpu depends Mike Frysinger
2010-03-09 17:25 ` [PATCH 03/13] serial: bfin_sport_uart: remove unused peripheral pin lists Mike Frysinger
2010-03-09 17:25 ` [PATCH 04/13] serial: bfin_sport_uart: add missing mapbase initialization Mike Frysinger
2010-03-09 17:25 ` [PATCH 06/13] serial: bfin_sport_uart: add support for CTS/RTS via GPIOs Mike Frysinger
2010-03-09 17:25 ` [PATCH 10/13] serial: bfin_sport_uart: only enable SPORT TX if data is to be sent Mike Frysinger
2010-03-09 17:25 ` [PATCH 11/13] serial: bfin_sport_uart: pull in bfin_sport.h for SPORT defines 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=1268155540-8241-2-git-send-email-vapier@gentoo.org \
    --to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.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;
as well as URLs for NNTP newsgroup(s).