diff mbox series

[4/4] ARM: dts: uniphier: change support card to simple-mfd from simple-bus

Message ID 20200623114614.792648-4-yamada.masahiro@socionext.com (mailing list archive)
State New, archived
Headers show
Series [1/4] ARM: dts: uniphier: add interrupts to support card serial | expand

Commit Message

Masahiro Yamada June 23, 2020, 11:46 a.m. UTC
'make ARCH=arm dtbs_check' emits the following warning:

  support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'

Maybe, simple-mfd could be a better fit for this device.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/boot/dts/uniphier-support-card.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lee Jones June 23, 2020, 12:24 p.m. UTC | #1
On Tue, 23 Jun 2020, Masahiro Yamada wrote:

> 'make ARCH=arm dtbs_check' emits the following warning:
> 
>   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> 
> Maybe, simple-mfd could be a better fit for this device.

The two should be equivalent.

What do you mean by "maybe"?  Does this squash the warning?

Isn't the issue caused by the ','?

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  arch/arm/boot/dts/uniphier-support-card.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/uniphier-support-card.dtsi b/arch/arm/boot/dts/uniphier-support-card.dtsi
> index 11e46e7de7c5..eedc10cbc6e6 100644
> --- a/arch/arm/boot/dts/uniphier-support-card.dtsi
> +++ b/arch/arm/boot/dts/uniphier-support-card.dtsi
> @@ -10,7 +10,7 @@ &system_bus {
>  	ranges = <1 0x00000000 0x42000000 0x02000000>;
>  
>  	support_card: support-card@1,1f00000 {
> -		compatible = "simple-bus";
> +		compatible = "simple-mfd";
>  		#address-cells = <1>;
>  		#size-cells = <1>;
>  		ranges = <0x00000000 1 0x01f00000 0x00100000>;
Masahiro Yamada June 24, 2020, 4:29 p.m. UTC | #2
On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Tue, 23 Jun 2020, Masahiro Yamada wrote:
>
> > 'make ARCH=arm dtbs_check' emits the following warning:
> >
> >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> >
> > Maybe, simple-mfd could be a better fit for this device.
>
> The two should be equivalent.

Yes, I know.
That's why I can change "simple-bus" to "simple-mfd"
with no risk.

The difference is schema-check.

The node name for "simple-bus" is checked by 'make dtbs_check'.

See this code:
https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17

Even if I rename the node, it does not accept the
unit name '1,1f00000'



>
> What do you mean by "maybe"?  Does this squash the warning?

"maybe" means I am not quite sure
which compatible is a better fit
to describe this device.


As mentioned above, simple-bus and simple-mfd
are interchangeable from a driver point of view.

This add-on board is integrated with various peripherals
such as 16550a serial, smsc9115 ether etc.
The address-decode is implemented in a CPLD device.
It has chip selects and local addresses, which are mapped to
the parent.

It can be either simple-bus or simple-mfd, I think.


dt-schema checks the node name of simple-bus.
Currently, there is no check for simple-mfd.

So, I think this patch is an easy solution
to fix the warning.

Rob is in Cc. Please add comments if any.


>
> Isn't the issue caused by the ','?

Right.

The node name of simple-bus
must meet the regular expression:
"^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$"


Even if I rename the node
"support-card@1,1f00000"
to "bus@1,1f00000", the warning is still
displayed due to ','

"1,1f00000" means
the address 0x01f00000 of chip select 1.


Thanks

>
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> >  arch/arm/boot/dts/uniphier-support-card.dtsi | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/boot/dts/uniphier-support-card.dtsi b/arch/arm/boot/dts/uniphier-support-card.dtsi
> > index 11e46e7de7c5..eedc10cbc6e6 100644
> > --- a/arch/arm/boot/dts/uniphier-support-card.dtsi
> > +++ b/arch/arm/boot/dts/uniphier-support-card.dtsi
> > @@ -10,7 +10,7 @@ &system_bus {
> >       ranges = <1 0x00000000 0x42000000 0x02000000>;
> >
> >       support_card: support-card@1,1f00000 {
> > -             compatible = "simple-bus";
> > +             compatible = "simple-mfd";
> >               #address-cells = <1>;
> >               #size-cells = <1>;
> >               ranges = <0x00000000 1 0x01f00000 0x00100000>;
>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog



--
Best Regards
Masahiro Yamada
Lee Jones June 24, 2020, 6:16 p.m. UTC | #3
On Thu, 25 Jun 2020, Masahiro Yamada wrote:

> On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Tue, 23 Jun 2020, Masahiro Yamada wrote:
> >
> > > 'make ARCH=arm dtbs_check' emits the following warning:
> > >
> > >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> > >
> > > Maybe, simple-mfd could be a better fit for this device.
> >
> > The two should be equivalent.
> 
> Yes, I know.
> That's why I can change "simple-bus" to "simple-mfd"
> with no risk.
> 
> The difference is schema-check.
> 
> The node name for "simple-bus" is checked by 'make dtbs_check'.
> 
> See this code:
> https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17
> 
> Even if I rename the node, it does not accept the
> unit name '1,1f00000'
> 
> > What do you mean by "maybe"?  Does this squash the warning?
> 
> "maybe" means I am not quite sure
> which compatible is a better fit
> to describe this device.
> 
> As mentioned above, simple-bus and simple-mfd
> are interchangeable from a driver point of view.
> 
> This add-on board is integrated with various peripherals
> such as 16550a serial, smsc9115 ether etc.
> The address-decode is implemented in a CPLD device.
> It has chip selects and local addresses, which are mapped to
> the parent.
> 
> It can be either simple-bus or simple-mfd, I think.
> 
> 
> dt-schema checks the node name of simple-bus.
> Currently, there is no check for simple-mfd.
> 
> So, I think this patch is an easy solution
> to fix the warning.

Yes, looking at the documentation it seems as though 'simple-mfd'
would be a better fit.  Is the device a single IP with various
different functions?

> Rob is in Cc. Please add comments if any.
> 
> > Isn't the issue caused by the ','?
> 
> Right.
> 
> The node name of simple-bus
> must meet the regular expression:
> "^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$"
> 
> 
> Even if I rename the node
> "support-card@1,1f00000"
> to "bus@1,1f00000", the warning is still
> displayed due to ','
> 
> "1,1f00000" means
> the address 0x01f00000 of chip select 1.

Is this an officially accepted format?
Masahiro Yamada June 25, 2020, 2:37 p.m. UTC | #4
On Thu, Jun 25, 2020 at 3:16 AM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Thu, 25 Jun 2020, Masahiro Yamada wrote:
>
> > On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Tue, 23 Jun 2020, Masahiro Yamada wrote:
> > >
> > > > 'make ARCH=arm dtbs_check' emits the following warning:
> > > >
> > > >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> > > >
> > > > Maybe, simple-mfd could be a better fit for this device.
> > >
> > > The two should be equivalent.
> >
> > Yes, I know.
> > That's why I can change "simple-bus" to "simple-mfd"
> > with no risk.
> >
> > The difference is schema-check.
> >
> > The node name for "simple-bus" is checked by 'make dtbs_check'.
> >
> > See this code:
> > https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17
> >
> > Even if I rename the node, it does not accept the
> > unit name '1,1f00000'
> >
> > > What do you mean by "maybe"?  Does this squash the warning?
> >
> > "maybe" means I am not quite sure
> > which compatible is a better fit
> > to describe this device.
> >
> > As mentioned above, simple-bus and simple-mfd
> > are interchangeable from a driver point of view.
> >
> > This add-on board is integrated with various peripherals
> > such as 16550a serial, smsc9115 ether etc.
> > The address-decode is implemented in a CPLD device.
> > It has chip selects and local addresses, which are mapped to
> > the parent.
> >
> > It can be either simple-bus or simple-mfd, I think.
> >
> >
> > dt-schema checks the node name of simple-bus.
> > Currently, there is no check for simple-mfd.
> >
> > So, I think this patch is an easy solution
> > to fix the warning.
>
> Yes, looking at the documentation it seems as though 'simple-mfd'
> would be a better fit.  Is the device a single IP with various
> different functions?


Not an IP.

This is a small board that consists of
a CPLD + ethernet controller + serial controller + LED, etc.


>
> > Rob is in Cc. Please add comments if any.
> >
> > > Isn't the issue caused by the ','?
> >
> > Right.
> >
> > The node name of simple-bus
> > must meet the regular expression:
> > "^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$"
> >
> >
> > Even if I rename the node
> > "support-card@1,1f00000"
> > to "bus@1,1f00000", the warning is still
> > displayed due to ','
> >
> > "1,1f00000" means
> > the address 0x01f00000 of chip select 1.
>
> Is this an officially accepted format?


I am not sure if it is official.

Rob said the data fields should be separated by commas.
https://www.spinics.net/lists/devicetree/msg201565.html
Lee Jones June 25, 2020, 2:57 p.m. UTC | #5
On Thu, 25 Jun 2020, Masahiro Yamada wrote:

> On Thu, Jun 25, 2020 at 3:16 AM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Thu, 25 Jun 2020, Masahiro Yamada wrote:
> >
> > > On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
> > > >
> > > > On Tue, 23 Jun 2020, Masahiro Yamada wrote:
> > > >
> > > > > 'make ARCH=arm dtbs_check' emits the following warning:
> > > > >
> > > > >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> > > > >
> > > > > Maybe, simple-mfd could be a better fit for this device.
> > > >
> > > > The two should be equivalent.
> > >
> > > Yes, I know.
> > > That's why I can change "simple-bus" to "simple-mfd"
> > > with no risk.
> > >
> > > The difference is schema-check.
> > >
> > > The node name for "simple-bus" is checked by 'make dtbs_check'.
> > >
> > > See this code:
> > > https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17
> > >
> > > Even if I rename the node, it does not accept the
> > > unit name '1,1f00000'
> > >
> > > > What do you mean by "maybe"?  Does this squash the warning?
> > >
> > > "maybe" means I am not quite sure
> > > which compatible is a better fit
> > > to describe this device.
> > >
> > > As mentioned above, simple-bus and simple-mfd
> > > are interchangeable from a driver point of view.
> > >
> > > This add-on board is integrated with various peripherals
> > > such as 16550a serial, smsc9115 ether etc.
> > > The address-decode is implemented in a CPLD device.
> > > It has chip selects and local addresses, which are mapped to
> > > the parent.
> > >
> > > It can be either simple-bus or simple-mfd, I think.
> > >
> > >
> > > dt-schema checks the node name of simple-bus.
> > > Currently, there is no check for simple-mfd.
> > >
> > > So, I think this patch is an easy solution
> > > to fix the warning.
> >
> > Yes, looking at the documentation it seems as though 'simple-mfd'
> > would be a better fit.  Is the device a single IP with various
> > different functions?
> 
> Not an IP.
> 
> This is a small board that consists of
> a CPLD + ethernet controller + serial controller + LED, etc.

Then simple MFD does not seem like a good fit.

Neither does 'simple-bus'.

What is it you're trying to describe in the device hierarchy?

> > > Rob is in Cc. Please add comments if any.
> > >
> > > > Isn't the issue caused by the ','?
> > >
> > > Right.
> > >
> > > The node name of simple-bus
> > > must meet the regular expression:
> > > "^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$"
> > >
> > >
> > > Even if I rename the node
> > > "support-card@1,1f00000"
> > > to "bus@1,1f00000", the warning is still
> > > displayed due to ','
> > >
> > > "1,1f00000" means
> > > the address 0x01f00000 of chip select 1.
> >
> > Is this an officially accepted format?
> 
> I am not sure if it is official.
> 
> Rob said the data fields should be separated by commas.
> https://www.spinics.net/lists/devicetree/msg201565.html

Are you sure he doesn't mean in the 'reg' property.

Rather than the node-name@NNNNNNNN syntax.

BTW, I think the error you link to above is related to the
node-name@NNNNNNNN not matching the value listed in the 'reg'
property.
Masahiro Yamada June 29, 2020, 1:58 a.m. UTC | #6
On Thu, Jun 25, 2020 at 11:57 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Thu, 25 Jun 2020, Masahiro Yamada wrote:
>
> > On Thu, Jun 25, 2020 at 3:16 AM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Thu, 25 Jun 2020, Masahiro Yamada wrote:
> > >
> > > > On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
> > > > >
> > > > > On Tue, 23 Jun 2020, Masahiro Yamada wrote:
> > > > >
> > > > > > 'make ARCH=arm dtbs_check' emits the following warning:
> > > > > >
> > > > > >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> > > > > >
> > > > > > Maybe, simple-mfd could be a better fit for this device.
> > > > >
> > > > > The two should be equivalent.
> > > >
> > > > Yes, I know.
> > > > That's why I can change "simple-bus" to "simple-mfd"
> > > > with no risk.
> > > >
> > > > The difference is schema-check.
> > > >
> > > > The node name for "simple-bus" is checked by 'make dtbs_check'.
> > > >
> > > > See this code:
> > > > https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17
> > > >
> > > > Even if I rename the node, it does not accept the
> > > > unit name '1,1f00000'
> > > >
> > > > > What do you mean by "maybe"?  Does this squash the warning?
> > > >
> > > > "maybe" means I am not quite sure
> > > > which compatible is a better fit
> > > > to describe this device.
> > > >
> > > > As mentioned above, simple-bus and simple-mfd
> > > > are interchangeable from a driver point of view.
> > > >
> > > > This add-on board is integrated with various peripherals
> > > > such as 16550a serial, smsc9115 ether etc.
> > > > The address-decode is implemented in a CPLD device.
> > > > It has chip selects and local addresses, which are mapped to
> > > > the parent.
> > > >
> > > > It can be either simple-bus or simple-mfd, I think.
> > > >
> > > >
> > > > dt-schema checks the node name of simple-bus.
> > > > Currently, there is no check for simple-mfd.
> > > >
> > > > So, I think this patch is an easy solution
> > > > to fix the warning.
> > >
> > > Yes, looking at the documentation it seems as though 'simple-mfd'
> > > would be a better fit.  Is the device a single IP with various
> > > different functions?
> >
> > Not an IP.
> >
> > This is a small board that consists of
> > a CPLD + ethernet controller + serial controller + LED, etc.
>
> Then simple MFD does not seem like a good fit.
>
> Neither does 'simple-bus'.

Then, I do not know what to do.


This board connection is so simple
that no hardware initialization needed to get access
to peripherals.

So, 'simple-bus' or 'simple-mfd' is preferred.

If this is not either simple-bus or simple-mfd,
I need a special driver to probe the
child devices such as ethernet, serial etc.



> What is it you're trying to describe in the device hierarchy?


The connection is as follows:


|-Main board -|      |----- add-on board ----|
|             |      |     (this board)      |
|             |      |                       |
|    (SoC) ---|------|--- CPLD --- ethernet  |
|             |      |          |- serial    |
|-------------|      |          |- LED       |
                     |                       |
                     |-----------------------|



uniphier-support-card.dtsi describes the
"add-on board" part.
Address-decode is implemented in CPLD.


So, the criteria to become MFD is
whether it is an IP integrated into SoC.


- implemented in an SoC  --> MFD

- implemented in a board + CPLD  --> not MFD


Right?




>
> > > > Rob is in Cc. Please add comments if any.
> > > >
> > > > > Isn't the issue caused by the ','?
> > > >
> > > > Right.
> > > >
> > > > The node name of simple-bus
> > > > must meet the regular expression:
> > > > "^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$"
> > > >
> > > >
> > > > Even if I rename the node
> > > > "support-card@1,1f00000"
> > > > to "bus@1,1f00000", the warning is still
> > > > displayed due to ','
> > > >
> > > > "1,1f00000" means
> > > > the address 0x01f00000 of chip select 1.
> > >
> > > Is this an officially accepted format?
> >
> > I am not sure if it is official.
> >
> > Rob said the data fields should be separated by commas.
> > https://www.spinics.net/lists/devicetree/msg201565.html
>
> Are you sure he doesn't mean in the 'reg' property.
>
> Rather than the node-name@NNNNNNNN syntax.
>
> BTW, I think the error you link to above is related to the
> node-name@NNNNNNNN not matching the value listed in the 'reg'
> property.


If I get rid of @NNNNNNNN part,
DTC warns the following for W=1 builds:

arch/arm/boot/dts/uniphier-support-card.dtsi:12.29-32.4: Warning
(unit_address_vs_reg): /soc/system-bus@58c00000/support-card: node has
a reg or ranges property, but no unit name



So, 'reg' or 'range' requires a unit name.

A unit name should be a base address.
If it has a chip select, the format is
<chip-select>,<base-address>

But the schema does not allow commas
in a unit name of simple-bus.

This is the problem I am trying to do something for.





>
> --
> Lee Jones [李琼斯]
> Senior Technical Lead - Developer Services
> Linaro.org │ Open source software for Arm SoCs
> Follow Linaro: Facebook | Twitter | Blog
Lee Jones June 29, 2020, 7:36 a.m. UTC | #7
On Mon, 29 Jun 2020, Masahiro Yamada wrote:

> On Thu, Jun 25, 2020 at 11:57 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Thu, 25 Jun 2020, Masahiro Yamada wrote:
> >
> > > On Thu, Jun 25, 2020 at 3:16 AM Lee Jones <lee.jones@linaro.org> wrote:
> > > >
> > > > On Thu, 25 Jun 2020, Masahiro Yamada wrote:
> > > >
> > > > > On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
> > > > > >
> > > > > > On Tue, 23 Jun 2020, Masahiro Yamada wrote:
> > > > > >
> > > > > > > 'make ARCH=arm dtbs_check' emits the following warning:
> > > > > > >
> > > > > > >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> > > > > > >
> > > > > > > Maybe, simple-mfd could be a better fit for this device.
> > > > > >
> > > > > > The two should be equivalent.
> > > > >
> > > > > Yes, I know.
> > > > > That's why I can change "simple-bus" to "simple-mfd"
> > > > > with no risk.
> > > > >
> > > > > The difference is schema-check.
> > > > >
> > > > > The node name for "simple-bus" is checked by 'make dtbs_check'.
> > > > >
> > > > > See this code:
> > > > > https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17
> > > > >
> > > > > Even if I rename the node, it does not accept the
> > > > > unit name '1,1f00000'
> > > > >
> > > > > > What do you mean by "maybe"?  Does this squash the warning?
> > > > >
> > > > > "maybe" means I am not quite sure
> > > > > which compatible is a better fit
> > > > > to describe this device.
> > > > >
> > > > > As mentioned above, simple-bus and simple-mfd
> > > > > are interchangeable from a driver point of view.
> > > > >
> > > > > This add-on board is integrated with various peripherals
> > > > > such as 16550a serial, smsc9115 ether etc.
> > > > > The address-decode is implemented in a CPLD device.
> > > > > It has chip selects and local addresses, which are mapped to
> > > > > the parent.
> > > > >
> > > > > It can be either simple-bus or simple-mfd, I think.
> > > > >
> > > > >
> > > > > dt-schema checks the node name of simple-bus.
> > > > > Currently, there is no check for simple-mfd.
> > > > >
> > > > > So, I think this patch is an easy solution
> > > > > to fix the warning.
> > > >
> > > > Yes, looking at the documentation it seems as though 'simple-mfd'
> > > > would be a better fit.  Is the device a single IP with various
> > > > different functions?
> > >
> > > Not an IP.
> > >
> > > This is a small board that consists of
> > > a CPLD + ethernet controller + serial controller + LED, etc.
> >
> > Then simple MFD does not seem like a good fit.
> >
> > Neither does 'simple-bus'.
> 
> Then, I do not know what to do.
> 
> 
> This board connection is so simple
> that no hardware initialization needed to get access
> to peripherals.
> 
> So, 'simple-bus' or 'simple-mfd' is preferred.
> 
> If this is not either simple-bus or simple-mfd,
> I need a special driver to probe the
> child devices such as ethernet, serial etc.
> 
> 
> 
> > What is it you're trying to describe in the device hierarchy?
> 
> 
> The connection is as follows:
> 
> 
> |-Main board -|      |----- add-on board ----|
> |             |      |     (this board)      |
> |             |      |                       |
> |    (SoC) ---|------|--- CPLD --- ethernet  |
> |             |      |          |- serial    |
> |-------------|      |          |- LED       |
>                      |                       |
>                      |-----------------------|
> 
> 
> 
> uniphier-support-card.dtsi describes the
> "add-on board" part.
> Address-decode is implemented in CPLD.
> 
> 
> So, the criteria to become MFD is
> whether it is an IP integrated into SoC.
> 
> 
> - implemented in an SoC  --> MFD

If

 s/in an SoC/in a single piece of silicon/

... then yes.

> - implemented in a board + CPLD  --> not MFD
> 
> Right?

Right.  Unless all H/W is represented inside the CPLD, in which case
the CPLD is, in theory, the MFD.  Although, due to the nature of
CPLDs, this is a slippery slope.

You may want something like:

  arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts

... where the add-on board is represented separately (not in the
same hierarchical structure as the main board.  The main board is then
included as a DTSI from the add-on board.

It might also be worth looking at how consumer boards such as the
RaspberryPi, BeagleBoard and the like handle their add-on boards,
mezzanines, capes, hats, etc.
Lee Jones June 29, 2020, 7:43 a.m. UTC | #8
On Mon, 29 Jun 2020, Lee Jones wrote:

> On Mon, 29 Jun 2020, Masahiro Yamada wrote:
> 
> > On Thu, Jun 25, 2020 at 11:57 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Thu, 25 Jun 2020, Masahiro Yamada wrote:
> > >
> > > > On Thu, Jun 25, 2020 at 3:16 AM Lee Jones <lee.jones@linaro.org> wrote:
> > > > >
> > > > > On Thu, 25 Jun 2020, Masahiro Yamada wrote:
> > > > >
> > > > > > On Tue, Jun 23, 2020 at 9:24 PM Lee Jones <lee.jones@linaro.org> wrote:
> > > > > > >
> > > > > > > On Tue, 23 Jun 2020, Masahiro Yamada wrote:
> > > > > > >
> > > > > > > > 'make ARCH=arm dtbs_check' emits the following warning:
> > > > > > > >
> > > > > > > >   support-card@1,1f00000: $nodename:0: 'support-card@1,1f00000' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
> > > > > > > >
> > > > > > > > Maybe, simple-mfd could be a better fit for this device.
> > > > > > >
> > > > > > > The two should be equivalent.
> > > > > >
> > > > > > Yes, I know.
> > > > > > That's why I can change "simple-bus" to "simple-mfd"
> > > > > > with no risk.
> > > > > >
> > > > > > The difference is schema-check.
> > > > > >
> > > > > > The node name for "simple-bus" is checked by 'make dtbs_check'.
> > > > > >
> > > > > > See this code:
> > > > > > https://github.com/robherring/dt-schema/blob/v2020.05/schemas/simple-bus.yaml#L17
> > > > > >
> > > > > > Even if I rename the node, it does not accept the
> > > > > > unit name '1,1f00000'
> > > > > >
> > > > > > > What do you mean by "maybe"?  Does this squash the warning?
> > > > > >
> > > > > > "maybe" means I am not quite sure
> > > > > > which compatible is a better fit
> > > > > > to describe this device.
> > > > > >
> > > > > > As mentioned above, simple-bus and simple-mfd
> > > > > > are interchangeable from a driver point of view.
> > > > > >
> > > > > > This add-on board is integrated with various peripherals
> > > > > > such as 16550a serial, smsc9115 ether etc.
> > > > > > The address-decode is implemented in a CPLD device.
> > > > > > It has chip selects and local addresses, which are mapped to
> > > > > > the parent.
> > > > > >
> > > > > > It can be either simple-bus or simple-mfd, I think.
> > > > > >
> > > > > >
> > > > > > dt-schema checks the node name of simple-bus.
> > > > > > Currently, there is no check for simple-mfd.
> > > > > >
> > > > > > So, I think this patch is an easy solution
> > > > > > to fix the warning.
> > > > >
> > > > > Yes, looking at the documentation it seems as though 'simple-mfd'
> > > > > would be a better fit.  Is the device a single IP with various
> > > > > different functions?
> > > >
> > > > Not an IP.
> > > >
> > > > This is a small board that consists of
> > > > a CPLD + ethernet controller + serial controller + LED, etc.
> > >
> > > Then simple MFD does not seem like a good fit.
> > >
> > > Neither does 'simple-bus'.
> > 
> > Then, I do not know what to do.
> > 
> > 
> > This board connection is so simple
> > that no hardware initialization needed to get access
> > to peripherals.
> > 
> > So, 'simple-bus' or 'simple-mfd' is preferred.
> > 
> > If this is not either simple-bus or simple-mfd,
> > I need a special driver to probe the
> > child devices such as ethernet, serial etc.
> > 
> > 
> > 
> > > What is it you're trying to describe in the device hierarchy?
> > 
> > 
> > The connection is as follows:
> > 
> > 
> > |-Main board -|      |----- add-on board ----|
> > |             |      |     (this board)      |
> > |             |      |                       |
> > |    (SoC) ---|------|--- CPLD --- ethernet  |
> > |             |      |          |- serial    |
> > |-------------|      |          |- LED       |
> >                      |                       |
> >                      |-----------------------|
> > 
> > 
> > 
> > uniphier-support-card.dtsi describes the
> > "add-on board" part.
> > Address-decode is implemented in CPLD.
> > 
> > 
> > So, the criteria to become MFD is
> > whether it is an IP integrated into SoC.
> > 
> > 
> > - implemented in an SoC  --> MFD
> 
> If
> 
>  s/in an SoC/in a single piece of silicon/
> 
> ... then yes.
> 
> > - implemented in a board + CPLD  --> not MFD
> > 
> > Right?
> 
> Right.  Unless all H/W is represented inside the CPLD, in which case
> the CPLD is, in theory, the MFD.  Although, due to the nature of
> CPLDs, this is a slippery slope.
> 
> You may want something like:
> 
>   arch/arm64/boot/dts/rockchip/rk3399-roc-pc-mezzanine.dts
> 
> ... where the add-on board is represented separately (not in the
> same hierarchical structure as the main board.  The main board is then
> included as a DTSI from the add-on board.
> 
> It might also be worth looking at how consumer boards such as the
> RaspberryPi, BeagleBoard and the like handle their add-on boards,
> mezzanines, capes, hats, etc.

Another option; if the add-on board PCB really doesn't do anything
except provide some copper lines to the on-board components, then does
it need representing in Device Tree at all?  I suggest not.

Your issue will come when you want to swap out that board and insert
another, which contains different functionality.  This is why it would
be better to represent the whole board as an orthogonal *.dts file.
Whether you decide to lay it out as it's own board (as above) or as
children to the system-bus will be up to you.
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/uniphier-support-card.dtsi b/arch/arm/boot/dts/uniphier-support-card.dtsi
index 11e46e7de7c5..eedc10cbc6e6 100644
--- a/arch/arm/boot/dts/uniphier-support-card.dtsi
+++ b/arch/arm/boot/dts/uniphier-support-card.dtsi
@@ -10,7 +10,7 @@  &system_bus {
 	ranges = <1 0x00000000 0x42000000 0x02000000>;
 
 	support_card: support-card@1,1f00000 {
-		compatible = "simple-bus";
+		compatible = "simple-mfd";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges = <0x00000000 1 0x01f00000 0x00100000>;