* FAILED: patch "[PATCH] tty/serial: atmel: fix out of range clock divider handling" failed to apply to 4.19-stable tree
@ 2019-12-29 15:45 gregkh
2020-01-02 0:47 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2019-12-29 15:45 UTC (permalink / raw)
To: david.engraf, gregkh, ludovic.desroches, richard.genoud, stable; +Cc: stable
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From cb47b9f8630ae3fa3f5fbd0c7003faba7abdf711 Mon Sep 17 00:00:00 2001
From: David Engraf <david.engraf@sysgo.com>
Date: Mon, 16 Dec 2019 09:54:03 +0100
Subject: [PATCH] tty/serial: atmel: fix out of range clock divider handling
Use MCK_DIV8 when the clock divider is > 65535. Unfortunately the mode
register was already written thus the clock selection is ignored.
Fix by doing the baud rate calulation before setting the mode.
Fixes: 5bf5635ac170 ("tty/serial: atmel: add fractional baud rate support")
Signed-off-by: David Engraf <david.engraf@sysgo.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191216085403.17050-1-david.engraf@sysgo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index a8dc8af83f39..1ba9bc667e13 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2270,27 +2270,6 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
mode |= ATMEL_US_USMODE_NORMAL;
}
- /* set the mode, clock divisor, parity, stop bits and data size */
- atmel_uart_writel(port, ATMEL_US_MR, mode);
-
- /*
- * when switching the mode, set the RTS line state according to the
- * new mode, otherwise keep the former state
- */
- if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) {
- unsigned int rts_state;
-
- if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) {
- /* let the hardware control the RTS line */
- rts_state = ATMEL_US_RTSDIS;
- } else {
- /* force RTS line to low level */
- rts_state = ATMEL_US_RTSEN;
- }
-
- atmel_uart_writel(port, ATMEL_US_CR, rts_state);
- }
-
/*
* Set the baud rate:
* Fractional baudrate allows to setup output frequency more
@@ -2317,6 +2296,28 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
if (!(port->iso7816.flags & SER_ISO7816_ENABLED))
atmel_uart_writel(port, ATMEL_US_BRGR, quot);
+
+ /* set the mode, clock divisor, parity, stop bits and data size */
+ atmel_uart_writel(port, ATMEL_US_MR, mode);
+
+ /*
+ * when switching the mode, set the RTS line state according to the
+ * new mode, otherwise keep the former state
+ */
+ if ((old_mode & ATMEL_US_USMODE) != (mode & ATMEL_US_USMODE)) {
+ unsigned int rts_state;
+
+ if ((mode & ATMEL_US_USMODE) == ATMEL_US_USMODE_HWHS) {
+ /* let the hardware control the RTS line */
+ rts_state = ATMEL_US_RTSDIS;
+ } else {
+ /* force RTS line to low level */
+ rts_state = ATMEL_US_RTSEN;
+ }
+
+ atmel_uart_writel(port, ATMEL_US_CR, rts_state);
+ }
+
atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN);
atmel_port->tx_stopped = false;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] tty/serial: atmel: fix out of range clock divider handling" failed to apply to 4.19-stable tree
2019-12-29 15:45 FAILED: patch "[PATCH] tty/serial: atmel: fix out of range clock divider handling" failed to apply to 4.19-stable tree gregkh
@ 2020-01-02 0:47 ` Sasha Levin
2020-01-02 9:52 ` Richard Genoud
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2020-01-02 0:47 UTC (permalink / raw)
To: gregkh; +Cc: david.engraf, ludovic.desroches, richard.genoud, stable
On Sun, Dec 29, 2019 at 04:45:59PM +0100, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.19-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From cb47b9f8630ae3fa3f5fbd0c7003faba7abdf711 Mon Sep 17 00:00:00 2001
>From: David Engraf <david.engraf@sysgo.com>
>Date: Mon, 16 Dec 2019 09:54:03 +0100
>Subject: [PATCH] tty/serial: atmel: fix out of range clock divider handling
>
>Use MCK_DIV8 when the clock divider is > 65535. Unfortunately the mode
>register was already written thus the clock selection is ignored.
>
>Fix by doing the baud rate calulation before setting the mode.
>
>Fixes: 5bf5635ac170 ("tty/serial: atmel: add fractional baud rate support")
>Signed-off-by: David Engraf <david.engraf@sysgo.com>
>Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>Acked-by: Richard Genoud <richard.genoud@gmail.com>
>Cc: stable <stable@vger.kernel.org>
>Link: https://lore.kernel.org/r/20191216085403.17050-1-david.engraf@sysgo.com
>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixed up context due to missing 377fedd1866a ("tty/serial: atmel: add ISO7816
support"), queued for 4.19-4.9.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] tty/serial: atmel: fix out of range clock divider handling" failed to apply to 4.19-stable tree
2020-01-02 0:47 ` Sasha Levin
@ 2020-01-02 9:52 ` Richard Genoud
0 siblings, 0 replies; 3+ messages in thread
From: Richard Genoud @ 2020-01-02 9:52 UTC (permalink / raw)
To: Sasha Levin, gregkh; +Cc: david.engraf, ludovic.desroches, stable
Le 02/01/2020 à 01:47, Sasha Levin a écrit :
> On Sun, Dec 29, 2019 at 04:45:59PM +0100, gregkh@linuxfoundation.org wrote:
>>
>> The patch below does not apply to the 4.19-stable tree.
>> If someone wants it applied there, or to any other stable or longterm
>> tree, then please email the backport, including the original git commit
>> id to <stable@vger.kernel.org>.
>>
>> thanks,
>>
>> greg k-h
>>
>> ------------------ original commit in Linus's tree ------------------
>>
>> From cb47b9f8630ae3fa3f5fbd0c7003faba7abdf711 Mon Sep 17 00:00:00 2001
>> From: David Engraf <david.engraf@sysgo.com>
>> Date: Mon, 16 Dec 2019 09:54:03 +0100
>> Subject: [PATCH] tty/serial: atmel: fix out of range clock divider
>> handling
>>
>> Use MCK_DIV8 when the clock divider is > 65535. Unfortunately the mode
>> register was already written thus the clock selection is ignored.
>>
>> Fix by doing the baud rate calulation before setting the mode.
>>
>> Fixes: 5bf5635ac170 ("tty/serial: atmel: add fractional baud rate
>> support")
>> Signed-off-by: David Engraf <david.engraf@sysgo.com>
>> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>> Acked-by: Richard Genoud <richard.genoud@gmail.com>
>> Cc: stable <stable@vger.kernel.org>
>> Link:
>> https://lore.kernel.org/r/20191216085403.17050-1-david.engraf@sysgo.com
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> Fixed up context due to missing 377fedd1866a ("tty/serial: atmel: add
> ISO7816
> support"), queued for 4.19-4.9.
>
Thanks for taking care of this Sacha !
regards,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-02 9:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-29 15:45 FAILED: patch "[PATCH] tty/serial: atmel: fix out of range clock divider handling" failed to apply to 4.19-stable tree gregkh
2020-01-02 0:47 ` Sasha Levin
2020-01-02 9:52 ` Richard Genoud
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.