[PATCH 2/4] dt-bindings: mtd: sunxi-nand: Add YAML schemas

Rob Herring robh+dt at kernel.org
Mon Apr 1 19:02:02 PDT 2019


On Mon, Apr 1, 2019 at 4:14 PM Maxime Ripard <maxime.ripard at bootlin.com> wrote:
>
> Switch the DT binding to a YAML schema to enable the DT validation.
>
> Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
> ---
>  Documentation/devicetree/bindings/mtd/allwinner,sun4i-a10-nand.yaml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  Documentation/devicetree/bindings/mtd/sunxi-nand.txt                | 48 +-------------------------------------------
>  2 files changed, 81 insertions(+), 48 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mtd/allwinner,sun4i-a10-nand.yaml
>  delete mode 100644 Documentation/devicetree/bindings/mtd/sunxi-nand.txt
>
> diff --git a/Documentation/devicetree/bindings/mtd/allwinner,sun4i-a10-nand.yaml b/Documentation/devicetree/bindings/mtd/allwinner,sun4i-a10-nand.yaml
> new file mode 100644
> index 000000000000..174294b9e9c6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/allwinner,sun4i-a10-nand.yaml
> @@ -0,0 +1,81 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mtd/allwinner,sun4i-a10-nand.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner A10 NAND Controller Device Tree Bindings
> +
> +allOf:
> +  - $ref: "nand-controller.yaml"
> +
> +maintainers:
> +  - Chen-Yu Tsai <wens at csie.org>
> +  - Maxime Ripard <maxime.ripard at bootlin.com>
> +
> +properties:
> +  "#address-cells": true
> +  "#size-cells": true
> +
> +  compatible:
> +    const: allwinner,sun4i-a10-nand
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    items:
> +      - description: Bus Clock
> +      - description: Module Clock
> +
> +  clock-names:
> +    items:
> +      - const: ahb
> +      - const: mod
> +
> +  resets:
> +    maxItems: 1
> +
> +  reset-names:
> +    const: ahb
> +
> +  dmas:
> +    maxItems: 1
> +
> +  dma-names:
> +    const: rxtx
> +
> +  pinctrl-names: true
> +
> +patternProperties:
> +  "^pinctrl-[0-9]+$": true
> +
> +  "^nand@[a-z0-9]+$":
> +    properties:
> +      reg:
> +        maxItems: 1

min/max value of reg values?

> +
> +      nand-ecc-mode: true
> +      nand-ecc-step-size: true
> +      nand-ecc-strength: true

Surely the h/w has further constraints on possible values?

> +
> +      allwinner,rb:
> +        $ref: /schemas/types.yaml#/definitions/uint32-array
> +        description:
> +          Contains the native Ready/Busy IDs.
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - clock-names
> +
> +additionalProperties: false
> +
> +...
> diff --git a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt b/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
> deleted file mode 100644
> index dcd5a5d80dc0..000000000000
> --- a/Documentation/devicetree/bindings/mtd/sunxi-nand.txt
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -Allwinner NAND Flash Controller (NFC)
> -
> -Required properties:
> -- compatible : "allwinner,sun4i-a10-nand".
> -- reg : shall contain registers location and length for data and reg.
> -- interrupts : shall define the nand controller interrupt.
> -- #address-cells: shall be set to 1. Encode the nand CS.
> -- #size-cells : shall be set to 0.
> -- clocks : shall reference nand controller clocks.
> -- clock-names : nand controller internal clock names. Shall contain :
> -    * "ahb" : AHB gating clock
> -    * "mod" : nand controller clock
> -
> -Optional properties:
> -- dmas : shall reference DMA channel associated to the NAND controller.
> -- dma-names : shall be "rxtx".
> -
> -Optional children nodes:
> -Children nodes represent the available nand chips.
> -
> -Optional properties:
> -- reset : phandle + reset specifier pair
> -- reset-names : must contain "ahb"
> -- allwinner,rb : shall contain the native Ready/Busy ids.
> -- nand-ecc-mode : one of the supported ECC modes ("hw", "soft", "soft_bch" or
> -                 "none")
> -
> -see Documentation/devicetree/bindings/mtd/nand.txt for generic bindings.
> -
> -
> -Examples:
> -nfc: nand at 1c03000 {
> -       compatible = "allwinner,sun4i-a10-nand";
> -       reg = <0x01c03000 0x1000>;
> -       interrupts = <0 37 1>;
> -       clocks = <&ahb_gates 13>, <&nand_clk>;
> -       clock-names = "ahb", "mod";
> -       #address-cells = <1>;
> -       #size-cells = <0>;
> -       pinctrl-names = "default";
> -       pinctrl-0 = <&nand_pins_a &nand_cs0_pins_a &nand_rb0_pins_a>;
> -
> -       nand at 0 {
> -               reg = <0>;
> -               allwinner,rb = <0>;
> -               nand-ecc-mode = "soft_bch";
> -       };
> -};
> --
> git-series 0.9.1



More information about the linux-mtd mailing list