ath79: add new OF only target for QCA MIPS silicon
[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 diff --git a/arch/mips/ath79/early_printk.c b/arch/mips/ath79/early_printk.c
12 index d1adc59af5bf..ec3978678653 100644
13 --- a/arch/mips/ath79/early_printk.c
14 +++ b/arch/mips/ath79/early_printk.c
15 @@ -58,6 +58,46 @@ static void prom_putchar_dummy(unsigned char ch)
16 /* nothing to do */
17 }
18
19 +static void prom_enable_uart(u32 id)
20 +{
21 + void __iomem *gpio_base;
22 + u32 uart_en;
23 + u32 t;
24 +
25 + switch (id) {
26 + case REV_ID_MAJOR_AR71XX:
27 + uart_en = AR71XX_GPIO_FUNC_UART_EN;
28 + break;
29 +
30 + case REV_ID_MAJOR_AR7240:
31 + case REV_ID_MAJOR_AR7241:
32 + case REV_ID_MAJOR_AR7242:
33 + uart_en = AR724X_GPIO_FUNC_UART_EN;
34 + break;
35 +
36 + case REV_ID_MAJOR_AR913X:
37 + uart_en = AR913X_GPIO_FUNC_UART_EN;
38 + break;
39 +
40 + case REV_ID_MAJOR_AR9330:
41 + case REV_ID_MAJOR_AR9331:
42 + uart_en = AR933X_GPIO_FUNC_UART_EN;
43 + break;
44 +
45 + case REV_ID_MAJOR_AR9341:
46 + case REV_ID_MAJOR_AR9342:
47 + case REV_ID_MAJOR_AR9344:
48 + /* TODO */
49 + default:
50 + return;
51 + }
52 +
53 + gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
54 + t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
55 + t |= uart_en;
56 + __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
57 +}
58 +
59 static void prom_putchar_init(void)
60 {
61 void __iomem *base;
62 @@ -88,8 +128,10 @@ static void prom_putchar_init(void)
63
64 default:
65 _prom_putchar = prom_putchar_dummy;
66 - break;
67 + return;
68 }
69 +
70 + prom_enable_uart(id);
71 }
72
73 void prom_putchar(unsigned char ch)
74 --
75 2.11.0
76