diff mbox series

[v1,02/36] dt-bindings: spi: support non-spi bindings as SPI slaves

Message ID 20200315134416.16527-3-sam@ravnborg.org
State New
Headers show
Series dt-bindings: display: convert remaning panel bindings to DT Schema | expand

Commit Message

Sam Ravnborg March 15, 2020, 1:43 p.m. UTC
Independent bindings can be SPI slaves which for example is
the case for several panel bindings.

Move SPI slave properties to spi-slave.yaml so the independent
SPI slave bindings can include spi-slave.yaml rather than
duplicating the properties.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
---
 .../bindings/spi/spi-controller.yaml          | 63 +-------------
 .../devicetree/bindings/spi/spi-slave.yaml    | 83 +++++++++++++++++++
 2 files changed, 86 insertions(+), 60 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-slave.yaml
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml
index 1e0ca6ccf64b..99531c8d10dd 100644
--- a/Documentation/devicetree/bindings/spi/spi-controller.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml
@@ -67,71 +67,14 @@  patternProperties:
   "^.*@[0-9a-f]+$":
     type: object
 
+    allOf:
+      - $ref: spi-slave.yaml#
+
     properties:
       compatible:
         description:
           Compatible of the SPI device.
 
-      reg:
-        minimum: 0
-        maximum: 256
-        description:
-          Chip select used by the device.
-
-      spi-3wire:
-        $ref: /schemas/types.yaml#/definitions/flag
-        description:
-          The device requires 3-wire mode.
-
-      spi-cpha:
-        $ref: /schemas/types.yaml#/definitions/flag
-        description:
-          The device requires shifted clock phase (CPHA) mode.
-
-      spi-cpol:
-        $ref: /schemas/types.yaml#/definitions/flag
-        description:
-          The device requires inverse clock polarity (CPOL) mode.
-
-      spi-cs-high:
-        $ref: /schemas/types.yaml#/definitions/flag
-        description:
-          The device requires the chip select active high.
-
-      spi-lsb-first:
-        $ref: /schemas/types.yaml#/definitions/flag
-        description:
-          The device requires the LSB first mode.
-
-      spi-max-frequency:
-        $ref: /schemas/types.yaml#/definitions/uint32
-        description:
-          Maximum SPI clocking speed of the device in Hz.
-
-      spi-rx-bus-width:
-        allOf:
-          - $ref: /schemas/types.yaml#/definitions/uint32
-          - enum: [ 1, 2, 4, 8 ]
-          - default: 1
-        description:
-          Bus width to the SPI bus used for MISO.
-
-      spi-rx-delay-us:
-        description:
-          Delay, in microseconds, after a read transfer.
-
-      spi-tx-bus-width:
-        allOf:
-          - $ref: /schemas/types.yaml#/definitions/uint32
-          - enum: [ 1, 2, 4, 8 ]
-          - default: 1
-        description:
-          Bus width to the SPI bus used for MOSI.
-
-      spi-tx-delay-us:
-        description:
-          Delay, in microseconds, after a write transfer.
-
     required:
       - compatible
       - reg
diff --git a/Documentation/devicetree/bindings/spi/spi-slave.yaml b/Documentation/devicetree/bindings/spi/spi-slave.yaml
new file mode 100644
index 000000000000..fa50d9dfab41
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-slave.yaml
@@ -0,0 +1,83 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/spi-slave.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI slave generic binding
+
+maintainers:
+  - Mark Brown <broonie@kernel.org>
+
+description: |
+  This document defines device tree properties common to SPI slaves.
+  It doesn't constitue a device tree binding specification by
+  itself but is meant to be referenced by device tree bindings.
+
+  When referenced from device tree bindings the properties defined in this
+  document are defined as follows. The device tree bindings are responsible
+  for defining whether each property is required or optional.
+
+properties:
+
+  reg:
+    minimum: 0
+    maximum: 256
+    description:
+      Chip select used by the device.
+
+  spi-3wire:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      The device requires 3-wire mode.
+
+  spi-cpha:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      The device requires shifted clock phase (CPHA) mode.
+
+  spi-cpol:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      The device requires inverse clock polarity (CPOL) mode.
+
+  spi-cs-high:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      The device requires the chip select active high.
+
+  spi-lsb-first:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      The device requires the LSB first mode.
+
+  spi-max-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Maximum SPI clocking speed of the device in Hz.
+
+  spi-rx-bus-width:
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [ 1, 2, 4, 8 ]
+      - default: 1
+    description:
+      Bus width to the SPI bus used for MISO.
+
+  spi-rx-delay-us:
+    description:
+      Delay, in microseconds, after a read transfer.
+
+  spi-tx-bus-width:
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+      - enum: [ 1, 2, 4, 8 ]
+      - default: 1
+    description:
+      Bus width to the SPI bus used for MOSI.
+
+  spi-tx-delay-us:
+    description:
+      Delay, in microseconds, after a write transfer.
+
+...