omap: Use spl_soc_init instead of spl_board_init
Subsystems (3)
PATCH 1/3 omap: Use spl_soc_init instead of spl_board_init
Both spl_board_init and spl_soc_init are available as ways to run specific code in the SPL's board_init_r. Use the former for init code that is specific to the SoC and leave spl_board_init available for boards to use.
--- arch/arm/Kconfig | 2 +- arch/arm/mach-omap2/boot-common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/Kconfig +1 -1
@@ -802,7 +802,7 @@ config ARCH_OMAP2PLUS bool "TI OMAP2+" select CPU_V7A select GPIO_EXTRA_HEADER - select SPL_BOARD_INIT if SPL + select SPL_SOC_INIT if SPL select SPL_STACK_R if SPL select SUPPORT_SPL imply TI_SYSC if DM && OF_CONTROL
arch/arm/mach-omap2/boot-common.c +1 -1
@@ -269,7 +269,7 @@ skip_ipu1:debug ("%s: IPU2 failed to start (%d)\n" , __func__, ret); } -void spl_board_init (void ) +void spl_soc_init (void ) {/* Prepare console output */ preloader_console_init ();
Signature · 1 line
2.45.2
PATCH 2/3 am33xx: Use regular spl_board_init instead of am33xx_spl_board_init
The am33xx_spl_board_init function was introduced as a way to add board-specific SPL init for AM33xx devices since the spl_board_init function was already used for SoC-specific init.
Now that the SoC-specific SPL init was moved to spl_soc_init, we can use spl_board_init for this purpose and get rid of am33xx_spl_board_init.
Rename the function in board files and enable the related config option for concerned boards.
--- arch/arm/include/asm/arch-am33xx/sys_proto.h | 1 - arch/arm/mach-omap2/am33xx/board.c | 8 -------- arch/arm/mach-omap2/boot-common.c | 3 --- board/BuR/brppt1/board.c | 2 +- board/BuR/brsmarc1/board.c | 2 +- board/BuR/brxre1/board.c | 2 +- board/bosch/guardian/board.c | 2 +- board/bosch/shc/board.c | 2 +- board/eets/pdu001/board.c | 6 +++--- board/grinn/chiliboard/board.c | 2 +- board/tcl/sl50/board.c | 2 +- board/vscom/baltos/board.c | 2 +- configs/am335x_baltos_defconfig | 1 + configs/am335x_guardian_defconfig | 1 + configs/am335x_pdu001_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/brppt1_mmc_defconfig | 1 + configs/brsmarc1_defconfig | 1 + configs/brxre1_defconfig | 1 + configs/chiliboard_defconfig | 1 + 24 files changed, 23 insertions(+), 23 deletions(-)
arch/arm/include/asm/arch-am33xx/sys_proto.h +0 -1
@@ -37,7 +37,6 @@ u32 wait_on_value(u32, u32, void *, u32);#ifdef CONFIG_NOR_BOOT void enable_norboot_pin_mux (void );#endif -void am33xx_spl_board_init (void );int am335x_get_efuse_mpu_max_freq (struct ctrl_dev *cdev);int am335x_get_mpu_vdd (int sil_rev,int frequency);int am335x_get_tps65910_mpu_vdd (int sil_rev,int frequency);
arch/arm/mach-omap2/am33xx/board.c +0 -8
@@ -337,14 +337,6 @@ int board_early_init_f(void)return 0 ; } -/* -* This function is the place to do per-board things such as ramp up the -* MPU clock frequency. -*/ -__weak void am33xx_spl_board_init (void ) -{ -} -#if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC )static void rtc32k_enable (void ) {
arch/arm/mach-omap2/boot-common.c +0 -3
@@ -285,9 +285,6 @@ void spl_soc_init(void)#endif #if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG )hw_watchdog_init (); -#endif -#ifdef CONFIG_AM33XX -am33xx_spl_board_init ();#endif if (IS_ENABLED (CONFIG_SPL_BUILD ) &&IS_ENABLED (CONFIG_REMOTEPROC_TI_IPU ))
board/BuR/brppt1/board.c +1 -1
@@ -79,7 +79,7 @@ static const struct ctrl_ioregs ddr3_ioregs = {#define OSC (V_OSCK/1000000)static const struct dpll_params dpll_ddr3 = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {int rc;
board/BuR/brsmarc1/board.c +1 -1
@@ -72,7 +72,7 @@ static const struct ctrl_ioregs ddr3_ioregs = {#define OSC (V_OSCK / 1000000)const struct dpll_params dpll_ddr3 = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {struct cm_perpll *const cmper = (struct cm_perpll *)CM_PER ;struct cm_wkuppll *const cmwkup = (struct cm_wkuppll *)CM_WKUP ;
board/BuR/brxre1/board.c +1 -1
@@ -79,7 +79,7 @@ static const struct ctrl_ioregs ddr3_ioregs = {#define OSC (V_OSCK / 1000000)const struct dpll_params dpll_ddr3 = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {int rc;
board/bosch/guardian/board.c +1 -1
@@ -75,7 +75,7 @@ static struct emif_regs ddr3_emif_reg_data = {const struct dpll_params dpll_ddr = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {int mpu_vdd;int usb_cur_lim;
board/bosch/shc/board.c +1 -1
@@ -310,7 +310,7 @@ const struct dpll_params *get_dpll_ddr_params(void)const struct dpll_params dpll_mpu_shc_opp100 = {99 ,MPUPLL_N ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {int sil_rev;int mpu_vdd;
board/eets/pdu001/board.c +3 -3
@@ -56,10 +56,10 @@ DECLARE_GLOBAL_DATA_PTR;* boot device save register * ------------------------- * The boot device can be quired by 'spl_boot_device()' in -* 'am33xx_spl_board_init'. However it can't be saved in the u-boot +* 'spl_board_init'. However it can't be saved in the u-boot * environment here. In turn 'spl_boot_device' can't be called in * 'board_late_init' which allows writing to u-boot environment. -* To get the boot device from 'am33xx_spl_board_init' to +* To get the boot device from 'spl_board_init' to * 'board_late_init' we therefore use a scratch register from the RTC. */ #define CFG_SYS_RTC_SCRATCH0 0x60
@@ -192,7 +192,7 @@ const struct dpll_params dpll_ddr_evm_sk = {const struct dpll_params dpll_ddr_bone_black = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE ;
board/grinn/chiliboard/board.c +1 -1
@@ -80,7 +80,7 @@ void set_mux_conf_regs(void)enable_board_pin_mux (); } -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {chilisom_spl_board_init (); }
board/tcl/sl50/board.c +1 -1
@@ -92,7 +92,7 @@ int spl_start_uboot(void)const struct dpll_params dpll_ddr_sl50 = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {int mpu_vdd;
board/vscom/baltos/board.c +1 -1
@@ -177,7 +177,7 @@ const struct dpll_params dpll_ddr_evm_sk = {const struct dpll_params dpll_ddr_baltos = {400 ,OSC -1 ,1 ,-1 ,-1 ,-1 ,-1 }; -void am33xx_spl_board_init (void ) +void spl_board_init (void ) {int sil_rev, mpu_vdd;int freq;
configs/am335x_baltos_defconfig +1 -0
@@ -17,6 +17,7 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTCOMMAND="run findfdt; run usbboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;" CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000 CONFIG_SPL_FS_EXT4=y
configs/am335x_guardian_defconfig +1 -0
@@ -29,6 +29,7 @@ CONFIG_AUTOBOOT_DELAY_STR="d" CONFIG_AUTOBOOT_STOP_STR=" " CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_BOARD_INIT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
configs/am335x_pdu001_defconfig +1 -0
@@ -22,6 +22,7 @@ CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" CONFIG_AUTOBOOT_STOP_STR=" " CONFIG_BOOTCOMMAND="run eval_boot_device;part uuid mmc ${mmc_boot}:${root_fs_partition} root_fs_partuuid;setenv bootargs console=${console} vt.global_cursor_default=0 root=PARTUUID=${root_fs_partuuid} rootfstype=ext4 rootwait rootdelay=1;fatload mmc ${mmc_boot} ${fdtaddr} ${fdtfile};fatload mmc ${mmc_boot} ${loadaddr} ${bootfile};bootz ${loadaddr} - ${fdtaddr}" CONFIG_BOARD_LATE_INIT=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
configs/am335x_shc_defconfig +1 -0
@@ -31,6 +31,7 @@ CONFIG_BOOTCOMMAND="if mmc dev 1; mmc rescan; then run emmc_setup; else echo ERR CONFIG_DEFAULT_FDT_FILE="am335x-shc" CONFIG_SYS_PBSIZE=1049 CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
configs/am335x_shc_ict_defconfig +1 -0
@@ -29,6 +29,7 @@ CONFIG_BOOTCOMMAND="if mmc dev 0; mmc rescan; then run sd_setup; else echo ERROR CONFIG_DEFAULT_FDT_FILE="am335x-shc" CONFIG_SYS_PBSIZE=1049 CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
configs/am335x_shc_netboot_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_BOOTCOMMAND="run fusecmd; if run netboot; then echo Booting from network; CONFIG_DEFAULT_FDT_FILE="am335x-shc" CONFIG_SYS_PBSIZE=1049 CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
configs/am335x_shc_sdboot_defconfig +1 -0
@@ -32,6 +32,7 @@ CONFIG_BOOTCOMMAND="if mmc dev 0; mmc rescan; then run sd_setup; else echo ERROR CONFIG_DEFAULT_FDT_FILE="am335x-shc" CONFIG_SYS_PBSIZE=1049 CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
configs/am335x_sl50_defconfig +1 -0
@@ -22,6 +22,7 @@ CONFIG_AUTOBOOT_PROMPT="Press SPACE to abort autoboot in %d seconds\n" CONFIG_AUTOBOOT_DELAY_STR="d" CONFIG_AUTOBOOT_STOP_STR=" " CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000 CONFIG_SPL_ENV_SUPPORT=y
configs/brppt1_mmc_defconfig +1 -0
@@ -37,6 +37,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
configs/brsmarc1_defconfig +1 -0
@@ -37,6 +37,7 @@ CONFIG_BOARD_TYPES=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_BOARD_INIT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y
configs/brxre1_defconfig +1 -0
@@ -33,6 +33,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
configs/chiliboard_defconfig +1 -0
@@ -22,6 +22,7 @@ CONFIG_BOOTCOMMAND="run mmcboot; run nandboot; run netboot" CONFIG_DEFAULT_FDT_FILE="am335x-chiliboard.dtb" CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_ARCH_MISC_INIT=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000 CONFIG_SPL_I2C=y
Signature · 1 line
2.45.2
Re: [PATCH 2/3] am33xx: Use regular spl_board_init instead of am33xx_spl_board_init
Quoted 4 lines · Paul Kocialkowski
The
am33xx_spl_board_initfunction was introduced as a way to add board-specific SPL init for AM33xx devices since thespl_board_initfunction was already used for SoC-specific init.
Quoted 8 lines
Now that the SoC-specific SPL init was moved to
spl_soc_init, we can usespl_board_initfor this purpose and get rid ofam33xx_spl_board_init.Rename the function in board files and enable the related config option for concerned boards.
Signed-off-by Paul Kocialkowski <[email protected]>
Nice cleanup thanks for doing it!
Signature · 1 line
Tom
PATCH 3/3 omap3: sniper: Convert to device-tree control and DM I2C
In reply to Paul KocialkowskiFrom: Paul Kocialkowski <[email protected]>
This converts the sniper board (LG P970) to device-tree control and DM I2C, both for SPL and U-Boot.
Note that we lose the call to board_mmc_power_init to enable power for MMC2. This is now expected to take place through proper regulators, which are not yet available with the twl4030 driver. The call to twl4030_power_mmc_init is moved to spl_board_init for now.
--- arch/arm/dts/omap3-sniper-u-boot.dtsi | 16 +++++++++++++++ board/lg/sniper/sniper.c | 29 +++++---------------------- configs/sniper_defconfig | 13 +++++++----- 3 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 arch/arm/dts/omap3-sniper-u-boot.dtsi
arch/arm/dts/omap3-sniper-u-boot.dtsi new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Paul Kocialkowski <[email protected]> + */ + +#include "omap3-u-boot.dtsi" + +/ { + chosen { + stdout-path = &uart3; + }; +}; + +&i2c1 { + clock-frequency = <400000>; +};
board/lg/sniper/sniper.c +5 -24
@@ -14,11 +14,9 @@#include <linux/ctype.h> #include <linux/usb/musb.h> #include <asm/omap_musb.h> -#include <asm/arch/mmc_host_def.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mem.h> #include <asm/io.h> -#include <ns16550.h> #include <twl4030.h> #include "sniper.h"
@@ -30,18 +28,6 @@ const omap3_sysinfo sysinfo = { .nand_string = "MMC" }; -static const struct ns16550_plat serial_omap_plat = { - .base =OMAP34XX_UART3 , - .reg_shift =2 , - .clock =V_NS16550_CLK , - .fcr =UART_FCR_DEFVAL , -}; - -U_BOOT_DRVINFO (sniper_serial) = { - .name ="ns16550_serial" , - .plat = &serial_omap_plat -}; -#if defined(CONFIG_USB_MUSB_HOST ) || defined(CONFIG_USB_MUSB_GADGET )static struct musb_hdrc_config musb_config = { .multipoint = 1,
@@ -77,6 +63,11 @@ void get_board_mem_timings(struct board_sdrc_timings *timings) timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz; timings->mr = MICRON_V_MR_165; } + +void spl_board_init (void ) +{ +twl4030_power_mmc_init (1 ); +}#endif int board_init (void )
@@ -188,13 +179,3 @@ int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)return omap_reboot_mode_store ("b" ); } - -int board_mmc_init (struct bd_info *bis) -{ -return omap_mmc_init (1 ,0 ,0 ,-1 ,-1 ); -} - -void board_mmc_power_init (void ) -{ -twl4030_power_mmc_init (1 ); -}
configs/sniper_defconfig +8 -5
@@ -1,12 +1,14 @@ CONFIG_ARM=y CONFIG_ARCH_OMAP2PLUS=y CONFIG_SYS_MALLOC_F_LEN=0x4000 +CONFIG_DEFAULT_DEVICE_TREE="ti/omap/omap3-sniper" CONFIG_TARGET_SNIPER=y CONFIG_SPL_SYS_MALLOC_F_LEN=0x400 CONFIG_SPL=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTCOMMAND="setenv boot_mmc_part ${kernel_mmc_part}; if test reboot-${reboot-mode} = reboot-r; then echo recovery; setenv boot_mmc_part ${recovery_mmc_part}; fi; if test reboot-${reboot-mode} = reboot-b; then echo fastboot; fastboot 0; fi; part start mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_start; part size mmc ${boot_mmc_dev} ${boot_mmc_part} boot_mmc_size; mmc dev ${boot_mmc_dev}; mmc read ${kernel_addr_r} ${boot_mmc_start} ${boot_mmc_size} && bootm ${kernel_addr_r};" CONFIG_SYS_CONSOLE_IS_IN_ENV=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_SYS_MALLOC_SIZE=0x800000
@@ -19,12 +21,13 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y # CONFIG_CMD_SETEXPR is not set +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_UPSTREAM=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y -CONFIG_SYS_I2C_SPEED=400000 +CONFIG_SPL_DM=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y CONFIG_TWL4030_INPUT=y CONFIG_MMC_OMAP_HS=y -CONFIG_CONS_INDEX=3 -CONFIG_OF_LIBFDT=y
Signature · 1 line
2.45.2
Quoted 6 lines · Paul Kocialkowski
Both
spl_board_initandspl_soc_initare available as ways to run specific code in the SPL'sboard_init_r. Use the former for init code that is specific to the SoC and leavespl_board_initavailable for boards to use.Signed-off-by Paul Kocialkowski <[email protected]>
Signature · 1 line
Tom
Quoted 6 lines · Paul Kocialkowski
Both
spl_board_initandspl_soc_initare available as ways to run specific code in the SPL'sboard_init_r. Use the former for init code that is specific to the SoC and leavespl_board_initavailable for boards to use.
Applied to u-boot/next, thanks!
Signature · 1 line
Tom