aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2018-11-01 17:57:55 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2018-12-15 12:50:06 +0100
commit52a82ce3dd901a1536c7d7d9d963e9c2d761c816 (patch)
tree79020fb59420fcea7bdc4b12272f7251e101fe64 /target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch
parenta272af75cd8c67d265400f96c1e6bb172315c23c (diff)
downloadupstream-52a82ce3dd901a1536c7d7d9d963e9c2d761c816.tar.gz
upstream-52a82ce3dd901a1536c7d7d9d963e9c2d761c816.tar.bz2
upstream-52a82ce3dd901a1536c7d7d9d963e9c2d761c816.zip
kernel: Copy patches from kernel 4.14 to 4.19
This just copies the files from the kernel 4.14 specific folders into the kernel 4.19 specific folder, no changes are done to the files in this commit. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch')
-rw-r--r--target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch b/target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch
new file mode 100644
index 0000000000..869bf7b9b2
--- /dev/null
+++ b/target/linux/generic/pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch
@@ -0,0 +1,76 @@
+From 24d5ba8ad40c3ac7903f688580c345aafa764dc7 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel@makrotopia.org>
+Date: Mon, 4 Jun 2018 14:51:29 +0200
+Subject: [PATCH] tty: serial: exar: generalize rs485 setup
+To: linux-serial@vger.kernel.org,
+ Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Linus Walleij <linus.walleij@linaro.org>,
+ Jan Kiszka <jan.kiszka@siemens.com>
+
+Move the non-board-specific part of the RS485 initialization
+from iot2040_rs485_config function to a new generic function
+used also for other boards.
+This allows using PCIe boards which are hard-wired to RS485
+or have jumpers for their configurations.
+
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+---
+ drivers/tty/serial/8250/8250_exar.c | 38 +++++++++++++++++++----------
+ 1 file changed, 25 insertions(+), 13 deletions(-)
+
+--- a/drivers/tty/serial/8250/8250_exar.c
++++ b/drivers/tty/serial/8250/8250_exar.c
+@@ -275,8 +275,32 @@ static int xr17v35x_register_gpio(struct
+ return 0;
+ }
+
++static int generic_rs485_config(struct uart_port *port,
++ struct serial_rs485 *rs485)
++{
++ bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED);
++ u8 __iomem *p = port->membase;
++ u8 value;
++
++ value = readb(p + UART_EXAR_FCTR);
++ if (is_rs485)
++ value |= UART_FCTR_EXAR_485;
++ else
++ value &= ~UART_FCTR_EXAR_485;
++
++ writeb(value, p + UART_EXAR_FCTR);
++
++ if (is_rs485)
++ writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR);
++
++ port->rs485 = *rs485;
++
++ return 0;
++}
++
+ static const struct exar8250_platform exar8250_default_platform = {
+ .register_gpio = xr17v35x_register_gpio,
++ .rs485_config = generic_rs485_config,
+ };
+
+ static int iot2040_rs485_config(struct uart_port *port,
+@@ -309,19 +333,7 @@ static int iot2040_rs485_config(struct u
+ value |= mode;
+ writeb(value, p + UART_EXAR_MPIOLVL_7_0);
+
+- value = readb(p + UART_EXAR_FCTR);
+- if (is_rs485)
+- value |= UART_FCTR_EXAR_485;
+- else
+- value &= ~UART_FCTR_EXAR_485;
+- writeb(value, p + UART_EXAR_FCTR);
+-
+- if (is_rs485)
+- writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR);
+-
+- port->rs485 = *rs485;
+-
+- return 0;
++ return generic_rs485_config(port, rs485);
+ }
+
+ static const struct property_entry iot2040_gpio_properties[] = {