[PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema

Neil Armstrong posted 1 patch 2 months, 2 weeks ago
.../bindings/mmc/amlogic,meson-mx-sdio.txt         |  54 -----------
.../bindings/mmc/amlogic,meson-mx-sdio.yaml        | 101 +++++++++++++++++++++
2 files changed, 101 insertions(+), 54 deletions(-)
[PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
Posted by Neil Armstrong 2 months, 2 weeks ago
Convert the Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
bindings to dt-schema.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 .../bindings/mmc/amlogic,meson-mx-sdio.txt         |  54 -----------
 .../bindings/mmc/amlogic,meson-mx-sdio.yaml        | 101 +++++++++++++++++++++
 2 files changed, 101 insertions(+), 54 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt
deleted file mode 100644
index 8765c605e6bc..000000000000
--- a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-* Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
-
-The highspeed MMC host controller on Amlogic SoCs provides an interface
-for MMC, SD, SDIO and SDHC types of memory cards.
-
-Supported maximum speeds are the ones of the eMMC standard 4.41 as well
-as the speed of SD standard 2.0.
-
-The hardware provides an internal "mux" which allows up to three slots
-to be controlled. Only one slot can be accessed at a time.
-
-Required properties:
- - compatible : must be one of
-	- "amlogic,meson8-sdio"
-	- "amlogic,meson8b-sdio"
-	along with the generic "amlogic,meson-mx-sdio"
- - reg : mmc controller base registers
- - interrupts : mmc controller interrupt
- - #address-cells : must be 1
- - size-cells : must be 0
- - clocks : phandle to clock providers
- - clock-names : must contain "core" and "clkin"
-
-Required child nodes:
-A node for each slot provided by the MMC controller is required.
-NOTE: due to a driver limitation currently only one slot (= child node)
-      is supported!
-
-Required properties on each child node (= slot):
- - compatible : must be "mmc-slot" (see mmc.txt within this directory)
- - reg : the slot (or "port") ID
-
-Optional properties on each child node (= slot):
- - bus-width : must be 1 or 4 (8-bit bus is not supported)
- - for cd and all other additional generic mmc parameters
-   please refer to mmc.txt within this directory
-
-Examples:
-	mmc@c1108c20 {
-		compatible = "amlogic,meson8-sdio", "amlogic,meson-mx-sdio";
-		reg = <0xc1108c20 0x20>;
-		interrupts = <0 28 1>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-		clocks = <&clkc CLKID_SDIO>, <&clkc CLKID_CLK81>;
-		clock-names = "core", "clkin";
-
-		slot@1 {
-			compatible = "mmc-slot";
-			reg = <1>;
-
-			bus-width = <4>;
-		};
-	};
diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml
new file mode 100644
index 000000000000..4d1142d2ff02
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mmc/amlogic,meson-mx-sdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
+
+description:
+  The highspeed MMC host controller on Amlogic SoCs provides an interface
+  for MMC, SD, SDIO and SDHC types of memory cards.
+  Supported maximum speeds are the ones of the eMMC standard 4.41 as well
+  as the speed of SD standard 2.0.
+  The hardware provides an internal "mux" which allows up to three slots
+  to be controlled. Only one slot can be accessed at a time.
+
+maintainers:
+  - Neil Armstrong <neil.armstrong@linaro.org>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - amlogic,meson8-sdio
+          - amlogic,meson8b-sdio
+      - const: amlogic,meson-mx-sdio
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: core
+      - const: clkin
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+
+patternProperties:
+  "slot@[a-f0-9]+$":
+    $ref: mmc-controller.yaml#
+    description:
+      A node for each slot provided by the MMC controller
+    properties:
+      compatible:
+        const: mmc-slot
+
+      reg:
+        description:
+          the slot (or "port") ID
+        maxItems: 1
+
+      bus-width:
+        enum: [1, 4]
+
+    required:
+      - compatible
+      - reg
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    mmc@c1108c20 {
+        compatible = "amlogic,meson8-sdio", "amlogic,meson-mx-sdio";
+        reg = <0xc1108c20 0x20>;
+        interrupts = <GIC_SPI 28 IRQ_TYPE_EDGE_RISING>;
+        clocks = <&clk_core>, <&clk_in>;
+        clock-names = "core", "clkin";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        slot@1 {
+            compatible = "mmc-slot";
+            reg = <1>;
+            bus-width = <4>;
+        };
+    };

---
base-commit: 47ac09b91befbb6a235ab620c32af719f8208399
change-id: 20240911-topic-amlogic-arm32-upstream-bindings-fixes-convert-meson-mx-sdio-6fa70546ebb8

Best regards,
-- 
Neil Armstrong <neil.armstrong@linaro.org>
Re: [PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
Posted by Rob Herring 2 months, 2 weeks ago
On Wed, Sep 11, 2024 at 05:20:47PM +0200, Neil Armstrong wrote:
> Convert the Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
> bindings to dt-schema.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
>  .../bindings/mmc/amlogic,meson-mx-sdio.txt         |  54 -----------
>  .../bindings/mmc/amlogic,meson-mx-sdio.yaml        | 101 +++++++++++++++++++++
>  2 files changed, 101 insertions(+), 54 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt
> deleted file mode 100644
> index 8765c605e6bc..000000000000
> --- a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt
> +++ /dev/null
> @@ -1,54 +0,0 @@
> -* Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
> -
> -The highspeed MMC host controller on Amlogic SoCs provides an interface
> -for MMC, SD, SDIO and SDHC types of memory cards.
> -
> -Supported maximum speeds are the ones of the eMMC standard 4.41 as well
> -as the speed of SD standard 2.0.
> -
> -The hardware provides an internal "mux" which allows up to three slots
> -to be controlled. Only one slot can be accessed at a time.
> -
> -Required properties:
> - - compatible : must be one of
> -	- "amlogic,meson8-sdio"
> -	- "amlogic,meson8b-sdio"
> -	along with the generic "amlogic,meson-mx-sdio"
> - - reg : mmc controller base registers
> - - interrupts : mmc controller interrupt
> - - #address-cells : must be 1
> - - size-cells : must be 0
> - - clocks : phandle to clock providers
> - - clock-names : must contain "core" and "clkin"
> -
> -Required child nodes:
> -A node for each slot provided by the MMC controller is required.
> -NOTE: due to a driver limitation currently only one slot (= child node)
> -      is supported!
> -
> -Required properties on each child node (= slot):
> - - compatible : must be "mmc-slot" (see mmc.txt within this directory)
> - - reg : the slot (or "port") ID
> -
> -Optional properties on each child node (= slot):
> - - bus-width : must be 1 or 4 (8-bit bus is not supported)
> - - for cd and all other additional generic mmc parameters
> -   please refer to mmc.txt within this directory
> -
> -Examples:
> -	mmc@c1108c20 {
> -		compatible = "amlogic,meson8-sdio", "amlogic,meson-mx-sdio";
> -		reg = <0xc1108c20 0x20>;
> -		interrupts = <0 28 1>;
> -		#address-cells = <1>;
> -		#size-cells = <0>;
> -		clocks = <&clkc CLKID_SDIO>, <&clkc CLKID_CLK81>;
> -		clock-names = "core", "clkin";
> -
> -		slot@1 {
> -			compatible = "mmc-slot";
> -			reg = <1>;
> -
> -			bus-width = <4>;
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml
> new file mode 100644
> index 000000000000..4d1142d2ff02
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml
> @@ -0,0 +1,101 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mmc/amlogic,meson-mx-sdio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
> +
> +description:
> +  The highspeed MMC host controller on Amlogic SoCs provides an interface
> +  for MMC, SD, SDIO and SDHC types of memory cards.
> +  Supported maximum speeds are the ones of the eMMC standard 4.41 as well
> +  as the speed of SD standard 2.0.
> +  The hardware provides an internal "mux" which allows up to three slots
> +  to be controlled. Only one slot can be accessed at a time.

You need '|' or this is treated as 1 paragraph. If it is 1 paragraph, 
then format it that way.

But really if you want 3 paragraphs, then you should use '>' and put 2 
CR's between each paragraph.

> +
> +maintainers:
> +  - Neil Armstrong <neil.armstrong@linaro.org>
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - amlogic,meson8-sdio
> +          - amlogic,meson8b-sdio
> +      - const: amlogic,meson-mx-sdio
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 2
> +
> +  clock-names:
> +    items:
> +      - const: core
> +      - const: clkin
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +
> +patternProperties:
> +  "slot@[a-f0-9]+$":

Are you going to add 'slot' to nodename in mmc-controller.yaml?

> +    $ref: mmc-controller.yaml#
> +    description:
> +      A node for each slot provided by the MMC controller

blank line

> +    properties:
> +      compatible:
> +        const: mmc-slot

This is also used by the Cavium controller. Should be common.

> +
> +      reg:
> +        description:
> +          the slot (or "port") ID
> +        maxItems: 1

Aren't there limits in the number of slots the h/w can support?

> +
> +      bus-width:
> +        enum: [1, 4]
> +
> +    required:
> +      - compatible
> +      - reg
> +
> +    unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - clock-names
> +  - "#address-cells"
> +  - "#size-cells"
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    mmc@c1108c20 {
> +        compatible = "amlogic,meson8-sdio", "amlogic,meson-mx-sdio";
> +        reg = <0xc1108c20 0x20>;
> +        interrupts = <GIC_SPI 28 IRQ_TYPE_EDGE_RISING>;
> +        clocks = <&clk_core>, <&clk_in>;
> +        clock-names = "core", "clkin";
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        slot@1 {
> +            compatible = "mmc-slot";
> +            reg = <1>;
> +            bus-width = <4>;
> +        };
> +    };
> 
> ---
> base-commit: 47ac09b91befbb6a235ab620c32af719f8208399
> change-id: 20240911-topic-amlogic-arm32-upstream-bindings-fixes-convert-meson-mx-sdio-6fa70546ebb8
> 
> Best regards,
> -- 
> Neil Armstrong <neil.armstrong@linaro.org>
>
Re: [PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
Posted by Neil Armstrong 2 months, 1 week ago
Hi Rob,

On 16/09/2024 19:40, Rob Herring wrote:
> On Wed, Sep 11, 2024 at 05:20:47PM +0200, Neil Armstrong wrote:
>> Convert the Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
>> bindings to dt-schema.
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
>>   .../bindings/mmc/amlogic,meson-mx-sdio.txt         |  54 -----------
>>   .../bindings/mmc/amlogic,meson-mx-sdio.yaml        | 101 +++++++++++++++++++++
>>   2 files changed, 101 insertions(+), 54 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt
>> deleted file mode 100644
>> index 8765c605e6bc..000000000000
>> --- a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.txt
>> +++ /dev/null
>> @@ -1,54 +0,0 @@
>> -* Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
>> -
>> -The highspeed MMC host controller on Amlogic SoCs provides an interface
>> -for MMC, SD, SDIO and SDHC types of memory cards.
>> -
>> -Supported maximum speeds are the ones of the eMMC standard 4.41 as well
>> -as the speed of SD standard 2.0.
>> -
>> -The hardware provides an internal "mux" which allows up to three slots
>> -to be controlled. Only one slot can be accessed at a time.
>> -
>> -Required properties:
>> - - compatible : must be one of
>> -	- "amlogic,meson8-sdio"
>> -	- "amlogic,meson8b-sdio"
>> -	along with the generic "amlogic,meson-mx-sdio"
>> - - reg : mmc controller base registers
>> - - interrupts : mmc controller interrupt
>> - - #address-cells : must be 1
>> - - size-cells : must be 0
>> - - clocks : phandle to clock providers
>> - - clock-names : must contain "core" and "clkin"
>> -
>> -Required child nodes:
>> -A node for each slot provided by the MMC controller is required.
>> -NOTE: due to a driver limitation currently only one slot (= child node)
>> -      is supported!
>> -
>> -Required properties on each child node (= slot):
>> - - compatible : must be "mmc-slot" (see mmc.txt within this directory)
>> - - reg : the slot (or "port") ID
>> -
>> -Optional properties on each child node (= slot):
>> - - bus-width : must be 1 or 4 (8-bit bus is not supported)
>> - - for cd and all other additional generic mmc parameters
>> -   please refer to mmc.txt within this directory
>> -
>> -Examples:
>> -	mmc@c1108c20 {
>> -		compatible = "amlogic,meson8-sdio", "amlogic,meson-mx-sdio";
>> -		reg = <0xc1108c20 0x20>;
>> -		interrupts = <0 28 1>;
>> -		#address-cells = <1>;
>> -		#size-cells = <0>;
>> -		clocks = <&clkc CLKID_SDIO>, <&clkc CLKID_CLK81>;
>> -		clock-names = "core", "clkin";
>> -
>> -		slot@1 {
>> -			compatible = "mmc-slot";
>> -			reg = <1>;
>> -
>> -			bus-width = <4>;
>> -		};
>> -	};
>> diff --git a/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml
>> new file mode 100644
>> index 000000000000..4d1142d2ff02
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdio.yaml
>> @@ -0,0 +1,101 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mmc/amlogic,meson-mx-sdio.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
>> +
>> +description:
>> +  The highspeed MMC host controller on Amlogic SoCs provides an interface
>> +  for MMC, SD, SDIO and SDHC types of memory cards.
>> +  Supported maximum speeds are the ones of the eMMC standard 4.41 as well
>> +  as the speed of SD standard 2.0.
>> +  The hardware provides an internal "mux" which allows up to three slots
>> +  to be controlled. Only one slot can be accessed at a time.
> 
> You need '|' or this is treated as 1 paragraph. If it is 1 paragraph,
> then format it that way.
> 
> But really if you want 3 paragraphs, then you should use '>' and put 2
> CR's between each paragraph.

Ack

> 
>> +
>> +maintainers:
>> +  - Neil Armstrong <neil.armstrong@linaro.org>
>> +
>> +properties:
>> +  compatible:
>> +    items:
>> +      - enum:
>> +          - amlogic,meson8-sdio
>> +          - amlogic,meson8b-sdio
>> +      - const: amlogic,meson-mx-sdio
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  clocks:
>> +    maxItems: 2
>> +
>> +  clock-names:
>> +    items:
>> +      - const: core
>> +      - const: clkin
>> +
>> +  "#address-cells":
>> +    const: 1
>> +
>> +  "#size-cells":
>> +    const: 0
>> +
>> +
>> +patternProperties:
>> +  "slot@[a-f0-9]+$":
> 
> Are you going to add 'slot' to nodename in mmc-controller.yaml?


Hmm, well slot should not be a valid nodename for a direct mmc-controller,
so how to solve that ?

> 
>> +    $ref: mmc-controller.yaml#
>> +    description:
>> +      A node for each slot provided by the MMC controller
> 
> blank line
> 
>> +    properties:
>> +      compatible:
>> +        const: mmc-slot
> 
> This is also used by the Cavium controller. Should be common.

Right but the cavium one isn't in dtschema, is it worth doing a
common yaml for that ?

> 
>> +
>> +      reg:
>> +        description:
>> +          the slot (or "port") ID
>> +        maxItems: 1
> 
> Aren't there limits in the number of slots the h/w can support?

Good question, let me check

> 
>> +
>> +      bus-width:
>> +        enum: [1, 4]
>> +
>> +    required:
>> +      - compatible
>> +      - reg
>> +
>> +    unevaluatedProperties: false
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - clocks
>> +  - clock-names
>> +  - "#address-cells"
>> +  - "#size-cells"
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +    mmc@c1108c20 {
>> +        compatible = "amlogic,meson8-sdio", "amlogic,meson-mx-sdio";
>> +        reg = <0xc1108c20 0x20>;
>> +        interrupts = <GIC_SPI 28 IRQ_TYPE_EDGE_RISING>;
>> +        clocks = <&clk_core>, <&clk_in>;
>> +        clock-names = "core", "clkin";
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +
>> +        slot@1 {
>> +            compatible = "mmc-slot";
>> +            reg = <1>;
>> +            bus-width = <4>;
>> +        };
>> +    };
>>
>> ---
>> base-commit: 47ac09b91befbb6a235ab620c32af719f8208399
>> change-id: 20240911-topic-amlogic-arm32-upstream-bindings-fixes-convert-meson-mx-sdio-6fa70546ebb8
>>
>> Best regards,
>> -- 
>> Neil Armstrong <neil.armstrong@linaro.org>
>>

Thanks,
Neil
Re: [PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
Posted by Martin Blumenstingl 2 months, 1 week ago
Hi Neil,

On Tue, Sep 17, 2024 at 9:13 AM Neil Armstrong
<neil.armstrong@linaro.org> wrote:
[...]
> >> +      reg:
> >> +        description:
> >> +          the slot (or "port") ID
> >> +        maxItems: 1
> >
> > Aren't there limits in the number of slots the h/w can support?
>
> Good question, let me check
allowed values are: 0, 1, 2

For the remaining questions: I also don't know - so let's see what
Rob's suggestion is going to be.


Best regards,
Martin
Re: [PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
Posted by neil.armstrong@linaro.org 2 months, 1 week ago
On 19/09/2024 18:33, Martin Blumenstingl wrote:
> Hi Neil,
> 
> On Tue, Sep 17, 2024 at 9:13 AM Neil Armstrong
> <neil.armstrong@linaro.org> wrote:
> [...]
>>>> +      reg:
>>>> +        description:
>>>> +          the slot (or "port") ID
>>>> +        maxItems: 1
>>>
>>> Aren't there limits in the number of slots the h/w can support?
>>
>> Good question, let me check
> allowed values are: 0, 1, 2
> 
> For the remaining questions: I also don't know - so let's see what
> Rob's suggestion is going to be.

I did something, I'll post it shortly, no idea if it works

Neil

> 
> 
> Best regards,
> Martin

Re: [PATCH] dt-bindings: mmc: convert amlogic,meson-mx-sdio.txt to dtschema
Posted by Martin Blumenstingl 2 months, 2 weeks ago
Thank you Neil!

On Wed, Sep 11, 2024 at 5:20 PM Neil Armstrong
<neil.armstrong@linaro.org> wrote:
>
> Convert the Amlogic Meson6, Meson8 and Meson8b SDIO/MMC controller
> bindings to dt-schema.
>
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>