From: Mark Rutland <mark.rutland@arm.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Linus WALLEIJ <linus.walleij@stericsson.com>,
Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 09/33] ARM: ux500: Supply the I2C clocks lookup to the DBX500 DT
Date: Thu, 22 Aug 2013 17:04:43 +0100 [thread overview]
Message-ID: <20130822160443.GG23152@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <20130822154116.GC17154@lee--X1>
On Thu, Aug 22, 2013 at 04:41:16PM +0100, Lee Jones wrote:
> On Thu, 22 Aug 2013, Mark Rutland wrote:
>
> > On Thu, Aug 22, 2013 at 03:19:00PM +0100, Lee Jones wrote:
> > > On Thu, 22 Aug 2013, Mark Rutland wrote:
> > >
> > > > On Tue, Aug 20, 2013 at 10:30:34AM +0100, Sascha Hauer wrote:
> > > > > On Tue, Aug 20, 2013 at 11:11:19AM +0200, Linus Walleij wrote:
> > > > > > On Thu, Jun 6, 2013 at 2:16 PM, Lee Jones <lee.jones@linaro.org> wrote:
> > > > > >
> > > > > > > +++ b/arch/arm/boot/dts/dbx5x0.dtsi
> > > > > > > @@ -572,6 +572,8 @@
> > > > > > > v-i2c-supply = <&db8500_vape_reg>;
> > > > > > >
> > > > > > > clock-frequency = <400000>;
> > > > > > > + clocks = <&prcc_kclk 3 3>, <&prcc_pclk 3 3>;
> > > > > > > + clock-names = "nmk-i2c.0", "apb_pclk";
> > > > >
> > > > > Why do most clocks in this series have the instance number in the clock
> > > > > names? This looks very wrong to me.
> > > >
> > > > +1. The clock names should be the input names to the unit, they
> > > > shouldn't vary per instance.
> > >
> > > So I just had a quick look, and it looks like they each have their own
> > > clock:
> > >
> > > clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
> > > clkrst1_base, BIT(2), CLK_SET_RATE_GATE);
> > > clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
> > > clkrst1_base, BIT(6), CLK_SET_RATE_GATE);
> > > clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
> > > clkrst2_base, BIT(0), CLK_SET_RATE_GATE);
> > > clk_register_clkdev(clk, NULL, "nmk-i2c.3");
> > >
> > > /* etc */
> > >
> > > When using the names in Device Tree it doesn't actually matter what
> > > you call the first clock. You can call it "fred" if you wanted and it
> > > would still work, but in light of the naming conventions above and the
> > > fact that each clock can all be controlled independently, do we still
> > > want to use the name of the parent clock i.e. i2cclk?
> >
> > Sorry, I don't follow.
> >
> >
> > The name should be the name of the clock _input_ on the block described,
> > as should be listed in documentation for the i2c block. The name should
> > not vary with instance, and the name should not (necessarily) match the
> > _output_ of the provider. Surely there's documentation for the i2c block
> > that gives a name for the clock input(s)?
>
> It's okay, I've fixed the patches.
Ok.
>
> Linus, branch fixed-up and pushed.
>
> > On a related note, I see that this doesn't follow the primecell clock
> > bindings, which seem to rely on "apb_pclk" being first in the list. I
> > see that other primecell device bindings don't follow that in dts or
> > drivers, so I'm not sure how to fix that brokenness.
>
> To which bindings do you refer? After taking a *quick* look, I see it
> being the other way around. Whenever the "apb_pclk" is requested, it
> is done so by name:
>
> drivers/amba/bus.c: struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
>
> So when clk_get() calls of_clk_get_by_name(), the clock-name index is
> returned correctly by of_property_match_string(), which then passes
> that index through of_clk_get() and does the right thing.
>
> When most of the other clocks that we deal with are being requested,
> they rely on being index zero:
>
> drivers/i2c/busses/i2c-nomadik.c: dev->clk = clk_get(&adev->dev, NULL);
>
> At the moment this works for us, so I don't think we need to go
> around populating the name params, but we might have to if this falls
> apart in some way (probably likely if you 'fixed' whatever brokenness
> you're wanting to fix ;-) )
The brokenness here is that the binding document states one thing, and
drivers do precisely the opposite.
Documentation/devicetree/bindings/arm/primecell.txt states:
- clocks : From common clock binding. First clock is phandle to clock for apb
pclk. Additional clocks are optional and specific to those peripherals.
- clock-names : From common clock binding. Shall be "apb_pclk" for first clock.
Yet as you've pointed out above we don't care which index apb_pblk is,
but do for the other clock, which we get at index 0 (where the binding
doc states apb_pclk should be).
If all users are doing that currently, it's possible to fix up the
binding document. If not, then it's a mess that can't be corrected...
Thanks,
Mark.
next prev parent reply other threads:[~2013-08-22 16:05 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 12:16 [PATCH 00/32] ARM: ux500: Enable clocks for Device Tree Lee Jones
2013-06-06 12:16 ` [PATCH 01/33] mfd: dbx500-prcmu: Provide PRCMU numerical clock identifiers Lee Jones
2013-06-06 12:16 ` [PATCH 02/33] ARM: ux500: Add PRCMU clock node to DBx500 Device Tree Lee Jones
2013-06-06 12:16 ` [PATCH 03/33] ARM: ux500: Supply the DMA clock lookup to the DBX500 DT Lee Jones
2013-06-06 12:16 ` [PATCH 04/33] ARM: ux500: Add PRCC Peripheral clock node to DBx500 Device Tree Lee Jones
2013-06-06 12:16 ` [PATCH 05/33] ARM: ux500: Supply the GPIO clocks lookup to the DBX500 DT Lee Jones
2013-06-06 12:16 ` [PATCH 06/33] ARM: ux500: Supply the USB clock " Lee Jones
2013-06-06 12:16 ` [PATCH 07/33] ARM: ux500: Supply the Ethernet clock lookup to Snowball's DT Lee Jones
2013-06-06 12:16 ` [PATCH 08/33] ARM: ux500: Add PRCC Kernel clock node to DBx500 Device Tree Lee Jones
2013-06-06 12:16 ` [PATCH 09/33] ARM: ux500: Supply the I2C clocks lookup to the DBX500 DT Lee Jones
2013-08-20 9:11 ` Linus Walleij
2013-08-20 9:30 ` Sascha Hauer
2013-08-22 13:37 ` Mark Rutland
2013-08-22 13:49 ` Lee Jones
2013-08-22 14:19 ` Lee Jones
2013-08-22 15:17 ` Mark Rutland
2013-08-22 15:41 ` Lee Jones
2013-08-22 16:04 ` Mark Rutland [this message]
2013-08-22 21:19 ` Sascha Hauer
2013-08-23 7:56 ` Lee Jones
2013-08-23 16:55 ` Mark Rutland
2013-08-27 8:06 ` Lee Jones
2013-08-27 13:46 ` Mark Rutland
2013-08-27 14:08 ` Lee Jones
2013-08-27 15:51 ` Rob Herring
2013-08-27 16:15 ` Pawel Moll
2013-08-21 8:28 ` Lee Jones
2013-08-21 22:44 ` Linus Walleij
2013-08-22 9:23 ` Lee Jones
2013-06-06 12:16 ` [PATCH 10/33] ARM: ux500: Supply the UART " Lee Jones
2013-06-06 12:16 ` [PATCH 11/33] ARM: ux500: Supply the SDI (MMC) " Lee Jones
2013-06-06 12:17 ` [PATCH 12/33] ARM: ux500: Supply the MSP (Audio) " Lee Jones
2013-06-06 12:17 ` [PATCH 13/33] ARM: ux500: Add RTC (fixed-frequency) clock node to DBx500 Device Tree Lee Jones
2013-06-06 12:17 ` [PATCH 14/33] ARM: ux500: Supply the RTC clock lookup to the DBX500 DT Lee Jones
2013-06-06 12:17 ` [PATCH 15/33] ARM: ux500: Add TWD (fixed-factor) clock node to DBx500 Device Tree Lee Jones
2013-06-06 12:17 ` [PATCH 16/33] ARM: ux500: Supply the TWD Timer clock lookup to the DBX500 DT Lee Jones
2013-06-06 12:17 ` [PATCH 17/33] clk: ux500: Provide u8500_clk with skeleton Device Tree support Lee Jones
2013-06-06 12:17 ` [PATCH 18/33] clk: ux500: Add a 2-cell Device Tree parser for obtaining PRCC clocks Lee Jones
2013-06-10 20:54 ` Ulf Hansson
2013-06-11 9:12 ` Lee Jones
2013-06-11 11:07 ` [PATCH 18/33 v2] " Lee Jones
2013-06-06 12:17 ` [PATCH 19/33] clk: ux500: Add Device Tree support for the PRCMU clock Lee Jones
2013-06-10 21:19 ` Ulf Hansson
2013-06-11 11:10 ` Lee Jones
2013-06-11 11:12 ` Lee Jones
2013-08-21 8:23 ` Linus Walleij
2013-08-21 10:10 ` Lee Jones
2013-06-06 12:17 ` [PATCH 20/33] clk: ux500: Add Device Tree support for the PRCC Peripheral clock Lee Jones
2013-06-11 11:51 ` [PATCH 20/33 v2] " Lee Jones
2013-06-06 12:17 ` [PATCH 21/33] clk: ux500: Add Device Tree support for the PRCC Kernel clock Lee Jones
2013-06-10 21:24 ` Ulf Hansson
2013-06-11 9:10 ` Lee Jones
2013-06-11 11:09 ` [PATCH 21/33 v2] " Lee Jones
2013-06-12 14:46 ` Arnd Bergmann
2013-06-18 21:17 ` Mike Turquette
2013-06-19 7:42 ` Lee Jones
2013-08-21 8:17 ` [PATCH 21/33] " Linus Walleij
2013-08-21 10:14 ` Lee Jones
2013-08-21 22:46 ` Linus Walleij
2013-08-22 9:21 ` Lee Jones
2013-08-23 18:01 ` Linus Walleij
2013-08-24 8:00 ` Arnd Bergmann
2013-08-24 21:19 ` Linus Walleij
2013-08-27 8:23 ` Lee Jones
2013-09-12 12:50 ` Linus Walleij
2013-09-12 14:56 ` Lee Jones
2013-09-13 7:20 ` Linus Walleij
2013-06-06 12:17 ` [PATCH 22/33] clk: ux500: Add Device Tree support for the RTC clock Lee Jones
2013-06-06 12:17 ` [PATCH 23/33] clk: ux500: Add Device Tree support for the TWD clock Lee Jones
2013-06-06 12:17 ` [PATCH 24/33] ARM: ux500: Remove AUXDATA relating to GPIO clock-name bindings Lee Jones
2013-06-06 12:17 ` [PATCH 25/33] ARM: ux500: Remove AUXDATA relating to UART " Lee Jones
2013-06-06 12:17 ` [PATCH 26/33] ARM: ux500: Remove AUXDATA relating to SDI (MMC) " Lee Jones
2013-08-23 13:31 ` Linus Walleij
2013-08-23 14:45 ` Lee Jones
2013-08-24 7:57 ` Arnd Bergmann
2013-08-27 8:11 ` Lee Jones
2013-06-06 12:17 ` [PATCH 27/33] ARM: ux500: Remove AUXDATA relating to I2C " Lee Jones
2013-06-06 12:17 ` [PATCH 28/33] ARM: ux500: Remove AUXDATA relating to MSP (Audio) " Lee Jones
2013-08-21 8:08 ` Linus Walleij
2013-08-21 8:17 ` Lee Jones
2013-06-06 12:17 ` [PATCH 29/33] ARM: ux500: Remove AUXDATA relating to USB " Lee Jones
2013-06-06 12:17 ` [PATCH 30/33] ARM: ux500: Remove AUXDATA relating to Ethernet " Lee Jones
2013-06-06 12:17 ` [PATCH 31/33] ARM: ux500: Remove AUXDATA relating to DMA " Lee Jones
2013-06-06 12:17 ` [PATCH 32/33] ARM: ux500: Reclassify PRCMU AUXDATA entry Lee Jones
2013-06-06 12:17 ` [PATCH 33/33] ARM: ux500: Remove SSP AUXDATA pertaining to DMA bindings Lee Jones
2013-06-12 13:27 ` [PATCH 00/32] ARM: ux500: Enable clocks for Device Tree Lee Jones
2013-06-13 8:41 ` Linus Walleij
2013-06-13 9:34 ` Lee Jones
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=20130822160443.GG23152@e106331-lin.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinidhi.kasagar@stericsson.com \
/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
all inboxes | Powered by JetHome®