[PATCH v8 12/12] firmware: raspberrypi: use drvdata to register rtc driver

From: Gregor Herburger

Date: Tue Nov 10 2026 - 11:49:28 EST


There are two bcm2712 steppings available that are not compatible.
Therefore we have "raspberrypi,5-model-b-d0" and
"raspberrypi,5-model-b". Some features of the Raspberry Pi are only
available on the 5th generation, e.g. the private OTP register and the
RTC clock.

Use the newly added fw->soc data to decide whether to register the rtc
driver.

Signed-off-by: Gregor Herburger <gregor.herburger@xxxxxxxxxxxxx>
---
drivers/firmware/raspberrypi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index 755f845754c1c..0cf893eb8b786 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -237,13 +237,14 @@ static void rpi_register_clk_driver(struct device *dev)

static void rpi_register_rtc_driver(struct device *dev)
{
+ struct rpi_firmware *fw = dev_get_drvdata(dev);
struct platform_device *pdev;

/*
* Check if our model of Raspberry Pi board is from the 5th gen
* as the RTC is only present on that model.
*/
- if (!of_machine_is_compatible("brcm,bcm2712"))
+ if (fw->soc != RPI_FIRMWARE_SOC_BCM2712)
return;

pdev = platform_device_register_data(dev, "raspberrypi-rtc",

--
2.47.3