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