Skip to contentSkip to conversation

dt-bindings: serial: pl011: Avoid matching device tree nodes of variant pl011 drivers

PATCH In review Zhen Lei 2 participants 7 messages May 20, 2021 – May 24, 2021

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

cover dt-bindings: serial: pl011: Avoid matching device tree nodes of variant pl011 drivers

Zhen Lei (2):
dt-bindings: serial: pl011: Delete an incorrect compatible string
dt-bindings: serial: pl011: Avoid matching device tree nodes of
variant pl011 drivers

 .../devicetree/bindings/serial/pl011.yaml         | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
Signature · 1 line
2.21.1
author
#1 lore raw

PATCH 1/2 dt-bindings: serial: pl011: Delete an incorrect compatible string

The compatible strings "zte,zx296702-uart" and "arm,primecell" are a combination, but commit 89d4f98ae90d ("ARM: remove zte zx platform") removes only the former. It is incorrect to match driver pl011 based only on the remaining "arm,primecell". Delete it.

---
 Documentation/devicetree/bindings/serial/pl011.yaml | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +3 -6
index 142187337c76..5ea00f8a283d 100644
@@ -24,12 +24,9 @@ select:
 
 properties:
   compatible:
-    oneOf:
-      - items:
-          - const: arm,pl011
-          - const: arm,primecell
-      - items:
-          - const: arm,primecell
+    items:
+      - const: arm,pl011
+      - const: arm,primecell
 
   reg:
     maxItems: 1
Signature · 1 line
2.21.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Delete an incorrect compatible string

Quoted 10 lines · Zhen Lei

The compatible strings "zte,zx296702-uart" and "arm,primecell" are a combination, but commit 89d4f98ae90d ("ARM: remove zte zx platform") removes only the former. It is incorrect to match driver pl011 based only on the remaining "arm,primecell". Delete it.

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

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

In reply to Zhen Lei

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.

---
 Documentation/devicetree/bindings/serial/pl011.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +3 -3
index 5ea00f8a283d..3683e4567645 100644
@@ -16,9 +16,9 @@ allOf:
 select:
   properties:
     compatible:
-      contains:
-        enum:
-          - arm,pl011
+      items:
+        - const: arm,pl011
+        - const: arm,primecell
   required:
     - compatible
 
Signature · 1 line
2.21.1
#4 lore raw
Quoted 10 lines · Zhen Lei

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.

Quoted 24 lines
---
 Documentation/devicetree/bindings/serial/pl011.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +3 -3
index 5ea00f8a283d..3683e4567645 100644
@@ -16,9 +16,9 @@ allOf:
 select:
   properties:
     compatible:
-      contains:
-        enum:
-          - arm,pl011
+      items:
+        - const: arm,pl011
+        - const: arm,primecell
   required:
     - compatible
 
#5 lore raw
In reply to Zhen Lei
Quoted 9 lines · Zhen Lei

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

#6 lore raw
Quoted 11 lines · Rob Herring
Quoted 9 lines · Zhen Lei

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

Quoted 5 lines

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";
Quoted 5 lines

Rob

.