1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
4 */
5
6/dts-v1/;
7#include "rk3399-puma.dtsi"
8#include <dt-bindings/input/input.h>
9
10/ {
11	model = "Theobroma Systems RK3399-Q7 SoM";
12	compatible = "tsd,rk3399-puma-haikou", "rockchip,rk3399";
13
14	aliases {
15		mmc1 = &sdmmc;
16	};
17
18	chosen {
19		stdout-path = "serial0:115200n8";
20	};
21
22	gpio-keys {
23		compatible = "gpio-keys";
24		pinctrl-0 = <&haikou_keys_pin>;
25		pinctrl-names = "default";
26
27		button-batlow-n {
28			gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
29			label = "BATLOW#";
30			linux,code = <KEY_BATTERY>;
31		};
32
33		button-pwrbtn-n {
34			gpios = <&gpio0 RK_PA1 GPIO_ACTIVE_LOW>;
35			label = "PWRBTN#";
36			linux,code = <KEY_POWER>;
37		};
38
39		button-slp-btn-n {
40			gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_LOW>;
41			label = "SLP_BTN#";
42			linux,code = <KEY_SLEEP>;
43		};
44
45		button-wake-n {
46			gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_LOW>;
47			label = "WAKE#";
48			linux,code = <KEY_WAKEUP>;
49			wakeup-source;
50		};
51
52		switch-lid-btn-n {
53			gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
54			label = "LID_BTN#";
55			linux,code = <SW_LID>;
56			linux,input-type = <EV_SW>;
57		};
58	};
59
60	leds {
61		pinctrl-0 = <&module_led_pin>, <&sd_card_led_pin>;
62
63		sd_card_led: led-1 {
64			label = "sd_card_led";
65			gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
66			linux,default-trigger = "mmc0";
67		};
68	};
69
70	i2s0-sound {
71		compatible = "simple-audio-card";
72		simple-audio-card,format = "i2s";
73		simple-audio-card,name = "Haikou,I2S-codec";
74		simple-audio-card,mclk-fs = <512>;
75
76		simple-audio-card,codec {
77			clocks = <&sgtl5000_clk>;
78			sound-dai = <&sgtl5000>;
79		};
80
81		simple-audio-card,cpu {
82			bitclock-master;
83			frame-master;
84			sound-dai = <&i2s0>;
85		};
86	};
87
88	sgtl5000_clk: sgtl5000-oscillator  {
89			compatible = "fixed-clock";
90			#clock-cells = <0>;
91			clock-frequency = <24576000>;
92	};
93
94	dc_12v: regulator-dc-12v {
95		compatible = "regulator-fixed";
96		regulator-name = "dc_12v";
97		regulator-always-on;
98		regulator-boot-on;
99		regulator-min-microvolt = <12000000>;
100		regulator-max-microvolt = <12000000>;
101	};
102
103	vcc3v3_baseboard: regulator-vcc3v3-baseboard {
104		compatible = "regulator-fixed";
105		regulator-name = "vcc3v3_baseboard";
106		regulator-always-on;
107		regulator-boot-on;
108		regulator-min-microvolt = <3300000>;
109		regulator-max-microvolt = <3300000>;
110		vin-supply = <&dc_12v>;
111	};
112
113	vcc5v0_baseboard: regulator-vcc5v0-baseboard {
114		compatible = "regulator-fixed";
115		regulator-name = "vcc5v0_baseboard";
116		regulator-always-on;
117		regulator-boot-on;
118		regulator-min-microvolt = <5000000>;
119		regulator-max-microvolt = <5000000>;
120		vin-supply = <&dc_12v>;
121	};
122
123	vcc5v0_otg: regulator-vcc5v0-otg {
124		compatible = "regulator-fixed";
125		enable-active-high;
126		gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
127		pinctrl-names = "default";
128		pinctrl-0 = <&otg_vbus_drv>;
129		regulator-name = "vcc5v0_otg";
130		regulator-always-on;
131	};
132
133	vdda_codec: regulator-vdda-codec {
134		compatible = "regulator-fixed";
135		regulator-name = "vdda_codec";
136		regulator-boot-on;
137		regulator-min-microvolt = <3300000>;
138		regulator-max-microvolt = <3300000>;
139		vin-supply = <&vcc5v0_baseboard>;
140	};
141
142	vddd_codec: regulator-vddd-codec {
143		compatible = "regulator-fixed";
144		regulator-name = "vddd_codec";
145		regulator-boot-on;
146		regulator-min-microvolt = <1600000>;
147		regulator-max-microvolt = <1600000>;
148		vin-supply = <&vcc5v0_baseboard>;
149	};
150};
151
152&gmac {
153	status = "okay";
154};
155
156&hdmi {
157	status = "okay";
158};
159
160&hdmi_sound {
161	status = "okay";
162};
163
164&i2c1 {
165	status = "okay";
166	clock-frequency = <400000>;
167};
168
169&i2c2 {
170	status = "okay";
171	clock-frequency = <400000>;
172};
173
174&i2c3 {
175	i2c-scl-rising-time-ns = <450>;
176	i2c-scl-falling-time-ns = <15>;
177	status = "okay";
178};
179
180&i2c4 {
181	status = "okay";
182	clock-frequency = <400000>;
183
184	sgtl5000: codec@a {
185		compatible = "fsl,sgtl5000";
186		reg = <0x0a>;
187		clocks = <&sgtl5000_clk>;
188		#sound-dai-cells = <0>;
189		VDDA-supply = <&vdda_codec>;
190		VDDIO-supply = <&vdda_codec>;
191		VDDD-supply = <&vddd_codec>;
192		status = "okay";
193	};
194};
195
196&i2c7 {
197	eeprom@50 {
198		reg = <0x50>;
199		compatible = "atmel,24c01";
200		pagesize = <8>;
201		size = <128>;
202		vcc-supply = <&vcc3v3_baseboard>;
203	};
204};
205
206&i2s0 {
207	status = "okay";
208};
209
210&i2s2 {
211	status = "okay";
212};
213
214&pcie_phy {
215	status = "okay";
216};
217
218&pcie0 {
219	ep-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
220	num-lanes = <4>;
221	pinctrl-names = "default";
222	pinctrl-0 = <&pcie_clkreqn_cpm>;
223	vpcie3v3-supply = <&vcc3v3_baseboard>;
224	vpcie12v-supply = <&dc_12v>;
225	status = "okay";
226};
227
228&pinctrl {
229	buttons {
230		haikou_keys_pin: haikou-keys-pin {
231			rockchip,pins =
232			  /* PWRBTN# */
233			  <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>,
234			  /* LID_BTN */
235			  <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
236			  /* BATLOW# */
237			  <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
238			  /* SLP_BTN# */
239			  <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
240			  /* WAKE# */
241			  <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
242		};
243	};
244
245	leds {
246		sd_card_led_pin: sd-card-led-pin {
247			rockchip,pins =
248			  <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
249		};
250	};
251
252	usb2 {
253		otg_vbus_drv: otg-vbus-drv {
254			rockchip,pins =
255			  <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
256		};
257	};
258};
259
260&pwm0 {
261	status = "okay";
262};
263
264&sdmmc {
265	bus-width = <4>;
266	cap-mmc-highspeed;
267	cap-sd-highspeed;
268	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
269	disable-wp;
270	max-frequency = <40000000>;
271	pinctrl-names = "default";
272	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
273	vmmc-supply = <&vcc3v3_baseboard>;
274	status = "okay";
275};
276
277&spi5 {
278	status = "okay";
279};
280
281&tcphy0 {
282	status = "okay";
283};
284
285&u2phy0 {
286	status = "okay";
287};
288
289&usbdrd3_0 {
290	status = "okay";
291};
292
293&usbdrd_dwc3_0 {
294	dr_mode = "otg";
295	extcon = <&extcon_usb3>;
296	status = "okay";
297};
298
299&u2phy0_host {
300	phy-supply = <&vcc5v0_otg>;
301	status = "okay";
302};
303
304&uart0 {
305	pinctrl-names = "default";
306	pinctrl-0 = <&uart0_xfer>;
307	status = "okay";
308};
309
310&uart2 {
311	rts-gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_HIGH>;
312	status = "okay";
313};
314
315&usb_host0_ehci {
316	status = "okay";
317};
318
319&usb_host0_ohci {
320	status = "okay";
321};
322
323&vopb {
324	status = "okay";
325};
326
327&vopb_mmu {
328	status = "okay";
329};
330
331&vopl {
332	status = "okay";
333};
334
335&vopl_mmu {
336	status = "okay";
337};
338