[PATCH 18/18] sparc32,leon: describe the DS1672 on the GR-LEON4-ITX

From: Magnus Lindholm

Date: Thu Nov 26 2026 - 04:32:05 EST


The factory PROM omits the RTC on I2CM0. Add an rtc@68 child to the
controller at 0xc0000700 when the legacy ITX check matches, so the
DS1672 driver can register the hardware clock at boot.

Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/kernel/leon_legacy.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/leon_legacy.c b/arch/sparc/kernel/leon_legacy.c
index d4b3c48a4a10..f9fb35c3bb06 100644
--- a/arch/sparc/kernel/leon_legacy.c
+++ b/arch/sparc/kernel/leon_legacy.c
@@ -32,6 +32,7 @@
#define ITX_DDR_END 0x50000000
#define ITX_DDR2CFG1 0xffe00100
#define ITX_GRVGA 0xc0800000
+#define ITX_I2CM0 0xc0000700

struct legacy_bus {
u32 area;
@@ -262,8 +263,10 @@ static bool __init legacy_clocks(int cpu_bus)
return true;
}

-static void __init legacy_i2c(struct device_node *np, u32 freq)
+static void __init legacy_i2c(struct device_node *np, u32 freq, u32 addr)
{
+ struct device_node *rtc;
+
legacy_property(np, "compatible", "aeroflexgaisler,i2cmst",
sizeof("aeroflexgaisler,i2cmst"));
legacy_u32(np, "reg-shift", 2);
@@ -272,6 +275,14 @@ static void __init legacy_i2c(struct device_node *np, u32 freq)
legacy_u32(np, "clock-frequency", 100000);
legacy_u32(np, "#address-cells", 1);
legacy_u32(np, "#size-cells", 0);
+
+ /* The GR-LEON4-ITX wires its DS1672 to I2CM0 (board manual, 2.14). */
+ if (leon_legacy_is_itx() && addr == ITX_I2CM0) {
+ rtc = legacy_node(np, "rtc", "rtc@68");
+ legacy_property(rtc, "compatible", "dallas,ds1672",
+ sizeof("dallas,ds1672"));
+ legacy_u32(rtc, "reg", 0x68);
+ }
}

static void __init legacy_device(struct device_node *bus, u32 id, u32 freq,
@@ -309,7 +320,7 @@ static void __init legacy_device(struct device_node *bus, u32 id, u32 freq,
if (irq)
legacy_u32(np, "interrupts", irq);
if (legacy_is(id, GAISLER_I2CMST))
- legacy_i2c(np, freq);
+ legacy_i2c(np, freq, addr);
pr_info("LEON PnP: %s at %08x irq %u clock %u\n", name,
be32_to_cpu(regs[0]), irq, freq);
}
--
2.43.0