1/*
2 * This file is dual-licensed: you can use it either under the terms
3 * of the GPL or the X11 license, at your option. Note that this dual
4 * licensing only applies to this file, and not this project as a
5 * whole.
6 *
7 *  a) This file is free software; you can redistribute it and/or
8 *     modify it under the terms of the GNU General Public License as
9 *     published by the Free Software Foundation; either version 2 of the
10 *     License, or (at your option) any later version.
11 *
12 *     This file is distributed in the hope that it will be useful,
13 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *     GNU General Public License for more details.
16 *
17 * Or, alternatively,
18 *
19 *  b) Permission is hereby granted, free of charge, to any person
20 *     obtaining a copy of this software and associated documentation
21 *     files (the "Software"), to deal in the Software without
22 *     restriction, including without limitation the rights to use,
23 *     copy, modify, merge, publish, distribute, sublicense, and/or
24 *     sell copies of the Software, and to permit persons to whom the
25 *     Software is furnished to do so, subject to the following
26 *     conditions:
27 *
28 *     The above copyright notice and this permission notice shall be
29 *     included in all copies or substantial portions of the Software.
30 *
31 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
33 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
35 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
36 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
37 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
38 *     OTHER DEALINGS IN THE SOFTWARE.
39 */
40
41/dts-v1/;
42#include "rk3288-rock2-som.dtsi"
43
44/ {
45	model = "Radxa Rock 2 Square";
46	compatible = "radxa,rock2-square", "rockchip,rk3288";
47
48	chosen {
49		stdout-path = "serial2:115200n8";
50	};
51
52	ir: ir-receiver {
53		compatible = "gpio-ir-receiver";
54		gpios = <&gpio8 1 GPIO_ACTIVE_LOW>;
55		pinctrl-names = "default";
56		pinctrl-0 = <&ir_int>;
57	};
58
59	sound {
60		compatible = "simple-audio-card";
61		simple-audio-card,name = "SPDIF";
62		simple-audio-card,dai-link@1 {  /* S/PDIF - S/PDIF */
63			cpu { sound-dai = <&spdif>; };
64			codec { sound-dai = <&spdif_out>; };
65		};
66	};
67
68	spdif_out: spdif-out {
69		compatible = "linux,spdif-dit";
70		#sound-dai-cells = <0>;
71	};
72
73	vcc_usb_host: vcc-host-regulator {
74		compatible = "regulator-fixed";
75		enable-active-high;
76		gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
77		pinctrl-names = "default";
78		pinctrl-0 = <&host_vbus_drv>;
79		/* Always on as the rockchip usb phy doesn't have a vbus-supply
80		 * property
81		 */
82		regulator-always-on;
83		regulator-name = "vcc_host";
84	};
85
86	vcc_sd: sdmmc-regulator {
87		compatible = "regulator-fixed";
88		gpio = <&gpio7 11 GPIO_ACTIVE_LOW>;
89		pinctrl-names = "default";
90		pinctrl-0 = <&sdmmc_pwr>;
91		regulator-name = "vcc_sd";
92		regulator-min-microvolt = <3300000>;
93		regulator-max-microvolt = <3300000>;
94		vin-supply = <&vcc_io>;
95	};
96};
97
98&sdmmc {
99	u-boot,dm-pre-reloc;
100	bus-width = <4>;
101	cap-mmc-highspeed;
102	cap-sd-highspeed;
103	card-detect-delay = <200>;
104	disable-wp;	/* wp not hooked up */
105	num-slots = <1>;
106	pinctrl-names = "default";
107	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
108	vmmc-supply = <&vcc_sd>;
109	vqmmc-supply = <&vccio_sd>;
110	status = "okay";
111};
112
113&gmac {
114	status = "okay";
115};
116
117&hdmi {
118	ddc-i2c-bus = <&i2c5>;
119	status = "okay";
120};
121
122&i2c0 {
123	hym8563@51 {
124		compatible = "haoyu,hym8563";
125		reg = <0x51>;
126		#clock-cells = <0>;
127		clock-frequency = <32768>;
128		clock-output-names = "xin32k";
129		interrupt-parent = <&gpio0>;
130		interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
131		pinctrl-names = "default";
132		pinctrl-0 = <&pmic_int>;
133
134	};
135};
136
137&i2c5 {
138	status = "okay";
139};
140
141&pinctrl {
142	u-boot,dm-pre-reloc;
143	ir {
144		ir_int: ir-int {
145			rockchip,pins = <8 1 RK_FUNC_GPIO &pcfg_pull_up>;
146		};
147	};
148
149	pmic {
150		pmic_int: pmic-int {
151			rockchip,pins = <0 4 RK_FUNC_GPIO &pcfg_pull_up>;
152		};
153	};
154
155	usb {
156		host_vbus_drv: host-vbus-drv {
157			rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
158		};
159	};
160
161	sdmmc {
162		sdmmc_pwr: sdmmc-pwr {
163			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
164		};
165	};
166};
167
168&spdif {
169	status = "okay";
170};
171
172&uart2 {
173	status = "okay";
174	u-boot,dm-pre-reloc;
175	reg-shift = <2>;
176};
177
178&usbphy {
179	status = "okay";
180};
181
182&usb_host0_ehci {
183	status = "okay";
184};
185
186&dmc {
187	rockchip,num-channels = <2>;
188	rockchip,pctl-timing = <0x29a 0xc8 0x1f8 0x42 0x4e 0x4 0xea 0xa
189		0x5 0x0 0xa 0x7 0x19 0x24 0xa 0x7
190		0x5 0xa 0x5 0x200 0x5 0x10 0x40 0x0
191		0x1 0x7 0x7 0x4 0xc 0x43 0x100 0x0
192		0x5 0x0>;
193	rockchip,phy-timing = <0x48f9aab4 0xea0910 0x1002c200
194		0xa60 0x40 0x10 0x0>;
195	rockchip,sdram-channel = /bits/ 8 <0x1 0xa 0x3 0x2 0x1 0x0 0xf 0xf 0xff>;
196	rockchip,sdram-params = <0x30B25564 0x627 3 666000000 3 9 1>;
197};
198
199&gpio7 {
200	u-boot,dm-pre-reloc;
201};
202