kernel: bump 4.14 to 4.14.41
[openwrt/openwrt.git] / target / linux / ath79 / patches-4.14 / 0015-MIPS-ath79-enable-uart-during-early_prink.patch
1 From b14f8260724abec6c82970085dece6a143d3a0db 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/27] MIPS: ath79: enable uart during early_prink
5
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
7 ---
8 arch/mips/ath79/early_printk.c | 44 +++++++++++++++++++++++++++++++++++++++++-
9 1 file changed, 43 insertions(+), 1 deletion(-)
10
11 --- a/arch/mips/ath79/early_printk.c
12 +++ b/arch/mips/ath79/early_printk.c
13 @@ -58,6 +58,46 @@ static void prom_putchar_dummy(unsigned
14 /* nothing to do */
15 }
16
17 +static void prom_enable_uart(u32 id)
18 +{
19 + void __iomem *gpio_base;
20 + u32 uart_en;
21 + u32 t;
22 +
23 + switch (id) {
24 + case REV_ID_MAJOR_AR71XX:
25 + uart_en = AR71XX_GPIO_FUNC_UART_EN;
26 + break;
27 +
28 + case REV_ID_MAJOR_AR7240:
29 + case REV_ID_MAJOR_AR7241:
30 + case REV_ID_MAJOR_AR7242:
31 + uart_en = AR724X_GPIO_FUNC_UART_EN;
32 + break;
33 +
34 + case REV_ID_MAJOR_AR913X:
35 + uart_en = AR913X_GPIO_FUNC_UART_EN;
36 + break;
37 +
38 + case REV_ID_MAJOR_AR9330:
39 + case REV_ID_MAJOR_AR9331:
40 + uart_en = AR933X_GPIO_FUNC_UART_EN;
41 + break;
42 +
43 + case REV_ID_MAJOR_AR9341:
44 + case REV_ID_MAJOR_AR9342:
45 + case REV_ID_MAJOR_AR9344:
46 + /* TODO */
47 + default:
48 + return;
49 + }
50 +
51 + gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
52 + t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
53 + t |= uart_en;
54 + __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
55 +}
56 +
57 static void prom_putchar_init(void)
58 {
59 void __iomem *base;
60 @@ -88,8 +128,10 @@ static void prom_putchar_init(void)
61
62 default:
63 _prom_putchar = prom_putchar_dummy;
64 - break;
65 + return;
66 }
67 +
68 + prom_enable_uart(id);
69 }
70
71 void prom_putchar(unsigned char ch)