All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes
@ 2021-12-03 18:35 Sam Protsenko
  2021-12-06 20:19 ` Rob Herring
  2021-12-06 20:19 ` Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Sam Protsenko @ 2021-12-03 18:35 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, Masahiro Yamada,
	David Virag, Jaewon Kim, linux-samsung-soc, devicetree,
	linux-kernel

There are valid cases when two nodes can have the same address. For
example, in Exynos SoCs there is USI IP-core, which might be configured
to provide UART, SPI or I2C block, all of which having the same base
register address. But only one can be enabled at a time. That looks like
this:

    usi@138200c0 {
        serial@13820000 {
            status = "okay";
        };

        i2c@13820000 {
            status = "disabled";
        };
    };

When running "make dt_binding_check", it reports next warning:

    Warning (unique_unit_address):
    /example-0/usi@138200c0/serial@13820000:
    duplicate unit-address (also used in node
    /example-0/usi@138200c0/i2c@13820000)

Disable "unique_unit_address" in DTC_FLAGS to suppress warnings like
that, but enable "unique_unit_address_if_enabled" warning, so that dtc
still reports a warning when two enabled nodes are having the same
address.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reported-by: Rob Herring <robh@kernel.org>
Suggested-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
index c9abfbe3f0aa..41c555181b6f 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -65,7 +65,9 @@ DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd)))
 override DTC_FLAGS := \
 	-Wno-avoid_unnecessary_addr_size \
 	-Wno-graph_child_address \
-	-Wno-interrupt_provider
+	-Wno-interrupt_provider \
+	-Wno-unique_unit_address \
+	-Wunique_unit_address_if_enabled
 
 # Disable undocumented compatible checks until warning free
 override DT_CHECKER_FLAGS ?=
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes
  2021-12-03 18:35 [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes Sam Protsenko
@ 2021-12-06 20:19 ` Rob Herring
  2021-12-07 12:16   ` Sam Protsenko
  2021-12-06 20:19 ` Rob Herring
  1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2021-12-06 20:19 UTC (permalink / raw)
  To: Sam Protsenko
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, Masahiro Yamada,
	David Virag, Jaewon Kim, linux-samsung-soc, devicetree,
	linux-kernel

On Fri, Dec 03, 2021 at 08:35:17PM +0200, Sam Protsenko wrote:
> There are valid cases when two nodes can have the same address. For
> example, in Exynos SoCs there is USI IP-core, which might be configured
> to provide UART, SPI or I2C block, all of which having the same base
> register address. But only one can be enabled at a time. That looks like
> this:
> 
>     usi@138200c0 {
>         serial@13820000 {
>             status = "okay";
>         };
> 
>         i2c@13820000 {
>             status = "disabled";
>         };
>     };
> 
> When running "make dt_binding_check", it reports next warning:
> 
>     Warning (unique_unit_address):
>     /example-0/usi@138200c0/serial@13820000:
>     duplicate unit-address (also used in node
>     /example-0/usi@138200c0/i2c@13820000)
> 
> Disable "unique_unit_address" in DTC_FLAGS to suppress warnings like
> that, but enable "unique_unit_address_if_enabled" warning, so that dtc
> still reports a warning when two enabled nodes are having the same
> address.

Presumably you have a dts file needing the same thing, so I'll be 
expecting a patch for that too. That's in scripts/Makefile.lib BTW.

> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> Reported-by: Rob Herring <robh@kernel.org>
> Suggested-by: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> index c9abfbe3f0aa..41c555181b6f 100644
> --- a/Documentation/devicetree/bindings/Makefile
> +++ b/Documentation/devicetree/bindings/Makefile
> @@ -65,7 +65,9 @@ DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd)))
>  override DTC_FLAGS := \
>  	-Wno-avoid_unnecessary_addr_size \
>  	-Wno-graph_child_address \
> -	-Wno-interrupt_provider
> +	-Wno-interrupt_provider \
> +	-Wno-unique_unit_address \
> +	-Wunique_unit_address_if_enabled
>  
>  # Disable undocumented compatible checks until warning free
>  override DT_CHECKER_FLAGS ?=
> -- 
> 2.30.2
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes
  2021-12-03 18:35 [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes Sam Protsenko
  2021-12-06 20:19 ` Rob Herring
@ 2021-12-06 20:19 ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2021-12-06 20:19 UTC (permalink / raw)
  To: Sam Protsenko
  Cc: Jaewon Kim, Geert Uytterhoeven, Rob Herring, linux-kernel,
	Krzysztof Kozlowski, David Virag, Masahiro Yamada, devicetree,
	linux-samsung-soc

On Fri, 03 Dec 2021 20:35:17 +0200, Sam Protsenko wrote:
> There are valid cases when two nodes can have the same address. For
> example, in Exynos SoCs there is USI IP-core, which might be configured
> to provide UART, SPI or I2C block, all of which having the same base
> register address. But only one can be enabled at a time. That looks like
> this:
> 
>     usi@138200c0 {
>         serial@13820000 {
>             status = "okay";
>         };
> 
>         i2c@13820000 {
>             status = "disabled";
>         };
>     };
> 
> When running "make dt_binding_check", it reports next warning:
> 
>     Warning (unique_unit_address):
>     /example-0/usi@138200c0/serial@13820000:
>     duplicate unit-address (also used in node
>     /example-0/usi@138200c0/i2c@13820000)
> 
> Disable "unique_unit_address" in DTC_FLAGS to suppress warnings like
> that, but enable "unique_unit_address_if_enabled" warning, so that dtc
> still reports a warning when two enabled nodes are having the same
> address.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> Reported-by: Rob Herring <robh@kernel.org>
> Suggested-by: Rob Herring <robh@kernel.org>
> ---
>  Documentation/devicetree/bindings/Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes
  2021-12-06 20:19 ` Rob Herring
@ 2021-12-07 12:16   ` Sam Protsenko
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Protsenko @ 2021-12-07 12:16 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, Masahiro Yamada,
	David Virag, Jaewon Kim, linux-samsung-soc, devicetree,
	linux-kernel

On Mon, 6 Dec 2021 at 22:19, Rob Herring <robh@kernel.org> wrote:
>
> On Fri, Dec 03, 2021 at 08:35:17PM +0200, Sam Protsenko wrote:
> > There are valid cases when two nodes can have the same address. For
> > example, in Exynos SoCs there is USI IP-core, which might be configured
> > to provide UART, SPI or I2C block, all of which having the same base
> > register address. But only one can be enabled at a time. That looks like
> > this:
> >
> >     usi@138200c0 {
> >         serial@13820000 {
> >             status = "okay";
> >         };
> >
> >         i2c@13820000 {
> >             status = "disabled";
> >         };
> >     };
> >
> > When running "make dt_binding_check", it reports next warning:
> >
> >     Warning (unique_unit_address):
> >     /example-0/usi@138200c0/serial@13820000:
> >     duplicate unit-address (also used in node
> >     /example-0/usi@138200c0/i2c@13820000)
> >
> > Disable "unique_unit_address" in DTC_FLAGS to suppress warnings like
> > that, but enable "unique_unit_address_if_enabled" warning, so that dtc
> > still reports a warning when two enabled nodes are having the same
> > address.
>
> Presumably you have a dts file needing the same thing, so I'll be
> expecting a patch for that too. That's in scripts/Makefile.lib BTW.
>

'-Wno-unique_unit_address' is already in scripts/Makefile.lib, and
when I add '-Wunique_unit_address_if_enabled' there, "make dtbs_check"
reports a lot of warnings (for ARCH=arm64 at least). Among obvious
bugs found, there are some cases like this:

        qfprom@784000 {
            compatible = "qcom,qfprom";
            reg = <0 0x00784000 0 0x8ff>;
            #address-cells = <1>;
            #size-cells = <1>;

            qusb2p_hstx_trim: hstx-trim-primary@1eb {
                reg = <0x1eb 0x1>;
                bits = <1 4>;
            };

            qusb2s_hstx_trim: hstx-trim-secondary@1eb {
                reg = <0x1eb 0x2>;
                bits = <6 4>;
            };
        };

where "dtbs_check" doesn't like duplicated "reg = <0x1eb 0x2>;" line.

I'll send the patch soon. Just want you to be on the same page about
side effects from that, because I'm not completely sure it's ok.

> >
> > Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> > Reported-by: Rob Herring <robh@kernel.org>
> > Suggested-by: Rob Herring <robh@kernel.org>
> > ---
> >  Documentation/devicetree/bindings/Makefile | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/Makefile b/Documentation/devicetree/bindings/Makefile
> > index c9abfbe3f0aa..41c555181b6f 100644
> > --- a/Documentation/devicetree/bindings/Makefile
> > +++ b/Documentation/devicetree/bindings/Makefile
> > @@ -65,7 +65,9 @@ DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd)))
> >  override DTC_FLAGS := \
> >       -Wno-avoid_unnecessary_addr_size \
> >       -Wno-graph_child_address \
> > -     -Wno-interrupt_provider
> > +     -Wno-interrupt_provider \
> > +     -Wno-unique_unit_address \
> > +     -Wunique_unit_address_if_enabled
> >
> >  # Disable undocumented compatible checks until warning free
> >  override DT_CHECKER_FLAGS ?=
> > --
> > 2.30.2
> >
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-07 12:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 18:35 [PATCH] dt-bindings: Only show unique unit address warning for enabled nodes Sam Protsenko
2021-12-06 20:19 ` Rob Herring
2021-12-07 12:16   ` Sam Protsenko
2021-12-06 20:19 ` Rob Herring

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.