ath79: etactica-eg200: fix restore button
[openwrt/openwrt.git] / target / linux / ath79 / patches-4.14 / 0015-MIPS-ath79-enable-uart-during-early_prink.patch
1 From f55a400f4a691f3750eaf7bfcd6ecbf7ed1622f0 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 5 Mar 2018 11:38:21 +0100
4 Subject: [PATCH 15/33] MIPS: ath79: enable uart during early_prink
5
6 This patch ensures, that the poinmux register is properly setup for the
7 boot console uart when early_printk is enabled.
8
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Signed-off-by: John Crispin <john@phrozen.org>
11 ---
12 arch/mips/ath79/early_printk.c | 44 +++++++++++++++++++++++++++++++++++++++++-
13 1 file changed, 43 insertions(+), 1 deletion(-)
14
15 --- a/arch/mips/ath79/early_printk.c
16 +++ b/arch/mips/ath79/early_printk.c
17 @@ -58,6 +58,46 @@ static void prom_putchar_dummy(unsigned
18 /* nothing to do */
19 }
20
21 +static void prom_enable_uart(u32 id)
22 +{
23 + void __iomem *gpio_base;
24 + u32 uart_en;
25 + u32 t;
26 +
27 + switch (id) {
28 + case REV_ID_MAJOR_AR71XX:
29 + uart_en = AR71XX_GPIO_FUNC_UART_EN;
30 + break;
31 +
32 + case REV_ID_MAJOR_AR7240:
33 + case REV_ID_MAJOR_AR7241:
34 + case REV_ID_MAJOR_AR7242:
35 + uart_en = AR724X_GPIO_FUNC_UART_EN;
36 + break;
37 +
38 + case REV_ID_MAJOR_AR913X:
39 + uart_en = AR913X_GPIO_FUNC_UART_EN;
40 + break;
41 +
42 + case REV_ID_MAJOR_AR9330:
43 + case REV_ID_MAJOR_AR9331:
44 + uart_en = AR933X_GPIO_FUNC_UART_EN;
45 + break;
46 +
47 + case REV_ID_MAJOR_AR9341:
48 + case REV_ID_MAJOR_AR9342:
49 + case REV_ID_MAJOR_AR9344:
50 + /* TODO */
51 + default:
52 + return;
53 + }
54 +
55 + gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
56 + t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
57 + t |= uart_en;
58 + __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
59 +}
60 +
61 static void prom_putchar_init(void)
62 {
63 void __iomem *base;
64 @@ -92,8 +132,10 @@ static void prom_putchar_init(void)
65
66 default:
67 _prom_putchar = prom_putchar_dummy;
68 - break;
69 + return;
70 }
71 +
72 + prom_enable_uart(id);
73 }
74
75 void prom_putchar(unsigned char ch)