8a8a35bb34811cac49d93239a2b321b65b3c932e
[openwrt/staging/robimarko.git] /
1 From 7d4346817f31105ed07dd4e3e9fd2294c85a5fee Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 19 Jan 2022 17:29:13 +0000
4 Subject: [PATCH] dtoverlays: Add option for PoE HAT to use Linux I2C
5 instead of FW.
6
7 Adds parameter "i2c" to use the PoE HAT I2C MFD driver to instantiate
8 the PoE HAT drivers, instead of being off the firmware.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 ---
12 arch/arm/boot/dts/overlays/README | 4 ++
13 .../arm/boot/dts/overlays/rpi-poe-overlay.dts | 62 +++++++++++++++----
14 .../dts/overlays/rpi-poe-plus-overlay.dts | 15 +++++
15 3 files changed, 69 insertions(+), 12 deletions(-)
16
17 --- a/arch/arm/boot/dts/overlays/README
18 +++ b/arch/arm/boot/dts/overlays/README
19 @@ -2858,6 +2858,8 @@ Params: poe_fan_temp0 Temperat
20 speeds up (default 55000)
21 poe_fan_temp3_hyst Temperature delta (in millicelcius) at which
22 the fan slows down (default 5000)
23 + i2c Control the fan via Linux I2C drivers instead of
24 + the firmware.
25
26
27 Name: rpi-poe-plus
28 @@ -2879,6 +2881,8 @@ Params: poe_fan_temp0 Temperat
29 speeds up (default 55000)
30 poe_fan_temp3_hyst Temperature delta (in millicelcius) at which
31 the fan slows down (default 5000)
32 + i2c Control the fan via Linux I2C drivers instead of
33 + the firmware.
34
35
36 Name: rpi-proto
37 --- a/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
38 +++ b/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts
39 @@ -8,16 +8,6 @@
40 compatible = "brcm,bcm2835";
41
42 fragment@0 {
43 - target = <&firmware>;
44 - __overlay__ {
45 - fwpwm: pwm {
46 - compatible = "raspberrypi,firmware-poe-pwm";
47 - #pwm-cells = <2>;
48 - };
49 - };
50 - };
51 -
52 - fragment@1 {
53 target-path = "/";
54 __overlay__ {
55 fan: pwm-fan {
56 @@ -29,7 +19,7 @@
57 };
58 };
59
60 - fragment@2 {
61 + fragment@1 {
62 target = <&cpu_thermal>;
63 __overlay__ {
64 trips {
65 @@ -75,7 +65,7 @@
66 };
67 };
68
69 - fragment@3 {
70 + fragment@2 {
71 target-path = "/__overrides__";
72 __overlay__ {
73 poe_fan_temp0 = <&trip0>,"temperature:0";
74 @@ -89,6 +79,52 @@
75 };
76 };
77
78 + fragment@3 {
79 + target = <&firmware>;
80 + __overlay__ {
81 + fwpwm: pwm {
82 + compatible = "raspberrypi,firmware-poe-pwm";
83 + #pwm-cells = <2>;
84 + };
85 + };
86 + };
87 +
88 + fragment@4 {
89 + target = <&i2c0>;
90 + __dormant__ {
91 + #address-cells = <1>;
92 + #size-cells = <0>;
93 + status = "okay";
94 +
95 + poe_mfd: poe@51 {
96 + compatible = "raspberrypi,poe-core";
97 + reg = <0x51>;
98 + status = "okay";
99 +
100 + poe_mfd_pwm: poe_pwm@f0 {
101 + compatible = "raspberrypi,poe-pwm";
102 + reg = <0xf0>;
103 + status = "okay";
104 + #pwm-cells = <2>;
105 + };
106 + };
107 + };
108 + };
109 +
110 + fragment@5 {
111 + target = <&i2c0if>;
112 + __dormant__ {
113 + status = "okay";
114 + };
115 + };
116 +
117 + fragment@6 {
118 + target = <&i2c0mux>;
119 + __dormant__ {
120 + status = "okay";
121 + };
122 + };
123 +
124 __overrides__ {
125 poe_fan_temp0 = <&trip0>,"temperature:0";
126 poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
127 @@ -98,5 +134,7 @@
128 poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
129 poe_fan_temp3 = <&trip3>,"temperature:0";
130 poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
131 + i2c = <0>, "-3+4+5+6",
132 + <&fan>,"pwms:0=",<&poe_mfd_pwm>;
133 };
134 };
135 --- a/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts
136 +++ b/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts
137 @@ -16,6 +16,21 @@
138 };
139 };
140 };
141 + fragment@11 {
142 + target = <&poe_mfd>;
143 + __dormant__ {
144 + rpi-poe-power-supply@f2 {
145 + compatible = "raspberrypi,rpi-poe-power-supply";
146 + reg = <0xf2>;
147 + status = "okay";
148 + };
149 + };
150 + };
151 +
152 + __overrides__ {
153 + i2c = <0>, "-3+4+5+6-10+11",
154 + <&fan>,"pwms:0=",<&poe_mfd_pwm>;
155 + };
156 };
157
158 &fan {