1/*-
2 * Copyright (c) 2015 John Wehle <john@feith.com>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29/*
30 * The ordering of certain devices is significant (e.g. usb depends on
31 * usb-phy which depends on gpio, also the timer should appear early on
32 * to provide a reasonably accurate DELAY implementation).
33 *
34 * Both usb-phys devices must be configured to prevent the usb controller
35 * from hanging during initialization.
36 */
37
38/dts-v1/;
39
40/memreserve/ 0x7900000 0x00600000;			/* 6MB frame buffer */
41
42#include "meson8b.dtsi"
43
44/ {
45	model = "hardkernel,odroid-c1";
46	compatible = "hardkernel,odroid-c1", "amlogic,s805";
47
48	#address-cells = <1>;
49	#size-cells = <1>;
50
51	aliases {
52		soc = &soc;
53		screen = &screen;
54		uart0 = &uart_AO;
55	};
56
57	memory {
58		device_type = "memory";
59		reg = <0x0 0x40000000>;		/* 1GB RAM */
60	};
61
62	soc: soc {
63		device_type = "soc";
64		bus-frequency = <0>;
65
66		scu: scu@c4300000 {
67			compatible = "arm,cortex-a5-scu";
68			reg = <0xc4300000 0x1000>;
69		};
70
71		cpuconfig: cpuconfig@d901ff80 {
72			compatible = "amlogic,aml8726-cpuconfig";
73			reg = <0xd901ff80 16>;
74		};
75
76		ccm@c1104140 {
77			compatible = "amlogic,aml8726-ccm";
78			reg = <0xc1104140 20>;	/* cbus 0x1050 */
79
80			functions = "ethernet", "i2c", "rng", "sdio", "sdxc",
81				    "uart-a", "uart-b", "uart-c",
82				    "usb-a", "usb-b";
83		};
84
85		pinctrl@c11080b0 {
86			compatible = "amlogic,aml8726-pinctrl";
87			reg = <0xc11080b0 40>,	/* mux */
88			      <0xc11080e8 24>,	/* pu/pd */
89			      <0xc1108120 24>,	/* pull enable */
90			      <0xc8100014 4>,	/* ao mux */
91			      <0xc810002c 4>,	/* ao pu/pd */
92			      <0xc810002c 4>;	/* ao pull enable */
93
94			/*
95			 * Currently only pin muxing that deviates
96			 * from the power on default of gpio is
97			 * specified here.
98			 */
99
100			pinctrl-names = "default";
101			pinctrl-0 = <&pins_uartao &pins_ethernet &pins_hdmi>;
102
103			pins_ethernet: ethernet {
104				amlogic,pins = "ref_clk",
105					       "tx_clk",  "tx_en",
106					       "tx_d0",   "tx_d1",
107					       "tx_d2",   "tx_d3",
108					       "rx_clk",  "rx_dv",
109					       "rx_d0",   "rx_d1",
110					       "rx_d2",   "rx_d3",
111					       "mdc",     "mdio";
112				amlogic,function = "ethernet";
113			};
114
115			pins_hdmi: hdmi {
116				amlogic,pins = "cec", "hpd",
117					       "scl", "sda";
118				amlogic,function = "hdmi";
119			};
120
121			pins_sdio_b: sdio_b {
122				amlogic,pins = "clk", "cmd",
123					       "d0",  "d1",
124					       "d2",  "d3";
125				amlogic,function = "sdio-b";
126				amlogic,pull = "up";
127			};
128
129			pins_sdxc_b: sdxc_b {
130				amlogic,pins = "clk", "cmd",
131					       "d0",  "d1",
132					       "d2",  "d3";
133				amlogic,function = "sdxc-b";
134				amlogic,pull = "up";
135			};
136
137			pins_sdio_c: sdio_c {
138				amlogic,pins = "clk", "cmd",
139					       "d0",  "d1",
140					       "d2",  "d3";
141				amlogic,function = "sdio-c";
142				amlogic,pull = "up";
143			};
144
145			pins_sdxc_c: sdxc_c {
146				amlogic,pins = "clk", "cmd",
147					       "d0",  "d1",
148					       "d2",  "d3",
149					       "d4",  "d5",
150					       "d6",  "d7";
151				amlogic,function = "sdxc-c";
152				amlogic,pull = "up";
153			};
154
155			pins_i2c_a: i2c_a {
156				amlogic,pins = "scl", "sda";
157				amlogic,function = "i2c-a";
158			};
159
160			pins_i2c_b: i2c_b {
161				amlogic,pins = "scl", "sda";
162				amlogic,function = "i2c-b";
163			};
164
165			pins_uarta: uarta {
166				amlogic,pins = "tx", "rx", "cts", "rts";
167				amlogic,function = "uart-a";
168			};
169
170			pins_uartb: uartb {
171
172				/*
173				 * gpiox18 appears to have special
174				 * meaning to the bootloader making
175				 * hardware handshaking unavailable.
176				 */
177
178				amlogic,pins = "tx", "rx";
179				amlogic,function = "uart-b";
180			};
181
182			pins_uartc: uartc {
183				amlogic,pins = "tx", "rx", "cts", "rts";
184				amlogic,function = "uart-c";
185			};
186
187			pins_uartao: uartao {
188				amlogic,pins = "tx", "rx";
189				amlogic,function = "uart-ao";
190			};
191		};
192
193		rtc@c8100740 {
194			compatible = "amlogic,aml8726-rtc";
195			reg = <0xc8100740 20>;	/* aobus 0x1d0 */
196			interrupts = <0 72 1>;
197		};
198
199		clkmsr: clkmsr@c1108758 {
200			compatible = "amlogic,aml8726-clkmsr";
201			reg = <0xc1108758 16>;	/* cbus 0x21d6 */
202
203			clocks = <&clk81>;
204		};
205
206		gpioao: gpio@c8100024 {
207			/* gpio unit 7 */
208			compatible = "amlogic,aml8726-gpio";
209			reg = <0xc8100024 4>,	/* oen aobus 0x9 */
210			      <0xc8100024 4>,	/* out */
211			      <0xc8100028 4>;	/* in */
212
213			gpio-controller;
214			#gpio-cells = <1>;
215			pin-count = <14>;
216		};
217
218		gpio3: gpio@c1108054 {
219			compatible = "amlogic,aml8726-gpio";
220			reg = <0xc1108054 4>,	/* oen cbus 0x2015 */
221			      <0xc1108058 4>,	/* out */
222			      <0xc110805c 4>;	/* in */
223
224			gpio-controller;
225			#gpio-cells = <1>;
226			pin-count = <32>;
227		};
228
229		gpio5: gpio@c110806c {
230			compatible = "amlogic,aml8726-gpio";
231			reg = <0xc110806c 4>,	/* oen cbus 0x201b */
232			      <0xc1108070 4>,	/* out */
233			      <0xc1108074 4>;	/* in */
234
235			gpio-controller;
236			#gpio-cells = <1>;
237			pin-count = <32>;
238		};
239
240		mmc@c1108c20 {
241			compatible = "amlogic,aml8726-mmc";
242			reg = <0xc1108c20 32>;	/* cbus 0x2308 */
243			interrupts = <0 28 1>;
244
245			clocks = <&clk81>;
246
247			pinctrl-names = "default";
248			pinctrl-0 = <&pins_sdio_b>;
249
250			/*
251			 * Ordering is significant.
252			 *
253			 * mmc-vselect low sets first voltage
254			 * mmc-vselect high sets second voltage
255			 *
256			 * If mmc-vselect is not present, then
257			 * only one voltage should be specified.
258			 */
259			mmc-voltages = "3.3", "1.8";
260			mmc-vselect = <&gpioao 3>;	/* gpioao_3 */
261
262			mmc-pwr-en = <&gpio5 31 0>;	/* card_8 */
263			ins-detect = <&gpio5 29 0>;	/* card_6 */
264		};
265
266		sdxc@c1108e00 {
267			compatible = "amlogic,aml8726-sdxc-m8";
268			clock-frequency = <1275000000>;
269			reg = <0xc1108e00 60>;	/* cbus 0x2380 */
270			interrupts = <0 78 1>;
271
272			pinctrl-names = "default";
273			pinctrl-0 = <&pins_sdxc_c>;
274
275			mmc-voltages = "1.8";
276
277			mmc-rst = <&gpio3 9 0>;	/* boot_9 emmc-rst */
278		};
279
280		rng@c1108100 {
281			compatible = "amlogic,aml8726-rng";
282			reg = <0xc1108100 8>;	/* cbus 0x2040 */
283		};
284
285		usb-phy@c1108800 {
286			/* usb-a phy */
287			compatible = "amlogic,aml8726-m8-usb-phy";
288			reg = <0xc1108800 32>;	/* cbus 0x2200 */
289
290			usb-pwr-en = <&gpioao 5 1>;	/* gpioao_5 vbus */
291		};
292
293		usb-phy@c1108820 {
294			/* usb-b phy */
295			compatible = "amlogic,aml8726-m8-usb-phy";
296			reg = <0xc1108820 32>;	/* cbus 0x2208 */
297
298			force-aca = "true";
299			usb-hub-rst = <&gpioao 4 0>;	/* gpioao_4 hub-rst */
300		};
301
302		usb@c9040000 {
303			/* usb-a */
304			compatible = "synopsys,designware-hs-otg2";
305			reg = <0xc9040000 0x40000>;	/* ahbbus 0x40000*/
306			interrupts = <0 30 4>;
307			#address-cells = <1>;
308			#size-cells = <0>;
309
310			dr_mode = "host";
311		};
312
313		usb@c90c0000 {
314			/* usb-b */
315			compatible = "synopsys,designware-hs-otg2";
316			reg = <0xc90c0000 0x40000>;	/* ahbbus 0xc0000 */
317			interrupts = <0 31 4>;
318			#address-cells = <1>;
319			#size-cells = <0>;
320
321			dr_mode = "host";
322		};
323
324		eth@c9410000 {
325			/* ethernet */
326			compatible = "amlogic,meson6-dwmac";
327			reg = <0xc9410000 0x2000>;	/* ahbbus 0x410000 */
328			interrupts = <0 8 1>;
329			#address-cells = <1>;
330			#size-cells = <0>;
331
332			eth-phy-rst = <&gpio3 23 0>;	/* gpioh_4 phy-rst */
333		};
334
335		screen: fb@c8006020 {
336			device_type = "display";
337			compatible = "amlogic,aml8726-fb";
338			reg = <0xc8006048 12>,	/* CANVAS */
339			      <0xc1106800 1024>,	/* VIU */
340			      <0xc1107400 1024>;	/* VPP */
341			interrupts = <0 2 1>,
342				     <0 3 1>,
343				     <0 12 1>,
344				     <0 13 1>;
345
346			address = <0x7900000>;	/* match memreserve */
347			width = <720>;
348			height = <480>;
349			depth = <24>;
350			linebytes = <2160>;
351		};
352	};
353
354	leds {
355		compatible = "gpio-leds";
356
357		sys_led {
358			gpios = <&gpioao 13>;	/* gpioao_13 sys_led */
359			label = "sys_led";
360		};
361	};
362
363	chosen {
364		stdin = "uart0";
365		stdout = "uart0";
366	};
367};
368
369&clk81 {
370	clock-frequency = <0>;
371};
372
373&uart_AO {
374	status = "okay";
375	current-speed = <115200>;
376};
377
378&uart_A {
379	status = "okay";
380};
381
382&uart_B {
383	status = "okay";
384};
385
386&uart_C {
387	status = "okay";
388};
389
390&i2c_A {
391	status = "okay";
392};
393
394&i2c_B {
395	status = "okay";
396};
397