blob: 933484e0df91fa1eac27572ca4fa772305562548 [file] [log] [blame]
Kever Yang0a2a5e12019-03-29 09:09:01 +08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd
4 */
5#include <common.h>
6#include <asm/io.h>
7#include <asm/arch-rockchip/grf_rk3188.h>
8#include <asm/arch-rockchip/hardware.h>
9
10#ifdef CONFIG_DEBUG_UART_BOARD_INIT
11void board_debug_uart_init(void)
12{
13 /* Enable early UART on the RK3188 */
14#define GRF_BASE 0x20008000
15 struct rk3188_grf * const grf = (void *)GRF_BASE;
16 enum {
17 GPIO1B1_SHIFT = 2,
18 GPIO1B1_MASK = 3,
19 GPIO1B1_GPIO = 0,
20 GPIO1B1_UART2_SOUT,
21 GPIO1B1_JTAG_TDO,
22
23 GPIO1B0_SHIFT = 0,
24 GPIO1B0_MASK = 3,
25 GPIO1B0_GPIO = 0,
26 GPIO1B0_UART2_SIN,
27 GPIO1B0_JTAG_TDI,
28 };
29
30 rk_clrsetreg(&grf->gpio1b_iomux,
31 GPIO1B1_MASK << GPIO1B1_SHIFT |
32 GPIO1B0_MASK << GPIO1B0_SHIFT,
33 GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT |
34 GPIO1B0_UART2_SIN << GPIO1B0_SHIFT);
35}
36#endif