Unverified Commit 37bb4033 authored by David Lechner's avatar David Lechner Committed by Mark Brown
Browse files

spi: dt-bindings: change spi-{rx,tx}-bus-width to arrays



Change spi-rx-bus-width and spi-tx-bus-width properties from single
uint32 values to arrays of uint32 values. This allows describing SPI
peripherals connected to controllers that have multiple data lanes for
receiving or transmitting two or more words in parallel.

Each index in the array corresponds to a physical data lane (one or more
wires depending on the bus width). Additional mapping properties will be
needed in cases where a lane on the controller or peripheral is skipped.

Bindings that make use of this property are updated in the same commit
to avoid validation errors.

The adi,ad4030 binding can now better describe the chips multi-lane
capabilities, so that binding is refined and gets a new example.

Converting from single uint32 to array of uint32 does not break .dts/
.dtb files since there is no difference between specifying a single
uint32 value and an array with a single uint32 value in devicetree.

Reviewed-by: default avatarRob Herring (Arm) <robh@kernel.org>
Reviewed-by: default avatarMarcelo Schmitt <marcelo.schmitt@analog.com>
Reviewed-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: default avatarDavid Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20260123-spi-add-multi-bus-support-v6-1-12af183c06eb@baylibre.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent b2f06783
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ properties:
  spi-cpol: true

  spi-rx-bus-width:
    items:
      minimum: 0
      maximum: 1

+41 −1
Original line number Diff line number Diff line
@@ -37,7 +37,15 @@ properties:
    maximum: 102040816

  spi-rx-bus-width:
    enum: [1, 2, 4]
    maxItems: 2
    # all lanes must have the same width
    oneOf:
      - contains:
          const: 1
      - contains:
          const: 2
      - contains:
          const: 4

  vdd-5v-supply: true
  vdd-1v8-supply: true
@@ -88,6 +96,18 @@ oneOf:

unevaluatedProperties: false

allOf:
  - if:
      properties:
        compatible:
          enum:
            - adi,ad4030-24
            - adi,ad4032-24
    then:
      properties:
        spi-rx-bus-width:
          maxItems: 1

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
@@ -108,3 +128,23 @@ examples:
            reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
        };
    };
  - |
    #include <dt-bindings/gpio/gpio.h>

    spi {
        #address-cells = <1>;
        #size-cells = <0>;

        adc@0 {
            compatible = "adi,ad4630-24";
            reg = <0>;
            spi-max-frequency = <80000000>;
            spi-rx-bus-width = <4>, <4>;
            vdd-5v-supply = <&supply_5V>;
            vdd-1v8-supply = <&supply_1_8V>;
            vio-supply = <&supply_1_8V>;
            ref-supply = <&supply_5V>;
            cnv-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
        };
    };
+3 −2
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ properties:
  spi-cpha: true

  spi-rx-bus-width:
    items:
      minimum: 1
      maximum: 4

+4 −2
Original line number Diff line number Diff line
@@ -55,10 +55,12 @@ patternProperties:
          maximum: 4

      spi-rx-bus-width:
        const: 1
        items:
          - const: 1

      spi-tx-bus-width:
        const: 1
        items:
          - const: 1

required:
  - compatible
+4 −2
Original line number Diff line number Diff line
@@ -77,10 +77,12 @@ patternProperties:
          maximum: 4

      spi-rx-bus-width:
        const: 1
        items:
          - const: 1

      spi-tx-bus-width:
        const: 1
        items:
          - const: 1

required:
  - compatible
Loading