1/*
2 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 *  a) This file is free software; you can redistribute it and/or
10 *     modify it under the terms of the GNU General Public License as
11 *     published by the Free Software Foundation; either version 2 of the
12 *     License, or (at your option) any later version.
13 *
14 *     This file is distributed in the hope that it will be useful,
15 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *     GNU General Public License for more details.
18 *
19 * Or, alternatively,
20 *
21 *  b) Permission is hereby granted, free of charge, to any person
22 *     obtaining a copy of this software and associated documentation
23 *     files (the "Software"), to deal in the Software without
24 *     restriction, including without limitation the rights to use,
25 *     copy, modify, merge, publish, distribute, sublicense, and/or
26 *     sell copies of the Software, and to permit persons to whom the
27 *     Software is furnished to do so, subject to the following
28 *     conditions:
29 *
30 *     The above copyright notice and this permission notice shall be
31 *     included in all copies or substantial portions of the Software.
32 *
33 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40 *     OTHER DEALINGS IN THE SOFTWARE.
41 */
42
43/dts-v1/;
44#include "rk3399-puma.dtsi"
45
46/ {
47	model = "Theobroma Systems RK3399-Q7 SoM";
48	compatible = "tsd,rk3399-puma-haikou", "rockchip,rk3399";
49
50	chosen {
51		stdout-path = "serial0:115200n8";
52	};
53
54	leds {
55		pinctrl-0 = <&led_pin_module>, <&led_sd_haikou>;
56
57		sd-card-led {
58			label = "sd_card_led";
59			gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
60			linux,default-trigger = "mmc0";
61		};
62	};
63
64	dc_12v: dc-12v {
65		compatible = "regulator-fixed";
66		regulator-name = "dc_12v";
67		regulator-always-on;
68		regulator-boot-on;
69		regulator-min-microvolt = <12000000>;
70		regulator-max-microvolt = <12000000>;
71	};
72
73	vcc3v3_baseboard: vcc3v3-baseboard {
74		compatible = "regulator-fixed";
75		regulator-name = "vcc3v3_baseboard";
76		regulator-always-on;
77		regulator-boot-on;
78		regulator-min-microvolt = <3300000>;
79		regulator-max-microvolt = <3300000>;
80		vin-supply = <&dc_12v>;
81	};
82
83	vcc5v0_otg: vcc5v0-otg-regulator {
84		compatible = "regulator-fixed";
85		enable-active-high;
86		gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
87		pinctrl-names = "default";
88		pinctrl-0 = <&otg_vbus_drv>;
89		regulator-name = "vcc5v0_otg";
90		regulator-always-on;
91	};
92};
93
94&i2c1 {
95	status = "okay";
96	clock-frequency = <400000>;
97};
98
99&i2c2 {
100	status = "okay";
101	clock-frequency = <400000>;
102};
103
104&i2c3 {
105	i2c-scl-rising-time-ns = <450>;
106	i2c-scl-falling-time-ns = <15>;
107	status = "okay";
108};
109
110&i2c4 {
111	status = "okay";
112	clock-frequency = <400000>;
113};
114
115&i2c6 {
116	status = "okay";
117	clock-frequency = <400000>;
118};
119
120&i2s0 {
121	status = "okay";
122	rockchip,playback-channels = <8>;
123	rockchip,capture-channels = <8>;
124	#sound-dai-cells = <0>;
125	status = "okay";
126};
127
128&pcie_phy {
129	status = "okay";
130};
131
132&pcie0 {
133	ep-gpios = <&gpio4 RK_PC6 GPIO_ACTIVE_LOW>;
134	num-lanes = <4>;
135	pinctrl-names = "default";
136	pinctrl-0 = <&pcie_clkreqn_cpm>;
137	status = "okay";
138};
139
140&pinctrl {
141	pinctrl-names = "default";
142	pinctrl-0 = <&haikou_pin_hog>;
143
144	hog {
145		haikou_pin_hog: haikou-pin-hog {
146			rockchip,pins =
147			  /* LID_BTN */
148			  <RK_GPIO0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
149			  /* BATLOW# */
150			  <RK_GPIO0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
151			  /* SLP_BTN# */
152			  <RK_GPIO0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
153			  /* BIOS_DISABLE# */
154			  <RK_GPIO0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
155		};
156	};
157
158	leds {
159		led_sd_haikou: led-sd-gpio {
160			rockchip,pins =
161			  <RK_GPIO1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
162		};
163	};
164
165	usb2 {
166		otg_vbus_drv: otg-vbus-drv {
167			rockchip,pins =
168			  <RK_GPIO0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
169		};
170	};
171};
172
173&pwm0 {
174	status = "okay";
175};
176
177&sdmmc {
178	bus-width = <4>;
179	cap-mmc-highspeed;
180	cap-sd-highspeed;
181	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
182	disable-wp;
183	max-frequency = <150000000>;
184	pinctrl-names = "default";
185	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
186	vmmc-supply = <&vcc3v3_baseboard>;
187	status = "okay";
188};
189
190&spi5 {
191	status = "okay";
192};
193
194&u2phy0 {
195	status = "okay";
196};
197
198&usbdrd3_0 {
199	status = "okay";
200};
201
202&usbdrd_dwc3_0 {
203	dr_mode = "otg";
204	status = "okay";
205};
206
207&u2phy0_host {
208	phy-supply = <&vcc5v0_otg>;
209	status = "okay";
210};
211
212&uart0 {
213	pinctrl-names = "default";
214	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
215	status = "okay";
216};
217
218&uart2 {
219	status = "okay";
220};
221
222&usb_host0_ehci {
223	status = "okay";
224};
225
226&usb_host0_ohci {
227	status = "okay";
228};
229