diff mbox series

dt-bindings: spi: Add YAML DT binding document for trivial devices

Message ID 20220407194936.223041-1-marex@denx.de
State Changes Requested, archived
Headers show
Series dt-bindings: spi: Add YAML DT binding document for trivial devices | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Marek Vasut April 7, 2022, 7:49 p.m. UTC
Document trivial SPI devices in single YAML DT binding document.
Currently this overlaps Linux kernel spidev.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
To: linux-spi@vger.kernel.org
---
 .../devicetree/bindings/spi/trivial.yaml      | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/trivial.yaml

Comments

Rob Herring April 7, 2022, 8:35 p.m. UTC | #1
On Thu, Apr 7, 2022 at 2:49 PM Marek Vasut <marex@denx.de> wrote:
>

'dt-bindings' pretty much implies or says 'YAML DT binding document'
already. Given limited subject line, don't repeat yourself.

> Document trivial SPI devices in single YAML DT binding document.
> Currently this overlaps Linux kernel spidev.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> To: linux-spi@vger.kernel.org
> ---
>  .../devicetree/bindings/spi/trivial.yaml      | 51 +++++++++++++++++++
>  1 file changed, 51 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/trivial.yaml
>
> diff --git a/Documentation/devicetree/bindings/spi/trivial.yaml b/Documentation/devicetree/bindings/spi/trivial.yaml
> new file mode 100644
> index 0000000000000..6d6e682948dfc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/trivial.yaml
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/trivial.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Trivial SPI device DT bindings
> +

Add 'description' and describe what devices do and don't qualify as
trivial. (And you can't say 'spidev' :)).

> +maintainers:
> +  - Marek Vasut <marex@denx.de>
> +  - Mark Brown <broonie@kernel.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - cisco,spi-petra
> +      - dh,dhcom-board
> +      - lineartechnology,ltc2488
> +      - lwn,bk4

This one is a *board*!. Wait, and a device... I suppose that's
possible if the board can be a device in another system. Except both
are used in the same dts file. That should create some nice warnings,
but I'm not sure anyone is paying attention to fsl.yaml warnings.

In any case, we're left with
Documentation/devicetree/bindings/misc/lwn-bk4.txt. That and any other
cases need to be deleted.

> +      - menlo,m53cpld
> +      - micron,spi-authenta
> +      - rohm,dh2228fv

This is a DAC. We have lots of DACs in trivial-devices.yaml already.
How does one decide where to document?

> +      - semtech,sx1301
> +
> +  reg:
> +    description: Chip select
> +    maxItems: 1
> +
> +  spi-max-frequency: true
> +  spi-cs-high: true

Reference spi-peripheral-props.yaml and drop these. Will also need to
use unevaluatedProperties.

> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    spi {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      spidev@0 {

dac@0

> +        compatible = "rohm,dh2228fv";
> +        reg = <0>;
> +        spi-max-frequency = <1000000>;
> +      };
> +    };
> --
> 2.35.1
>
Marek Vasut April 7, 2022, 9:03 p.m. UTC | #2
On 4/7/22 22:35, Rob Herring wrote:

[...]

>> +$id: http://devicetree.org/schemas/spi/trivial.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Trivial SPI device DT bindings
>> +
> 
> Add 'description' and describe what devices do and don't qualify as
> trivial. (And you can't say 'spidev' :)).

I got as far as here and then realized all the devices I need to 
document do fit the trivial-devices.yaml ... so, patches are out, please 
drop this patch for now.

>> +maintainers:
>> +  - Marek Vasut <marex@denx.de>
>> +  - Mark Brown <broonie@kernel.org>
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - cisco,spi-petra
>> +      - dh,dhcom-board
>> +      - lineartechnology,ltc2488
>> +      - lwn,bk4
> 
> This one is a *board*!. Wait, and a device... I suppose that's
> possible if the board can be a device in another system. Except both
> are used in the same dts file. That should create some nice warnings,
> but I'm not sure anyone is paying attention to fsl.yaml warnings.
> 
> In any case, we're left with
> Documentation/devicetree/bindings/misc/lwn-bk4.txt. That and any other
> cases need to be deleted.

+CC Lukasz.
Rob Herring April 8, 2022, 12:30 a.m. UTC | #3
On Thu, 07 Apr 2022 21:49:36 +0200, Marek Vasut wrote:
> Document trivial SPI devices in single YAML DT binding document.
> Currently this overlaps Linux kernel spidev.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: devicetree@vger.kernel.org
> To: linux-spi@vger.kernel.org
> ---
>  .../devicetree/bindings/spi/trivial.yaml      | 51 +++++++++++++++++++
>  1 file changed, 51 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/trivial.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/


/: '#address-cells', '#size-cells', 'aliases', 'chosen', 'cpus', 'fxosc', 'iio-hwmon', 'leds', 'memory@80000000', 'model', 'oscillator-audio', 'oscillator-ethernet', 'regulator-3p3v', 'regulator-vcc3v3mcu', 'soc', 'spi-gpio', 'sxosc', 'syscon-reboot' do not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/vf610-bk4.dtb

channel@0: '#address-cells', '#size-cells', 'spi-cpha' do not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/am335x-sancloud-bbe-lite.dtb

/: compatible: ['lwn,bk4', 'fsl,vf610'] is too long
	arch/arm/boot/dts/vf610-bk4.dtb

dac@0: 'spi-cpha', 'spi-cpol' do not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/rv1108-elgin-r1.dtb

/: 'reg' is a required property
	arch/arm/boot/dts/vf610-bk4.dtb

slave: 'reg' is a required property
	arch/arm/boot/dts/vf610-bk4.dtb

spidev0@0: 'fsl,spi-cs-sck-delay', 'fsl,spi-sck-cs-delay' do not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/vf610-bk4.dtb
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/spi/trivial.yaml b/Documentation/devicetree/bindings/spi/trivial.yaml
new file mode 100644
index 0000000000000..6d6e682948dfc
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/trivial.yaml
@@ -0,0 +1,51 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/trivial.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Trivial SPI device DT bindings
+
+maintainers:
+  - Marek Vasut <marex@denx.de>
+  - Mark Brown <broonie@kernel.org>
+
+properties:
+  compatible:
+    enum:
+      - cisco,spi-petra
+      - dh,dhcom-board
+      - lineartechnology,ltc2488
+      - lwn,bk4
+      - menlo,m53cpld
+      - micron,spi-authenta
+      - rohm,dh2228fv
+      - semtech,sx1301
+
+  reg:
+    description: Chip select
+    maxItems: 1
+
+  spi-max-frequency: true
+  spi-cs-high: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      spidev@0 {
+        compatible = "rohm,dh2228fv";
+        reg = <0>;
+        spi-max-frequency = <1000000>;
+      };
+    };