From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: devicetree-discuss
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Subject: Re: Device tree node names
Date: Wed, 22 Aug 2012 13:20:19 -0500 [thread overview]
Message-ID: <503522E3.2050900@gmail.com> (raw)
In-Reply-To: <5034F870.2010604-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
On 08/22/2012 10:19 AM, Stephen Warren wrote:
> Grant, Rob, Segher, Arnd, Olof,
>
> Can you please state if you agree with Mitch's opinion below? Thanks.
>
> On 08/16/2012 03:36 PM, Mitch Bradley wrote:
>> On 8/16/2012 9:34 AM, Stephen Warren wrote:
>>> As I understand it, there is a rule when writing device tree files (and
>>> bindings) that nodes should be named after the type of object they
>>> represent, and not the particular instance of the object. Related, node
>>> names should not be interpreted as data.
>>>
>>> This rules makes perfect sense when talking about nodes on a bus that
>>> represent devices; something like:
>>>
>>> i2c@7000c000 {
>>> compatible = "nvidia,tegra20-i2c";
>>> reg = <0x7000c000 0x100>;
>>> ...
>>> };
>>>
>>> i2c@7000c400 {
>>> compatible = "nvidia,tegra20-i2c";
>>> reg = <0x7000c400 0x100>;
>>> ...
>>> };
>>>
>>> However, when nodes are being used to represent configuration
>>> information inside a device node, or even when representing
>>> pseudo-devices that don't directly exist on a specific bus, this rules
>>> becomes quite annoying.
>>>
>>> As an example, consider a device that contains 10 voltage regulators
>>> (named "ldon" in the chip documentation), and each needs some
>>> configuration provided through DT. A simple binding might result in:
>>>
>>> i2c@7000c000 {
>>> ldo0 {
>>> ... (configuration data here)
>>> };
>>> ldo1 {
>>> ...
>>> };
>>> ...
>>> };
>>>
>>> Where regulator "name"'s configuration is encoded into node "name".
>>>
>>> Instead, if we follow this rule precisely, we end up with something more
>>> like:
>>>
>>> i2c@7000c000 {
>>> #address-cells = <1>;
>>> #size-cells = <0>;
>>>
>>> ldo@0 {
>>> reg = <0>;
>>> regulator-id = "ldo0";
>>> ...
>>> };
>>> ldo@1 {
>>> reg = <1>;
>>> regulator-id = "ldo1";
>>> ...
>>> };
>>> ...
>>> };
>>>
>>> This is a fair bit more wordy, and the only advantage appears to be that
>>> it correctly conforms to some apparently arbitrary rule for node naming.
>>>
>>> Similar situations exist when describing the set of power sequences
>>> needed to enable/disable a device [1] or pinctrl configurations (see
>>> Linux kernel file arch/arm/boot/dts/tegra20-harmony.dts, node
>>> /pinmux/pinmux where I haven't actually followed this rule correctly) etc.
>>>
>>> So, my question is: Can/should we relax this rule? Can we allow drivers
>>> (bindings) to require specific node names for things, lookup up specific
>>> configuration data by node name and/or enumerate all nodes, and parse
>>> data out of the node names (e.g. the value n for nodes named LDOn in the
>>> above example)?
>>
>> As far as I'm concerned, within the privacy of your own node, you can do
>> whatever you want. Perhaps others will disagree...
>
> If everyone agrees with this, it'll certainly give a lot more
> flexibility for individual bindings to come up with simple
> representations for configuration data within their own node.
>
> Nodes that represent addressable buses would of course continue to use
> standardized conventions in my opinion.
I don't really have a strong opinion on this. So I guess I'm okay with
it, but I still reserve the right to object to how it gets (ab)used. :)
In fact, the nodes for the highbank clocks does exactly this. In this
case it is only used to get the clock names when no clock-output-names
property is present.
Rob
>> The main "rule" for node names is that a user browsing the device tree
>> can easily determine what something is. Thus "ethernet" instead of
>> "DEC,21140".
>>
>> As an historical note, in early Open Boot, it was just the other way
>> around. I originally thought that node names should be precise - and
>> the ill-considered "device_type" property gave the "generic"
>> identification. But it soon became clear that "precise" names were
>> neither human-understandable nor actually precise. Pathnames looked like
>> gobbledygook with strings of part numbers that only an expert could
>> remember, and the evolution of part numbers, coupled with companies
>> going out of business and other companies making compatible parts, made
>> "precise" names change semi-randomly. Thus was born the "generic names"
>> rethink, in which the name became human-meaningful (but generally
>> meaningless to software in any precise sense), device_type was
>> deprecated, and compatible appeared, as a list.
>>
>>>
>>> [1]
>>> https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-August/018433.html
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
>
next prev parent reply other threads:[~2012-08-22 18:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 19:34 Device tree node names Stephen Warren
[not found] ` <502D4B28.4020108-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-16 21:36 ` Mitch Bradley
[not found] ` <502D67DF.7010605-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-08-17 11:36 ` Mark Brown
[not found] ` <20120817113610.GB32216-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-08-17 13:10 ` Mitch Bradley
2012-08-22 15:19 ` Stephen Warren
[not found] ` <5034F870.2010604-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-22 18:20 ` Rob Herring [this message]
2012-08-16 21:46 ` Associating devices with multiple parents Mitch Bradley
[not found] ` <502D6A3A.7060808-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-08-16 22:20 ` Grant Likely
[not found] ` <CACxGe6uqWG7kRUL0o3qPCMDvG52UyqTMez+AT1yK55X-xgaRuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-17 10:37 ` Mark Brown
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=503522E3.2050900@gmail.com \
--to=robherring2-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.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).