diff mbox series

[v3,13/15] dt-bindings: ata: Convert Broadcom SATA to YAML

Message ID 20211208003727.3596577-14-f.fainelli@gmail.com (mailing list archive)
State New, archived
Headers show
Series Broadcom DT bindings updates to YAML | expand

Commit Message

Florian Fainelli Dec. 8, 2021, 12:37 a.m. UTC
Convert the Broadcom SATA3 AHCI controller Device Tree binding to YAML
to help with validation.

Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../bindings/ata/brcm,sata-brcm.txt           | 45 ---------
 .../bindings/ata/brcm,sata-brcm.yaml          | 98 +++++++++++++++++++
 2 files changed, 98 insertions(+), 45 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
 create mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml

Comments

Rob Herring (Arm) Dec. 8, 2021, 1:44 p.m. UTC | #1
On Tue, 07 Dec 2021 16:37:24 -0800, Florian Fainelli wrote:
> Convert the Broadcom SATA3 AHCI controller Device Tree binding to YAML
> to help with validation.
> 
> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  .../bindings/ata/brcm,sata-brcm.txt           | 45 ---------
>  .../bindings/ata/brcm,sata-brcm.yaml          | 98 +++++++++++++++++++
>  2 files changed, 98 insertions(+), 45 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
>  create mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
> 

Running 'make dtbs_check' with the schema in this patch gives the
following warnings. Consider if they are expected or the schema is
incorrect. These may not be new warnings.

Note that it is not yet a requirement to have 0 warnings for dtbs_check.
This will change in the future.

Full log is available here: https://patchwork.ozlabs.org/patch/1565011


ahci@41000: $nodename:0: 'ahci@41000' does not match '^sata(@.*)?$'
	arch/arm/boot/dts/bcm958522er.dt.yaml
	arch/arm/boot/dts/bcm958525er.dt.yaml
	arch/arm/boot/dts/bcm958525xmc.dt.yaml
	arch/arm/boot/dts/bcm958622hr.dt.yaml
	arch/arm/boot/dts/bcm958623hr.dt.yaml
	arch/arm/boot/dts/bcm958625hr.dt.yaml
	arch/arm/boot/dts/bcm958625k.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64-a0.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64w-a0.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64w.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx65.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx65w.dt.yaml
	arch/arm/boot/dts/bcm988312hr.dt.yaml

ahci@41000: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'sata-port@0', 'sata-port@1' were unexpected)
	arch/arm/boot/dts/bcm958522er.dt.yaml
	arch/arm/boot/dts/bcm958525er.dt.yaml
	arch/arm/boot/dts/bcm958525xmc.dt.yaml
	arch/arm/boot/dts/bcm958622hr.dt.yaml
	arch/arm/boot/dts/bcm958623hr.dt.yaml
	arch/arm/boot/dts/bcm958625hr.dt.yaml
	arch/arm/boot/dts/bcm958625k.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64-a0.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64w-a0.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx64w.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx65.dt.yaml
	arch/arm/boot/dts/bcm958625-meraki-mx65w.dt.yaml
	arch/arm/boot/dts/bcm988312hr.dt.yaml
Florian Fainelli Dec. 8, 2021, 5:33 p.m. UTC | #2
On 12/8/21 5:44 AM, Rob Herring wrote:
> On Tue, 07 Dec 2021 16:37:24 -0800, Florian Fainelli wrote:
>> Convert the Broadcom SATA3 AHCI controller Device Tree binding to YAML
>> to help with validation.
>>
>> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>  .../bindings/ata/brcm,sata-brcm.txt           | 45 ---------
>>  .../bindings/ata/brcm,sata-brcm.yaml          | 98 +++++++++++++++++++
>>  2 files changed, 98 insertions(+), 45 deletions(-)
>>  delete mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
>>  create mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
>>
> 
> Running 'make dtbs_check' with the schema in this patch gives the
> following warnings. Consider if they are expected or the schema is
> incorrect. These may not be new warnings.
> 
> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> This will change in the future.
> 
> Full log is available here: https://patchwork.ozlabs.org/patch/1565011

Likewise, those indicate that the preceding patch which renames the sata
controller unit name has not been applied.
Rob Herring (Arm) Dec. 14, 2021, 6:28 p.m. UTC | #3
On Wed, Dec 08, 2021 at 09:33:38AM -0800, Florian Fainelli wrote:
> On 12/8/21 5:44 AM, Rob Herring wrote:
> > On Tue, 07 Dec 2021 16:37:24 -0800, Florian Fainelli wrote:
> >> Convert the Broadcom SATA3 AHCI controller Device Tree binding to YAML
> >> to help with validation.
> >>
> >> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >> ---
> >>  .../bindings/ata/brcm,sata-brcm.txt           | 45 ---------
> >>  .../bindings/ata/brcm,sata-brcm.yaml          | 98 +++++++++++++++++++
> >>  2 files changed, 98 insertions(+), 45 deletions(-)
> >>  delete mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
> >>  create mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
> >>
> > 
> > Running 'make dtbs_check' with the schema in this patch gives the
> > following warnings. Consider if they are expected or the schema is
> > incorrect. These may not be new warnings.
> > 
> > Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> > This will change in the future.
> > 
> > Full log is available here: https://patchwork.ozlabs.org/patch/1565011
> 
> Likewise, those indicate that the preceding patch which renames the sata
> controller unit name has not been applied.

I looked at that, but it was the unevaluated properties I was worried 
about. However, the example has the same thing, but no errors. I think 
running with DT_SCHEMA_FILES means sata-common.yaml is not included. 
I'll have to look into that.

Rob
Rob Herring (Arm) Dec. 14, 2021, 7:10 p.m. UTC | #4
On Tue, Dec 07, 2021 at 04:37:24PM -0800, Florian Fainelli wrote:
> Convert the Broadcom SATA3 AHCI controller Device Tree binding to YAML
> to help with validation.
> 
> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  .../bindings/ata/brcm,sata-brcm.txt           | 45 ---------
>  .../bindings/ata/brcm,sata-brcm.yaml          | 98 +++++++++++++++++++
>  2 files changed, 98 insertions(+), 45 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
>  create mode 100644 Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
> 
> diff --git a/Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt b/Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
> deleted file mode 100644
> index b9ae4ce4a0a0..000000000000
> --- a/Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -* Broadcom SATA3 AHCI Controller
> -
> -SATA nodes are defined to describe on-chip Serial ATA controllers.
> -Each SATA controller should have its own node.
> -
> -Required properties:
> -- compatible         : should be one or more of
> -			"brcm,bcm7216-ahci"
> -			"brcm,bcm7425-ahci"
> -			"brcm,bcm7445-ahci"
> -			"brcm,bcm-nsp-ahci"
> -			"brcm,sata3-ahci"
> -			"brcm,bcm63138-ahci"
> -- reg                : register mappings for AHCI and SATA_TOP_CTRL
> -- reg-names          : "ahci" and "top-ctrl"
> -- interrupts         : interrupt mapping for SATA IRQ
> -
> -Optional properties:
> -
> -- reset: for "brcm,bcm7216-ahci" must be a valid reset phandle
> -  pointing to the RESCAL reset controller provider node.
> -- reset-names: for "brcm,bcm7216-ahci", must be "rescal".
> -
> -Also see ahci-platform.txt.
> -
> -Example:
> -
> -	sata@f045a000 {
> -		compatible = "brcm,bcm7445-ahci", "brcm,sata3-ahci";
> -		reg = <0xf045a000 0xa9c>, <0xf0458040 0x24>;
> -		reg-names = "ahci", "top-ctrl";
> -		interrupts = <0 30 0>;
> -		#address-cells = <1>;
> -		#size-cells = <0>;
> -
> -		sata0: sata-port@0 {
> -			reg = <0>;
> -			phys = <&sata_phy 0>;
> -		};
> -
> -		sata1: sata-port@1 {
> -			reg = <1>;
> -			phys = <&sata_phy 1>;
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml b/Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
> new file mode 100644
> index 000000000000..3e24f45c65af
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
> @@ -0,0 +1,98 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/ata/brcm,sata-brcm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom SATA3 AHCI Controller
> +
> +description:
> +  SATA nodes are defined to describe on-chip Serial ATA controllers.
> +  Each SATA controller should have its own node.
> +
> +maintainers:
> +  - Florian Fainelli <f.fainelli@gmail.com>
> +
> +allOf:
> +  - $ref: sata-common.yaml#
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - brcm,bcm7216-ahci
> +          - const: brcm,sata3-ahci
> +      - items:
> +          - enum:
> +              - brcm,bcm7445-ahci
> +          - const: brcm,sata3-ahci
> +      - items:
> +          - enum:
> +              - brcm,bcm7425-ahci
> +          - const: brcm,sata3-ahci
> +      - items:
> +          - const: brcm,bcm-nsp-ahci
> +      - items:
> +          - enum:
> +              - brcm,bcm63138-ahci
> +          - const: brcm,sata3-ahci

Is there some reason this is not grouped into 2 oneOf entries? If not, I 
can fixup.

> +
> +  reg:
> +    minItems: 2
> +    maxItems: 2
> +
> +  reg-names:
> +    items:
> +      - const: ahci
> +      - const: top-ctrl
> +
> +  interrupts: true

maxItems: 1 ?

> +
> +  dma-coherent: true
> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - brcm,bcm7216-ahci
> +          - brcm,bcm63138-ahci
> +then:
> +  properties:
> +    resets:
> +      maxItems: 1
> +    reset-names:
> +      enum:
> +        - rescal
> +        - ahci
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - "#address-cells"
> +  - "#size-cells"
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    sata@f045a000 {
> +        compatible = "brcm,bcm7445-ahci", "brcm,sata3-ahci";
> +        reg = <0xf045a000 0xa9c>, <0xf0458040 0x24>;
> +        reg-names = "ahci", "top-ctrl";
> +        interrupts = <0 30 0>;
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        sata0: sata-port@0 {
> +            reg = <0>;
> +            phys = <&sata_phy 0>;
> +        };
> +
> +        sata1: sata-port@1 {
> +            reg = <1>;
> +            phys = <&sata_phy 1>;
> +        };
> +    };
> -- 
> 2.25.1
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt b/Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
deleted file mode 100644
index b9ae4ce4a0a0..000000000000
--- a/Documentation/devicetree/bindings/ata/brcm,sata-brcm.txt
+++ /dev/null
@@ -1,45 +0,0 @@ 
-* Broadcom SATA3 AHCI Controller
-
-SATA nodes are defined to describe on-chip Serial ATA controllers.
-Each SATA controller should have its own node.
-
-Required properties:
-- compatible         : should be one or more of
-			"brcm,bcm7216-ahci"
-			"brcm,bcm7425-ahci"
-			"brcm,bcm7445-ahci"
-			"brcm,bcm-nsp-ahci"
-			"brcm,sata3-ahci"
-			"brcm,bcm63138-ahci"
-- reg                : register mappings for AHCI and SATA_TOP_CTRL
-- reg-names          : "ahci" and "top-ctrl"
-- interrupts         : interrupt mapping for SATA IRQ
-
-Optional properties:
-
-- reset: for "brcm,bcm7216-ahci" must be a valid reset phandle
-  pointing to the RESCAL reset controller provider node.
-- reset-names: for "brcm,bcm7216-ahci", must be "rescal".
-
-Also see ahci-platform.txt.
-
-Example:
-
-	sata@f045a000 {
-		compatible = "brcm,bcm7445-ahci", "brcm,sata3-ahci";
-		reg = <0xf045a000 0xa9c>, <0xf0458040 0x24>;
-		reg-names = "ahci", "top-ctrl";
-		interrupts = <0 30 0>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		sata0: sata-port@0 {
-			reg = <0>;
-			phys = <&sata_phy 0>;
-		};
-
-		sata1: sata-port@1 {
-			reg = <1>;
-			phys = <&sata_phy 1>;
-		};
-	};
diff --git a/Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml b/Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
new file mode 100644
index 000000000000..3e24f45c65af
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/brcm,sata-brcm.yaml
@@ -0,0 +1,98 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ata/brcm,sata-brcm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom SATA3 AHCI Controller
+
+description:
+  SATA nodes are defined to describe on-chip Serial ATA controllers.
+  Each SATA controller should have its own node.
+
+maintainers:
+  - Florian Fainelli <f.fainelli@gmail.com>
+
+allOf:
+  - $ref: sata-common.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - brcm,bcm7216-ahci
+          - const: brcm,sata3-ahci
+      - items:
+          - enum:
+              - brcm,bcm7445-ahci
+          - const: brcm,sata3-ahci
+      - items:
+          - enum:
+              - brcm,bcm7425-ahci
+          - const: brcm,sata3-ahci
+      - items:
+          - const: brcm,bcm-nsp-ahci
+      - items:
+          - enum:
+              - brcm,bcm63138-ahci
+          - const: brcm,sata3-ahci
+
+  reg:
+    minItems: 2
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: ahci
+      - const: top-ctrl
+
+  interrupts: true
+
+  dma-coherent: true
+
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - brcm,bcm7216-ahci
+          - brcm,bcm63138-ahci
+then:
+  properties:
+    resets:
+      maxItems: 1
+    reset-names:
+      enum:
+        - rescal
+        - ahci
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#address-cells"
+  - "#size-cells"
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    sata@f045a000 {
+        compatible = "brcm,bcm7445-ahci", "brcm,sata3-ahci";
+        reg = <0xf045a000 0xa9c>, <0xf0458040 0x24>;
+        reg-names = "ahci", "top-ctrl";
+        interrupts = <0 30 0>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        sata0: sata-port@0 {
+            reg = <0>;
+            phys = <&sata_phy 0>;
+        };
+
+        sata1: sata-port@1 {
+            reg = <1>;
+            phys = <&sata_phy 1>;
+        };
+    };