rockchip: odroid-m1/m1s/rk3566 watchdog support
Subsystems (3)
v5 cover rockchip: odroid-m1/m1s/rk3566 watchdog support
New maintainer, new list, new luck :). Here goes:
This series makes the Synopsys DesignWare watchdog usable on rk3566/rk3568 and enables it on the Hardkernel ODROID-M1 and ODROID-M1S.
On current next the dw-wdt driver already probes (d62801d09441), but a timeout or "wdt expire" still hangs the SoC: CRU_GLB_RST_CON routes the watchdog to the second global reset by default, which causes a hung SoC.
Patch 1 routes the watchdog to the first global reset instead, same as the PX30 implementation. Patch 2 does the same for the TSADC, so a thermal shutdown also resets the whole SoC. Patch 3 makes the dw-wdt driver the default for the rk3566/rk3568 family. Patch 4 enables the watchdog (wdt command only, no autostart to be non-breaking) on the ODROID-M1 and ODROID-M1S.
Verified on the ODROID-M1S (RK3566): a watchdog timeout cleanly reboots the board.
Changes in v5:
- rebased on current main and resubmitted
- no code change
Changes in v4:
- patch 3 (new): imply DESIGNWARE_WATCHDOG for the rk3568 family instead of enabling the driver per board (review comment by Jonas)
- patch 4 (was 3/3): enable the watchdog on both ODROID-M1 and M1S, not just M1S (review comment by Jonas); dropped Quentin's Reviewed-by as the patch changed
Changes in v3:
- patch 1: keep the glb_rst_con write inside CONFIG_XPL_BUILD (review comment by Jonas)
- patch 2: fold the WDT and TSADC bits into a single glb_rst_con read-modify-write instead of two separate ones (review comment by Jonas)
Changes in v2:
- patch 1: access CRU_GLB_RST_CON through the rk3568_cru struct, matching PX30's arch_cpu_init() (review comment by Quentin)
- patch 2 (new): also route the TSADC to a first global reset (review comment by Quentin)
Andreas Zdziarstek (4):
rockchip: rk3568: make the WDT trigger a first global reset
rockchip: rk3568: make the TSADC trigger a first global reset
rockchip: rk3568: imply DESIGNWARE_WATCHDOG
rockchip: odroid-m1/m1s: enable watchdog support
arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/rk3568/rk3568.c | 11 +++++++++++ configs/odroid-m1-rk3568_defconfig | 4 ++++ configs/odroid-m1s-rk3566_defconfig | 4 ++++ 4 files changed, 20 insertions(+)
Signature · 1 line
2.53.0
PATCH v5 1/4 rockchip: rk3568: make the WDT trigger a first global reset
Default is a second global reset which causes a system hang on a timeout in U-Boot.
Access the register through the rk3568_cru struct to match how PX30 does it in arch_cpu_init().
Verified on the Hardkernel ODROID-M1S (RK3566): a watchdog timeout now cleanly reboots the board.
--- arch/arm/mach-rockchip/rk3568/rk3568.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/mach-rockchip/rk3568/rk3568.c +9 -0
@@ -9,6 +9,7 @@#include <misc.h> #include <asm/armv8/mmu.h> #include <asm/arch-rockchip/bootrom.h> +#include <asm/arch-rockchip/cru_rk3568.h> #include <asm/arch-rockchip/grf_rk3568.h> #include <asm/arch-rockchip/hardware.h> #include <dt-bindings/clock/rk3568-cru.h>
@@ -37,6 +38,9 @@#define CPU_GRF_BASE 0xfdc30000#define GRF_CORE_PVTPLL_CON0 (0x10) +#define CRU_BASE 0xfdd20000 +#define WDT_GLB_SRST_CTRL BIT(1) +/* PMU_GRF_GPIO0D_IOMUX_L */ enum {GPIO0D1_SHIFT =4 ,
@@ -117,6 +121,8 @@ void board_debug_uart_init(void)int arch_cpu_init (void ) {#ifdef CONFIG_XPL_BUILD +static struct rk3568_cru *const cru = (void *)CRU_BASE ; +/* * When perform idle operation, corresponding clock can * be opened or gated automatically.
@@ -145,6 +151,9 @@ int arch_cpu_init(void)/* Enable VO power domain for display */ writel ((PMU_PD_VO_DWN_ENA <<16 ),PMU_BASE_ADDR +PMU_PWR_GATE_SFTCON ); + +/* Make WDT trigger a first global reset */ +setbits_le32 (&cru->glb_rst_con,WDT_GLB_SRST_CTRL );#endif return 0 ; }
Signature · 1 line
2.53.0
PATCH v5 2/4 rockchip: rk3568: make the TSADC trigger a first global reset
In reply to Andreas ZdziarstekSame rationale as the watchdog: the default second global reset leaves the SoC hung. Set the TSADC to the first global reset as well, so a thermal shutdown reliably resets the whole SoC.
--- arch/arm/mach-rockchip/rk3568/rk3568.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/rk3568/rk3568.c +4 -2
@@ -40,6 +40,7 @@#define CRU_BASE 0xfdd20000#define WDT_GLB_SRST_CTRL BIT(1) +#define TSADC_GLB_SRST_CTRL BIT(0)/* PMU_GRF_GPIO0D_IOMUX_L */ enum {
@@ -152,8 +153,9 @@ int arch_cpu_init(void)writel ((PMU_PD_VO_DWN_ENA <<16 ),PMU_BASE_ADDR +PMU_PWR_GATE_SFTCON ); -/* Make WDT trigger a first global reset */ -setbits_le32 (&cru->glb_rst_con,WDT_GLB_SRST_CTRL ); +/* Make WDT and TSADC trigger a first global reset */ +setbits_le32 (&cru->glb_rst_con, +WDT_GLB_SRST_CTRL |TSADC_GLB_SRST_CTRL );#endif return 0 ; }
Signature · 1 line
2.53.0
PATCH v5 3/4 rockchip: rk3568: imply DESIGNWARE_WATCHDOG
In reply to Andreas ZdziarstekThe rk3566/rk3568 has a DesignWare watchdog, so make its driver the default for the SoC family The imply only takes effect once a board enables CONFIG_WDT, so it does not change any existing board.
--- arch/arm/mach-rockchip/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -426,6 +426,7 @@ config ROCKCHIP_RK3568 select DM_REGULATOR_FIXED select DM_RESET imply BOOTSTD_FULL + imply DESIGNWARE_WATCHDOG imply DM_RNG imply MISC_INIT_R imply MMC_HS200_SUPPORT if MMC_SDHCI_ROCKCHIP
Signature · 1 line
2.53.0
PATCH v5 4/4 rockchip: odroid-m1/m1s: enable watchdog support
In reply to Andreas ZdziarstekThe rk3566 ODROID-M1S and rk3568 ODROID-M1 have a DesignWare watchdog. Enable CONFIG_WDT and CONFIG_CMD_WDT so it can be driven via the wdt command. The driver itself is pulled in by the SoC's imply DESIGNWARE_WATCHDOG.
CONFIG_WATCHDOG and CONFIG_WATCHDOG_AUTOSTART are left explicitly unset to not cause any breaking changes on existing systems.
--- configs/odroid-m1-rk3568_defconfig | 4 ++++ configs/odroid-m1s-rk3566_defconfig | 4 ++++ 2 files changed, 8 insertions(+)
configs/odroid-m1-rk3568_defconfig +4 -0
@@ -37,6 +37,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y CONFIG_CMD_USB=y +CONFIG_CMD_WDT=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_INI=y CONFIG_CMD_PMIC=y
@@ -92,5 +93,8 @@ CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GENERIC=y +# CONFIG_WATCHDOG is not set +# CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_WDT=y CONFIG_FS_CRAMFS=y CONFIG_ERRNO_STR=y
configs/odroid-m1s-rk3566_defconfig +4 -0
@@ -30,6 +30,7 @@ CONFIG_CMD_PCI=y CONFIG_CMD_USB=y CONFIG_CMD_ROCKUSB=y CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_WDT=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_INI=y CONFIG_CMD_PMIC=y
@@ -87,5 +88,8 @@ CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_FUNCTION_ROCKUSB=y +# CONFIG_WATCHDOG is not set +# CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_WDT=y CONFIG_FS_CRAMFS=y CONFIG_ERRNO_STR=y
Signature · 1 line
2.53.0