aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0661-dtoverlays-Add-option-for-PoE-HAT-to-use-Linux-I2C-i.patch
blob: 8a8a35bb34811cac49d93239a2b321b65b3c932e (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
From 7d4346817f31105ed07dd4e3e9fd2294c85a5fee Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 19 Jan 2022 17:29:13 +0000
Subject: [PATCH] dtoverlays: Add option for PoE HAT to use Linux I2C
 instead of FW.

Adds parameter "i2c" to use the PoE HAT I2C MFD driver to instantiate
the PoE HAT drivers, instead of being off the firmware.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README             |  4 ++
 .../arm/boot/dts/overlays/rpi-poe-overlay.dts | 62 +++++++++++++++----
 .../dts/overlays/rpi-poe-plus-overlay.dts     | 15 +++++
 3 files changed, 69 insertions(+), 12 deletions(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2858,6 +2858,8 @@ Params: poe_fan_temp0           Temperat
                                 speeds up (default 55000)
         poe_fan_temp3_hyst      Temperature delta (in millicelcius) at which
                                 the fan slows down (default 5000)
+        i2c                     Control the fan via Linux I2C drivers instead of
+                                the firmware.
 
 
 Name:   rpi-poe-plus
@@ -2879,6 +2881,8 @@ Params: poe_fan_temp0           Temperat
                                 speeds up (default 55000)
         poe_fan_temp3_hyst      Temperature delta (in millicelcius) at which
                                 the fan slows down (default 5000)
+        i2c                     Control the fan via Linux I2C drivers instead of
+                                the firmware.
 
 
 Name:   rpi-proto
--- a/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
+++ b/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
@@ -8,16 +8,6 @@
 	compatible = "brcm,bcm2835";
 
 	fragment@0 {
-		target = <&firmware>;
-		__overlay__ {
-			fwpwm: pwm {
-				compatible = "raspberrypi,firmware-poe-pwm";
-				#pwm-cells = <2>;
-			};
-		};
-	};
-
-	fragment@1 {
 		target-path = "/";
 		__overlay__ {
 			fan: pwm-fan {
@@ -29,7 +19,7 @@
 		};
 	};
 
-	fragment@2 {
+	fragment@1 {
 		target = <&cpu_thermal>;
 		__overlay__ {
 			trips {
@@ -75,7 +65,7 @@
 		};
 	};
 
-	fragment@3 {
+	fragment@2 {
 		target-path = "/__overrides__";
 		__overlay__ {
 			poe_fan_temp0 =		<&trip0>,"temperature:0";
@@ -89,6 +79,52 @@
 		};
 	};
 
+	fragment@3 {
+		target = <&firmware>;
+		__overlay__ {
+			fwpwm: pwm {
+				compatible = "raspberrypi,firmware-poe-pwm";
+				#pwm-cells = <2>;
+			};
+		};
+	};
+
+	fragment@4 {
+		target = <&i2c0>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			poe_mfd: poe@51 {
+				compatible = "raspberrypi,poe-core";
+				reg = <0x51>;
+				status = "okay";
+
+				poe_mfd_pwm: poe_pwm@f0 {
+					compatible = "raspberrypi,poe-pwm";
+					reg = <0xf0>;
+					status = "okay";
+					#pwm-cells = <2>;
+				};
+			};
+		};
+	};
+
+	fragment@5 {
+		target = <&i2c0if>;
+		__dormant__ {
+			status = "okay";
+		};
+	};
+
+	fragment@6 {
+		target = <&i2c0mux>;
+		__dormant__ {
+			status = "okay";
+		};
+	};
+
 	__overrides__ {
 		poe_fan_temp0 =		<&trip0>,"temperature:0";
 		poe_fan_temp0_hyst =	<&trip0>,"hysteresis:0";
@@ -98,5 +134,7 @@
 		poe_fan_temp2_hyst =	<&trip2>,"hysteresis:0";
 		poe_fan_temp3 =		<&trip3>,"temperature:0";
 		poe_fan_temp3_hyst =	<&trip3>,"hysteresis:0";
+		i2c =			<0>, "-3+4+5+6",
+					<&fan>,"pwms:0=",<&poe_mfd_pwm>;
 	};
 };
--- a/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts
+++ b/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts
@@ -16,6 +16,21 @@
 			};
 		};
 	};
+	fragment@11 {
+		target = <&poe_mfd>;
+		__dormant__ {
+			rpi-poe-power-supply@f2 {
+				compatible = "raspberrypi,rpi-poe-power-supply";
+				reg = <0xf2>;
+				status = "okay";
+			};
+		};
+	};
+
+	__overrides__ {
+		i2c =	<0>, "-3+4+5+6-10+11",
+			<&fan>,"pwms:0=",<&poe_mfd_pwm>;
+	};
 };
 
 &fan {