1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4
5#include <dt-bindings/leds/common.h>
6#include "rk3308.dtsi"
7
8/ {
9	model = "Radxa ROCK S0";
10	compatible = "radxa,rock-s0", "rockchip,rk3308";
11
12	aliases {
13		ethernet0 = &gmac;
14		mmc0 = &emmc;
15		mmc1 = &sdmmc;
16		mmc2 = &sdio;
17	};
18
19	chosen {
20		stdout-path = "serial0:1500000n8";
21	};
22
23	leds {
24		compatible = "gpio-leds";
25		pinctrl-names = "default";
26		pinctrl-0 = <&pwr_led>;
27
28		led-green {
29			color = <LED_COLOR_ID_GREEN>;
30			default-state = "on";
31			function = LED_FUNCTION_HEARTBEAT;
32			gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;
33			linux,default-trigger = "heartbeat";
34		};
35	};
36
37	vdd_log: regulator-1v04-vdd-log {
38		compatible = "regulator-fixed";
39		regulator-name = "vdd_log";
40		regulator-always-on;
41		regulator-boot-on;
42		regulator-min-microvolt = <1040000>;
43		regulator-max-microvolt = <1040000>;
44		vin-supply = <&vcc5v0_sys>;
45	};
46
47	vcc_ddr: regulator-1v5-vcc-ddr {
48		compatible = "regulator-fixed";
49		regulator-name = "vcc_ddr";
50		regulator-always-on;
51		regulator-boot-on;
52		regulator-min-microvolt = <1500000>;
53		regulator-max-microvolt = <1500000>;
54		vin-supply = <&vcc5v0_sys>;
55	};
56
57	vcc_1v8: regulator-1v8-vcc {
58		compatible = "regulator-fixed";
59		regulator-name = "vcc_1v8";
60		regulator-always-on;
61		regulator-boot-on;
62		regulator-min-microvolt = <1800000>;
63		regulator-max-microvolt = <1800000>;
64		vin-supply = <&vcc_io>;
65	};
66
67	vcc_io: regulator-3v3-vcc-io {
68		compatible = "regulator-fixed";
69		regulator-name = "vcc_io";
70		regulator-always-on;
71		regulator-boot-on;
72		regulator-min-microvolt = <3300000>;
73		regulator-max-microvolt = <3300000>;
74		vin-supply = <&vcc5v0_sys>;
75	};
76
77	/*
78	 * HW revision prior to v1.2 must pull GPIO4_D6 low to access sdmmc.
79	 * This is modeled as an always-on active low fixed regulator.
80	 */
81	vcc_sd: regulator-3v3-vcc-sd {
82		compatible = "regulator-fixed";
83		gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_LOW>;
84		pinctrl-names = "default";
85		pinctrl-0 = <&sdmmc_2030>;
86		regulator-name = "vcc_sd";
87		regulator-always-on;
88		regulator-boot-on;
89		regulator-min-microvolt = <3300000>;
90		regulator-max-microvolt = <3300000>;
91		vin-supply = <&vcc_io>;
92	};
93
94	vcc5v0_sys: regulator-5v0-vcc-sys {
95		compatible = "regulator-fixed";
96		regulator-name = "vcc5v0_sys";
97		regulator-always-on;
98		regulator-boot-on;
99		regulator-min-microvolt = <5000000>;
100		regulator-max-microvolt = <5000000>;
101	};
102
103	vdd_core: regulator-vdd-core {
104		compatible = "pwm-regulator";
105		pwms = <&pwm0 0 5000 1>;
106		pwm-supply = <&vcc5v0_sys>;
107		regulator-name = "vdd_core";
108		regulator-always-on;
109		regulator-boot-on;
110		regulator-min-microvolt = <827000>;
111		regulator-max-microvolt = <1340000>;
112		regulator-settling-time-up-us = <250>;
113	};
114
115	sdio_pwrseq: sdio-pwrseq {
116		compatible = "mmc-pwrseq-simple";
117		pinctrl-names = "default";
118		pinctrl-0 = <&wifi_reg_on>;
119		reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
120	};
121};
122
123&cpu0 {
124	cpu-supply = <&vdd_core>;
125};
126
127&emmc {
128	cap-mmc-highspeed;
129	no-sd;
130	no-sdio;
131	non-removable;
132	pinctrl-names = "default";
133	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_pwren>;
134	vmmc-supply = <&vcc_io>;
135	status = "okay";
136};
137
138&gmac {
139	clock_in_out = "output";
140	phy-handle = <&rtl8201f>;
141	phy-supply = <&vcc_io>;
142	status = "okay";
143
144	mdio {
145		compatible = "snps,dwmac-mdio";
146		#address-cells = <1>;
147		#size-cells = <0>;
148
149		rtl8201f: ethernet-phy@1 {
150			compatible = "ethernet-phy-ieee802.3-c22";
151			reg = <1>;
152			pinctrl-names = "default";
153			pinctrl-0 = <&mac_rst>;
154			reset-assert-us = <20000>;
155			reset-deassert-us = <50000>;
156			reset-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
157		};
158	};
159};
160
161&io_domains {
162	vccio0-supply = <&vcc_io>;
163	vccio1-supply = <&vcc_io>;
164	vccio2-supply = <&vcc_io>;
165	vccio3-supply = <&vcc_io>;
166	vccio4-supply = <&vcc_1v8>;
167	vccio5-supply = <&vcc_io>;
168	status = "okay";
169};
170
171&pinctrl {
172	pinctrl-names = "default";
173	pinctrl-0 = <&rtc_32k>;
174
175	bluetooth {
176		bt_reg_on: bt-reg-on {
177			rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
178		};
179
180		bt_wake_host: bt-wake-host {
181			rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
182		};
183
184		host_wake_bt: host-wake-bt {
185			rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
186		};
187	};
188
189	gmac {
190		mac_rst: mac-rst {
191			rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
192		};
193	};
194
195	leds {
196		pwr_led: pwr-led {
197			rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
198		};
199	};
200
201	sdmmc {
202		sdmmc_2030: sdmmc-2030 {
203			rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
204		};
205	};
206
207	wifi {
208		wifi_reg_on: wifi-reg-on {
209			rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
210		};
211
212		wifi_wake_host: wifi-wake-host {
213			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>;
214		};
215	};
216};
217
218&pwm0 {
219	pinctrl-names = "default";
220	pinctrl-0 = <&pwm0_pin_pull_down>;
221	status = "okay";
222};
223
224&saradc {
225	vref-supply = <&vcc_1v8>;
226	status = "okay";
227};
228
229&sdio {
230	#address-cells = <1>;
231	#size-cells = <0>;
232	cap-sd-highspeed;
233	cap-sdio-irq;
234	keep-power-in-suspend;
235	max-frequency = <50000000>;
236	mmc-pwrseq = <&sdio_pwrseq>;
237	no-mmc;
238	no-sd;
239	non-removable;
240	vmmc-supply = <&vcc_io>;
241	vqmmc-supply = <&vcc_1v8>;
242	status = "okay";
243
244	brcmf: wifi@1 {
245		compatible = "brcm,bcm43430a1-fmac", "brcm,bcm4329-fmac";
246		reg = <1>;
247		interrupt-parent = <&gpio0>;
248		interrupts = <RK_PA0 IRQ_TYPE_LEVEL_HIGH>;
249		interrupt-names = "host-wake";
250		pinctrl-names = "default";
251		pinctrl-0 = <&wifi_wake_host>;
252	};
253};
254
255&sdmmc {
256	cap-mmc-highspeed;
257	cap-sd-highspeed;
258	disable-wp;
259	vmmc-supply = <&vcc_sd>;
260	status = "okay";
261};
262
263&u2phy {
264	status = "okay";
265};
266
267&u2phy_host {
268	status = "okay";
269};
270
271&u2phy_otg {
272	status = "okay";
273};
274
275&uart0 {
276	pinctrl-names = "default";
277	pinctrl-0 = <&uart0_xfer>;
278	status = "okay";
279};
280
281&uart4 {
282	uart-has-rtscts;
283	status = "okay";
284
285	bluetooth {
286		compatible = "brcm,bcm43430a1-bt";
287		clocks = <&cru SCLK_RTC32K>;
288		clock-names = "lpo";
289		interrupt-parent = <&gpio4>;
290		interrupts = <RK_PB4 IRQ_TYPE_LEVEL_HIGH>;
291		interrupt-names = "host-wakeup";
292		device-wakeup-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;
293		shutdown-gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
294		pinctrl-names = "default";
295		pinctrl-0 = <&bt_reg_on &bt_wake_host &host_wake_bt>;
296		vbat-supply = <&vcc_io>;
297		vddio-supply = <&vcc_1v8>;
298	};
299};
300
301&usb_host_ehci {
302	status = "okay";
303};
304
305&usb_host_ohci {
306	status = "okay";
307};
308
309&usb20_otg {
310	dr_mode = "peripheral";
311	status = "okay";
312};
313
314&wdt {
315	status = "okay";
316};
317