aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0375-overlays-Make-mcp342x-run-time-compatible.patch
blob: 1b4809db0d854a9d14e57b10dfcaf423b2809ea0 (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
200
201
202
203
204
205
206
207
208
209
From 00f01136b1c165e0f4a190fcb5ec8aa11428362f Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Mon, 9 Dec 2019 12:32:20 +0000
Subject: [PATCH] overlays: Make mcp342x run-time compatible

The order of processing of run-time overlays differs from that done by
the firmware. This means that certain parameter processing techniques
are not compatible with run-time use.  The mcp342x overlay is one such
overlay, but it is easy to change the implementation without changing
the interface.

See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=258294

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
 .../arm/boot/dts/overlays/mcp342x-overlay.dts | 133 ++++++++++++++----
 1 file changed, 102 insertions(+), 31 deletions(-)

--- a/arch/arm/boot/dts/overlays/mcp342x-overlay.dts
+++ b/arch/arm/boot/dts/overlays/mcp342x-overlay.dts
@@ -8,14 +8,15 @@
 
 	fragment@0 {
 		target = <&i2c1>;
-		__overlay__ {
+		__dormant__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
 
 			status = "okay";
 
-			mcp342x: mcp@68 {
+			mcp3421: mcp@68 {
 				reg = <0x68>;
+				compatible = "microchip,mcp3421";
 
 				status = "okay";
 			};
@@ -23,71 +24,141 @@
 	};
 
 	fragment@1 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3421";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "okay";
+
+			mcp3422: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3422";
+
+				status = "okay";
+			};
 		};
 	};
 
 	fragment@2 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3422";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "okay";
+
+			mcp3423: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3423";
+
+				status = "okay";
+			};
 		};
 	};
 
 	fragment@3 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3423";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "okay";
+
+			mcp3424: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3424";
+
+				status = "okay";
+			};
 		};
 	};
 
 	fragment@4 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3424";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "okay";
+
+			mcp3425: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3425","mcp3425";
+
+				status = "okay";
+			};
 		};
 	};
 
 	fragment@5 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3425";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "okay";
+
+			mcp3426: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3426";
+
+				status = "okay";
+			};
 		};
 	};
 
 	fragment@6 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3426";
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "okay";
+
+			mcp3427: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3427";
+
+				status = "okay";
+			};
 		};
 	};
 
 	fragment@7 {
-		target = <&mcp342x>;
+		target = <&i2c1>;
 		__dormant__ {
-			compatible = "microchip,mcp3427";
-		};
-	};
+			#address-cells = <1>;
+			#size-cells = <0>;
 
-	fragment@8 {
-		target = <&mcp342x>;
-		__dormant__ {
-			compatible = "microchip,mcp3428";
+			status = "okay";
+
+			mcp3428: mcp@68 {
+				reg = <0x68>;
+				compatible = "microchip,mcp3428";
+
+				status = "okay";
+			};
 		};
 	};
 
 	__overrides__ {
-		addr = <&mcp342x>,"reg:0";
-		mcp3421 = <0>,"=1";
-		mcp3422 = <0>,"=2";
-		mcp3423 = <0>,"=3";
-		mcp3424 = <0>,"=4";
-		mcp3425 = <0>,"=5";
-		mcp3426 = <0>,"=6";
-		mcp3427 = <0>,"=7";
-		mcp3428 = <0>,"=8";
+		addr = <&mcp3421>,"reg:0",
+		       <&mcp3422>,"reg:0",
+		       <&mcp3423>,"reg:0",
+		       <&mcp3424>,"reg:0",
+		       <&mcp3425>,"reg:0",
+		       <&mcp3426>,"reg:0",
+		       <&mcp3427>,"reg:0",
+		       <&mcp3428>,"reg:0";
+		mcp3421 = <0>,"=0";
+		mcp3422 = <0>,"=1";
+		mcp3423 = <0>,"=2";
+		mcp3424 = <0>,"=3";
+		mcp3425 = <0>,"=4";
+		mcp3426 = <0>,"=5";
+		mcp3427 = <0>,"=6";
+		mcp3428 = <0>,"=7";
 	};
 };