aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0957-overlays-Add-spi0-1cs-and-spi0-2cs.patch
blob: 3af45bb0b63652fd151b2af624fb06fbdce5cb57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
From 692af7a59fd6d9d3b64edbf028cd75b0096ef8c7 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Fri, 28 Aug 2020 12:55:41 +0100
Subject: [PATCH] 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>
---
 arch/arm/boot/dts/overlays/Makefile           |  3 +-
 arch/arm/boot/dts/overlays/README             | 22 ++++++++--
 arch/arm/boot/dts/overlays/overlay_map.dts    |  4 ++
 .../boot/dts/overlays/spi0-1cs-overlay.dts    | 42 +++++++++++++++++++
 ...i0-cs-overlay.dts => spi0-2cs-overlay.dts} |  8 ++++
 5 files changed, 75 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/boot/dts/overlays/spi0-1cs-overlay.dts
 rename arch/arm/boot/dts/overlays/{spi0-cs-overlay.dts => spi0-2cs-overlay.dts} (79%)

--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -161,7 +161,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
 	spi-gpio35-39.dtbo \
 	spi-gpio40-45.dtbo \
 	spi-rtc.dtbo \
-	spi0-cs.dtbo \
+	spi0-1cs.dtbo \
+	spi0-2cs.dtbo \
 	spi1-1cs.dtbo \
 	spi1-2cs.dtbo \
 	spi1-3cs.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2412,11 +2412,27 @@ Load:   dtoverlay=spi-rtc,<param>=<val>
 Params: pcf2123                 Select the PCF2123 device
 
 
-Name:   spi0-cs
-Info:   Allows the (software) CS pins for SPI0 to be changed
-Load:   dtoverlay=spi0-cs,<param>=<val>
+Name:   spi0-1cs
+Info:   Only use one CS pin for SPI0
+Load:   dtoverlay=spi0-1cs,<param>=<val>
+Params: cs0_pin                 GPIO pin for CS0 (default 8)
+        no_miso                 Don't claim and use the MISO pin (9), freeing
+                                it for other uses.
+
+
+Name:   spi0-2cs
+Info:   Change the CS pins for SPI0
+Load:   dtoverlay=spi0-2cs,<param>=<val>
 Params: cs0_pin                 GPIO pin for CS0 (default 8)
         cs1_pin                 GPIO pin for CS1 (default 7)
+        no_miso                 Don't claim and use the MISO pin (9), freeing
+                                it for other uses.
+
+
+Name:   spi0-cs
+Info:   This overlay has been renamed spi0-1cs, keeping spi0-cs as an
+        alias for backwards compatibility.
+Load:   <Deprecated>
 
 
 Name:   spi0-hw-cs
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -61,6 +61,10 @@
 		deprecated = "use sdio,bus_width=1,gpios_22_25";
 	};
 
+	spi0-cs {
+		renamed = "spi0-2cs";
+	};
+
 	spi0-hw-cs {
 		deprecated = "no longer necessary";
 	};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/spi0-1cs-overlay.dts
@@ -0,0 +1,42 @@
+/dts-v1/;
+/plugin/;
+
+
+/ {
+	compatible = "brcm,bcm2835";
+
+	fragment@0 {
+		target = <&spi0_cs_pins>;
+		frag0: __overlay__ {
+			brcm,pins = <8>;
+		};
+	};
+
+	fragment@1 {
+		target = <&spi0>;
+		frag1: __overlay__ {
+			cs-gpios = <&gpio 8 1>;
+			status = "okay";
+		};
+	};
+
+	fragment@2 {
+		target = <&spidev1>;
+		__overlay__ {
+			status = "disabled";
+		};
+	};
+
+	fragment@3 {
+		target = <&spi0_pins>;
+		__dormant__ {
+			brcm,pins = <10 11>;
+		};
+	};
+
+	__overrides__ {
+		cs0_pin  = <&frag0>,"brcm,pins:0",
+			   <&frag1>,"cs-gpios:4";
+		no_miso = <0>,"=3";
+	};
+};
--- a/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
+++ /dev/null
@@ -1,29 +0,0 @@
-/dts-v1/;
-/plugin/;
-
-
-/ {
-	compatible = "brcm,bcm2835";
-
-	fragment@0 {
-		target = <&spi0_cs_pins>;
-		frag0: __overlay__ {
-			brcm,pins = <8 7>;
-		};
-	};
-
-	fragment@1 {
-		target = <&spi0>;
-		frag1: __overlay__ {
-			cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
-			status = "okay";
-		};
-	};
-
-	__overrides__ {
-		cs0_pin  = <&frag0>,"brcm,pins:0",
-			   <&frag1>,"cs-gpios:4";
-		cs1_pin  = <&frag0>,"brcm,pins:4",
-			   <&frag1>,"cs-gpios:16";
-	};
-};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/spi0-2cs-overlay.dts
@@ -0,0 +1,37 @@
+/dts-v1/;
+/plugin/;
+
+
+/ {
+	compatible = "brcm,bcm2835";
+
+	fragment@0 {
+		target = <&spi0_cs_pins>;
+		frag0: __overlay__ {
+			brcm,pins = <8 7>;
+		};
+	};
+
+	fragment@1 {
+		target = <&spi0>;
+		frag1: __overlay__ {
+			cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
+			status = "okay";
+		};
+	};
+
+	fragment@2 {
+		target = <&spi0_pins>;
+		__dormant__ {
+			brcm,pins = <10 11>;
+		};
+	};
+
+	__overrides__ {
+		cs0_pin  = <&frag0>,"brcm,pins:0",
+			   <&frag1>,"cs-gpios:4";
+		cs1_pin  = <&frag0>,"brcm,pins:4",
+			   <&frag1>,"cs-gpios:16";
+		no_miso = <0>,"=2";
+	};
+};