aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0703-overlays-rpi-poe-plus-Fix-parameters.patch
blob: e4aca831d5bb37790354ef4aa453bfe2d4b4f109 (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
From c19602f73386571bc9aed6059e2cce14f84eded4 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Mon, 7 Feb 2022 16:06:11 +0000
Subject: [PATCH] overlays: rpi-poe(-plus): Fix parameters

The support of PoE HATs is complicated because there are two methods to
control them - via the firmware, and directly over I2C - the choice
between the two methods depending on which side "owns" the i2c0 bus.

The firmware determines the ownership of i2c0 by analysing the Device
Tree after applying any dtoverlays and dtparams. For this reason the
PoE HAT overlays have recently been applied by the firmware _after_
config.txt has been processed, but this has prevented any user-supplied
threshold settings from being applied - either because the parameters
are unknown or because (after an explicit dtoverlay=rpi-poe) the
firmware's reload of the overlay has overwritten the user's settings.

Solve the problem by restructuring the rpi-poe overlays to support
a mode switch _after_ the overlay has been merged, thereby allowing
the overlays to be loaded _before_ config.txt is processed.

There is a companion firmware patch that changes the point at which
the overlays are loaded, and the parameter used to switch modes, but
the updated overlays are still compatible with older firmware, albeit
without working parameters.

See: https://github.com/raspberrypi/firmware/issues/1689

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/rpi-poe-overlay.dts    | 15 ++++++++++-----
 .../boot/dts/overlays/rpi-poe-plus-overlay.dts    | 15 +++++++++++++--
 2 files changed, 23 insertions(+), 7 deletions(-)

--- a/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
+++ b/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
@@ -67,7 +67,7 @@
 
 	fragment@2 {
 		target-path = "/__overrides__";
-		__overlay__ {
+		params: __overlay__ {
 			poe_fan_temp0 =		<&trip0>,"temperature:0";
 			poe_fan_temp0_hyst =	<&trip0>,"hysteresis:0";
 			poe_fan_temp1 =		<&trip1>,"temperature:0";
@@ -76,6 +76,9 @@
 			poe_fan_temp2_hyst =	<&trip2>,"hysteresis:0";
 			poe_fan_temp3 =		<&trip3>,"temperature:0";
 			poe_fan_temp3_hyst =	<&trip3>,"hysteresis:0";
+			poe_fan_i2c =		<&fwpwm>,"status=disabled",
+						<&poe_mfd>,"status=okay",
+						<&fan>,"pwms:0=",<&poe_mfd_pwm>;
 		};
 	};
 
@@ -91,15 +94,14 @@
 
 	fragment@4 {
 		target = <&i2c0>;
-		__dormant__ {
+		i2c_bus: __overlay__ {
 			#address-cells = <1>;
 			#size-cells = <0>;
-			status = "okay";
 
 			poe_mfd: poe@51 {
 				compatible = "raspberrypi,poe-core";
 				reg = <0x51>;
-				status = "okay";
+				status = "disabled";
 
 				poe_mfd_pwm: poe_pwm@f0 {
 					compatible = "raspberrypi,poe-pwm";
@@ -134,7 +136,10 @@
 		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",
+		i2c =			<0>, "+5+6",
+					<&fwpwm>,"status=disabled",
+					<&i2c_bus>,"status=okay",
+					<&poe_mfd>,"status=okay",
 					<&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
@@ -18,7 +18,7 @@
 	};
 	fragment@11 {
 		target = <&poe_mfd>;
-		__dormant__ {
+		__overlay__ {
 			rpi-poe-power-supply@f2 {
 				compatible = "raspberrypi,rpi-poe-power-supply";
 				reg = <0xf2>;
@@ -28,7 +28,11 @@
 	};
 
 	__overrides__ {
-		i2c =	<0>, "-3+4+5+6-10+11",
+		i2c =	<0>, "+5+6",
+			<&fwpwm>,"status=disabled",
+			<&rpi_poe_power_supply>,"status=disabled",
+			<&i2c_bus>,"status=okay",
+			<&poe_mfd>,"status=okay",
 			<&fan>,"pwms:0=",<&poe_mfd_pwm>;
 	};
 };
@@ -36,3 +40,10 @@
 &fan {
 	cooling-levels = <0 32 64 128 255>;
 };
+
+&params {
+	poe_fan_i2c = <&fwpwm>,"status=disabled",
+		      <&rpi_poe_power_supply>,"status=disabled",
+		      <&poe_mfd>,"status=okay",
+		      <&fan>,"pwms:0=",<&poe_mfd_pwm>;
+};