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-slp-btn-n {
34			gpios = <&gpio0 RK_PB3 GPIO_ACTIVE_LOW>;
35			label = "SLP_BTN#";
36			linux,code = <KEY_SLEEP>;
37		};
38
39		button-wake-n {
40			gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_LOW>;
41			label = "WAKE#";
42			linux,code = <KEY_WAKEUP>;
43			wakeup-source;
44		};
45
46		switch-lid-btn-n {
47			gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
48			label = "LID_BTN#";
49			linux,code = <SW_LID>;
50			linux,input-type = <EV_SW>;
51		};
52	};
53
54	leds {
55		pinctrl-0 = <&module_led_pin>, <&sd_card_led_pin>;
56
57		sd_card_led: led-1 {
58			label = "sd_card_led";
59			gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
60			linux,default-trigger = "mmc0";
61		};
62	};
63
64	i2s0-sound {
65		compatible = "simple-audio-card";
66		simple-audio-card,format = "i2s";
67		simple-audio-card,name = "Haikou,I2S-codec";
68		simple-audio-card,mclk-fs = <512>;
69
70		simple-audio-card,codec {
71			clocks = <&sgtl5000_clk>;
72			sound-dai = <&sgtl5000>;
73		};
74
75		simple-audio-card,cpu {
76			bitclock-master;
77			frame-master;
78			sound-dai = <&i2s0>;
79		};
80	};
81
82	sgtl5000_clk: sgtl5000-oscillator  {
83			compatible = "fixed-clock";
84			#clock-cells = <0>;
85			clock-frequency = <24576000>;
86	};
87
88	dc_12v: dc-12v {
89		compatible = "regulator-fixed";
90		regulator-name = "dc_12v";
91		regulator-always-on;
92		regulator-boot-on;
93		regulator-min-microvolt = <12000000>;
94		regulator-max-microvolt = <12000000>;
95	};
96
97	vcc3v3_baseboard: vcc3v3-baseboard {
98		compatible = "regulator-fixed";
99		regulator-name = "vcc3v3_baseboard";
100		regulator-always-on;
101		regulator-boot-on;
102		regulator-min-microvolt = <3300000>;
103		regulator-max-microvolt = <3300000>;
104		vin-supply = <&dc_12v>;
105	};
106
107	vcc5v0_baseboard: vcc5v0-baseboard {
108		compatible = "regulator-fixed";
109		regulator-name = "vcc5v0_baseboard";
110		regulator-always-on;
111		regulator-boot-on;
112		regulator-min-microvolt = <5000000>;
113		regulator-max-microvolt = <5000000>;
114		vin-supply = <&dc_12v>;
115	};
116
117	vcc5v0_otg: vcc5v0-otg-regulator {
118		compatible = "regulator-fixed";
119		enable-active-high;
120		gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
121		pinctrl-names = "default";
122		pinctrl-0 = <&otg_vbus_drv>;
123		regulator-name = "vcc5v0_otg";
124		regulator-always-on;
125	};
126
127	vdda_codec: vdda-codec {
128		compatible = "regulator-fixed";
129		regulator-name = "vdda_codec";
130		regulator-boot-on;
131		regulator-min-microvolt = <3300000>;
132		regulator-max-microvolt = <3300000>;
133		vin-supply = <&vcc5v0_baseboard>;
134	};
135
136	vddd_codec: vddd-codec {
137		compatible = "regulator-fixed";
138		regulator-name = "vddd_codec";
139		regulator-boot-on;
140		regulator-min-microvolt = <1600000>;
141		regulator-max-microvolt = <1600000>;
142		vin-supply = <&vcc5v0_baseboard>;
143	};
144};
145
146&hdmi {
147	ddc-i2c-bus = <&i2c3>;
148	status = "okay";
149};
150
151&i2c1 {
152	status = "okay";
153	clock-frequency = <400000>;
154};
155
156&i2c2 {
157	status = "okay";
158	clock-frequency = <400000>;
159};
160
161&i2c3 {
162	i2c-scl-rising-time-ns = <450>;
163	i2c-scl-falling-time-ns = <15>;
164	status = "okay";
165};
166
167&i2c4 {
168	status = "okay";
169	clock-frequency = <400000>;
170
171	sgtl5000: codec@a {
172		compatible = "fsl,sgtl5000";
173		reg = <0x0a>;
174		clocks = <&sgtl5000_clk>;
175		#sound-dai-cells = <0>;
176		VDDA-supply = <&vdda_codec>;
177		VDDIO-supply = <&vdda_codec>;
178		VDDD-supply = <&vddd_codec>;
179		status = "okay";
180	};
181};
182
183&i2c6 {
184	status = "okay";
185	clock-frequency = <400000>;
186};
187
188&pcie_phy {
189	status = "okay";
190};
191
192&pcie0 {
193	ep-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_HIGH>;
194	num-lanes = <4>;
195	pinctrl-names = "default";
196	pinctrl-0 = <&pcie_clkreqn_cpm>;
197	status = "okay";
198};
199
200&pinctrl {
201	buttons {
202		haikou_keys_pin: haikou-keys-pin {
203			rockchip,pins =
204			  /* LID_BTN */
205			  <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
206			  /* BATLOW# */
207			  <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
208			  /* SLP_BTN# */
209			  <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
210			  /* WAKE# */
211			  <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
212		};
213	};
214
215	leds {
216		sd_card_led_pin: sd-card-led-pin {
217			rockchip,pins =
218			  <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
219		};
220	};
221
222	usb2 {
223		otg_vbus_drv: otg-vbus-drv {
224			rockchip,pins =
225			  <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
226		};
227	};
228};
229
230&pwm0 {
231	status = "okay";
232};
233
234&sdmmc {
235	bus-width = <4>;
236	cap-mmc-highspeed;
237	cap-sd-highspeed;
238	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
239	disable-wp;
240	max-frequency = <40000000>;
241	pinctrl-names = "default";
242	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
243	vmmc-supply = <&vcc3v3_baseboard>;
244	status = "okay";
245};
246
247&spi5 {
248	status = "okay";
249};
250
251&tcphy0 {
252	status = "okay";
253};
254
255&u2phy0 {
256	status = "okay";
257};
258
259&usbdrd3_0 {
260	status = "okay";
261};
262
263&usbdrd_dwc3_0 {
264	dr_mode = "otg";
265	extcon = <&extcon_usb3>;
266	status = "okay";
267};
268
269&u2phy0_host {
270	phy-supply = <&vcc5v0_otg>;
271	status = "okay";
272};
273
274&uart0 {
275	pinctrl-names = "default";
276	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
277	status = "okay";
278};
279
280&uart2 {
281	status = "okay";
282};
283
284&usb_host0_ehci {
285	status = "okay";
286};
287
288&usb_host0_ohci {
289	status = "okay";
290};
291
292&vopb {
293	status = "okay";
294};
295
296&vopb_mmu {
297	status = "okay";
298};
299
300&vopl {
301	status = "okay";
302};
303
304&vopl_mmu {
305	status = "okay";
306};
307