diff mbox series

dt-bindings: Only show unique unit address warning for enabled nodes

Message ID 20211203183517.11390-1-semen.protsenko@linaro.org
State New
Headers show
Series dt-bindings: Only show unique unit address warning for enabled nodes | expand

Commit Message

Sam Protsenko Dec. 3, 2021, 6:35 p.m. UTC
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(-)

Comments

Rob Herring Dec. 6, 2021, 8:19 p.m. UTC | #1
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
> 
>
diff mbox series

Patch

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 ?=