This series provides a fix for wdt_start() function, which can print incorrect timeout values in cases where the function is called with a timeout value greater than the hardware-supported maximum. The current implementation prints the value the user requested, so e.g. the console print may show that watchdog timeout is set at 60 seconds when the timeout was in practice clamped to 10 seconds by the device.
The series introduces a get_timeout operation in the watchdog uclass, which is used in the start-path console print, exposes the operation with wdt gettimeout shell command, and implements the operation in sbsa_gwdt, octeontx_wdt and sandbox_wdt drivers. This fix improves the overall correctness of the console output, and can be helpful in debugging cases so the console prints reflect the real timeout on the device when the operation is supported. If the operation is unsupported on the device, the print remains as it was before. Patch summary: - Patch 1: Add a get_timeout operation and wdt_get_timeout helper function for wdt-uclass. Update the wdt_start function to use this helper. - Patch 2: Add a gettimeout subcommand to the wdt command in cmd/wdt.c which exposes the wdt_get_timeout helper to the shell interface. - Patch 3: Implement the get_timeout operation for sbsa_gwdt - Patch 4: Implement the operation for octeontx_wdt - Patch 5: Implement the operation for sandbox_wdt - Patch 6: Implement a test for the wdt_get_timeout helper Signed-off-by: Juuso Rinta <[email protected]> --- Juuso Rinta (6): watchdog: wdt-uclass: add get_timeout operation and helper cmd: wdt: add gettimeout command watchdog: sbsa_gwdt: add get_timeout operation watchdog: octeontx_wdt: add get_timeout operation watchdog: sandbox_wdt: add get_timeout operation test: wdt: add a test for wdt_get_timeout cmd/wdt.c | 26 ++++++++++++++++++++++++++ drivers/watchdog/octeontx_wdt.c | 17 ++++++++++++++++- drivers/watchdog/sandbox_wdt.c | 9 +++++++++ drivers/watchdog/sbsa_gwdt.c | 11 +++++++++++ drivers/watchdog/wdt-uclass.c | 35 +++++++++++++++++++++++++++++++++-- include/wdt.h | 22 ++++++++++++++++++++++ test/dm/wdt.c | 4 ++++ 7 files changed, 121 insertions(+), 3 deletions(-) --- base-commit: 5a7117b0a2e3f41475945a4443a4e3adf8799024 change-id: 20260427-rinta-watchdog-gettime-6ae2e0a76983 Best regards, -- Juuso Rinta <[email protected]>

