Kever Yang | 7f3eec0 | 2019-03-29 09:09:00 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C) Copyright 2019 Rockchip Electronics Co., Ltd |
| 4 | */ |
| 5 | #include <asm/io.h> |
| 6 | #include <asm/arch-rockchip/grf_rk3036.h> |
| 7 | #include <asm/arch-rockchip/hardware.h> |
| 8 | |
| 9 | #ifdef CONFIG_DEBUG_UART_BOARD_INIT |
| 10 | void board_debug_uart_init(void) |
| 11 | { |
| 12 | #define GRF_BASE 0x20008000 |
| 13 | struct rk3036_grf * const grf = (void *)GRF_BASE; |
| 14 | enum { |
| 15 | GPIO1C3_SHIFT = 6, |
| 16 | GPIO1C3_MASK = 3 << GPIO1C3_SHIFT, |
| 17 | GPIO1C3_GPIO = 0, |
| 18 | GPIO1C3_MMC0_D1, |
| 19 | GPIO1C3_UART2_SOUT, |
| 20 | |
| 21 | GPIO1C2_SHIFT = 4, |
| 22 | GPIO1C2_MASK = 3 << GPIO1C2_SHIFT, |
| 23 | GPIO1C2_GPIO = 0, |
| 24 | GPIO1C2_MMC0_D0, |
| 25 | GPIO1C2_UART2_SIN, |
| 26 | }; |
| 27 | /* |
| 28 | * NOTE: sd card and debug uart use same iomux in rk3036, |
| 29 | * so if you enable uart, |
| 30 | * you can not boot from sdcard |
| 31 | */ |
| 32 | rk_clrsetreg(&grf->gpio1c_iomux, |
| 33 | GPIO1C3_MASK << GPIO1C3_SHIFT | |
| 34 | GPIO1C2_MASK << GPIO1C2_SHIFT, |
| 35 | GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT | |
| 36 | GPIO1C2_UART2_SIN << GPIO1C2_SHIFT); |
| 37 | } |
| 38 | #endif |