mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v1 2/4] ARM: rpi: move clk support to a separate driver and enable deep-probe
Date: Tue, 18 Jan 2022 08:57:33 +0100	[thread overview]
Message-ID: <20220118075733.GE23490@pengutronix.de> (raw)
In-Reply-To: <20220117120500.3556703-2-o.rempel@pengutronix.de>

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@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@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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-01-18  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 12:04 [PATCH v1 1/4] ARM: rpi: convert board code to a driver Oleksij Rempel
2022-01-17 12:04 ` [PATCH v1 2/4] ARM: rpi: move clk support to a separate driver and enable deep-probe Oleksij Rempel
2022-01-18  7:57   ` Sascha Hauer [this message]
2022-01-17 12:04 ` [PATCH v1 3/4] ARM: rpi: validate devicetree compatible instead of changing model name Oleksij Rempel
2022-01-17 20:14   ` Trent Piepho
2022-01-17 12:05 ` [PATCH v1 4/4] ARM: rpi: set host name based on DT compatible Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220118075733.GE23490@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox