rockchip: Migrate to use common board file
Subsystems (3)
cover rockchip: Migrate to use common board file
Rockchip SoCs have similar boot process, we can re-use the same U-Boot proper board file for all SoCs, and avoid too much copy-paste overhead.
Kever Yang (24):
rockchip: rk3328: add board_debug_uart_init()
rockchip: convert to use ROCKCHIP_BOOT_MODE_REG for fastboot tag
rockchip: clean up board_usb_init() for all SoCs
rockchip: add common board file for U-Boot proper
rockchip: sdram_common: add common dram_init_banksize
rockchip: rk3036: move dram_init() into soc file
rockchip: rk3036: Migrate to use common board file
rockchip: rk3128: Migrate to use common board file
rockchip: rk322x: move SoC setting into arch_cpu_init()
rockchip: rk322x: Migrate to use common board file
rockchip: rk3188: Move SoC one time setting into arch_cpu_init()
rockchip: rk3188: Migrate to use common board file
rockchip: rk3288: move SOC setting into arch_cpu_init()
rockchip: rk3288: move board_early_init_f() back to veyron
rockchip: rk3288: Move veyron_init() back to veyron.c
rockchip: rk3288: Move clock CMD to SoC file
rockchip: rk3288: Move rk3288_detect_reset_reason to soc file
rockchip: rk3288: Migrate to use common board file
rockchip: rk3328: Migrate to use common board file
rockchip: rk3328: Migrate to use common board file
rockchip: rk3399: init vbus regulator in board_early_init_f()
rockchip: rk3399: Migrate to use common board file
rockchip: elgin-rv1108: use board_early_init_f for per-boar init
rockchip: rv1108: Migrate to use common board file
arch/arm/mach-rockchip/Kconfig | 16 +
arch/arm/mach-rockchip/Makefile | 9 +-
.../mach-rockchip/{rk3036-board.c => board.c} | 52 +--
arch/arm/mach-rockchip/rk3036/rk3036.c | 16 +
arch/arm/mach-rockchip/rk3128-board.c | 123 -------
arch/arm/mach-rockchip/rk3128/rk3128.c | 3 +
arch/arm/mach-rockchip/rk3188-board.c | 53 ---
arch/arm/mach-rockchip/rk3188/rk3188.c | 16 +
arch/arm/mach-rockchip/rk322x-board.c | 127 -------
arch/arm/mach-rockchip/rk322x/rk322x.c | 11 +
arch/arm/mach-rockchip/rk3288-board.c | 320 ------------------
arch/arm/mach-rockchip/rk3288/rk3288.c | 134 ++++++++
arch/arm/mach-rockchip/rk3328/rk3328.c | 56 ++-
arch/arm/mach-rockchip/rk3368/rk3368.c | 11 -
arch/arm/mach-rockchip/rk3399-board.c | 13 -
arch/arm/mach-rockchip/rk3399/rk3399.c | 11 -
arch/arm/mach-rockchip/rv1108-board.c | 81 -----
arch/arm/mach-rockchip/rv1108/rv1108.c | 10 -
arch/arm/mach-rockchip/sdram_common.c | 63 ++++
.../popmetal_rk3288/popmetal-rk3288.c | 2 +-
board/elgin/elgin_rv1108/elgin_rv1108.c | 4 +-
board/google/veyron/veyron.c | 83 +++++
board/phytec/phycore_rk3288/phycore-rk3288.c | 2 +-
board/rockchip/evb_px5/evb-px5.c | 6 -
board/rockchip/evb_rk3328/evb-rk3328.c | 65 ----
board/rockchip/evb_rk3399/evb-rk3399.c | 15 +-
board/rockchip/evb_rv1108/evb_rv1108.c | 14 -
board/rockchip/sheep_rk3368/sheep_rk3368.c | 15 -
board/rockchip/tinker_rk3288/tinker-rk3288.c | 2 +-
.../lion_rk3368/lion_rk3368.c | 18 -
.../puma_rk3399/puma-rk3399.c | 15 -
board/vamrs/rock960_rk3399/rock960-rk3399.c | 15 -
32 files changed, 426 insertions(+), 955 deletions(-)
rename arch/arm/mach-rockchip/{rk3036-board.c => board.c} (61%)
delete mode 100644 arch/arm/mach-rockchip/rk3128-board.c
delete mode 100644 arch/arm/mach-rockchip/rk3188-board.c
delete mode 100644 arch/arm/mach-rockchip/rk322x-board.c
delete mode 100644 arch/arm/mach-rockchip/rk3288-board.c
delete mode 100644 arch/arm/mach-rockchip/rk3399-board.c
delete mode 100644 arch/arm/mach-rockchip/rv1108-board.cSignature · 1 line
2.17.1
PATCH 1/24 rockchip: rk3328: add board_debug_uart_init()
Add board_debug_uart_init() to make the debug UART work with correct setting.
---
arch/arm/mach-rockchip/rk3328/rk3328.c | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
arch/arm/mach-rockchip/rk3328/rk3328.c +49 -0
@@ -6,11 +6,17 @@#include <common.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/hardware.h> +#include <asm/arch-rockchip/grf_rk3328.h> +#include <asm/arch-rockchip/uart.h> #include <asm/armv8/mmu.h> #include <asm/io.h> DECLARE_GLOBAL_DATA_PTR ; +#define CRU_BASE 0xFF440000 +#define GRF_BASE 0xFF100000 +#define UART2_BASE 0xFF130000 +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { [BROM_BOOTSOURCE_EMMC ] ="rksdmmc at ff520000" , [BROM_BOOTSOURCE_SD ] ="rksdmmc at ff500000" ,
@@ -55,3 +61,46 @@ int arch_cpu_init(void)return 0 ; } + +void board_debug_uart_init (void ) +{ +struct rk3328_grf_regs *const grf = (void *)GRF_BASE ; +struct rk_uart *const uart = (void *)UART2_BASE ; +enum { +GPIO2A0_SEL_SHIFT =0 , +GPIO2A0_SEL_MASK =3 <<GPIO2A0_SEL_SHIFT , +GPIO2A0_UART2_TX_M1 =1 , + +GPIO2A1_SEL_SHIFT =2 , +GPIO2A1_SEL_MASK =3 <<GPIO2A1_SEL_SHIFT , +GPIO2A1_UART2_RX_M1 =1 , + }; +enum { +IOMUX_SEL_UART2_SHIFT =0 , +IOMUX_SEL_UART2_MASK =3 <<IOMUX_SEL_UART2_SHIFT , +IOMUX_SEL_UART2_M0 =0 , +IOMUX_SEL_UART2_M1 , + }; + +/* uart_sel_clk default select 24MHz */ +writel ((3 << (8 +16 )) | (2 <<8 ),CRU_BASE +0x148 ); + +/* init uart baud rate 1500000 */ +writel (0x83 , &uart->lcr); +writel (0x1 , &uart->rbr); +writel (0x3 , &uart->lcr); + +/* Enable early UART2 */ +rk_clrsetreg (&grf->com_iomux, +IOMUX_SEL_UART2_MASK , +IOMUX_SEL_UART2_M1 <<IOMUX_SEL_UART2_SHIFT ); +rk_clrsetreg (&grf->gpio2a_iomux, +GPIO2A0_SEL_MASK , +GPIO2A0_UART2_TX_M1 <<GPIO2A0_SEL_SHIFT ); +rk_clrsetreg (&grf->gpio2a_iomux, +GPIO2A1_SEL_MASK , +GPIO2A1_UART2_RX_M1 <<GPIO2A1_SEL_SHIFT ); + +/* enable FIFO */ +writel (0x1 , &uart->sfe); +}
Signature · 1 line
2.17.1
PATCH 2/24 rockchip: convert to use ROCKCHIP_BOOT_MODE_REG for fastboot tag
In reply to Kever YangThe fastboot_set_reboot_flag() update a TAG into a register for next boot, use the common macro for the register so that we can re-use the function for different SoCs.
---
arch/arm/mach-rockchip/rk3128-board.c | 5 +---- arch/arm/mach-rockchip/rk322x-board.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-)
arch/arm/mach-rockchip/rk3128-board.c +1 -4
@@ -111,12 +111,9 @@ int board_usb_cleanup(int index, enum usb_init_type init)#if CONFIG_IS_ENABLED (FASTBOOT )int fastboot_set_reboot_flag (void ) { -struct rk3128_grf *grf; -printf ("Setting reboot to fastboot flag ...\n" ); - grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF );/* Set boot mode to fastboot */ -writel (BOOT_FASTBOOT , &grf->os_reg[0 ]); +writel (BOOT_FASTBOOT ,CONFIG_ROCKCHIP_BOOT_MODE_REG );return 0 ; }
arch/arm/mach-rockchip/rk322x-board.c +1 -4
@@ -115,12 +115,9 @@ int board_usb_cleanup(int index, enum usb_init_type init)#if CONFIG_IS_ENABLED (FASTBOOT )int fastboot_set_reboot_flag (void ) { -struct rk322x_grf *grf; -printf ("Setting reboot to fastboot flag ...\n" ); - grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF );/* Set boot mode to fastboot */ -writel (BOOT_FASTBOOT , &grf->os_reg[0 ]); +writel (BOOT_FASTBOOT ,CONFIG_ROCKCHIP_BOOT_MODE_REG );return 0 ; }
Signature · 1 line
2.17.1
PATCH 3/24 rockchip: clean up board_usb_init() for all SoCs
In reply to Kever YangUse "snps,dwc2" for compatible name and and common variable names so that we can share the common code for all SoCs.
---
arch/arm/mach-rockchip/rk3036-board.c | 10 +++--- arch/arm/mach-rockchip/rk3128-board.c | 10 +++--- arch/arm/mach-rockchip/rk322x-board.c | 10 +++--- arch/arm/mach-rockchip/rk3288-board.c | 38 ++++---------------- arch/arm/mach-rockchip/rv1108-board.c | 49 ++++++-------------------- board/rockchip/evb_rk3328/evb-rk3328.c | 11 +++--- 6 files changed, 36 insertions(+), 92 deletions(-)
arch/arm/mach-rockchip/rk3036-board.c +5 -5
@@ -59,7 +59,7 @@ void enable_caches(void)#include <usb.h> #include <usb/dwc2_udc.h> -static struct dwc2_plat_otg_data rk3036_otg_data = { +static struct dwc2_plat_otg_data otg_data = { .rx_fifo_sz =512 , .np_tx_fifo_sz =16 , .tx_fifo_sz =128 ,
@@ -74,7 +74,7 @@ int board_usb_init(int index, enum usb_init_type init)/* find the usb_otg node */ node =fdt_node_offset_by_compatible (blob,-1 , -"rockchip,rk3288-usb" ); +"snps,dwc2" );while (node >0 ) { mode =fdt_getprop (blob, node,"dr_mode" ,NULL );
@@ -84,15 +84,15 @@ int board_usb_init(int index, enum usb_init_type init) } node =fdt_node_offset_by_compatible (blob, node, -"rockchip,rk3288-usb" ); +"snps,dwc2" ); }if (!matched) {debug ("Not found usb_otg device\n" );return -ENODEV ; } - rk3036_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); -return dwc2_udc_probe (&rk3036_otg_data); +return dwc2_udc_probe (&otg_data); }int board_usb_cleanup (int index,enum usb_init_type init)
arch/arm/mach-rockchip/rk3128-board.c +5 -5
@@ -66,7 +66,7 @@ void enable_caches(void)#include <usb.h> #include <usb/dwc2_udc.h> -static struct dwc2_plat_otg_data rk3128_otg_data = { +static struct dwc2_plat_otg_data otg_data = { .rx_fifo_sz =512 , .np_tx_fifo_sz =16 , .tx_fifo_sz =128 ,
@@ -81,7 +81,7 @@ int board_usb_init(int index, enum usb_init_type init)/* find the usb_otg node */ node =fdt_node_offset_by_compatible (blob,-1 , -"rockchip,rk3128-usb" ); +"snps,dwc2" );while (node >0 ) { mode =fdt_getprop (blob, node,"dr_mode" ,NULL );
@@ -91,15 +91,15 @@ int board_usb_init(int index, enum usb_init_type init) } node =fdt_node_offset_by_compatible (blob, node, -"rockchip,rk3128-usb" ); +"snps,dwc2" ); }if (!matched) {debug ("Not found usb_otg device\n" );return -ENODEV ; } - rk3128_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); -return dwc2_udc_probe (&rk3128_otg_data); +return dwc2_udc_probe (&otg_data); }int board_usb_cleanup (int index,enum usb_init_type init)
arch/arm/mach-rockchip/rk322x-board.c +5 -5
@@ -70,7 +70,7 @@ void enable_caches(void)#include <usb.h> #include <usb/dwc2_udc.h> -static struct dwc2_plat_otg_data rk322x_otg_data = { +static struct dwc2_plat_otg_data otg_data = { .rx_fifo_sz =512 , .np_tx_fifo_sz =16 , .tx_fifo_sz =128 ,
@@ -85,7 +85,7 @@ int board_usb_init(int index, enum usb_init_type init)/* find the usb_otg node */ node =fdt_node_offset_by_compatible (blob,-1 , -"rockchip,rk3288-usb" ); +"snps,dwc2" );while (node >0 ) { mode =fdt_getprop (blob, node,"dr_mode" ,NULL );
@@ -95,15 +95,15 @@ int board_usb_init(int index, enum usb_init_type init) } node =fdt_node_offset_by_compatible (blob, node, -"rockchip,rk3288-usb" ); +"snps,dwc2" ); }if (!matched) {debug ("Not found usb_otg device\n" );return -ENODEV ; } - rk322x_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); -return dwc2_udc_probe (&rk322x_otg_data); +return dwc2_udc_probe (&otg_data); }int board_usb_cleanup (int index,enum usb_init_type init)
arch/arm/mach-rockchip/rk3288-board.c +6 -32
@@ -171,7 +171,7 @@ void enable_caches(void)#include <usb.h> #include <usb/dwc2_udc.h> -static struct dwc2_plat_otg_data rk3288_otg_data = { +static struct dwc2_plat_otg_data otg_data = { .rx_fifo_sz =512 , .np_tx_fifo_sz =16 , .tx_fifo_sz =128 ,
@@ -179,15 +179,14 @@ static struct dwc2_plat_otg_data rk3288_otg_data = {int board_usb_init (int index,enum usb_init_type init) { -int node, phy_node; +int node;const char *mode;bool matched = false;const void *blob = gd->fdt_blob; -u32 grf_phy_offset;/* find the usb_otg node */ node =fdt_node_offset_by_compatible (blob,-1 , -"rockchip,rk3288-usb" ); +"snps,dwc2" );while (node >0 ) { mode =fdt_getprop (blob, node,"dr_mode" ,NULL );
@@ -197,40 +196,15 @@ int board_usb_init(int index, enum usb_init_type init) } node =fdt_node_offset_by_compatible (blob, node, -"rockchip,rk3288-usb" ); +"snps,dwc2" ); }if (!matched) {debug ("Not found usb_otg device\n" );return -ENODEV ; } - rk3288_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); - node =fdtdec_lookup_phandle (blob, node,"phys" ); -if (node <=0 ) { -debug ("Not found usb phy device\n" ); -return -ENODEV ; - } - - phy_node =fdt_parent_offset (blob, node); -if (phy_node <=0 ) { -debug ("Not found usb phy device\n" ); -return -ENODEV ; - } - - rk3288_otg_data.phy_of_node = phy_node; - grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); - -/* find the grf node */ - node =fdt_node_offset_by_compatible (blob,-1 , -"rockchip,rk3288-grf" ); -if (node <=0 ) { -debug ("Not found grf device\n" ); -return -ENODEV ; - } - rk3288_otg_data.regs_phy = grf_phy_offset + -fdtdec_get_addr (blob, node,"reg" ); - -return dwc2_udc_probe (&rk3288_otg_data); +return dwc2_udc_probe (&otg_data); }int board_usb_cleanup (int index,enum usb_init_type init)
arch/arm/mach-rockchip/rv1108-board.c +10 -39
75 lines not on this page · raw message
board/rockchip/evb_rk3328/evb-rk3328.c +5 -6
@@ -26,7 +26,7 @@ int board_init(void)#include <usb.h> #include <usb/dwc2_udc.h> -static struct dwc2_plat_otg_data rk3328_otg_data = { +static struct dwc2_plat_otg_data otg_data = { .rx_fifo_sz =512 , .np_tx_fifo_sz =16 , .tx_fifo_sz =128 ,
@@ -41,7 +41,7 @@ int board_usb_init(int index, enum usb_init_type init)/* find the usb_otg node */ node =fdt_node_offset_by_compatible (blob,-1 , -"rockchip,rk3328-usb" ); +"snps,dwc2" );while (node >0 ) { mode =fdt_getprop (blob, node,"dr_mode" ,NULL );
@@ -51,16 +51,15 @@ int board_usb_init(int index, enum usb_init_type init) } node =fdt_node_offset_by_compatible (blob, node, -"rockchip,rk3328-usb" ); +"snps,dwc2" ); }if (!matched) {debug ("Not found usb_otg device\n" );return -ENODEV ; } + otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); - rk3328_otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); - -return dwc2_udc_probe (&rk3328_otg_data); +return dwc2_udc_probe (&otg_data); }int board_usb_cleanup (int index,enum usb_init_type init)
Signature · 1 line
2.17.1
PATCH 4/24 rockchip: add common board file for U-Boot proper
In reply to Kever YangAdd common board file for Rockchip SoCs to avoid too much copy-paste work for different SoCs.
This board file in charge for common board_init() and board_late_init() in U-Boot proper.
---
arch/arm/mach-rockchip/Kconfig | 7 +++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/board.c | 104 ++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 arch/arm/mach-rockchip/board.c
arch/arm/mach-rockchip/Kconfig +7 -0
@@ -229,6 +229,13 @@ config TPL_ROCKCHIP_BACK_TO_BROM SPL will return to the boot rom, which will then load the U-Boot binary to keep going on. +config ROCKCHIP_COMMON_BOARD + bool "Rockchip common board file" + help + Rockchip SoCs have similar boot process, Common board file is mainly + in charge of common process of board_init() and board_late_init() for + U-Boot proper. + config SPL_ROCKCHIP_COMMON_BOARD bool "Rockchip SPL common board file" depends on SPL
arch/arm/mach-rockchip/Makefile +1 -0
@@ -20,6 +20,7 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # we can have the preprocessor correctly recognise both 0x0 and 0 # meaning "turn it off". obj-y += boot_mode.o +obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o
arch/arm/mach-rockchip/board.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 5/24 rockchip: sdram_common: add common dram_init_banksize
In reply to Kever Yangdram_init_banksize() can be common used by all SoCs, move it into sdram_common.c
---
arch/arm/mach-rockchip/rk3128-board.c | 13 ------ arch/arm/mach-rockchip/rk3128/rk3128.c | 3 ++ arch/arm/mach-rockchip/rk322x-board.c | 13 ------ arch/arm/mach-rockchip/rk3328/rk3328.c | 11 ----- arch/arm/mach-rockchip/rk3368/rk3368.c | 11 ----- arch/arm/mach-rockchip/rk3399/rk3399.c | 11 ----- arch/arm/mach-rockchip/sdram_common.c | 63 ++++++++++++++++++++++++++ board/rockchip/evb_rv1108/evb_rv1108.c | 8 ---- 8 files changed, 66 insertions(+), 67 deletions(-)
arch/arm/mach-rockchip/rk3128-board.c +0 -13
@@ -41,19 +41,6 @@ int board_init(void)return 0 ; } -int dram_init_banksize (void ) -{ - gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_dram[0 ].size =0x8400000 ; -/* Reserve 0xe00000(14MB) for OPTEE with TA enabled, otherwise 2MB */ - gd->bd->bi_dram[1 ].start =CONFIG_SYS_SDRAM_BASE - + gd->bd->bi_dram[0 ].size +0xe00000 ; - gd->bd->bi_dram[1 ].size = gd->bd->bi_dram[0 ].start - + gd->ram_size - gd->bd->bi_dram[1 ].start; - -return 0 ; -} -#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF )void enable_caches (void ) {
arch/arm/mach-rockchip/rk3128/rk3128.c +3 -0
@@ -2,6 +2,9 @@/* * Copyright (c) 2017 Rockchip Electronics Co., Ltd */ +#include <common.h> + +DECLARE_GLOBAL_DATA_PTR ;int arch_cpu_init (void ) {
arch/arm/mach-rockchip/rk322x-board.c +0 -13
@@ -45,19 +45,6 @@ int board_init(void)return 0 ; } -int dram_init_banksize (void ) -{ - gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_dram[0 ].size =0x8400000 ; -/* Reserve 0x200000 for OPTEE */ - gd->bd->bi_dram[1 ].start =CONFIG_SYS_SDRAM_BASE - + gd->bd->bi_dram[0 ].size +0x200000 ; - gd->bd->bi_dram[1 ].size = gd->bd->bi_dram[0 ].start - + gd->ram_size - gd->bd->bi_dram[1 ].start; - -return 0 ; -} -#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF )void enable_caches (void ) {
arch/arm/mach-rockchip/rk3328/rk3328.c +0 -11
@@ -44,17 +44,6 @@ static struct mm_region rk3328_mem_map[] = {struct mm_region *mem_map = rk3328_mem_map; -int dram_init_banksize (void ) -{ -size_t max_size =min ((unsigned long )gd->ram_size, gd->ram_top); - -/* Reserve 0x200000 for ATF bl31 */ - gd->bd->bi_dram[0 ].start =0x200000 ; - gd->bd->bi_dram[0 ].size = max_size - gd->bd->bi_dram[0 ].start; - -return 0 ; -} -int arch_cpu_init (void ) {/* We do some SoC one time setting here. */
arch/arm/mach-rockchip/rk3368/rk3368.c +0 -11
@@ -58,17 +58,6 @@ const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = { [BROM_BOOTSOURCE_SD] = "dwmmc at ff0c0000", }; -int dram_init_banksize (void ) -{ -size_t max_size =min ((unsigned long )gd->ram_size, gd->ram_top); - -/* Reserve 0x200000 for ATF bl31 */ - gd->bd->bi_dram[0 ].start =0x200000 ; - gd->bd->bi_dram[0 ].size = max_size - gd->bd->bi_dram[0 ].start; - -return 0 ; -} -#ifdef CONFIG_ARCH_EARLY_INIT_R static int mcu_init (void ) {
arch/arm/mach-rockchip/rk3399/rk3399.c +0 -11
@@ -78,17 +78,6 @@ void rockchip_stimer_init(void) }#endif -int dram_init_banksize (void ) -{ -size_t max_size =min ((unsigned long )gd->ram_size, gd->ram_top); - -/* Reserve 0x200000 for ATF bl31 */ - gd->bd->bi_dram[0 ].start =0x200000 ; - gd->bd->bi_dram[0 ].size = max_size - gd->bd->bi_dram[0 ].start; - -return 0 ; -} -int arch_cpu_init (void ) {
arch/arm/mach-rockchip/sdram_common.c +63 -0
69 lines not on this page · raw message
board/rockchip/evb_rv1108/evb_rv1108.c +0 -8
@@ -59,11 +59,3 @@ int dram_init(void)return 0 ; } - -int dram_init_banksize (void ) -{ - gd->bd->bi_dram[0 ].start =0x60000000 ; - gd->bd->bi_dram[0 ].size =0x8000000 ; - -return 0 ; -}
Signature · 1 line
2.17.1
PATCH 6/24 rockchip: rk3036: move dram_init() into soc file
In reply to Kever YangMove dram_init() into rk3036.c so that we can use to common board file later.
---
arch/arm/mach-rockchip/rk3036-board.c | 14 -------------- arch/arm/mach-rockchip/rk3036/rk3036.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-)
arch/arm/mach-rockchip/rk3036-board.c +0 -14
@@ -13,7 +13,6 @@#include <asm/arch-rockchip/periph.h> #include <asm/arch-rockchip/grf_rk3036.h> #include <asm/arch-rockchip/boot_mode.h> -#include <asm/arch-rockchip/sdram_rk3036.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -34,19 +33,6 @@ int board_init(void)return 0 ; } -#if !CONFIG_IS_ENABLED (RAM ) -/* -* When CONFIG_RAM is enabled, the dram_init() function is implemented -* in sdram_common.c. -*/ -int dram_init (void ) -{ - gd->ram_size =sdram_size (); - -return 0 ; -} -#endif -#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF )void enable_caches (void ) {
arch/arm/mach-rockchip/rk3036/rk3036.c +16 -0
@@ -5,6 +5,9 @@#include <asm/io.h> #include <asm/arch-rockchip/grf_rk3036.h> #include <asm/arch-rockchip/hardware.h> +#include <asm/arch-rockchip/sdram_rk3036.h> + +DECLARE_GLOBAL_DATA_PTR ;#ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init (void )
@@ -36,3 +39,16 @@ void board_debug_uart_init(void) GPIO1C2_UART2_SIN << GPIO1C2_SHIFT); }#endif + +#if !CONFIG_IS_ENABLED (RAM ) +/* +* When CONFIG_RAM is enabled, the dram_init() function is implemented +* in sdram_common.c. +*/ +int dram_init (void ) +{ + gd->ram_size =sdram_size (); + +return 0 ; +} +#endif
Signature · 1 line
2.17.1
PATCH 7/24 rockchip: rk3036: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3036-board.c | 88 --------------------------- 3 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3036-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -7,6 +7,7 @@ config ROCKCHIP_RK3036 select SPL imply USB_FUNCTION_ROCKUSB imply CMD_ROCKUSB + imply ROCKCHIP_COMMON_BOARD help The Rockchip RK3036 is a ARM-based SoC with a dual-core Cortex-A7 including NEON and GPU, Mali-400 graphics, several DDR3 options
arch/arm/mach-rockchip/Makefile +0 -1
@@ -26,7 +26,6 @@ obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o -obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o endif
arch/arm/mach-rockchip/rk3036-board.c deleted +0 -88
88 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 8/24 rockchip: rk3128: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3128-board.c | 107 -------------------------- 3 files changed, 1 insertion(+), 108 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3128-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -17,6 +17,7 @@ config ROCKCHIP_RK3036 config ROCKCHIP_RK3128 bool "Support Rockchip RK3128" select CPU_V7A + imply ROCKCHIP_COMMON_BOARD help The Rockchip RK3128 is a ARM-based SoC with a quad-core Cortex-A7 including NEON and GPU, Mali-400 graphics, several DDR3 options
arch/arm/mach-rockchip/Makefile +0 -1
@@ -23,7 +23,6 @@ obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o -obj-$(CONFIG_ROCKCHIP_RK3128) += rk3128-board.o obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o
arch/arm/mach-rockchip/rk3128-board.c deleted +0 -107
107 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 9/24 rockchip: rk322x: move SoC setting into arch_cpu_init()
In reply to Kever YangThe SoC one time setting should go to arch_cpu_init() in rk322x.c
---
arch/arm/mach-rockchip/rk322x-board.c | 14 -------------- arch/arm/mach-rockchip/rk322x/rk322x.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 14 deletions(-)
arch/arm/mach-rockchip/rk322x-board.c +0 -14
@@ -10,7 +10,6 @@#include <asm/io.h> #include <asm/arch-rockchip/boot_mode.h> #include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk322x.h> #include <asm/arch-rockchip/periph.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -29,19 +28,6 @@ int board_late_init(void)int board_init (void ) { -#include <asm/arch-rockchip/grf_rk322x.h> -/* Enable early UART2 channel 1 on the RK322x */ -#define GRF_BASE 0x11000000 -static struct rk322x_grf *const grf = (void *)GRF_BASE ; - -/* -* The integrated macphy is enabled by default, disable it -* for saving power consuming. -*/ -rk_clrsetreg (&grf->macphy_con[0 ], -MACPHY_CFG_ENABLE_MASK , -0 <<MACPHY_CFG_ENABLE_SHIFT ); -return 0 ; }
arch/arm/mach-rockchip/rk322x/rk322x.c +11 -0
@@ -57,6 +57,17 @@ int arch_cpu_init(void)/* Disable the ddr secure region setting to make it non-secure */ rk_clrreg (&sgrf->soc_con[0 ],0x4000 ); +#else +#define GRF_BASE 0x11000000 +static struct rk322x_grf *const grf = (void *)GRF_BASE ; +/* +* The integrated macphy is enabled by default, disable it +* for saving power consuming. +*/ +rk_clrsetreg (&grf->macphy_con[0 ], +MACPHY_CFG_ENABLE_MASK , +0 <<MACPHY_CFG_ENABLE_SHIFT ); +#endif return 0 ; }
Signature · 1 line
2.17.1
PATCH 10/24 rockchip: rk322x: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk322x-board.c | 97 --------------------------- 3 files changed, 1 insertion(+), 98 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk322x-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -60,6 +60,7 @@ config ROCKCHIP_RK322X select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL select TPL_NEEDS_SEPARATE_STACK if TPL select SPL_DRIVERS_MISC_SUPPORT + imply ROCKCHIP_COMMON_BOARD imply SPL_SERIAL_SUPPORT imply SPL_ROCKCHIP_COMMON_BOARD imply TPL_SERIAL_SUPPORT
arch/arm/mach-rockchip/Makefile +0 -1
@@ -23,7 +23,6 @@ obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o -obj-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
arch/arm/mach-rockchip/rk322x-board.c deleted +0 -97
97 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 11/24 rockchip: rk3188: Move SoC one time setting into arch_cpu_init()
In reply to Kever YangThe setting for noc remap should goto arch_cpu_init().
---
arch/arm/mach-rockchip/rk3188-board.c | 15 --------------- arch/arm/mach-rockchip/rk3188/rk3188.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-)
arch/arm/mach-rockchip/rk3188-board.c +0 -15
@@ -7,13 +7,9 @@#include <clk.h> #include <dm.h> #include <ram.h> -#include <syscon.h> #include <asm/gpio.h> #include <asm/io.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3188.h> #include <asm/arch-rockchip/periph.h> -#include <asm/arch-rockchip/pmu_rk3288.h> #include <asm/arch-rockchip/boot_mode.h> __weak int rk_board_late_init (void )
@@ -23,18 +19,7 @@ __weak int rk_board_late_init(void)int board_late_init (void ) { -struct rk3188_grf *grf; -setup_boot_mode (); - grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); -if (IS_ERR (grf)) { -pr_err ("grf syscon returned %ld\n" ,PTR_ERR (grf)); - }else { -/* enable noc remap to mimic legacy loaders */ -rk_clrsetreg (&grf->soc_con0, -NOC_REMAP_MASK <<NOC_REMAP_SHIFT , -NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); - }return rk_board_late_init (); }
arch/arm/mach-rockchip/rk3188/rk3188.c +16 -0
@@ -3,8 +3,11 @@* (C) Copyright 2019 Rockchip Electronics Co., Ltd */ #include <common.h> +#include <dm.h> +#include <syscon.h> #include <asm/io.h> #include <asm/arch-rockchip/bootrom.h> +#include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/grf_rk3188.h> #include <asm/arch-rockchip/hardware.h>
@@ -42,6 +45,7 @@ void board_debug_uart_init(void) }#endif +#ifdef CONFIG_SPL_BUILD int arch_cpu_init (void ) {#ifdef CONFIG_ROCKCHIP_USB_UART
@@ -64,8 +68,20 @@ int arch_cpu_init(void)BYPASSSEL_MASK |BYPASSDMEN_MASK , 1 << BYPASSSEL_SHIFT | 1 << BYPASSDMEN_SHIFT);#endif + + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +if (IS_ERR (grf)) { +pr_err ("grf syscon returned %ld\n" ,PTR_ERR (grf)); + }else { +/* enable noc remap to mimic legacy loaders */ +rk_clrsetreg (&grf->soc_con0, +NOC_REMAP_MASK <<NOC_REMAP_SHIFT , +NOC_REMAP_MASK <<NOC_REMAP_SHIFT ); + } + return 0; } +#endif #ifdef CONFIG_SPL_BUILD static int setup_led (void )
Signature · 1 line
2.17.1
PATCH 12/24 rockchip: rk3188: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3188-board.c | 38 --------------------------- 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3188-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -38,6 +38,7 @@ config ROCKCHIP_RK3188 select SPL_ROCKCHIP_EARLYRETURN_TO_BROM select SPL_ROCKCHIP_BACK_TO_BROM select BOARD_LATE_INIT + imply ROCKCHIP_COMMON_BOARD imply SPL_ROCKCHIP_COMMON_BOARD help The Rockchip RK3188 is a ARM-based SoC with a quad-core Cortex-A9
arch/arm/mach-rockchip/Makefile +0 -1
@@ -22,7 +22,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o -obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o
arch/arm/mach-rockchip/rk3188-board.c deleted +0 -38
@@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* (C) Copyright 2015 Google, Inc -*/ - -#include <common.h> -#include <clk.h> -#include <dm.h> -#include <ram.h> -#include <asm/gpio.h> -#include <asm/io.h> -#include <asm/arch-rockchip/periph.h> -#include <asm/arch-rockchip/boot_mode.h> - -__weak int rk_board_late_init (void ) -{ -return 0 ; -} - -int board_late_init (void ) -{ -setup_boot_mode (); - -return rk_board_late_init (); -} - -int board_init (void ) -{ -return 0 ; -} - -#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) -void enable_caches (void ) -{ -/* Enable D-cache. I-cache is already enabled in start.S */ -dcache_enable (); -} -#endif
Signature · 1 line
2.17.1
PATCH 13/24 rockchip: rk3288: move SOC setting into arch_cpu_init()
In reply to Kever YangQos setting and emmc relate SoC setting should go to arch_cpu_init().
---
arch/arm/mach-rockchip/rk3288-board.c | 30 -------------------------- arch/arm/mach-rockchip/rk3288/rk3288.c | 30 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-)
arch/arm/mach-rockchip/rk3288-board.c +0 -30
@@ -13,7 +13,6 @@#include <asm/arch-rockchip/cru_rk3288.h> #include <asm/arch-rockchip/periph.h> #include <asm/arch-rockchip/pmu_rk3288.h> -#include <asm/arch-rockchip/qos_rk3288.h> #include <asm/arch-rockchip/boot_mode.h> #include <asm/gpio.h> #include <dt-bindings/clock/rk3288-cru.h>
@@ -26,24 +25,6 @@ __weak int rk_board_late_init(void)return 0 ; } -int rk3288_qos_init (void ) -{ -int val =2 <<PRIORITY_HIGH_SHIFT |2 <<PRIORITY_LOW_SHIFT ; -/* set vop qos to higher priority */ -writel (val,CPU_AXI_QOS_PRIORITY +VIO0_VOP_QOS ); -writel (val,CPU_AXI_QOS_PRIORITY +VIO1_VOP_QOS ); - -if (!fdt_node_check_compatible (gd->fdt_blob,0 , -"rockchip,rk3288-tinker" )) - { -/* set isp qos to higher priority */ -writel (val,CPU_AXI_QOS_PRIORITY +VIO1_ISP_R_QOS ); -writel (val,CPU_AXI_QOS_PRIORITY +VIO1_ISP_W0_QOS ); -writel (val,CPU_AXI_QOS_PRIORITY +VIO1_ISP_W1_QOS ); - } -return 0 ; -} -static void rk3288_detect_reset_reason (void ) {struct rk3288_cru *cru =rockchip_get_cru ();
@@ -84,7 +65,6 @@ static void rk3288_detect_reset_reason(void)int board_late_init (void ) {setup_boot_mode (); -rk3288_qos_init ();rk3288_detect_reset_reason ();return rk_board_late_init ();
@@ -266,8 +246,6 @@ U_BOOT_CMD(int board_early_init_f (void ) { -const uintptr_t GRF_SOC_CON0 =0xff770244 ; -const uintptr_t GRF_SOC_CON2 =0xff77024c ;struct udevice *dev;int ret;
@@ -282,13 +260,5 @@ int board_early_init_f(void)return ret; } -rk_setreg (GRF_SOC_CON2 ,1 <<0 ); - -/* -* Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is -* cleared -*/ -rk_clrreg (GRF_SOC_CON0 ,1 <<12 ); -return 0 ; }
arch/arm/mach-rockchip/rk3288/rk3288.c +30 -0
@@ -2,11 +2,15 @@/* * Copyright (c) 2016 Rockchip Electronics Co., Ltd */ +#include <common.h> #include <asm/armv7.h> #include <asm/io.h> #include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/grf_rk3288.h> +#include <asm/arch-rockchip/qos_rk3288.h> + +DECLARE_GLOBAL_DATA_PTR ;#define GRF_BASE 0xff770000
@@ -36,6 +40,24 @@ static void configure_l2ctlr(void) }#endif +int rk3288_qos_init (void ) +{ +int val =2 <<PRIORITY_HIGH_SHIFT |2 <<PRIORITY_LOW_SHIFT ; +/* set vop qos to higher priority */ +writel (val,CPU_AXI_QOS_PRIORITY +VIO0_VOP_QOS ); +writel (val,CPU_AXI_QOS_PRIORITY +VIO1_VOP_QOS ); + +if (!fdt_node_check_compatible (gd->fdt_blob,0 , +"rockchip,rk3288-tinker" )) { +/* set isp qos to higher priority */ +writel (val,CPU_AXI_QOS_PRIORITY +VIO1_ISP_R_QOS ); +writel (val,CPU_AXI_QOS_PRIORITY +VIO1_ISP_W0_QOS ); +writel (val,CPU_AXI_QOS_PRIORITY +VIO1_ISP_W1_QOS ); + } + +return 0 ; +} +int arch_cpu_init (void ) {#ifdef CONFIG_SPL_BUILD
@@ -46,6 +68,14 @@ int arch_cpu_init(void)/* Use rkpwm by default */ rk_setreg (&grf->soc_con2,1 <<0 ); + +/* +* Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is +* cleared +*/ +rk_clrreg (&grf->soc_con0,1 <<12 ); + +rk3288_qos_init ();#endif return 0 ;
Signature · 1 line
2.17.1
PATCH 14/24 rockchip: rk3288: move board_early_init_f() back to veyron
In reply to Kever YangThe board_early_init_f() is only used by veyron board now, move it into the board file veyron.c
---
arch/arm/mach-rockchip/rk3288-board.c | 19 ------------------- board/google/veyron/veyron.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-)
arch/arm/mach-rockchip/rk3288-board.c +0 -19
@@ -243,22 +243,3 @@ U_BOOT_CMD("display information about clocks" ,"" ); - -int board_early_init_f (void ) -{ -struct udevice *dev; -int ret; - -/* -* This init is done in SPL, but when chain-loading U-Boot SPL will -* have been skipped. Allow the clock driver to check if it needs -* setting up. -*/ - ret =rockchip_get_clk (&dev); -if (ret) { -debug ("CLK init failed: %d\n" , ret); -return ret; - } - -return 0 ; -}
board/google/veyron/veyron.c +20 -0
@@ -4,9 +4,29 @@*/ #include <common.h> +#include <asm/arch-rockchip/clock.h> /* * We should increase the DDR voltage to 1.2V using the PWM regulator. * There is a U-Boot driver for this but it may need to add support for the * 'voltage-table' property. */ + +int board_early_init_f (void ) +{ +struct udevice *dev; +int ret; + +/* +* This init is done in SPL, but when chain-loading U-Boot SPL will +* have been skipped. Allow the clock driver to check if it needs +* setting up. +*/ + ret =rockchip_get_clk (&dev); +if (ret) { +debug ("CLK init failed: %d\n" , ret); +return ret; + } + +return 0 ; +}
Signature · 1 line
2.17.1
PATCH 15/24 rockchip: rk3288: Move veyron_init() back to veyron.c
In reply to Kever YangThe veyron_init() should go to its board file veyron.c, and the board_early_init_f() could be the right place.
---
arch/arm/mach-rockchip/rk3288-board.c | 65 --------------------------- board/google/veyron/veyron.c | 63 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 65 deletions(-)
arch/arm/mach-rockchip/rk3288-board.c +0 -65
@@ -15,7 +15,6 @@#include <asm/arch-rockchip/pmu_rk3288.h> #include <asm/arch-rockchip/boot_mode.h> #include <asm/gpio.h> -#include <dt-bindings/clock/rk3288-cru.h> #include <power/regulator.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -70,73 +69,9 @@ int board_late_init(void)return rk_board_late_init (); } -#if !CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM ) -static int veyron_init (void ) -{ -struct udevice *dev; -struct clk clk; -int ret; - - ret =regulator_get_by_platname ("vdd_arm" , &dev); -if (ret) { -debug ("Cannot set regulator name\n" ); -return ret; - } - -/* Slowly raise to max CPU voltage to prevent overshoot */ - ret =regulator_set_value (dev,1200000 ); -if (ret) -return ret; -udelay (175 );/* Must wait for voltage to stabilize, 2mV/us */ - ret =regulator_set_value (dev,1400000 ); -if (ret) -return ret; -udelay (100 );/* Must wait for voltage to stabilize, 2mV/us */ - - ret =rockchip_get_clk (&clk.dev); -if (ret) -return ret; - clk.id =PLL_APLL ; - ret =clk_set_rate (&clk,1800000000 ); -if (IS_ERR_VALUE (ret)) -return ret; - - ret =regulator_get_by_platname ("vcc33_sd" , &dev); -if (ret) { -debug ("Cannot get regulator name\n" ); -return ret; - } - - ret =regulator_set_value (dev,3300000 ); -if (ret) -return ret; - - ret =regulators_enable_boot_on (false); -if (ret) { -debug ("%s: Cannot enable boot on regulators\n" , __func__); -return ret; - } - -return 0 ; -} -#endif -int board_init (void ) { -#if CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM )return 0 ; -#else -int ret; - -/* We do some SoC one time setting here */ -if (!fdt_node_check_compatible (gd->fdt_blob,0 ,"google,veyron" )) { - ret =veyron_init (); -if (ret) -return ret; - } - -return 0 ; -#endif }#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF )
board/google/veyron/veyron.c +63 -0
86 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 16/24 rockchip: rk3288: Move clock CMD to SoC file
In reply to Kever YangMove the do_clock CMD to rk3288.c so that we can re-use the common board file later.
---
arch/arm/mach-rockchip/rk3288-board.c | 51 ------------------------ arch/arm/mach-rockchip/rk3288/rk3288.c | 55 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 51 deletions(-)
arch/arm/mach-rockchip/rk3288-board.c +0 -51
@@ -127,54 +127,3 @@ int board_usb_cleanup(int index, enum usb_init_type init) return 0; }#endif - -static int do_clock (cmd_tbl_t *cmdtp,int flag,int argc, -char *const argv[]) -{ -static const struct { -char *name; -int id; - } clks[] = { - {"osc" ,CLK_OSC }, - {"apll" ,CLK_ARM }, - {"dpll" ,CLK_DDR }, - {"cpll" ,CLK_CODEC }, - {"gpll" ,CLK_GENERAL }, -#ifdef CONFIG_ROCKCHIP_RK3036 - {"mpll" ,CLK_NEW }, -#else - {"npll" ,CLK_NEW }, -#endif - }; -int ret, i; -struct udevice *dev; - - ret =rockchip_get_clk (&dev); -if (ret) { -printf ("clk-uclass not found\n" ); -return 0 ; - } - -for (i =0 ; i <ARRAY_SIZE (clks); i++) { -struct clk clk; -ulong rate; - - clk.id = clks[i].id; - ret =clk_request (dev, &clk); -if (ret <0 ) -continue ; - - rate =clk_get_rate (&clk); -printf ("%s: %lu\n" , clks[i].name, rate); - -clk_free (&clk); - } - -return 0 ; -} - -U_BOOT_CMD ( - clock,2 ,1 , do_clock, -"display information about clocks" , -"" -);
arch/arm/mach-rockchip/rk3288/rk3288.c +55 -0
67 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 17/24 rockchip: rk3288: Move rk3288_detect_reset_reason to soc file
In reply to Kever YangThe rk3288_detect_reset_reason() is per-SoC operation, move it to rk3288.c, and extend the rk_board_late_init() with rk3288_board_late_init() to make all the board works fine as before.
---
arch/arm/mach-rockchip/rk3288-board.c | 38 -------------- arch/arm/mach-rockchip/rk3288/rk3288.c | 49 +++++++++++++++++++ .../popmetal_rk3288/popmetal-rk3288.c | 2 +- board/phytec/phycore_rk3288/phycore-rk3288.c | 2 +- board/rockchip/tinker_rk3288/tinker-rk3288.c | 2 +- 5 files changed, 52 insertions(+), 41 deletions(-)
arch/arm/mach-rockchip/rk3288-board.c +0 -38
@@ -24,47 +24,9 @@ __weak int rk_board_late_init(void)return 0 ; } -static void rk3288_detect_reset_reason (void ) -{ -struct rk3288_cru *cru =rockchip_get_cru (); -const char *reason; - -if (IS_ERR (cru)) -return ; - -switch (cru->cru_glb_rst_st) { -case GLB_POR_RST : - reason ="POR" ; -break ; -case FST_GLB_RST_ST : -case SND_GLB_RST_ST : - reason ="RST" ; -break ; -case FST_GLB_TSADC_RST_ST : -case SND_GLB_TSADC_RST_ST : - reason ="THERMAL" ; -break ; -case FST_GLB_WDT_RST_ST : -case SND_GLB_WDT_RST_ST : - reason ="WDOG" ; -break ; -default : - reason ="unknown reset" ; - } - -env_set ("reset_reason" , reason); - -/* -* Clear cru_glb_rst_st, so we can determine the last reset cause -* for following resets. -*/ -rk_clrreg (&cru->cru_glb_rst_st,GLB_RST_ST_MASK ); -} -int board_late_init (void ) {setup_boot_mode (); -rk3288_detect_reset_reason ();return rk_board_late_init (); }
arch/arm/mach-rockchip/rk3288/rk3288.c +49 -0
55 lines not on this page · raw message
board/chipspark/popmetal_rk3288/popmetal-rk3288.c +1 -1
@@ -8,7 +8,7 @@#define GPIO7A3_HUB_RST 227 -int rk_board_late_init (void ) +int rk3288_board_late_init (void ) {int ret;
board/phytec/phycore_rk3288/phycore-rk3288.c +1 -1
@@ -30,7 +30,7 @@ static int valid_rk3288_som(struct rk3288_som *som)return hw == som->bs; } -int rk_board_late_init (void ) +int rk3288_board_late_init (void ) {int ret;struct udevice *dev;
board/rockchip/tinker_rk3288/tinker-rk3288.c +1 -1
@@ -21,7 +21,7 @@ static int get_ethaddr_from_eeprom(u8 *addr)return i2c_eeprom_read (dev,0 , addr,6 ); } -int rk_board_late_init (void ) +int rk3288_board_late_init (void ) {u8 ethaddr[6 ];
Signature · 1 line
2.17.1
PATCH 18/24 rockchip: rk3288: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3288-board.c | 91 --------------------------- 3 files changed, 1 insertion(+), 92 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3288-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -80,6 +80,7 @@ config ROCKCHIP_RK3288 select SUPPORT_SPL select SPL select SUPPORT_TPL + imply ROCKCHIP_COMMON_BOARD imply SPL_ROCKCHIP_COMMON_BOARD imply TPL_CLK imply TPL_DM
arch/arm/mach-rockchip/Makefile +0 -1
@@ -22,7 +22,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o -obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o endif
arch/arm/mach-rockchip/rk3288-board.c deleted +0 -91
91 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 19/24 rockchip: rk3328: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + board/rockchip/evb_rk3328/evb-rk3328.c | 64 -------------------------- 2 files changed, 1 insertion(+), 64 deletions(-)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -110,6 +110,7 @@ config ROCKCHIP_RK3328 select ARM64 select SUPPORT_SPL select SPL + imply ROCKCHIP_COMMON_BOARD imply SPL_ROCKCHIP_COMMON_BOARD imply SPL_SERIAL_SUPPORT imply SPL_SEPARATE_BSS
board/rockchip/evb_rk3328/evb-rk3328.c +0 -64
67 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 19/24 rockchip: rk3328: Migrate to use common board file
22.07.2019 15:02, Kever Yang пишет:
Quoted 4 lines
Use common board file for
board_init()andboard_late_init(), for Rockchip SoCs have very similar process.Signed-off-by Kever Yang <[email protected]>
Hi,
I've just checked that rock64-rk3328_defconfig is still bootable with this series.
Quoted 91 lines
---
arch/arm/mach-rockchip/Kconfig | 1 + board/rockchip/evb_rk3328/evb-rk3328.c | 64 -------------------------- 2 files changed, 1 insertion(+), 64 deletions(-)arch/arm/mach-rockchip/Kconfig +1
-0@@ -110,6 +110,7 @@ config ROCKCHIP_RK3328 select ARM64 select SUPPORT_SPL select SPL + imply ROCKCHIP_COMMON_BOARD imply SPL_ROCKCHIP_COMMON_BOARD imply SPL_SERIAL_SUPPORT imply SPL_SEPARATE_BSSboard/rockchip/evb_rk3328/evb-rk3328.c +0
-64@@ -3,67 +3,3 @@* (C) Copyright 2016 Rockchip Electronics Co., Ltd */ -#include <common.h> -#include <asm/armv8/mmu.h> -#include <dwc3-uboot.h> -#include <power/regulator.h> -#include <usb.h> - -DECLARE_GLOBAL_DATA_PTR ; - -int board_init (void ) -{ -int ret; - - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); - -return ret; -} - -#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) -#include <usb.h> -#include <usb/dwc2_udc.h> - -static struct dwc2_plat_otg_data otg_data = { - .rx_fifo_sz =512 , - .np_tx_fifo_sz =16 , - .tx_fifo_sz =128 , -}; - -int board_usb_init (int index,enum usb_init_type init) -{ -int node; -const char *mode; -bool matched = false; -const void *blob = gd->fdt_blob; - -/* find the usb_otg node */ - node =fdt_node_offset_by_compatible (blob,-1 , -"snps,dwc2" ); - -while (node >0 ) { - mode =fdt_getprop (blob, node,"dr_mode" ,NULL ); -if (mode &&strcmp (mode,"otg" ) ==0 ) { - matched = true; -break ; - } - - node =fdt_node_offset_by_compatible (blob, node, -"snps,dwc2" ); - } -if (!matched) { -debug ("Not found usb_otg device\n" ); -return -ENODEV ; - } - otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); - -return dwc2_udc_probe (&otg_data); -} - -int board_usb_cleanup (int index,enum usb_init_type init) -{ -return 0 ; -} -#endif
PATCH 20/24 rockchip: rk3328: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + board/rockchip/evb_px5/evb-px5.c | 6 ------ board/rockchip/sheep_rk3368/sheep_rk3368.c | 15 --------------- .../lion_rk3368/lion_rk3368.c | 18 ------------------ 4 files changed, 1 insertion(+), 39 deletions(-)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -131,6 +131,7 @@ config ROCKCHIP_RK3368 select SUPPORT_TPL select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL select TPL_NEEDS_SEPARATE_STACK if TPL + imply ROCKCHIP_COMMON_BOARD imply SPL_ROCKCHIP_COMMON_BOARD imply SPL_SEPARATE_BSS imply SPL_SERIAL_SUPPORT
board/rockchip/evb_px5/evb-px5.c +0 -6
@@ -2,9 +2,3 @@/* * Copyright (c) 2017 Andy Yan */ -#include <common.h> - -int board_init (void ) -{ -return 0 ; -}
board/rockchip/sheep_rk3368/sheep_rk3368.c +0 -15
@@ -2,18 +2,3 @@/* * Copyright (c) 2017 Andy Yan */ -#include <common.h> -#include <asm/io.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3368.h> -#include <syscon.h> - -int mach_cpu_init (void ) -{ -return 0 ; -} - -int board_init (void ) -{ -return 0 ; -}
board/theobroma-systems/lion_rk3368/lion_rk3368.c +0 -18
@@ -2,21 +2,3 @@/* * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH */ -#include <common.h> -#include <dm.h> -#include <ram.h> -#include <asm/io.h> -#include <asm/arch-rockchip/clock.h> -#include <asm/arch-rockchip/grf_rk3368.h> -#include <asm/arch-rockchip/timer.h> -#include <syscon.h> - -int mach_cpu_init (void ) -{ -return 0 ; -} - -int board_init (void ) -{ -return 0 ; -}
Signature · 1 line
2.17.1
PATCH 21/24 rockchip: rk3399: init vbus regulator in board_early_init_f()
In reply to Kever YangHandle per-board init in board_early_init_f() and use the common board_init() for per-platform board init later.
---
board/rockchip/evb_rk3399/evb-rk3399.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
board/rockchip/evb_rk3399/evb-rk3399.c +17 -9
@@ -9,15 +9,12 @@#include <asm/arch-rockchip/periph.h> #include <power/regulator.h> -int board_init (void ) +#ifndef CONFIG_SPL_BUILD +int board_early_init_f (void ) {struct udevice *regulator;int ret; - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); - ret =regulator_get_by_platname ("vcc5v0_host" , ®ulator);if (ret) {debug ("%s vcc5v0_host init fail! ret %d\n" , __func__, ret);
@@ -25,11 +22,22 @@ int board_init(void) } ret =regulator_set_enable (regulator, true); -if (ret) { -debug ("%s vcc5v0-host-en set fail!\n" , __func__); - goto out; - } +if (ret) +debug ("%s vcc5v0-host-en set fail! ret %d\n" , __func__, ret); out:return 0 ; } + +int board_init (void ) +{ +struct udevice *regulator; +int ret; + + ret =regulators_enable_boot_on (false); +if (ret) +debug ("%s: Cannot enable boot on regulator\n" , __func__); + +return 0 ; +} +#endif
Signature · 1 line
2.17.1
PATCH 22/24 rockchip: rk3399: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3399-board.c | 13 ------------- board/rockchip/evb_rk3399/evb-rk3399.c | 13 ------------- board/theobroma-systems/puma_rk3399/puma-rk3399.c | 15 --------------- board/vamrs/rock960_rk3399/rock960-rk3399.c | 15 --------------- 6 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3399-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -177,6 +177,7 @@ config ROCKCHIP_RK3399 select DM_PMIC select DM_REGULATOR_FIXED select BOARD_LATE_INIT + imply ROCKCHIP_COMMON_BOARD imply SPL_ROCKCHIP_COMMON_BOARD imply TPL_SERIAL_SUPPORT imply TPL_LIBCOMMON_SUPPORT
arch/arm/mach-rockchip/Makefile +0 -1
@@ -22,7 +22,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o -obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board.o obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o endif
arch/arm/mach-rockchip/rk3399-board.c deleted +0 -13
@@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright (c) 2017 Rockchip Electronics Co., Ltd -*/ - -#include <common.h> -#include <asm/arch-rockchip/boot_mode.h> - -int board_late_init (void ) -{ -setup_boot_mode (); -return 0 ; -}
board/rockchip/evb_rk3399/evb-rk3399.c +0 -13
@@ -5,7 +5,6 @@#include <common.h> #include <dm.h> -#include <dm/pinctrl.h> #include <asm/arch-rockchip/periph.h> #include <power/regulator.h>
@@ -28,16 +27,4 @@ int board_early_init_f(void) out: return 0; } - -int board_init (void ) -{ -struct udevice *regulator; -int ret; - - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); - -return 0 ; -}#endif
board/theobroma-systems/puma_rk3399/puma-rk3399.c +0 -15
@@ -21,21 +21,6 @@#include <power/regulator.h> #include <u-boot/sha256.h> -int board_init (void ) -{ -int ret; - -/* -* We need to call into regulators_enable_boot_on() again, as the call -* during SPL may have not included all regulators. -*/ - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); - -return 0 ; -} -static void setup_macaddr (void ) {#if CONFIG_IS_ENABLED (CMD_NET )
board/vamrs/rock960_rk3399/rock960-rk3399.c +0 -15
@@ -2,18 +2,3 @@/* * Copyright (C) 2018 Manivannan Sadhasivam <[email protected]> */ - -#include <common.h> -#include <dm.h> -#include <power/regulator.h> - -int board_init (void ) -{ -int ret; - - ret =regulators_enable_boot_on (false); -if (ret) -debug ("%s: Cannot enable boot on regulator\n" , __func__); - -return 0 ; -}
Signature · 1 line
2.17.1
PATCH 23/24 rockchip: elgin-rv1108: use board_early_init_f for per-boar init
In reply to Kever YangUse board_early_init_f() for per-board init operation and use board_init() from common board file.
---
board/elgin/elgin_rv1108/elgin_rv1108.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
board/elgin/elgin_rv1108/elgin_rv1108.c +4 -1
@@ -50,11 +50,14 @@ int mach_cpu_init(void)#define MODEM_ENABLE_GPIO 111 -int board_init (void ) +int board_early_init_f (void ) {gpio_request (MODEM_ENABLE_GPIO ,"modem_enable" );gpio_direction_output (MODEM_ENABLE_GPIO ,0 ); +} +int board_init (void ) +{return 0 ; }
Signature · 1 line
2.17.1
PATCH 24/24 rockchip: rv1108: Migrate to use common board file
In reply to Kever YangUse common board file for board_init() and board_late_init(), for Rockchip SoCs have very similar process.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 2 - arch/arm/mach-rockchip/rv1108-board.c | 52 ------------------------- arch/arm/mach-rockchip/rv1108/rv1108.c | 10 ----- board/elgin/elgin_rv1108/elgin_rv1108.c | 5 --- board/rockchip/evb_rv1108/evb_rv1108.c | 6 --- 6 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rv1108-board.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -203,6 +203,7 @@ config ROCKCHIP_RK3399 config ROCKCHIP_RV1108 bool "Support Rockchip RV1108" select CPU_V7A + imply ROCKCHIP_COMMON_BOARD help The Rockchip RV1108 is a ARM-based SoC with a single-core Cortex-A7 and a DSP.
arch/arm/mach-rockchip/Makefile +0 -2
@@ -21,8 +21,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # meaning "turn it off". obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o - -obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108-board.o endif obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram_common.o
arch/arm/mach-rockchip/rv1108-board.c deleted +0 -52
52 lines not on this page · raw message
arch/arm/mach-rockchip/rv1108/rv1108.c +0 -10
@@ -3,13 +3,3 @@* (C) Copyright 2016 Rockchip Electronics Co., Ltd * Author: Andy Yan <[email protected]> */ - -#include <common.h> - -#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) -void enable_caches (void ) -{ -/* Enable D-cache. I-cache is already enabled in start.S */ -dcache_enable (); -} -#endif
board/elgin/elgin_rv1108/elgin_rv1108.c +0 -5
@@ -56,11 +56,6 @@ int board_early_init_f(void)gpio_direction_output (MODEM_ENABLE_GPIO ,0 ); } -int board_init (void ) -{ -return 0 ; -} -int dram_init (void ) { gd->ram_size =0x8000000 ;
board/rockchip/evb_rv1108/evb_rv1108.c +0 -6
@@ -47,12 +47,6 @@ int mach_cpu_init(void)return 0 ; } - -int board_init (void ) -{ -return 0 ; -} -int dram_init (void ) { gd->ram_size =0x8000000 ;
Signature · 1 line
2.17.1