Skip to contentSkip to conversation

BUG: atmel_serial: Interrupts not disabled on close

PATCH In review Richard Genoud 4 participants 4 messages Sep 12, 2016 – Sep 15, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BUG: atmel_serial: Interrupts not disabled on close

Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), interrupts from GPIOs are not disabled any more when the serial port is closed, leading to an oops when the one of the input pin is toggled (CTS/DSR/DCD/RNG).

This is only the case if those pins are used as GPIOs, i.e. declared like that:

usart1: serial at f8020000 {
        /* CTS and DTS will be handled by GPIO */
        status = "okay";
        rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
        cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
        dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
        dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
        rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
        dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
};

That's because modem interrupts used to be freed in atmel_shutdown(). After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), this code was just removed.
Calling atmel_disable_ms() disables the interrupts and everything works fine again.

Tested on at91sam9g35-cm

(This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will be sent after this one is applied.)

Fixes 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")
---
 drivers/tty/serial/atmel_serial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/atmel_serial.c +3 -2
index 2eaa18ddef61..8bbde52db376 100644
@@ -1929,6 +1929,9 @@ static void atmel_shutdown(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
+	/* Disable modem control lines interrupts */
+	atmel_disable_ms(port);
+
 	/* Disable interrupts at device level */
 	atmel_uart_writel(port, ATMEL_US_IDR, -1);
 
@@ -1979,8 +1982,6 @@ static void atmel_shutdown(struct uart_port *port)
 	 */
 	free_irq(port->irq, port);
 
-	atmel_port->ms_irq_enabled = false;
-
 	atmel_flush_buffer(port);
 }
 
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · Richard Genoud

Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), interrupts from GPIOs are not disabled any more when the serial port is closed, leading to an oops when the one of the input pin is toggled (CTS/DSR/DCD/RNG).

This is only the case if those pins are used as GPIOs, i.e. declared like that:

usart1: serial at f8020000 {
        /* CTS and DTS will be handled by GPIO */
        status = "okay";
        rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
        cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
        dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
        dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
        rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
        dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
};

That's because modem interrupts used to be freed in atmel_shutdown(). After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), this code was just removed.
Calling atmel_disable_ms() disables the interrupts and everything works fine again.

Quoted 4 lines

Tested on at91sam9g35-cm

(This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will be sent after this one is applied.)

AFAIK this is no reason to not put stable on Cc. If then $stablemaintainer fails to backport the change, he will contact you.

Quoted 2 lines
Fixes 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")

Thanks for caring
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Acked-by on v1 1/1
#2 lore raw
In reply to Richard Genoud

Le 12/09/2016 ? 15:34, Richard Genoud a ?crit :

Quoted 24 lines

Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), interrupts from GPIOs are not disabled any more when the serial port is closed, leading to an oops when the one of the input pin is toggled (CTS/DSR/DCD/RNG).

This is only the case if those pins are used as GPIOs, i.e. declared like that:

usart1: serial at f8020000 {
        /* CTS and DTS will be handled by GPIO */
        status = "okay";
        rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
        cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
        dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
        dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
        rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
        dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
};

That's because modem interrupts used to be freed in atmel_shutdown(). After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), this code was just removed.
Calling atmel_disable_ms() disables the interrupts and everything works fine again.

Quoted 7 lines

Tested on at91sam9g35-cm

(This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will be sent after this one is applied.)

Fixes 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")

I thinks it's a bit late for "4.8-fixes".

Greg, tell me if you want that I add the Cc: stable tag to this patch (as advised by Uwe) and re-send?

Thanks Richard!

Best regards,

Quoted 28 lines
---
 drivers/tty/serial/atmel_serial.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/atmel_serial.c +3 -2
index 2eaa18ddef61..8bbde52db376 100644
@@ -1929,6 +1929,9 @@ static void atmel_shutdown(struct uart_port *port)
 {
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
+	/* Disable modem control lines interrupts */
+	atmel_disable_ms(port);
+
 	/* Disable interrupts at device level */
 	atmel_uart_writel(port, ATMEL_US_IDR, -1);
 
@@ -1979,8 +1982,6 @@ static void atmel_shutdown(struct uart_port *port)
 	 */
 	free_irq(port->irq, port);
 
-	atmel_port->ms_irq_enabled = false;
-
 	atmel_flush_buffer(port);
 }
 
Signature · 1 line
Nicolas Ferre
#3 lore raw
Quoted 30 lines · Nicolas Ferre
Quoted 29 lines · Richard Genoud

Since commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), interrupts from GPIOs are not disabled any more when the serial port is closed, leading to an oops when the one of the input pin is toggled (CTS/DSR/DCD/RNG).

This is only the case if those pins are used as GPIOs, i.e. declared like that:

usart1: serial@f8020000 {
        /* CTS and DTS will be handled by GPIO */
        status = "okay";
        rts-gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
        cts-gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
        dtr-gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
        dsr-gpios = <&pioC 31 GPIO_ACTIVE_LOW>;
        rng-gpios = <&pioB 12 GPIO_ACTIVE_LOW>;
        dcd-gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
};

That's because modem interrupts used to be freed in atmel_shutdown(). After commit 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio"), this code was just removed.
Calling atmel_disable_ms() disables the interrupts and everything works fine again.

Tested on at91sam9g35-cm

(This patch doesn't apply on -stable kernels, fixes for 4.4 and 4.7 will be sent after this one is applied.)

Quoted 7 lines
Quoted 2 lines
Fixes 18dfef9c7f87 ("serial: atmel: convert to irq handling provided mctrl-gpio")

I thinks it's a bit late for "4.8-fixes".

Greg, tell me if you want that I add the Cc: stable tag to this patch (as advised by Uwe) and re-send?

I'll add it, no worries.

greg k-h