diff mbox series

[2/2] dt-bindings: serial: pl011: Avoid matching device tree nodes of variant pl011 drivers

Message ID 20210520115440.8259-3-thunder.leizhen@huawei.com
State New
Headers show
Series dt-bindings: serial: pl011: Avoid matching device tree nodes of variant pl011 drivers | expand

Commit Message

Zhen Lei May 20, 2021, 11:54 a.m. UTC
There is a variant driver of pl011, which may have a compatible string
written as: "arm,sbsa-uart", "arm,pl011". Because it contains "arm,pl011",
so the corresponding device tree nodes are also checked by this YAML file.
As a result, many flase warnings similar to the following are reported:

arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-cx.dt.yaml:
 serial@21c0000: compatible:0: 'arm,pl011' was expected
 serial@21c0000: compatible:1: 'arm,primecell' was expected

Change to only check the device tree nodes that are matched exactly.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

---
 Documentation/devicetree/bindings/serial/pl011.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.21.1

Comments

Zhen Lei May 21, 2021, 1:29 a.m. UTC | #1
On 2021/5/20 19:54, Zhen Lei wrote:
> There is a variant driver of pl011, which may have a compatible string

> written as: "arm,sbsa-uart", "arm,pl011". Because it contains "arm,pl011",

> so the corresponding device tree nodes are also checked by this YAML file.

> As a result, many flase warnings similar to the following are reported:

> 

> arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-cx.dt.yaml:

>  serial@21c0000: compatible:0: 'arm,pl011' was expected

>  serial@21c0000: compatible:1: 'arm,primecell' was expected

> 

> Change to only check the device tree nodes that are matched exactly.


Hi, all:
  This morning I rethought, and there's something wrong with this change.
The compatibles that are incorrectly written cannot be identified, for
example, only "arm,pl011". I'll think of something else.

> 

> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

> ---

>  Documentation/devicetree/bindings/serial/pl011.yaml | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

> 

> diff --git a/Documentation/devicetree/bindings/serial/pl011.yaml b/Documentation/devicetree/bindings/serial/pl011.yaml

> index 5ea00f8a283d..3683e4567645 100644

> --- a/Documentation/devicetree/bindings/serial/pl011.yaml

> +++ b/Documentation/devicetree/bindings/serial/pl011.yaml

> @@ -16,9 +16,9 @@ allOf:

>  select:

>    properties:

>      compatible:

> -      contains:

> -        enum:

> -          - arm,pl011

> +      items:

> +        - const: arm,pl011

> +        - const: arm,primecell

>    required:

>      - compatible

>  

>
Rob Herring May 21, 2021, 6:54 p.m. UTC | #2
On Thu, May 20, 2021 at 6:54 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:
>
> There is a variant driver of pl011, which may have a compatible string
> written as: "arm,sbsa-uart", "arm,pl011". Because it contains "arm,pl011",
> so the corresponding device tree nodes are also checked by this YAML file.
> As a result, many flase warnings similar to the following are reported:
>
> arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-cx.dt.yaml:
>  serial@21c0000: compatible:0: 'arm,pl011' was expected
>  serial@21c0000: compatible:1: 'arm,primecell' was expected

The DT is wrong. The h/w is either a PL011 or it isn't. If it is, then
the compatible should be '"arm,pl011", "arm,primecell"'. There is no
point in making it 'arm,sbsa-uart' as the PL011 (and OS support for
it) predate SBSA (by a lot). If it is not a PL011 and only the SBSA
subset, then it should be "arm,sbsa-uart".

Rob
Zhen Lei May 24, 2021, 2:12 a.m. UTC | #3
On 2021/5/22 2:54, Rob Herring wrote:
> On Thu, May 20, 2021 at 6:54 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:

>>

>> There is a variant driver of pl011, which may have a compatible string

>> written as: "arm,sbsa-uart", "arm,pl011". Because it contains "arm,pl011",

>> so the corresponding device tree nodes are also checked by this YAML file.

>> As a result, many flase warnings similar to the following are reported:

>>

>> arch/arm64/boot/dts/freescale/fsl-lx2160a-clearfog-cx.dt.yaml:

>>  serial@21c0000: compatible:0: 'arm,pl011' was expected

>>  serial@21c0000: compatible:1: 'arm,primecell' was expected

> 

> The DT is wrong. The h/w is either a PL011 or it isn't. If it is, then

> the compatible should be '"arm,pl011", "arm,primecell"'. There is no

> point in making it 'arm,sbsa-uart' as the PL011 (and OS support for

> it) predate SBSA (by a lot). If it is not a PL011 and only the SBSA

> subset, then it should be "arm,sbsa-uart".


Yes, I agree. I'll send a patch to fix the freescale's dts.

arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi:923:                 compatible = "arm,sbsa-uart","arm,pl011";
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi:931:                 compatible = "arm,sbsa-uart","arm,pl011";
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi:939:                 compatible = "arm,sbsa-uart","arm,pl011";
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi:947:                 compatible = "arm,sbsa-uart","arm,pl011";
arch/arm64/boot/dts/hisilicon/hip07.dtsi:1242:                      compatible = "arm,sbsa-uart";


> 

> Rob

> 

> .

>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/serial/pl011.yaml b/Documentation/devicetree/bindings/serial/pl011.yaml
index 5ea00f8a283d..3683e4567645 100644
--- a/Documentation/devicetree/bindings/serial/pl011.yaml
+++ b/Documentation/devicetree/bindings/serial/pl011.yaml
@@ -16,9 +16,9 @@  allOf:
 select:
   properties:
     compatible:
-      contains:
-        enum:
-          - arm,pl011
+      items:
+        - const: arm,pl011
+        - const: arm,primecell
   required:
     - compatible