All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: rmk+kernel@arm.linux.org.uk, Greg KH <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	arnd@arndb.de, Jakub Kicinski <moorray3@wp.pl>,
	linux-serial@vger.kernel.org, dave.martin@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 06/11] drivers: PL011: replace UART_MIS reading with _RIS & _IMSC
Date: Tue, 12 May 2015 15:14:50 +0100	[thread overview]
Message-ID: <1431440095-5146-7-git-send-email-andre.przywara@arm.com> (raw)
In-Reply-To: <1431440095-5146-1-git-send-email-andre.przywara@arm.com>

The PL011 register UART_MIS is actually a bitwise AND of the
UART_RIS and the UART_MISC register.
Since the SBSA UART does not include the _MIS register, use the
two separate registers to get the same behaviour. Since we are
inside the spinlock and we read the _IMSC register only once, there
should be no race issue.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/tty/serial/amba-pl011.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 6709c6c..52cc2f5 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1322,11 +1322,13 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
 	struct uart_amba_port *uap = dev_id;
 	unsigned long flags;
 	unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT;
+	u16 imsc;
 	int handled = 0;
 	unsigned int dummy_read;
 
 	spin_lock_irqsave(&uap->port.lock, flags);
-	status = readw(uap->port.membase + UART011_MIS);
+	imsc = readw(uap->port.membase + UART011_IMSC);
+	status = readw(uap->port.membase + UART011_RIS) & imsc;
 	if (status) {
 		do {
 			if (uap->vendor->cts_event_workaround) {
@@ -1361,7 +1363,7 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
 			if (pass_counter-- == 0)
 				break;
 
-			status = readw(uap->port.membase + UART011_MIS);
+			status = readw(uap->port.membase + UART011_RIS) & imsc;
 		} while (status != 0);
 		handled = 1;
 	}
-- 
2.3.5

WARNING: multiple messages have this Message-ID (diff)
From: andre.przywara@arm.com (Andre Przywara)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 06/11] drivers: PL011: replace UART_MIS reading with _RIS & _IMSC
Date: Tue, 12 May 2015 15:14:50 +0100	[thread overview]
Message-ID: <1431440095-5146-7-git-send-email-andre.przywara@arm.com> (raw)
In-Reply-To: <1431440095-5146-1-git-send-email-andre.przywara@arm.com>

The PL011 register UART_MIS is actually a bitwise AND of the
UART_RIS and the UART_MISC register.
Since the SBSA UART does not include the _MIS register, use the
two separate registers to get the same behaviour. Since we are
inside the spinlock and we read the _IMSC register only once, there
should be no race issue.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/tty/serial/amba-pl011.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 6709c6c..52cc2f5 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1322,11 +1322,13 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
 	struct uart_amba_port *uap = dev_id;
 	unsigned long flags;
 	unsigned int status, pass_counter = AMBA_ISR_PASS_LIMIT;
+	u16 imsc;
 	int handled = 0;
 	unsigned int dummy_read;
 
 	spin_lock_irqsave(&uap->port.lock, flags);
-	status = readw(uap->port.membase + UART011_MIS);
+	imsc = readw(uap->port.membase + UART011_IMSC);
+	status = readw(uap->port.membase + UART011_RIS) & imsc;
 	if (status) {
 		do {
 			if (uap->vendor->cts_event_workaround) {
@@ -1361,7 +1363,7 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
 			if (pass_counter-- == 0)
 				break;
 
-			status = readw(uap->port.membase + UART011_MIS);
+			status = readw(uap->port.membase + UART011_RIS) & imsc;
 		} while (status != 0);
 		handled = 1;
 	}
-- 
2.3.5

  parent reply	other threads:[~2015-05-12 14:14 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 14:14 [PATCH v4 00/11] drivers: PL011: add ARM SBSA Generic UART support Andre Przywara
2015-05-12 14:14 ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 01/11] drivers: PL011: avoid potential unregister_driver call Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 02/11] drivers: PL011: refactor pl011_startup() Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 03/11] drivers: PL011: refactor pl011_shutdown() Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 04/11] drivers: PL011: refactor pl011_set_termios() Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 05/11] drivers: PL011: refactor pl011_probe() Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` Andre Przywara [this message]
2015-05-12 14:14   ` [PATCH v4 06/11] drivers: PL011: replace UART_MIS reading with _RIS & _IMSC Andre Przywara
2015-05-12 14:14 ` [PATCH v4 07/11] drivers: PL011: move cts_event workaround into separate function Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 08/11] drivers: PL011: allow avoiding UART enabling/disabling Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 09/11] drivers: PL011: allow to supply fixed option string Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-12 14:14 ` [PATCH v4 10/11] drivers: PL011: add support for the ARM SBSA generic UART Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-13 14:32   ` Mark Langsdorf
2015-05-13 15:03     ` Graeme Gregory
2015-05-21 11:13     ` Andre Przywara
2015-05-21 11:13       ` Andre Przywara
2015-05-21 12:49       ` Naresh Bhat
2015-05-21 12:49         ` Naresh Bhat
2015-05-21 15:12       ` Mark Langsdorf
2015-05-21 15:12         ` Mark Langsdorf
2015-05-12 14:14 ` [PATCH v4 11/11] drivers: PL011: add ACPI probing for SBSA UART Andre Przywara
2015-05-12 14:14   ` Andre Przywara
2015-05-13  1:09   ` Hanjun Guo
2015-05-13  1:09     ` Hanjun Guo
2015-05-12 15:18 ` [PATCH v4 00/11] drivers: PL011: add ARM SBSA Generic UART support Jakub Kiciński
2015-05-12 15:18   ` Jakub Kiciński
2015-05-12 16:42 ` Robert Richter
2015-05-12 16:42   ` Robert Richter
2015-05-13  9:17 ` Lorenzo Pieralisi
2015-05-13  9:17   ` Lorenzo Pieralisi
2015-05-15  3:31 ` Hanjun Guo
2015-05-15  3:31   ` Hanjun Guo

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=1431440095-5146-7-git-send-email-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=arnd@arndb.de \
    --cc=dave.martin@arm.com \
    --cc=graeme.gregory@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=moorray3@wp.pl \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.