Skip to content

Commit ee2549d

Browse files
pelwellpopcornmix
authored andcommitted
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: raspberrypi/firmware#1689 Signed-off-by: Phil Elwell <[email protected]>
1 parent 5b0b516 commit ee2549d

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

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

Lines changed: 10 additions & 5 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,14 @@
9194

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

99101
poe_mfd: poe@51 {
100102
compatible = "raspberrypi,poe-core";
101103
reg = <0x51>;
102-
status = "okay";
104+
status = "disabled";
103105

104106
poe_mfd_pwm: poe_pwm@f0 {
105107
compatible = "raspberrypi,poe-pwm";
@@ -134,7 +136,10 @@
134136
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
135137
poe_fan_temp3 = <&trip3>,"temperature:0";
136138
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
137-
i2c = <0>, "-3+4+5+6",
139+
i2c = <0>, "+5+6",
140+
<&fwpwm>,"status=disabled",
141+
<&i2c_bus>,"status=okay",
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: 13 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,22 @@
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+
<&i2c_bus>,"status=okay",
35+
<&poe_mfd>,"status=okay",
3236
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
3337
};
3438
};
3539

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

0 commit comments

Comments
 (0)