U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
October 2019
- 191 participants
- 769 discussions
Hi,
This patchset follow
http://patchwork.ozlabs.org/project/uboot/list/?series=131268&state=*
It follow the first proposal
http://patchwork.ozlabs.org/project/uboot/list/?series=129339
"env: Add CONFIG_ENV_SUPPORT"
The first patch of the serie only solves the regression introduced by
commit 7d4776545b0f ("env: solve compilation error
in SPL"); change_ok was always NULL in U-Boot.
See "U-Boot: Environment flags broken for U-Boot" mail
http://u-boot.10912.n7.nabble.com/U-Boot-Environment-flags-broken-for-U-Boo…
This first patch can be integrated in master branch
for v2019.10 as requested Tom Rimi.
The next patches of the serie is a proposal after Wolfgang Denk
review on the first proposal: I make the env support coherent
between U-Boot, SPL and TPL.
I need to change many defconfig (to add CONFIG_(SPL/TPL)_ENV_IS_NOWHERE)
because I modify the dependency between the CONFIG used by SPL.
Moreover the size of SPL increase this last patch.
So to avoid to increase the SPL and TPL size, I also allow to
have empty default environment with the new options
CONFIG_$(SPL_TPL_)ENV_DEFAULT
Today the last buildman result is :
02: env: Add CONFIG_ENV_FULL_SUPPORT
arm: + smartweb
+/local/home/frq07632/.buildman-toolchains/gcc-7.3.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: u-boot-spl section `.u_boot_list' will not fit in region `.sram'
+/local/home/frq07632/.buildman-toolchains/gcc-7.3.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: SPL image too big
+/local/home/frq07632/.buildman-toolchains/gcc-7.3.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: region `.sram' overflowed by 56 bytes
+make[2]: *** [spl/u-boot-spl] Error 1
+make[1]: *** [spl/u-boot-spl] Error 2
x86: (for 26/26 boards) all -23.5 bss -7.4 spl/u-boot-spl:all -226.7 spl/u-boot-spl:data +0.9 spl/u-boot-spl:rodata -228.6 spl/u-boot-spl:text +1.0 text -16.1
aarch64: (for 225/225 boards) all +0.1 rodata +0.1 spl/u-boot-spl:all -33.3 spl/u-boot-spl:bss -0.1 spl/u-boot-spl:data +18.0 spl/u-boot-spl:rodata -64.3 spl/u-boot-spl:text +13.2
powerpc: (for 309/309 boards) spl/u-boot-spl:all -338.8 spl/u-boot-spl:data -338.8
sandbox: (for 6/6 boards) all -46.7 rodata +16.0 spl/u-boot-spl:all -496.0 spl/u-boot-spl:rodata -496.0 text -62.7
microblaze: (for 1/1 boards) all +4.0 bss +100.0 data -4.0 rodata -8.0 spl/u-boot-spl:all +1136.0 spl/u-boot-spl:bss -8.0 spl/u-boot-spl:data +24.0 spl/u-boot-spl:rodata +1092.0 spl/u-boot-spl:text +28.0 text -84.0
arm: (for 689/689 boards) all -0.1 bss +0.1 rodata +0.1 spl/u-boot-spl:all -131.3 spl/u-boot-spl:data +12.9 spl/u-boot-spl:rodata -154.7 spl/u-boot-spl:text +10.5 text -0.3
With this patch I gain on the rodata size in spl for many targets.
But I need to be sure that have a empty default environment in SPL/TPL
by default is normal for all architecture/boards.
Do you think I need to reactivate it by default the CONFIG for SPL
and deactivated only on some target.
Any remarks are welcome.
Best regards.
Patrick Delaunay.
Changes in v4:
- Add CONFIG_$(SPL_TPL_)ENV_DEFAULT: empty default environment
when not activated
Changes in v3:
- It is a version 3 of
http://patchwork.ozlabs.org/project/uboot/list/?series=129339
"env: Add CONFIG_ENV_SUPPORT"
after Tom Rimi and Wolfgang Denk remarks
Changes in v2:
- Add comment for ENV_IS_IN_SOMEWHERE
- Update commit message after Lukasz Majewki review
Patrick Delaunay (3):
env: correct the check of env_flags_validate presence
env: introduce macro ENV_IS_IN_SOMEWHERE
env: Add CONFIG_ENV_FULL_SUPPORT
arch/arm/mach-omap2/Kconfig | 1 -
arch/arm/mach-omap2/am33xx/Kconfig | 2 --
board/birdland/bav335x/board.c | 2 +-
board/gateworks/gw_ventana/gw_ventana_spl.c | 2 +-
board/liebherr/display5/spl.c | 4 +--
board/tcl/sl50/board.c | 2 +-
board/ti/am335x/board.c | 2 +-
board/ti/am57xx/board.c | 2 +-
board/ti/dra7xx/evm.c | 2 +-
cmd/Kconfig | 2 ++
cmd/nvedit.c | 27 +++------------
common/spl/Kconfig | 20 -----------
common/spl/spl_ext.c | 2 +-
common/spl/spl_fat.c | 2 +-
configs/A10-OLinuXino-Lime_defconfig | 1 +
configs/A10s-OLinuXino-M_defconfig | 1 +
configs/A13-OLinuXinoM_defconfig | 1 +
configs/A13-OLinuXino_defconfig | 1 +
configs/A20-OLinuXino-Lime2-eMMC_defconfig | 1 +
configs/A20-OLinuXino-Lime2_defconfig | 1 +
configs/A20-OLinuXino-Lime_defconfig | 1 +
configs/A20-OLinuXino_MICRO-eMMC_defconfig | 1 +
configs/A20-OLinuXino_MICRO_defconfig | 1 +
configs/A20-Olimex-SOM-EVB_defconfig | 1 +
configs/A20-Olimex-SOM204-EVB-eMMC_defconfig | 1 +
configs/A20-Olimex-SOM204-EVB_defconfig | 1 +
configs/A33-OLinuXino_defconfig | 1 +
configs/Ainol_AW1_defconfig | 1 +
configs/Ampe_A76_defconfig | 1 +
configs/Auxtek-T003_defconfig | 1 +
configs/Auxtek-T004_defconfig | 1 +
configs/B4420QDS_NAND_defconfig | 1 -
configs/B4860QDS_NAND_defconfig | 1 -
configs/BSC9131RDB_NAND_SYSCLK100_defconfig | 1 +
configs/BSC9131RDB_NAND_defconfig | 1 +
configs/BSC9132QDS_NAND_DDRCLK100_defconfig | 1 +
configs/BSC9132QDS_NAND_DDRCLK133_defconfig | 1 +
configs/Bananapi_M2_Ultra_defconfig | 1 +
configs/Bananapi_defconfig | 1 +
configs/Bananapi_m2m_defconfig | 1 +
configs/Bananapro_defconfig | 1 +
configs/C29XPCIE_NAND_defconfig | 2 +-
configs/CHIP_pro_defconfig | 1 +
configs/CSQ_CS908_defconfig | 1 +
configs/Chuwi_V7_CW0825_defconfig | 1 +
configs/Colombus_defconfig | 1 +
configs/Cubieboard2_defconfig | 1 +
configs/Cubieboard4_defconfig | 1 +
configs/Cubieboard_defconfig | 1 +
configs/Cubietruck_defconfig | 1 +
configs/Cubietruck_plus_defconfig | 1 +
configs/Empire_electronix_d709_defconfig | 1 +
configs/Empire_electronix_m712_defconfig | 1 +
configs/Hummingbird_A31_defconfig | 1 +
configs/Hyundai_A7HD_defconfig | 1 +
configs/Itead_Ibox_A20_defconfig | 1 +
configs/Lamobo_R1_defconfig | 1 +
configs/LicheePi_Zero_defconfig | 1 +
configs/Linksprite_pcDuino3_Nano_defconfig | 1 +
configs/Linksprite_pcDuino3_defconfig | 1 +
configs/Linksprite_pcDuino_defconfig | 1 +
configs/MK808C_defconfig | 1 +
configs/MPC8313ERDB_NAND_33_defconfig | 1 +
configs/MPC8313ERDB_NAND_66_defconfig | 1 +
configs/MSI_Primo73_defconfig | 1 +
configs/MSI_Primo81_defconfig | 1 +
configs/Marsboard_A10_defconfig | 1 +
configs/Mele_A1000G_quad_defconfig | 1 +
configs/Mele_A1000_defconfig | 1 +
configs/Mele_I7_defconfig | 1 +
configs/Mele_M3_defconfig | 1 +
configs/Mele_M5_defconfig | 1 +
configs/Mele_M9_defconfig | 1 +
configs/Merrii_A80_Optimus_defconfig | 1 +
configs/Mini-X_defconfig | 1 +
configs/Orangepi_defconfig | 1 +
configs/Orangepi_mini_defconfig | 1 +
configs/P1010RDB-PA_36BIT_NAND_defconfig | 2 +-
configs/P1010RDB-PA_36BIT_SDCARD_defconfig | 1 -
configs/P1010RDB-PA_36BIT_SPIFLASH_defconfig | 1 -
configs/P1010RDB-PA_NAND_defconfig | 2 +-
configs/P1010RDB-PA_SDCARD_defconfig | 1 -
configs/P1010RDB-PA_SPIFLASH_defconfig | 1 -
configs/P1010RDB-PB_36BIT_NAND_defconfig | 2 +-
configs/P1010RDB-PB_36BIT_SDCARD_defconfig | 1 -
configs/P1010RDB-PB_36BIT_SPIFLASH_defconfig | 1 -
configs/P1010RDB-PB_NAND_defconfig | 2 +-
configs/P1010RDB-PB_SDCARD_defconfig | 1 -
configs/P1010RDB-PB_SPIFLASH_defconfig | 1 -
configs/P1020MBG-PC_36BIT_SDCARD_defconfig | 1 -
configs/P1020MBG-PC_SDCARD_defconfig | 1 -
configs/P1020RDB-PC_36BIT_NAND_defconfig | 2 +-
configs/P1020RDB-PC_36BIT_SDCARD_defconfig | 1 -
configs/P1020RDB-PC_36BIT_SPIFLASH_defconfig | 1 -
configs/P1020RDB-PC_NAND_defconfig | 2 +-
configs/P1020RDB-PC_SDCARD_defconfig | 1 -
configs/P1020RDB-PC_SPIFLASH_defconfig | 1 -
configs/P1020RDB-PD_NAND_defconfig | 2 +-
configs/P1020RDB-PD_SDCARD_defconfig | 1 -
configs/P1020RDB-PD_SPIFLASH_defconfig | 1 -
configs/P1020UTM-PC_36BIT_SDCARD_defconfig | 1 -
configs/P1020UTM-PC_SDCARD_defconfig | 1 -
configs/P1021RDB-PC_36BIT_NAND_defconfig | 2 +-
configs/P1021RDB-PC_36BIT_SDCARD_defconfig | 1 -
configs/P1021RDB-PC_36BIT_SPIFLASH_defconfig | 1 -
configs/P1021RDB-PC_NAND_defconfig | 2 +-
configs/P1021RDB-PC_SDCARD_defconfig | 1 -
configs/P1021RDB-PC_SPIFLASH_defconfig | 1 -
configs/P1022DS_36BIT_NAND_defconfig | 2 +-
configs/P1022DS_36BIT_SDCARD_defconfig | 1 -
configs/P1022DS_36BIT_SPIFLASH_defconfig | 1 -
configs/P1022DS_NAND_defconfig | 2 +-
configs/P1022DS_SDCARD_defconfig | 1 -
configs/P1022DS_SPIFLASH_defconfig | 1 -
configs/P1024RDB_NAND_defconfig | 2 +-
configs/P1024RDB_SDCARD_defconfig | 1 -
configs/P1024RDB_SPIFLASH_defconfig | 1 -
configs/P1025RDB_NAND_defconfig | 2 +-
configs/P1025RDB_SDCARD_defconfig | 1 -
configs/P1025RDB_SPIFLASH_defconfig | 1 -
configs/P2020RDB-PC_36BIT_NAND_defconfig | 2 +-
configs/P2020RDB-PC_36BIT_SDCARD_defconfig | 1 -
configs/P2020RDB-PC_36BIT_SPIFLASH_defconfig | 1 -
configs/P2020RDB-PC_NAND_defconfig | 2 +-
configs/P2020RDB-PC_SDCARD_defconfig | 1 -
configs/P2020RDB-PC_SPIFLASH_defconfig | 1 -
configs/Sinlinx_SinA31s_defconfig | 1 +
configs/Sinlinx_SinA33_defconfig | 1 +
configs/Sinovoip_BPI_M2_defconfig | 1 +
configs/Sinovoip_BPI_M3_defconfig | 1 +
configs/Sunchip_CX-A99_defconfig | 1 +
configs/T1023RDB_NAND_defconfig | 1 -
configs/T1023RDB_SDCARD_defconfig | 1 -
configs/T1023RDB_SPIFLASH_defconfig | 1 -
configs/T1024QDS_NAND_defconfig | 1 -
configs/T1024QDS_SDCARD_defconfig | 1 -
configs/T1024QDS_SPIFLASH_defconfig | 1 -
configs/T1024RDB_NAND_defconfig | 1 -
configs/T1024RDB_SDCARD_defconfig | 1 -
configs/T1024RDB_SPIFLASH_defconfig | 1 -
configs/T1040D4RDB_NAND_defconfig | 1 -
configs/T1040D4RDB_SDCARD_defconfig | 1 -
configs/T1040D4RDB_SPIFLASH_defconfig | 1 -
configs/T1040RDB_NAND_defconfig | 1 -
configs/T1040RDB_SDCARD_defconfig | 1 -
configs/T1040RDB_SPIFLASH_defconfig | 1 -
configs/T1042D4RDB_NAND_defconfig | 1 -
configs/T1042D4RDB_SDCARD_defconfig | 1 -
configs/T1042D4RDB_SPIFLASH_defconfig | 1 -
.../T1042RDB_PI_NAND_SECURE_BOOT_defconfig | 1 -
configs/T1042RDB_PI_NAND_defconfig | 1 -
configs/T1042RDB_PI_SDCARD_defconfig | 1 -
configs/T1042RDB_PI_SPIFLASH_defconfig | 1 -
configs/T2080QDS_NAND_defconfig | 1 -
configs/T2080QDS_SDCARD_defconfig | 1 -
configs/T2080QDS_SPIFLASH_defconfig | 1 -
configs/T2080RDB_NAND_defconfig | 1 -
configs/T2080RDB_SDCARD_defconfig | 1 -
configs/T2080RDB_SPIFLASH_defconfig | 1 -
configs/T2081QDS_NAND_defconfig | 1 -
configs/T2081QDS_SDCARD_defconfig | 1 -
configs/T2081QDS_SPIFLASH_defconfig | 1 -
configs/T4160QDS_NAND_defconfig | 1 -
configs/T4160QDS_SDCARD_defconfig | 1 -
configs/T4240QDS_NAND_defconfig | 1 -
configs/T4240QDS_SDCARD_defconfig | 1 -
configs/T4240RDB_SDCARD_defconfig | 1 -
configs/UTOO_P66_defconfig | 1 +
configs/Wexler_TAB7200_defconfig | 1 +
configs/Wits_Pro_A20_DKT_defconfig | 1 +
configs/Wobo_i5_defconfig | 1 +
configs/Yones_Toptech_BD1078_defconfig | 1 +
configs/Yones_Toptech_BS1078_V2_defconfig | 1 +
configs/a64-olinuxino_defconfig | 1 +
configs/ae350_rv32_xip_defconfig | 1 +
configs/alt_defconfig | 1 +
configs/am335x_guardian_defconfig | 1 -
configs/am335x_hs_evm_defconfig | 2 +-
configs/am335x_hs_evm_uart_defconfig | 2 +-
configs/am335x_igep003x_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/am3517_crane_defconfig | 1 +
configs/am3517_evm_defconfig | 1 +
configs/am65x_evm_a53_defconfig | 1 +
configs/am65x_evm_r5_defconfig | 1 +
configs/am65x_hs_evm_a53_defconfig | 1 +
configs/am65x_hs_evm_r5_defconfig | 1 +
configs/amarula_a64_relic_defconfig | 1 +
configs/apalis-tk1_defconfig | 1 +
configs/apalis_imx6_defconfig | 1 +
configs/apalis_t30_defconfig | 1 +
configs/apf27_defconfig | 1 +
configs/apx4devkit_defconfig | 1 +
configs/arndale_defconfig | 1 +
configs/axm_defconfig | 1 +
configs/ba10_tv_box_defconfig | 1 +
configs/bananapi_m1_plus_defconfig | 1 +
configs/bananapi_m2_berry_defconfig | 1 +
configs/bananapi_m2_plus_h3_defconfig | 1 +
configs/bananapi_m2_plus_h5_defconfig | 1 +
configs/bananapi_m2_zero_defconfig | 1 +
configs/bananapi_m64_defconfig | 1 +
configs/beaver_defconfig | 1 +
configs/beelink_gs1_defconfig | 1 +
configs/beelink_x2_defconfig | 1 +
configs/bitmain_antminer_s9_defconfig | 1 +
configs/brppt1_mmc_defconfig | 1 +
configs/brppt1_nand_defconfig | 1 +
configs/brppt1_spi_defconfig | 1 +
configs/brsmarc1_defconfig | 1 +
configs/brxre1_defconfig | 1 +
configs/cairo_defconfig | 1 +
configs/cardhu_defconfig | 1 +
configs/cei-tk1-som_defconfig | 1 +
configs/cgtqmx6eval_defconfig | 1 +
configs/chiliboard_defconfig | 1 +
configs/chromebook_bob_defconfig | 1 +
configs/chromebook_link64_defconfig | 1 -
configs/chromebook_samus_tpl_defconfig | 2 ++
configs/ci20_mmc_defconfig | 1 +
configs/cl-som-imx7_defconfig | 1 +
configs/clearfog_defconfig | 1 +
configs/cm_fx6_defconfig | 1 +
configs/cm_t335_defconfig | 1 +
configs/cm_t35_defconfig | 1 +
configs/cm_t43_defconfig | 1 +
configs/colibri_imx6_defconfig | 1 +
configs/colibri_t20_defconfig | 1 +
configs/colibri_t30_defconfig | 1 +
configs/colorfly_e708_q1_defconfig | 1 +
configs/controlcenterdc_defconfig | 1 +
configs/corvus_defconfig | 1 +
configs/da850evm_defconfig | 1 +
configs/da850evm_nand_defconfig | 1 +
configs/dalmore_defconfig | 1 +
configs/db-88f6720_defconfig | 1 +
configs/db-88f6820-amc_defconfig | 1 +
configs/db-88f6820-gp_defconfig | 1 +
configs/db-mv784mp-gp_defconfig | 1 +
configs/devkit3250_defconfig | 1 +
configs/devkit8000_defconfig | 1 +
configs/dh_imx6_defconfig | 1 +
configs/difrnce_dit4350_defconfig | 1 +
configs/display5_defconfig | 1 -
configs/display5_factory_defconfig | 1 +
configs/draco_defconfig | 1 +
configs/ds414_defconfig | 1 +
configs/dserve_dsrv9703c_defconfig | 1 +
configs/edminiv2_defconfig | 1 +
configs/emlid_neutis_n5_devboard_defconfig | 1 +
configs/etamin_defconfig | 1 +
configs/evb-px5_defconfig | 2 ++
configs/evb-rk3229_defconfig | 2 ++
configs/evb-rk3288_defconfig | 2 ++
configs/evb-rk3328_defconfig | 2 ++
configs/evb-rk3399_defconfig | 2 ++
configs/ficus-rk3399_defconfig | 1 +
configs/firefly-rk3288_defconfig | 1 +
configs/firefly-rk3399_defconfig | 2 ++
configs/ga10h_v1_1_defconfig | 1 +
.../gardena-smart-gateway-at91sam_defconfig | 1 +
configs/gose_defconfig | 1 +
configs/gt90h_v4_defconfig | 1 +
configs/gwventana_emmc_defconfig | 1 +
configs/gwventana_gw5904_defconfig | 1 +
configs/gwventana_nand_defconfig | 1 +
configs/h8_homlet_v2_defconfig | 1 +
configs/harmony_defconfig | 1 +
configs/helios4_defconfig | 1 +
configs/i12-tvbox_defconfig | 1 +
configs/iNet_3F_defconfig | 1 +
configs/iNet_3W_defconfig | 1 +
configs/iNet_86VS_defconfig | 1 +
configs/iNet_D978_rev2_defconfig | 1 +
configs/icnova-a20-swac_defconfig | 1 +
configs/igep00x0_defconfig | 1 +
configs/imx6dl_icore_nand_defconfig | 1 +
configs/imx6dl_mamoj_defconfig | 1 +
configs/imx6q_icore_nand_defconfig | 1 +
configs/imx6q_logic_defconfig | 1 +
configs/imx6qdl_icore_mipi_defconfig | 1 +
configs/imx6qdl_icore_mmc_defconfig | 1 +
configs/imx6qdl_icore_nand_defconfig | 1 +
configs/imx6qdl_icore_rqs_defconfig | 1 +
configs/imx6ul_geam_mmc_defconfig | 1 +
configs/imx6ul_geam_nand_defconfig | 1 +
configs/imx6ul_isiot_emmc_defconfig | 1 +
configs/imx6ul_isiot_nand_defconfig | 1 +
configs/imx8mq_evk_defconfig | 1 +
configs/imx8qm_mek_defconfig | 1 +
configs/imx8qxp_mek_defconfig | 1 +
configs/inet1_defconfig | 1 +
configs/inet86dz_defconfig | 1 +
configs/inet97fv2_defconfig | 1 +
configs/inet98v_rev2_defconfig | 1 +
configs/inet9f_rev03_defconfig | 1 +
configs/inet_q972_defconfig | 1 +
configs/j721e_evm_r5_defconfig | 1 -
configs/jesurun_q5_defconfig | 1 +
configs/jetson-tk1_defconfig | 1 +
configs/k2e_evm_defconfig | 1 +
configs/k2g_evm_defconfig | 1 +
configs/k2hk_evm_defconfig | 1 +
configs/k2l_evm_defconfig | 1 +
configs/khadas-edge-captain-rk3399_defconfig | 2 ++
configs/khadas-edge-rk3399_defconfig | 2 ++
configs/khadas-edge-v-rk3399_defconfig | 2 ++
configs/koelsch_defconfig | 1 +
configs/kp_imx6q_tpc_defconfig | 1 +
configs/kylin-rk3036_defconfig | 1 +
configs/lager_defconfig | 1 +
configs/libretech_all_h3_cc_h2_plus_defconfig | 1 +
configs/libretech_all_h3_cc_h3_defconfig | 1 +
configs/libretech_all_h3_cc_h5_defconfig | 1 +
configs/lion-rk3368_defconfig | 2 ++
configs/liteboard_defconfig | 1 +
configs/ls1021aiot_sdcard_defconfig | 1 +
configs/ls1021aqds_nand_defconfig | 1 -
configs/ls1021aqds_sdcard_ifc_defconfig | 1 -
configs/ls1021aqds_sdcard_qspi_defconfig | 1 -
configs/ls1021atsn_sdcard_defconfig | 1 -
...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig | 1 -
configs/ls1021atwr_sdcard_ifc_defconfig | 1 -
configs/ls1021atwr_sdcard_qspi_defconfig | 1 -
configs/ls1043aqds_nand_defconfig | 1 -
configs/ls1043aqds_sdcard_ifc_defconfig | 1 -
configs/ls1043aqds_sdcard_qspi_defconfig | 1 -
configs/ls1043ardb_nand_SECURE_BOOT_defconfig | 1 -
configs/ls1043ardb_nand_defconfig | 1 -
.../ls1043ardb_sdcard_SECURE_BOOT_defconfig | 1 -
configs/ls1043ardb_sdcard_defconfig | 1 -
configs/ls1046aqds_nand_defconfig | 1 +
configs/ls1046aqds_sdcard_ifc_defconfig | 1 -
configs/ls1046aqds_sdcard_qspi_defconfig | 1 -
configs/ls1046ardb_emmc_defconfig | 1 -
configs/ls1046ardb_qspi_spl_defconfig | 1 -
.../ls1046ardb_sdcard_SECURE_BOOT_defconfig | 1 -
configs/ls1046ardb_sdcard_defconfig | 1 -
configs/ls1088aqds_sdcard_ifc_defconfig | 1 -
configs/ls1088aqds_sdcard_qspi_defconfig | 1 -
...1088ardb_sdcard_qspi_SECURE_BOOT_defconfig | 1 -
configs/ls1088ardb_sdcard_qspi_defconfig | 1 -
configs/ls2080aqds_nand_defconfig | 1 -
configs/ls2080aqds_sdcard_defconfig | 1 -
configs/ls2080ardb_nand_defconfig | 1 -
configs/m53menlo_defconfig | 1 +
configs/maxbcm_defconfig | 1 +
configs/mccmon6_nor_defconfig | 1 -
configs/mccmon6_sd_defconfig | 1 -
configs/medcom-wide_defconfig | 1 +
configs/miqi-rk3288_defconfig | 1 +
configs/mixtile_loftq_defconfig | 1 +
configs/mk802_a10s_defconfig | 1 +
configs/mk802_defconfig | 1 +
configs/mk802ii_defconfig | 1 +
configs/mx23_olinuxino_defconfig | 1 +
configs/mx23evk_defconfig | 1 +
configs/mx28evk_auart_console_defconfig | 1 +
configs/mx28evk_defconfig | 1 +
configs/mx28evk_nand_defconfig | 1 +
configs/mx31pdk_defconfig | 1 +
configs/mx6cuboxi_defconfig | 1 +
configs/mx6sabreauto_defconfig | 1 +
configs/mx6sabresd_defconfig | 1 +
configs/mx6slevk_spl_defconfig | 1 +
configs/mx6sxsabresd_spl_defconfig | 1 +
configs/mx6ul_14x14_evk_defconfig | 1 +
configs/mx6ul_9x9_evk_defconfig | 1 +
configs/nanopc-t4-rk3399_defconfig | 2 ++
configs/nanopi-m4-rk3399_defconfig | 2 ++
configs/nanopi-neo4-rk3399_defconfig | 2 ++
configs/nanopi_a64_defconfig | 1 +
configs/nanopi_m1_defconfig | 1 +
configs/nanopi_m1_plus_defconfig | 1 +
configs/nanopi_neo2_defconfig | 1 +
configs/nanopi_neo_air_defconfig | 1 +
configs/nanopi_neo_defconfig | 1 +
configs/nanopi_neo_plus2_defconfig | 1 +
configs/novena_defconfig | 1 +
configs/nyan-big_defconfig | 1 +
configs/oceanic_5205_5inmfd_defconfig | 1 +
configs/omap35_logic_defconfig | 1 +
configs/omap35_logic_somlv_defconfig | 1 +
configs/omap3_beagle_defconfig | 1 +
configs/omap3_evm_defconfig | 1 +
configs/omap3_ha_defconfig | 1 +
configs/omap3_logic_defconfig | 1 +
configs/omap3_logic_somlv_defconfig | 1 +
configs/omap3_overo_defconfig | 1 +
configs/omap4_panda_defconfig | 1 +
configs/omap4_sdp4430_defconfig | 1 +
configs/omapl138_lcdk_defconfig | 1 +
configs/opos6uldev_defconfig | 1 -
configs/orangepi-rk3399_defconfig | 2 ++
configs/orangepi_2_defconfig | 1 +
configs/orangepi_lite2_defconfig | 1 +
configs/orangepi_lite_defconfig | 1 +
configs/orangepi_one_defconfig | 1 +
configs/orangepi_one_plus_defconfig | 1 +
configs/orangepi_pc2_defconfig | 1 +
configs/orangepi_pc_defconfig | 1 +
configs/orangepi_pc_plus_defconfig | 1 +
configs/orangepi_plus2e_defconfig | 1 +
configs/orangepi_plus_defconfig | 1 +
configs/orangepi_prime_defconfig | 1 +
configs/orangepi_r1_defconfig | 1 +
configs/orangepi_win_defconfig | 1 +
configs/orangepi_zero_defconfig | 1 +
configs/orangepi_zero_plus2_defconfig | 1 +
configs/orangepi_zero_plus_defconfig | 1 +
configs/origen_defconfig | 1 +
configs/ot1200_spl_defconfig | 1 +
configs/parrot_r16_defconfig | 1 +
configs/paz00_defconfig | 1 +
configs/pcm051_rev1_defconfig | 1 -
configs/pcm051_rev3_defconfig | 1 -
configs/pcm058_defconfig | 1 +
configs/peach-pi_defconfig | 1 +
configs/peach-pit_defconfig | 1 +
configs/pengwyn_defconfig | 1 -
configs/phycore-am335x-r2-wega_defconfig | 1 +
configs/phycore-rk3288_defconfig | 1 +
configs/pico-hobbit-imx6ul_defconfig | 1 +
configs/pico-hobbit-imx7d_defconfig | 1 +
configs/pico-imx6ul_defconfig | 1 +
configs/pico-imx7d_bl33_defconfig | 1 +
configs/pico-imx7d_defconfig | 1 +
configs/pico-pi-imx6ul_defconfig | 1 +
configs/pico-pi-imx7d_defconfig | 1 +
configs/picosam9g45_defconfig | 1 +
configs/pine64-lts_defconfig | 1 +
configs/pine64_plus_defconfig | 1 +
configs/pine_h64_defconfig | 1 +
configs/pinebook_defconfig | 1 +
configs/platinum_picon_defconfig | 1 +
configs/platinum_titanium_defconfig | 1 +
configs/plutux_defconfig | 1 +
configs/polaroid_mid2407pxe03_defconfig | 1 +
configs/polaroid_mid2809pxe04_defconfig | 1 +
configs/popmetal-rk3288_defconfig | 1 +
configs/porter_defconfig | 1 +
configs/pov_protab2_ips9_defconfig | 1 +
configs/puma-rk3399_defconfig | 1 +
configs/pxm2_defconfig | 1 +
configs/q8_a13_tablet_defconfig | 1 +
configs/q8_a23_tablet_800x480_defconfig | 1 +
configs/q8_a33_tablet_1024x600_defconfig | 1 +
configs/q8_a33_tablet_800x480_defconfig | 1 +
configs/qemu-riscv32_smode_defconfig | 1 +
configs/qemu-x86_64_defconfig | 1 -
configs/r7-tv-dongle_defconfig | 1 +
configs/r8a7795_salvator-x_defconfig | 1 +
configs/r8a7795_ulcb_defconfig | 1 +
configs/r8a77965_salvator-x_defconfig | 1 +
configs/r8a77965_ulcb_defconfig | 1 +
configs/r8a7796_salvator-x_defconfig | 1 +
configs/r8a7796_ulcb_defconfig | 1 +
configs/r8a77970_eagle_defconfig | 1 +
configs/r8a77980_condor_defconfig | 1 +
configs/r8a77990_ebisu_defconfig | 1 +
configs/r8a77995_draak_defconfig | 1 +
configs/rastaban_defconfig | 1 +
configs/riotboard_spl_defconfig | 1 +
configs/roc-rk3399-pc_defconfig | 2 ++
configs/rock-pi-4-rk3399_defconfig | 2 ++
configs/rock2_defconfig | 1 +
configs/rock64-rk3328_defconfig | 2 ++
configs/rock960-rk3399_defconfig | 1 +
configs/rock_defconfig | 1 +
configs/rockpro64-rk3399_defconfig | 2 ++
configs/rut_defconfig | 1 +
configs/sama5d27_som1_ek_mmc1_defconfig | 1 +
configs/sama5d27_som1_ek_mmc_defconfig | 1 +
configs/sama5d27_som1_ek_qspiflash_defconfig | 1 +
configs/sama5d2_icp_mmc_defconfig | 1 +
configs/sama5d2_xplained_emmc_defconfig | 1 +
configs/sama5d2_xplained_mmc_defconfig | 1 +
configs/sama5d2_xplained_qspiflash_defconfig | 1 +
configs/sama5d2_xplained_spiflash_defconfig | 1 +
configs/sama5d3_xplained_mmc_defconfig | 1 +
configs/sama5d3_xplained_nandflash_defconfig | 1 +
configs/sama5d3xek_mmc_defconfig | 1 +
configs/sama5d3xek_nandflash_defconfig | 1 +
configs/sama5d3xek_spiflash_defconfig | 1 +
configs/sama5d4_xplained_mmc_defconfig | 1 +
configs/sama5d4_xplained_nandflash_defconfig | 1 +
configs/sama5d4_xplained_spiflash_defconfig | 1 +
configs/sama5d4ek_mmc_defconfig | 1 +
configs/sama5d4ek_nandflash_defconfig | 1 +
configs/sama5d4ek_spiflash_defconfig | 1 +
configs/sandbox_spl_defconfig | 1 -
configs/sc_sps_1_defconfig | 1 +
configs/seaboard_defconfig | 1 +
configs/sh7752evb_defconfig | 1 +
configs/silk_defconfig | 1 +
configs/sksimx6_defconfig | 1 +
configs/smartweb_defconfig | 1 +
configs/smdk5250_defconfig | 1 +
configs/smdk5420_defconfig | 1 +
configs/smdkv310_defconfig | 1 +
configs/snow_defconfig | 1 +
configs/socfpga_arria10_defconfig | 1 -
configs/socfpga_arria5_defconfig | 1 +
configs/socfpga_cyclone5_defconfig | 1 +
configs/socfpga_dbm_soc1_defconfig | 1 +
configs/socfpga_de0_nano_soc_defconfig | 1 +
configs/socfpga_de10_nano_defconfig | 1 +
configs/socfpga_de1_soc_defconfig | 1 +
configs/socfpga_is1_defconfig | 1 +
configs/socfpga_mcvevk_defconfig | 1 +
configs/socfpga_sockit_defconfig | 1 +
configs/socfpga_socrates_defconfig | 1 +
configs/socfpga_sr1500_defconfig | 1 +
configs/socfpga_stratix10_defconfig | 1 +
configs/socfpga_vining_fpga_defconfig | 1 +
configs/sopine_baseboard_defconfig | 1 +
configs/spring_defconfig | 1 +
configs/stout_defconfig | 1 +
configs/sun8i_a23_evb_defconfig | 1 +
configs/sunxi_Gemei_G9_defconfig | 1 +
configs/tao3530_defconfig | 1 +
configs/taurus_defconfig | 1 +
configs/tbs_a711_defconfig | 1 +
configs/tec-ng_defconfig | 1 +
configs/tec_defconfig | 1 +
configs/teres_i_defconfig | 1 +
configs/theadorable_debug_defconfig | 1 +
configs/thuban_defconfig | 1 +
configs/ti816x_evm_defconfig | 1 +
configs/tinker-rk3288_defconfig | 2 ++
configs/tricorder_defconfig | 1 +
configs/trimslice_defconfig | 1 +
configs/ts4600_defconfig | 1 +
configs/turris_omnia_defconfig | 1 +
configs/udoo_defconfig | 1 +
configs/udoo_neo_defconfig | 1 -
configs/venice2_defconfig | 1 +
configs/ventana_defconfig | 1 +
configs/vyasa-rk3288_defconfig | 2 ++
configs/wandboard_defconfig | 1 +
configs/wb45n_defconfig | 1 +
configs/wb50n_defconfig | 1 +
configs/woodburn_sd_defconfig | 1 +
configs/work_92105_defconfig | 1 +
configs/x530_defconfig | 1 +
configs/x600_defconfig | 1 +
.../xilinx_zynqmp_zc1751_xm015_dc1_defconfig | 1 +
.../xilinx_zynqmp_zc1751_xm018_dc4_defconfig | 1 +
.../xilinx_zynqmp_zc1751_xm019_dc5_defconfig | 1 +
configs/xilinx_zynqmp_zcu102_rev1_0_defconfig | 1 +
configs/xilinx_zynqmp_zcu102_revA_defconfig | 1 +
configs/xilinx_zynqmp_zcu102_revB_defconfig | 1 +
configs/xilinx_zynqmp_zcu104_revA_defconfig | 1 +
configs/xilinx_zynqmp_zcu104_revC_defconfig | 1 +
configs/xilinx_zynqmp_zcu106_revA_defconfig | 1 +
configs/xilinx_zynqmp_zcu111_revA_defconfig | 1 +
configs/xpress_spl_defconfig | 1 +
configs/zc5202_defconfig | 1 +
configs/zc5601_defconfig | 1 +
configs/zynq_dlc20_rev1_0_defconfig | 1 +
configs/zynq_microzed_defconfig | 1 +
configs/zynq_minized_defconfig | 1 +
configs/zynq_zc702_defconfig | 1 +
configs/zynq_zc706_defconfig | 1 +
configs/zynq_zc770_xm010_defconfig | 1 +
configs/zynq_zc770_xm012_defconfig | 1 +
configs/zynq_zed_defconfig | 1 +
configs/zynq_zybo_defconfig | 1 +
configs/zynq_zybo_z7_defconfig | 1 +
drivers/input/input.c | 2 +-
drivers/mtd/nand/raw/Makefile | 4 +--
drivers/reset/reset-socfpga.c | 2 +-
env/Kconfig | 33 +++++++++++++++++--
env/Makefile | 11 +++----
env/common.c | 4 +--
include/configs/ls1021aiot.h | 1 -
include/configs/ls1046a_common.h | 1 -
include/configs/xilinx_zynqmp.h | 1 -
include/env.h | 23 +++++++++++++
include/env_callback.h | 4 +++
include/env_default.h | 4 +++
include/env_flags.h | 4 +++
586 files changed, 557 insertions(+), 207 deletions(-)
--
2.17.1
4
11
V3:
Added a new patch from Frieder:
imx: mkimage_fit_atf: Fix FIT image for correct boot order
Tag fixes for Frieder
Drop rom_pointer use in patch 27/27 and clean up included files.
4bytes-> 4 bytes in patch 2/27
V2:
Fixed comments from Lukasz and Frieder
The following was newly added.
imx8m: imx-regs: drop unused register definitions
imx8m: restrict reset_cpu
imx: mmc_env: update runtime SD/MMC boot env device
imx8m: soc: probe clock device in arch_cpu_init_dm
V1:
https://patchwork.ozlabs.org/cover/1144326/
This is a splitted and updated patch from
https://patchwork.ozlabs.org/cover/1128799/ which is to support both
i.MX8MM and i.MX8MN.
There is a README added, following that to test if you would like to.
Frieder Schrempf (1):
imx: mkimage_fit_atf: Fix FIT image for correct boot order
Peng Fan (25):
tools: imx8m_image: align spl bin image size
ddr: imx8m: fix ddr firmware location when enable SPL OF
imx8m: add image cfg for i.MX8MM lpddr4
imx: add IMX8MQ kconfig entry
imx: add IMX8MM kconfig entry
imx: imx8mm: add clock bindings header
imx: add i.MX8MM cpu type
imx: spl: add spl_board_boot_device for i.MX8MM
imx8m: imx-regs: drop unused register definitions
imx8m: update imx-regs for i.MX8MM
imx: add get_cpu_rev support for i.MX8MM
imx8m: add pin header for i.MX8MM
imx: add i.MX8MM PE property
imx8m: Fix MMU table issue for OPTEE memory
imx8m: set BYPASS ID SWAP to avoid AXI bus errors
imx8m: soc: enable SCTR clock before timer init
imx8m: restrict reset_cpu
imx8m: rename clock to clock_imx8mq
imx8m: restructure clock.h
imx8m: add clk support for i.MX8MM
imx: mmc_env: update runtime SD/MMC boot env device
imx8m: soc: probe clock device in arch_cpu_init_dm
arm: dts: import i.MX8MM dtsi
arm: dts: add i.MX8MM pin func
imx: Add i.MX8MM EVK board support.
Ye Li (1):
imx8m: Configure trustzone region 0 for non-secure access
arch/arm/dts/Makefile | 3 +-
arch/arm/dts/imx8mm-evk-u-boot.dtsi | 92 +
arch/arm/dts/imx8mm-evk.dts | 235 +++
arch/arm/dts/imx8mm-pinfunc.h | 629 +++++++
arch/arm/dts/imx8mm.dtsi | 733 ++++++++
arch/arm/include/asm/arch-imx/cpu.h | 6 +
arch/arm/include/asm/arch-imx8m/clock.h | 491 +----
arch/arm/include/asm/arch-imx8m/clock_imx8mm.h | 387 ++++
arch/arm/include/asm/arch-imx8m/clock_imx8mq.h | 424 +++++
arch/arm/include/asm/arch-imx8m/imx-regs.h | 291 +--
arch/arm/include/asm/arch-imx8m/imx8mm_pins.h | 691 +++++++
arch/arm/include/asm/mach-imx/iomux-v3.h | 4 +
arch/arm/include/asm/mach-imx/sys_proto.h | 8 +
arch/arm/mach-imx/cpu.c | 12 +
arch/arm/mach-imx/imx8m/Kconfig | 17 +-
arch/arm/mach-imx/imx8m/Makefile | 4 +-
arch/arm/mach-imx/imx8m/clock_imx8mm.c | 306 +++
.../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} | 5 +-
arch/arm/mach-imx/imx8m/clock_slice.c | 63 +
arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg | 16 +
arch/arm/mach-imx/imx8m/soc.c | 129 +-
arch/arm/mach-imx/mkimage_fit_atf.sh | 10 +-
arch/arm/mach-imx/mmc_env.c | 3 +
arch/arm/mach-imx/spl.c | 8 +
board/freescale/imx8mm_evk/Kconfig | 12 +
board/freescale/imx8mm_evk/MAINTAINERS | 6 +
board/freescale/imx8mm_evk/Makefile | 12 +
board/freescale/imx8mm_evk/README | 37 +
board/freescale/imx8mm_evk/imx8mm_evk.c | 29 +
board/freescale/imx8mm_evk/lpddr4_timing.c | 1980 ++++++++++++++++++++
board/freescale/imx8mm_evk/spl.c | 129 ++
configs/imx8mm_evk_defconfig | 74 +
drivers/ddr/imx/imx8m/helper.c | 12 +-
include/configs/imx8mm_evk.h | 153 ++
include/dt-bindings/clock/imx8mm-clock.h | 253 +++
tools/imx8m_image.sh | 5 +-
36 files changed, 6562 insertions(+), 707 deletions(-)
create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi
create mode 100644 arch/arm/dts/imx8mm-evk.dts
create mode 100644 arch/arm/dts/imx8mm-pinfunc.h
create mode 100644 arch/arm/dts/imx8mm.dtsi
create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h
create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c
rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (99%)
create mode 100644 arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
create mode 100644 board/freescale/imx8mm_evk/Kconfig
create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS
create mode 100644 board/freescale/imx8mm_evk/Makefile
create mode 100644 board/freescale/imx8mm_evk/README
create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c
create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c
create mode 100644 board/freescale/imx8mm_evk/spl.c
create mode 100644 configs/imx8mm_evk_defconfig
create mode 100644 include/configs/imx8mm_evk.h
create mode 100644 include/dt-bindings/clock/imx8mm-clock.h
--
2.16.4
5
40

29 Feb '20
It is likely that the DM conversion of EHCI iMX5 driver was a derivative
of EHCI VF, however the conversion is incomplete and is missing the bind
workaround, which updates dev->seq number. Without this, all controllers
have dev->seq number 0 . Add this bind workaround into EHCI iMX5 driver
as well.
Signed-off-by: Marek Vasut <marex(a)denx.de>
Cc: Abel Vesa <abel.vesa(a)nxp.com>
Cc: Adam Ford <aford173(a)gmail.com>
Cc: Fabio Estevam <festevam(a)gmail.com>
Cc: Ludwig Zenz <lzenz(a)dh-electronics.com>
Cc: Peng Fan <peng.fan(a)nxp.com>
Cc: Stefano Babic <sbabic(a)denx.de>
Cc: Vagrant Cascadian <vagrant(a)debian.org>
---
drivers/usb/host/ehci-mx5.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c
index 0b32728c57..4db513f4e5 100644
--- a/drivers/usb/host/ehci-mx5.c
+++ b/drivers/usb/host/ehci-mx5.c
@@ -301,6 +301,22 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
return 0;
}
+static int ehci_usb_bind(struct udevice *dev)
+{
+ static int num_controllers;
+
+ /*
+ * Without this hack, if we return ENODEV for USB Controller 0, on
+ * probe for the next controller, USB Controller 1 will be given a
+ * sequence number of 0. This conflicts with our requirement of
+ * sequence numbers while initialising the peripherals.
+ */
+ dev->req_seq = num_controllers;
+ num_controllers++;
+
+ return 0;
+}
+
static int ehci_usb_probe(struct udevice *dev)
{
struct usb_platdata *plat = dev_get_platdata(dev);
@@ -362,6 +378,7 @@ U_BOOT_DRIVER(usb_mx5) = {
.id = UCLASS_USB,
.of_match = mx5_usb_ids,
.ofdata_to_platdata = ehci_usb_ofdata_to_platdata,
+ .bind = ehci_usb_bind,
.probe = ehci_usb_probe,
.remove = ehci_deregister,
.ops = &ehci_usb_ops,
--
2.20.1
2
5
Hello u-booters!
I want to load u-boot-sunxi-with-spl.bin and make it operate the USB in otg mode.
(Where the host can still be connected to the board).
How can I achieve this?
(I have attempted to use: "usb0:dr_mode=otg,phy_type=utmi\0" without success).
Thank you,
Michael
5
11

[U-Boot] [PATCH 1/2] sunxi: fix support board-specific CONFIG_PREBOOT
by Jonas Smedegaard 27 Feb '20
by Jonas Smedegaard 27 Feb '20
27 Feb '20
commit 37304aaf60bf ("Convert CONFIG_USE_PREBOOT and CONFIG_PREBOOT to
Kconfig") intended to support CONFIG_PREBOOT, but
include/configs/sunxi-common.h hardcodes preboot as part of internally
defined CONSOLE_STDIN_SETTINGS, silently ignoring any board-specific
CONFIG_PREBOOT.
Tested-by: Jonas Smedegaard <dr(a)jones.dk>
Signed-off-by: Jonas Smedegaard <dr(a)jones.dk>
Series-Cc: Jagan Teki <jagan(a)amarulasolutions.com>
---
include/configs/sunxi-common.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index d7133a73fc..2069884b63 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -432,8 +432,13 @@ extern int soft_i2c_gpio_scl;
#include <config_distro_bootcmd.h>
#ifdef CONFIG_USB_KEYBOARD
+#ifdef CONFIG_USE_PREBOOT
+#ifndef CONFIG_PREBOOT
+#define CONFIG_PREBOOT \
+ "usb start"
+#endif
+#endif
#define CONSOLE_STDIN_SETTINGS \
- "preboot=usb start\0" \
"stdin=serial,usbkbd\0"
#else
#define CONSOLE_STDIN_SETTINGS \
--
2.23.0.rc1
2
6
Currently dozens of boards still do not use the driver model for the
network devices. This makes integration between devices in the UEFI
sub-system with the U-Boot devices complicated.
See: https://travis-ci.org/xypron2/u-boot/builds/569675547
In doc/driver-model/migration.rst I am missing a migration target day
for DM_ETH. Shouldn't define one? 2020-07 should be realistic.
Best regards
Heinrich
4
5
At present bootstage cannot be fully used on x86 since it violates a few
U-Boot rules, mostly accessing pre-relocation memory after relocation.
This series corrects this and adds better support for using bootstage in
TPL.
It also includes a few improvements to tiny-printf.
Changes in v2:
- Add a new patch to support %p without DEBUG
- Adjust SPL logic to avoid failing if TPL does not provide bootstage data
- Add a new patch to support %p without DEBUG in tiny-printf
Simon Glass (10):
tiny-printf: Reduce size by removing ctype
tiny-printf: Add print_grouped_ull()
tiny-printf: Reorder code to support %p
bloblist: Reserve an aligned base
bootstage: Store the next ID in the stash
bootstage: Fix counting of entries in stash
bootstage: Avoid conflicts between stash/unstash
bootstage: Correct relocation algorithm
bootstage: Mark the start/end of TPL and SPL separately
bootstage: Allow SPL to obtain bootstage info from TPL
common/board_f.c | 2 ++
common/board_r.c | 1 -
common/bootstage.c | 53 ++++++++++++++++++++++++++++++---------------
common/spl/spl.c | 23 ++++++++++++++++----
include/bootstage.h | 2 ++
lib/tiny-printf.c | 29 ++++++++++++++++++++-----
6 files changed, 81 insertions(+), 29 deletions(-)
--
2.23.0.866.gb869b98d4c-goog
6
29

[U-Boot] [PATCH 1/4 v4] watchdog: Implement generic watchdog_reset() version
by Stefan Roese 23 Feb '20
by Stefan Roese 23 Feb '20
23 Feb '20
This patch tries to implement a generic watchdog_reset() function that
can be used by all boards that want to service the watchdog device in
U-Boot. This watchdog servicing is enabled via CONFIG_WATCHDOG.
Without this approach, new boards or platforms needed to implement a
board specific version of this functionality, mostly copy'ing the same
code over and over again into their board or platforms code base.
With this new generic function, the scattered other functions are now
removed to be replaced by the generic one. The new version also enables
the configuration of the watchdog timeout via the DT "timeout-sec"
property (if enabled via CONFIG_OF_CONTROL).
This patch also adds a new flag to the GD flags, to flag that the
watchdog is ready to use and adds the pointer to the watchdog device
to the GD. This enables us to remove the global "watchdog_dev"
variable, which was prone to cause problems because of its potentially
very early use in watchdog_reset(), even before the BSS is cleared.
Signed-off-by: Stefan Roese <sr(a)denx.de>
Cc: Heiko Schocher <hs(a)denx.de>
Cc: Tom Rini <trini(a)konsulko.com>
Cc: Michal Simek <michal.simek(a)xilinx.com>
Cc: "Marek Behún" <marek.behun(a)nic.cz>
Cc: Daniel Schwierzeck <daniel.schwierzeck(a)gmail.com>
Cc: Maxim Sloyko <maxims(a)google.com>
Cc: Erik van Luijk <evanluijk(a)interact.nl>
Cc: Ryder Lee <ryder.lee(a)mediatek.com>
Cc: Weijie Gao <weijie.gao(a)mediatek.com>
Cc: Simon Glass <sjg(a)chromium.org>
Cc: "Álvaro Fernández Rojas" <noltari(a)gmail.com>
Cc: Philippe Reynes <philippe.reynes(a)softathome.com>
Cc: Christophe Leroy <christophe.leroy(a)c-s.fr>
---
This patch depends on the following patch:
[1] watchdog: Handle SPL build with watchdog disabled
https://patchwork.ozlabs.org/patch/1074098/
We have a few boards that have CONFIG_WDT (DM watchdog driver) enabled
and CONFIG_WATCHDOG (U-Boot watchdog servicing) disabled. This might
lead to a watchdog reboot, if the board does not boot fast enough into
some OS (like Linux) which services the watchdog. With this patch
now, the watchdog is started on all those boards (if found via the DT)
and also serviced as this patch also "implies" CONFIG_WATCHDOG. If
this is not desired, then please send a patch to disable
CONFIG_WATCHDOG for this board. Here the list of those boards with
their maintainers:
taurus: Heiko Schocher <hs(a)denx.de>
smartweb: Heiko Schocher <hs(a)denx.de>
ast2500: Maxim Sloyko <maxims(a)google.com>
picosam9g45: Erik van Luijk <evanluijk(a)interact.nl>
mt7623n_bpir2: Ryder Lee <ryder.lee(a)mediatek.com> Weijie Gao <weijie.gao(a)mediatek.com>
mt7629_rfb: Ryder Lee <ryder.lee(a)mediatek.com> Weijie Gao <weijie.gao(a)mediatek.com>
bitmain_antminer_s9: Michal Simek <monstr(a)monstr.eu>
sandbox64: Simon Glass <sjg(a)chromium.org>
sandbox: Simon Glass <sjg(a)chromium.org>
comtrend_ct5361_ram: "Álvaro Fernández Rojas" <noltari(a)gmail.com>
netgear_cg3100d_ram: "Álvaro Fernández Rojas" <noltari(a)gmail.com>
bcm968380gerg_ram: Philippe Reynes <philippe.reynes(a)softathome.com>
bcm963158_ram: Philippe Reynes <philippe.reynes(a)softathome.com>
bcm968580xref_ram: Philippe Reynes <philippe.reynes(a)softathome.com>
MCR3000: Christophe Leroy <christophe.leroy(a)c-s.fr>
Thanks,
Stefan
v4:
- No change
v3:
- Use already available CONFIG_WATCHDOG_TIMEOUT_MSECS option vs the
newly introduced WDT_DEFAULT_TIMEOUT default timeout value (if not
provided via DT property).
- Guard initr_watchdog by CONFIG_WDT instead of CONFIG_WATCHDOG &&
CONFIG_WDT as suggested by Michal. This makes it possible to enable
and start the U-Boot watchdog without enabling the U-Boot watchdog
servicing.
- Add imply CONFIG_WATCHDOG to CONFIG_WDT, as this restores the
current behaviour to use the U-Boot watchdog servicing feature, if
the DM watchdog is enabled (CONFIG_WDT). If this is not desired,
CONFIG_WATCHDOG can be disabled in the board defconfig.
- Remove CONFIG_WATCHDOG from include/configs/turris_omnia.h
v2:
- Rename watchdog_start() to initr_watchdog() and move it to board_r.c.
This way its only called once, after the DM subsystem has bound all
watchdog drivers. This enables the use of the currently implemented
logic of using the correct watchdog in U-Boot (via alias etc).
arch/mips/mach-mt7620/cpu.c | 36 ----------------
board/CZ.NIC/turris_mox/turris_mox.c | 30 --------------
board/CZ.NIC/turris_omnia/turris_omnia.c | 35 ----------------
.../microblaze-generic/microblaze-generic.c | 40 ------------------
board/xilinx/zynq/board.c | 39 ------------------
board/xilinx/zynqmp/zynqmp.c | 39 ------------------
common/board_r.c | 41 +++++++++++++++++++
drivers/watchdog/Kconfig | 1 +
drivers/watchdog/wdt-uclass.c | 26 ++++++++++++
include/asm-generic/global_data.h | 4 ++
include/configs/turris_omnia.h | 5 ---
11 files changed, 72 insertions(+), 224 deletions(-)
diff --git a/arch/mips/mach-mt7620/cpu.c b/arch/mips/mach-mt7620/cpu.c
index fe74f26a54..fcd0484a6d 100644
--- a/arch/mips/mach-mt7620/cpu.c
+++ b/arch/mips/mach-mt7620/cpu.c
@@ -69,28 +69,6 @@ int print_cpuinfo(void)
return 0;
}
-#ifdef CONFIG_WATCHDOG
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = get_timer(0);
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- next_reset = now + 1000; /* reset every 1000ms */
- wdt_reset(watchdog_dev);
- }
-}
-#endif
-
int arch_misc_init(void)
{
/*
@@ -103,19 +81,5 @@ int arch_misc_init(void)
flush_dcache_range(gd->bd->bi_memstart,
gd->bd->bi_memstart + gd->ram_size - 1);
-#ifdef CONFIG_WATCHDOG
- /* Init watchdog */
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 60000, 0); /* 60 seconds */
- printf("Watchdog: Started\n");
-#endif
-
return 0;
}
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 96cb9c7e5c..8a4872343b 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -119,41 +119,11 @@ int board_fix_fdt(void *blob)
}
#endif
-#ifdef CONFIG_WDT_ARMADA_37XX
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-
-void watchdog_reset(void)
-{
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 100000;
- }
-}
-#endif
-
int board_init(void)
{
/* address of boot parameters */
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
-#ifdef CONFIG_WDT_ARMADA_37XX
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- printf("Cannot find Armada 3720 watchdog!\n");
- } else {
- printf("Enabling Armada 3720 watchdog (3 minutes timeout).\n");
- wdt_start(watchdog_dev, 180000, 0);
- }
-#endif
-
return 0;
}
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index c7f6479a0c..8101cfd88a 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -364,25 +364,12 @@ static bool disable_mcu_watchdog(void)
}
#endif
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif
-
int board_init(void)
{
/* adress of boot parameters */
gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
#ifndef CONFIG_SPL_BUILD
-# ifdef CONFIG_WDT_ORION
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Cannot find Armada 385 watchdog!\n");
- } else {
- puts("Enabling Armada 385 watchdog.\n");
- wdt_start(watchdog_dev, (u32) 25000000 * 120, 0);
- }
-# endif
-
if (disable_mcu_watchdog())
puts("Disabled MCU startup watchdog.\n");
@@ -392,28 +379,6 @@ int board_init(void)
return 0;
}
-#ifdef CONFIG_WATCHDOG
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-# if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
- static ulong next_reset = 0;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-# endif
-}
-#endif
-
int board_late_init(void)
{
#ifndef CONFIG_SPL_BUILD
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 28c9efa3a2..ba82292e35 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -24,10 +24,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
-
ulong ram_base;
int dram_init_banksize(void)
@@ -43,44 +39,8 @@ int dram_init(void)
return 0;
};
-#ifdef CONFIG_WDT
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-#if !defined(CONFIG_SPL_BUILD)
- ulong now;
- static ulong next_reset;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-#endif /* !CONFIG_SPL_BUILD */
-}
-#endif /* CONFIG_WDT */
-
int board_late_init(void)
{
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
- watchdog_dev = NULL;
-
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 0, 0);
- puts("Watchdog: Started\n");
-#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYSRESET_MICROBLAZE)
int ret;
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index ea26aad16f..6857f2c0b8 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -18,10 +18,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif
-
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_BOARD_EARLY_INIT_F)
int board_early_init_f(void)
{
@@ -31,19 +27,6 @@ int board_early_init_f(void)
int board_init(void)
{
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 0, 0);
- puts("Watchdog: Started\n");
-# endif
-
return 0;
}
@@ -127,25 +110,3 @@ int dram_init(void)
return 0;
}
#endif
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-# if !defined(CONFIG_SPL_BUILD)
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-# endif
-}
-#endif
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index db27247850..1c12891b82 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -24,10 +24,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif
-
#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
!defined(CONFIG_SPL_BUILD)
static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC;
@@ -340,44 +336,9 @@ int board_init(void)
}
#endif
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 0, 0);
- puts("Watchdog: Started\n");
-#endif
-
return 0;
}
-#ifdef CONFIG_WATCHDOG
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-# if !defined(CONFIG_SPL_BUILD)
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-# endif
-}
-#endif
-
int board_early_init_r(void)
{
u32 val;
diff --git a/common/board_r.c b/common/board_r.c
index 472987d5d5..d457b6715f 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -48,6 +48,7 @@
#include <linux/compiler.h>
#include <linux/err.h>
#include <efi_loader.h>
+#include <wdt.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -621,6 +622,43 @@ static int initr_bedbug(void)
}
#endif
+#if defined(CONFIG_WDT)
+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000)
+#endif
+#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000)
+
+static int initr_watchdog(void)
+{
+ u32 timeout = WATCHDOG_TIMEOUT_SECS;
+
+ /*
+ * Init watchdog: This will call the probe function of the
+ * watchdog driver, enabling the use of the device
+ */
+ if (uclass_get_device_by_seq(UCLASS_WDT, 0,
+ (struct udevice **)&gd->watchdog_dev)) {
+ debug("WDT: Not found by seq!\n");
+ if (uclass_get_device(UCLASS_WDT, 0,
+ (struct udevice **)&gd->watchdog_dev)) {
+ printf("WDT: Not found!\n");
+ return 0;
+ }
+ }
+
+ if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+ timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
+ WATCHDOG_TIMEOUT_SECS);
+ }
+
+ wdt_start(gd->watchdog_dev, timeout * 1000, 0);
+ gd->flags |= GD_FLG_WDT_READY;
+ printf("WDT: Started (%ds timeout)\n", timeout);
+
+ return 0;
+}
+#endif
+
static int run_main_loop(void)
{
#ifdef CONFIG_SANDBOX
@@ -670,6 +708,9 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_DM
initr_dm,
#endif
+#if defined(CONFIG_WDT)
+ initr_watchdog,
+#endif
#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \
defined(CONFIG_SANDBOX)
board_init, /* Setup chipselects */
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 34e78beb2a..82080d3867 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -51,6 +51,7 @@ config ULP_WATCHDOG
config WDT
bool "Enable driver model for watchdog timer drivers"
depends on DM
+ imply WATCHDOG
help
Enable driver model for watchdog timer. At the moment the API
is very simple and only supports four operations:
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 23b7e3360d..bbfac4f0f9 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -10,6 +10,8 @@
#include <dm/device-internal.h>
#include <dm/lists.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
{
const struct wdt_ops *ops = device_get_ops(dev);
@@ -63,6 +65,30 @@ int wdt_expire_now(struct udevice *dev, ulong flags)
return ret;
}
+#if defined(CONFIG_WATCHDOG)
+/*
+ * Called by macro WATCHDOG_RESET. This function be called *very* early,
+ * so we need to make sure, that the watchdog driver is ready before using
+ * it in this function.
+ */
+void watchdog_reset(void)
+{
+ static ulong next_reset;
+ ulong now;
+
+ /* Exit if GD is not ready or watchdog is not initialized yet */
+ if (!gd || !(gd->flags & GD_FLG_WDT_READY))
+ return;
+
+ /* Do not reset the watchdog too often */
+ now = get_timer(0);
+ if (now > next_reset) {
+ next_reset = now + 1000; /* reset every 1000ms */
+ wdt_reset(gd->watchdog_dev);
+ }
+}
+#endif
+
static int wdt_post_bind(struct udevice *dev)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 78dcf40bff..d16f50f677 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -133,6 +133,9 @@ typedef struct global_data {
struct spl_handoff *spl_handoff;
# endif
#endif
+#if defined(CONFIG_WDT)
+ struct udevice *watchdog_dev;
+#endif
} gd_t;
#endif
@@ -161,5 +164,6 @@ typedef struct global_data {
#define GD_FLG_ENV_DEFAULT 0x02000 /* Default variable flag */
#define GD_FLG_SPL_EARLY_INIT 0x04000 /* Early SPL init is done */
#define GD_FLG_LOG_READY 0x08000 /* Log system is ready for use */
+#define GD_FLG_WDT_READY 0x10000 /* Watchdog is ready for use */
#endif /* __ASM_GENERIC_GBL_DATA_H */
diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h
index 038f6398eb..78e3cf2ff4 100644
--- a/include/configs/turris_omnia.h
+++ b/include/configs/turris_omnia.h
@@ -29,11 +29,6 @@
#define CONFIG_SPL_I2C_MUX
#define CONFIG_SYS_I2C_MVTWSI
-/* Watchdog support */
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
-# define CONFIG_WATCHDOG
-#endif
-
/* SPI NOR flash default params, used by sf commands */
#define CONFIG_SPI_FLASH_SPANSION
--
2.21.0
3
9

[U-Boot] [PATCH 1/4 v5] watchdog: Implement generic watchdog_reset() version
by Stefan Roese 20 Feb '20
by Stefan Roese 20 Feb '20
20 Feb '20
This patch tries to implement a generic watchdog_reset() function that
can be used by all boards that want to service the watchdog device in
U-Boot. This watchdog servicing is enabled via CONFIG_WATCHDOG.
Without this approach, new boards or platforms needed to implement a
board specific version of this functionality, mostly copy'ing the same
code over and over again into their board or platforms code base.
With this new generic function, the scattered other functions are now
removed to be replaced by the generic one. The new version also enables
the configuration of the watchdog timeout via the DT "timeout-sec"
property (if enabled via CONFIG_OF_CONTROL).
This patch also adds a new flag to the GD flags, to flag that the
watchdog is ready to use and adds the pointer to the watchdog device
to the GD. This enables us to remove the global "watchdog_dev"
variable, which was prone to cause problems because of its potentially
very early use in watchdog_reset(), even before the BSS is cleared.
Signed-off-by: Stefan Roese <sr(a)denx.de>
Cc: Heiko Schocher <hs(a)denx.de>
Cc: Tom Rini <trini(a)konsulko.com>
Cc: Michal Simek <michal.simek(a)xilinx.com>
Cc: "Marek Behún" <marek.behun(a)nic.cz>
Cc: Daniel Schwierzeck <daniel.schwierzeck(a)gmail.com>
Cc: Maxim Sloyko <maxims(a)google.com>
Cc: Erik van Luijk <evanluijk(a)interact.nl>
Cc: Ryder Lee <ryder.lee(a)mediatek.com>
Cc: Weijie Gao <weijie.gao(a)mediatek.com>
Cc: Simon Glass <sjg(a)chromium.org>
Cc: "Álvaro Fernández Rojas" <noltari(a)gmail.com>
Cc: Philippe Reynes <philippe.reynes(a)softathome.com>
Cc: Christophe Leroy <christophe.leroy(a)c-s.fr>
Cc: Chris Packham <chris.packham(a)alliedtelesis.co.nz>
Reviewed-by: Michal Simek <michal.simek(a)xilinx.com>
Tested-by: Michal Simek <michal.simek(a)xilinx.com> (on zcu100)
---
We have a few boards that have CONFIG_WDT (DM watchdog driver) enabled
and CONFIG_WATCHDOG (U-Boot watchdog servicing) disabled. This might
lead to a watchdog reboot, if the board does not boot fast enough into
some OS (like Linux) which services the watchdog. With this patch
now, the watchdog is started on all those boards (if found via the DT)
and also serviced as this patch also "implies" CONFIG_WATCHDOG. If
this is not desired, then please send a patch to disable
CONFIG_WATCHDOG for this board. Here the list of those boards with
their maintainers:
taurus: Heiko Schocher <hs(a)denx.de>
smartweb: Heiko Schocher <hs(a)denx.de>
ast2500: Maxim Sloyko <maxims(a)google.com>
picosam9g45: Erik van Luijk <evanluijk(a)interact.nl>
mt7623n_bpir2: Ryder Lee <ryder.lee(a)mediatek.com> Weijie Gao <weijie.gao(a)mediatek.com>
mt7629_rfb: Ryder Lee <ryder.lee(a)mediatek.com> Weijie Gao <weijie.gao(a)mediatek.com>
bitmain_antminer_s9: Michal Simek <monstr(a)monstr.eu>
sandbox64: Simon Glass <sjg(a)chromium.org>
sandbox: Simon Glass <sjg(a)chromium.org>
comtrend_ct5361_ram: "Álvaro Fernández Rojas" <noltari(a)gmail.com>
netgear_cg3100d_ram: "Álvaro Fernández Rojas" <noltari(a)gmail.com>
bcm968380gerg_ram: Philippe Reynes <philippe.reynes(a)softathome.com>
bcm963158_ram: Philippe Reynes <philippe.reynes(a)softathome.com>
bcm968580xref_ram: Philippe Reynes <philippe.reynes(a)softathome.com>
MCR3000: Christophe Leroy <christophe.leroy(a)c-s.fr>
Thanks,
Stefan
v5:
- Remove board specific x530 watchdog support and implement this in
this generic apprioach as well. For this, we need to support the
watchdog in SPL now. Move the watchdog init function initr_watchdog()
into wdt.h to not duplicate this code.
v4:
- No change
v3:
- Use already available CONFIG_WATCHDOG_TIMEOUT_MSECS option vs the
newly introduced WDT_DEFAULT_TIMEOUT default timeout value (if not
provided via DT property).
- Guard initr_watchdog by CONFIG_WDT instead of CONFIG_WATCHDOG &&
CONFIG_WDT as suggested by Michal. This makes it possible to enable
and start the U-Boot watchdog without enabling the U-Boot watchdog
servicing.
- Add imply CONFIG_WATCHDOG to CONFIG_WDT, as this restores the
current behaviour to use the U-Boot watchdog servicing feature, if
the DM watchdog is enabled (CONFIG_WDT). If this is not desired,
CONFIG_WATCHDOG can be disabled in the board defconfig.
- Remove CONFIG_WATCHDOG from include/configs/turris_omnia.h
v2:
- Rename watchdog_start() to initr_watchdog() and move it to board_r.c.
This way its only called once, after the DM subsystem has bound all
watchdog drivers. This enables the use of the currently implemented
logic of using the correct watchdog in U-Boot (via alias etc).
arch/mips/mach-mt7620/cpu.c | 36 ----------------
board/CZ.NIC/turris_mox/turris_mox.c | 30 --------------
board/CZ.NIC/turris_omnia/turris_omnia.c | 35 ----------------
board/alliedtelesis/x530/x530.c | 36 +---------------
.../microblaze-generic/microblaze-generic.c | 40 ------------------
board/xilinx/zynq/board.c | 39 ------------------
board/xilinx/zynqmp/zynqmp.c | 39 ------------------
common/board_r.c | 4 ++
common/spl/spl.c | 5 +++
drivers/watchdog/Kconfig | 1 +
drivers/watchdog/wdt-uclass.c | 26 ++++++++++++
include/asm-generic/global_data.h | 4 ++
include/configs/turris_omnia.h | 5 ---
include/wdt.h | 41 +++++++++++++++++++
14 files changed, 82 insertions(+), 259 deletions(-)
diff --git a/arch/mips/mach-mt7620/cpu.c b/arch/mips/mach-mt7620/cpu.c
index fe74f26a54..fcd0484a6d 100644
--- a/arch/mips/mach-mt7620/cpu.c
+++ b/arch/mips/mach-mt7620/cpu.c
@@ -69,28 +69,6 @@ int print_cpuinfo(void)
return 0;
}
-#ifdef CONFIG_WATCHDOG
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = get_timer(0);
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- next_reset = now + 1000; /* reset every 1000ms */
- wdt_reset(watchdog_dev);
- }
-}
-#endif
-
int arch_misc_init(void)
{
/*
@@ -103,19 +81,5 @@ int arch_misc_init(void)
flush_dcache_range(gd->bd->bi_memstart,
gd->bd->bi_memstart + gd->ram_size - 1);
-#ifdef CONFIG_WATCHDOG
- /* Init watchdog */
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 60000, 0); /* 60 seconds */
- printf("Watchdog: Started\n");
-#endif
-
return 0;
}
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 96cb9c7e5c..8a4872343b 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -119,41 +119,11 @@ int board_fix_fdt(void *blob)
}
#endif
-#ifdef CONFIG_WDT_ARMADA_37XX
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-
-void watchdog_reset(void)
-{
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 100000;
- }
-}
-#endif
-
int board_init(void)
{
/* address of boot parameters */
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
-#ifdef CONFIG_WDT_ARMADA_37XX
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- printf("Cannot find Armada 3720 watchdog!\n");
- } else {
- printf("Enabling Armada 3720 watchdog (3 minutes timeout).\n");
- wdt_start(watchdog_dev, 180000, 0);
- }
-#endif
-
return 0;
}
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 0287f23283..4c08f810a2 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -364,25 +364,12 @@ static bool disable_mcu_watchdog(void)
}
#endif
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif
-
int board_init(void)
{
/* adress of boot parameters */
gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
#ifndef CONFIG_SPL_BUILD
-# ifdef CONFIG_WDT_ORION
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Cannot find Armada 385 watchdog!\n");
- } else {
- puts("Enabling Armada 385 watchdog.\n");
- wdt_start(watchdog_dev, 120000, 0);
- }
-# endif
-
if (disable_mcu_watchdog())
puts("Disabled MCU startup watchdog.\n");
@@ -392,28 +379,6 @@ int board_init(void)
return 0;
}
-#ifdef CONFIG_WATCHDOG
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-# if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
- static ulong next_reset = 0;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-# endif
-}
-#endif
-
int board_late_init(void)
{
#ifndef CONFIG_SPL_BUILD
diff --git a/board/alliedtelesis/x530/x530.c b/board/alliedtelesis/x530/x530.c
index 6934fd8017..97dbed79dd 100644
--- a/board/alliedtelesis/x530/x530.c
+++ b/board/alliedtelesis/x530/x530.c
@@ -25,10 +25,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define CONFIG_NVS_LOCATION 0xf4800000
#define CONFIG_NVS_SIZE (512 << 10)
-#ifdef CONFIG_WATCHDOG
-static struct udevice *watchdog_dev;
-#endif
-
static struct serdes_map board_serdes_map[] = {
{PEX0, SERDES_SPEED_5_GBPS, PEX_ROOT_COMPLEX_X1, 0, 0},
{DEFAULT_SERDES, SERDES_SPEED_5_GBPS, SERDES_DEFAULT_MODE, 0, 0},
@@ -80,10 +76,6 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void)
int board_early_init_f(void)
{
-#ifdef CONFIG_WATCHDOG
- watchdog_dev = NULL;
-#endif
-
/* Configure MPP */
writel(0x00001111, MVEBU_MPP_BASE + 0x00);
writel(0x00000000, MVEBU_MPP_BASE + 0x04);
@@ -99,13 +91,6 @@ int board_early_init_f(void)
void spl_board_init(void)
{
-#ifdef CONFIG_WATCHDOG
- int ret;
-
- ret = uclass_get_device(UCLASS_WDT, 0, &watchdog_dev);
- if (!ret)
- wdt_start(watchdog_dev, 120000, 0);
-#endif
}
int board_init(void)
@@ -128,29 +113,10 @@ int board_init(void)
void arch_preboot_os(void)
{
#ifdef CONFIG_WATCHDOG
- wdt_stop(watchdog_dev);
+ wdt_stop(gd->watchdog_dev);
#endif
}
-#ifdef CONFIG_WATCHDOG
-void watchdog_reset(void)
-{
- static ulong next_reset = 0;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-}
-#endif
-
static int led_7seg_init(unsigned int segments)
{
int node;
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 28c9efa3a2..ba82292e35 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -24,10 +24,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
-
ulong ram_base;
int dram_init_banksize(void)
@@ -43,44 +39,8 @@ int dram_init(void)
return 0;
};
-#ifdef CONFIG_WDT
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-#if !defined(CONFIG_SPL_BUILD)
- ulong now;
- static ulong next_reset;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-#endif /* !CONFIG_SPL_BUILD */
-}
-#endif /* CONFIG_WDT */
-
int board_late_init(void)
{
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
- watchdog_dev = NULL;
-
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 0, 0);
- puts("Watchdog: Started\n");
-#endif /* !CONFIG_SPL_BUILD && CONFIG_WDT */
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYSRESET_MICROBLAZE)
int ret;
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index ea26aad16f..6857f2c0b8 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -18,10 +18,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif
-
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_BOARD_EARLY_INIT_F)
int board_early_init_f(void)
{
@@ -31,19 +27,6 @@ int board_early_init_f(void)
int board_init(void)
{
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 0, 0);
- puts("Watchdog: Started\n");
-# endif
-
return 0;
}
@@ -127,25 +110,3 @@ int dram_init(void)
return 0;
}
#endif
-
-#if defined(CONFIG_WATCHDOG)
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-# if !defined(CONFIG_SPL_BUILD)
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-# endif
-}
-#endif
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 5189925beb..c840e92d9c 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -24,10 +24,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-#endif
-
#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
!defined(CONFIG_SPL_BUILD)
static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC;
@@ -344,44 +340,9 @@ int board_init(void)
}
#endif
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT)
- if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
- debug("Watchdog: Not found by seq!\n");
- if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
- puts("Watchdog: Not found!\n");
- return 0;
- }
- }
-
- wdt_start(watchdog_dev, 0, 0);
- puts("Watchdog: Started\n");
-#endif
-
return 0;
}
-#ifdef CONFIG_WATCHDOG
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-# if !defined(CONFIG_SPL_BUILD)
- static ulong next_reset;
- ulong now;
-
- if (!watchdog_dev)
- return;
-
- now = timer_get_us();
-
- /* Do not reset the watchdog too often */
- if (now > next_reset) {
- wdt_reset(watchdog_dev);
- next_reset = now + 1000;
- }
-# endif
-}
-#endif
-
int board_early_init_r(void)
{
u32 val;
diff --git a/common/board_r.c b/common/board_r.c
index 1ad44bbe3f..150e8cd424 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -48,6 +48,7 @@
#include <linux/compiler.h>
#include <linux/err.h>
#include <efi_loader.h>
+#include <wdt.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -677,6 +678,9 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_DM
initr_dm,
#endif
+#if defined(CONFIG_WDT)
+ initr_watchdog,
+#endif
#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \
defined(CONFIG_SANDBOX)
board_init, /* Setup chipselects */
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 88d4b8a9bf..0a6a47c202 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -22,6 +22,7 @@
#include <linux/compiler.h>
#include <fdt_support.h>
#include <bootcount.h>
+#include <wdt.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -600,6 +601,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_board_init();
#endif
+#if defined(CONFIG_SPL_WATCHDOG_SUPPORT) && defined(CONFIG_WDT)
+ initr_watchdog();
+#endif
+
if (IS_ENABLED(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF))
dram_init_banksize();
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 9d7f503b69..aa8e725573 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -51,6 +51,7 @@ config ULP_WATCHDOG
config WDT
bool "Enable driver model for watchdog timer drivers"
depends on DM
+ imply WATCHDOG
help
Enable driver model for watchdog timer. At the moment the API
is very simple and only supports four operations:
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 23b7e3360d..bbfac4f0f9 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -10,6 +10,8 @@
#include <dm/device-internal.h>
#include <dm/lists.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
{
const struct wdt_ops *ops = device_get_ops(dev);
@@ -63,6 +65,30 @@ int wdt_expire_now(struct udevice *dev, ulong flags)
return ret;
}
+#if defined(CONFIG_WATCHDOG)
+/*
+ * Called by macro WATCHDOG_RESET. This function be called *very* early,
+ * so we need to make sure, that the watchdog driver is ready before using
+ * it in this function.
+ */
+void watchdog_reset(void)
+{
+ static ulong next_reset;
+ ulong now;
+
+ /* Exit if GD is not ready or watchdog is not initialized yet */
+ if (!gd || !(gd->flags & GD_FLG_WDT_READY))
+ return;
+
+ /* Do not reset the watchdog too often */
+ now = get_timer(0);
+ if (now > next_reset) {
+ next_reset = now + 1000; /* reset every 1000ms */
+ wdt_reset(gd->watchdog_dev);
+ }
+}
+#endif
+
static int wdt_post_bind(struct udevice *dev)
{
#if defined(CONFIG_NEEDS_MANUAL_RELOC)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 78dcf40bff..d16f50f677 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -133,6 +133,9 @@ typedef struct global_data {
struct spl_handoff *spl_handoff;
# endif
#endif
+#if defined(CONFIG_WDT)
+ struct udevice *watchdog_dev;
+#endif
} gd_t;
#endif
@@ -161,5 +164,6 @@ typedef struct global_data {
#define GD_FLG_ENV_DEFAULT 0x02000 /* Default variable flag */
#define GD_FLG_SPL_EARLY_INIT 0x04000 /* Early SPL init is done */
#define GD_FLG_LOG_READY 0x08000 /* Log system is ready for use */
+#define GD_FLG_WDT_READY 0x10000 /* Watchdog is ready for use */
#endif /* __ASM_GENERIC_GBL_DATA_H */
diff --git a/include/configs/turris_omnia.h b/include/configs/turris_omnia.h
index c7805cf36b..0e65a12345 100644
--- a/include/configs/turris_omnia.h
+++ b/include/configs/turris_omnia.h
@@ -29,11 +29,6 @@
#define CONFIG_SPL_I2C_MUX
#define CONFIG_SYS_I2C_MVTWSI
-/* Watchdog support */
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_WDT_ORION)
-# define CONFIG_WATCHDOG
-#endif
-
/*
* SDIO/MMC Card Configuration
*/
diff --git a/include/wdt.h b/include/wdt.h
index e9a7c5355a..aa77d3e9b4 100644
--- a/include/wdt.h
+++ b/include/wdt.h
@@ -6,6 +6,9 @@
#ifndef _WDT_H_
#define _WDT_H_
+#include <dm.h>
+#include <dm/read.h>
+
/*
* Implement a simple watchdog uclass. Watchdog is basically a timer that
* is used to detect or recover from malfunction. During normal operation
@@ -103,4 +106,42 @@ struct wdt_ops {
int (*expire_now)(struct udevice *dev, ulong flags);
};
+#if defined(CONFIG_WDT)
+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000)
+#endif
+#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000)
+
+static inline int initr_watchdog(void)
+{
+ u32 timeout = WATCHDOG_TIMEOUT_SECS;
+
+ /*
+ * Init watchdog: This will call the probe function of the
+ * watchdog driver, enabling the use of the device
+ */
+ if (uclass_get_device_by_seq(UCLASS_WDT, 0,
+ (struct udevice **)&gd->watchdog_dev)) {
+ debug("WDT: Not found by seq!\n");
+ if (uclass_get_device(UCLASS_WDT, 0,
+ (struct udevice **)&gd->watchdog_dev)) {
+ printf("WDT: Not found!\n");
+ return 0;
+ }
+ }
+
+ if (CONFIG_IS_ENABLED(OF_CONTROL)) {
+ timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
+ WATCHDOG_TIMEOUT_SECS);
+ }
+
+ wdt_start(gd->watchdog_dev, timeout * 1000, 0);
+ gd->flags |= GD_FLG_WDT_READY;
+ printf("WDT: Started with%s servicing (%ds timeout)\n",
+ IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout);
+
+ return 0;
+}
+#endif
+
#endif /* _WDT_H_ */
--
2.21.0
6
23

[U-Boot] [RFC] cmd: add bootslot command to select/boot slot based on boot counts
by Martin Hundebøll 16 Feb '20
by Martin Hundebøll 16 Feb '20
16 Feb '20
The existing bootcount feature is targeted systems with a primary, and a
rescue boot setup, where the number of boot tries to the primary boot is
tracked. If the number exceeds the limit, the alternative/rescue is
booted.
This patch adds support for a more sophisticated setup, where more than
two boot slots can exist, and the order of slots can be configured.
The 'bootcommand' command reads the configured slots (and their
priority/order) from a configured environment variable ("bootslots" by
default). For each conifgured slot, a remaining boot count is maintained
in an evnironment variable ("bootcount_<slot>" by default). If the first
boot slot has positive boot count, it is booted using the slot specific
boot command ("bootcmd_<slot>" by default). Otherwise the next slot is
checked.
An example environment when using the bootslot command with two slots
("a" and "b"):
bootslots=a b
bootcount_a=3
bootcount_b=3
bootcmd_a=setenv bootargs $bootargs root=/dev/mmcblk0p1; booti $loadaddr
bootcmd_b=setenv bootargs $bootargs root=/dev/mmcblk0p2; booti $loadaddr
Once linux is booted, it resets the bootcount variable for the booted
slot using "fw_setenv":
> fw_setenv bootcount_a 3
When the non-booted slot is updated, the order is updated by setting the
bootslots variable with "fw_setenv":
> fw_setenv bootslots=b a
Signed-off-by: Martin Hundebøll <martin(a)geanix.com>
---
cmd/Kconfig | 42 +++++++++
cmd/Makefile | 1 +
cmd/bootslot.c | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 268 insertions(+)
create mode 100644 cmd/bootslot.c
diff --git a/cmd/Kconfig b/cmd/Kconfig
index aec209006d..3919606e74 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1277,6 +1277,48 @@ config CMD_BOOTCOUNT
Enable the bootcount command, which allows interrogation and
reset of the bootcounter.
+config CMD_BOOTSLOT
+ bool "Enable support for multiple boot slots"
+ help
+ Parses an ordered list of configured boot slot names (e.g. "a b")
+ and selects a corresponding boot command based on the current
+ boot counter for each slot.
+
+config CMD_BOOTSLOT_ENV_SLOTS
+ string "Environment variable to read bootslots from"
+ depends on CMD_BOOTSLOT
+ default "bootslots"
+ help
+ Configures the environment variable to read out when looking for a
+ list of available boot sloots.
+
+config CMD_BOOTSLOT_ENV_COUNT
+ string "Environment variable format string to read/write slot boot count from/to"
+ depends on CMD_BOOTSLOT
+ default "bootcount_%s"
+ help
+ Configures the prefix to use when reading the boot count for a
+ specific slot. The prefix is concatenated with the slot name, so
+ that the boot count for slot "a" is read and saved to "<prefix>a".
+
+config CMD_BOOTSLOT_ENV_CMD
+ string "Environment variable format string to read slot boot command from"
+ depends on CMD_BOOTSLOT
+ default "bootcmd_%s"
+ help
+ Configures the prefix to use when reading the boot command for
+ specific slot. The prefix is concatenated with the slot name, so
+ that the boot command for slot "a" is read from "<prefix>a".
+
+config CMD_BOOTSLOT_DEFAULT_COUNT
+ int "Default boot count for each configured slot"
+ depends on CMD_BOOTSLOT
+ default 3
+ help
+ The default number of times a slot is tried before proceeding to the
+ slot. The default is used when a slot has no count yet, or when it
+ is reset with the "bootslot reset" command.
+
config CMD_BSP
bool "Enable board-specific commands"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 323f1fd2c7..68c8e50c91 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_CMD_BOOTCOUNT) += bootcount.o
obj-$(CONFIG_CMD_BOOTEFI) += bootefi.o
obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o
obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o
+obj-$(CONFIG_CMD_BOOTSLOT) += bootslot.o
obj-$(CONFIG_CMD_BOOTZ) += bootz.o
obj-$(CONFIG_CMD_BOOTI) += booti.o
obj-$(CONFIG_CMD_BTRFS) += btrfs.o
diff --git a/cmd/bootslot.c b/cmd/bootslot.c
new file mode 100644
index 0000000000..03897b1f60
--- /dev/null
+++ b/cmd/bootslot.c
@@ -0,0 +1,225 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2018, Geanix, All rights reserved.
+ */
+
+#include <common.h>
+#include <environment.h>
+#include <stdlib.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/compat.h>
+#include <vsprintf.h>
+
+static char *bootslot_envname(const char *fmt, const char *slot)
+{
+ int len = strlen(fmt) + strlen(slot);
+ char *envname = malloc(len + 1);
+
+ sprintf(envname, fmt, slot);
+
+ return envname;
+}
+
+static unsigned long bootslot_get_count(const char *slot)
+{
+ char *envname;
+ unsigned long count;
+
+ envname = bootslot_envname(CONFIG_CMD_BOOTSLOT_ENV_COUNT, slot);
+ count = env_get_ulong(envname, 10, CONFIG_CMD_BOOTSLOT_DEFAULT_COUNT);
+ free(envname);
+
+ return count;
+}
+
+static void bootslot_set_count(const char *slot, unsigned long count)
+{
+ char *envname;
+
+ envname = bootslot_envname(CONFIG_CMD_BOOTSLOT_ENV_COUNT, slot);
+ env_set_ulong(envname, count);
+ free(envname);
+}
+
+static const char *bootslot_get_cmd(const char *slot)
+{
+ char *envname;
+ char *cmd;
+
+ envname = bootslot_envname(CONFIG_CMD_BOOTSLOT_ENV_CMD, slot);
+ cmd = env_get(envname);
+ free(envname);
+
+ return cmd;
+}
+
+static char *bootslot_get_slots(int argc, char * const argv[])
+{
+ char *slots = NULL;
+ int len = 1; /* make room for terminating \0 */
+ int i;
+
+ /* read boot slots from environment if no args are given, or
+ * duplicate the argument if a single argument is given */
+ if (argc == 1)
+ return strdup(env_get(CONFIG_CMD_BOOTSLOT_ENV_SLOTS));
+ else if (argc == 2)
+ return strdup(argv[1]);
+
+ /* compute the string length of the list of slots */
+ for (i = 1; i < argc; i++)
+ len += strlen(argv[i]) + 1; /* add room for space separator */
+
+ /* allocate the string buffer and copy each slot argument to it */
+ slots = kzalloc(len, 0);
+ strcpy(slots, argv[1]);
+
+ for (i = 2; i < argc; i++) {
+ strcat(slots, " ");
+ strcat(slots, argv[i]);
+ }
+
+ return slots;
+}
+
+static int do_bootslot_list(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ char *mem = bootslot_get_slots(argc, argv);
+ char *slots = mem;
+ char *slot;
+
+ if (slots == NULL)
+ return CMD_RET_USAGE;
+
+ printf("slot\tcount\tbootcmd\n");
+ while ((slot = strsep(&slots, " ")) != NULL) {
+ unsigned long count;
+ const char *bootcmd;
+
+ if (strlen(slot) == 0)
+ continue;
+
+ count = bootslot_get_count(slot);
+ bootcmd = bootslot_get_cmd(slot);
+
+ if (bootcmd)
+ printf("%s\t%lu\t%s\n", slot, count, bootcmd);
+ else
+ printf("%s\t%lu\t<not defined>\n", slot, count);
+ }
+
+ free(mem);
+
+ return CMD_RET_SUCCESS;
+}
+
+static int do_bootslot_reset(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ char *mem = bootslot_get_slots(argc, argv);
+ char *slots = mem;
+ char *slot;
+
+ if (slots == NULL)
+ return CMD_RET_USAGE;
+
+ while ((slot = strsep(&slots, " ")) != NULL) {
+ if (strlen(slot) == 0)
+ continue;
+ bootslot_set_count(slot, CONFIG_CMD_BOOTSLOT_DEFAULT_COUNT);
+ }
+
+ free(mem);
+
+ return CMD_RET_SUCCESS;
+}
+
+static int do_bootslot_boot(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ char *mem = bootslot_get_slots(argc, argv);
+ char *slots = mem;
+ char *slot;
+ bool found_valid = false;
+
+ if (slots == NULL)
+ return CMD_RET_USAGE;
+
+ while ((slot = strsep(&slots, " ")) != NULL) {
+ const char *bootcmd;
+ unsigned long count;
+
+ if (strlen(slot) == 0)
+ continue;
+
+ count = bootslot_get_count(slot);
+ if (count == 0) {
+ printf("slot %s bootcount is zero; trying next...\n",
+ slot);
+ continue;
+ }
+
+ bootcmd = bootslot_get_cmd(slot);
+ if (bootcmd == NULL) {
+ printf("slot %s bootcmd not found; trying next...\n",
+ slot);
+ continue;
+ }
+
+ printf("slot %s has %lu boot tries remaining; booting...\n",
+ slot, count);
+ found_valid = true;
+ bootslot_set_count(slot, --count);
+ env_save();
+ run_command_list(bootcmd, -1, CMD_FLAG_ENV);
+ break;
+ }
+
+ free(mem);
+
+ if (found_valid == false) {
+ printf("no valid bootslot found; resetting counters\n");
+ run_command("bootslot reset", 0);
+ return CMD_RET_FAILURE;
+ }
+
+ return CMD_RET_SUCCESS;
+}
+
+static cmd_tbl_t cmd_bootslot_sub[] = {
+ U_BOOT_CMD_MKENT(boot, INT_MAX, 0, do_bootslot_boot, "", ""),
+ U_BOOT_CMD_MKENT(list, INT_MAX, 1, do_bootslot_list, "", ""),
+ U_BOOT_CMD_MKENT(reset, INT_MAX, 1, do_bootslot_reset, "", ""),
+};
+
+/*
+ * Process a bootslots sub-command
+ */
+static int do_bootslot(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ cmd_tbl_t *c;
+
+ /* Strip off leading 'bootslot' command argument */
+ argc--;
+ argv++;
+
+ c = find_cmd_tbl(argv[0], cmd_bootslot_sub,
+ ARRAY_SIZE(cmd_bootslot_sub));
+
+ if (c)
+ return c->cmd(cmdtp, flag, argc, argv);
+ else
+ return CMD_RET_USAGE;
+}
+
+
+U_BOOT_CMD(bootslot, INT_MAX, 1, do_bootslot,
+ "Bootslot command",
+ " - select and boot slot based on counters\n"
+ "boot [<slot>] - Boot the passed or first valid slot in $bootslots\n"
+ "list [<slot>] - List remaining boot tries for passed or all slots in $bootslots\n"
+ "reset [<slot>] - Reset remaining boot tries for all or passed slot\n"
+);
--
2.18.0
4
5