lantiq: change xrx200 ethernet driver WRED signal to global to fix spurious packet...
[openwrt/openwrt.git] / target / linux / ar71xx / patches-4.4 / 003-MIPS-ath79-make-bootconsole-wait-for-both-THRE-and-T.patch
1 From f1ba020af5076172c9d29006a747ccf40027fedc Mon Sep 17 00:00:00 2001
2 Message-Id: <f1ba020af5076172c9d29006a747ccf40027fedc.1458840219.git.mschiffer@universe-factory.net>
3 From: Matthias Schiffer <mschiffer@universe-factory.net>
4 Date: Thu, 24 Mar 2016 15:34:05 +0100
5 Subject: [PATCH] MIPS: ath79: make bootconsole wait for both THRE and TEMT
6
7 This makes the ath79 bootconsole behave the same way as the generic 8250
8 bootconsole.
9
10 Also waiting for TEMT (transmit buffer is empty) instead of just THRE
11 (transmit buffer is not full) ensures that all characters have been
12 transmitted before the real serial driver starts reconfiguring the serial
13 controller (which would sometimes result in garbage being transmitted.)
14 This change does not cause a visible performance loss.
15
16 In addition, this seems to fix a hang observed in certain configurations on
17 many AR7xxx/AR9xxx SoCs during autoconfig of the real serial driver.
18
19 A more complete follow-up patch will disable 8250 autoconfig for ath79
20 altogether (the serial controller is detected as a 16550A, which is not
21 fully compatible with the ath79 serial, and the autoconfig may lead to
22 undefined behavior on ath79.)
23
24 Cc: <stable@vger.kernel.org>
25 Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
26 ---
27 arch/mips/ath79/early_printk.c | 6 ++++--
28 1 file changed, 4 insertions(+), 2 deletions(-)
29
30 --- a/arch/mips/ath79/early_printk.c
31 +++ b/arch/mips/ath79/early_printk.c
32 @@ -31,13 +31,15 @@ static inline void prom_putchar_wait(voi
33 } while (1);
34 }
35
36 +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
37 +
38 static void prom_putchar_ar71xx(unsigned char ch)
39 {
40 void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
41
42 - prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE);
43 + prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
44 __raw_writel(ch, base + UART_TX * 4);
45 - prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE);
46 + prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
47 }
48
49 static void prom_putchar_ar933x(unsigned char ch)