All of lore.kernel.org
 help / color / mirror / Atom feed
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] clk: fixed-rate: use full DT node name
Date: Tue, 18 Feb 2014 10:34:36 -0700	[thread overview]
Message-ID: <530399AC.2070204@wwwdotorg.org> (raw)
In-Reply-To: <20140218112323.GB6051@e106331-lin.cambridge.arm.com>

On 02/18/2014 04:23 AM, Mark Rutland wrote:
> On Fri, Feb 14, 2014 at 04:43:04PM +0000, Stephen Warren wrote:
>> On 02/14/2014 03:35 AM, Mark Rutland wrote:
>>> On Fri, Feb 14, 2014 at 06:16:52AM +0000, Stephen Warren wrote:
>>>> clk-fixed-rate currently names clocks according to a node's name without
>>>> the unit address. When faced with the legal and technically correct DT
>>>> structure below, this causes rgistration attempts for 3 clocks with the
>>>> same name, 2 of which fail.
>>>>
>>>> 	clocks {
>>>> 		compatible = "simple-bus";
>>>> 		#address-cells = <1>;
>>>> 		#size-cells = <0>;
>>>>
>>>> 		clk_mmc: clock at 0 {
>>>> 			compatible = "fixed-clock";
>>>> 			reg = <0>;
>>>> ...
>>>> 		clk_i2c: clock at 1 {
>>>> 			compatible = "fixed-clock";
>>>> 			reg = <1>;
>>>> ...
>>>> 		clk_spi: clock at 2 {
>>>> 			compatible = "fixed-clock";
>>>> 			reg = <2>;
>>>> ...
>>>
>>> I'd argue that this case isn't valid.
>>
>> Well, it's very widely used, and was the result of numerous discussions
>> of how this kind of thing should be represented:-/
> 
> Maybe we have to live with it then. :/

Great:-)

...
>>> It's just nonsensical; rename them to clock_{0,1,..} instead and get rid
>>> of the reg properties. Then they're named uniquely.
>>
>> That's not legal either. DT node names are supposed to represent the
>> type of device/object (i.e. just "clock"), not the identity of the
>> device/object (i.e. not include IDs etc.). Hence, the node name needs to
>> be "clock" for all of them, and the unit address must be used to
>> differentiate them.
> 
> As far as I can see from ePAPR, the only requriement is:
> 
>   The node-name shall start with a lower or uppercase character and
>   should describe the general class of device.
> 
> IMO clock_1 describes the general class of device as well as clock at 1,
> while also not filling a unexpected property with a meaningless value.

I believe section 2.2.2 "Generic Names Recommendation" is the source of
the rule that nodes should be named after the type of object rather than
the identity.

"""
The name of a node should be somewhat generic, reflecting the function
of the device and not its precise programming model. If appropriate, the
name should be one of the following choices:

* atm
* cache-controller
* compact-flash
* can
* cpu
...
"""

(I note e.g. "cpu" not "cpu-1", "cpu_2", etc.)

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Cc: Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH 1/2] clk: fixed-rate: use full DT node name
Date: Tue, 18 Feb 2014 10:34:36 -0700	[thread overview]
Message-ID: <530399AC.2070204@wwwdotorg.org> (raw)
In-Reply-To: <20140218112323.GB6051-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>

On 02/18/2014 04:23 AM, Mark Rutland wrote:
> On Fri, Feb 14, 2014 at 04:43:04PM +0000, Stephen Warren wrote:
>> On 02/14/2014 03:35 AM, Mark Rutland wrote:
>>> On Fri, Feb 14, 2014 at 06:16:52AM +0000, Stephen Warren wrote:
>>>> clk-fixed-rate currently names clocks according to a node's name without
>>>> the unit address. When faced with the legal and technically correct DT
>>>> structure below, this causes rgistration attempts for 3 clocks with the
>>>> same name, 2 of which fail.
>>>>
>>>> 	clocks {
>>>> 		compatible = "simple-bus";
>>>> 		#address-cells = <1>;
>>>> 		#size-cells = <0>;
>>>>
>>>> 		clk_mmc: clock@0 {
>>>> 			compatible = "fixed-clock";
>>>> 			reg = <0>;
>>>> ...
>>>> 		clk_i2c: clock@1 {
>>>> 			compatible = "fixed-clock";
>>>> 			reg = <1>;
>>>> ...
>>>> 		clk_spi: clock@2 {
>>>> 			compatible = "fixed-clock";
>>>> 			reg = <2>;
>>>> ...
>>>
>>> I'd argue that this case isn't valid.
>>
>> Well, it's very widely used, and was the result of numerous discussions
>> of how this kind of thing should be represented:-/
> 
> Maybe we have to live with it then. :/

Great:-)

...
>>> It's just nonsensical; rename them to clock_{0,1,..} instead and get rid
>>> of the reg properties. Then they're named uniquely.
>>
>> That's not legal either. DT node names are supposed to represent the
>> type of device/object (i.e. just "clock"), not the identity of the
>> device/object (i.e. not include IDs etc.). Hence, the node name needs to
>> be "clock" for all of them, and the unit address must be used to
>> differentiate them.
> 
> As far as I can see from ePAPR, the only requriement is:
> 
>   The node-name shall start with a lower or uppercase character and
>   should describe the general class of device.
> 
> IMO clock_1 describes the general class of device as well as clock@1,
> while also not filling a unexpected property with a meaningless value.

I believe section 2.2.2 "Generic Names Recommendation" is the source of
the rule that nodes should be named after the type of object rather than
the identity.

"""
The name of a node should be somewhat generic, reflecting the function
of the device and not its precise programming model. If appropriate, the
name should be one of the following choices:

* atm
* cache-controller
* compact-flash
* can
* cpu
...
"""

(I note e.g. "cpu" not "cpu-1", "cpu_2", etc.)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-02-18 17:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  6:16 [PATCH 1/2] clk: fixed-rate: use full DT node name Stephen Warren
2014-02-14  6:16 ` Stephen Warren
2014-02-14  6:16 ` [PATCH 2/2] ARM: bcm2835: fix clock DT node names Stephen Warren
2014-02-14  6:16   ` Stephen Warren
2014-02-14 10:39   ` Mark Rutland
2014-02-14 10:39     ` Mark Rutland
2014-02-14 10:35 ` [PATCH 1/2] clk: fixed-rate: use full DT node name Mark Rutland
2014-02-14 10:35   ` Mark Rutland
2014-02-14 16:43   ` Stephen Warren
2014-02-14 16:43     ` Stephen Warren
2014-02-18 11:23     ` Mark Rutland
2014-02-18 11:23       ` Mark Rutland
2014-02-18 17:34       ` Stephen Warren [this message]
2014-02-18 17:34         ` Stephen Warren
2014-02-14 16:43   ` Stephen Warren
2014-02-14 16:43     ` Stephen Warren
2014-02-15 15:18 ` Emilio López
2014-02-15 15:18   ` Emilio López

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=530399AC.2070204@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.