[PATCH v1 2/4] ARM: rpi: move clk support to a separate driver and enable deep-probe
Sascha Hauer
sha at pengutronix.de
Mon Jan 17 23:57:33 PST 2022
On Mon, Jan 17, 2022 at 01:04:58PM +0100, Oleksij Rempel wrote:
> To make deep-probe work properly, we need clock support be registered as
> driver to related device.
>
> To avoid regression, deep-probe is enabled in the same patch.
>
> Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
> ---
> arch/arm/boards/raspberry-pi/rpi-common.c | 75 +-----------------
> drivers/clk/Makefile | 1 +
> drivers/clk/clk-rpi.c | 93 +++++++++++++++++++++++
> 3 files changed, 96 insertions(+), 73 deletions(-)
> create mode 100644 drivers/clk/clk-rpi.c
>
> +static int bcm2835_cprman_init(struct device_node *np)
> +{
> + struct device_node *mbox_node;
> + struct clk *clk;
> + int ret;
> +
> + mbox_node = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-mbox");
> + if (!mbox_node) {
> + pr_err("Missing mbox node\n");
> + return -ENOENT;
> + }
> +
> + ret = of_device_ensure_probed(mbox_node);
> + if (ret) {
> + pr_err("Can't probe mbox node. %i\n", ret);
> + return ret;
> + }
> +
> + clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
> + "bcm2835_mci0");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + clkdev_add_physbase(clk, 0x20300000, NULL);
> + clkdev_add_physbase(clk, 0x3f300000, NULL);
> +
> + clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE,
> + "bcm2835_sdhost");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + clkdev_add_physbase(clk, 0x20202000, NULL);
> + clkdev_add_physbase(clk, 0x3f202000, NULL);
> +
> + clk = clk_fixed("apb_pclk", 0);
> + clk_register_clkdev(clk, "apb_pclk", NULL);
> +
> + clk = clk_fixed("uart0-pl0110", 48 * 1000 * 1000);
> + clk_register_clkdev(clk, NULL, "uart0-pl0110");
> + clkdev_add_physbase(clk, BCM2835_PL011_BASE, NULL);
> + clkdev_add_physbase(clk, BCM2836_PL011_BASE, NULL);
> +
> + clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE,
> + "uart1-8250");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + clkdev_add_physbase(clk, BCM2835_MINIUART_BASE, NULL);
> + clkdev_add_physbase(clk, BCM2836_MINIUART_BASE, NULL);
> +
> + clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
> + clk_register_clkdev(clk, NULL, "bcm2835-cs");
> +
> + return 0;
> +}
> +/* CLK_OF_DECLARE should be used to make it probed before amba,pl011 */
We should finally switch to device tree based lookup for the clocks.
Given where we are already this seems to be only a small step left to
go.
Sascha
> +CLK_OF_DECLARE(bcm2835_cprman, "brcm,bcm2835-cprman", bcm2835_cprman_init);
> --
> 2.30.2
>
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list