Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646481 > unrolled thread

[DT Question] "simple-mfd" DT binding

Started byMasahiro Yamada <yamada.masahiro@socionext.com>
First post2017-05-22 03:30 +0200
Last post2017-05-24 09:20 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [DT Question] "simple-mfd" DT binding Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-05-22 03:30 +0200
    Re: [DT Question] "simple-mfd" DT binding Lee Jones <lee.jones@linaro.org> - 2017-05-22 09:50 +0200
    Re: [DT Question] "simple-mfd" DT binding Linus Walleij <linus.walleij@linaro.org> - 2017-05-22 10:50 +0200
      Re: [DT Question] "simple-mfd" DT binding Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-05-23 03:30 +0200
        Re: [DT Question] "simple-mfd" DT binding Lee Jones <lee.jones@linaro.org> - 2017-05-23 09:10 +0200
          Re: [DT Question] "simple-mfd" DT binding Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-05-24 07:00 +0200
            Re: [DT Question] "simple-mfd" DT binding Lee Jones <lee.jones@linaro.org> - 2017-05-24 09:20 +0200

#1646481 — [DT Question] "simple-mfd" DT binding

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-05-22 03:30 +0200
Subject[DT Question] "simple-mfd" DT binding
Message-ID<tJKkx-74C-5@gated-at.bofh.it>
Hi DT experts,

I have a question about "simple-mfd".


Documentation/devicetree/bindings/mfd/mfd.txt says as allows:

----------------------8<---------------------
Optional properties:

- compatible : "simple-mfd" - this signifies that the operating system should
  consider all subnodes of the MFD device as separate devices akin to how
  "simple-bus" indicates when to see subnodes as children for a simple
  memory-mapped bus.   <snip>
----------------------8<---------------------


I'd like to be sure about the statement above.

Does this mean, "simple-bus" and "simple-mfd" are technically interchangeable?



If so, I thought the example some lines below is questionable.

---------------------8<---------------------------
Example:

foo@1000 {
        compatible = "syscon", "simple-mfd";
        reg = <0x01000 0x1000>;

        led@08.0 {
                compatible = "register-bit-led";
                offset = <0x08>;
                mask = <0x01>;
                label = "myled";
                default-state = "on";
        };
};
---------------------8<---------------------------


Because "simple-bus" indicates that child nodes are
simply memory mapped, but the node "register-bit-led"
can not be memory-mapped.
So, "simple-mfd" can not be replaced "simple-bus" here.



arch/arm/boot/dts/arm-realview-pb1176.dts is a real example.

If I replace "simple-mfd" with "simple-bus",
DTC warns "empty reg/ranges property".



$ sed -i  -e 's/simple-mfd/simple-bus/'
arch/arm/boot/dts/arm-realview-pb1176.dts
$ make -s ARCH=arm defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- W=1  arm-realview-pb1176.dtb
   ...
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.0 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.1 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.2 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.3 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.4 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.5 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.6 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/led@08.7 missing or empty reg/ranges
property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/osc0@0c missing or empty reg/ranges property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/osc1@10 missing or empty reg/ranges property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/osc2@14 missing or empty reg/ranges property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/osc3@18 missing or empty reg/ranges property
arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
Node /soc/syscon@10000000/osc4@1c missing or empty reg/ranges property






-- 
Best Regards
Masahiro Yamada

[toc] | [next] | [standalone]


#1646576

FromLee Jones <lee.jones@linaro.org>
Date2017-05-22 09:50 +0200
Message-ID<tJQgi-2Cc-11@gated-at.bofh.it>
In reply to#1646481
On Mon, 22 May 2017, Masahiro Yamada wrote:

> Hi DT experts,
> 
> I have a question about "simple-mfd".
> 
> 
> Documentation/devicetree/bindings/mfd/mfd.txt says as allows:
> 
> ----------------------8<---------------------
> Optional properties:
> 
> - compatible : "simple-mfd" - this signifies that the operating system should
>   consider all subnodes of the MFD device as separate devices akin to how
>   "simple-bus" indicates when to see subnodes as children for a simple
>   memory-mapped bus.   <snip>
> ----------------------8<---------------------
> 
> 
> I'd like to be sure about the statement above.
> 
> Does this mean, "simple-bus" and "simple-mfd" are technically interchangeable?

You can use them interchangeably and they will 'work', but the
implication will be wrong.  Hence why both exist.

> If so, I thought the example some lines below is questionable.
> 
> ---------------------8<---------------------------
> Example:
> 
> foo@1000 {
>         compatible = "syscon", "simple-mfd";
>         reg = <0x01000 0x1000>;
> 
>         led@08.0 {
>                 compatible = "register-bit-led";
>                 offset = <0x08>;
>                 mask = <0x01>;
>                 label = "myled";
>                 default-state = "on";
>         };
> };
> ---------------------8<---------------------------
> 
> 
> Because "simple-bus" indicates that child nodes are
> simply memory mapped, but the node "register-bit-led"
> can not be memory-mapped.
> So, "simple-mfd" can not be replaced "simple-bus" here.

Correct.  It would be inappropriate to use "simple-bus" for this use
case.  That is most likely why "simple-mfd" is used instead.

> arch/arm/boot/dts/arm-realview-pb1176.dts is a real example.
> 
> If I replace "simple-mfd" with "simple-bus",
> DTC warns "empty reg/ranges property".
> 
> $ sed -i  -e 's/simple-mfd/simple-bus/'
> arch/arm/boot/dts/arm-realview-pb1176.dts
> $ make -s ARCH=arm defconfig
> $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- W=1  arm-realview-pb1176.dtb
>    ...
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.0 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.1 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.2 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.3 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.4 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.5 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.6 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/led@08.7 missing or empty reg/ranges
> property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/osc0@0c missing or empty reg/ranges property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/osc1@10 missing or empty reg/ranges property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/osc2@14 missing or empty reg/ranges property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/osc3@18 missing or empty reg/ranges property
> arch/arm/boot/dts/arm-realview-pb1176.dtb: Warning (simple_bus_reg):
> Node /soc/syscon@10000000/osc4@1c missing or empty reg/ranges property

Exactly.  Don't do that. :)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1646612

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-05-22 10:50 +0200
Message-ID<tJRcm-3bn-19@gated-at.bofh.it>
In reply to#1646481
On Mon, May 22, 2017 at 3:29 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> Because "simple-bus" indicates that child nodes are
> simply memory mapped, but the node "register-bit-led"
> can not be memory-mapped.
> So, "simple-mfd" can not be replaced "simple-bus" here.

Yeah... just like Lee points out, you are spot on, this is exactly
the reason why we created "simple-mfd" in the first place
IIRC.

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1647555

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-05-23 03:30 +0200
Message-ID<tK6O5-4Nz-7@gated-at.bofh.it>
In reply to#1646612
Hi Lee, Linus,

Thanks for your comments!

2017-05-22 17:43 GMT+09:00 Linus Walleij <linus.walleij@linaro.org>:
> On Mon, May 22, 2017 at 3:29 AM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>
>> Because "simple-bus" indicates that child nodes are
>> simply memory mapped, but the node "register-bit-led"
>> can not be memory-mapped.
>> So, "simple-mfd" can not be replaced "simple-bus" here.
>
> Yeah... just like Lee points out, you are spot on, this is exactly
> the reason why we created "simple-mfd" in the first place
> IIRC.

OK, Linux treats simple-bus and simple-mfd in the same way
as far as I see drivers/of/platform.c

Perhaps, can we document the difference between simple-bus and
simple-mfd clearly?
For example, "Unlike simple-bus, it is legitimate that simple-mfd has
subnodes without reg property"


I think this is typical when "simple-mfd" is used together with "syscon".
The child devices will use regmap of the parent node.
I'd like to be sure this is valid usage.


-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [next] | [standalone]


#1647703

FromLee Jones <lee.jones@linaro.org>
Date2017-05-23 09:10 +0200
Message-ID<tKc79-8iP-33@gated-at.bofh.it>
In reply to#1647555
On Tue, 23 May 2017, Masahiro Yamada wrote:

> Hi Lee, Linus,
> 
> Thanks for your comments!
> 
> 2017-05-22 17:43 GMT+09:00 Linus Walleij <linus.walleij@linaro.org>:
> > On Mon, May 22, 2017 at 3:29 AM, Masahiro Yamada
> > <yamada.masahiro@socionext.com> wrote:
> >
> >> Because "simple-bus" indicates that child nodes are
> >> simply memory mapped, but the node "register-bit-led"
> >> can not be memory-mapped.
> >> So, "simple-mfd" can not be replaced "simple-bus" here.
> >
> > Yeah... just like Lee points out, you are spot on, this is exactly
> > the reason why we created "simple-mfd" in the first place
> > IIRC.
> 
> OK, Linux treats simple-bus and simple-mfd in the same way
> as far as I see drivers/of/platform.c

Correct.  As I said, the functionality of the two are the same.  The
difference is their meaning.  Initially we were using "simple-mfd" to
achieve our aim (see below), but there was push-back due to the
differences in what the two properties were trying to achieve.  Ergo,
we introduced a second property.

> Perhaps, can we document the difference between simple-bus and
> simple-mfd clearly?
> For example, "Unlike simple-bus, it is legitimate that simple-mfd has
> subnodes without reg property"
> 
> 
> I think this is typical when "simple-mfd" is used together with "syscon".
> The child devices will use regmap of the parent node.
> I'd like to be sure this is valid usage.

"simple-mfd" simply means "register all of my child nodes using the
platform API without any further intervention".  It's goal is to
prevent the MFD subsystem from being stuffed full of drivers where
their only purpose is to call of_platform_populate().  All other rules
and policy which must be followed are generic DT ones.  To that end, I
do not believe making further statements is necessary.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1649115

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-05-24 07:00 +0200
Message-ID<tKwyR-5R1-3@gated-at.bofh.it>
In reply to#1647703
Hi Lee,

2017-05-23 16:05 GMT+09:00 Lee Jones <lee.jones@linaro.org>:
> On Tue, 23 May 2017, Masahiro Yamada wrote:
>
>> Hi Lee, Linus,
>>
>> Thanks for your comments!
>>
>> 2017-05-22 17:43 GMT+09:00 Linus Walleij <linus.walleij@linaro.org>:
>> > On Mon, May 22, 2017 at 3:29 AM, Masahiro Yamada
>> > <yamada.masahiro@socionext.com> wrote:
>> >
>> >> Because "simple-bus" indicates that child nodes are
>> >> simply memory mapped, but the node "register-bit-led"
>> >> can not be memory-mapped.
>> >> So, "simple-mfd" can not be replaced "simple-bus" here.
>> >
>> > Yeah... just like Lee points out, you are spot on, this is exactly
>> > the reason why we created "simple-mfd" in the first place
>> > IIRC.
>>
>> OK, Linux treats simple-bus and simple-mfd in the same way
>> as far as I see drivers/of/platform.c
>
> Correct.  As I said, the functionality of the two are the same.  The
> difference is their meaning.  Initially we were using "simple-mfd" to
> achieve our aim (see below), but there was push-back due to the
> differences in what the two properties were trying to achieve.  Ergo,
> we introduced a second property.
>
>> Perhaps, can we document the difference between simple-bus and
>> simple-mfd clearly?
>> For example, "Unlike simple-bus, it is legitimate that simple-mfd has
>> subnodes without reg property"
>>
>>
>> I think this is typical when "simple-mfd" is used together with "syscon".
>> The child devices will use regmap of the parent node.
>> I'd like to be sure this is valid usage.
>
> "simple-mfd" simply means "register all of my child nodes using the
> platform API without any further intervention".  It's goal is to
> prevent the MFD subsystem from being stuffed full of drivers where
> their only purpose is to call of_platform_populate().  All other rules
> and policy which must be followed are generic DT ones.  To that end, I
> do not believe making further statements is necessary.

I see.  Thanks for your kind explanation!


-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [next] | [standalone]


#1649182

FromLee Jones <lee.jones@linaro.org>
Date2017-05-24 09:20 +0200
Message-ID<tKyKn-7zX-25@gated-at.bofh.it>
In reply to#1649115
On Wed, 24 May 2017, Masahiro Yamada wrote:

> Hi Lee,
> 
> 2017-05-23 16:05 GMT+09:00 Lee Jones <lee.jones@linaro.org>:
> > On Tue, 23 May 2017, Masahiro Yamada wrote:
> >
> >> Hi Lee, Linus,
> >>
> >> Thanks for your comments!
> >>
> >> 2017-05-22 17:43 GMT+09:00 Linus Walleij <linus.walleij@linaro.org>:
> >> > On Mon, May 22, 2017 at 3:29 AM, Masahiro Yamada
> >> > <yamada.masahiro@socionext.com> wrote:
> >> >
> >> >> Because "simple-bus" indicates that child nodes are
> >> >> simply memory mapped, but the node "register-bit-led"
> >> >> can not be memory-mapped.
> >> >> So, "simple-mfd" can not be replaced "simple-bus" here.
> >> >
> >> > Yeah... just like Lee points out, you are spot on, this is exactly
> >> > the reason why we created "simple-mfd" in the first place
> >> > IIRC.
> >>
> >> OK, Linux treats simple-bus and simple-mfd in the same way
> >> as far as I see drivers/of/platform.c
> >
> > Correct.  As I said, the functionality of the two are the same.  The
> > difference is their meaning.  Initially we were using "simple-mfd" to

This should have read "simple-bus".

Sorry for any confusion this may have caused.

> > achieve our aim (see below), but there was push-back due to the
> > differences in what the two properties were trying to achieve.  Ergo,
> > we introduced a second property.
> >
> >> Perhaps, can we document the difference between simple-bus and
> >> simple-mfd clearly?
> >> For example, "Unlike simple-bus, it is legitimate that simple-mfd has
> >> subnodes without reg property"
> >>
> >>
> >> I think this is typical when "simple-mfd" is used together with "syscon".
> >> The child devices will use regmap of the parent node.
> >> I'd like to be sure this is valid usage.
> >
> > "simple-mfd" simply means "register all of my child nodes using the
> > platform API without any further intervention".  It's goal is to
> > prevent the MFD subsystem from being stuffed full of drivers where
> > their only purpose is to call of_platform_populate().  All other rules
> > and policy which must be followed are generic DT ones.  To that end, I
> > do not believe making further statements is necessary.
> 
> I see.  Thanks for your kind explanation!

No problem.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web