summaryrefslogtreecommitdiffstats
path: root/drivers/clk
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-06-09 07:59:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-06-17 08:28:55 +0200
commit23c160091076319da6e3e0b302aa8d36c7ac64af (patch)
treef430a487a2e8083049b634b64382812cb727363c /drivers/clk
parent30e6f9027e2b15536a4e85878406f0c056f55b10 (diff)
downloadbarebox-23c160091076319da6e3e0b302aa8d36c7ac64af.tar.gz
barebox-23c160091076319da6e3e0b302aa8d36c7ac64af.tar.xz
clk: rpi: add Raspberry Pi 4 support
Our Raspberry Pi clock driver is a hack, but it works well enough for older Rpis and just needs one more clock to support the SD-Card on the Raspberry Pi 4, so add that. In return, we remove bcm2835-cs, which we won't use on Raspberry Pi 4, because we'll leverage the ARM architected timer instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220609055922.667016-16-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk-rpi.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/drivers/clk/clk-rpi.c b/drivers/clk/clk-rpi.c
index 59ae8e59ba..71badc04c0 100644
--- a/drivers/clk/clk-rpi.c
+++ b/drivers/clk/clk-rpi.c
@@ -40,10 +40,29 @@ static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
}
-static int bcm2835_cprman_probe(struct device_d *dev)
+static int bcm2835_cprman_init(struct device_d *dev)
{
struct clk *clk_cs;
+ clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
+ clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
+
+ return 0;
+}
+
+static int rpi_cprman_probe(struct device_d *dev)
+{
+ int (*init)(struct device_d *dev);
+
+ init = device_get_match_data(dev);
+ if (init) {
+ int ret;
+
+ ret = init(dev);
+ if (ret)
+ return ret;
+ }
+
clks[BCM2835_CLOCK_EMMC] =
rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
"bcm2835_mci0");
@@ -56,12 +75,15 @@ static int bcm2835_cprman_probe(struct device_d *dev)
if (IS_ERR(clks[BCM2835_CLOCK_VPU]))
return PTR_ERR(clks[BCM2835_CLOCK_VPU]);
+ clks[BCM2711_CLOCK_EMMC2] =
+ rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC2,
+ "bcm2711_emmc2");
+ if (IS_ERR(clks[BCM2711_CLOCK_EMMC2]))
+ return PTR_ERR(clks[BCM2711_CLOCK_EMMC2]);
+
clks[BCM2835_CLOCK_UART] = clk_fixed("uart0-pl0110", 48 * 1000 * 1000);
clk_register_clkdev(clks[BCM2835_CLOCK_UART], NULL, "uart0-pl0110");
- clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
- clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
-
clk_data.clks = clks;
clk_data.clk_num = BCM2711_CLOCK_END;
of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data);
@@ -70,16 +92,14 @@ static int bcm2835_cprman_probe(struct device_d *dev)
}
static __maybe_unused struct of_device_id bcm2835_cprman_dt_ids[] = {
- {
- .compatible = "brcm,bcm2835-cprman",
- }, {
- /* sentinel */
- }
+ { .compatible = "brcm,bcm2835-cprman", .data = bcm2835_cprman_init },
+ { .compatible = "brcm,bcm2711-cprman" },
+ { /* sentinel */ }
};
static struct driver_d bcm2835_cprman_driver = {
- .probe = bcm2835_cprman_probe,
- .name = "bcm2835-cprman",
+ .probe = rpi_cprman_probe,
+ .name = "raspberrypi-cprman",
.of_compatible = DRV_OF_COMPAT(bcm2835_cprman_dt_ids),
};
core_platform_driver(bcm2835_cprman_driver);