[source] ar7: unbreak serial console

LEDE Commits lede-commits at lists.infradead.org
Sun Oct 29 15:41:10 PDT 2017


jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/be11b3b1c71945fbac359104a21d55f245800c7b

commit be11b3b1c71945fbac359104a21d55f245800c7b
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Sun Oct 29 23:12:20 2017 +0100

    ar7: unbreak serial console
    
    Serial output was broken since 3.16 for shared uarts between
    kernel and login. Fix this by adding a fix sent upstream.
    
    While at it, drop a useless patch that adds duplicate code.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 ...-ensure-the-port-type-s-FCR-value-is-used.patch | 48 ++++++++++++++++++++++
 .../linux/ar7/patches-3.18/500-serial_kludge.patch | 28 -------------
 .../linux/ar7/patches-3.18/950-cpmac_titan.patch   | 10 ++---
 3 files changed, 53 insertions(+), 33 deletions(-)

diff --git a/target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch b/target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch
new file mode 100644
index 0000000..f6a8754
--- /dev/null
+++ b/target/linux/ar7/patches-3.18/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch
@@ -0,0 +1,48 @@
+From ee6c9d41de084b2cefd90e5e0c9f30a35f6d3967 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski at gmail.com>
+Date: Sun, 29 Oct 2017 15:50:42 +0100
+Subject: [PATCH RFC 3/3] MIPS: AR7: ensure the port type's FCR value is used
+
+Since commit aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt
+trigger I/F of FIFO buffers"), the port's default FCR value isn't used
+in serial8250_do_set_termios anymore, but copied over once in
+serial8250_config_port and then modified as needed.
+
+Unfortunately, serial8250_config_port will never be called if the port
+is shared between kernel and userspace, and the port's flag doesn't have
+UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
+
+This causes garbled output from userspace:
+
+[    5.220000] random: procd urandom read with 49 bits of entropy available
+ers
+   [kee
+
+Fix this by forcing it to be configured on boot, resulting in the
+expected output:
+
+[    5.250000] random: procd urandom read with 50 bits of entropy available
+Press the [f] key and hit [enter] to enter failsafe mode
+Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
+
+Fixes: aef9a7bd9b67 ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
+Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
+---
+I'm not sure if this is just AR7's issue, or if this points to a general
+issue for UARTs used as kernel console and login console with the "fixed"
+commit.
+
+ arch/mips/ar7/platform.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/ar7/platform.c
++++ b/arch/mips/ar7/platform.c
+@@ -581,7 +581,7 @@ static int __init ar7_register_uarts(voi
+ 	uart_port.type		= PORT_AR7;
+ 	uart_port.uartclk	= clk_get_rate(bus_clk) / 2;
+ 	uart_port.iotype	= UPIO_MEM32;
+-	uart_port.flags		= UPF_FIXED_TYPE;
++	uart_port.flags		= UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF;
+ 	uart_port.regshift	= 2;
+ 
+ 	uart_port.line		= 0;
diff --git a/target/linux/ar7/patches-3.18/500-serial_kludge.patch b/target/linux/ar7/patches-3.18/500-serial_kludge.patch
deleted file mode 100644
index fc72530..0000000
--- a/target/linux/ar7/patches-3.18/500-serial_kludge.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- a/drivers/tty/serial/8250/8250_core.c
-+++ b/drivers/tty/serial/8250/8250_core.c
-@@ -329,6 +329,13 @@ static const struct serial8250_config ua
- 		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
- 		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
- 	},
-+	[PORT_AR7] = {
-+		.name		= "TI-AR7",
-+		.fifo_size	= 16,
-+		.tx_loadsz	= 16,
-+		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00,
-+		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
-+	},
- };
- 
- /* Uart divisor latch read */
-@@ -3168,7 +3175,11 @@ static void serial8250_console_putchar(s
- {
- 	struct uart_8250_port *up = up_to_u8250p(port);
- 
-+#ifdef CONFIG_AR7
-+	wait_for_xmitr(up, BOTH_EMPTY);
-+#else
- 	wait_for_xmitr(up, UART_LSR_THRE);
-+#endif
- 	serial_port_out(port, UART_TX, ch);
- }
- 
diff --git a/target/linux/ar7/patches-3.18/950-cpmac_titan.patch b/target/linux/ar7/patches-3.18/950-cpmac_titan.patch
index f1d432c..3cabae0 100644
--- a/target/linux/ar7/patches-3.18/950-cpmac_titan.patch
+++ b/target/linux/ar7/patches-3.18/950-cpmac_titan.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/ethernet/ti/cpmac.c
 +++ b/drivers/net/ethernet/ti/cpmac.c
-@@ -1146,6 +1146,8 @@ static int cpmac_probe(struct platform_d
+@@ -1147,6 +1147,8 @@ static int cpmac_probe(struct platform_d
  		goto out;
  	}
  
@@ -9,7 +9,7 @@
  	dev->irq = platform_get_irq_byname(pdev, "irq");
  
  	dev->netdev_ops = &cpmac_netdev_ops;
-@@ -1227,7 +1229,7 @@ int cpmac_init(void)
+@@ -1228,7 +1230,7 @@ int cpmac_init(void)
  	cpmac_mii->reset = cpmac_mdio_reset;
  	cpmac_mii->irq = mii_irqs;
  
@@ -18,8 +18,8 @@
  
  	if (!cpmac_mii->priv) {
  		pr_err("Can't ioremap mdio registers\n");
-@@ -1238,10 +1240,16 @@ int cpmac_init(void)
- #warning FIXME: unhardcode gpio&reset bits
+@@ -1239,10 +1241,16 @@ int cpmac_init(void)
+ 	/* FIXME: unhardcode gpio&reset bits */
  	ar7_gpio_disable(26);
  	ar7_gpio_disable(27);
 -	ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
@@ -37,7 +37,7 @@
  	cpmac_mii->reset(cpmac_mii);
  
  	for (i = 0; i < 300; i++) {
-@@ -1258,7 +1266,11 @@ int cpmac_init(void)
+@@ -1259,7 +1267,11 @@ int cpmac_init(void)
  		mask = 0;
  	}
  



More information about the lede-commits mailing list