Message ID | 62e2c566f6f79950b8081f5d565d954e126ba13e.1675427201.git.jan.kiszka@siemens.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | IOT2050-related enhancements | expand |
On Fri, Feb 03, 2023 at 01:26:33PM +0100, Jan Kiszka wrote: > From: Jan Kiszka <jan.kiszka@siemens.com> > > Allows run-time control over watchdog auto-start and the timeout via > setting the environment variable watchdog_timeout_ms. A value of zero > means "do not start". Use CONFIG_WATCHDOG_TIMEOUT_MSECS as initial value > and this to zero by default. Users can then enable the watchdog once the > use and OS which picks it up during boot. > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> [snip] > diff --git a/include/configs/iot2050.h b/include/configs/iot2050.h > index 7d087413362..5186dfd8ff8 100644 > --- a/include/configs/iot2050.h > +++ b/include/configs/iot2050.h > @@ -15,6 +15,14 @@ > > /* SPL Loader Configuration */ > > +#define WATCHDOG_ENV \ > + "watchdog_timeout_ms=" __stringify(CONFIG_WATCHDOG_TIMEOUT_MSECS) "\0" \ > + "start_watchdog=if test ${watchdog_timeout_ms} -gt 0; then " \ > + "wdt dev watchdog@40610000; " \ > + "wdt start ${watchdog_timeout_ms}; " \ > + "echo Watchdog started, timeout ${watchdog_timeout_ms} ms; " \ > + "fi\0" > + > /* U-Boot general configuration */ > #define EXTRA_ENV_IOT2050_BOARD_SETTINGS \ > "usb_pgood_delay=900\0" > @@ -43,6 +51,7 @@ > #define CFG_EXTRA_ENV_SETTINGS \ > DEFAULT_LINUX_BOOT_ENV \ > BOOTENV \ > + WATCHDOG_ENV \ > EXTRA_ENV_IOT2050_BOARD_SETTINGS As a follow-up I would like to see all of this migrated to the plain text environment, see board/*/*/*.env for various more and less complex examples of this kind of conversion.
On 03.02.23 19:51, Tom Rini wrote: > On Fri, Feb 03, 2023 at 01:26:33PM +0100, Jan Kiszka wrote: > >> From: Jan Kiszka <jan.kiszka@siemens.com> >> >> Allows run-time control over watchdog auto-start and the timeout via >> setting the environment variable watchdog_timeout_ms. A value of zero >> means "do not start". Use CONFIG_WATCHDOG_TIMEOUT_MSECS as initial value >> and this to zero by default. Users can then enable the watchdog once the >> use and OS which picks it up during boot. >> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> > [snip] >> diff --git a/include/configs/iot2050.h b/include/configs/iot2050.h >> index 7d087413362..5186dfd8ff8 100644 >> --- a/include/configs/iot2050.h >> +++ b/include/configs/iot2050.h >> @@ -15,6 +15,14 @@ >> >> /* SPL Loader Configuration */ >> >> +#define WATCHDOG_ENV \ >> + "watchdog_timeout_ms=" __stringify(CONFIG_WATCHDOG_TIMEOUT_MSECS) "\0" \ >> + "start_watchdog=if test ${watchdog_timeout_ms} -gt 0; then " \ >> + "wdt dev watchdog@40610000; " \ >> + "wdt start ${watchdog_timeout_ms}; " \ >> + "echo Watchdog started, timeout ${watchdog_timeout_ms} ms; " \ >> + "fi\0" >> + >> /* U-Boot general configuration */ >> #define EXTRA_ENV_IOT2050_BOARD_SETTINGS \ >> "usb_pgood_delay=900\0" >> @@ -43,6 +51,7 @@ >> #define CFG_EXTRA_ENV_SETTINGS \ >> DEFAULT_LINUX_BOOT_ENV \ >> BOOTENV \ >> + WATCHDOG_ENV \ >> EXTRA_ENV_IOT2050_BOARD_SETTINGS > > As a follow-up I would like to see all of this migrated to the plain > text environment, see board/*/*/*.env for various more and less complex > examples of this kind of conversion. As I have to do a v6 anyway, let me check if this could be done quickly as well. Jan
diff --git a/configs/iot2050_pg1_defconfig b/configs/iot2050_pg1_defconfig index 28930aac5eb..6c6af35cdee 100644 --- a/configs/iot2050_pg1_defconfig +++ b/configs/iot2050_pg1_defconfig @@ -32,6 +32,7 @@ CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTSTAGE=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_SPL_SHOW_BOOT_PROGRESS=y +CONFIG_BOOTCOMMAND="run start_watchdog; run distro_bootcmd" CONFIG_CONSOLE_MUX=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_MAX_SIZE=0x58000 @@ -141,6 +142,7 @@ CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_KEYBOARD=y # CONFIG_WATCHDOG is not set # CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_WATCHDOG_TIMEOUT_MSECS=0 CONFIG_WDT=y CONFIG_WDT_K3_RTI=y CONFIG_WDT_K3_RTI_LOAD_FW=y diff --git a/configs/iot2050_pg2_defconfig b/configs/iot2050_pg2_defconfig index c76abcca672..43410160c8a 100644 --- a/configs/iot2050_pg2_defconfig +++ b/configs/iot2050_pg2_defconfig @@ -32,6 +32,7 @@ CONFIG_OF_BOARD_SETUP=y CONFIG_BOOTSTAGE=y CONFIG_SHOW_BOOT_PROGRESS=y CONFIG_SPL_SHOW_BOOT_PROGRESS=y +CONFIG_BOOTCOMMAND="run start_watchdog; run distro_bootcmd" CONFIG_CONSOLE_MUX=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_SPL_MAX_SIZE=0x58000 @@ -142,6 +143,7 @@ CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_KEYBOARD=y # CONFIG_WATCHDOG is not set # CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_WATCHDOG_TIMEOUT_MSECS=0 CONFIG_WDT=y CONFIG_WDT_K3_RTI=y CONFIG_WDT_K3_RTI_LOAD_FW=y diff --git a/include/configs/iot2050.h b/include/configs/iot2050.h index 7d087413362..5186dfd8ff8 100644 --- a/include/configs/iot2050.h +++ b/include/configs/iot2050.h @@ -15,6 +15,14 @@ /* SPL Loader Configuration */ +#define WATCHDOG_ENV \ + "watchdog_timeout_ms=" __stringify(CONFIG_WATCHDOG_TIMEOUT_MSECS) "\0" \ + "start_watchdog=if test ${watchdog_timeout_ms} -gt 0; then " \ + "wdt dev watchdog@40610000; " \ + "wdt start ${watchdog_timeout_ms}; " \ + "echo Watchdog started, timeout ${watchdog_timeout_ms} ms; " \ + "fi\0" + /* U-Boot general configuration */ #define EXTRA_ENV_IOT2050_BOARD_SETTINGS \ "usb_pgood_delay=900\0" @@ -43,6 +51,7 @@ #define CFG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \ BOOTENV \ + WATCHDOG_ENV \ EXTRA_ENV_IOT2050_BOARD_SETTINGS #include <configs/ti_armv7_common.h>