d1: add new target
[openwrt/staging/mans0n.git] / target / linux / d1 / patches-6.1 / 0033-riscv-dts-allwinner-Add-ClockworkPi-and-DevTerm-devi.patch
1 From 11f692c6b009f36b9a91d5ceb5998ae15e57f18c Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Sun, 10 Jul 2022 23:43:49 -0500
4 Subject: [PATCH 033/117] riscv: dts: allwinner: Add ClockworkPi and DevTerm
5 devicetrees
6
7 Clockwork Tech manufactures several SoMs for their RasPi CM3-compatible
8 "ClockworkPi" mainboard. Their R-01 SoM features the Allwinner D1 SoC.
9 The R-01 contains only the CPU, DRAM, and always-on voltage regulation;
10 it does not merit a separate devicetree.
11
12 The ClockworkPi mainboard features analog audio, a MIPI-DSI panel, USB
13 host and peripheral ports, an Ampak AP6256 WiFi/Bluetooth module, and an
14 X-Powers AXP228 PMIC for managing a Li-ion battery.
15
16 The DevTerm is a complete system which extends the ClockworkPi mainboard
17 with a pair of expansion boards. These expansion boards provide a fan, a
18 keyboard, speakers, and a thermal printer.
19
20 Signed-off-by: Samuel Holland <samuel@sholland.org>
21 ---
22 arch/riscv/boot/dts/allwinner/Makefile | 2 +
23 .../allwinner/sun20i-d1-clockworkpi-v3.14.dts | 242 ++++++++++++++++++
24 .../dts/allwinner/sun20i-d1-devterm-v3.14.dts | 37 +++
25 3 files changed, 281 insertions(+)
26 create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-clockworkpi-v3.14.dts
27 create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-devterm-v3.14.dts
28
29 --- a/arch/riscv/boot/dts/allwinner/Makefile
30 +++ b/arch/riscv/boot/dts/allwinner/Makefile
31 @@ -1,4 +1,6 @@
32 # SPDX-License-Identifier: GPL-2.0
33 +dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-clockworkpi-v3.14.dtb
34 +dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-devterm-v3.14.dtb
35 dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-dongshan-nezha-stu.dtb
36 dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-86-panel-480p.dtb
37 dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-86-panel-720p.dtb
38 --- /dev/null
39 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-clockworkpi-v3.14.dts
40 @@ -0,0 +1,242 @@
41 +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
42 +// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
43 +
44 +/dts-v1/;
45 +
46 +#include <dt-bindings/gpio/gpio.h>
47 +
48 +#include "sun20i-d1.dtsi"
49 +#include "sun20i-d1-common-regulators.dtsi"
50 +
51 +/ {
52 + model = "ClockworkPi v3.14 (R-01)";
53 + compatible = "clockwork,r-01-clockworkpi-v3.14", "allwinner,sun20i-d1";
54 +
55 + aliases {
56 + ethernet0 = &ap6256;
57 + mmc0 = &mmc0;
58 + serial0 = &uart0;
59 + };
60 +
61 + chosen {
62 + stdout-path = "serial0:115200n8";
63 + };
64 +
65 + /*
66 + * This regulator is PWM-controlled, but the PWM controller is not
67 + * yet supported, so fix the regulator to its default voltage.
68 + */
69 + reg_vdd_cpu: vdd-cpu {
70 + compatible = "regulator-fixed";
71 + regulator-name = "vdd-cpu";
72 + regulator-min-microvolt = <1100000>;
73 + regulator-max-microvolt = <1100000>;
74 + vin-supply = <&reg_vcc>;
75 + };
76 +
77 + wifi_pwrseq: wifi-pwrseq {
78 + compatible = "mmc-pwrseq-simple";
79 + reset-gpios = <&pio 6 11 GPIO_ACTIVE_LOW>; /* PG11/GPIO3 */
80 + };
81 +};
82 +
83 +&cpu0 {
84 + cpu-supply = <&reg_vdd_cpu>;
85 +};
86 +
87 +&ehci1 {
88 + status = "okay";
89 +};
90 +
91 +&i2c0 {
92 + pinctrl-0 = <&i2c0_pb10_pins>;
93 + pinctrl-names = "default";
94 + status = "okay";
95 +
96 + axp221: pmic@34 {
97 + compatible = "x-powers,axp228", "x-powers,axp221";
98 + reg = <0x34>;
99 + interrupt-parent = <&pio>;
100 + interrupts = <4 9 IRQ_TYPE_LEVEL_LOW>; /* PE9/GPIO2 */
101 + interrupt-controller;
102 + #interrupt-cells = <1>;
103 +
104 + ac_power_supply: ac-power {
105 + compatible = "x-powers,axp221-ac-power-supply";
106 + };
107 +
108 + axp_adc: adc {
109 + compatible = "x-powers,axp221-adc";
110 + #io-channel-cells = <1>;
111 + };
112 +
113 + battery_power_supply: battery-power {
114 + compatible = "x-powers,axp221-battery-power-supply";
115 + };
116 +
117 + regulators {
118 + x-powers,dcdc-freq = <3000>;
119 +
120 + reg_dcdc1: dcdc1 {
121 + regulator-name = "sys-3v3";
122 + regulator-always-on;
123 + regulator-min-microvolt = <3300000>;
124 + regulator-max-microvolt = <3300000>;
125 + };
126 +
127 + reg_dcdc3: dcdc3 {
128 + regulator-name = "sys-1v8";
129 + regulator-always-on;
130 + regulator-min-microvolt = <1800000>;
131 + regulator-max-microvolt = <1800000>;
132 + };
133 +
134 + reg_aldo1: aldo1 {
135 + regulator-name = "aud-3v3";
136 + regulator-min-microvolt = <3300000>;
137 + regulator-max-microvolt = <3300000>;
138 + };
139 +
140 + reg_aldo2: aldo2 {
141 + regulator-name = "disp-3v3";
142 + regulator-always-on;
143 + regulator-min-microvolt = <3300000>;
144 + regulator-max-microvolt = <3300000>;
145 + };
146 +
147 + reg_aldo3: aldo3 {
148 + regulator-name = "vdd-wifi";
149 + regulator-min-microvolt = <1800000>;
150 + regulator-max-microvolt = <1800000>;
151 + };
152 +
153 + /* DLDO1 and ELDO1-3 are connected in parallel. */
154 + reg_dldo1: dldo1 {
155 + regulator-name = "vbat-wifi-a";
156 + regulator-always-on;
157 + regulator-min-microvolt = <3300000>;
158 + regulator-max-microvolt = <3300000>;
159 + };
160 +
161 + /* DLDO2-DLDO4 are connected in parallel. */
162 + reg_dldo2: dldo2 {
163 + regulator-name = "vcc-3v3-ext-a";
164 + regulator-always-on;
165 + regulator-min-microvolt = <3300000>;
166 + regulator-max-microvolt = <3300000>;
167 + };
168 +
169 + reg_dldo3: dldo3 {
170 + regulator-name = "vcc-3v3-ext-b";
171 + regulator-always-on;
172 + regulator-min-microvolt = <3300000>;
173 + regulator-max-microvolt = <3300000>;
174 + };
175 +
176 + reg_dldo4: dldo4 {
177 + regulator-name = "vcc-3v3-ext-c";
178 + regulator-always-on;
179 + regulator-min-microvolt = <3300000>;
180 + regulator-max-microvolt = <3300000>;
181 + };
182 +
183 + reg_eldo1: eldo1 {
184 + regulator-name = "vbat-wifi-b";
185 + regulator-always-on;
186 + regulator-min-microvolt = <3300000>;
187 + regulator-max-microvolt = <3300000>;
188 + };
189 +
190 + reg_eldo2: eldo2 {
191 + regulator-name = "vbat-wifi-c";
192 + regulator-always-on;
193 + regulator-min-microvolt = <3300000>;
194 + regulator-max-microvolt = <3300000>;
195 + };
196 +
197 + reg_eldo3: eldo3 {
198 + regulator-name = "vbat-wifi-d";
199 + regulator-always-on;
200 + regulator-min-microvolt = <3300000>;
201 + regulator-max-microvolt = <3300000>;
202 + };
203 + };
204 +
205 + usb_power_supply: usb-power {
206 + compatible = "x-powers,axp221-usb-power-supply";
207 + status = "disabled";
208 + };
209 + };
210 +};
211 +
212 +&mmc0 {
213 + broken-cd;
214 + bus-width = <4>;
215 + disable-wp;
216 + vmmc-supply = <&reg_dcdc1>;
217 + vqmmc-supply = <&reg_vcc_3v3>;
218 + pinctrl-0 = <&mmc0_pins>;
219 + pinctrl-names = "default";
220 + status = "okay";
221 +};
222 +
223 +&mmc1 {
224 + bus-width = <4>;
225 + mmc-pwrseq = <&wifi_pwrseq>;
226 + non-removable;
227 + vmmc-supply = <&reg_dldo1>;
228 + vqmmc-supply = <&reg_aldo3>;
229 + pinctrl-0 = <&mmc1_pins>;
230 + pinctrl-names = "default";
231 + status = "okay";
232 +
233 + ap6256: wifi@1 {
234 + compatible = "brcm,bcm43456-fmac", "brcm,bcm4329-fmac";
235 + reg = <1>;
236 + interrupt-parent = <&pio>;
237 + interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10/GPIO4 */
238 + interrupt-names = "host-wake";
239 + };
240 +};
241 +
242 +&ohci1 {
243 + status = "okay";
244 +};
245 +
246 +&pio {
247 + vcc-pg-supply = <&reg_ldoa>;
248 +};
249 +
250 +&uart0 {
251 + pinctrl-0 = <&uart0_pb8_pins>;
252 + pinctrl-names = "default";
253 + status = "okay";
254 +};
255 +
256 +&uart1 {
257 + uart-has-rtscts;
258 + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
259 + pinctrl-names = "default";
260 + status = "okay";
261 +
262 + bluetooth {
263 + compatible = "brcm,bcm4345c5";
264 + interrupt-parent = <&pio>;
265 + interrupts = <6 17 IRQ_TYPE_LEVEL_HIGH>; /* PG17/GPIO6 */
266 + device-wakeup-gpios = <&pio 6 16 GPIO_ACTIVE_HIGH>; /* PG16/GPIO7 */
267 + shutdown-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18/GPIO5 */
268 + max-speed = <1500000>;
269 + vbat-supply = <&reg_dldo1>;
270 + vddio-supply = <&reg_aldo3>;
271 + };
272 +};
273 +
274 +&usb_otg {
275 + dr_mode = "peripheral";
276 + status = "okay";
277 +};
278 +
279 +&usbphy {
280 + usb0_vbus_power-supply = <&ac_power_supply>;
281 + status = "okay";
282 +};
283 --- /dev/null
284 +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-devterm-v3.14.dts
285 @@ -0,0 +1,37 @@
286 +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
287 +// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
288 +
289 +/dts-v1/;
290 +
291 +#include "sun20i-d1-clockworkpi-v3.14.dts"
292 +
293 +/ {
294 + model = "Clockwork DevTerm (R-01)";
295 + compatible = "clockwork,r-01-devterm-v3.14",
296 + "clockwork,r-01-clockworkpi-v3.14",
297 + "allwinner,sun20i-d1";
298 +
299 + fan {
300 + compatible = "gpio-fan";
301 + gpios = <&pio 3 10 GPIO_ACTIVE_HIGH>; /* PD10/GPIO41 */
302 + gpio-fan,speed-map = <0 0>,
303 + <6000 1>;
304 + #cooling-cells = <2>;
305 + };
306 +
307 + i2c-gpio-0 {
308 + compatible = "i2c-gpio";
309 + sda-gpios = <&pio 3 14 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD14/GPIO44 */
310 + scl-gpios = <&pio 3 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD15/GPIO45 */
311 + #address-cells = <1>;
312 + #size-cells = <0>;
313 +
314 + adc@54 {
315 + compatible = "ti,adc101c";
316 + reg = <0x54>;
317 + interrupt-parent = <&pio>;
318 + interrupts = <4 12 IRQ_TYPE_LEVEL_LOW>; /* PE12/GPIO35 */
319 + vref-supply = <&reg_dldo2>;
320 + };
321 + };
322 +};