linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups
@ 2015-12-26 10:43 Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 1/8] tty: xuartps: Beautify read-modify writes Soren Brinkmann
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

as requested by Peter, this is the first part of my series which has the
patches reviewed by Peter. I'll submit the second part separately. There
are no new changes within the patches.

	Thanks,
	S?ren

S?ren Brinkmann (8):
  tty: xuartps: Beautify read-modify writes
  tty: xuartps: Use spinlock to serialize HW access
  tty: xuartps: Don't consider circular buffer when enabling transmitter
  tty: xuartps: Clear interrupt status register in shutdown
  tty: xuartps: Improve startup function
  tty: xuartps: Keep lock for whole ISR
  tty: xuartps: Acquire port lock for shutdown
  tty: xuartps: Move RX path into helper function

 drivers/tty/serial/xilinx_uartps.c | 117 +++++++++++++++++++++----------------
 1 file changed, 66 insertions(+), 51 deletions(-)

-- 
2.6.3.3.g9bb996a

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 1/8] tty: xuartps: Beautify read-modify writes
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 2/8] tty: xuartps: Use spinlock to serialize HW access Soren Brinkmann
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Non-functional, formatting changes to ease reading the code.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
---
 drivers/tty/serial/xilinx_uartps.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 009e0dbc12d2..50d4082d2354 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -515,12 +515,14 @@ static void cdns_uart_start_tx(struct uart_port *port)
 	if (uart_circ_empty(&port->state->xmit) || uart_tx_stopped(port))
 		return;
 
-	status = readl(port->membase + CDNS_UART_CR_OFFSET);
-	/* Set the TX enable bit and clear the TX disable bit to enable the
+	/*
+	 * Set the TX enable bit and clear the TX disable bit to enable the
 	 * transmitter.
 	 */
-	writel((status & ~CDNS_UART_CR_TX_DIS) | CDNS_UART_CR_TX_EN,
-			port->membase + CDNS_UART_CR_OFFSET);
+	status = readl(port->membase + CDNS_UART_CR_OFFSET);
+	status &= ~CDNS_UART_CR_TX_DIS;
+	status |= CDNS_UART_CR_TX_EN;
+	writel(status, port->membase + CDNS_UART_CR_OFFSET);
 
 	while (numbytes-- && ((readl(port->membase + CDNS_UART_SR_OFFSET) &
 				CDNS_UART_SR_TXFULL)) != CDNS_UART_SR_TXFULL) {
@@ -1123,8 +1125,9 @@ static void cdns_uart_console_write(struct console *co, const char *s,
 	 * clear the TX disable bit to enable the transmitter.
 	 */
 	ctrl = readl(port->membase + CDNS_UART_CR_OFFSET);
-	writel((ctrl & ~CDNS_UART_CR_TX_DIS) | CDNS_UART_CR_TX_EN,
-			port->membase + CDNS_UART_CR_OFFSET);
+	ctrl &= ~CDNS_UART_CR_TX_DIS;
+	ctrl |= CDNS_UART_CR_TX_EN;
+	writel(ctrl, port->membase + CDNS_UART_CR_OFFSET);
 
 	uart_console_write(port, s, count, cdns_uart_console_putchar);
 	cdns_uart_console_wait_tx(port);
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 2/8] tty: xuartps: Use spinlock to serialize HW access
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 1/8] tty: xuartps: Beautify read-modify writes Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 3/8] tty: xuartps: Don't consider circular buffer when enabling transmitter Soren Brinkmann
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of disabling the IRQ, use the spin lock to serialize accesses to
the HW. This protects the driver from interference of non-IRQ callbacks
with each other and makes the driver more consistent in its
serialization method.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/xilinx_uartps.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 50d4082d2354..2c98c357d9a0 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -945,12 +945,10 @@ static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
 #ifdef CONFIG_CONSOLE_POLL
 static int cdns_uart_poll_get_char(struct uart_port *port)
 {
-	u32 imr;
 	int c;
+	unsigned long flags;
 
-	/* Disable all interrupts */
-	imr = readl(port->membase + CDNS_UART_IMR_OFFSET);
-	writel(imr, port->membase + CDNS_UART_IDR_OFFSET);
+	spin_lock_irqsave(&port->lock, flags);
 
 	/* Check if FIFO is empty */
 	if (readl(port->membase + CDNS_UART_SR_OFFSET) & CDNS_UART_SR_RXEMPTY)
@@ -959,19 +957,16 @@ static int cdns_uart_poll_get_char(struct uart_port *port)
 		c = (unsigned char) readl(
 					port->membase + CDNS_UART_FIFO_OFFSET);
 
-	/* Enable interrupts */
-	writel(imr, port->membase + CDNS_UART_IER_OFFSET);
+	spin_unlock_irqrestore(&port->lock, flags);
 
 	return c;
 }
 
 static void cdns_uart_poll_put_char(struct uart_port *port, unsigned char c)
 {
-	u32 imr;
+	unsigned long flags;
 
-	/* Disable all interrupts */
-	imr = readl(port->membase + CDNS_UART_IMR_OFFSET);
-	writel(imr, port->membase + CDNS_UART_IDR_OFFSET);
+	spin_lock_irqsave(&port->lock, flags);
 
 	/* Wait until FIFO is empty */
 	while (!(readl(port->membase + CDNS_UART_SR_OFFSET) &
@@ -986,8 +981,7 @@ static void cdns_uart_poll_put_char(struct uart_port *port, unsigned char c)
 				CDNS_UART_SR_TXEMPTY))
 		cpu_relax();
 
-	/* Enable interrupts */
-	writel(imr, port->membase + CDNS_UART_IER_OFFSET);
+	spin_unlock_irqrestore(&port->lock, flags);
 
 	return;
 }
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 3/8] tty: xuartps: Don't consider circular buffer when enabling transmitter
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 1/8] tty: xuartps: Beautify read-modify writes Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 2/8] tty: xuartps: Use spinlock to serialize HW access Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 4/8] tty: xuartps: Clear interrupt status register in shutdown Soren Brinkmann
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Restarting the transmitter even if the circ buffer is empty may be
necessary to push out remaining data when the port is restarted after
being stopped.

Cc: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
v3:
 - changed this patch to not always enable the transmitter, but keep the
   check for uart_tx_stopped() in place, as suggested by Peter, whose
   explanation I also stole for the new commit message (thx)
---
 drivers/tty/serial/xilinx_uartps.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 2c98c357d9a0..6a7cd4e057ae 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -512,7 +512,7 @@ static void cdns_uart_start_tx(struct uart_port *port)
 {
 	unsigned int status, numbytes = port->fifosize;
 
-	if (uart_circ_empty(&port->state->xmit) || uart_tx_stopped(port))
+	if (uart_tx_stopped(port))
 		return;
 
 	/*
@@ -524,6 +524,9 @@ static void cdns_uart_start_tx(struct uart_port *port)
 	status |= CDNS_UART_CR_TX_EN;
 	writel(status, port->membase + CDNS_UART_CR_OFFSET);
 
+	if (uart_circ_empty(&port->state->xmit))
+		return;
+
 	while (numbytes-- && ((readl(port->membase + CDNS_UART_SR_OFFSET) &
 				CDNS_UART_SR_TXFULL)) != CDNS_UART_SR_TXFULL) {
 		/* Break if no more data available in the UART buffer */
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 4/8] tty: xuartps: Clear interrupt status register in shutdown
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
                   ` (2 preceding siblings ...)
  2015-12-26 10:43 ` [PATCH LINUX v5 3/8] tty: xuartps: Don't consider circular buffer when enabling transmitter Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 5/8] tty: xuartps: Improve startup function Soren Brinkmann
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

When shutting down the UART, clear the interrupt status register. Bits
in the ISR are cleared by writing them as '1'.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
---
v4:
 - clarify workings of the ISR in the commit message
---
 drivers/tty/serial/xilinx_uartps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 6a7cd4e057ae..ef114d7a0623 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -828,6 +828,7 @@ static void cdns_uart_shutdown(struct uart_port *port)
 	/* Disable interrupts */
 	status = readl(port->membase + CDNS_UART_IMR_OFFSET);
 	writel(status, port->membase + CDNS_UART_IDR_OFFSET);
+	writel(0xffffffff, port->membase + CDNS_UART_ISR_OFFSET);
 
 	/* Disable the TX and RX */
 	writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS,
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 5/8] tty: xuartps: Improve startup function
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
                   ` (3 preceding siblings ...)
  2015-12-26 10:43 ` [PATCH LINUX v5 4/8] tty: xuartps: Clear interrupt status register in shutdown Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 6/8] tty: xuartps: Keep lock for whole ISR Soren Brinkmann
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

The startup function is supposed to initialize the UART for receiving.
Hence, don't enable the TX part. Also, protect HW accesses with the port
lock.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/xilinx_uartps.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index ef114d7a0623..6ffd3bbe3e18 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -758,6 +758,7 @@ static void cdns_uart_set_termios(struct uart_port *port,
  */
 static int cdns_uart_startup(struct uart_port *port)
 {
+	unsigned long flags;
 	unsigned int retval = 0, status = 0;
 
 	retval = request_irq(port->irq, cdns_uart_isr, 0, CDNS_UART_NAME,
@@ -765,6 +766,8 @@ static int cdns_uart_startup(struct uart_port *port)
 	if (retval)
 		return retval;
 
+	spin_lock_irqsave(&port->lock, flags);
+
 	/* Disable the TX and RX */
 	writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS,
 			port->membase + CDNS_UART_CR_OFFSET);
@@ -775,15 +778,14 @@ static int cdns_uart_startup(struct uart_port *port)
 	writel(CDNS_UART_CR_TXRST | CDNS_UART_CR_RXRST,
 			port->membase + CDNS_UART_CR_OFFSET);
 
-	status = readl(port->membase + CDNS_UART_CR_OFFSET);
-
-	/* Clear the RX disable and TX disable bits and then set the TX enable
-	 * bit and RX enable bit to enable the transmitter and receiver.
+	/*
+	 * Clear the RX disable bit and then set the RX enable bit to enable
+	 * the receiver.
 	 */
-	writel((status & ~(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS))
-			| (CDNS_UART_CR_TX_EN | CDNS_UART_CR_RX_EN |
-			CDNS_UART_CR_STOPBRK),
-			port->membase + CDNS_UART_CR_OFFSET);
+	status = readl(port->membase + CDNS_UART_CR_OFFSET);
+	status &= CDNS_UART_CR_RX_DIS;
+	status |= CDNS_UART_CR_RX_EN;
+	writel(status, port->membase + CDNS_UART_CR_OFFSET);
 
 	/* Set the Mode Register with normal mode,8 data bits,1 stop bit,
 	 * no parity.
@@ -814,6 +816,8 @@ static int cdns_uart_startup(struct uart_port *port)
 		CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_TOUT,
 		port->membase + CDNS_UART_IER_OFFSET);
 
+	spin_unlock_irqrestore(&port->lock, flags);
+
 	return retval;
 }
 
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 6/8] tty: xuartps: Keep lock for whole ISR
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
                   ` (4 preceding siblings ...)
  2015-12-26 10:43 ` [PATCH LINUX v5 5/8] tty: xuartps: Improve startup function Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 7/8] tty: xuartps: Acquire port lock for shutdown Soren Brinkmann
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

The RX path in the interrupt handler released a lock unnecessarily.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/xilinx_uartps.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 6ffd3bbe3e18..ab3995d00973 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -265,9 +265,7 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
 			uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN,
 					data, status);
 		}
-		spin_unlock(&port->lock);
 		tty_flip_buffer_push(&port->state->port);
-		spin_lock(&port->lock);
 	}
 
 	/* Dispatch an appropriate handler */
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 7/8] tty: xuartps: Acquire port lock for shutdown
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
                   ` (5 preceding siblings ...)
  2015-12-26 10:43 ` [PATCH LINUX v5 6/8] tty: xuartps: Keep lock for whole ISR Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2015-12-26 10:43 ` [PATCH LINUX v5 8/8] tty: xuartps: Move RX path into helper function Soren Brinkmann
  2016-01-10  6:18 ` [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Peter Hurley
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Shutting down the UART port can happen while console operations are in
progress. Holding the port lock serializes these operations and avoids
the UART HW to be disabled in the middle of console prints.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/xilinx_uartps.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index ab3995d00973..f3ac69387b0a 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -826,6 +826,9 @@ static int cdns_uart_startup(struct uart_port *port)
 static void cdns_uart_shutdown(struct uart_port *port)
 {
 	int status;
+	unsigned long flags;
+
+	spin_lock_irqsave(&port->lock, flags);
 
 	/* Disable interrupts */
 	status = readl(port->membase + CDNS_UART_IMR_OFFSET);
@@ -835,6 +838,9 @@ static void cdns_uart_shutdown(struct uart_port *port)
 	/* Disable the TX and RX */
 	writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS,
 			port->membase + CDNS_UART_CR_OFFSET);
+
+	spin_unlock_irqrestore(&port->lock, flags);
+
 	free_irq(port->irq, port);
 }
 
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 8/8] tty: xuartps: Move RX path into helper function
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
                   ` (6 preceding siblings ...)
  2015-12-26 10:43 ` [PATCH LINUX v5 7/8] tty: xuartps: Acquire port lock for shutdown Soren Brinkmann
@ 2015-12-26 10:43 ` Soren Brinkmann
  2016-01-10  6:18 ` [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Peter Hurley
  8 siblings, 0 replies; 12+ messages in thread
From: Soren Brinkmann @ 2015-12-26 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Move RX-related IRQ handling into a helper function.
Fixes a problem where every char received after a parity or frame error
in the current isr will also be tagged as a parity or frame error.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
v4:
 - added Peter's additional information to the commit message (thx)
---
 drivers/tty/serial/xilinx_uartps.c | 50 +++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index f3ac69387b0a..db9e23eaf300 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -172,28 +172,8 @@ struct cdns_uart {
 #define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \
 		clk_rate_change_nb);
 
-/**
- * cdns_uart_isr - Interrupt handler
- * @irq: Irq number
- * @dev_id: Id of the port
- *
- * Return: IRQHANDLED
- */
-static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
+static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
 {
-	struct uart_port *port = (struct uart_port *)dev_id;
-	unsigned long flags;
-	unsigned int isrstatus, numbytes;
-	unsigned int data;
-	char status = TTY_NORMAL;
-
-	spin_lock_irqsave(&port->lock, flags);
-
-	/* Read the interrupt status register to determine which
-	 * interrupt(s) is/are active.
-	 */
-	isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET);
-
 	/*
 	 * There is no hardware break detection, so we interpret framing
 	 * error with all-zeros data as a break sequence. Most of the time,
@@ -223,6 +203,9 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
 		/* Receive Timeout Interrupt */
 		while (!(readl(port->membase + CDNS_UART_SR_OFFSET) &
 					CDNS_UART_SR_RXEMPTY)) {
+			u32 data;
+			char status = TTY_NORMAL;
+
 			data = readl(port->membase + CDNS_UART_FIFO_OFFSET);
 
 			/* Non-NULL byte after BREAK is garbage (99%) */
@@ -263,10 +246,33 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
 			}
 
 			uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN,
-					data, status);
+					 data, status);
 		}
 		tty_flip_buffer_push(&port->state->port);
 	}
+}
+
+/**
+ * cdns_uart_isr - Interrupt handler
+ * @irq: Irq number
+ * @dev_id: Id of the port
+ *
+ * Return: IRQHANDLED
+ */
+static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
+{
+	struct uart_port *port = (struct uart_port *)dev_id;
+	unsigned long flags;
+	unsigned int isrstatus, numbytes;
+
+	spin_lock_irqsave(&port->lock, flags);
+
+	/* Read the interrupt status register to determine which
+	 * interrupt(s) is/are active.
+	 */
+	isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET);
+
+	cdns_uart_handle_rx(port, isrstatus);
 
 	/* Dispatch an appropriate handler */
 	if ((isrstatus & CDNS_UART_IXR_TXEMPTY) == CDNS_UART_IXR_TXEMPTY) {
-- 
2.6.3.3.g9bb996a

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups
  2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
                   ` (7 preceding siblings ...)
  2015-12-26 10:43 ` [PATCH LINUX v5 8/8] tty: xuartps: Move RX path into helper function Soren Brinkmann
@ 2016-01-10  6:18 ` Peter Hurley
  2016-01-19  0:27   ` Sören Brinkmann
  8 siblings, 1 reply; 12+ messages in thread
From: Peter Hurley @ 2016-01-10  6:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/26/2015 02:43 AM, Soren Brinkmann wrote:
> Hi,
> 
> as requested by Peter, this is the first part of my series which has the
> patches reviewed by Peter. I'll submit the second part separately. There
> are no new changes within the patches.

Thanks. Looks good.

Regards,
Peter Hurley

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups
  2016-01-10  6:18 ` [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Peter Hurley
@ 2016-01-19  0:27   ` Sören Brinkmann
  2016-01-19  3:22     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 12+ messages in thread
From: Sören Brinkmann @ 2016-01-19  0:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 2016-01-09 at 10:18PM -0800, Peter Hurley wrote:
> On 12/26/2015 02:43 AM, Soren Brinkmann wrote:
> > Hi,
> > 
> > as requested by Peter, this is the first part of my series which has the
> > patches reviewed by Peter. I'll submit the second part separately. There
> > are no new changes within the patches.
> 
> Thanks. Looks good.

Thanks, Peter.

Greg, would you pick these up please? Or is anything missing?

	Thanks,
	S?ren

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups
  2016-01-19  0:27   ` Sören Brinkmann
@ 2016-01-19  3:22     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2016-01-19  3:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 18, 2016 at 04:27:51PM -0800, S?ren Brinkmann wrote:
> On Sat, 2016-01-09 at 10:18PM -0800, Peter Hurley wrote:
> > On 12/26/2015 02:43 AM, Soren Brinkmann wrote:
> > > Hi,
> > > 
> > > as requested by Peter, this is the first part of my series which has the
> > > patches reviewed by Peter. I'll submit the second part separately. There
> > > are no new changes within the patches.
> > 
> > Thanks. Looks good.
> 
> Thanks, Peter.
> 
> Greg, would you pick these up please? Or is anything missing?

I will, after the 4.5-rc1 kernel is out, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-01-19  3:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-26 10:43 [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 1/8] tty: xuartps: Beautify read-modify writes Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 2/8] tty: xuartps: Use spinlock to serialize HW access Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 3/8] tty: xuartps: Don't consider circular buffer when enabling transmitter Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 4/8] tty: xuartps: Clear interrupt status register in shutdown Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 5/8] tty: xuartps: Improve startup function Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 6/8] tty: xuartps: Keep lock for whole ISR Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 7/8] tty: xuartps: Acquire port lock for shutdown Soren Brinkmann
2015-12-26 10:43 ` [PATCH LINUX v5 8/8] tty: xuartps: Move RX path into helper function Soren Brinkmann
2016-01-10  6:18 ` [PATCH LINUX v5 0/8] tty: xuartps: Fix lock ups Peter Hurley
2016-01-19  0:27   ` Sören Brinkmann
2016-01-19  3:22     ` Greg Kroah-Hartman

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).