kernel: bump 5.4 to 5.4.106
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0957-overlays-Add-spi0-1cs-and-spi0-2cs.patch
1 From 692af7a59fd6d9d3b64edbf028cd75b0096ef8c7 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Fri, 28 Aug 2020 12:55:41 +0100
4 Subject: [PATCH] overlays: Add spi0-1cs and spi0-2cs
5
6 The spi0-1cs overlay allows the SPI0 interface to be run with a single
7 CS line, which can be useful if GPIOs are in short supply. The no_miso
8 parameter is for write-only devices that don't need the return channel,
9 and again is there to free up a GPIO.
10
11 spi0-2cs is the new name for spi0-cs (now deprecated with a redirect
12 to spi0-2cs), but with the addedd no_miso parameter.
13
14 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
15 ---
16 arch/arm/boot/dts/overlays/Makefile | 3 +-
17 arch/arm/boot/dts/overlays/README | 22 ++++++++--
18 arch/arm/boot/dts/overlays/overlay_map.dts | 4 ++
19 .../boot/dts/overlays/spi0-1cs-overlay.dts | 42 +++++++++++++++++++
20 ...i0-cs-overlay.dts => spi0-2cs-overlay.dts} | 8 ++++
21 5 files changed, 75 insertions(+), 4 deletions(-)
22 create mode 100644 arch/arm/boot/dts/overlays/spi0-1cs-overlay.dts
23 rename arch/arm/boot/dts/overlays/{spi0-cs-overlay.dts => spi0-2cs-overlay.dts} (79%)
24
25 --- a/arch/arm/boot/dts/overlays/Makefile
26 +++ b/arch/arm/boot/dts/overlays/Makefile
27 @@ -161,7 +161,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
28 spi-gpio35-39.dtbo \
29 spi-gpio40-45.dtbo \
30 spi-rtc.dtbo \
31 - spi0-cs.dtbo \
32 + spi0-1cs.dtbo \
33 + spi0-2cs.dtbo \
34 spi1-1cs.dtbo \
35 spi1-2cs.dtbo \
36 spi1-3cs.dtbo \
37 --- a/arch/arm/boot/dts/overlays/README
38 +++ b/arch/arm/boot/dts/overlays/README
39 @@ -2412,11 +2412,27 @@ Load: dtoverlay=spi-rtc,<param>=<val>
40 Params: pcf2123 Select the PCF2123 device
41
42
43 -Name: spi0-cs
44 -Info: Allows the (software) CS pins for SPI0 to be changed
45 -Load: dtoverlay=spi0-cs,<param>=<val>
46 +Name: spi0-1cs
47 +Info: Only use one CS pin for SPI0
48 +Load: dtoverlay=spi0-1cs,<param>=<val>
49 +Params: cs0_pin GPIO pin for CS0 (default 8)
50 + no_miso Don't claim and use the MISO pin (9), freeing
51 + it for other uses.
52 +
53 +
54 +Name: spi0-2cs
55 +Info: Change the CS pins for SPI0
56 +Load: dtoverlay=spi0-2cs,<param>=<val>
57 Params: cs0_pin GPIO pin for CS0 (default 8)
58 cs1_pin GPIO pin for CS1 (default 7)
59 + no_miso Don't claim and use the MISO pin (9), freeing
60 + it for other uses.
61 +
62 +
63 +Name: spi0-cs
64 +Info: This overlay has been renamed spi0-1cs, keeping spi0-cs as an
65 + alias for backwards compatibility.
66 +Load: <Deprecated>
67
68
69 Name: spi0-hw-cs
70 --- a/arch/arm/boot/dts/overlays/overlay_map.dts
71 +++ b/arch/arm/boot/dts/overlays/overlay_map.dts
72 @@ -61,6 +61,10 @@
73 deprecated = "use sdio,bus_width=1,gpios_22_25";
74 };
75
76 + spi0-cs {
77 + renamed = "spi0-2cs";
78 + };
79 +
80 spi0-hw-cs {
81 deprecated = "no longer necessary";
82 };
83 --- /dev/null
84 +++ b/arch/arm/boot/dts/overlays/spi0-1cs-overlay.dts
85 @@ -0,0 +1,42 @@
86 +/dts-v1/;
87 +/plugin/;
88 +
89 +
90 +/ {
91 + compatible = "brcm,bcm2835";
92 +
93 + fragment@0 {
94 + target = <&spi0_cs_pins>;
95 + frag0: __overlay__ {
96 + brcm,pins = <8>;
97 + };
98 + };
99 +
100 + fragment@1 {
101 + target = <&spi0>;
102 + frag1: __overlay__ {
103 + cs-gpios = <&gpio 8 1>;
104 + status = "okay";
105 + };
106 + };
107 +
108 + fragment@2 {
109 + target = <&spidev1>;
110 + __overlay__ {
111 + status = "disabled";
112 + };
113 + };
114 +
115 + fragment@3 {
116 + target = <&spi0_pins>;
117 + __dormant__ {
118 + brcm,pins = <10 11>;
119 + };
120 + };
121 +
122 + __overrides__ {
123 + cs0_pin = <&frag0>,"brcm,pins:0",
124 + <&frag1>,"cs-gpios:4";
125 + no_miso = <0>,"=3";
126 + };
127 +};
128 --- a/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
129 +++ /dev/null
130 @@ -1,29 +0,0 @@
131 -/dts-v1/;
132 -/plugin/;
133 -
134 -
135 -/ {
136 - compatible = "brcm,bcm2835";
137 -
138 - fragment@0 {
139 - target = <&spi0_cs_pins>;
140 - frag0: __overlay__ {
141 - brcm,pins = <8 7>;
142 - };
143 - };
144 -
145 - fragment@1 {
146 - target = <&spi0>;
147 - frag1: __overlay__ {
148 - cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
149 - status = "okay";
150 - };
151 - };
152 -
153 - __overrides__ {
154 - cs0_pin = <&frag0>,"brcm,pins:0",
155 - <&frag1>,"cs-gpios:4";
156 - cs1_pin = <&frag0>,"brcm,pins:4",
157 - <&frag1>,"cs-gpios:16";
158 - };
159 -};
160 --- /dev/null
161 +++ b/arch/arm/boot/dts/overlays/spi0-2cs-overlay.dts
162 @@ -0,0 +1,37 @@
163 +/dts-v1/;
164 +/plugin/;
165 +
166 +
167 +/ {
168 + compatible = "brcm,bcm2835";
169 +
170 + fragment@0 {
171 + target = <&spi0_cs_pins>;
172 + frag0: __overlay__ {
173 + brcm,pins = <8 7>;
174 + };
175 + };
176 +
177 + fragment@1 {
178 + target = <&spi0>;
179 + frag1: __overlay__ {
180 + cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
181 + status = "okay";
182 + };
183 + };
184 +
185 + fragment@2 {
186 + target = <&spi0_pins>;
187 + __dormant__ {
188 + brcm,pins = <10 11>;
189 + };
190 + };
191 +
192 + __overrides__ {
193 + cs0_pin = <&frag0>,"brcm,pins:0",
194 + <&frag1>,"cs-gpios:4";
195 + cs1_pin = <&frag0>,"brcm,pins:4",
196 + <&frag1>,"cs-gpios:16";
197 + no_miso = <0>,"=2";
198 + };
199 +};