rockchip: add option to change method of loading u-boot
Subsystems (3)
PATCH v5 1/1 rockchip: add option to change method of loading u-boot
From: Xu Ziyuan <[email protected]>
If we would like to boot from SD card, we have to implement mmc driver in SPL stage, and get a slightly large SPL binary. Rockchip SoC's bootrom code has the ability to load spl and u-boot, then boot.
If CONFIG_ROCKCHIP_SPL_BACK_TO_BROM is enabled, the spl will return to bootrom in board_init_f(), then bootrom loads u-boot binary.
Loading sequence after rework:
bootrom ==> spl ==> bootrom ==> u-boot
---
Changes in v5:
- Revise some typos
Changes in v4:
- Add acked flag from Simon
- Rename to CONFIG_ROCKCHIP_SPL_BACK_TO_BROM
- Add Kconfig option for this feature support
- Revise some nits
- Update comments a little
- Update commit message
Changes in v3:
- Add CONFIG_ROCKCHIP_RK3288_SPL_BACKTO_BROM for enabling this feature
- Update doc/README.rockchip to instruct how to use it
- Detailed commit message
Changes in v2:
- Add sdcard iomux initlization in board_init() to fix sdmmc command sending timeout issue when booting from eMMC
arch/arm/mach-rockchip/Kconfig | 8 ++++++
arch/arm/mach-rockchip/Makefile | 1 +
arch/arm/mach-rockchip/board.c | 33 ++++++++++++++++++++++
arch/arm/mach-rockchip/rk3036/Makefile | 1 -
arch/arm/mach-rockchip/rk3288-board-spl.c | 5 +++-
.../mach-rockchip/{rk3036 => }/save_boot_param.S | 2 +-
doc/README.rockchip | 14 +++++++++
include/configs/rk3288_common.h | 5 ++++
8 files changed, 66 insertions(+), 3 deletions(-)
rename arch/arm/mach-rockchip/{rk3036 => }/save_boot_param.S (90%)arch/arm/mach-rockchip/Kconfig +8 -0
@@ -17,6 +17,14 @@ config ROCKCHIP_RK3036 and video codec support. Peripherals include Gigabit Ethernet, USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs. +config ROCKCHIP_SPL_BACK_TO_BROM + bool "SPL returns to bootrom" + default y if ROCKCHIP_RK3036 + help + Rochchip SoCs have ability to load SPL & U-BOOT binary. This opinion, + if enabled, SPL will return to boorom, then load U-BOOT binary to keep + going on. + config SYS_MALLOC_F default y
arch/arm/mach-rockchip/Makefile +1 -0
@@ -7,6 +7,7 @@ ifdef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o +obj-$(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM) += save_boot_param.o else obj-$(CONFIG_ROCKCHIP_RK3288) += board.o endif
arch/arm/mach-rockchip/board.c +33 -0
@@ -10,12 +10,45 @@#include <ram.h> #include <asm/io.h> #include <asm/arch/clock.h> +#include <asm/arch/periph.h> +#include <asm/gpio.h> +#include <dm/pinctrl.h> DECLARE_GLOBAL_DATA_PTR ;int board_init (void ) { +#ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM +struct udevice *pinctrl; +int ret; + +/* +* We need to implement sdcard iomux here for the further +* initlization, otherwise, it'll hit sdcard command sending +* timeout exception. +*/ + ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); +if (ret) { +debug ("%s: Cannot find pinctrl device\n" , __func__); + goto err; + } + ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_SDCARD ); +if (ret) { +debug ("%s: Failed to set up SD card\n" , __func__); + goto err; + } + +return 0 ; +err: +printf ("board_init: Error %d\n" , ret); + +/* No way to report error here */ +hang (); + +return -1 ; +#else return 0 ; +#endif }int dram_init (void )
arch/arm/mach-rockchip/rk3036/Makefile +0 -1
@@ -10,4 +10,3 @@ obj-y += syscon_rk3036.o endif obj-y += sdram_rk3036.o -obj-y += save_boot_param.o
arch/arm/mach-rockchip/rk3288-board-spl.c +4 -1
@@ -151,7 +151,7 @@ static int configure_emmc(struct udevice *pinctrl) return 0; }#endif - +extern void back_to_bootrom (void );void board_init_f (ulong dummy) {struct udevice *pinctrl;
@@ -206,6 +206,9 @@ void board_init_f(ulong dummy)debug ("DRAM init failed: %d\n" , ret);return ; } +#ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM +back_to_bootrom (); +#endif }static int setup_led (void )
arch/arm/mach-rockchip/save_boot_param.S renamed from arch/arm/mach-rockchip/rk3036/save_boot_param.S +1 -1
@@ -1,5 +1,5 @@ /* - * (C) Copyright 2015 Google, Inc + * (C) Copyright 2016 Rockchip Electronics Co., Ltd * * SPDX-License-Identifier: GPL-2.0+ */
doc/README.rockchip +14 -0
@@ -120,6 +120,20 @@ something like: Hit any key to stop autoboot: 0 => +The rockchip bootrom can load and boot an initial spl, then continue to +load a second-level bootloader(ie. U-BOOT) as soon as it returns to bootrom. +Therefore RK3288 has another loading sequence like RK3036. The option of +U-Boot is controlled with this setting in U-Boot: + + #define CONFIG_ROCKCHIP_SPL_BACK_TO_BROM + +You can create the image via the following operations: + + ./firefly-rk3288/tools/mkimage -n rk3288 -T rksd -d \ + firefly-rk3288/spl/u-boot-spl-dtb.bin out && \ + cat firefly-rk3288/u-boot-dtb.bin >> out && \ + sudo dd if=out of=/dev/sdc seek=64 + If you have an HDMI cable attached you should see a video console. For evb_rk3036 board:
include/configs/rk3288_common.h +5 -0
@@ -33,7 +33,12 @@#define CONFIG_SYS_NS16550_MEM32 #define CONFIG_SPL_BOARD_INIT +#ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM +/* Bootrom will load u-boot binary to 0x0 once return from SPL */ +#define CONFIG_SYS_TEXT_BASE 0x00000000 +#else #define CONFIG_SYS_TEXT_BASE 0x00100000 +#endif #define CONFIG_SYS_INIT_SP_ADDR 0x00100000#define CONFIG_SYS_LOAD_ADDR 0x00800800#define CONFIG_SPL_STACK 0xff718000
Signature · 1 line
1.9.1
PATCH v5 1/1 rockchip: add option to change method of loading u-boot
Quoted 36 lines · Ziyuan Xu
From: Xu Ziyuan <[email protected]>
If we would like to boot from SD card, we have to implement mmc driver in SPL stage, and get a slightly large SPL binary. Rockchip SoC's bootrom code has the ability to load spl and u-boot, then boot.
If
CONFIG_ROCKCHIP_SPL_BACK_TO_BROMis enabled, the spl will return to bootrom inboard_init_f(), then bootrom loads u-boot binary.Loading sequence after rework:
bootrom ==> spl ==> bootrom ==> u-bootSigned-off-by Ziyuan Xu <[email protected]>Acked-by Simon Glass <[email protected]>---
Changes in v5:
- Revise some typosChanges in v4:
- Add acked flag from Simon
- Rename toCONFIG_ROCKCHIP_SPL_BACK_TO_BROM
- AddKconfigoption for this feature support
- Revise some nits
- Update comments a little
- Update commit messageChanges in v3:
- AddCONFIG_ROCKCHIP_RK3288_SPL_BACKTO_BROMfor enabling this feature
- Update doc/README.rockchip to instruct how to use it
- Detailed commit messageChanges in v2:
- Add sdcard iomux initlization inboard_init()to fix sdmmc command sending timeout issue when booting from eMMC
Quoted 10 lines
arch/arm/mach-rockchip/Kconfig | 8 ++++++
arch/arm/mach-rockchip/Makefile | 1 +
arch/arm/mach-rockchip/board.c | 33 ++++++++++++++++++++++
arch/arm/mach-rockchip/rk3036/Makefile | 1 -
arch/arm/mach-rockchip/rk3288-board-spl.c | 5 +++-
.../mach-rockchip/{rk3036 => }/save_boot_param.S | 2 +-
doc/README.rockchip | 14 +++++++++
include/configs/rk3288_common.h | 5 ++++
8 files changed, 66 insertions(+), 3 deletions(-)
rename arch/arm/mach-rockchip/{rk3036 => }/save_boot_param.S (90%)I fixed several typos in the Kconfig help, so ended up rewording it a little. Your patches are good but please can you take a little more time to read them before sending? Also please use "U-Boot" consistently instead of u-boot, U-BOOT, etc. I am not claiming to be perfect here either - in fact I am quite bad with typos sometimes. But a read through will often reduce their number.
Fixed, and:
Applied to u-boot-rockchip, thanks!
PATCH v5 1/1 rockchip: add option to change method of loading u-boot
hi Simon,
Quoted 54 lines · Simon Glass
Quoted 45 lines · Ziyuan Xu
From: Xu Ziyuan <[email protected]>
If we would like to boot from SD card, we have to implement mmc driver in SPL stage, and get a slightly large SPL binary. Rockchip SoC's bootrom code has the ability to load spl and u-boot, then boot.
If
CONFIG_ROCKCHIP_SPL_BACK_TO_BROMis enabled, the spl will return to bootrom inboard_init_f(), then bootrom loads u-boot binary.Loading sequence after rework:
bootrom ==> spl ==> bootrom ==> u-bootSigned-off-by Ziyuan Xu <[email protected]>Acked-by Simon Glass <[email protected]>---
Changes in v5:
- Revise some typosChanges in v4:
- Add acked flag from Simon
- Rename toCONFIG_ROCKCHIP_SPL_BACK_TO_BROM
- AddKconfigoption for this feature support
- Revise some nits
- Update comments a little
- Update commit messageChanges in v3:
- AddCONFIG_ROCKCHIP_RK3288_SPL_BACKTO_BROMfor enabling this feature
- Update doc/README.rockchip to instruct how to use it
- Detailed commit messageChanges in v2:
- Add sdcard iomux initlization inboard_init()to fix sdmmc command sending timeout issue when booting from eMMCarch/arm/mach-rockchip/Kconfig | 8 ++++++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/board.c | 33 ++++++++++++++++++++++ arch/arm/mach-rockchip/rk3036/Makefile | 1 - arch/arm/mach-rockchip/rk3288-board-spl.c | 5 +++- .../mach-rockchip/{rk3036 => }/save_boot_param.S | 2 +- doc/README.rockchip | 14 +++++++++ include/configs/rk3288_common.h | 5 ++++ 8 files changed, 66 insertions(+), 3 deletions(-)Quoted 1 line
rename
arch/arm/mach-rockchip/{rk3036=>}/save_boot_param.S(90%)I fixed several typos in the
Kconfighelp, so ended up rewording it a little. Your patches are good but please can you take a little more time to read them before sending? Also please use "U-Boot" consistently instead of u-boot, U-BOOT, etc. I am not claiming to be perfect here either - in fact I am quite bad with typos sometimes. But a read through will often reduce their number.
Quoted 3 lines
Fixed, and:
Applied to u-boot-rockchip, thanks!
Thanks for your help, I will be more carefully. :-) [snip]
A nit should be fixed.
arch/arm/mach-rockchip/Kconfig +0 -0
@@ -22,7 +22,7 @@ config ROCKCHIP_SPL_BACK_TO_BROM default y if ROCKCHIP_RK3036 help Rockchip SoCs have ability to load SPL & U-Boot binary. If
enabled,
- SPL will return to the boot rom, whch will then load the U-Boot
+ SPL will return to the boot rom, which will then load the U-Boot
binary to keep going on.
Quoted 3 lines
PATCH v5 1/1 rockchip: add option to change method of loading u-boot
Quoted 75 lines · Ziyuan Xu
hi Simon,
Quoted 58 lines · Simon Glass
Quoted 47 lines · Ziyuan Xu
From: Xu Ziyuan <[email protected]>
If we would like to boot from SD card, we have to implement mmc driver in SPL stage, and get a slightly large SPL binary. Rockchip SoC's bootrom code has the ability to load spl and u-boot, then boot.
If
CONFIG_ROCKCHIP_SPL_BACK_TO_BROMis enabled, the spl will return to bootrom inboard_init_f(), then bootrom loads u-boot binary.Loading sequence after rework:
bootrom ==> spl ==> bootrom ==> u-bootSigned-off-by Ziyuan Xu <[email protected]>Acked-by Simon Glass <[email protected]>---
Changes in v5:
- Revise some typosChanges in v4:
- Add acked flag from Simon
- Rename toCONFIG_ROCKCHIP_SPL_BACK_TO_BROM
- AddKconfigoption for this feature support
- Revise some nits
- Update comments a little
- Update commit messageChanges in v3:
- AddCONFIG_ROCKCHIP_RK3288_SPL_BACKTO_BROMfor enabling this feature
- Update doc/README.rockchip to instruct how to use it
- Detailed commit messageChanges in v2:
- Add sdcard iomux initlization inboard_init()to fix sdmmc command sending timeout issue when booting from eMMCarch/arm/mach-rockchip/Kconfig | 8 ++++++ arch/arm/mach-rockchip/Makefile | 1 + arch/arm/mach-rockchip/board.c | 33 ++++++++++++++++++++++ arch/arm/mach-rockchip/rk3036/Makefile | 1 - arch/arm/mach-rockchip/rk3288-board-spl.c | 5 +++- .../mach-rockchip/{rk3036 => }/save_boot_param.S | 2 +- doc/README.rockchip | 14 +++++++++ include/configs/rk3288_common.h | 5 ++++ 8 files changed, 66 insertions(+), 3 deletions(-)Quoted 1 line
rename
arch/arm/mach-rockchip/{rk3036=>}/save_boot_param.S(90%)I fixed several typos in the
Kconfighelp, so ended up rewording it a little. Your patches are good but please can you take a little more time to read them before sending? Also please use "U-Boot" consistently instead of u-boot, U-BOOT, etc. I am not claiming to be perfect here either - in fact I am quite bad with typos sometimes. But a read through will often reduce their number.Quoted 3 lines
Fixed, and:
Applied to u-boot-rockchip, thanks!
Thanks for your help, I will be more carefully. :-) [snip]
A nit should be fixed.arch/arm/mach-rockchip/Kconfig +0
-0
arch/arm/mach-rockchip/Kconfig config ROCKCHIP_SPL_BACK_TO_BROM · line 27
Quoted 7 lines
arch/arm/mach-rockchip/Kconfig +1
-1@@ -22,7 +22,7 @@ config ROCKCHIP_SPL_BACK_TO_BROM default y if ROCKCHIP_RK3036 help Rockchip SoCs have ability to load SPL & U-Boot binary. If enabled, - SPL will return to the boot rom, whch will then load the U-Boot + SPL will return to the boot rom, which will then load the U-Boot binary to keep going on.
Thanks - fixed!
- Simon