public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linus.walleij@stericsson.com,
	srinidhi.kasagar@stericsson.com, ulf.hansson@linaro.org,
	Mike Turquette <mturquette@linaro.org>
Subject: Re: [PATCH 21/21] clk: ux500: Supply provider look-up functionality to support Device Tree
Date: Mon, 03 Jun 2013 17:49:54 +0200	[thread overview]
Message-ID: <2458719.gboIs9CIQE@wuerfel> (raw)
In-Reply-To: <1370266965-7901-22-git-send-email-lee.jones@linaro.org>

On Monday 03 June 2013 14:42:45 Lee Jones wrote:
> In this patch we're populating a clk_data array, one clock per element to
> act as a clk look-up using indexes supplied from Device Tree.

This is the first time I actually take a closer look at clock bindings.
It feels odd to have a single index when you have multiple clock
providers in hardware.

> +struct clk *clks[CLK_MAX];
> +
> +const static struct of_device_id u8500_clk_of_match[] = {
> +	{ .compatible = "stericsson,u8500-clk", },
> +	{ },
> +};

>From the code in drivers/clk/ux500, I would have expected two separate
clock nodes: the prcmu and the prcc, each with their own number
space.

>  void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
>  		    u32 clkrst5_base, u32 clkrst6_base)
>  {
>  	struct prcmu_fw_version *fw_version;
>  	const char *sgaclk_parent = NULL;
> +	static struct clk_onecell_data clk_data;
> +	struct device_node *np = NULL;
>  	struct clk *clk;
>  
>  	/* Clock sources */
>  	clk = clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0,
>  				CLK_IS_ROOT|CLK_IGNORE_UNUSED);
>  	clk_register_clkdev(clk, "soc0_pll", NULL);
> +	clks[soc0_pll] = clk;
>  
>  	clk = clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1,
>  				CLK_IS_ROOT|CLK_IGNORE_UNUSED);
>  	clk_register_clkdev(clk, "soc1_pll", NULL);
> +	clks[soc1_pll] = clk;
>  
>  	clk = clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR,
>  				CLK_IS_ROOT|CLK_IGNORE_UNUSED);
>  	clk_register_clkdev(clk, "ddr_pll", NULL);
> +	clks[ddr_pll] = clk;

It seems the actual numbers for the PCRMU clocks are defined
in drivers/mfd/dbx500-prcmu-regs.h, at PRCM_ACLK_MGT through
PRCM_MSP1CLK_MGT, where each clock has its own register.

> @@ -218,106 +296,130 @@ void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
>  	clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", clkrst1_base,
>  				BIT(0), 0);
>  	clk_register_clkdev(clk, "apb_pclk", "uart0");
> +	clks[uart0] = clk;
>  
>  	clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", clkrst1_base,
>  				BIT(1), 0);
>  	clk_register_clkdev(clk, "apb_pclk", "uart1");
> +	clks[uart1] = clk;
>  
>  	clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", clkrst1_base,
>  				BIT(2), 0);
>  	clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.1");
> +	clks[nmk_i2c1] = clk;

The prcc clocks are inherently numbered, there is a set of six
registers with 8 bits each, so the number you use can simply
be the index from 0 to 48, or use #clock-cells=<2> and pass both.
Using the same numbers as the hardware in the binding is much less
ambiguous than making up your own number space that you have to
then document in the binding and update every time a new chip
gets released.

	Arnd

  reply	other threads:[~2013-06-03 15:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 13:42 [PATCH 00/21] ARM: ux500: Enable Clock look-up from Device Tree Lee Jones
2013-06-03 13:42 ` [PATCH 01/21] ARM: ux500: Supply the PRCMU Clock node Lee Jones
2013-06-03 13:42 ` [PATCH 02/21] ARM: ux500: Supply the Ethernet clock lookup to Snowball's DT Lee Jones
2013-06-03 13:42 ` [PATCH 03/21] ARM: ux500: Supply the TWD Timer clock lookup to the DBX500 DT Lee Jones
2013-06-03 13:42 ` [PATCH 04/21] ARM: ux500: Supply the RTC " Lee Jones
2013-06-03 13:42 ` [PATCH 05/21] ARM: ux500: Supply the GPIO clocks " Lee Jones
2013-06-03 13:42 ` [PATCH 06/21] ARM: ux500: Supply the USB clock " Lee Jones
2013-06-03 13:42 ` [PATCH 07/21] ARM: ux500: Supply the DMA " Lee Jones
2013-06-03 13:42 ` [PATCH 08/21] ARM: ux500: Supply the I2C clocks " Lee Jones
2013-06-03 13:54   ` Arnd Bergmann
2013-06-03 14:27     ` Lee Jones
2013-06-03 15:29       ` Arnd Bergmann
2013-06-03 13:42 ` [PATCH 09/21] ARM: ux500: Supply the UART " Lee Jones
2013-06-03 13:50   ` Arnd Bergmann
2013-06-03 13:42 ` [PATCH 10/21] ARM: ux500: Supply the SDI (MMC) " Lee Jones
2013-06-03 13:42 ` [PATCH 11/21] ARM: ux500: Supply the MSP (Audio) " Lee Jones
2013-06-03 13:42 ` [PATCH 12/21] ARM: ux500: Remove AUXDATA relating to GPIO clock-name bindings Lee Jones
2013-06-03 13:42 ` [PATCH 13/21] ARM: ux500: Remove AUXDATA relating to UART " Lee Jones
2013-06-03 13:42 ` [PATCH 14/21] ARM: ux500: Remove AUXDATA relating to SDI (MMC) " Lee Jones
2013-06-03 13:42 ` [PATCH 15/21] ARM: ux500: Remove AUXDATA relating to I2C " Lee Jones
2013-06-03 13:42 ` [PATCH 16/21] ARM: ux500: Remove AUXDATA relating to MSP (Audio) " Lee Jones
2013-06-03 13:42 ` [PATCH 17/21] ARM: ux500: Remove AUXDATA relating to USB " Lee Jones
2013-06-03 13:42 ` [PATCH 18/21] ARM: ux500: Remove AUXDATA relating to Ethernet " Lee Jones
2013-06-03 13:42 ` [PATCH 19/21] ARM: ux500: Remove AUXDATA relating to DMA " Lee Jones
2013-06-03 13:42 ` [PATCH 20/21] ARM: ux500: Reclassify PRCMU AUXDATA entry Lee Jones
2013-06-03 13:42 ` [PATCH 21/21] clk: ux500: Supply provider look-up functionality to support Device Tree Lee Jones
2013-06-03 15:49   ` Arnd Bergmann [this message]
2013-06-04 10:57   ` Linus Walleij
2013-06-04 20:52     ` Arnd Bergmann
2013-06-05  8:05       ` Lee Jones
2013-06-11 20:28       ` Mike Turquette
2013-06-12 12:56     ` Grant Likely
2013-06-10 21:05 ` [PATCH 00/21] ARM: ux500: Enable Clock look-up from " Ulf Hansson
2013-06-11 10:01   ` Lee Jones
2013-06-11 12:07     ` Ulf Hansson

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=2458719.gboIs9CIQE@wuerfel \
    --to=arnd@arndb.de \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=srinidhi.kasagar@stericsson.com \
    --cc=ulf.hansson@linaro.org \
    /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