Skip to content

Commit 30634d3

Browse files
committed
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 up to now 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: raspberrypi/firmware#1689 Signed-off-by: Phil Elwell <[email protected]>
1 parent 2a1d12e commit 30634d3

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

arch/arm/boot/dts/overlays/rpi-poe-overlay.dts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
fragment@2 {
6969
target-path = "/__overrides__";
70-
__overlay__ {
70+
params: __overlay__ {
7171
poe_fan_temp0 = <&trip0>,"temperature:0";
7272
poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
7373
poe_fan_temp1 = <&trip1>,"temperature:0";
@@ -76,6 +76,9 @@
7676
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
7777
poe_fan_temp3 = <&trip3>,"temperature:0";
7878
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
79+
poe_fan_i2c = <&fwpwm>,"status=disabled",
80+
<&poe_mfd>,"status=okay",
81+
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
7982
};
8083
};
8184

@@ -91,15 +94,15 @@
9194

9295
fragment@4 {
9396
target = <&i2c0>;
94-
__dormant__ {
97+
__overlay__ {
9598
#address-cells = <1>;
9699
#size-cells = <0>;
97100
status = "okay";
98101

99102
poe_mfd: poe@51 {
100103
compatible = "raspberrypi,poe-core";
101104
reg = <0x51>;
102-
status = "okay";
105+
status = "disabled";
103106

104107
poe_mfd_pwm: poe_pwm@f0 {
105108
compatible = "raspberrypi,poe-pwm";
@@ -134,7 +137,9 @@
134137
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
135138
poe_fan_temp3 = <&trip3>,"temperature:0";
136139
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
137-
i2c = <0>, "-3+4+5+6",
140+
i2c = <0>, "+5+6",
141+
<&fwpwm>,"status=disabled",
142+
<&poe_mfd>,"status=okay",
138143
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
139144
};
140145
};

arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
};
1919
fragment@11 {
2020
target = <&poe_mfd>;
21-
__dormant__ {
21+
__overlay__ {
2222
rpi-poe-power-supply@f2 {
2323
compatible = "raspberrypi,rpi-poe-power-supply";
2424
reg = <0xf2>;
@@ -28,11 +28,21 @@
2828
};
2929

3030
__overrides__ {
31-
i2c = <0>, "-3+4+5+6-10+11",
31+
i2c = <0>, "+5+6",
32+
<&fwpwm>,"status=disabled",
33+
<&rpi_poe_power_supply>,"status=disabled",
34+
<&poe_mfd>,"status=okay",
3235
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
3336
};
3437
};
3538

3639
&fan {
3740
cooling-levels = <0 32 64 128 255>;
3841
};
42+
43+
&params {
44+
poe_fan_i2c = <&fwpwm>,"status=disabled",
45+
<&rpi_poe_power_supply>,"status=disabled",
46+
<&poe_mfd>,"status=okay",
47+
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
48+
};

0 commit comments

Comments
 (0)