1/*-
2 * Copyright (c) 2013-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: releng/11.0/sys/boot/fdt/dts/arm/vsatv102-m6.dts 283352 2015-05-24 07:09:16Z ganbold $
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/ 0x84900000 0x00600000;			/* 6MB frame buffer */
41
42#include "meson6.dtsi"
43
44/ {
45	/*
46	 * My development unit visually appears to be a Visson ATV-102
47	 * and the specs for both my unit and the Visson ATV-102 say
48	 * the SoC is an aml8726-m3.  However the uboot prompt says
49	 * m6_mbx_v1, the RTC is located on SECBUS2 instead of AOBUS,
50	 * and there are two cores so it seems my unit is a newer
51	 * version using the later processor.
52	 */
53
54	model = "visson,atv-102";
55	compatible = "visson,atv-102", "amlogic,meson6";
56
57	#address-cells = <1>;
58	#size-cells = <1>;
59
60	aliases {
61		soc = &soc;
62		screen = &screen;
63		uart0 = &uart_AO;
64	};
65
66	memory {
67		device_type = "memory";
68		reg = <0x80000000 0x40000000>;		/* 1GB RAM */
69	};
70
71	soc: soc {
72		device_type = "soc";
73		bus-frequency = <0>;
74
75		pic: pic@c1109a40 {
76			device_type = "interrupt-controller";
77			compatible = "amlogic,aml8726-pic";
78			reg = <0xc1109a40 128>;	/* cbus 0x2690 */
79
80			interrupt-controller;
81			#interrupt-cells = <3>;
82		};
83
84		scu: scu@c4300000 {
85			compatible = "arm,cortex-a9-scu";
86			reg = <0xc4300000 0x1000>;
87		};
88
89		cpuconfig: cpuconfig@d901ff80 {
90			compatible = "amlogic,aml8726-cpuconfig";
91			reg = <0xd901ff80 8>;
92		};
93
94		ccm@c1104140 {
95			compatible = "amlogic,aml8726-ccm";
96			reg = <0xc1104140 20>;	/* cbus 0x1050 */
97
98			functions = "ethernet", "i2c", "rng", "sdio",
99				    "uart-a", "uart-b", "uart-c",
100				    "usb-a", "usb-b";
101		};
102
103		pinctrl: pinctrl@c11080b0 {
104			compatible = "amlogic,aml8726-pinctrl";
105			reg = <0xc11080b0 40>,	/* mux */
106			      <0xc11080e8 24>,	/* pu/pd */
107			      <0xc11080e8 24>,	/* pull enable */
108			      <0xc8100014 4>,	/* ao mux */
109			      <0xc810002c 4>,	/* ao pu/pd */
110			      <0xc810002c 4>;	/* ao pull enable */
111
112			/*
113			 * Currently only pin muxing that deviates
114			 * from the power on default of gpio is
115			 * specified here.
116			 */
117
118			pinctrl-names = "default";
119			pinctrl-0 = <&pins_uartao &pins_ethernet &pins_hdmi>;
120
121			pins_ethernet: ethernet {
122				amlogic,pins = "ref_clk_in",
123					       "tx_clk", "tx_en",
124					       "tx_d0",  "tx_d1",
125					       "tx_d2",  "tx_d3",
126					       "rx_clk", "rx_dv",
127					       "rx_d0",  "rx_d1",
128					       "rx_d2",  "rx_d3",
129					       "mdc",    "mdio";
130				amlogic,function = "ethernet";
131			};
132
133			pins_hdmi: hdmi {
134				amlogic,pins = "cec", "hpd",
135					       "scl", "sda";
136				amlogic,function = "hdmi";
137			};
138
139			pins_sdio_b: sdio_b {
140				amlogic,pins = "clk", "cmd",
141					       "d0",  "d1",
142					       "d2",  "d3";
143				amlogic,function = "sdio-b";
144			};
145
146			pins_uartao: uartao {
147				amlogic,pins = "tx", "rx";
148				amlogic,function = "uart-ao";
149			};
150		};
151
152		rtc@da004340 {
153			compatible = "amlogic,aml8726-rtc";
154			reg = <0xda004340 20>;	/* secbus2 0xd0 */
155			interrupts = <0 72 1>;	/* AM_IRQ2(8) */
156		};
157
158		clkmsr: clkmsr@c1108758 {
159			compatible = "amlogic,aml8726-clkmsr";
160			reg = <0xc1108758 16>;	/* cbus 0x21d6 */
161
162			clocks = <&clk81>;
163		};
164
165		gpioao: gpio@c8100024 {
166			/* gpio unit 7 */
167			compatible = "amlogic,aml8726-gpio";
168			reg = <0xc8100024 4>,	/* oen aobus 0x9 */
169			      <0xc8100024 4>,	/* out */
170			      <0xc8100028 4>;	/* in */
171
172			gpio-controller;
173			#gpio-cells = <1>;
174			pin-count = <12>;
175		};
176
177		gpio5: gpio@c110806c {
178			compatible = "amlogic,aml8726-gpio";
179			reg = <0xc110806c 4>,	/* oen cbus 0x201b */
180			      <0xc1108070 4>,	/* out */
181			      <0xc1108074 4>;	/* in */
182
183			gpio-controller;
184			#gpio-cells = <1>;
185			pin-count = <32>;
186		};
187
188		gpio6: gpio@c1108020 {
189			compatible = "amlogic,aml8726-gpio";
190			reg = <0xc1108020 4>,	/* oen cbus 0x2008 */
191			      <0xc1108024 4>,	/* out */
192			      <0xc1108028 4>;	/* in */
193
194			gpio-controller;
195			#gpio-cells = <1>;
196			pin-count = <29>;
197		};
198
199		mmc@c1108c20 {
200			compatible = "amlogic,aml8726-mmc";
201			reg = <0xc1108c20 32>;	/* cbus 0x2308 */
202			interrupts = <0 28 1>;	/* AM_IRQ0(28) */
203
204			clocks = <&clk81>;
205
206			pinctrl-names = "default";
207			pinctrl-0 = <&pins_sdio_b>;
208
209			mmc-voltages = "3.3";
210
211			mmc-pwr-en = <&gpio5 31 0>;	/* card_8 */
212			ins-detect = <&gpio5 29 0>;	/* card_6 */
213		};
214
215		rng@c1108100 {
216			compatible = "amlogic,aml8726-rng";
217			reg = <0xc1108100 8>;	/* cbus 0x2040 */
218		};
219
220		usb-phy@c1108400 {
221			/* usb-a phy */
222			compatible = "amlogic,aml8726-m6-usb-phy";
223			reg = <0xc1108400 32>;	/* cbus 0x2100 */
224		};
225
226		usb-phy@c1108420 {
227			/* usb-b phy */
228			compatible = "amlogic,aml8726-m6-usb-phy";
229			reg = <0xc1108420 32>;	/* cbus 0x2108 */
230
231			usb-pwr-en = <&gpioao 3 1>,	/* gpioao_3 vbus */
232				     <&gpio6 11 0>;	/* gpioe_11 wifi */
233		};
234
235		usb@c9040000 {
236			/* usb-a */
237			compatible = "synopsys,designware-hs-otg2";
238			reg = <0xc9040000 0x40000>;	/* ahbbus 0x40000*/
239			interrupts = <0 30 4>;		/* AM_IRQ0(30) */
240			#address-cells = <1>;
241			#size-cells = <0>;
242		};
243
244		usb@c90c0000 {
245			/* usb-b */
246			compatible = "synopsys,designware-hs-otg2";
247			reg = <0xc90c0000 0x40000>;	/* ahbbus 0xc0000 */
248			interrupts = <0 31 4>;		/* AM_IRQ0(31) */
249			#address-cells = <1>;
250			#size-cells = <0>;
251
252			dr_mode = "host";
253		};
254
255		eth@c9410000 {
256			/* ethernet */
257			compatible = "snps,dwmac";
258			reg = <0xc9410000 0x2000>;	/* ahbbus 0x410000 */
259			interrupts = <0 8 1>;		/* AM_IRQ0(8) */
260			#address-cells = <1>;
261			#size-cells = <0>;
262
263			eth-phy-rst = <&gpio5 15 0>;	/* gpioy_15 phy-rst */
264		};
265
266		screen: fb@c8006324 {
267			device_type = "display";
268			compatible = "amlogic,aml8726-fb";
269			reg = <0xc8006324 12>,		/* CANVAS */
270			      <0xc1106800 1024>,	/* VIU */
271			      <0xc1107400 1024>;	/* VPP */
272			interrupts = <0 2 1>,		/* AM_IRQ0(2) */
273				     <0 3 1>,		/* AM_IRQ0(3) */
274				     <0 12 1>,		/* AM_IRQ0(12) */
275				     <0 13 1>;		/* AM_IRQ0(13) */
276
277			address = <0x84900000>;	/* match memreserve */
278			width = <720>;
279			height = <480>;
280			depth = <24>;
281			linebytes = <2160>;
282		};
283	};
284
285	leds {
286		compatible = "gpio-leds";
287
288		sys_led {
289			gpios = <&gpioao 2>;	/* gpioao_2 sys_led */
290			label = "sys_led";
291
292			default-state = "on";
293		};
294	};
295
296	chosen {
297		stdin = "uart0";
298		stdout = "uart0";
299	};
300};
301
302&clk81 {
303	clock-frequency = <0>;
304};
305
306&uart_AO {
307	status = "okay";
308	current-speed = <115200>;
309};
310