bcm27xx: add support for linux v5.15
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0703-overlays-rpi-poe-plus-Fix-parameters.patch
1 From c19602f73386571bc9aed6059e2cce14f84eded4 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Mon, 7 Feb 2022 16:06:11 +0000
4 Subject: [PATCH] overlays: rpi-poe(-plus): Fix parameters
5
6 The support of PoE HATs is complicated because there are two methods to
7 control them - via the firmware, and directly over I2C - the choice
8 between the two methods depending on which side "owns" the i2c0 bus.
9
10 The firmware determines the ownership of i2c0 by analysing the Device
11 Tree after applying any dtoverlays and dtparams. For this reason the
12 PoE HAT overlays have recently been applied by the firmware _after_
13 config.txt has been processed, but this has prevented any user-supplied
14 threshold settings from being applied - either because the parameters
15 are unknown or because (after an explicit dtoverlay=rpi-poe) the
16 firmware's reload of the overlay has overwritten the user's settings.
17
18 Solve the problem by restructuring the rpi-poe overlays to support
19 a mode switch _after_ the overlay has been merged, thereby allowing
20 the overlays to be loaded _before_ config.txt is processed.
21
22 There is a companion firmware patch that changes the point at which
23 the overlays are loaded, and the parameter used to switch modes, but
24 the updated overlays are still compatible with older firmware, albeit
25 without working parameters.
26
27 See: https://github.com/raspberrypi/firmware/issues/1689
28
29 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
30 ---
31 arch/arm/boot/dts/overlays/rpi-poe-overlay.dts | 15 ++++++++++-----
32 .../boot/dts/overlays/rpi-poe-plus-overlay.dts | 15 +++++++++++++--
33 2 files changed, 23 insertions(+), 7 deletions(-)
34
35 --- a/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
36 +++ b/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
37 @@ -67,7 +67,7 @@
38
39 fragment@2 {
40 target-path = "/__overrides__";
41 - __overlay__ {
42 + params: __overlay__ {
43 poe_fan_temp0 = <&trip0>,"temperature:0";
44 poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
45 poe_fan_temp1 = <&trip1>,"temperature:0";
46 @@ -76,6 +76,9 @@
47 poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
48 poe_fan_temp3 = <&trip3>,"temperature:0";
49 poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
50 + poe_fan_i2c = <&fwpwm>,"status=disabled",
51 + <&poe_mfd>,"status=okay",
52 + <&fan>,"pwms:0=",<&poe_mfd_pwm>;
53 };
54 };
55
56 @@ -91,15 +94,14 @@
57
58 fragment@4 {
59 target = <&i2c0>;
60 - __dormant__ {
61 + i2c_bus: __overlay__ {
62 #address-cells = <1>;
63 #size-cells = <0>;
64 - status = "okay";
65
66 poe_mfd: poe@51 {
67 compatible = "raspberrypi,poe-core";
68 reg = <0x51>;
69 - status = "okay";
70 + status = "disabled";
71
72 poe_mfd_pwm: poe_pwm@f0 {
73 compatible = "raspberrypi,poe-pwm";
74 @@ -134,7 +136,10 @@
75 poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
76 poe_fan_temp3 = <&trip3>,"temperature:0";
77 poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
78 - i2c = <0>, "-3+4+5+6",
79 + i2c = <0>, "+5+6",
80 + <&fwpwm>,"status=disabled",
81 + <&i2c_bus>,"status=okay",
82 + <&poe_mfd>,"status=okay",
83 <&fan>,"pwms:0=",<&poe_mfd_pwm>;
84 };
85 };
86 --- a/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts
87 +++ b/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts
88 @@ -18,7 +18,7 @@
89 };
90 fragment@11 {
91 target = <&poe_mfd>;
92 - __dormant__ {
93 + __overlay__ {
94 rpi-poe-power-supply@f2 {
95 compatible = "raspberrypi,rpi-poe-power-supply";
96 reg = <0xf2>;
97 @@ -28,7 +28,11 @@
98 };
99
100 __overrides__ {
101 - i2c = <0>, "-3+4+5+6-10+11",
102 + i2c = <0>, "+5+6",
103 + <&fwpwm>,"status=disabled",
104 + <&rpi_poe_power_supply>,"status=disabled",
105 + <&i2c_bus>,"status=okay",
106 + <&poe_mfd>,"status=okay",
107 <&fan>,"pwms:0=",<&poe_mfd_pwm>;
108 };
109 };
110 @@ -36,3 +40,10 @@
111 &fan {
112 cooling-levels = <0 32 64 128 255>;
113 };
114 +
115 +&params {
116 + poe_fan_i2c = <&fwpwm>,"status=disabled",
117 + <&rpi_poe_power_supply>,"status=disabled",
118 + <&poe_mfd>,"status=okay",
119 + <&fan>,"pwms:0=",<&poe_mfd_pwm>;
120 +};