From 1785544ded4dd4fdbcc17aef462482a6cb196dbc Mon Sep 17 00:00:00 2001 From: acoul Date: Thu, 31 Mar 2016 21:58:04 +0300 Subject: [PATCH] linux/ar71xx: add an ath79_serial upstream patch --- .../patches-4.1/999_ath79_serial_fix.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 target/linux/ar71xx/patches-4.1/999_ath79_serial_fix.patch diff --git a/target/linux/ar71xx/patches-4.1/999_ath79_serial_fix.patch b/target/linux/ar71xx/patches-4.1/999_ath79_serial_fix.patch new file mode 100644 index 0000000000..d80523491c --- /dev/null +++ b/target/linux/ar71xx/patches-4.1/999_ath79_serial_fix.patch @@ -0,0 +1,47 @@ +This makes the ath79 bootconsole behave the same way as the generic 8250 +bootconsole. + +Also waiting for TEMT (transmit buffer is empty) instead of just THRE +(transmit buffer is not full) ensures that all characters have been +transmitted before the real serial driver starts reconfiguring the serial +controller (which would sometimes result in garbage being transmitted.) +This change does not cause a visible performance loss. + +In addition, this seems to fix a hang observed in certain configurations on +many AR7xxx/AR9xxx SoCs during autoconfig of the real serial driver. + +A more complete follow-up patch will disable 8250 autoconfig for ath79 +altogether (the serial controller is detected as a 16550A, which is not +fully compatible with the ath79 serial, and the autoconfig may lead to +undefined behavior on ath79.) + +Cc: +Signed-off-by: Matthias Schiffer +--- + arch/mips/ath79/early_printk.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/mips/ath79/early_printk.c b/arch/mips/ath79/early_printk.c +index b955faf..d1adc59 100644 +--- a/arch/mips/ath79/early_printk.c ++++ b/arch/mips/ath79/early_printk.c +@@ -31,13 +31,15 @@ static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val) + } while (1); + } + ++#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) ++ + static void prom_putchar_ar71xx(unsigned char ch) + { + void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE)); + +- prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); ++ prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); + __raw_writel(ch, base + UART_TX * 4); +- prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); ++ prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); + } + + static void prom_putchar_ar933x(unsigned char ch) +-- +2.7.4 -- 2.35.1