public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Shreshtha Kumar SAHU <shreshthakumar.sahu@stericsson.com>
To: gregkh@suse.de, linux-serial@vger.kernel.org,
	rmk+kernel@arm.linux.org.uk
Cc: linux-kernel@vger.kernel.org,
	Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Subject: [PATCH] amba-pl011: clear previous interrupts before request_irq
Date: Tue, 17 Jan 2012 16:04:53 +0530	[thread overview]
Message-ID: <1326796493-16080-1-git-send-email-shreshthakumar.sahu@stericsson.com> (raw)

From: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>

All previous interrupts should be cleared before installing
interrupt handler i.e. before request_irq. pl011_shutdown
clears the interrupt register but there may be case where
bootloader transfers control to kernel and there are some
pending interrupts. In this case interrupt handler will get
called even before interrupt mask is enabled.

Change-Id: Ie58ca0a36dec76ac38babc057ce1d66b3129d8f9
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/tty/serial/amba-pl011.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 6958594..6dafaa2 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1381,6 +1381,15 @@ static int pl011_startup(struct uart_port *port)
 	uap->port.uartclk = clk_get_rate(uap->clk);
 
 	/*
+	 * Clear previous interrupts before installing interrupt handler
+	 */
+	spin_lock_irq(&uap->port.lock);
+	uap->im = 0;
+	writew(uap->im, uap->port.membase + UART011_IMSC);
+	writew(0xffff, uap->port.membase + UART011_ICR);
+	spin_unlock_irq(&uap->port.lock);
+
+	/*
 	 * Allocate the IRQ
 	 */
 	retval = request_irq(uap->port.irq, pl011_int, 0, "uart-pl011", uap);
-- 
1.7.4.3


             reply	other threads:[~2012-01-17 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 10:34 Shreshtha Kumar SAHU [this message]
2012-01-18 10:04 ` [PATCH] amba-pl011: clear previous interrupts before request_irq Shreshtha Kumar SAHU
2012-01-18 10:15   ` Russell King
2012-01-19 11:07     ` Shreshtha Kumar SAHU
2012-01-18 11:41   ` Alan Cox
2012-01-19 11:15     ` Shreshtha Kumar SAHU

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=1326796493-16080-1-git-send-email-shreshthakumar.sahu@stericsson.com \
    --to=shreshthakumar.sahu@stericsson.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox