Skip to content

Commit 37bb403

Browse files
dlechbroonie
authored andcommitted
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: Rob Herring (Arm) <robh@kernel.org> Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20260123-spi-add-multi-bus-support-v6-1-12af183c06eb@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b2f0678 commit 37bb403

8 files changed

Lines changed: 83 additions & 19 deletions

File tree

Documentation/devicetree/bindings/display/panel/sitronix,st7789v.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ properties:
3434
spi-cpol: true
3535

3636
spi-rx-bus-width:
37-
minimum: 0
38-
maximum: 1
37+
items:
38+
minimum: 0
39+
maximum: 1
3940

4041
dc-gpios:
4142
maxItems: 1

Documentation/devicetree/bindings/iio/adc/adi,ad4030.yaml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ properties:
3737
maximum: 102040816
3838

3939
spi-rx-bus-width:
40-
enum: [1, 2, 4]
40+
maxItems: 2
41+
# all lanes must have the same width
42+
oneOf:
43+
- contains:
44+
const: 1
45+
- contains:
46+
const: 2
47+
- contains:
48+
const: 4
4149

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

8997
unevaluatedProperties: false
9098

99+
allOf:
100+
- if:
101+
properties:
102+
compatible:
103+
enum:
104+
- adi,ad4030-24
105+
- adi,ad4032-24
106+
then:
107+
properties:
108+
spi-rx-bus-width:
109+
maxItems: 1
110+
91111
examples:
92112
- |
93113
#include <dt-bindings/gpio/gpio.h>
@@ -108,3 +128,23 @@ examples:
108128
reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
109129
};
110130
};
131+
- |
132+
#include <dt-bindings/gpio/gpio.h>
133+
134+
spi {
135+
#address-cells = <1>;
136+
#size-cells = <0>;
137+
138+
adc@0 {
139+
compatible = "adi,ad4630-24";
140+
reg = <0>;
141+
spi-max-frequency = <80000000>;
142+
spi-rx-bus-width = <4>, <4>;
143+
vdd-5v-supply = <&supply_5V>;
144+
vdd-1v8-supply = <&supply_1_8V>;
145+
vio-supply = <&supply_1_8V>;
146+
ref-supply = <&supply_5V>;
147+
cnv-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
148+
reset-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
149+
};
150+
};

Documentation/devicetree/bindings/iio/adc/adi,ad4695.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ properties:
3838
spi-cpha: true
3939

4040
spi-rx-bus-width:
41-
minimum: 1
42-
maximum: 4
41+
items:
42+
minimum: 1
43+
maximum: 4
4344

4445
avdd-supply:
4546
description: Analog power supply.

Documentation/devicetree/bindings/spi/allwinner,sun4i-a10-spi.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ patternProperties:
5555
maximum: 4
5656

5757
spi-rx-bus-width:
58-
const: 1
58+
items:
59+
- const: 1
5960

6061
spi-tx-bus-width:
61-
const: 1
62+
items:
63+
- const: 1
6264

6365
required:
6466
- compatible

Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ patternProperties:
7777
maximum: 4
7878

7979
spi-rx-bus-width:
80-
const: 1
80+
items:
81+
- const: 1
8182

8283
spi-tx-bus-width:
83-
const: 1
84+
items:
85+
- const: 1
8486

8587
required:
8688
- compatible

Documentation/devicetree/bindings/spi/andestech,ae350-spi.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ patternProperties:
4545

4646
properties:
4747
spi-rx-bus-width:
48-
enum: [1, 4]
48+
items:
49+
- enum: [1, 4]
4950

5051
spi-tx-bus-width:
51-
enum: [1, 4]
52+
items:
53+
- enum: [1, 4]
5254

5355
allOf:
5456
- $ref: spi-controller.yaml#

Documentation/devicetree/bindings/spi/nvidia,tegra210-quad.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ patternProperties:
5454

5555
properties:
5656
spi-rx-bus-width:
57-
enum: [1, 2, 4]
57+
items:
58+
- enum: [1, 2, 4]
5859

5960
spi-tx-bus-width:
60-
enum: [1, 2, 4]
61+
items:
62+
- enum: [1, 2, 4]
6163

6264
required:
6365
- compatible

Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,16 @@ properties:
6464
description:
6565
Bus width to the SPI bus used for read transfers.
6666
If 0 is provided, then no RX will be possible on this device.
67-
$ref: /schemas/types.yaml#/definitions/uint32
68-
enum: [0, 1, 2, 4, 8]
69-
default: 1
67+
68+
Some SPI peripherals and controllers may have multiple data lanes for
69+
receiving two or more words at the same time. If this is the case, each
70+
index in the array represents the lane on both the SPI peripheral and
71+
controller. Additional mapping properties may be needed if a lane is
72+
skipped on either side.
73+
$ref: /schemas/types.yaml#/definitions/uint32-array
74+
items:
75+
enum: [0, 1, 2, 4, 8]
76+
default: [1]
7077

7178
spi-rx-delay-us:
7279
description:
@@ -81,9 +88,16 @@ properties:
8188
description:
8289
Bus width to the SPI bus used for write transfers.
8390
If 0 is provided, then no TX will be possible on this device.
84-
$ref: /schemas/types.yaml#/definitions/uint32
85-
enum: [0, 1, 2, 4, 8]
86-
default: 1
91+
92+
Some SPI peripherals and controllers may have multiple data lanes for
93+
transmitting two or more words at the same time. If this is the case, each
94+
index in the array represents the lane on both the SPI peripheral and
95+
controller. Additional mapping properties may be needed if a lane is
96+
skipped on either side.
97+
$ref: /schemas/types.yaml#/definitions/uint32-array
98+
items:
99+
enum: [0, 1, 2, 4, 8]
100+
default: [1]
87101

88102
spi-tx-delay-us:
89103
description:

0 commit comments

Comments
 (0)