2 * Copyright (C) 2015-2016 Wills Wang <wills.wang@live.com>
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <asm/addrspace.h>
10 #include <asm/types.h>
11 #include <mach/ar71xx_regs.h>
13 #include <mach/ath79.h>
14 #include <debug_uart.h>
16 DECLARE_GLOBAL_DATA_PTR
;
18 #ifdef CONFIG_DEBUG_UART_BOARD_INIT
19 void board_debug_uart_init(void)
24 regs
= map_physmem(AR71XX_GPIO_BASE
, AR71XX_GPIO_SIZE
,
28 * GPIO9 as input, GPIO10 as output
30 val
= readl(regs
+ AR71XX_GPIO_REG_OE
);
31 val
&= ~AR933X_GPIO(9);
32 val
|= AR933X_GPIO(10);
33 writel(val
, regs
+ AR71XX_GPIO_REG_OE
);
36 * Enable UART, GPIO9 as UART_SI, GPIO10 as UART_SO
38 val
= readl(regs
+ AR71XX_GPIO_REG_FUNC
);
39 val
|= AR933X_GPIO_FUNC_UART_EN
| AR933X_GPIO_FUNC_RES_TRUE
;
40 writel(val
, regs
+ AR71XX_GPIO_REG_FUNC
);
44 int board_early_init_f(void)