rockchip: Migrate to use common SPL board file
Subsystems (4)
cover rockchip: Migrate to use common SPL board file
Rockchip SoCs have similar boot process, we can re-use the same SPL board file for all SoCs, and avoid too much copy-paste overhead.
Kever Yang (35):
rockchip: remove redundant CONFIG_SYS_NS16550_MEM32
rockchip: add CONFIG_IRAM_BASE for all SoCs
rockchip: intruduce common BROM_BOOTSOURCE_ID_ADDR
rockchip: declear boot_devices in bootrom.h
rockchip: add common spl board file
rockchip: rk3188: init CPU freq in clock driver
rockchip: rk3188: move usb uart init into arch_cpu_init()
rockchip: Migrate to use BOOTROM_SUPPORT driver
rockchip: rk3188: move spl_board_init() into rk3188.c
rockchip: rk3188: add boot_devices mapping to support 'same-as-spl'
rockchip: rk3188: migrate to use common spl board file
rockchip: rk322x: introduce arch_cpu_init() for SoC setting init
rockchip: rk322x: migrate to use common spl board file
rockchip: rk322x: add boot_devices mapping to support 'same-as-spl'
rockchip: fit_spl_optee: rockchip: fix warning unit_address_vs_reg
rockchip: rk3288: show SPL BANNER earlier in board_init_f()
rockchip: rk3288: move setup_led() to firefly-rk3288
rockchip: rk3288-phycore: move phycore_init() to its own board file
rockchip: rk3288: move dram_init_banksize() into soc file
rockchip: rk3288: Migrate to use common spl board file
rockchip: phycore: remove no use "u-boot,boot0" in dts
rockchip: rk3288-veyron: Migrate "u-boot,boot0" to
"u-boot,spl-boot-order"
rockchip: rk3288: add boot_devices mapping to support 'same-as-spl'
rockchip: rk3328: add STIMER_BASE definition
rockchip: rk3328: migrate to use common spl board file
rockchip: rk3328: add boot_devices mapping to support 'same-as-spl'
rockchip: rk3368: migrate to use common spl board file
rockchip: rk3368: add boot_devices mapping to support 'same-as-spl'
rockchip: rk3399: move spl_perform_fixups() into soc file
rockchip: rk3399: show SPL BANNER earlier in board_init_f()
rockchip: rk3399: move SoC setting into arch_cpu_init()
rockchip: rk3399; move spl_board_init() into soc file
rockchip: rk3399: move boot_devices into soc file
rockchip: rk3399: move chromebook bob specific flow to its board file
rockchip: rk3399: Migrate to use common spl board file
arch/arm/dts/rk3288-phycore-rdk.dts | 5 - arch/arm/dts/rk3288-veyron.dtsi | 6 +- arch/arm/include/asm/arch-rockchip/bootrom.h | 4 +- .../arm/include/asm/arch-rockchip/sys_proto.h | 4 - arch/arm/mach-rockchip/Kconfig | 24 +- arch/arm/mach-rockchip/Makefile | 7 +- arch/arm/mach-rockchip/fit_spl_optee.its | 16 +- arch/arm/mach-rockchip/rk3188-board-spl.c | 193 -------------- arch/arm/mach-rockchip/rk3188/rk3188.c | 70 ++++- arch/arm/mach-rockchip/rk322x-board-spl.c | 76 ------ arch/arm/mach-rockchip/rk322x/rk322x.c | 18 ++ arch/arm/mach-rockchip/rk3288-board-spl.c | 249 ----------------- arch/arm/mach-rockchip/rk3288/Kconfig | 2 + arch/arm/mach-rockchip/rk3288/rk3288.c | 21 ++ arch/arm/mach-rockchip/rk3328-board-spl.c | 58 ---- arch/arm/mach-rockchip/rk3328/rk3328.c | 6 + arch/arm/mach-rockchip/rk3368-board-spl.c | 80 ------ arch/arm/mach-rockchip/rk3368/rk3368.c | 6 + arch/arm/mach-rockchip/rk3399-board-spl.c | 251 ------------------ arch/arm/mach-rockchip/rk3399/rk3399.c | 144 +++++++++- arch/arm/mach-rockchip/spl.c | 154 +++++++++++ board/firefly/firefly-rk3288/firefly-rk3288.c | 36 +++ board/google/gru/gru.c | 21 ++ board/phytec/phycore_rk3288/phycore-rk3288.c | 47 ++++ drivers/clk/rockchip/clk_rk3188.c | 3 + include/configs/rk3128_common.h | 2 + include/configs/rk3188_common.h | 3 +- include/configs/rk322x_common.h | 1 + include/configs/rk3288_common.h | 2 + include/configs/rk3328_common.h | 6 +- include/configs/rk3368_common.h | 2 +- include/configs/rk3399_common.h | 2 +- include/configs/rv1108_common.h | 2 + 33 files changed, 568 insertions(+), 953 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3188-board-spl.c delete mode 100644 arch/arm/mach-rockchip/rk322x-board-spl.c delete mode 100644 arch/arm/mach-rockchip/rk3288-board-spl.c delete mode 100644 arch/arm/mach-rockchip/rk3328-board-spl.c delete mode 100644 arch/arm/mach-rockchip/rk3368-board-spl.c delete mode 100644 arch/arm/mach-rockchip/rk3399-board-spl.c create mode 100644 arch/arm/mach-rockchip/spl.c
Signature · 1 line
2.17.1
PATCH 1/35 rockchip: remove redundant CONFIG_SYS_NS16550_MEM32
The CONFIG_SYS_NS16550_MEM32 already defined inrockchip_common.h, no need to define again in soc
level header.
---
include/configs/rk3188_common.h | 2 -- include/configs/rk3328_common.h | 2 -- include/configs/rk3368_common.h | 2 -- include/configs/rk3399_common.h | 2 -- 4 files changed, 8 deletions(-)
include/configs/rk3188_common.h +0 -2
@@ -15,8 +15,6 @@#define CONFIG_SYS_MALLOC_LEN (32 << 20)#define CONFIG_SYS_CBSIZE 1024 -#define CONFIG_SYS_NS16550_MEM32 -#ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM /* Bootrom will load u-boot binary to 0x60000000 once return from SPL */ #endif
include/configs/rk3328_common.h +0 -2
@@ -12,8 +12,6 @@#define CONFIG_SYS_CBSIZE 1024#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_SYS_NS16550_MEM32 -#define CONFIG_SYS_INIT_SP_ADDR 0x00300000#define CONFIG_SYS_LOAD_ADDR 0x00800800#define CONFIG_SPL_STACK 0x00400000
include/configs/rk3368_common.h +0 -2
@@ -23,8 +23,6 @@#define CONFIG_ROCKCHIP_STIMER_BASE 0xff830020#define COUNTER_FREQUENCY 24000000 -#define CONFIG_SYS_NS16550_MEM32 -#define CONFIG_SYS_INIT_SP_ADDR 0x00300000#define CONFIG_SYS_LOAD_ADDR 0x00280000
include/configs/rk3399_common.h +0 -2
@@ -15,8 +15,6 @@#define COUNTER_FREQUENCY 24000000#define CONFIG_ROCKCHIP_STIMER_BASE 0xff8680a0 -#define CONFIG_SYS_NS16550_MEM32 -#define CONFIG_SYS_INIT_SP_ADDR 0x00300000#define CONFIG_SYS_LOAD_ADDR 0x00800800
Signature · 1 line
2.17.1
PATCH 2/35 rockchip: add CONFIG_IRAM_BASE for all SoCs
In reply to Kever YangRockchip SoCs have internal sram for bootrom data area and for sdram init program space. Introduce the base address in case we need to use it.
---
include/configs/rk3128_common.h | 2 ++ include/configs/rk3188_common.h | 1 + include/configs/rk322x_common.h | 1 + include/configs/rk3288_common.h | 2 ++ include/configs/rk3328_common.h | 2 ++ include/configs/rk3368_common.h | 2 ++ include/configs/rk3399_common.h | 2 ++ include/configs/rv1108_common.h | 2 ++ 8 files changed, 14 insertions(+)
include/configs/rk3128_common.h +2 -0
@@ -19,6 +19,8 @@#define CONFIG_SYS_ARCH_TIMER #define CONFIG_SYS_HZ_CLOCK 24000000 +#define CONFIG_IRAM_BASE 0x10080000 +#define CONFIG_SYS_INIT_SP_ADDR 0x60100000#define CONFIG_SYS_LOAD_ADDR 0x60800800
include/configs/rk3188_common.h +1 -0
@@ -23,6 +23,7 @@#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (0x8000 - 0x800)#define CONFIG_ROCKCHIP_CHIP_TAG "RK31" +#define CONFIG_IRAM_BASE 0x10080000/* spl size 32kb sram - 2kb bootrom */ #define CONFIG_SPL_MAX_SIZE (0x8000 - 0x800)
include/configs/rk322x_common.h +1 -0
@@ -24,6 +24,7 @@#define CONFIG_ROCKCHIP_MAX_INIT_SIZE (28 << 10)#define CONFIG_ROCKCHIP_CHIP_TAG "RK32" +#define CONFIG_IRAM_BASE 0x10080000#define CONFIG_SYS_SDRAM_BASE 0x60000000#define SDRAM_BANK_SIZE (512UL << 20UL)
include/configs/rk3288_common.h +2 -0
@@ -25,6 +25,8 @@#define CONFIG_SYS_LOAD_ADDR 0x00800800#define CONFIG_SPL_STACK 0xff718000 +#define CONFIG_IRAM_BASE 0xff700000 +/* RAW SD card / eMMC locations. */ #define CONFIG_SYS_SPI_U_BOOT_OFFS (128 << 10)
include/configs/rk3328_common.h +2 -0
@@ -8,6 +8,8 @@#include "rockchip-common.h" +#define CONFIG_IRAM_BASE 0xff090000 +#define CONFIG_SYS_MALLOC_LEN (32 << 20)#define CONFIG_SYS_CBSIZE 1024#define CONFIG_SKIP_LOWLEVEL_INIT
include/configs/rk3368_common.h +2 -0
@@ -23,6 +23,8 @@#define CONFIG_ROCKCHIP_STIMER_BASE 0xff830020#define COUNTER_FREQUENCY 24000000 +#define CONFIG_IRAM_BASE 0xff8c0000 +#define CONFIG_SYS_INIT_SP_ADDR 0x00300000#define CONFIG_SYS_LOAD_ADDR 0x00280000
include/configs/rk3399_common.h +2 -0
@@ -15,6 +15,8 @@#define COUNTER_FREQUENCY 24000000#define CONFIG_ROCKCHIP_STIMER_BASE 0xff8680a0 +#define CONFIG_IRAM_BASE 0xff8c0000 +#define CONFIG_SYS_INIT_SP_ADDR 0x00300000#define CONFIG_SYS_LOAD_ADDR 0x00800800
include/configs/rv1108_common.h +2 -0
@@ -8,6 +8,8 @@#include <asm/arch-rockchip/hardware.h> #include "rockchip-common.h" +#define CONFIG_IRAM_BASE 0x10080000 +#define CONFIG_SYS_MALLOC_LEN (32 << 20)#define CONFIG_SYS_CBSIZE 1024#define CONFIG_SKIP_LOWLEVEL_INIT
Signature · 1 line
2.17.1
PATCH 3/35 rockchip: intruduce common BROM_BOOTSOURCE_ID_ADDR
In reply to Kever YangThe boot source from BootRom is store at a fix offset of IRAM, update to use the common macro instead of rk3399 specific one.
---
arch/arm/include/asm/arch-rockchip/bootrom.h | 2 +- arch/arm/mach-rockchip/rk3399-board-spl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-rockchip/bootrom.h +1 -1
@@ -55,6 +55,6 @@ enum {/** * Locations of the boot-device identifier in SRAM */ -#define RK3399_BROM_BOOTSOURCE_ID_ADDR 0xff8c0010 +#define BROM_BOOTSOURCE_ID_ADDR (CONFIG_IRAM_BASE + 0x10)#endif
arch/arm/mach-rockchip/rk3399-board-spl.c +1 -1
@@ -35,7 +35,7 @@ static const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {const char *board_spl_was_booted_from (void ) { -u32 bootdevice_brom_id =readl (RK3399_BROM_BOOTSOURCE_ID_ADDR ); +u32 bootdevice_brom_id =readl (BROM_BOOTSOURCE_ID_ADDR );const char *bootdevice_ofpath =NULL ;if (bootdevice_brom_id <ARRAY_SIZE (boot_devices))
Signature · 1 line
2.17.1
PATCH 4/35 rockchip: declear boot_devices in bootrom.h
In reply to Kever Yangboot_devices may defined in soc file, and used in board file, we need to delear it in header file.
---
arch/arm/include/asm/arch-rockchip/bootrom.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/include/asm/arch-rockchip/bootrom.h +2 -0
@@ -52,6 +52,8 @@ enum { BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB }; +extern const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ]; +/** * Locations of the boot-device identifier in SRAM */
Signature · 1 line
2.17.1
PATCH 5/35 rockchip: add common spl board file
In reply to Kever YangThe common spl board file handles board_init_f() in SPL, and with board_early_init_f() and arch_cpu_init() callback, other operateion after board_init_f() should go to board specific spl_board_init().
---
arch/arm/mach-rockchip/Kconfig | 8 ++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/spl.c | 154 ++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 arch/arm/mach-rockchip/spl.c
arch/arm/mach-rockchip/Kconfig +8 -0
@@ -227,6 +227,14 @@ 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 SPL_ROCKCHIP_COMMON_BOARD + bool "Rockchip SPL common board file" + depends on SPL + help + Rockchip SoCs have similar boot process, SPL is mainly in charge of + load and boot Trust ATF/U-Boot firmware, and DRAM init if there is + no TPL for the board. + config TPL_ROCKCHIP_COMMON_BOARD bool "" depends on TPL
arch/arm/mach-rockchip/Makefile +1 -0
@@ -7,6 +7,7 @@ # inaccessible/protected memory (and the bootrom-helper assumes that # the stack-pointer is valid before switching to the U-Boot stack). obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o +obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o
arch/arm/mach-rockchip/spl.c new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 6/35 rockchip: rk3188: init CPU freq in clock driver
In reply to Kever YangInit CPU frquency in clock driver instead of in SPL board file, this will help for use common board file later.
---
arch/arm/mach-rockchip/rk3188-board-spl.c | 22 ---------------------- drivers/clk/rockchip/clk_rk3188.c | 3 +++ 2 files changed, 3 insertions(+), 22 deletions(-)
arch/arm/mach-rockchip/rk3188-board-spl.c +0 -22
@@ -70,27 +70,6 @@ fallback:return BOOT_DEVICE_MMC1 ; } -static int setup_arm_clock (void ) -{ -struct udevice *dev; -struct clk clk; -int ret; - - ret =rockchip_get_clk (&dev); -if (ret) -return ret; - - clk.id =CLK_ARM ; - ret =clk_request (dev, &clk); -if (ret <0 ) -return ret; - - ret =clk_set_rate (&clk,600000000 ); - -clk_free (&clk); -return ret; -} -void board_init_f (ulong dummy) {struct udevice *dev;
@@ -146,7 +125,6 @@ void board_init_f(ulong dummy)return ; } -setup_arm_clock ();#if CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM ) && !defined(CONFIG_SPL_BOARD_INIT )back_to_bootrom (BROM_BOOT_NEXTSTAGE );#endif
drivers/clk/rockchip/clk_rk3188.c +3 -0
@@ -562,6 +562,9 @@ static int rk3188_clk_probe(struct udevice *dev)#endif rkclk_init (priv->cru, priv->grf, priv->has_bwadj); + +/* Init CPU frequency */ +rkclk_configure_cpu (priv->cru, priv->grf,APLL_HZ , priv->has_bwadj);#endif return 0 ;
Signature · 1 line
2.17.1
PATCH 7/35 rockchip: rk3188: move usb uart init into arch_cpu_init()
In reply to Kever YangThe SoC feature init will be better to use arch_cpu_init() and goes to soc file.
---
arch/arm/mach-rockchip/rk3188-board-spl.c | 27 +++++----------------- arch/arm/mach-rockchip/rk3188/rk3188.c | 28 ++++++++++++++++++++++- 2 files changed, 33 insertions(+), 22 deletions(-)
arch/arm/mach-rockchip/rk3188-board-spl.c +6 -21
@@ -17,10 +17,7 @@#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> #include <asm/arch-rockchip/periph.h> -#include <asm/arch-rockchip/pmu_rk3188.h> #include <asm/arch-rockchip/sdram.h> #include <dm/root.h> #include <dm/test.h>
@@ -70,6 +67,11 @@ fallback:return BOOT_DEVICE_MMC1 ; } +__weak int arch_cpu_init (void ) +{ +return 0 ; +} +void board_init_f (ulong dummy) {struct udevice *dev;
@@ -88,24 +90,7 @@ void board_init_f(ulong dummy)printascii ("U-Boot SPL board init" );#endif -#ifdef CONFIG_ROCKCHIP_USB_UART -rk_clrsetreg (&grf->uoc0_con[0 ], -SIDDQ_MASK |UOC_DISABLE_MASK |COMMON_ON_N_MASK , -1 <<SIDDQ_SHIFT |1 <<UOC_DISABLE_SHIFT | -1 <<COMMON_ON_N_SHIFT ); -rk_clrsetreg (&grf->uoc0_con[2 ], -SOFT_CON_SEL_MASK ,1 <<SOFT_CON_SEL_SHIFT ); -rk_clrsetreg (&grf->uoc0_con[3 ], -OPMODE_MASK |XCVRSELECT_MASK | -TERMSEL_FULLSPEED_MASK |SUSPENDN_MASK , -OPMODE_NODRIVING <<OPMODE_SHIFT | -XCVRSELECT_FSTRANSC <<XCVRSELECT_SHIFT | -1 <<TERMSEL_FULLSPEED_SHIFT | -1 <<SUSPENDN_SHIFT ); -rk_clrsetreg (&grf->uoc0_con[0 ], -BYPASSSEL_MASK |BYPASSDMEN_MASK , -1 <<BYPASSSEL_SHIFT |1 <<BYPASSDMEN_SHIFT ); -#endif +arch_cpu_init (); ret =spl_early_init ();if (ret) {
arch/arm/mach-rockchip/rk3188/rk3188.c +27 -1
@@ -7,11 +7,12 @@#include <asm/arch-rockchip/grf_rk3188.h> #include <asm/arch-rockchip/hardware.h> +#define GRF_BASE 0x20008000 + #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,
@@ -34,3 +35,28 @@ void board_debug_uart_init(void) GPIO1B0_UART2_SIN << GPIO1B0_SHIFT); }#endif + +int arch_cpu_init (void ) +{ +#ifdef CONFIG_ROCKCHIP_USB_UART +struct rk3188_grf *const grf = (void *)GRF_BASE ; + +rk_clrsetreg (&grf->uoc0_con[0 ], +SIDDQ_MASK |UOC_DISABLE_MASK |COMMON_ON_N_MASK , +1 <<SIDDQ_SHIFT |1 <<UOC_DISABLE_SHIFT | +1 <<COMMON_ON_N_SHIFT ); +rk_clrsetreg (&grf->uoc0_con[2 ], +SOFT_CON_SEL_MASK ,1 <<SOFT_CON_SEL_SHIFT ); +rk_clrsetreg (&grf->uoc0_con[3 ], +OPMODE_MASK |XCVRSELECT_MASK | +TERMSEL_FULLSPEED_MASK |SUSPENDN_MASK , +OPMODE_NODRIVING <<OPMODE_SHIFT | +XCVRSELECT_FSTRANSC <<XCVRSELECT_SHIFT | +1 <<TERMSEL_FULLSPEED_SHIFT | +1 <<SUSPENDN_SHIFT ); +rk_clrsetreg (&grf->uoc0_con[0 ], +BYPASSSEL_MASK |BYPASSDMEN_MASK , +1 <<BYPASSSEL_SHIFT |1 <<BYPASSDMEN_SHIFT ); +#endif +return 0 ; +}
Signature · 1 line
2.17.1
PATCH 8/35 rockchip: Migrate to use BOOTROM_SUPPORT driver
In reply to Kever YangSPL bootrom support is a boot device just like mmc and etc, use formal boot device instead of jump to bootrom directly. Enable the Kconfig by default if ROCKCHIP_BACK_TO_BROM is enabled.
---
arch/arm/mach-rockchip/Kconfig | 9 +++------ arch/arm/mach-rockchip/rk3188-board-spl.c | 13 ++++++------- arch/arm/mach-rockchip/rk3288-board-spl.c | 13 ++++++------- 3 files changed, 15 insertions(+), 20 deletions(-)
arch/arm/mach-rockchip/Kconfig +3 -6
@@ -34,8 +34,8 @@ config ROCKCHIP_RK3188 select SPL_RAM select SPL_DRIVERS_MISC_SUPPORT select SPL_ROCKCHIP_EARLYRETURN_TO_BROM + select SPL_ROCKCHIP_BACK_TO_BROM select BOARD_LATE_INIT - select ROCKCHIP_BROM_HELPER help The Rockchip RK3188 is a ARM-based SoC with a quad-core Cortex-A9 including NEON and GPU, 512KB L2 cache, Mali-400 graphics, two
@@ -59,9 +59,7 @@ config ROCKCHIP_RK322X select SPL_DRIVERS_MISC_SUPPORT imply SPL_SERIAL_SUPPORT imply TPL_SERIAL_SUPPORT - imply TPL_BOOTROM_SUPPORT imply TPL_ROCKCHIP_COMMON_BOARD - select ROCKCHIP_BROM_HELPER select TPL_LIBCOMMON_SUPPORT select TPL_LIBGENERIC_SUPPORT help
@@ -77,7 +75,6 @@ config ROCKCHIP_RK3288 select SUPPORT_SPL select SPL select SUPPORT_TPL - imply TPL_BOOTROM_SUPPORT imply TPL_CLK imply TPL_DM imply TPL_DRIVERS_MISC_SUPPORT
@@ -169,12 +166,10 @@ config ROCKCHIP_RK3399 select DM_PMIC select DM_REGULATOR_FIXED select BOARD_LATE_INIT - select ROCKCHIP_BROM_HELPER imply TPL_SERIAL_SUPPORT imply TPL_LIBCOMMON_SUPPORT imply TPL_LIBGENERIC_SUPPORT imply TPL_SYS_MALLOC_SIMPLE - imply TPL_BOOTROM_SUPPORT imply TPL_DRIVERS_MISC_SUPPORT imply TPL_OF_CONTROL imply TPL_DM
@@ -211,6 +206,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM bool "SPL returns to bootrom" default y if ROCKCHIP_RK3036 select ROCKCHIP_BROM_HELPER + select SPL_BOOTROM_SUPPORT depends on SPL help Rockchip SoCs have ability to load SPL & U-Boot binary. If enabled,
@@ -221,6 +217,7 @@ config TPL_ROCKCHIP_BACK_TO_BROM bool "TPL returns to bootrom" default y select ROCKCHIP_BROM_HELPER + select TPL_BOOTROM_SUPPORT depends on TPL help Rockchip SoCs have ability to load SPL & U-Boot binary. If enabled,
arch/arm/mach-rockchip/rk3188-board-spl.c +6 -7
@@ -26,6 +26,11 @@DECLARE_GLOBAL_DATA_PTR ; +void board_return_to_bootrom (void ) +{ +back_to_bootrom (BROM_BOOT_NEXTSTAGE ); +} +u32 spl_boot_device (void ) {#if !CONFIG_IS_ENABLED (OF_PLATDATA )
@@ -109,10 +114,6 @@ void board_init_f(ulong dummy)debug ("DRAM init failed: %d\n" , ret);return ; } - -#if CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM ) && !defined(CONFIG_SPL_BOARD_INIT ) -back_to_bootrom (BROM_BOOT_NEXTSTAGE ); -#endif }static int setup_led (void )
@@ -149,8 +150,6 @@ void spl_board_init(void) }preloader_console_init (); -#if CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM ) -back_to_bootrom (BROM_BOOT_NEXTSTAGE ); -#endif +return ; }
arch/arm/mach-rockchip/rk3288-board-spl.c +6 -7
@@ -30,6 +30,11 @@DECLARE_GLOBAL_DATA_PTR ; +void board_return_to_bootrom (void ) +{ +back_to_bootrom (BROM_BOOT_NEXTSTAGE ); +} +u32 spl_boot_device (void ) {#if !CONFIG_IS_ENABLED (OF_PLATDATA )
@@ -187,10 +192,6 @@ void board_init_f(ulong dummy) return; }#endif - -#if CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM ) && !defined(CONFIG_SPL_BOARD_INIT ) -back_to_bootrom (BROM_BOOT_NEXTSTAGE ); -#endif }static int setup_led (void )
@@ -227,9 +228,7 @@ void spl_board_init(void) }preloader_console_init (); -#if CONFIG_IS_ENABLED (ROCKCHIP_BACK_TO_BROM ) -back_to_bootrom (BROM_BOOT_NEXTSTAGE ); -#endif +return ; }
Signature · 1 line
2.17.1
PATCH 9/35 rockchip: rk3188: move spl_board_init() into rk3188.c
In reply to Kever YangClean up the rk3188.c so that we can re-use the common spl board file.
---
arch/arm/mach-rockchip/rk3188-board-spl.c | 36 ----------------------- arch/arm/mach-rockchip/rk3188/rk3188.c | 36 +++++++++++++++++++++++ 2 files changed, 36 insertions(+), 36 deletions(-)
arch/arm/mach-rockchip/rk3188-board-spl.c +0 -36
@@ -114,42 +114,6 @@ void board_init_f(ulong dummy)debug ("DRAM init failed: %d\n" , ret);return ; } -} - -static int setup_led (void ) -{ -#ifdef CONFIG_SPL_LED -struct udevice *dev; -char *led_name; -int ret; - - led_name =fdtdec_get_config_string (gd->fdt_blob,"u-boot,boot-led" ); -if (!led_name) -return 0 ; - ret =led_get_by_label (led_name, &dev); -if (ret) { -debug ("%s: get=%d\n" , __func__, ret); -return ret; - } - ret =led_set_on (dev,1 ); -if (ret) -return ret; -#endif - -return 0 ; -} - -void spl_board_init (void ) -{ -int ret; - - ret =setup_led (); -if (ret) { -debug ("LED ret=%d\n" , ret); -hang (); - }preloader_console_init (); - -return ; }
arch/arm/mach-rockchip/rk3188/rk3188.c +36 -0
@@ -60,3 +60,39 @@ int arch_cpu_init(void)#endif return 0 ; } + +#ifdef CONFIG_SPL_BUILD +static int setup_led (void ) +{ +#ifdef CONFIG_SPL_LED +struct udevice *dev; +char *led_name; +int ret; + + led_name =fdtdec_get_config_string (gd->fdt_blob,"u-boot,boot-led" ); +if (!led_name) +return 0 ; + ret =led_get_by_label (led_name, &dev); +if (ret) { +debug ("%s: get=%d\n" , __func__, ret); +return ret; + } + ret =led_set_on (dev,1 ); +if (ret) +return ret; +#endif + +return 0 ; +} + +void spl_board_init (void ) +{ +int ret; + + ret =setup_led (); +if (ret) { +debug ("LED ret=%d\n" , ret); +hang (); + } +} +#endif
Signature · 1 line
2.17.1
PATCH 10/35 rockchip: rk3188: add boot_devices mapping to support 'same-as-spl'
In reply to Kever YangThe driver need a mapping to get the dts node by boot srouce ID.
---
arch/arm/mach-rockchip/rk3188/rk3188.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-rockchip/rk3188/rk3188.c +6 -0
@@ -4,11 +4,17 @@*/ #include <common.h> #include <asm/io.h> +#include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/grf_rk3188.h> #include <asm/arch-rockchip/hardware.h> #define GRF_BASE 0x20008000 +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { + [BROM_BOOTSOURCE_EMMC ] ="dwmmc at 1021c000" , + [BROM_BOOTSOURCE_SD ] ="dwmmc at 10214000" , +}; +#ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init (void ) {
Signature · 1 line
2.17.1
PATCH 11/35 rockchip: rk3188: migrate to use common spl board file
In reply to Kever Yangrk3188 has similar boot flow in SPL with other Rockchip SoCs, migrate to use common spl board file.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3188-board-spl.c | 119 ---------------------- 3 files changed, 1 insertion(+), 120 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3188-board-spl.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -36,6 +36,7 @@ config ROCKCHIP_RK3188 select SPL_ROCKCHIP_EARLYRETURN_TO_BROM select SPL_ROCKCHIP_BACK_TO_BROM select BOARD_LATE_INIT + imply SPL_ROCKCHIP_COMMON_BOARD help The Rockchip RK3188 is a ARM-based SoC with a quad-core Cortex-A9 including NEON and GPU, 512KB L2 cache, Mali-400 graphics, two
arch/arm/mach-rockchip/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -obj-spl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3328) += rk3328-board-spl.o
arch/arm/mach-rockchip/rk3188-board-spl.c deleted +0 -119
119 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 12/35 rockchip: rk322x: introduce arch_cpu_init() for SoC setting init
In reply to Kever YangUse arch_cpu_init() to init SoC secure region and move it to rk322x.c
---
arch/arm/mach-rockchip/rk322x-board-spl.c | 10 ++++++---- arch/arm/mach-rockchip/rk322x/rk322x.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-)
arch/arm/mach-rockchip/rk322x-board-spl.c +6 -4
@@ -44,7 +44,11 @@ void rockchip_stimer_init(void) TIMER_CONTROL_REG); } -#define SGRF_DDR_CON0 0x10150000 +__weak int arch_cpu_init (void ) +{ +return 0 ; +} +void board_init_f (ulong dummy) {int ret;
@@ -60,9 +64,7 @@ void board_init_f(ulong dummy)rockchip_stimer_init ();/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */ timer_init (); - -/* Disable the ddr secure region setting to make it non-secure */ -rk_clrreg (SGRF_DDR_CON0 ,0x4000 ); +arch_cpu_init (); }#ifdef CONFIG_SPL_LOAD_FIT
arch/arm/mach-rockchip/rk322x/rk322x.c +12 -0
@@ -42,3 +42,15 @@ void board_debug_uart_init(void) CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT); }#endif + +int arch_cpu_init (void ) +{ +#ifdef CONFIG_SPL_BUILD +#define SGRF_BASE 0x10150000 +static struct rk322x_sgrf *const sgrf = (void *)SGRF_BASE ; + +/* Disable the ddr secure region setting to make it non-secure */ +rk_clrreg (&sgrf->soc_con[0 ],0x4000 ); +#endif +return 0 ; +}
Signature · 1 line
2.17.1
PATCH 13/35 rockchip: rk322x: migrate to use common spl board file
In reply to Kever Yangrk322x has similar boot flow in SPL with other Rockchip SoCs, migrate to use common spl board file.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk322x-board-spl.c | 78 ----------------------- 3 files changed, 1 insertion(+), 79 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk322x-board-spl.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -59,6 +59,7 @@ config ROCKCHIP_RK322X select TPL_NEEDS_SEPARATE_STACK if TPL select SPL_DRIVERS_MISC_SUPPORT imply SPL_SERIAL_SUPPORT + imply SPL_ROCKCHIP_COMMON_BOARD imply TPL_SERIAL_SUPPORT imply TPL_ROCKCHIP_COMMON_BOARD select TPL_LIBCOMMON_SUPPORT
arch/arm/mach-rockchip/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3328) += rk3328-board-spl.o obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o
arch/arm/mach-rockchip/rk322x-board-spl.c deleted +0 -78
78 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 14/35 rockchip: rk322x: add boot_devices mapping to support 'same-as-spl'
In reply to Kever YangThe driver need a mapping to get the dts node by boot srouce ID.
---
arch/arm/mach-rockchip/rk322x/rk322x.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-rockchip/rk322x/rk322x.c +6 -0
@@ -3,9 +3,15 @@* (C) Copyright 2019 Rockchip Electronics Co., Ltd */ #include <asm/io.h> +#include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/grf_rk322x.h> #include <asm/arch-rockchip/hardware.h> +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { + [BROM_BOOTSOURCE_EMMC ] ="dwmmc at 30020000" , + [BROM_BOOTSOURCE_SD ] ="dwmmc at 30000000" , +}; +#ifdef CONFIG_DEBUG_UART_BOARD_INIT void board_debug_uart_init (void ) {
Signature · 1 line
2.17.1
PATCH 15/35 rockchip: fit_spl_optee: rockchip: fix warning unit_address_vs_reg
In reply to Kever YangUpdate to fix warning:
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/uboot at 1 has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/optee at 1 has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/fdt at 1 has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /configurations/conf at 1 has a unit name, but no reg property
---
arch/arm/mach-rockchip/fit_spl_optee.its | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm/mach-rockchip/fit_spl_optee.its +8 -8
@@ -11,7 +11,7 @@ #address-cells = <1>; images { - uboot at 1 { + uboot { description = "U-Boot"; data = /incbin/("../../../u-boot-nodtb.bin"); type = "standalone";
@@ -20,7 +20,7 @@ compression = "none"; load = <0x61000000>; }; - optee at 1 { + optee { description = "OP-TEE"; data = /incbin/("../../../tee.bin"); type = "firmware";
@@ -30,7 +30,7 @@ load = <0x68400000>; entry = <0x68400000>; }; - fdt at 1 { + fdt { description = "dtb"; data = /incbin/("../../../u-boot.dtb"); type = "flat_dt";
@@ -39,12 +39,12 @@ }; configurations { - default = "conf at 1"; - conf at 1 { + default = "conf"; + conf { description = "Rockchip armv7 with OP-TEE"; - firmware = "optee at 1"; - loadables = "uboot at 1"; - fdt = "fdt at 1"; + firmware = "optee"; + loadables = "uboot"; + fdt = "fdt"; }; }; };
Signature · 1 line
2.17.1
PATCH 16/35 rockchip: rk3288: show SPL BANNER earlier in board_init_f()
In reply to Kever YangShow the SPL BANNER earlier so that we know already get into SPL.
---
arch/arm/mach-rockchip/rk3288-board-spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/rk3288-board-spl.c +2 -2
@@ -167,6 +167,8 @@ void board_init_f(ulong dummy)arch_cpu_init (); +preloader_console_init (); + ret =rockchip_get_clk (&dev);if (ret) {debug ("CLK init failed: %d\n" , ret);
@@ -227,8 +229,6 @@ void spl_board_init(void)hang (); } -preloader_console_init (); -return ; }
Signature · 1 line
2.17.1
PATCH 17/35 rockchip: rk3288: move setup_led() to firefly-rk3288
In reply to Kever YangOnly firefly-rk3288 has the dts node "u-boot,boot-led", while CONFIG_SPL_LED is not enable, move code to firefly-rk3288 now in case someone need this code.
---
arch/arm/mach-rockchip/Kconfig | 1 - arch/arm/mach-rockchip/rk3288-board-spl.c | 36 ------------------- arch/arm/mach-rockchip/rk3288/Kconfig | 1 + board/firefly/firefly-rk3288/firefly-rk3288.c | 36 +++++++++++++++++++ 4 files changed, 37 insertions(+), 37 deletions(-)
arch/arm/mach-rockchip/Kconfig +0 -1
@@ -73,7 +73,6 @@ config ROCKCHIP_RK322X config ROCKCHIP_RK3288 bool "Support Rockchip RK3288" select CPU_V7A - select SPL_BOARD_INIT if SPL select SUPPORT_SPL select SPL select SUPPORT_TPL
arch/arm/mach-rockchip/rk3288-board-spl.c +0 -36
@@ -196,42 +196,6 @@ void board_init_f(ulong dummy)#endif } -static int setup_led (void ) -{ -#ifdef CONFIG_SPL_LED -struct udevice *dev; -char *led_name; -int ret; - - led_name =fdtdec_get_config_string (gd->fdt_blob,"u-boot,boot-led" ); -if (!led_name) -return 0 ; - ret =led_get_by_label (led_name, &dev); -if (ret) { -debug ("%s: get=%d\n" , __func__, ret); -return ret; - } - ret =led_set_on (dev,1 ); -if (ret) -return ret; -#endif - -return 0 ; -} - -void spl_board_init (void ) -{ -int ret; - - ret =setup_led (); -if (ret) { -debug ("LED ret=%d\n" , ret); -hang (); - } - -return ; -} -#ifdef CONFIG_SPL_OS_BOOT #define PMU_BASE 0xff730000
arch/arm/mach-rockchip/rk3288/Kconfig +1 -0
@@ -66,6 +66,7 @@ config TARGET_FENNEC_RK3288 config TARGET_FIREFLY_RK3288 bool "Firefly-RK3288" select BOARD_LATE_INIT + select SPL_BOARD_INIT if SPL help Firefly is a RK3288-based development board with 2 USB ports, HDMI, VGA, micro-SD card, audio, WiFi and Gigabit Ethernet, It
board/firefly/firefly-rk3288/firefly-rk3288.c +36 -0
@@ -4,3 +4,39 @@*/ #include <common.h> + +#ifdef CONFIG_SPL_BUILD +static int setup_led (void ) +{ +#ifdef CONFIG_SPL_LED +struct udevice *dev; +char *led_name; +int ret; + + led_name =fdtdec_get_config_string (gd->fdt_blob,"u-boot,boot-led" ); +if (!led_name) +return 0 ; + ret =led_get_by_label (led_name, &dev); +if (ret) { +debug ("%s: get=%d\n" , __func__, ret); +return ret; + } + ret =led_set_on (dev,1 ); +if (ret) +return ret; +#endif + +return 0 ; +} + +void spl_board_init (void ) +{ +int ret; + + ret =setup_led (); +if (ret) { +debug ("LED ret=%d\n" , ret); +hang (); + } +} +#endif
Signature · 1 line
2.17.1
PATCH 18/35 rockchip: rk3288-phycore: move phycore_init() to its own board file
In reply to Kever Yangphycore_init() is use for phycore board only, it should be move back to phycore-rk3288.c
---
arch/arm/mach-rockchip/rk3288-board-spl.c | 39 ---------------- arch/arm/mach-rockchip/rk3288/Kconfig | 1 + board/phytec/phycore_rk3288/phycore-rk3288.c | 47 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 39 deletions(-)
arch/arm/mach-rockchip/rk3288-board-spl.c +0 -39
@@ -25,8 +25,6 @@#include <dm/root.h> #include <dm/test.h> #include <dm/util.h> -#include <power/regulator.h> -#include <power/rk8xx_pmic.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -81,32 +79,6 @@ fallback:return BOOT_DEVICE_MMC1 ; } -#if !defined(CONFIG_SPL_OF_PLATDATA ) -static int phycore_init (void ) -{ -struct udevice *pmic; -int ret; - - ret =uclass_first_device_err (UCLASS_PMIC , &pmic); -if (ret) -return ret; - -#if defined(CONFIG_SPL_POWER_SUPPORT ) -/* Increase USB input current to 2A */ - ret =rk818_spl_configure_usb_input_current (pmic,2000 ); -if (ret) -return ret; - -/* Close charger when USB lower then 3.26V */ - ret =rk818_spl_configure_usb_chrg_shutdown (pmic,3260000 ); -if (ret) -return ret; -#endif - -return 0 ; -} -#endif -__weak int arch_cpu_init (void ) {return 0 ;
@@ -175,17 +147,6 @@ void board_init_f(ulong dummy)return ; } -#if !defined(CONFIG_SPL_OF_PLATDATA ) -if (of_machine_is_compatible ("phytec,rk3288-phycore-som" )) { - ret =phycore_init (); -if (ret) { -debug ("Failed to set up phycore power settings: %d\n" , - ret); -return ; - } - } -#endif -#if !defined(CONFIG_SUPPORT_TPL )debug ("\nspl:init dram\n" ); ret =uclass_get_device (UCLASS_RAM ,0 , &dev);
arch/arm/mach-rockchip/rk3288/Kconfig +1 -0
@@ -85,6 +85,7 @@ config TARGET_MIQI_RK3288 config TARGET_PHYCORE_RK3288 bool "phyCORE-RK3288" select BOARD_LATE_INIT + select SPL_BOARD_INIT if SPL help Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combination
board/phytec/phycore_rk3288/phycore-rk3288.c +47 -0
60 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 18/35 rockchip: rk3288-phycore: move phycore_init() to its own board file
Hi Kever,
this is fine for me. You can drop the phycore_init() code completely. No need to carry this around in our board code.
The SOM was redesigned and is equipped with an STM8 connected to the RK818. The required setup we did before in the SPL is now done by the ST controller. I know there are only a few SOMs without the STM8 out in the wild. So if you remove it it will affect only a few people who probably already have both boards.
Thanks,
Wadim
Quoted 153 lines · Kever Yang
phycore_init()is use for phycore board only, it should be move back tophycore-rk3288.cSigned-off-by Kever Yang <[email protected]>---
arch/arm/mach-rockchip/rk3288-board-spl.c | 39 ---------------- arch/arm/mach-rockchip/rk3288/Kconfig | 1 + board/phytec/phycore_rk3288/phycore-rk3288.c | 47 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 39 deletions(-)arch/arm/mach-rockchip/rk3288-board-spl.c +0
-39@@ -25,8 +25,6 @@#include <dm/root.h> #include <dm/test.h> #include <dm/util.h> -#include <power/regulator.h> -#include <power/rk8xx_pmic.h> DECLARE_GLOBAL_DATA_PTR ;@@ -81,32 +79,6 @@ fallback:return BOOT_DEVICE_MMC1 ; } -#if !defined(CONFIG_SPL_OF_PLATDATA ) -static int phycore_init (void ) -{ -struct udevice *pmic; -int ret; - - ret =uclass_first_device_err (UCLASS_PMIC , &pmic); -if (ret) -return ret; - -#if defined(CONFIG_SPL_POWER_SUPPORT ) -/* Increase USB input current to 2A */ - ret =rk818_spl_configure_usb_input_current (pmic,2000 ); -if (ret) -return ret; - -/* Close charger when USB lower then 3.26V */ - ret =rk818_spl_configure_usb_chrg_shutdown (pmic,3260000 ); -if (ret) -return ret; -#endif - -return 0 ; -} -#endif -__weak int arch_cpu_init (void ) {return 0 ;@@ -175,17 +147,6 @@ void board_init_f(ulong dummy)return ; } -#if !defined(CONFIG_SPL_OF_PLATDATA ) -if (of_machine_is_compatible ("phytec,rk3288-phycore-som" )) { - ret =phycore_init (); -if (ret) { -debug ("Failed to set up phycore power settings: %d\n" , - ret); -return ; - } - } -#endif -#if !defined(CONFIG_SUPPORT_TPL )debug ("\nspl:init dram\n" ); ret =uclass_get_device (UCLASS_RAM ,0 , &dev);arch/arm/mach-rockchip/rk3288/Kconfig +1
-0@@ -85,6 +85,7 @@ config TARGET_MIQI_RK3288 config TARGET_PHYCORE_RK3288 bool "phyCORE-RK3288" select BOARD_LATE_INIT + select SPL_BOARD_INIT if SPL help Add basic support for the PCM-947 carrier board, a RK3288 based development board made by PHYTEC. This board works in a combinationboard/phytec/phycore_rk3288/phycore-rk3288.c +47
-0@@ -8,10 +8,13 @@#include <common.h> #include <dm.h> #include <environment.h> +#include <fdtdec.h> #include <i2c.h> #include <i2c_eeprom.h> #include <netdev.h> #include "som.h" +#include <power/regulator.h> +#include <power/rk8xx_pmic.h> static int valid_rk3288_som (struct rk3288_som *som) {@@ -68,3 +71,47 @@ int rk_board_late_init(void)return 0 ; } + +#ifdef CONFIG_SPL_BUILD +#if !defined(CONFIG_SPL_OF_PLATDATA ) +static int phycore_init (void ) +{ +struct udevice *pmic; +int ret; + + ret =uclass_first_device_err (UCLASS_PMIC , &pmic); +if (ret) +return ret; + +#if defined(CONFIG_SPL_POWER_SUPPORT ) +/* Increase USB input current to 2A */ + ret =rk818_spl_configure_usb_input_current (pmic,2000 ); +if (ret) +return ret; + +/* Close charger when USB lower then 3.26V */ + ret =rk818_spl_configure_usb_chrg_shutdown (pmic,3260000 ); +if (ret) +return ret; +#endif + +return 0 ; +} +#endif + +void spl_board_init (void ) +{ +#if !defined(CONFIG_SPL_OF_PLATDATA ) +int ret; + +if (of_machine_is_compatible ("phytec,rk3288-phycore-som" )) { + ret =phycore_init (); +if (ret) { +debug ("Failed to set up phycore power settings: %d\n" , + ret); +return ; + } + } +#endif +} +#endif
PATCH 19/35 rockchip: rk3288: move dram_init_banksize() into soc file
In reply to Kever YangMov edram_init_banksize() into rk3288.c so that we can re-use the common SPL board file later.
---
arch/arm/mach-rockchip/rk3288-board-spl.c | 15 --------------- arch/arm/mach-rockchip/rk3288/rk3288.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-)
arch/arm/mach-rockchip/rk3288-board-spl.c +0 -15
@@ -156,18 +156,3 @@ void board_init_f(ulong dummy) }#endif } - -#ifdef CONFIG_SPL_OS_BOOT - -#define PMU_BASE 0xff730000 -int dram_init_banksize (void ) -{ -struct rk3288_pmu *const pmu = (void *)PMU_BASE ; -size_t size =rockchip_sdram_size ((phys_addr_t)&pmu->sys_reg[2 ]); - - gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; - gd->bd->bi_dram[0 ].size = size; - -return 0 ; -} -#endif
arch/arm/mach-rockchip/rk3288/rk3288.c +15 -0
@@ -57,3 +57,18 @@ void board_debug_uart_init(void) GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT); }#endif + +#ifdef CONFIG_SPL_OS_BOOT + +#define PMU_BASE 0xff730000 +int dram_init_banksize (void ) +{ +struct rk3288_pmu *const pmu = (void *)PMU_BASE ; +size_t size =rockchip_sdram_size ((phys_addr_t)&pmu->sys_reg[2 ]); + + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; + gd->bd->bi_dram[0 ].size = size; + +return 0 ; +} +#endif
Signature · 1 line
2.17.1
PATCH 20/35 rockchip: rk3288: Migrate to use common spl board file
In reply to Kever Yangrk3288 has similar boot flow in SPL with other Rockchip SoCs, migrate to use common spl board file.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3288-board-spl.c | 158 ---------------------- 3 files changed, 1 insertion(+), 159 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3288-board-spl.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -76,6 +76,7 @@ config ROCKCHIP_RK3288 select SUPPORT_SPL select SPL select SUPPORT_TPL + imply SPL_ROCKCHIP_COMMON_BOARD imply TPL_CLK imply TPL_DM imply TPL_DRIVERS_MISC_SUPPORT
arch/arm/mach-rockchip/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -obj-spl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3328) += rk3328-board-spl.o obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o
arch/arm/mach-rockchip/rk3288-board-spl.c deleted +0 -158
158 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 21/35 rockchip: phycore: remove no use "u-boot, boot0" in dts
In reply to Kever YangWe are using "u-boot,spl-boot-order" now and re-use the definition from rk3288-u-boot.dtsi, so remove it directly here.
---
arch/arm/dts/rk3288-phycore-rdk.dts | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/dts/rk3288-phycore-rdk.dts +0 -5
@@ -55,11 +55,6 @@ stdout-path = &uart2; }; - config { - u-boot,dm-pre-reloc; - u-boot,boot0 = &emmc; - }; - user_buttons: user-buttons { compatible = "gpio-keys"; pinctrl-names = "default";
Signature · 1 line
2.17.1
PATCH 22/35 rockchip: rk3288-veyron: Migrate "u-boot, boot0" to "u-boot, spl-boot-order"
In reply to Kever Yang"u-boot,spl-boot-order" is more flexible and other rockchip SoCs has convert to use it, migrate to use the new dts property.
---
arch/arm/dts/rk3288-veyron.dtsi | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/arm/dts/rk3288-veyron.dtsi +1 -5
@@ -16,11 +16,7 @@ chosen { stdout-path = &uart2; - }; - - config { - u-boot,dm-pre-reloc; - u-boot,boot0 = &spi_flash; + u-boot,spl-boot-order = &spi_flash; }; firmware {
Signature · 1 line
2.17.1
PATCH 23/35 rockchip: rk3288: add boot_devices mapping to support 'same-as-spl'
In reply to Kever YangThe driver need a mapping to get the dts node by boot srouce ID.
---
arch/arm/mach-rockchip/rk3288/rk3288.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-rockchip/rk3288/rk3288.c +6 -0
@@ -4,11 +4,17 @@*/ #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> #define GRF_BASE 0xff770000 +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { + [BROM_BOOTSOURCE_EMMC ] ="dwmmc at ff0f0000" , + [BROM_BOOTSOURCE_SD ] ="dwmmc at ff0c0000" , +}; +#ifdef CONFIG_SPL_BUILD static void configure_l2ctlr (void ) {
Signature · 1 line
2.17.1
PATCH 24/35 rockchip: rk3328: add STIMER_BASE definition
In reply to Kever YangAdd the CONFIG_ROCKCHIP_STIMER_BASE so that we can use the stimer init function in tpl.c and spl.c
---
include/configs/rk3328_common.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/rk3328_common.h +2 -0
@@ -10,6 +10,8 @@#define CONFIG_IRAM_BASE 0xff090000 +#define CONFIG_ROCKCHIP_STIMER_BASE 0xff1d0020 +#define CONFIG_SYS_MALLOC_LEN (32 << 20)#define CONFIG_SYS_CBSIZE 1024#define CONFIG_SKIP_LOWLEVEL_INIT
Signature · 1 line
2.17.1
PATCH 25/35 rockchip: rk3328: migrate to use common spl board file
In reply to Kever Yangrk3328 has similar boot flow in SPL with other Rockchip SoCs, migrate to use common spl board file.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3328-board-spl.c | 58 ----------------------- 3 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3328-board-spl.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -105,6 +105,7 @@ config ROCKCHIP_RK3328 select ARM64 select SUPPORT_SPL select SPL + imply SPL_ROCKCHIP_COMMON_BOARD imply SPL_SERIAL_SUPPORT imply SPL_SEPARATE_BSS select ENABLE_ARM_SOC_BOOT0_HOOK
arch/arm/mach-rockchip/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -obj-spl-$(CONFIG_ROCKCHIP_RK3328) += rk3328-board-spl.o obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o
arch/arm/mach-rockchip/rk3328-board-spl.c deleted +0 -58
58 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 26/35 rockchip: rk3328: add boot_devices mapping to support 'same-as-spl'
In reply to Kever YangThe driver need a mapping to get the dts node by boot srouce ID.
---
arch/arm/mach-rockchip/rk3328/rk3328.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-rockchip/rk3328/rk3328.c +6 -0
@@ -4,12 +4,18 @@*/ #include <common.h> +#include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/hardware.h> #include <asm/armv8/mmu.h> #include <asm/io.h> DECLARE_GLOBAL_DATA_PTR ; +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { + [BROM_BOOTSOURCE_EMMC ] ="rksdmmc at ff520000" , + [BROM_BOOTSOURCE_SD ] ="rksdmmc at ff500000" , +}; +static struct mm_region rk3328_mem_map[] = { { .virt =0x0UL ,
Signature · 1 line
2.17.1
PATCH 27/35 rockchip: rk3368: migrate to use common spl board file
In reply to Kever Yangrk3368 has similar boot flow in SPL with other Rockchip SoCs, migrate to use common spl board file.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3368-board-spl.c | 80 ----------------------- 3 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3368-board-spl.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -125,6 +125,7 @@ config ROCKCHIP_RK3368 select SUPPORT_TPL select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL select TPL_NEEDS_SEPARATE_STACK if TPL + imply SPL_ROCKCHIP_COMMON_BOARD imply SPL_SEPARATE_BSS imply SPL_SERIAL_SUPPORT imply TPL_SERIAL_SUPPORT
arch/arm/mach-rockchip/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
arch/arm/mach-rockchip/rk3368-board-spl.c deleted +0 -80
80 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 28/35 rockchip: rk3368: add boot_devices mapping to support 'same-as-spl'
In reply to Kever YangThe driver need a mapping to get the dts node by boot srouce ID.
---
arch/arm/mach-rockchip/rk3368/rk3368.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-rockchip/rk3368/rk3368.c +6 -0
@@ -8,6 +8,7 @@#include <syscon.h> #include <asm/armv8/mmu.h> #include <asm/io.h> +#include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3368.h> #include <asm/arch-rockchip/grf_rk3368.h>
@@ -52,6 +53,11 @@ static struct mm_region rk3368_mem_map[] = {struct mm_region *mem_map = rk3368_mem_map; +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { + [BROM_BOOTSOURCE_EMMC ] ="dwmmc at ff0f0000" , + [BROM_BOOTSOURCE_SD ] ="dwmmc at ff0c0000" , +}; +int dram_init_banksize (void ) {size_t max_size =min ((unsigned long )gd->ram_size, gd->ram_top);
Signature · 1 line
2.17.1
PATCH 29/35 rockchip: rk3399: move spl_perform_fixups() into soc file
In reply to Kever YangMove the spl_perform_fixups() into rk3399.c so that we can use common spl board file later.
---
arch/arm/mach-rockchip/rk3399-board-spl.c | 48 ---------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 50 +++++++++++++++++++++++ 2 files changed, 50 insertions(+), 48 deletions(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +0 -48
@@ -61,54 +61,6 @@ u32 spl_boot_device(void)return boot_device; } -const char *spl_decode_boot_device (u32 boot_device) -{ -int i; -static const struct { -u32 boot_device; -const char *ofpath; - } spl_boot_devices_tbl[] = { - {BOOT_DEVICE_MMC1 ,"/dwmmc at fe320000" }, - {BOOT_DEVICE_MMC2 ,"/sdhci at fe330000" }, - {BOOT_DEVICE_SPI ,"/spi at ff1d0000" }, - }; - -for (i =0 ; i <ARRAY_SIZE (spl_boot_devices_tbl); ++i) -if (spl_boot_devices_tbl[i].boot_device == boot_device) -return spl_boot_devices_tbl[i].ofpath; - -return NULL ; -} - -void spl_perform_fixups (struct spl_image_info *spl_image) -{ -void *blob = spl_image->fdt_addr; -const char *boot_ofpath; -int chosen; - -/* -* Inject the ofpath of the device the full U-Boot (or Linux in -* Falcon-mode) was booted from into the FDT, if a FDT has been -* loaded at the same time. -*/ -if (!blob) -return ; - - boot_ofpath =spl_decode_boot_device (spl_image->boot_device); -if (!boot_ofpath) { -pr_err ("%s: could not map boot_device to ofpath\n" , __func__); -return ; - } - - chosen =fdt_find_or_add_subnode (blob,0 ,"chosen" ); -if (chosen <0 ) { -pr_err ("%s: could not find/create '/chosen'\n" , __func__); -return ; - } -fdt_setprop_string (blob, chosen, -"u-boot,spl-boot-device" , boot_ofpath); -} -__weak void rockchip_stimer_init (void ) { }
arch/arm/mach-rockchip/rk3399/rk3399.c +50 -0
53 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 30/35 rockchip: rk3399: show SPL BANNER earlier in board_init_f()
In reply to Kever YangShow the SPL BANNER earlier so that we know already get into SPL.
---
arch/arm/mach-rockchip/rk3399-board-spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +2 -2
@@ -130,6 +130,8 @@ void board_init_f(ulong dummy)pr_err ("DRAM init failed: %d\n" , ret);return ; } + +preloader_console_init (); }#if defined(SPL_GPIO_SUPPORT )
@@ -188,8 +190,6 @@ void spl_board_init(void)if (regulators_enable_boot_on (false))debug ("%s: Cannot enable boot on regulator\n" , __func__);#endif - -preloader_console_init (); }#ifdef CONFIG_SPL_LOAD_FIT
Signature · 1 line
2.17.1
PATCH 31/35 rockchip: rk3399: move SoC setting into arch_cpu_init()
In reply to Kever YangSoC setting like DDR secure region and EMMC clock setting should go to arch_cpu_init().
---
arch/arm/mach-rockchip/rk3399-board-spl.c | 27 ++++++----------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 25 ++++++++++++++++++--- 2 files changed, 29 insertions(+), 23 deletions(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +7 -20
@@ -16,7 +16,6 @@#include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3399.h> -#include <asm/arch-rockchip/grf_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/periph.h> #include <asm/arch-rockchip/sys_proto.h>
@@ -65,11 +64,14 @@ __weak void rockchip_stimer_init(void) { } +__weak int arch_cpu_init (void ) +{ +return 0 ; +} +void board_init_f (ulong dummy) {struct udevice *dev; -struct rk3399_pmusgrf_regs *sgrf; -struct rk3399_grf_regs *grf;int ret;#ifdef CONFIG_DEBUG_UART
@@ -100,29 +102,14 @@ void board_init_f(ulong dummy)debug ("U-Boot SPL board init\n" );#endif +arch_cpu_init (); + ret =spl_early_init ();if (ret) {debug ("spl_early_init() failed: %d\n" , ret);hang (); } -/* -* Disable DDR and SRAM security regions. -* -* As we are entered from the BootROM, the region from -* 0x0 through 0xfffff (i.e. the first MB of memory) will -* be protected. This will cause issues with the DW_MMC -* driver, which tries to DMA from/to the stack (likely) -* located in this range. -*/ - sgrf =syscon_get_first_range (ROCKCHIP_SYSCON_PMUSGRF ); -rk_clrsetreg (&sgrf->ddr_rgn_con[16 ],0x1ff ,0 ); -rk_clrreg (&sgrf->slv_secure_con4,0x2000 ); - -/* eMMC clock generator: disable the clock multipilier */ - grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); -rk_clrreg (&grf->emmccore_con[11 ],0x0ff ); -rockchip_stimer_init (); ret =uclass_get_device (UCLASS_RAM ,0 , &dev);
arch/arm/mach-rockchip/rk3399/rk3399.c +22 -3
@@ -80,11 +80,30 @@ 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 */ +#ifdef CONFIG_SPL_BUILD +struct rk3399_pmusgrf_regs *sgrf; +struct rk3399_grf_regs *grf; + +/* +* Disable DDR and SRAM security regions. +* +* As we are entered from the BootROM, the region from +* 0x0 through 0xfffff (i.e. the first MB of memory) will +* be protected. This will cause issues with the DW_MMC +* driver, which tries to DMA from/to the stack (likely) +* located in this range. +*/ + sgrf =syscon_get_first_range (ROCKCHIP_SYSCON_PMUSGRF ); +rk_clrsetreg (&sgrf->ddr_rgn_con[16 ],0x1ff ,0 ); +rk_clrreg (&sgrf->slv_secure_con4,0x2000 ); + +/* eMMC clock generator: disable the clock multipilier */ + grf =syscon_get_first_range (ROCKCHIP_SYSCON_GRF ); +printf ("%s sgrf %lx grf %lx\n" , __func__, (u64 )sgrf, (u64 )grf); +printf ("%s %x\n" , __func__, &grf->emmccore_con[11 ]);rk_clrreg (&grf->emmccore_con[11 ],0x0ff ); +#endif return 0 ; }
Signature · 1 line
2.17.1
PATCH 32/35 rockchip: rk3399; move spl_board_init() into soc file
In reply to Kever YangMove spl_board_init() into rk3399.c so that we can re-use the common SPL board file later.
---
arch/arm/mach-rockchip/rk3399-board-spl.c | 61 --------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 64 ++++++++++++++++++++++- 2 files changed, 63 insertions(+), 62 deletions(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +0 -61
@@ -10,16 +10,13 @@#include <ram.h> #include <spl.h> #include <spl_gpio.h> -#include <syscon.h> #include <asm/gpio.h> #include <asm/io.h> #include <asm/arch-rockchip/bootrom.h> -#include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3399.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/periph.h> #include <asm/arch-rockchip/sys_proto.h> -#include <power/regulator.h> void board_return_to_bootrom (void ) {
@@ -121,64 +118,6 @@ void board_init_f(ulong dummy)preloader_console_init (); } -#if defined(SPL_GPIO_SUPPORT ) -static void rk3399_force_power_on_reset (void ) -{ -ofnode node; -struct gpio_desc sysreset_gpio; - -debug ("%s: trying to force a power-on reset\n" , __func__); - - node =ofnode_path ("/config" ); -if (!ofnode_valid (node)) { -debug ("%s: no /config node?\n" , __func__); -return ; - } - -if (gpio_request_by_name_nodev (node,"sysreset-gpio" ,0 , - &sysreset_gpio,GPIOD_IS_OUT )) { -debug ("%s: could not find a /config/sysreset-gpio\n" , __func__); -return ; - } - -dm_gpio_set_value (&sysreset_gpio,1 ); -} -#endif - -void spl_board_init (void ) -{ -#if defined(SPL_GPIO_SUPPORT ) -struct rk3399_cru *cru =rockchip_get_cru (); - -/* -* The RK3399 resets only 'almost all logic' (see also in the TRM -* "3.9.4 Global software reset"), when issuing a software reset. -* This may cause issues during boot-up for some configurations of -* the application software stack. -* -* To work around this, we test whether the last reset reason was -* a power-on reset and (if not) issue an overtemp-reset to reset -* the entire module. -* -* While this was previously fixed by modifying the various places -* that could generate a software reset (e.g. U-Boot's sysreset -* driver, the ATF or Linux), we now have it here to ensure that -* we no longer have to track this through the various components. -*/ -if (cru->glb_rst_st !=0 ) -rk3399_force_power_on_reset (); -#endif - -#if defined(SPL_DM_REGULATOR ) -/* -* Turning the eMMC and SPI back on (if disabled via the Qseven -* BIOS_ENABLE) signal is done through a always-on regulator). -*/ -if (regulators_enable_boot_on (false)) -debug ("%s: Cannot enable boot on regulator\n" , __func__); -#endif -} -#ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match (const char *name) {
arch/arm/mach-rockchip/rk3399/rk3399.c +63 -1
86 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 33/35 rockchip: rk3399: move boot_devices into soc file
In reply to Kever YangMove boot_devices definition into rk3399.c, so that we can share the common code for board_spl_was_booted_from().
---
arch/arm/mach-rockchip/rk3399-board-spl.c | 6 +----- arch/arm/mach-rockchip/rk3399/rk3399.c | 7 +++++++ 2 files changed, 8 insertions(+), 5 deletions(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +1 -5
@@ -23,11 +23,7 @@ void board_return_to_bootrom(void)back_to_bootrom (BROM_BOOT_NEXTSTAGE ); } -static const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { - [BROM_BOOTSOURCE_EMMC ] ="/sdhci at fe330000" , - [BROM_BOOTSOURCE_SPINOR ] ="/spi at ff1d0000" , - [BROM_BOOTSOURCE_SD ] ="/dwmmc at fe320000" , -}; +__weak const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = {};const char *board_spl_was_booted_from (void ) {
arch/arm/mach-rockchip/rk3399/rk3399.c +7 -0
@@ -9,6 +9,7 @@#include <syscon.h> #include <asm/armv8/mmu.h> #include <asm/io.h> +#include <asm/arch-rockchip/bootrom.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/gpio.h> #include <asm/arch-rockchip/grf_rk3399.h>
@@ -20,6 +21,12 @@ DECLARE_GLOBAL_DATA_PTR;#define GRF_EMMCCORE_CON11 0xff77f02c#define GRF_BASE 0xff770000 +const char *const boot_devices[BROM_LAST_BOOTSOURCE +1 ] = { + [BROM_BOOTSOURCE_EMMC ] ="/sdhci at fe330000" , + [BROM_BOOTSOURCE_SPINOR ] ="/spi at ff1d0000" , + [BROM_BOOTSOURCE_SD ] ="/dwmmc at fe320000" , +}; +static struct mm_region rk3399_mem_map[] = { { .virt =0x0UL ,
Signature · 1 line
2.17.1
PATCH 34/35 rockchip: rk3399: move chromebook bob specific flow to its board file
In reply to Kever YangAdd a board_early_init_f() in board_init_f() and move the board specific init code into its own board file.
---
.../arm/include/asm/arch-rockchip/sys_proto.h | 4 ---- arch/arm/mach-rockchip/rk3399-board-spl.c | 20 ++++++------------ board/google/gru/gru.c | 21 +++++++++++++++++++ 3 files changed, 27 insertions(+), 18 deletions(-)
arch/arm/include/asm/arch-rockchip/sys_proto.h +0 -4
@@ -6,8 +6,4 @@#ifndef _ASM_ARCH_SYS_PROTO_H#define _ASM_ARCH_SYS_PROTO_H - -/* provided to defeat compiler optimisation in board_init_f() */ -void gru_dummy_function (int i); -#endif /* _ASM_ARCH_SYS_PROTO_H */
arch/arm/mach-rockchip/rk3399-board-spl.c +6 -14
@@ -57,6 +57,11 @@ __weak void rockchip_stimer_init(void) { } +__weak int board_early_init_f (void ) +{ +return 0 ; +} +__weak int arch_cpu_init (void ) {return 0 ;
@@ -70,20 +75,6 @@ void board_init_f(ulong dummy)#ifdef CONFIG_DEBUG_UART debug_uart_init (); -# ifdef CONFIG_TARGET_CHROMEBOOK_BOB -int sum, i; - -/* -* Add a delay and ensure that the compiler does not optimise this out. -* This is needed since the power rails tail a while to turn on, and -* we get garbage serial output otherwise. -*/ - sum =0 ; -for (i =0 ; i <150000 ; i++) - sum += i; -gru_dummy_function (sum); -#endif /* CONFIG_TARGET_CHROMEBOOK_BOB */ -/* * Debug UART can be used from here if required: *
@@ -95,6 +86,7 @@ void board_init_f(ulong dummy)debug ("U-Boot SPL board init\n" );#endif +board_early_init_f ();arch_cpu_init (); ret =spl_early_init ();
board/google/gru/gru.c +21 -0
@@ -10,7 +10,28 @@ int board_init(void)return 0 ; } +#ifdef CONFIG_SPL_BUILD /* provided to defeat compiler optimisation in board_init_f() */ void gru_dummy_function (int i) { } + +int board_early_init_f (void ) +{ +# ifdef CONFIG_TARGET_CHROMEBOOK_BOB +int sum, i; + +/* +* Add a delay and ensure that the compiler does not optimise this out. +* This is needed since the power rails tail a while to turn on, and +* we get garbage serial output otherwise. +*/ + sum =0 ; +for (i =0 ; i <150000 ; i++) + sum += i; +gru_dummy_function (sum); +#endif /* CONFIG_TARGET_CHROMEBOOK_BOB */ + +return 0 ; +} +#endif
Signature · 1 line
2.17.1
PATCH 35/35 rockchip: rk3399: Migrate to use common spl board file
In reply to Kever Yangrk3399 has similar boot flow in SPL with other Rockchip SoCs, migrate to use common spl board file.
---
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/rk3399-board-spl.c | 117 ---------------------- 3 files changed, 1 insertion(+), 118 deletions(-) delete mode 100644 arch/arm/mach-rockchip/rk3399-board-spl.c
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -170,6 +170,7 @@ config ROCKCHIP_RK3399 select DM_PMIC select DM_REGULATOR_FIXED select BOARD_LATE_INIT + imply SPL_ROCKCHIP_COMMON_BOARD imply TPL_SERIAL_SUPPORT imply TPL_LIBCOMMON_SUPPORT imply TPL_LIBGENERIC_SUPPORT
arch/arm/mach-rockchip/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o -obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
arch/arm/mach-rockchip/rk3399-board-spl.c deleted +0 -117
117 lines not on this page · raw message
Signature · 1 line
2.17.1