[U-Boot] [PATCH 00/10] rockchip: enable board_debug_uart_init for all soc

ALl rockchip soc use DEBUG UART, and need init the uart iomux in board_debug_uart_init(). Move the board_debug_uart_init() into soc file so that we can make all soc config in soc file and share a common board file later for all rockchip SoCs.
Kever Yang (10): rockchip: enable DEBUG_UART_BOARD_INIT by default rockchip; kylin-rk3036: enabl DEBUG UART rockchip: rk3036: add board_debug_uart_init() rockchip: rk3188: add board_debug_uart_init() rockchip: rk322x: move board_debug_uart_init() to rk322x.c rockchip: rk3288: use grf structure to access soc_con2 rockchip: rk3288: add board_debug_uart_init() rockchip: rk3368: move board_debug_uart_init() to rk3368.c rockchip: rk3399: use grf structure to access reg rockchip: rk3399: add board_debug_uart_init()
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +------------ arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +-------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3288-board-spl.c | 11 ++------ arch/arm/mach-rockchip/rk3288-board-tpl.c | 13 ++------- arch/arm/mach-rockchip/rk3288/rk3288.c | 19 +++++++++++-- arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ---- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +---------------------- arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++ arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +-------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 34 ++++++++++++++++++++++- configs/kylin-rk3036_defconfig | 4 +++ 21 files changed, 223 insertions(+), 194 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c

All Rockchip SoCs use DEBUG_UART_BOARD_INIT to init per board UART IOMUX, enable it by default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a90f870..97e4a93 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1191,6 +1191,7 @@ config ARCH_ROCKCHIP select DM_PWM select DM_REGULATOR select ENABLE_ARM_SOC_BOOT0_HOOK + select DEBUG_UART_BOARD_INIT imply CMD_FASTBOOT imply FASTBOOT imply FAT_WRITE @@ -1201,6 +1202,7 @@ config ARCH_ROCKCHIP imply SARADC_ROCKCHIP imply SYS_NS16550
+ config TARGET_THUNDERX_88XX bool "Support ThunderX 88xx" select ARM64 diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 41f529c..ccb9fa6 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -50,7 +50,6 @@ config ROCKCHIP_RK322X select SUPPORT_SPL select SPL select ROCKCHIP_BROM_HELPER - select DEBUG_UART_BOARD_INIT help The Rockchip RK3229 is a ARM-based SoC with a dual-core Cortex-A7 including NEON and GPU, Mali-400 graphics, several DDR3 options @@ -102,7 +101,6 @@ config ROCKCHIP_RK3368 imply SPL_SEPARATE_BSS imply SPL_SERIAL_SUPPORT imply TPL_SERIAL_SUPPORT - select DEBUG_UART_BOARD_INIT help The Rockchip RK3368 is a ARM-based SoC with a octa-core (organised into a big and little cluster with 4 cores each) Cortex-A53 including @@ -138,7 +136,6 @@ config ROCKCHIP_RK3399 select SPL_SEPARATE_BSS select SPL_SERIAL_SUPPORT select SPL_DRIVERS_MISC_SUPPORT - select DEBUG_UART_BOARD_INIT select BOARD_LATE_INIT select ROCKCHIP_BROM_HELPER help

All Rockchip SoCs use DEBUG_UART_BOARD_INIT to init per board UART IOMUX, enable it by default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Kever,
Could you rebase this series to u-boot-rockchip/next and resubmit? I’d like to avoid any issues from manually fixing up git-am issues (as I happened to introduce on last set of UART changes).
Thanks, Philipp.
On 29 Aug 2018, at 20:33, Philipp Tomsich philipp.tomsich@theobroma-systems.com wrote:
All Rockchip SoCs use DEBUG_UART_BOARD_INIT to init per board UART IOMUX, enable it by default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Philipp,
Sure, I can do it.
Thanks, - Kever On 08/30/2018 02:43 AM, Dr. Philipp Tomsich wrote:
Kever,
Could you rebase this series to u-boot-rockchip/next and resubmit? I’d like to avoid any issues from manually fixing up git-am issues (as I happened to introduce on last set of UART changes).
Thanks, Philipp.
On 29 Aug 2018, at 20:33, Philipp Tomsich philipp.tomsich@theobroma-systems.com wrote:
All Rockchip SoCs use DEBUG_UART_BOARD_INIT to init per board UART IOMUX, enable it by default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Kever,
Did I miss the rebased series? Also note that next is not current at the moment (I haven’t started on next yet), so best to rebase onto the Tom’s master.
Thanks, Philipp.
On 30.08.2018, at 03:04, Kever Yang kever.yang@rock-chips.com wrote:
Philipp,
Sure, I can do it.
Thanks,
- Kever
On 08/30/2018 02:43 AM, Dr. Philipp Tomsich wrote:
Kever,
Could you rebase this series to u-boot-rockchip/next and resubmit? I’d like to avoid any issues from manually fixing up git-am issues (as I happened to introduce on last set of UART changes).
Thanks, Philipp.
On 29 Aug 2018, at 20:33, Philipp Tomsich philipp.tomsich@theobroma-systems.com wrote:
All Rockchip SoCs use DEBUG_UART_BOARD_INIT to init per board UART IOMUX, enable it by default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

All Rockchip SoCs use DEBUG_UART_BOARD_INIT to init per board UART IOMUX, enable it by default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Enable debug uart for kylin board in defconfig.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
configs/kylin-rk3036_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig index c7bd73f..6ff187e 100644 --- a/configs/kylin-rk3036_defconfig +++ b/configs/kylin-rk3036_defconfig @@ -8,6 +8,7 @@ CONFIG_ROCKCHIP_RK3036=y CONFIG_TARGET_KYLIN_RK3036=y CONFIG_SPL_STACK_R_ADDR=0x80000 CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk" +CONFIG_DEBUG_UART=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x0 # CONFIG_ANDROID_BOOT_IMAGE is not set # CONFIG_DISPLAY_CPUINFO is not set @@ -40,6 +41,9 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_ROCKCHIP_RK3036=y CONFIG_DM_REGULATOR_FIXED=y # CONFIG_SPL_DM_SERIAL is not set +CONFIG_DEBUG_UART_BASE=0x20068000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_DWC2=y

Enable debug uart for kylin board in defconfig.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
configs/kylin-rk3036_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Enable debug uart for kylin board in defconfig.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
configs/kylin-rk3036_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 ---
arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +-------------- arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c
diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c b/arch/arm/mach-rockchip/rk3036-board-spl.c index 4b4016b..71124c8 100644 --- a/arch/arm/mach-rockchip/rk3036-board-spl.c +++ b/arch/arm/mach-rockchip/rk3036-board-spl.c @@ -8,17 +8,11 @@ #include <debug_uart.h> #include <asm/io.h> #include <asm/arch/bootrom.h> -#include <asm/arch/grf_rk3036.h> -#include <asm/arch/hardware.h> #include <asm/arch/sdram_rk3036.h> #include <asm/arch/uart.h>
DECLARE_GLOBAL_DATA_PTR;
-#define GRF_BASE 0x20008000 - -#define DEBUG_UART_BASE 0x20068000 - void rockchip_stimer_init(void) { asm volatile("mcr p15, 0, %0, c14, c0, 0" @@ -32,18 +26,7 @@ void rockchip_stimer_init(void)
void board_init_f(ulong dummy) { -#ifdef EARLY_DEBUG - struct rk3036_grf * const grf = (void *)GRF_BASE; - /* - * NOTE: sd card and debug uart use same iomux in rk3036, - * so if you enable uart, - * you can not boot from sdcard - */ - rk_clrsetreg(&grf->gpio1c_iomux, - GPIO1C3_MASK << GPIO1C3_SHIFT | - GPIO1C2_MASK << GPIO1C2_SHIFT, - GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT | - GPIO1C2_UART2_SIN << GPIO1C2_SHIFT); +#ifdef CONFIG_DEBUG_UART debug_uart_init(); #endif
diff --git a/arch/arm/mach-rockchip/rk3036/Makefile b/arch/arm/mach-rockchip/rk3036/Makefile index 20d28f7..299fc50 100644 --- a/arch/arm/mach-rockchip/rk3036/Makefile +++ b/arch/arm/mach-rockchip/rk3036/Makefile @@ -10,4 +10,5 @@ ifndef CONFIG_SPL_BUILD obj-y += syscon_rk3036.o endif
+obj-y += rk3036.o obj-y += sdram_rk3036.o diff --git a/arch/arm/mach-rockchip/rk3036/rk3036.c b/arch/arm/mach-rockchip/rk3036/rk3036.c new file mode 100644 index 0000000..5a486ab --- /dev/null +++ b/arch/arm/mach-rockchip/rk3036/rk3036.c @@ -0,0 +1,40 @@ +/* + * (C) Copyright 2018 Rockchip Electronics Co., Ltd + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include <asm/io.h> +#include <asm/arch/grf_rk3036.h> +#include <asm/arch/hardware.h> + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ +#define GRF_BASE 0x20008000 + struct rk3036_grf * const grf = (void *)GRF_BASE; + enum { + GPIO1C3_SHIFT = 6, + GPIO1C3_MASK = 3 << GPIO1C3_SHIFT, + GPIO1C3_GPIO = 0, + GPIO1C3_MMC0_D1, + GPIO1C3_UART2_SOUT, + + GPIO1C2_SHIFT = 4, + GPIO1C2_MASK = 3 << GPIO1C2_SHIFT, + GPIO1C2_GPIO = 0, + GPIO1C2_MMC0_D0, + GPIO1C2_UART2_SIN, + }; + /* + * NOTE: sd card and debug uart use same iomux in rk3036, + * so if you enable uart, + * you can not boot from sdcard + */ + rk_clrsetreg(&grf->gpio1c_iomux, + GPIO1C3_MASK << GPIO1C3_SHIFT | + GPIO1C2_MASK << GPIO1C2_SHIFT, + GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT | + GPIO1C2_UART2_SIN << GPIO1C2_SHIFT); +} +#endif +

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
arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +-------------- arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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
arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +-------------- arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 ---
arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +--------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c
diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c index 3ccc4f1..56ff77b 100644 --- a/arch/arm/mach-rockchip/rk3188-board-spl.c +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c @@ -99,17 +99,7 @@ void board_init_f(ulong dummy) int ret;
/* Example code showing how to enable the debug UART on RK3188 */ -#ifdef EARLY_UART -#include <asm/arch/grf_rk3188.h> - /* Enable early UART on the RK3188 */ -#define GRF_BASE 0x20008000 - struct rk3188_grf * const grf = (void *)GRF_BASE; - - rk_clrsetreg(&grf->gpio1b_iomux, - GPIO1B1_MASK << GPIO1B1_SHIFT | - GPIO1B0_MASK << GPIO1B0_SHIFT, - GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT | - GPIO1B0_UART2_SIN << GPIO1B0_SHIFT); +#ifdef CONFIG_DEBUG_UART /* * Debug UART can be used from here if required: * diff --git a/arch/arm/mach-rockchip/rk3188/Makefile b/arch/arm/mach-rockchip/rk3188/Makefile index 7fa0104..7dc123a 100644 --- a/arch/arm/mach-rockchip/rk3188/Makefile +++ b/arch/arm/mach-rockchip/rk3188/Makefile @@ -6,5 +6,6 @@
ifndef CONFIG_TPL_BUILD obj-y += clk_rk3188.o +obj-y += rk3188.o obj-y += syscon_rk3188.o endif diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c new file mode 100644 index 0000000..f2adcc9 --- /dev/null +++ b/arch/arm/mach-rockchip/rk3188/rk3188.c @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2018 Rockchip Electronics Co., Ltd + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include <common.h> +#include <asm/io.h> +#include <asm/arch/grf_rk3188.h> +#include <asm/arch/hardware.h> + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ + /* Enable early UART on the RK3188 */ +#define GRF_BASE 0x20008000 + struct rk3188_grf * const grf = (void *)GRF_BASE; + enum { + GPIO1B1_SHIFT = 2, + GPIO1B1_MASK = 3, + GPIO1B1_GPIO = 0, + GPIO1B1_UART2_SOUT, + GPIO1B1_JTAG_TDO, + + GPIO1B0_SHIFT = 0, + GPIO1B0_MASK = 3, + GPIO1B0_GPIO = 0, + GPIO1B0_UART2_SIN, + GPIO1B0_JTAG_TDI, + }; + + rk_clrsetreg(&grf->gpio1b_iomux, + GPIO1B1_MASK << GPIO1B1_SHIFT | + GPIO1B0_MASK << GPIO1B0_SHIFT, + GPIO1B1_UART2_SOUT << GPIO1B1_SHIFT | + GPIO1B0_UART2_SIN << GPIO1B0_SHIFT); +} +#endif

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
arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +--------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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
arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +--------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 later for all rockchip SoCs.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 72 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c
diff --git a/arch/arm/mach-rockchip/rk322x-board-spl.c b/arch/arm/mach-rockchip/rk322x-board-spl.c index b5b178f..2b67e14 100644 --- a/arch/arm/mach-rockchip/rk322x-board-spl.c +++ b/arch/arm/mach-rockchip/rk322x-board-spl.c @@ -12,7 +12,6 @@ #include <asm/io.h> #include <asm/arch/bootrom.h> #include <asm/arch/cru_rk322x.h> -#include <asm/arch/grf_rk322x.h> #include <asm/arch/hardware.h> #include <asm/arch/uart.h>
@@ -22,45 +21,6 @@ u32 spl_boot_device(void) } DECLARE_GLOBAL_DATA_PTR;
-#define GRF_BASE 0x11000000 -#define SGRF_BASE 0x10140000 - -#define DEBUG_UART_BASE 0x11030000 - -void board_debug_uart_init(void) -{ - static struct rk322x_grf * const grf = (void *)GRF_BASE; - enum { - GPIO1B2_SHIFT = 4, - GPIO1B2_MASK = 3 << GPIO1B2_SHIFT, - GPIO1B2_GPIO = 0, - GPIO1B2_UART1_SIN, - GPIO1B2_UART21_SIN, - - GPIO1B1_SHIFT = 2, - GPIO1B1_MASK = 3 << GPIO1B1_SHIFT, - GPIO1B1_GPIO = 0, - GPIO1B1_UART1_SOUT, - GPIO1B1_UART21_SOUT, - }; - enum { - CON_IOMUX_UART2SEL_SHIFT= 8, - CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT, - CON_IOMUX_UART2SEL_2 = 0, - CON_IOMUX_UART2SEL_21, - }; - - /* Enable early UART2 channel 1 on the RK322x */ - rk_clrsetreg(&grf->gpio1b_iomux, - GPIO1B1_MASK | GPIO1B2_MASK, - GPIO1B2_UART21_SIN << GPIO1B2_SHIFT | - GPIO1B1_UART21_SOUT << GPIO1B1_SHIFT); - /* Set channel C as UART2 input */ - rk_clrsetreg(&grf->con_iomux, - CON_IOMUX_UART2SEL_MASK, - CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT); -} - void rockchip_stimer_init(void) { asm volatile("mcr p15, 0, %0, c14, c0, 0" @@ -78,6 +38,7 @@ void board_init_f(ulong dummy) struct udevice *dev; int ret;
+#ifdef CONFIG_DEBUG_UART /* * Debug UART can be used from here if required: * @@ -88,7 +49,7 @@ void board_init_f(ulong dummy) */ debug_uart_init(); printascii("SPL Init"); - +#endif ret = spl_early_init(); if (ret) { debug("spl_early_init() failed: %d\n", ret); diff --git a/arch/arm/mach-rockchip/rk322x-board.c b/arch/arm/mach-rockchip/rk322x-board.c index 6295b1a..43b0d11 100644 --- a/arch/arm/mach-rockchip/rk322x-board.c +++ b/arch/arm/mach-rockchip/rk322x-board.c @@ -30,37 +30,8 @@ int board_late_init(void)
int board_init(void) { -#include <asm/arch/grf_rk322x.h> - /* Enable early UART2 channel 1 on the RK322x */ #define GRF_BASE 0x11000000 - struct rk322x_grf * const grf = (void *)GRF_BASE; - enum { - GPIO1B2_SHIFT = 4, - GPIO1B2_MASK = 3 << GPIO1B2_SHIFT, - GPIO1B2_GPIO = 0, - GPIO1B2_UART21_SIN, - - GPIO1B1_SHIFT = 2, - GPIO1B1_MASK = 3 << GPIO1B1_SHIFT, - GPIO1B1_GPIO = 0, - GPIO1B1_UART1_SOUT, - GPIO1B1_UART21_SOUT, - }; - enum { - CON_IOMUX_UART2SEL_SHIFT= 8, - CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT, - CON_IOMUX_UART2SEL_2 = 0, - CON_IOMUX_UART2SEL_21, - }; - - rk_clrsetreg(&grf->gpio1b_iomux, - GPIO1B1_MASK | GPIO1B2_MASK, - GPIO1B2_UART21_SIN << GPIO1B2_SHIFT | - GPIO1B1_UART21_SOUT << GPIO1B1_SHIFT); - /* Set channel C as UART2 input */ - rk_clrsetreg(&grf->con_iomux, - CON_IOMUX_UART2SEL_MASK, - CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT); + static struct rk322x_grf * const grf = (void *)GRF_BASE;
/* * The integrated macphy is enabled by default, disable it diff --git a/arch/arm/mach-rockchip/rk322x/Makefile b/arch/arm/mach-rockchip/rk322x/Makefile index ecb3e8d..89b0fed 100644 --- a/arch/arm/mach-rockchip/rk322x/Makefile +++ b/arch/arm/mach-rockchip/rk322x/Makefile @@ -4,6 +4,6 @@ # SPDX-License-Identifier: GPL-2.0+ #
- obj-y += clk_rk322x.o +obj-y += rk322x.o obj-y += syscon_rk322x.o diff --git a/arch/arm/mach-rockchip/rk322x/rk322x.c b/arch/arm/mach-rockchip/rk322x/rk322x.c new file mode 100644 index 0000000..945fcf3 --- /dev/null +++ b/arch/arm/mach-rockchip/rk322x/rk322x.c @@ -0,0 +1,45 @@ +/* + * (C) Copyright 2018 Rockchip Electronics Co., Ltd + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include <asm/io.h> +#include <asm/arch/grf_rk322x.h> +#include <asm/arch/hardware.h> + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ +#define GRF_BASE 0x11000000 + static struct rk322x_grf * const grf = (void *)GRF_BASE; + enum { + GPIO1B2_SHIFT = 4, + GPIO1B2_MASK = 3 << GPIO1B2_SHIFT, + GPIO1B2_GPIO = 0, + GPIO1B2_UART1_SIN, + GPIO1B2_UART21_SIN, + + GPIO1B1_SHIFT = 2, + GPIO1B1_MASK = 3 << GPIO1B1_SHIFT, + GPIO1B1_GPIO = 0, + GPIO1B1_UART1_SOUT, + GPIO1B1_UART21_SOUT, + }; + enum { + CON_IOMUX_UART2SEL_SHIFT = 8, + CON_IOMUX_UART2SEL_MASK = 1 << CON_IOMUX_UART2SEL_SHIFT, + CON_IOMUX_UART2SEL_2 = 0, + CON_IOMUX_UART2SEL_21, + }; + + /* Enable early UART2 channel 1 on the RK322x */ + rk_clrsetreg(&grf->gpio1b_iomux, + GPIO1B1_MASK | GPIO1B2_MASK, + GPIO1B2_UART21_SIN << GPIO1B2_SHIFT | + GPIO1B1_UART21_SOUT << GPIO1B1_SHIFT); + /* Set channel C as UART2 input */ + rk_clrsetreg(&grf->con_iomux, + CON_IOMUX_UART2SEL_MASK, + CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT); +} +#endif

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 later for all rockchip SoCs.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 72 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 later for all rockchip SoCs.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 72 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Prefer to use structure to access register if we can.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk3288/rk3288.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c index acc3b79..8f5aaa1 100644 --- a/arch/arm/mach-rockchip/rk3288/rk3288.c +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c @@ -5,15 +5,17 @@ */ #include <asm/io.h> #include <asm/arch/hardware.h> +#include <asm/arch/grf_rk3288.h>
-#define GRF_SOC_CON2 0xff77024c +#define GRF_BASE 0xff770000
int arch_cpu_init(void) { /* We do some SoC one time setting here. */ + struct rk3288_grf * const grf = (void *)GRF_BASE;
/* Use rkpwm by default */ - rk_setreg(GRF_SOC_CON2, 1 << 0); + rk_setreg(&grf->soc_con2, 1 << 0);
return 0; }

Prefer to use structure to access register if we can.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3288/rk3288.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Prefer to use structure to access register if we can.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/mach-rockchip/rk3288/rk3288.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 for all rockchip SoCs later.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk3288-board-spl.c | 11 ++--------- arch/arm/mach-rockchip/rk3288-board-tpl.c | 13 ++----------- arch/arm/mach-rockchip/rk3288/rk3288.c | 13 +++++++++++++ 3 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c index 8f22549..22b12a1 100644 --- a/arch/arm/mach-rockchip/rk3288-board-spl.c +++ b/arch/arm/mach-rockchip/rk3288-board-spl.c @@ -160,15 +160,7 @@ void board_init_f(ulong dummy) int ret;
/* Example code showing how to enable the debug UART on RK3288 */ -#include <asm/arch/grf_rk3288.h> - /* Enable early UART on the RK3288 */ -#define GRF_BASE 0xff770000 - struct rk3288_grf * const grf = (void *)GRF_BASE; - - rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT | - GPIO7C6_MASK << GPIO7C6_SHIFT, - GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT | - GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT); +#ifdef CONFIG_DEBUG_UART /* * Debug UART can be used from here if required: * @@ -179,6 +171,7 @@ void board_init_f(ulong dummy) */ debug_uart_init(); debug("\nspl:debug uart enabled in %s\n", __func__); +#endif ret = spl_early_init(); if (ret) { debug("spl_early_init() failed: %d\n", ret); diff --git a/arch/arm/mach-rockchip/rk3288-board-tpl.c b/arch/arm/mach-rockchip/rk3288-board-tpl.c index e34142c..cd2a33b 100644 --- a/arch/arm/mach-rockchip/rk3288-board-tpl.c +++ b/arch/arm/mach-rockchip/rk3288-board-tpl.c @@ -13,7 +13,6 @@ #include <asm/io.h> #include <asm/arch/bootrom.h> #include <asm/arch/clock.h> -#include <asm/arch/grf_rk3288.h> #include <asm/arch/periph.h> #include <asm/arch/pmu_rk3288.h> #include <asm/arch/sys_proto.h> @@ -31,20 +30,12 @@ void rockchip_stimer_init(void) writel(1, CONFIG_ROCKCHIP_STIMER_BASE + 0x10); }
-#define GRF_BASE 0xff770000 void board_init_f(ulong dummy) { struct udevice *dev; int ret;
- /* Example code showing how to enable the debug UART on RK3288 */ - /* Enable early UART on the RK3288 */ - struct rk3288_grf * const grf = (void *)GRF_BASE; - - rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT | - GPIO7C6_MASK << GPIO7C6_SHIFT, - GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT | - GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT); +#ifdef CONFIG_DEBUG_UART /* * Debug UART can be used from here if required: * @@ -54,7 +45,7 @@ void board_init_f(ulong dummy) * printascii("string"); */ debug_uart_init(); - +#endif ret = spl_early_init(); if (ret) { debug("spl_early_init() failed: %d\n", ret); diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c index 8f5aaa1..232796e 100644 --- a/arch/arm/mach-rockchip/rk3288/rk3288.c +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c @@ -19,3 +19,16 @@ int arch_cpu_init(void)
return 0; } + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ + /* Enable early UART on the RK3288 */ + struct rk3288_grf * const grf = (void *)GRF_BASE; + + rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT | + GPIO7C6_MASK << GPIO7C6_SHIFT, + GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT | + GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT); +} +#endif

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 for all rockchip SoCs later.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3288-board-spl.c | 11 ++--------- arch/arm/mach-rockchip/rk3288-board-tpl.c | 13 ++----------- arch/arm/mach-rockchip/rk3288/rk3288.c | 13 +++++++++++++ 3 files changed, 17 insertions(+), 20 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 later for all rockchip SoCs.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ----- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +------------------------------ arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3368-board-spl.c b/arch/arm/mach-rockchip/rk3368-board-spl.c index 8055ae5..0a4975b 100644 --- a/arch/arm/mach-rockchip/rk3368-board-spl.c +++ b/arch/arm/mach-rockchip/rk3368-board-spl.c @@ -12,17 +12,12 @@ #include <spl.h> #include <asm/io.h> #include <asm/arch/cru_rk3368.h> -#include <asm/arch/grf_rk3368.h> #include <asm/arch/hardware.h> #include <asm/arch/periph.h> #include <asm/arch/timer.h>
DECLARE_GLOBAL_DATA_PTR;
-void board_debug_uart_init(void) -{ -} - void board_init_f(ulong dummy) { struct udevice *pinctrl; diff --git a/arch/arm/mach-rockchip/rk3368-board-tpl.c b/arch/arm/mach-rockchip/rk3368-board-tpl.c index 60d5aea..78a2b63 100644 --- a/arch/arm/mach-rockchip/rk3368-board-tpl.c +++ b/arch/arm/mach-rockchip/rk3368-board-tpl.c @@ -13,7 +13,6 @@ #include <asm/io.h> #include <asm/arch/bootrom.h> #include <asm/arch/cru_rk3368.h> -#include <asm/arch/grf_rk3368.h> #include <asm/arch/hardware.h> #include <asm/arch/timer.h> #include <syscon.h> @@ -82,42 +81,12 @@ static void sgrf_init(void) rk_clrreg(&cru->softrst_con[4], DMA2_SRST_REQ); }
-void board_debug_uart_init(void) -{ - /* - * N.B.: This is called before the device-model has been - * initialised. For this reason, we can not access - * the GRF address range using the syscon API. - */ - struct rk3368_grf * const grf = - (struct rk3368_grf * const)0xff770000; - - enum { - GPIO2D1_MASK = GENMASK(3, 2), - GPIO2D1_GPIO = 0, - GPIO2D1_UART0_SOUT = (1 << 2), - - GPIO2D0_MASK = GENMASK(1, 0), - GPIO2D0_GPIO = 0, - GPIO2D0_UART0_SIN = (1 << 0), - }; - -#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) - /* Enable early UART0 on the RK3368 */ - rk_clrsetreg(&grf->gpio2d_iomux, - GPIO2D0_MASK, GPIO2D0_UART0_SIN); - rk_clrsetreg(&grf->gpio2d_iomux, - GPIO2D1_MASK, GPIO2D1_UART0_SOUT); -#endif -} - void board_init_f(ulong dummy) { struct udevice *dev; int ret;
-#define EARLY_UART -#ifdef EARLY_UART +#ifdef CONFIG_DEBUG_UART /* * Debug UART can be used from here if required: * diff --git a/arch/arm/mach-rockchip/rk3368/rk3368.c b/arch/arm/mach-rockchip/rk3368/rk3368.c index f62d91d..2966923 100644 --- a/arch/arm/mach-rockchip/rk3368/rk3368.c +++ b/arch/arm/mach-rockchip/rk3368/rk3368.c @@ -97,3 +97,34 @@ int arch_early_init_r(void) return mcu_init(); } #endif + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ + /* + * N.B.: This is called before the device-model has been + * initialised. For this reason, we can not access + * the GRF address range using the syscon API. + */ +#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) + struct rk3368_grf * const grf = + (struct rk3368_grf * const)0xff770000; + + enum { + GPIO2D1_MASK = GENMASK(3, 2), + GPIO2D1_GPIO = 0, + GPIO2D1_UART0_SOUT = (1 << 2), + + GPIO2D0_MASK = GENMASK(1, 0), + GPIO2D0_GPIO = 0, + GPIO2D0_UART0_SIN = (1 << 0), + }; + + /* Enable early UART0 on the RK3368 */ + rk_clrsetreg(&grf->gpio2d_iomux, + GPIO2D0_MASK, GPIO2D0_UART0_SIN); + rk_clrsetreg(&grf->gpio2d_iomux, + GPIO2D1_MASK, GPIO2D1_UART0_SOUT); +#endif +} +#endif

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 later for all rockchip SoCs.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ----- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +------------------------------ arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 37 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 later for all rockchip SoCs.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ----- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +------------------------------ arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 37 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Prefer to use structure to access register if we could.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk3399/rk3399.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index dbc248f..6a276b9 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -7,11 +7,13 @@ #include <common.h> #include <asm/armv8/mmu.h> #include <asm/io.h> +#include <asm/arch/grf_rk3399.h> #include <asm/arch/hardware.h>
DECLARE_GLOBAL_DATA_PTR;
#define GRF_EMMCCORE_CON11 0xff77f02c +#define GRF_BASE 0xff770000
static struct mm_region rk3399_mem_map[] = { { @@ -49,9 +51,10 @@ int dram_init_banksize(void) int arch_cpu_init(void) { /* We do some SoC one time setting here. */ + struct rk3399_grf_regs * const grf = (void *)GRF_BASE;
/* Emmc clock generator: disable the clock multipilier */ - rk_clrreg(GRF_EMMCCORE_CON11, 0x0ff); + rk_clrreg(&grf->emmccore_con[11], 0x0ff);
return 0; }

Prefer to use structure to access register if we could.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3399/rk3399.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Prefer to use structure to access register if we could.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/mach-rockchip/rk3399/rk3399.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 for all rockchip SoCs later.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +------------------------------ arch/arm/mach-rockchip/rk3399/rk3399.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c index d35990e..f88944f 100644 --- a/arch/arm/mach-rockchip/rk3399-board-spl.c +++ b/arch/arm/mach-rockchip/rk3399-board-spl.c @@ -80,34 +80,6 @@ void secure_timer_init(void) writel(TIMER_EN | TIMER_FMODE, TIMER_CHN10_BASE + TIMER_CONTROL_REG); }
-void board_debug_uart_init(void) -{ -#define GRF_BASE 0xff770000 - struct rk3399_grf_regs * const grf = (void *)GRF_BASE; - -#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) - /* Enable early UART0 on the RK3399 */ - rk_clrsetreg(&grf->gpio2c_iomux, - GRF_GPIO2C0_SEL_MASK, - GRF_UART0BT_SIN << GRF_GPIO2C0_SEL_SHIFT); - rk_clrsetreg(&grf->gpio2c_iomux, - GRF_GPIO2C1_SEL_MASK, - GRF_UART0BT_SOUT << GRF_GPIO2C1_SEL_SHIFT); -#else - /* Enable early UART2 channel C on the RK3399 */ - rk_clrsetreg(&grf->gpio4c_iomux, - GRF_GPIO4C3_SEL_MASK, - GRF_UART2DGBC_SIN << GRF_GPIO4C3_SEL_SHIFT); - rk_clrsetreg(&grf->gpio4c_iomux, - GRF_GPIO4C4_SEL_MASK, - GRF_UART2DBGC_SOUT << GRF_GPIO4C4_SEL_SHIFT); - /* Set channel C as UART2 input */ - rk_clrsetreg(&grf->soc_con7, - GRF_UART_DBG_SEL_MASK, - GRF_UART_DBG_SEL_C << GRF_UART_DBG_SEL_SHIFT); -#endif -} - void board_init_f(ulong dummy) { struct udevice *pinctrl; @@ -116,8 +88,7 @@ void board_init_f(ulong dummy) struct rk3399_grf_regs *grf; int ret;
-#define EARLY_UART -#ifdef EARLY_UART +#ifdef CONFIG_DEBUG_UART /* * Debug UART can be used from here if required: * diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c index 6a276b9..7d64b72 100644 --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -58,3 +58,32 @@ int arch_cpu_init(void)
return 0; } + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ + struct rk3399_grf_regs * const grf = (void *)GRF_BASE; + +#if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) + /* Enable early UART0 on the RK3399 */ + rk_clrsetreg(&grf->gpio2c_iomux, + GRF_GPIO2C0_SEL_MASK, + GRF_UART0BT_SIN << GRF_GPIO2C0_SEL_SHIFT); + rk_clrsetreg(&grf->gpio2c_iomux, + GRF_GPIO2C1_SEL_MASK, + GRF_UART0BT_SOUT << GRF_GPIO2C1_SEL_SHIFT); +#else + /* Enable early UART2 channel C on the RK3399 */ + rk_clrsetreg(&grf->gpio4c_iomux, + GRF_GPIO4C3_SEL_MASK, + GRF_UART2DGBC_SIN << GRF_GPIO4C3_SEL_SHIFT); + rk_clrsetreg(&grf->gpio4c_iomux, + GRF_GPIO4C4_SEL_MASK, + GRF_UART2DBGC_SOUT << GRF_GPIO4C4_SEL_SHIFT); + /* Set channel C as UART2 input */ + rk_clrsetreg(&grf->soc_con7, + GRF_UART_DBG_SEL_MASK, + GRF_UART_DBG_SEL_C << GRF_UART_DBG_SEL_SHIFT); +#endif +} +#endif

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 for all rockchip SoCs later.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +------------------------------ arch/arm/mach-rockchip/rk3399/rk3399.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

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 for all rockchip SoCs later.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +------------------------------ arch/arm/mach-rockchip/rk3399/rk3399.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Hi Philipp, What kind of update do I need to do for this patch set? I didn't get response mail for this patch set after some search(maybe I didn't do it correctly). I'm sorry my local mail client only have one month data. I can do the update upon the comments/request for it, or just re-send it base on latest U-Boot.
Thanks, - Kever
Kever Yang kever.yang@rock-chips.com 于2018年4月20日周五 下午12:41写道:
ALl rockchip soc use DEBUG UART, and need init the uart iomux in board_debug_uart_init(). Move the board_debug_uart_init() into soc file so that we can make all soc config in soc file and share a common board file later for all rockchip SoCs.
Kever Yang (10): rockchip: enable DEBUG_UART_BOARD_INIT by default rockchip; kylin-rk3036: enabl DEBUG UART rockchip: rk3036: add board_debug_uart_init() rockchip: rk3188: add board_debug_uart_init() rockchip: rk322x: move board_debug_uart_init() to rk322x.c rockchip: rk3288: use grf structure to access soc_con2 rockchip: rk3288: add board_debug_uart_init() rockchip: rk3368: move board_debug_uart_init() to rk3368.c rockchip: rk3399: use grf structure to access reg rockchip: rk3399: add board_debug_uart_init()
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +------------ arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +-------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3288-board-spl.c | 11 ++------ arch/arm/mach-rockchip/rk3288-board-tpl.c | 13 ++------- arch/arm/mach-rockchip/rk3288/rk3288.c | 19 +++++++++++-- arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ---- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +---------------------- arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++ arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +-------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 34 ++++++++++++++++++++++- configs/kylin-rk3036_defconfig | 4 +++ 21 files changed, 223 insertions(+), 194 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c
-- 1.9.1

Hi Philipp,
Ping again. I search the patchwork again for this patch set, and most of them get your tags: 'Reviewed-by' and 'Acked-by', and I didn't see any change request for it, can I just rebase them and re-send them? It has been almost 1 year after I send out my patch set.
Thanks, - Kever Kever Yang kever.yang@rock-chips.com 于2018年8月23日周四 下午6:26写道:
Hi Philipp, What kind of update do I need to do for this patch set? I didn't get response mail for this patch set after some search(maybe I didn't do it correctly). I'm sorry my local mail client only have one month data. I can do the update upon the comments/request for it, or just re-send it base on latest U-Boot.
Thanks,
- Kever
Kever Yang kever.yang@rock-chips.com 于2018年4月20日周五 下午12:41写道:
ALl rockchip soc use DEBUG UART, and need init the uart iomux in board_debug_uart_init(). Move the board_debug_uart_init() into soc file so that we can make all soc config in soc file and share a common board file later for all rockchip SoCs.
Kever Yang (10): rockchip: enable DEBUG_UART_BOARD_INIT by default rockchip; kylin-rk3036: enabl DEBUG UART rockchip: rk3036: add board_debug_uart_init() rockchip: rk3188: add board_debug_uart_init() rockchip: rk322x: move board_debug_uart_init() to rk322x.c rockchip: rk3288: use grf structure to access soc_con2 rockchip: rk3288: add board_debug_uart_init() rockchip: rk3368: move board_debug_uart_init() to rk3368.c rockchip: rk3399: use grf structure to access reg rockchip: rk3399: add board_debug_uart_init()
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +------------ arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +-------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3288-board-spl.c | 11 ++------ arch/arm/mach-rockchip/rk3288-board-tpl.c | 13 ++------- arch/arm/mach-rockchip/rk3288/rk3288.c | 19 +++++++++++-- arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ---- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +---------------------- arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++ arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +-------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 34 ++++++++++++++++++++++- configs/kylin-rk3036_defconfig | 4 +++ 21 files changed, 223 insertions(+), 194 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c
-- 1.9.1

Last I remember was that I had requested a rebase, as they didn’t apply cleanly any longer.
On 28.03.2019, at 11:52, Kever Yang kever.yang@rock-chips.com wrote:
Hi Philipp,
Ping again. I search the patchwork again for this patch set, and most of them get your tags: 'Reviewed-by' and 'Acked-by', and I didn't see any change request for it, can I just rebase them and re-send them? It has been almost 1 year after I send out my patch set.
Thanks,
- Kever
Kever Yang <kever.yang@rock-chips.com mailto:kever.yang@rock-chips.com> 于2018年8月23日周四 下午6:26写道: Hi Philipp, What kind of update do I need to do for this patch set? I didn't get response mail for this patch set after some search(maybe I didn't do it correctly). I'm sorry my local mail client only have one month data. I can do the update upon the comments/request for it, or just re-send it base on latest U-Boot.
Thanks,
- Kever
Kever Yang <kever.yang@rock-chips.com mailto:kever.yang@rock-chips.com> 于2018年4月20日周五 下午12:41写道:
ALl rockchip soc use DEBUG UART, and need init the uart iomux in board_debug_uart_init(). Move the board_debug_uart_init() into soc file so that we can make all soc config in soc file and share a common board file later for all rockchip SoCs.
Kever Yang (10): rockchip: enable DEBUG_UART_BOARD_INIT by default rockchip; kylin-rk3036: enabl DEBUG UART rockchip: rk3036: add board_debug_uart_init() rockchip: rk3188: add board_debug_uart_init() rockchip: rk322x: move board_debug_uart_init() to rk322x.c rockchip: rk3288: use grf structure to access soc_con2 rockchip: rk3288: add board_debug_uart_init() rockchip: rk3368: move board_debug_uart_init() to rk3368.c rockchip: rk3399: use grf structure to access reg rockchip: rk3399: add board_debug_uart_init()
arch/arm/Kconfig | 2 ++ arch/arm/mach-rockchip/Kconfig | 3 --- arch/arm/mach-rockchip/rk3036-board-spl.c | 19 +------------ arch/arm/mach-rockchip/rk3036/Makefile | 1 + arch/arm/mach-rockchip/rk3036/rk3036.c | 40 +++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3188-board-spl.c | 12 +-------- arch/arm/mach-rockchip/rk3188/Makefile | 1 + arch/arm/mach-rockchip/rk3188/rk3188.c | 37 +++++++++++++++++++++++++ arch/arm/mach-rockchip/rk322x-board-spl.c | 43 ++--------------------------- arch/arm/mach-rockchip/rk322x-board.c | 31 +-------------------- arch/arm/mach-rockchip/rk322x/Makefile | 2 +- arch/arm/mach-rockchip/rk322x/rk322x.c | 45 +++++++++++++++++++++++++++++++ arch/arm/mach-rockchip/rk3288-board-spl.c | 11 ++------ arch/arm/mach-rockchip/rk3288-board-tpl.c | 13 ++------- arch/arm/mach-rockchip/rk3288/rk3288.c | 19 +++++++++++-- arch/arm/mach-rockchip/rk3368-board-spl.c | 5 ---- arch/arm/mach-rockchip/rk3368-board-tpl.c | 33 +---------------------- arch/arm/mach-rockchip/rk3368/rk3368.c | 31 +++++++++++++++++++++ arch/arm/mach-rockchip/rk3399-board-spl.c | 31 +-------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 34 ++++++++++++++++++++++- configs/kylin-rk3036_defconfig | 4 +++ 21 files changed, 223 insertions(+), 194 deletions(-) create mode 100644 arch/arm/mach-rockchip/rk3036/rk3036.c create mode 100644 arch/arm/mach-rockchip/rk3188/rk3188.c create mode 100644 arch/arm/mach-rockchip/rk322x/rk322x.c
-- 1.9.1
participants (3)
-
Dr. Philipp Tomsich
-
Kever Yang
-
Philipp Tomsich