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