rockchip: rk3399: Use spl_board_init in SPL, TPL
Subsystems (3)
cover rockchip: rk3399: Use spl_board_init in SPL, TPL
Usually spl_board_init has preloader_console_init which would help to print boot up banner during SPL and TPL.
The current rk3399 lacking that in few of the boards, this series make reuse of spl_board_init in SPL and TPL stages.
with this series:
================
U-Boot TPL 2019.07-rc1-00243-g3f0cad6bd2 (May 08 2019 - 11:29:32 +0530) Trying to boot from BOOTROM
Returning to boot ROM...
U-Boot SPL 2019.07-rc1-00243-g3f0cad6bd2 (May 08 2019 - 11:29:32 +0530) Trying to boot from MMC1
U-Boot 2019.07-rc1-00243-g3f0cad6bd2 (May 08 2019 - 11:29:32 +0530)
Model: FriendlyElec NanoPC-T4 DRAM: 3.9 GiB MMC: dwmmc@fe310000: 2, dwmmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial@ff1a0000 Out: serial@ff1a0000 Err: serial@ff1a0000 Model: FriendlyElec NanoPC-T4 Net: eth0: ethernet@fe300000 Hit any key to stop autoboot: 0
=>
without this series:
===================
U-Boot TPL board init
Trying to boot from BOOTROM
Returning to boot ROM...
U-Boot SPL board init
Trying to boot from MMC1
U-Boot 2019.07-rc1-00243-g3f0cad6bd2 (May 08 2019 - 11:29:32 +0530)
Model: FriendlyElec NanoPC-T4 DRAM: 3.9 GiB MMC: dwmmc@fe310000: 2, dwmmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial@ff1a0000 Out: serial@ff1a0000 Err: serial@ff1a0000 Model: FriendlyElec NanoPC-T4 Net: eth0: ethernet@fe300000 Hit any key to stop autoboot: 0
=>
Any inputs?
Jagan.
Jagan Teki (8):
board: rk3399: Drop explicit uart enablement in spl_board_init
rockchip: rk3399: Support common spl_board_init
rockchip: rk3399: spl: Mark printascii into debug
rockchip: rk3399: Move u-boot,dm-pre-reloc of uart0, uart2
rockchip: rk3399: Enable SPL_BOARD_INIT
rockchip: rk3399: tpl: Add spl_board_init
rockchip: rk3399: tpl: Mark printascii into debug
rockchip: rk3399: Enable TPL_BOARD_INIT
arch/arm/dts/rk3399-gru.dtsi | 1 - arch/arm/dts/rk3399-puma.dtsi | 1 - arch/arm/dts/rk3399-u-boot.dtsi | 8 +++ arch/arm/mach-rockchip/Kconfig | 2 + arch/arm/mach-rockchip/rk3399-board-spl.c | 65 ++++++++++++++++++- arch/arm/mach-rockchip/rk3399-board-tpl.c | 9 ++- board/rockchip/evb_rk3399/evb-rk3399.c | 29 --------- .../puma_rk3399/puma-rk3399.c | 58 ----------------- board/vamrs/rock960_rk3399/rock960-rk3399.c | 31 --------- configs/puma-rk3399_defconfig | 1 - 10 files changed, 82 insertions(+), 123 deletions(-)
Signature · 6 lines
2.18.0.321.gffc6fa0e3 _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot
A message that is not in the archive (sent off-list or not yet received): 20190508080904.1567-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org
PATCH 1/8 board: rk3399: Drop explicit uart enablement in spl_board_init
preloader_console_init is used for printing SPL boot banner that usually called from spl_board_init.
The current spl_board_init in evb and rock960 is enabling explicit pinctrl, debug uart prior to calling preloader_console_init which eventually not required since board_init_f is already enabled debug uart.
So, drop those explicit enablement calls from spl_board_init of evb, rock960.
Tested this by enabling CONFIG_SPL_BOARD_INIT and adding u-boot,dm-pre-reloc property for uart node.
--- board/rockchip/evb_rk3399/evb-rk3399.c | 23 +------------------ board/vamrs/rock960_rk3399/rock960-rk3399.c | 25 +-------------------- 2 files changed, 2 insertions(+), 46 deletions(-)
board/rockchip/evb_rk3399/evb-rk3399.c +1 -22
@@ -6,7 +6,6 @@#include <common.h> #include <dm.h> #include <dm/pinctrl.h> -#include <dm/uclass-internal.h> #include <asm/arch-rockchip/periph.h> #include <power/regulator.h> #include <spl.h>
@@ -68,27 +67,7 @@ out:void spl_board_init (void ) { -struct udevice *pinctrl; -int ret; - - ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); -if (ret) { -debug ("%s: Cannot find pinctrl device\n" , __func__); - goto err; - } - -/* Enable debug UART */ - ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_UART_DBG ); -if (ret) { -debug ("%s: Failed to set up console UART\n" , __func__); - goto err; - } -preloader_console_init (); -return ; -err: -printf ("%s: Error %d\n" , __func__, ret); -/* No way to report error here */ -hang (); +return ; }
board/vamrs/rock960_rk3399/rock960-rk3399.c +1 -24
@@ -5,9 +5,6 @@#include <common.h> #include <dm.h> -#include <dm/pinctrl.h> -#include <dm/uclass-internal.h> -#include <asm/arch-rockchip/periph.h> #include <power/regulator.h> #include <spl.h>
@@ -24,27 +21,7 @@ int board_init(void)void spl_board_init (void ) { -struct udevice *pinctrl; -int ret; - - ret =uclass_get_device (UCLASS_PINCTRL ,0 , &pinctrl); -if (ret) { -debug ("%s: Cannot find pinctrl device\n" , __func__); - goto err; - } - -/* Enable debug UART */ - ret =pinctrl_request_noflags (pinctrl,PERIPH_ID_UART_DBG ); -if (ret) { -debug ("%s: Failed to set up console UART\n" , __func__); - goto err; - } -preloader_console_init (); -return ; -err: -printf ("%s: Error %d\n" , __func__, ret); -/* No way to report error here */ -hang (); +return ; }
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 2/8 rockchip: rk3399: Support common spl_board_init
In reply to a message not in the archiveSupport common spl_board_init by moving code from puma board file into, common rk3399-board-spl.c.
Part of the code has sysreset-gpio, regulators_enable_boot_on but right now only puma board is using this with relevant config options rest remains common for all targets.
--- arch/arm/mach-rockchip/rk3399-board-spl.c | 63 +++++++++++++++++++ board/rockchip/evb_rk3399/evb-rk3399.c | 8 --- .../puma_rk3399/puma-rk3399.c | 58 ----------------- board/vamrs/rock960_rk3399/rock960-rk3399.c | 8 --- 4 files changed, 63 insertions(+), 74 deletions(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +63 -0
@@ -11,13 +11,16 @@#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/grf_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> #include <dm/pinctrl.h> void board_return_to_bootrom (void )
@@ -204,6 +207,66 @@ void board_init_f(ulong dummy)#endif } +#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 + +preloader_console_init (); +} +#ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match (const char *name) {
board/rockchip/evb_rk3399/evb-rk3399.c +0 -8
@@ -8,7 +8,6 @@#include <dm/pinctrl.h> #include <asm/arch-rockchip/periph.h> #include <power/regulator.h> -#include <spl.h> int board_init (void ) {
@@ -64,10 +63,3 @@ int board_init(void) out:return 0 ; } - -void spl_board_init (void ) -{ -preloader_console_init (); - -return ; -}
board/theobroma-systems/puma_rk3399/puma-rk3399.c +0 -58
72 lines not on this page · raw message
board/vamrs/rock960_rk3399/rock960-rk3399.c +0 -8
@@ -6,7 +6,6 @@#include <common.h> #include <dm.h> #include <power/regulator.h> -#include <spl.h> int board_init (void ) {
@@ -18,10 +17,3 @@ int board_init(void)return 0 ; } - -void spl_board_init (void ) -{ -preloader_console_init (); - -return ; -}
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 3/8 rockchip: rk3399: spl: Mark printascii into debug
In reply to a message not in the archiveNow, we have spl_board_init with preloader_console_init that indeed show SPL banner.
So mark the 'U-Boot SPL board init' print into debug.
--- arch/arm/mach-rockchip/rk3399-board-spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399-board-spl.c +1 -1
@@ -164,7 +164,7 @@ void board_init_f(ulong dummy)* printhex8(0x1234); * printascii("string"); */ -printascii ("U-Boot SPL board init\n" ); +debug ("U-Boot SPL board init\n" );#endif ret =spl_early_init ();
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 4/8 rockchip: rk3399: Move u-boot, dm-pre-reloc of uart0, uart2
In reply to a message not in the archiveu-boot,dm-pre-reloc for uart0, uart2 indeed u-boot specific properties. Move them into rk3399-u-boot.dtsi so the boards which enabled these node will available during SPL.
--- arch/arm/dts/rk3399-gru.dtsi | 1 - arch/arm/dts/rk3399-puma.dtsi | 1 - arch/arm/dts/rk3399-u-boot.dtsi | 8 ++++++++ 3 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/dts/rk3399-gru.dtsi +0 -1
@@ -629,7 +629,6 @@ ap_i2c_audio: &i2c8 { &uart2 { status = "okay"; - u-boot,dm-pre-reloc; }; &usb_host0_ohci {
arch/arm/dts/rk3399-puma.dtsi +0 -1
@@ -639,7 +639,6 @@ }; &uart0 { - u-boot,dm-pre-reloc; pinctrl-names = "default"; pinctrl-0 = <&uart0_xfer &uart0_cts>; status = "okay";
arch/arm/dts/rk3399-u-boot.dtsi +8 -0
@@ -10,3 +10,11 @@ &spi1 { u-boot,dm-pre-reloc; }; + +&uart0 { + u-boot,dm-pre-reloc; +}; + +&uart2 { + u-boot,dm-pre-reloc; +};
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 5/8 rockchip: rk3399: Enable SPL_BOARD_INIT
In reply to a message not in the archiveEnable SPL_BOARD_INIT globally to rk3399, this would help to print the SPL banner during bootup.
--- arch/arm/mach-rockchip/Kconfig | 1 + configs/puma-rk3399_defconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -158,6 +158,7 @@ config ROCKCHIP_RK3399 select SPL select SPL_ATF select SPL_ATF_NO_PLATFORM_PARAM if SPL_ATF + select SPL_BOARD_INIT if SPL select SPL_LOAD_FIT select SPL_CLK if SPL select SPL_PINCTRL if SPL
configs/puma-rk3399_defconfig +0 -1
@@ -21,7 +21,6 @@ CONFIG_MISC_INIT_R=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_TEXT_BASE=0xff8c2000 -CONFIG_SPL_BOARD_INIT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set # CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set CONFIG_SPL_STACK_R=y
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 6/8 rockchip: rk3399: tpl: Add spl_board_init
In reply to a message not in the archiveAdd spl_board_init for TPL, that have TPL banner will help to print tpl boot prints.
--- arch/arm/mach-rockchip/rk3399-board-tpl.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-rockchip/rk3399-board-tpl.c +7 -0
@@ -8,6 +8,7 @@#include <dm.h> #include <ram.h> #include <spl.h> +#include <version.h> #include <asm/io.h> #include <asm/arch-rockchip/bootrom.h>
@@ -73,6 +74,12 @@ u32 spl_boot_device(void)return BOOT_DEVICE_BOOTROM ; } +void spl_board_init (void ) +{ +puts ("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " +U_BOOT_TIME " " U_BOOT_TZ ")\n" ); +} +#ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match (const char *name) {
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 7/8 rockchip: rk3399: tpl: Mark printascii into debug
In reply to a message not in the archiveNow, we have spl_board_init which has TPL banner prints.
So mark the 'U-Boot TPL board init' print into debug.
--- arch/arm/mach-rockchip/rk3399-board-tpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399-board-tpl.c +1 -1
@@ -47,7 +47,7 @@ void board_init_f(ulong dummy)* printhex8(0x1234); * printascii("string"); */ -printascii ("U-Boot TPL board init\n" ); +debug ("U-Boot TPL board init\n" );#endif ret =spl_early_init ();if (ret) {
Signature · 1 line
2.18.0.321.gffc6fa0e3
PATCH 8/8 rockchip: rk3399: Enable TPL_BOARD_INIT
In reply to a message not in the archiveEnable TPL_BOARD_INIT, this would help us to show
TPL boot prints.
--- arch/arm/mach-rockchip/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -184,6 +184,7 @@ config ROCKCHIP_RK3399 imply TPL_LIBCOMMON_SUPPORT imply TPL_LIBGENERIC_SUPPORT imply TPL_SYS_MALLOC_SIMPLE + imply TPL_BOARD_INIT imply TPL_BOOTROM_SUPPORT imply TPL_DRIVERS_MISC_SUPPORT imply TPL_OF_CONTROL
Signature · 1 line
2.18.0.321.gffc6fa0e3