From: Grant Likely <grant.likely@secretlab.ca>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev list <linuxppc-dev@ozlabs.org>,
devicetree-discuss@lists.ozlabs.org
Subject: Re: [RFC] Clock binding
Date: Fri, 28 Aug 2009 10:37:17 -0600 [thread overview]
Message-ID: <fa686aa40908280937nda32be7m97314e4aaef9ff81@mail.gmail.com> (raw)
In-Reply-To: <1250569288.19007.15.camel@pasglop>
On Mon, Aug 17, 2009 at 10:21 PM, Benjamin
Herrenschmidt<benh@kernel.crashing.org> wrote:
> However, it's a bit nasty to mix strings and numbers (phandles) in a
> single property. It's possible, but would likely lead to the phandle not
> being aligned and tools such as lsprop to fail miserably to display
> those properties in any kind of readable form.
[...]
> However, I really dislike that numerical clock ID. Magic numbers suck.
> It should be a string.
Agreed.
> Hence my idea below. It's not perfect but it's the less sucky i've come
> up with so far. And then we can do some small refinements.
>
> =A0 =A0 =A0 =A0* Device has:
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0- "clock-input-names" as above
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0- "clock-map" contains list of phandle,ind=
ex
>
> =A0 =A0 =A0 =A0* Clock source has:
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0- "clock-output-names" list of strings
The big problem as you say is the referencing of both phandles and
strings in the same property, but it's not particularly pretty to
disperse the data across multiple properties. Changes to the two
properties must be kept in sync, and if order changes in one and not
the other then badness occurs... Actually, I don't *dislike* you're
proposed binding, but in the interest of generating and endless
goodness argument, what about the following?
As above, clock source has:
- "clock-output-names" list of strings. All possible inputs
must be in this list in the interest of clarity and sanity checking,
but drivers must not depend on the order of the list. Drivers must
always resolve clocks by name.
Clock consumer has:
- "clock-inputs" property. Array of string 'tuples' in the
form: "input-name","clock-source-path","output-name".
This sidesteps the phandle issue by using the path string instead.
It's not as efficient space wise, but (at least when using dtc) the
syntax stays pretty sane, and the output remains mere-mortal parsable:
ie: clock-inputs =3D "sysclk", &clocksource, "clkout_orange";
> The "index" in the clock map thus would reference the
> "clock-output-names" array in the clock provider. That means that the
> "magic number" here is entirely local to a given device-tree, doesn't
> leak into driver code, which continues using names.
>
> In addition, we can even have some smooth "upgrade" path from existing
> "clock-frequency" properties by assuming that if "clock-output-names" is
> absent, but "clock-frequency" exist, then index 0 references a fixed
> frequency clock source without a driver. This could be generally handy
> anyway to represent crystals of fixed bus clocks without having to write
> a clock source driver for them.
The analog of this could be:
clock-inputs =3D "sysclk", &clocksource, "0";
Otherwise, I think the approach is sound and I agree fully that
referencing names makes sense.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
prev parent reply other threads:[~2009-08-28 16:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-18 4:21 [RFC] Clock binding Benjamin Herrenschmidt
2009-08-18 7:45 ` [RFC/PATCH] Clock binding prototype implementation Benjamin Herrenschmidt
2009-08-27 4:09 ` [RFC] Clock binding Benjamin Herrenschmidt
2009-08-27 5:20 ` Grant Likely
2009-08-27 21:11 ` Mitch Bradley
2009-08-27 22:18 ` Benjamin Herrenschmidt
2009-08-27 22:28 ` Mitch Bradley
2009-08-27 22:45 ` Mitch Bradley
2009-08-28 0:51 ` Benjamin Herrenschmidt
2009-08-28 2:36 ` Mitch Bradley
2009-08-28 2:43 ` Benjamin Herrenschmidt
2009-08-28 2:53 ` Michael Ellerman
2009-08-28 10:58 ` Josh Boyer
2009-08-28 11:23 ` David Gibson
2009-08-28 22:28 ` Benjamin Herrenschmidt
2009-08-28 12:16 ` Stuart Yoder
2009-08-28 16:06 ` Grant Likely
2009-08-28 18:05 ` Stuart Yoder
2009-08-28 18:23 ` M. Warner Losh
2009-08-28 20:09 ` Grant Likely
2009-08-31 17:49 ` Stuart Yoder
2009-08-28 18:12 ` Mitch Bradley
2009-08-28 18:24 ` Rafal Jaworowski
2009-08-28 22:33 ` Benjamin Herrenschmidt
2009-08-28 16:37 ` Grant Likely [this message]
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=fa686aa40908280937nda32be7m97314e4aaef9ff81@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=benh@kernel.crashing.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).