* [PATCH u-boot-mvebu v2 0/4] turris_omnia: Disable MCU watchdog in SPL when booting over UART @ 2021-08-16 13:19 Marek Behún 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún ` (3 more replies) 0 siblings, 4 replies; 17+ messages in thread From: Marek Behún @ 2021-08-16 13:19 UTC (permalink / raw) To: Stefan Roese; +Cc: u-boot, pali, Marek Behún Hello Stefan, while debugging Omnia, when sending U-Boot over UART, some USB-TTY controllers are too slow and Omnia's MCU watchdog resets the board before U-Boot proper is sent. This patch series changes Omnia board code so that when booting via UART, we disable MCU watchdog in SPL, prior loading U-Boot proper. Changes since v1: - added patch that moves disabling MCU watchdog in normal boot from board_init() to board_late_init(), so that it is disabled after U-Boot enables the SOC watchdog Marek Marek Behún (4): arm: mvebu: Move get_boot_device() to cpu.c and make visible arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() arch/arm/mach-mvebu/cpu.c | 60 ++++++++++++++++++ arch/arm/mach-mvebu/include/mach/cpu.h | 2 + arch/arm/mach-mvebu/spl.c | 77 +++--------------------- board/CZ.NIC/turris_omnia/turris_omnia.c | 27 ++++++--- configs/turris_omnia_defconfig | 1 + 5 files changed, 89 insertions(+), 78 deletions(-) -- 2.31.1 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible 2021-08-16 13:19 [PATCH u-boot-mvebu v2 0/4] turris_omnia: Disable MCU watchdog in SPL when booting over UART Marek Behún @ 2021-08-16 13:19 ` Marek Behún 2021-08-16 17:51 ` Pali Rohár ` (2 more replies) 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro Marek Behún ` (2 subsequent siblings) 3 siblings, 3 replies; 17+ messages in thread From: Marek Behún @ 2021-08-16 13:19 UTC (permalink / raw) To: Stefan Roese; +Cc: u-boot, pali, Marek Behún Move the function get_boot_device() from spl.c to cpu.c. Make it visible, so that it may be used from other files. Signed-off-by: Marek Behún <marek.behun@nic.cz> --- arch/arm/mach-mvebu/cpu.c | 60 ++++++++++++++++++++ arch/arm/mach-mvebu/include/mach/cpu.h | 2 + arch/arm/mach-mvebu/spl.c | 77 +++----------------------- 3 files changed, 71 insertions(+), 68 deletions(-) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 0b935c46fb..daf8bd66a0 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -14,6 +14,7 @@ #include <asm/pl310.h> #include <asm/arch/cpu.h> #include <asm/arch/soc.h> +#include <asm/spl.h> #include <sdhci.h> #define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3)) @@ -80,6 +81,65 @@ int mvebu_soc_family(void) return MVEBU_SOC_UNKNOWN; } +u32 get_boot_device(void) +{ + u32 val; + u32 boot_device; + + /* + * First check, if UART boot-mode is active. This can only + * be done, via the bootrom error register. Here the + * MSB marks if the UART mode is active. + */ + val = readl(CONFIG_BOOTROM_ERR_REG); + boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; + debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); + if (boot_device == BOOTROM_ERR_MODE_UART) + return BOOT_DEVICE_UART; + +#ifdef CONFIG_ARMADA_38X + /* + * If the bootrom error code contains any other than zeros it's an + * error condition and the bootROM has fallen back to UART boot + */ + boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; + if (boot_device) + return BOOT_DEVICE_UART; +#endif + + /* + * Now check the SAR register for the strapped boot-device + */ + val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ + boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; + debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); + switch (boot_device) { +#ifdef BOOT_FROM_NAND + case BOOT_FROM_NAND: + return BOOT_DEVICE_NAND; +#endif +#ifdef BOOT_FROM_MMC + case BOOT_FROM_MMC: + case BOOT_FROM_MMC_ALT: + return BOOT_DEVICE_MMC1; +#endif + case BOOT_FROM_UART: +#ifdef BOOT_FROM_UART_ALT + case BOOT_FROM_UART_ALT: +#endif + return BOOT_DEVICE_UART; +#ifdef BOOT_FROM_SATA + case BOOT_FROM_SATA: + case BOOT_FROM_SATA_ALT: + return BOOT_DEVICE_SATA; +#endif + case BOOT_FROM_SPI: + return BOOT_DEVICE_SPI; + default: + return BOOT_DEVICE_BOOTROM; + }; +} + #if defined(CONFIG_DISPLAY_CPUINFO) #if defined(CONFIG_ARMADA_375) diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h index 79858858c2..a7a62c7e7d 100644 --- a/arch/arm/mach-mvebu/include/mach/cpu.h +++ b/arch/arm/mach-mvebu/include/mach/cpu.h @@ -148,6 +148,8 @@ void __noreturn return_to_bootrom(void); int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks); #endif +u32 get_boot_device(void); + void get_sar_freq(struct sar_freq_modes *sar_freq); /* diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index f0cf60bb14..8d6d4902f6 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -171,74 +171,6 @@ int spl_parse_board_header(struct spl_image_info *spl_image, return 0; } -static u32 get_boot_device(void) -{ - u32 val; - u32 boot_device; - - /* - * First check, if UART boot-mode is active. This can only - * be done, via the bootrom error register. Here the - * MSB marks if the UART mode is active. - */ - val = readl(CONFIG_BOOTROM_ERR_REG); - boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; - debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); - if (boot_device == BOOTROM_ERR_MODE_UART) - return BOOT_DEVICE_UART; - -#ifdef CONFIG_ARMADA_38X - /* - * If the bootrom error code contains any other than zeros it's an - * error condition and the bootROM has fallen back to UART boot - */ - boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; - if (boot_device) - return BOOT_DEVICE_UART; -#endif - - /* - * Now check the SAR register for the strapped boot-device - */ - val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ - boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; - debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); - switch (boot_device) { -#ifdef BOOT_FROM_NAND - case BOOT_FROM_NAND: - return BOOT_DEVICE_NAND; -#endif -#ifdef BOOT_FROM_MMC - case BOOT_FROM_MMC: - case BOOT_FROM_MMC_ALT: - return BOOT_DEVICE_MMC1; -#endif - case BOOT_FROM_UART: -#ifdef BOOT_FROM_UART_ALT - case BOOT_FROM_UART_ALT: -#endif - return BOOT_DEVICE_UART; -#ifdef BOOT_FROM_SATA - case BOOT_FROM_SATA: - case BOOT_FROM_SATA_ALT: - return BOOT_DEVICE_SATA; -#endif - case BOOT_FROM_SPI: - return BOOT_DEVICE_SPI; - default: - return BOOT_DEVICE_BOOTROM; - }; -} - -#else - -static u32 get_boot_device(void) -{ - return BOOT_DEVICE_BOOTROM; -} - -#endif - u32 spl_boot_device(void) { u32 boot_device = get_boot_device(); @@ -285,6 +217,15 @@ u32 spl_boot_device(void) } } +#else + +u32 spl_boot_device(void) +{ + return BOOT_DEVICE_BOOTROM; +} + +#endif + int board_return_to_bootrom(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { -- 2.31.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún @ 2021-08-16 17:51 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Pali Rohár @ 2021-08-16 17:51 UTC (permalink / raw) To: Marek Behún; +Cc: Stefan Roese, u-boot On Monday 16 August 2021 15:19:37 Marek Behún wrote: > Move the function get_boot_device() from spl.c to cpu.c. > > Make it visible, so that it may be used from other files. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Pali Rohár <pali@kernel.org> > --- > arch/arm/mach-mvebu/cpu.c | 60 ++++++++++++++++++++ > arch/arm/mach-mvebu/include/mach/cpu.h | 2 + > arch/arm/mach-mvebu/spl.c | 77 +++----------------------- > 3 files changed, 71 insertions(+), 68 deletions(-) > > diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c > index 0b935c46fb..daf8bd66a0 100644 > --- a/arch/arm/mach-mvebu/cpu.c > +++ b/arch/arm/mach-mvebu/cpu.c > @@ -14,6 +14,7 @@ > #include <asm/pl310.h> > #include <asm/arch/cpu.h> > #include <asm/arch/soc.h> > +#include <asm/spl.h> > #include <sdhci.h> > > #define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3)) > @@ -80,6 +81,65 @@ int mvebu_soc_family(void) > return MVEBU_SOC_UNKNOWN; > } > > +u32 get_boot_device(void) > +{ > + u32 val; > + u32 boot_device; > + > + /* > + * First check, if UART boot-mode is active. This can only > + * be done, via the bootrom error register. Here the > + * MSB marks if the UART mode is active. > + */ > + val = readl(CONFIG_BOOTROM_ERR_REG); > + boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; > + debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); > + if (boot_device == BOOTROM_ERR_MODE_UART) > + return BOOT_DEVICE_UART; > + > +#ifdef CONFIG_ARMADA_38X > + /* > + * If the bootrom error code contains any other than zeros it's an > + * error condition and the bootROM has fallen back to UART boot > + */ > + boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; > + if (boot_device) > + return BOOT_DEVICE_UART; > +#endif > + > + /* > + * Now check the SAR register for the strapped boot-device > + */ > + val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ > + boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; > + debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); > + switch (boot_device) { > +#ifdef BOOT_FROM_NAND > + case BOOT_FROM_NAND: > + return BOOT_DEVICE_NAND; > +#endif > +#ifdef BOOT_FROM_MMC > + case BOOT_FROM_MMC: > + case BOOT_FROM_MMC_ALT: > + return BOOT_DEVICE_MMC1; > +#endif > + case BOOT_FROM_UART: > +#ifdef BOOT_FROM_UART_ALT > + case BOOT_FROM_UART_ALT: > +#endif > + return BOOT_DEVICE_UART; > +#ifdef BOOT_FROM_SATA > + case BOOT_FROM_SATA: > + case BOOT_FROM_SATA_ALT: > + return BOOT_DEVICE_SATA; > +#endif > + case BOOT_FROM_SPI: > + return BOOT_DEVICE_SPI; > + default: > + return BOOT_DEVICE_BOOTROM; > + }; > +} > + > #if defined(CONFIG_DISPLAY_CPUINFO) > > #if defined(CONFIG_ARMADA_375) > diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h > index 79858858c2..a7a62c7e7d 100644 > --- a/arch/arm/mach-mvebu/include/mach/cpu.h > +++ b/arch/arm/mach-mvebu/include/mach/cpu.h > @@ -148,6 +148,8 @@ void __noreturn return_to_bootrom(void); > int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks); > #endif > > +u32 get_boot_device(void); > + > void get_sar_freq(struct sar_freq_modes *sar_freq); > > /* > diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c > index f0cf60bb14..8d6d4902f6 100644 > --- a/arch/arm/mach-mvebu/spl.c > +++ b/arch/arm/mach-mvebu/spl.c > @@ -171,74 +171,6 @@ int spl_parse_board_header(struct spl_image_info *spl_image, > return 0; > } > > -static u32 get_boot_device(void) > -{ > - u32 val; > - u32 boot_device; > - > - /* > - * First check, if UART boot-mode is active. This can only > - * be done, via the bootrom error register. Here the > - * MSB marks if the UART mode is active. > - */ > - val = readl(CONFIG_BOOTROM_ERR_REG); > - boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; > - debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); > - if (boot_device == BOOTROM_ERR_MODE_UART) > - return BOOT_DEVICE_UART; > - > -#ifdef CONFIG_ARMADA_38X > - /* > - * If the bootrom error code contains any other than zeros it's an > - * error condition and the bootROM has fallen back to UART boot > - */ > - boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; > - if (boot_device) > - return BOOT_DEVICE_UART; > -#endif > - > - /* > - * Now check the SAR register for the strapped boot-device > - */ > - val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ > - boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; > - debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); > - switch (boot_device) { > -#ifdef BOOT_FROM_NAND > - case BOOT_FROM_NAND: > - return BOOT_DEVICE_NAND; > -#endif > -#ifdef BOOT_FROM_MMC > - case BOOT_FROM_MMC: > - case BOOT_FROM_MMC_ALT: > - return BOOT_DEVICE_MMC1; > -#endif > - case BOOT_FROM_UART: > -#ifdef BOOT_FROM_UART_ALT > - case BOOT_FROM_UART_ALT: > -#endif > - return BOOT_DEVICE_UART; > -#ifdef BOOT_FROM_SATA > - case BOOT_FROM_SATA: > - case BOOT_FROM_SATA_ALT: > - return BOOT_DEVICE_SATA; > -#endif > - case BOOT_FROM_SPI: > - return BOOT_DEVICE_SPI; > - default: > - return BOOT_DEVICE_BOOTROM; > - }; > -} > - > -#else > - > -static u32 get_boot_device(void) > -{ > - return BOOT_DEVICE_BOOTROM; > -} > - > -#endif > - > u32 spl_boot_device(void) > { > u32 boot_device = get_boot_device(); > @@ -285,6 +217,15 @@ u32 spl_boot_device(void) > } > } > > +#else > + > +u32 spl_boot_device(void) > +{ > + return BOOT_DEVICE_BOOTROM; > +} > + > +#endif > + > int board_return_to_bootrom(struct spl_image_info *spl_image, > struct spl_boot_device *bootdev) > { > -- > 2.31.1 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún 2021-08-16 17:51 ` Pali Rohár @ 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-08-17 7:46 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > Move the function get_boot_device() from spl.c to cpu.c. > > Make it visible, so that it may be used from other files. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > arch/arm/mach-mvebu/cpu.c | 60 ++++++++++++++++++++ > arch/arm/mach-mvebu/include/mach/cpu.h | 2 + > arch/arm/mach-mvebu/spl.c | 77 +++----------------------- > 3 files changed, 71 insertions(+), 68 deletions(-) > > diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c > index 0b935c46fb..daf8bd66a0 100644 > --- a/arch/arm/mach-mvebu/cpu.c > +++ b/arch/arm/mach-mvebu/cpu.c > @@ -14,6 +14,7 @@ > #include <asm/pl310.h> > #include <asm/arch/cpu.h> > #include <asm/arch/soc.h> > +#include <asm/spl.h> > #include <sdhci.h> > > #define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3)) > @@ -80,6 +81,65 @@ int mvebu_soc_family(void) > return MVEBU_SOC_UNKNOWN; > } > > +u32 get_boot_device(void) > +{ > + u32 val; > + u32 boot_device; > + > + /* > + * First check, if UART boot-mode is active. This can only > + * be done, via the bootrom error register. Here the > + * MSB marks if the UART mode is active. > + */ > + val = readl(CONFIG_BOOTROM_ERR_REG); > + boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; > + debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); > + if (boot_device == BOOTROM_ERR_MODE_UART) > + return BOOT_DEVICE_UART; > + > +#ifdef CONFIG_ARMADA_38X > + /* > + * If the bootrom error code contains any other than zeros it's an > + * error condition and the bootROM has fallen back to UART boot > + */ > + boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; > + if (boot_device) > + return BOOT_DEVICE_UART; > +#endif > + > + /* > + * Now check the SAR register for the strapped boot-device > + */ > + val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ > + boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; > + debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); > + switch (boot_device) { > +#ifdef BOOT_FROM_NAND > + case BOOT_FROM_NAND: > + return BOOT_DEVICE_NAND; > +#endif > +#ifdef BOOT_FROM_MMC > + case BOOT_FROM_MMC: > + case BOOT_FROM_MMC_ALT: > + return BOOT_DEVICE_MMC1; > +#endif > + case BOOT_FROM_UART: > +#ifdef BOOT_FROM_UART_ALT > + case BOOT_FROM_UART_ALT: > +#endif > + return BOOT_DEVICE_UART; > +#ifdef BOOT_FROM_SATA > + case BOOT_FROM_SATA: > + case BOOT_FROM_SATA_ALT: > + return BOOT_DEVICE_SATA; > +#endif > + case BOOT_FROM_SPI: > + return BOOT_DEVICE_SPI; > + default: > + return BOOT_DEVICE_BOOTROM; > + }; > +} > + > #if defined(CONFIG_DISPLAY_CPUINFO) > > #if defined(CONFIG_ARMADA_375) > diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h > index 79858858c2..a7a62c7e7d 100644 > --- a/arch/arm/mach-mvebu/include/mach/cpu.h > +++ b/arch/arm/mach-mvebu/include/mach/cpu.h > @@ -148,6 +148,8 @@ void __noreturn return_to_bootrom(void); > int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks); > #endif > > +u32 get_boot_device(void); > + > void get_sar_freq(struct sar_freq_modes *sar_freq); > > /* > diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c > index f0cf60bb14..8d6d4902f6 100644 > --- a/arch/arm/mach-mvebu/spl.c > +++ b/arch/arm/mach-mvebu/spl.c > @@ -171,74 +171,6 @@ int spl_parse_board_header(struct spl_image_info *spl_image, > return 0; > } > > -static u32 get_boot_device(void) > -{ > - u32 val; > - u32 boot_device; > - > - /* > - * First check, if UART boot-mode is active. This can only > - * be done, via the bootrom error register. Here the > - * MSB marks if the UART mode is active. > - */ > - val = readl(CONFIG_BOOTROM_ERR_REG); > - boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; > - debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); > - if (boot_device == BOOTROM_ERR_MODE_UART) > - return BOOT_DEVICE_UART; > - > -#ifdef CONFIG_ARMADA_38X > - /* > - * If the bootrom error code contains any other than zeros it's an > - * error condition and the bootROM has fallen back to UART boot > - */ > - boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; > - if (boot_device) > - return BOOT_DEVICE_UART; > -#endif > - > - /* > - * Now check the SAR register for the strapped boot-device > - */ > - val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ > - boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; > - debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); > - switch (boot_device) { > -#ifdef BOOT_FROM_NAND > - case BOOT_FROM_NAND: > - return BOOT_DEVICE_NAND; > -#endif > -#ifdef BOOT_FROM_MMC > - case BOOT_FROM_MMC: > - case BOOT_FROM_MMC_ALT: > - return BOOT_DEVICE_MMC1; > -#endif > - case BOOT_FROM_UART: > -#ifdef BOOT_FROM_UART_ALT > - case BOOT_FROM_UART_ALT: > -#endif > - return BOOT_DEVICE_UART; > -#ifdef BOOT_FROM_SATA > - case BOOT_FROM_SATA: > - case BOOT_FROM_SATA_ALT: > - return BOOT_DEVICE_SATA; > -#endif > - case BOOT_FROM_SPI: > - return BOOT_DEVICE_SPI; > - default: > - return BOOT_DEVICE_BOOTROM; > - }; > -} > - > -#else > - > -static u32 get_boot_device(void) > -{ > - return BOOT_DEVICE_BOOTROM; > -} > - > -#endif > - > u32 spl_boot_device(void) > { > u32 boot_device = get_boot_device(); > @@ -285,6 +217,15 @@ u32 spl_boot_device(void) > } > } > > +#else > + > +u32 spl_boot_device(void) > +{ > + return BOOT_DEVICE_BOOTROM; > +} > + > +#endif > + > int board_return_to_bootrom(struct spl_image_info *spl_image, > struct spl_boot_device *bootdev) > { > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún 2021-08-16 17:51 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese @ 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-09-01 9:13 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > Move the function get_boot_device() from spl.c to cpu.c. > > Make it visible, so that it may be used from other files. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Applied to u-boot-marvell/master Thanks, Stefan > --- > arch/arm/mach-mvebu/cpu.c | 60 ++++++++++++++++++++ > arch/arm/mach-mvebu/include/mach/cpu.h | 2 + > arch/arm/mach-mvebu/spl.c | 77 +++----------------------- > 3 files changed, 71 insertions(+), 68 deletions(-) > > diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c > index 0b935c46fb..daf8bd66a0 100644 > --- a/arch/arm/mach-mvebu/cpu.c > +++ b/arch/arm/mach-mvebu/cpu.c > @@ -14,6 +14,7 @@ > #include <asm/pl310.h> > #include <asm/arch/cpu.h> > #include <asm/arch/soc.h> > +#include <asm/spl.h> > #include <sdhci.h> > > #define DDR_BASE_CS_OFF(n) (0x0000 + ((n) << 3)) > @@ -80,6 +81,65 @@ int mvebu_soc_family(void) > return MVEBU_SOC_UNKNOWN; > } > > +u32 get_boot_device(void) > +{ > + u32 val; > + u32 boot_device; > + > + /* > + * First check, if UART boot-mode is active. This can only > + * be done, via the bootrom error register. Here the > + * MSB marks if the UART mode is active. > + */ > + val = readl(CONFIG_BOOTROM_ERR_REG); > + boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; > + debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); > + if (boot_device == BOOTROM_ERR_MODE_UART) > + return BOOT_DEVICE_UART; > + > +#ifdef CONFIG_ARMADA_38X > + /* > + * If the bootrom error code contains any other than zeros it's an > + * error condition and the bootROM has fallen back to UART boot > + */ > + boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; > + if (boot_device) > + return BOOT_DEVICE_UART; > +#endif > + > + /* > + * Now check the SAR register for the strapped boot-device > + */ > + val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ > + boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; > + debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); > + switch (boot_device) { > +#ifdef BOOT_FROM_NAND > + case BOOT_FROM_NAND: > + return BOOT_DEVICE_NAND; > +#endif > +#ifdef BOOT_FROM_MMC > + case BOOT_FROM_MMC: > + case BOOT_FROM_MMC_ALT: > + return BOOT_DEVICE_MMC1; > +#endif > + case BOOT_FROM_UART: > +#ifdef BOOT_FROM_UART_ALT > + case BOOT_FROM_UART_ALT: > +#endif > + return BOOT_DEVICE_UART; > +#ifdef BOOT_FROM_SATA > + case BOOT_FROM_SATA: > + case BOOT_FROM_SATA_ALT: > + return BOOT_DEVICE_SATA; > +#endif > + case BOOT_FROM_SPI: > + return BOOT_DEVICE_SPI; > + default: > + return BOOT_DEVICE_BOOTROM; > + }; > +} > + > #if defined(CONFIG_DISPLAY_CPUINFO) > > #if defined(CONFIG_ARMADA_375) > diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h > index 79858858c2..a7a62c7e7d 100644 > --- a/arch/arm/mach-mvebu/include/mach/cpu.h > +++ b/arch/arm/mach-mvebu/include/mach/cpu.h > @@ -148,6 +148,8 @@ void __noreturn return_to_bootrom(void); > int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks); > #endif > > +u32 get_boot_device(void); > + > void get_sar_freq(struct sar_freq_modes *sar_freq); > > /* > diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c > index f0cf60bb14..8d6d4902f6 100644 > --- a/arch/arm/mach-mvebu/spl.c > +++ b/arch/arm/mach-mvebu/spl.c > @@ -171,74 +171,6 @@ int spl_parse_board_header(struct spl_image_info *spl_image, > return 0; > } > > -static u32 get_boot_device(void) > -{ > - u32 val; > - u32 boot_device; > - > - /* > - * First check, if UART boot-mode is active. This can only > - * be done, via the bootrom error register. Here the > - * MSB marks if the UART mode is active. > - */ > - val = readl(CONFIG_BOOTROM_ERR_REG); > - boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; > - debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); > - if (boot_device == BOOTROM_ERR_MODE_UART) > - return BOOT_DEVICE_UART; > - > -#ifdef CONFIG_ARMADA_38X > - /* > - * If the bootrom error code contains any other than zeros it's an > - * error condition and the bootROM has fallen back to UART boot > - */ > - boot_device = (val & BOOTROM_ERR_CODE_MASK) >> BOOTROM_ERR_CODE_OFFS; > - if (boot_device) > - return BOOT_DEVICE_UART; > -#endif > - > - /* > - * Now check the SAR register for the strapped boot-device > - */ > - val = readl(CONFIG_SAR_REG); /* SAR - Sample At Reset */ > - boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; > - debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); > - switch (boot_device) { > -#ifdef BOOT_FROM_NAND > - case BOOT_FROM_NAND: > - return BOOT_DEVICE_NAND; > -#endif > -#ifdef BOOT_FROM_MMC > - case BOOT_FROM_MMC: > - case BOOT_FROM_MMC_ALT: > - return BOOT_DEVICE_MMC1; > -#endif > - case BOOT_FROM_UART: > -#ifdef BOOT_FROM_UART_ALT > - case BOOT_FROM_UART_ALT: > -#endif > - return BOOT_DEVICE_UART; > -#ifdef BOOT_FROM_SATA > - case BOOT_FROM_SATA: > - case BOOT_FROM_SATA_ALT: > - return BOOT_DEVICE_SATA; > -#endif > - case BOOT_FROM_SPI: > - return BOOT_DEVICE_SPI; > - default: > - return BOOT_DEVICE_BOOTROM; > - }; > -} > - > -#else > - > -static u32 get_boot_device(void) > -{ > - return BOOT_DEVICE_BOOTROM; > -} > - > -#endif > - > u32 spl_boot_device(void) > { > u32 boot_device = get_boot_device(); > @@ -285,6 +217,15 @@ u32 spl_boot_device(void) > } > } > > +#else > + > +u32 spl_boot_device(void) > +{ > + return BOOT_DEVICE_BOOTROM; > +} > + > +#endif > + > int board_return_to_bootrom(struct spl_image_info *spl_image, > struct spl_boot_device *bootdev) > { > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro 2021-08-16 13:19 [PATCH u-boot-mvebu v2 0/4] turris_omnia: Disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún @ 2021-08-16 13:19 ` Marek Behún 2021-08-16 17:55 ` Pali Rohár ` (2 more replies) 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() Marek Behún 3 siblings, 3 replies; 17+ messages in thread From: Marek Behún @ 2021-08-16 13:19 UTC (permalink / raw) To: Stefan Roese; +Cc: u-boot, pali, Marek Behún We do not need to guard code in board_init() and board_late_init() functions with the CONFIG_SPL_BUILD macro, since these functions are not called in SPL. Signed-off-by: Marek Behún <marek.behun@nic.cz> --- board/CZ.NIC/turris_omnia/turris_omnia.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index a7e5f56eed..a84a409f43 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -129,7 +129,6 @@ static int omnia_mcu_read(u8 cmd, void *buf, int len) return dm_i2c_read(chip, cmd, buf, len); } -#ifndef CONFIG_SPL_BUILD static int omnia_mcu_write(u8 cmd, const void *buf, int len) { struct udevice *chip; @@ -158,7 +157,6 @@ static bool disable_mcu_watchdog(void) return true; } -#endif static bool omnia_detect_sata(void) { @@ -325,7 +323,6 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void) return &board_topology_map_1g; } -#ifndef CONFIG_SPL_BUILD static int set_regdomain(void) { struct omnia_eeprom oep; @@ -394,7 +391,6 @@ static void handle_reset_button(void) } } } -#endif int board_early_init_f(void) { @@ -428,19 +424,15 @@ int board_init(void) /* address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; -#ifndef CONFIG_SPL_BUILD disable_mcu_watchdog(); -#endif return 0; } int board_late_init(void) { -#ifndef CONFIG_SPL_BUILD set_regdomain(); handle_reset_button(); -#endif pci_init(); return 0; -- 2.31.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro Marek Behún @ 2021-08-16 17:55 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Pali Rohár @ 2021-08-16 17:55 UTC (permalink / raw) To: Marek Behún; +Cc: Stefan Roese, u-boot On Monday 16 August 2021 15:19:38 Marek Behún wrote: > We do not need to guard code in board_init() and board_late_init() > functions with the CONFIG_SPL_BUILD macro, since these functions are not > called in SPL. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Pali Rohár <pali@kernel.org> > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index a7e5f56eed..a84a409f43 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -129,7 +129,6 @@ static int omnia_mcu_read(u8 cmd, void *buf, int len) > return dm_i2c_read(chip, cmd, buf, len); > } > > -#ifndef CONFIG_SPL_BUILD > static int omnia_mcu_write(u8 cmd, const void *buf, int len) > { > struct udevice *chip; > @@ -158,7 +157,6 @@ static bool disable_mcu_watchdog(void) > > return true; > } > -#endif > > static bool omnia_detect_sata(void) > { > @@ -325,7 +323,6 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void) > return &board_topology_map_1g; > } > > -#ifndef CONFIG_SPL_BUILD > static int set_regdomain(void) > { > struct omnia_eeprom oep; > @@ -394,7 +391,6 @@ static void handle_reset_button(void) > } > } > } > -#endif > > int board_early_init_f(void) > { > @@ -428,19 +424,15 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > -#ifndef CONFIG_SPL_BUILD > disable_mcu_watchdog(); > -#endif > > return 0; > } > > int board_late_init(void) > { > -#ifndef CONFIG_SPL_BUILD > set_regdomain(); > handle_reset_button(); > -#endif > pci_init(); > > return 0; > -- > 2.31.1 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro Marek Behún 2021-08-16 17:55 ` Pali Rohár @ 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-08-17 7:46 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > We do not need to guard code in board_init() and board_late_init() > functions with the CONFIG_SPL_BUILD macro, since these functions are not > called in SPL. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index a7e5f56eed..a84a409f43 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -129,7 +129,6 @@ static int omnia_mcu_read(u8 cmd, void *buf, int len) > return dm_i2c_read(chip, cmd, buf, len); > } > > -#ifndef CONFIG_SPL_BUILD > static int omnia_mcu_write(u8 cmd, const void *buf, int len) > { > struct udevice *chip; > @@ -158,7 +157,6 @@ static bool disable_mcu_watchdog(void) > > return true; > } > -#endif > > static bool omnia_detect_sata(void) > { > @@ -325,7 +323,6 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void) > return &board_topology_map_1g; > } > > -#ifndef CONFIG_SPL_BUILD > static int set_regdomain(void) > { > struct omnia_eeprom oep; > @@ -394,7 +391,6 @@ static void handle_reset_button(void) > } > } > } > -#endif > > int board_early_init_f(void) > { > @@ -428,19 +424,15 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > -#ifndef CONFIG_SPL_BUILD > disable_mcu_watchdog(); > -#endif > > return 0; > } > > int board_late_init(void) > { > -#ifndef CONFIG_SPL_BUILD > set_regdomain(); > handle_reset_button(); > -#endif > pci_init(); > > return 0; > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro Marek Behún 2021-08-16 17:55 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese @ 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-09-01 9:13 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > We do not need to guard code in board_init() and board_late_init() > functions with the CONFIG_SPL_BUILD macro, since these functions are not > called in SPL. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Applied to u-boot-marvell/master Thanks, Stefan > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index a7e5f56eed..a84a409f43 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -129,7 +129,6 @@ static int omnia_mcu_read(u8 cmd, void *buf, int len) > return dm_i2c_read(chip, cmd, buf, len); > } > > -#ifndef CONFIG_SPL_BUILD > static int omnia_mcu_write(u8 cmd, const void *buf, int len) > { > struct udevice *chip; > @@ -158,7 +157,6 @@ static bool disable_mcu_watchdog(void) > > return true; > } > -#endif > > static bool omnia_detect_sata(void) > { > @@ -325,7 +323,6 @@ struct mv_ddr_topology_map *mv_ddr_topology_map_get(void) > return &board_topology_map_1g; > } > > -#ifndef CONFIG_SPL_BUILD > static int set_regdomain(void) > { > struct omnia_eeprom oep; > @@ -394,7 +391,6 @@ static void handle_reset_button(void) > } > } > } > -#endif > > int board_early_init_f(void) > { > @@ -428,19 +424,15 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > -#ifndef CONFIG_SPL_BUILD > disable_mcu_watchdog(); > -#endif > > return 0; > } > > int board_late_init(void) > { > -#ifndef CONFIG_SPL_BUILD > set_regdomain(); > handle_reset_button(); > -#endif > pci_init(); > > return 0; > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART 2021-08-16 13:19 [PATCH u-boot-mvebu v2 0/4] turris_omnia: Disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro Marek Behún @ 2021-08-16 13:19 ` Marek Behún 2021-08-16 17:56 ` Pali Rohár ` (2 more replies) 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() Marek Behún 3 siblings, 3 replies; 17+ messages in thread From: Marek Behún @ 2021-08-16 13:19 UTC (permalink / raw) To: Stefan Roese; +Cc: u-boot, pali, Marek Behún When booting over UART, sending U-Boot proper may take too much time and MCU watchdog will reset the board before U-Boot proper is loaded. Better disable MCU watchdog in SPL when booting over UART. Signed-off-by: Marek Behún <marek.behun@nic.cz> --- board/CZ.NIC/turris_omnia/turris_omnia.c | 17 ++++++++++++++++- configs/turris_omnia_defconfig | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index a84a409f43..b0391c973d 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -419,12 +419,27 @@ int board_early_init_f(void) return 0; } +void spl_board_init(void) +{ + /* + * If booting from UART, disable MCU watchdog in SPL, since uploading + * U-Boot proper can take too much time and trigger it. + */ + if (get_boot_device() == BOOT_DEVICE_UART) + disable_mcu_watchdog(); +} + int board_init(void) { /* address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; - disable_mcu_watchdog(); + /* + * If not booting from UART, MCU watchdog was not disabled in SPL, + * disable it now. + */ + if (get_boot_device() != BOOT_DEVICE_UART) + disable_mcu_watchdog(); return 0; } diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index cd443ceb30..67f8bdadaf 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -33,6 +33,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_I2C=y CONFIG_CMD_MEMTEST=y CONFIG_SYS_ALT_MEMTEST=y -- 2.31.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART Marek Behún @ 2021-08-16 17:56 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Pali Rohár @ 2021-08-16 17:56 UTC (permalink / raw) To: Marek Behún; +Cc: Stefan Roese, u-boot On Monday 16 August 2021 15:19:39 Marek Behún wrote: > When booting over UART, sending U-Boot proper may take too much time and > MCU watchdog will reset the board before U-Boot proper is loaded. > > Better disable MCU watchdog in SPL when booting over UART. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Pali Rohár <pali@kernel.org> > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 17 ++++++++++++++++- > configs/turris_omnia_defconfig | 1 + > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index a84a409f43..b0391c973d 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -419,12 +419,27 @@ int board_early_init_f(void) > return 0; > } > > +void spl_board_init(void) > +{ > + /* > + * If booting from UART, disable MCU watchdog in SPL, since uploading > + * U-Boot proper can take too much time and trigger it. > + */ > + if (get_boot_device() == BOOT_DEVICE_UART) > + disable_mcu_watchdog(); > +} > + > int board_init(void) > { > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > - disable_mcu_watchdog(); > + /* > + * If not booting from UART, MCU watchdog was not disabled in SPL, > + * disable it now. > + */ > + if (get_boot_device() != BOOT_DEVICE_UART) > + disable_mcu_watchdog(); > > return 0; > } > diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig > index cd443ceb30..67f8bdadaf 100644 > --- a/configs/turris_omnia_defconfig > +++ b/configs/turris_omnia_defconfig > @@ -33,6 +33,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y > # CONFIG_DISPLAY_BOARDINFO is not set > CONFIG_DISPLAY_BOARDINFO_LATE=y > CONFIG_MISC_INIT_R=y > +CONFIG_SPL_BOARD_INIT=y > CONFIG_SPL_I2C=y > CONFIG_CMD_MEMTEST=y > CONFIG_SYS_ALT_MEMTEST=y > -- > 2.31.1 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 17:56 ` Pali Rohár @ 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-08-17 7:46 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > When booting over UART, sending U-Boot proper may take too much time and > MCU watchdog will reset the board before U-Boot proper is loaded. > > Better disable MCU watchdog in SPL when booting over UART. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 17 ++++++++++++++++- > configs/turris_omnia_defconfig | 1 + > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index a84a409f43..b0391c973d 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -419,12 +419,27 @@ int board_early_init_f(void) > return 0; > } > > +void spl_board_init(void) > +{ > + /* > + * If booting from UART, disable MCU watchdog in SPL, since uploading > + * U-Boot proper can take too much time and trigger it. > + */ > + if (get_boot_device() == BOOT_DEVICE_UART) > + disable_mcu_watchdog(); > +} > + > int board_init(void) > { > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > - disable_mcu_watchdog(); > + /* > + * If not booting from UART, MCU watchdog was not disabled in SPL, > + * disable it now. > + */ > + if (get_boot_device() != BOOT_DEVICE_UART) > + disable_mcu_watchdog(); > > return 0; > } > diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig > index cd443ceb30..67f8bdadaf 100644 > --- a/configs/turris_omnia_defconfig > +++ b/configs/turris_omnia_defconfig > @@ -33,6 +33,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y > # CONFIG_DISPLAY_BOARDINFO is not set > CONFIG_DISPLAY_BOARDINFO_LATE=y > CONFIG_MISC_INIT_R=y > +CONFIG_SPL_BOARD_INIT=y > CONFIG_SPL_I2C=y > CONFIG_CMD_MEMTEST=y > CONFIG_SYS_ALT_MEMTEST=y > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 17:56 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese @ 2021-09-01 9:13 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-09-01 9:13 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > When booting over UART, sending U-Boot proper may take too much time and > MCU watchdog will reset the board before U-Boot proper is loaded. > > Better disable MCU watchdog in SPL when booting over UART. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Applied to u-boot-marvell/master Thanks, Stefan > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 17 ++++++++++++++++- > configs/turris_omnia_defconfig | 1 + > 2 files changed, 17 insertions(+), 1 deletion(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index a84a409f43..b0391c973d 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -419,12 +419,27 @@ int board_early_init_f(void) > return 0; > } > > +void spl_board_init(void) > +{ > + /* > + * If booting from UART, disable MCU watchdog in SPL, since uploading > + * U-Boot proper can take too much time and trigger it. > + */ > + if (get_boot_device() == BOOT_DEVICE_UART) > + disable_mcu_watchdog(); > +} > + > int board_init(void) > { > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > - disable_mcu_watchdog(); > + /* > + * If not booting from UART, MCU watchdog was not disabled in SPL, > + * disable it now. > + */ > + if (get_boot_device() != BOOT_DEVICE_UART) > + disable_mcu_watchdog(); > > return 0; > } > diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig > index cd443ceb30..67f8bdadaf 100644 > --- a/configs/turris_omnia_defconfig > +++ b/configs/turris_omnia_defconfig > @@ -33,6 +33,7 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y > # CONFIG_DISPLAY_BOARDINFO is not set > CONFIG_DISPLAY_BOARDINFO_LATE=y > CONFIG_MISC_INIT_R=y > +CONFIG_SPL_BOARD_INIT=y > CONFIG_SPL_I2C=y > CONFIG_CMD_MEMTEST=y > CONFIG_SYS_ALT_MEMTEST=y > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() 2021-08-16 13:19 [PATCH u-boot-mvebu v2 0/4] turris_omnia: Disable MCU watchdog in SPL when booting over UART Marek Behún ` (2 preceding siblings ...) 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART Marek Behún @ 2021-08-16 13:19 ` Marek Behún 2021-08-16 17:56 ` Pali Rohár ` (2 more replies) 3 siblings, 3 replies; 17+ messages in thread From: Marek Behún @ 2021-08-16 13:19 UTC (permalink / raw) To: Stefan Roese; +Cc: u-boot, pali, Marek Behún Disable MCU watchdog in board_late_init() instead of board_init(), so that it is disabled after U-Boot enables SOC watchdog instead of before. This way there is no window when the board is vulnerable. Signed-off-by: Marek Behún <marek.behun@nic.cz> --- board/CZ.NIC/turris_omnia/turris_omnia.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index b0391c973d..bac78af04e 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -434,6 +434,11 @@ int board_init(void) /* address of boot parameters */ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; + return 0; +} + +int board_late_init(void) +{ /* * If not booting from UART, MCU watchdog was not disabled in SPL, * disable it now. @@ -441,11 +446,6 @@ int board_init(void) if (get_boot_device() != BOOT_DEVICE_UART) disable_mcu_watchdog(); - return 0; -} - -int board_late_init(void) -{ set_regdomain(); handle_reset_button(); pci_init(); -- 2.31.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() Marek Behún @ 2021-08-16 17:56 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:14 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Pali Rohár @ 2021-08-16 17:56 UTC (permalink / raw) To: Marek Behún; +Cc: Stefan Roese, u-boot On Monday 16 August 2021 15:19:40 Marek Behún wrote: > Disable MCU watchdog in board_late_init() instead of board_init(), so > that it is disabled after U-Boot enables SOC watchdog instead of before. > This way there is no window when the board is vulnerable. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Pali Rohár <pali@kernel.org> > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index b0391c973d..bac78af04e 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -434,6 +434,11 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > + return 0; > +} > + > +int board_late_init(void) > +{ > /* > * If not booting from UART, MCU watchdog was not disabled in SPL, > * disable it now. > @@ -441,11 +446,6 @@ int board_init(void) > if (get_boot_device() != BOOT_DEVICE_UART) > disable_mcu_watchdog(); > > - return 0; > -} > - > -int board_late_init(void) > -{ > set_regdomain(); > handle_reset_button(); > pci_init(); > -- > 2.31.1 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() Marek Behún 2021-08-16 17:56 ` Pali Rohár @ 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:14 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-08-17 7:46 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > Disable MCU watchdog in board_late_init() instead of board_init(), so > that it is disabled after U-Boot enables SOC watchdog instead of before. > This way there is no window when the board is vulnerable. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index b0391c973d..bac78af04e 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -434,6 +434,11 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > + return 0; > +} > + > +int board_late_init(void) > +{ > /* > * If not booting from UART, MCU watchdog was not disabled in SPL, > * disable it now. > @@ -441,11 +446,6 @@ int board_init(void) > if (get_boot_device() != BOOT_DEVICE_UART) > disable_mcu_watchdog(); > > - return 0; > -} > - > -int board_late_init(void) > -{ > set_regdomain(); > handle_reset_button(); > pci_init(); > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() Marek Behún 2021-08-16 17:56 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese @ 2021-09-01 9:14 ` Stefan Roese 2 siblings, 0 replies; 17+ messages in thread From: Stefan Roese @ 2021-09-01 9:14 UTC (permalink / raw) To: Marek Behún; +Cc: u-boot, pali On 16.08.21 15:19, Marek Behún wrote: > Disable MCU watchdog in board_late_init() instead of board_init(), so > that it is disabled after U-Boot enables SOC watchdog instead of before. > This way there is no window when the board is vulnerable. > > Signed-off-by: Marek Behún <marek.behun@nic.cz> Applied to u-boot-marvell/master Thanks, Stefan > --- > board/CZ.NIC/turris_omnia/turris_omnia.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c > index b0391c973d..bac78af04e 100644 > --- a/board/CZ.NIC/turris_omnia/turris_omnia.c > +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c > @@ -434,6 +434,11 @@ int board_init(void) > /* address of boot parameters */ > gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; > > + return 0; > +} > + > +int board_late_init(void) > +{ > /* > * If not booting from UART, MCU watchdog was not disabled in SPL, > * disable it now. > @@ -441,11 +446,6 @@ int board_init(void) > if (get_boot_device() != BOOT_DEVICE_UART) > disable_mcu_watchdog(); > > - return 0; > -} > - > -int board_late_init(void) > -{ > set_regdomain(); > handle_reset_button(); > pci_init(); > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-09-01 9:14 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-16 13:19 [PATCH u-boot-mvebu v2 0/4] turris_omnia: Disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 1/4] arm: mvebu: Move get_boot_device() to cpu.c and make visible Marek Behún 2021-08-16 17:51 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 2/4] arm: mvebu: turris_omnia: don't guard by CONFIG_SPL_BUILD macro Marek Behún 2021-08-16 17:55 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 3/4] arm: mvebu: turris_omnia: disable MCU watchdog in SPL when booting over UART Marek Behún 2021-08-16 17:56 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:13 ` Stefan Roese 2021-08-16 13:19 ` [PATCH u-boot-mvebu v2 4/4] arm: mvebu: turris_omnia: disable MCU watchdog in board_late_init() Marek Behún 2021-08-16 17:56 ` Pali Rohár 2021-08-17 7:46 ` Stefan Roese 2021-09-01 9:14 ` Stefan Roese
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.