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
6 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
8 arch/mips/ath79/early_printk.c | 44 +++++++++++++++++++++++++++++++++++++++++-
9 1 file changed, 43 insertions(+), 1 deletion(-)
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)
19 +static void prom_enable_uart(u32 id)
21 + void __iomem *gpio_base;
26 + case REV_ID_MAJOR_AR71XX:
27 + uart_en = AR71XX_GPIO_FUNC_UART_EN;
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;
36 + case REV_ID_MAJOR_AR913X:
37 + uart_en = AR913X_GPIO_FUNC_UART_EN;
40 + case REV_ID_MAJOR_AR9330:
41 + case REV_ID_MAJOR_AR9331:
42 + uart_en = AR933X_GPIO_FUNC_UART_EN;
45 + case REV_ID_MAJOR_AR9341:
46 + case REV_ID_MAJOR_AR9342:
47 + case REV_ID_MAJOR_AR9344:
53 + gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
54 + t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
56 + __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
59 static void prom_putchar_init(void)
62 @@ -88,8 +128,10 @@ static void prom_putchar_init(void)
65 _prom_putchar = prom_putchar_dummy;
70 + prom_enable_uart(id);
73 void prom_putchar(unsigned char ch)