[PATCHv3 2/2] watchdog: pika_wdt: enable COMPILE_TEST builds
From: Rosen Penev
Date: Mon Jun 08 2026 - 17:05:05 EST
Replace powerpc-specific I/O accessors (in_be32/out_be32) with
generic ones (ioread32be/iowrite32be) so the driver can be
compile-tested on other architectures. Relax the Kconfig
dependency accordingly and add the required HAS_IOMEM.
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/watchdog/Kconfig | 3 ++-
drivers/watchdog/pika_wdt.c | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 8319c503319a..855736eaca2c 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -2040,7 +2040,8 @@ config 8xxx_WDT
config PIKA_WDT
tristate "PIKA FPGA Watchdog"
- depends on WARP || (PPC64 && COMPILE_TEST)
+ depends on WARP || COMPILE_TEST
+ depends on HAS_IOMEM
default WARP
help
This enables the watchdog in the PIKA FPGA. Currently used on
diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c
index d567103ec5e4..e599aff8329b 100644
--- a/drivers/watchdog/pika_wdt.c
+++ b/drivers/watchdog/pika_wdt.c
@@ -77,10 +77,10 @@ static inline void pikawdt_reset(void)
* seconds. Valid ranges are 1 to 15 seconds. The value can
* be modified dynamically.
*/
- unsigned reset = in_be32(pikawdt_private.fpga + 0x14);
+ unsigned reset = ioread32be(pikawdt_private.fpga + 0x14);
/* enable with max timeout - 15 seconds */
reset |= (1 << 7) + (WDT_HW_TIMEOUT << 8);
- out_be32(pikawdt_private.fpga + 0x14, reset);
+ iowrite32be(reset, pikawdt_private.fpga + 0x14);
}
/*
@@ -243,7 +243,7 @@ static int __init pikawdt_init(void)
return -ENOMEM;
}
- ident.firmware_version = in_be32(pikawdt_private.fpga + 0x1c) & 0xffff;
+ ident.firmware_version = ioread32be(pikawdt_private.fpga + 0x1c) & 0xffff;
/* POST information is in the sd area. */
np = of_find_compatible_node(NULL, NULL, "pika,fpga-sd");
@@ -265,7 +265,7 @@ static int __init pikawdt_init(void)
* Bit 31, WDOG: Set to 1 when the last reset was caused by a watchdog
* timeout.
*/
- post1 = in_be32(fpga + 0x40);
+ post1 = ioread32be(fpga + 0x40);
if (post1 & 0x80000000)
pikawdt_private.bootstatus = WDIOF_CARDRESET;
--
2.54.0