Commit 7f3eec03d59a0532579ba364e0ba1381feafb814
Committed by
Philipp Tomsich
1 parent
2b2ff1bd87
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
rockchip: rk3036: add board_debug_uart_init()
Use board_debug_uart_init() for UART iomux init instead of do it in board_init_f, and move the function to soc file so that we can find all the soc/board setting in soc file and use a common board file. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> [Fixed whitespace error:] Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Showing 4 changed files with 40 additions and 20 deletions Side-by-side Diff
arch/arm/mach-rockchip/rk3036-board-spl.c
... | ... | @@ -7,30 +7,12 @@ |
7 | 7 | #include <debug_uart.h> |
8 | 8 | #include <asm/io.h> |
9 | 9 | #include <asm/arch-rockchip/bootrom.h> |
10 | -#include <asm/arch-rockchip/grf_rk3036.h> | |
11 | -#include <asm/arch-rockchip/hardware.h> | |
12 | 10 | #include <asm/arch-rockchip/sdram_rk3036.h> |
13 | 11 | #include <asm/arch-rockchip/timer.h> |
14 | -#include <asm/arch-rockchip/uart.h> | |
15 | 12 | |
16 | -#define GRF_BASE 0x20008000 | |
17 | - | |
18 | -#define DEBUG_UART_BASE 0x20068000 | |
19 | - | |
20 | 13 | void board_init_f(ulong dummy) |
21 | 14 | { |
22 | -#ifdef EARLY_DEBUG | |
23 | - struct rk3036_grf * const grf = (void *)GRF_BASE; | |
24 | - /* | |
25 | - * NOTE: sd card and debug uart use same iomux in rk3036, | |
26 | - * so if you enable uart, | |
27 | - * you can not boot from sdcard | |
28 | - */ | |
29 | - rk_clrsetreg(&grf->gpio1c_iomux, | |
30 | - GPIO1C3_MASK << GPIO1C3_SHIFT | | |
31 | - GPIO1C2_MASK << GPIO1C2_SHIFT, | |
32 | - GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT | | |
33 | - GPIO1C2_UART2_SIN << GPIO1C2_SHIFT); | |
15 | +#ifdef CONFIG_DEBUG_UART | |
34 | 16 | debug_uart_init(); |
35 | 17 | #endif |
36 | 18 | rockchip_timer_init(); |
arch/arm/mach-rockchip/rk3036/Makefile
arch/arm/mach-rockchip/rk3036/rk3036.c
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 |
configs/kylin-rk3036_defconfig