Skip to content

Commit 302ebb3

Browse files
pelwellpopcornmix
authored andcommitted
overlays: Add spi0-1cs and spi0-2cs
The spi0-1cs overlay allows the SPI0 interface to be run with a single CS line, which can be useful if GPIOs are in short supply. The no_miso parameter is for write-only devices that don't need the return channel, and again is there to free up a GPIO. spi0-2cs is the new name for spi0-cs (now deprecated with a redirect to spi0-2cs), but with the addedd no_miso parameter. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent e9e462b commit 302ebb3

5 files changed

Lines changed: 75 additions & 4 deletions

File tree

‎arch/arm/boot/dts/overlays/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
161161
spi-gpio35-39.dtbo \
162162
spi-gpio40-45.dtbo \
163163
spi-rtc.dtbo \
164-
spi0-cs.dtbo \
164+
spi0-1cs.dtbo \
165+
spi0-2cs.dtbo \
165166
spi1-1cs.dtbo \
166167
spi1-2cs.dtbo \
167168
spi1-3cs.dtbo \

‎arch/arm/boot/dts/overlays/README‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,11 +2412,27 @@ Load: dtoverlay=spi-rtc,<param>=<val>
24122412
Params: pcf2123 Select the PCF2123 device
24132413

24142414

2415-
Name: spi0-cs
2416-
Info: Allows the (software) CS pins for SPI0 to be changed
2417-
Load: dtoverlay=spi0-cs,<param>=<val>
2415+
Name: spi0-1cs
2416+
Info: Only use one CS pin for SPI0
2417+
Load: dtoverlay=spi0-1cs,<param>=<val>
2418+
Params: cs0_pin GPIO pin for CS0 (default 8)
2419+
no_miso Don't claim and use the MISO pin (9), freeing
2420+
it for other uses.
2421+
2422+
2423+
Name: spi0-2cs
2424+
Info: Change the CS pins for SPI0
2425+
Load: dtoverlay=spi0-2cs,<param>=<val>
24182426
Params: cs0_pin GPIO pin for CS0 (default 8)
24192427
cs1_pin GPIO pin for CS1 (default 7)
2428+
no_miso Don't claim and use the MISO pin (9), freeing
2429+
it for other uses.
2430+
2431+
2432+
Name: spi0-cs
2433+
Info: This overlay has been renamed spi0-2cs, keeping spi0-cs as an
2434+
alias for backwards compatibility.
2435+
Load: <Deprecated>
24202436

24212437

24222438
Name: spi0-hw-cs

‎arch/arm/boot/dts/overlays/overlay_map.dts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
deprecated = "use sdio,bus_width=1,gpios_22_25";
6262
};
6363

64+
spi0-cs {
65+
renamed = "spi0-2cs";
66+
};
67+
6468
spi0-hw-cs {
6569
deprecated = "no longer necessary";
6670
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
5+
/ {
6+
compatible = "brcm,bcm2835";
7+
8+
fragment@0 {
9+
target = <&spi0_cs_pins>;
10+
frag0: __overlay__ {
11+
brcm,pins = <8>;
12+
};
13+
};
14+
15+
fragment@1 {
16+
target = <&spi0>;
17+
frag1: __overlay__ {
18+
cs-gpios = <&gpio 8 1>;
19+
status = "okay";
20+
};
21+
};
22+
23+
fragment@2 {
24+
target = <&spidev1>;
25+
__overlay__ {
26+
status = "disabled";
27+
};
28+
};
29+
30+
fragment@3 {
31+
target = <&spi0_pins>;
32+
__dormant__ {
33+
brcm,pins = <10 11>;
34+
};
35+
};
36+
37+
__overrides__ {
38+
cs0_pin = <&frag0>,"brcm,pins:0",
39+
<&frag1>,"cs-gpios:4";
40+
no_miso = <0>,"=3";
41+
};
42+
};

arch/arm/boot/dts/overlays/spi0-cs-overlay.dts renamed to arch/arm/boot/dts/overlays/spi0-2cs-overlay.dts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@
2020
};
2121
};
2222

23+
fragment@2 {
24+
target = <&spi0_pins>;
25+
__dormant__ {
26+
brcm,pins = <10 11>;
27+
};
28+
};
29+
2330
__overrides__ {
2431
cs0_pin = <&frag0>,"brcm,pins:0",
2532
<&frag1>,"cs-gpios:4";
2633
cs1_pin = <&frag0>,"brcm,pins:4",
2734
<&frag1>,"cs-gpios:16";
35+
no_miso = <0>,"=2";
2836
};
2937
};

0 commit comments

Comments
 (0)