[PATCH 14/18] sparc32,leon: describe legacy AMBA I2C controllers

From: Magnus Lindholm

Date: Thu Nov 26 2026 - 04:31:53 EST


Describe I2CMST controllers discovered from legacy GRLIB plug-and-play
with the compatible string, register spacing and input clock required
by i2c-ocores. Do not infer attached peripherals from the ASIC system ID;
RTC instantiation needs reliable board-specific information.

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

diff --git a/arch/sparc/kernel/leon_legacy.c b/arch/sparc/kernel/leon_legacy.c
index a9364708e231..fa978620f4a6 100644
--- a/arch/sparc/kernel/leon_legacy.c
+++ b/arch/sparc/kernel/leon_legacy.c
@@ -201,6 +201,18 @@ static bool __init legacy_clocks(int cpu_bus)
return true;
}

+static void __init legacy_i2c(struct device_node *np, u32 freq)
+{
+ legacy_property(np, "compatible", "aeroflexgaisler,i2cmst",
+ sizeof("aeroflexgaisler,i2cmst"));
+ legacy_u32(np, "reg-shift", 2);
+ legacy_u32(np, "reg-io-width", 4);
+ legacy_u32(np, "opencores,ip-clock-frequency", freq);
+ legacy_u32(np, "clock-frequency", 100000);
+ legacy_u32(np, "#address-cells", 1);
+ legacy_u32(np, "#size-cells", 0);
+}
+
static void __init legacy_device(struct device_node *bus, u32 id, u32 freq,
__be32 *regs, unsigned int count)
{
@@ -235,6 +247,8 @@ static void __init legacy_device(struct device_node *bus, u32 id, u32 freq,
legacy_u32(np, "version", (id >> 5) & 0x1f);
if (irq)
legacy_u32(np, "interrupts", irq);
+ if (legacy_is(id, GAISLER_I2CMST))
+ legacy_i2c(np, freq);
pr_info("LEON PnP: %s at %08x irq %u clock %u\n", name,
be32_to_cpu(regs[0]), irq, freq);
}
--
2.43.0