1/*
2 * Copyright (c) 2016 Andreas Färber
3 * Copyright (c) 2016 BayLibre, Inc.
4 * Author: Neil Armstrong <narmstrong@kernel.org>
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This library is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This library is distributed in the hope that it will be useful,
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 * Or, alternatively,
22 *
23 *  b) Permission is hereby granted, free of charge, to any person
24 *     obtaining a copy of this software and associated documentation
25 *     files (the "Software"), to deal in the Software without
26 *     restriction, including without limitation the rights to use,
27 *     copy, modify, merge, publish, distribute, sublicense, and/or
28 *     sell copies of the Software, and to permit persons to whom the
29 *     Software is furnished to do so, subject to the following
30 *     conditions:
31 *
32 *     The above copyright notice and this permission notice shall be
33 *     included in all copies or substantial portions of the Software.
34 *
35 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
40 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42 *     OTHER DEALINGS IN THE SOFTWARE.
43 */
44
45/dts-v1/;
46
47#include "meson-gxbb.dtsi"
48#include <dt-bindings/gpio/gpio.h>
49#include <dt-bindings/input/input.h>
50
51/ {
52	compatible = "nexbox,a95x", "amlogic,meson-gxbb";
53	model = "NEXBOX A95X";
54
55	aliases {
56		serial0 = &uart_AO;
57		ethernet0 = &ethmac;
58	};
59
60	chosen {
61		stdout-path = "serial0:115200n8";
62	};
63
64	memory@0 {
65		device_type = "memory";
66		reg = <0x0 0x0 0x0 0x40000000>;
67	};
68
69	leds {
70		compatible = "gpio-leds";
71		blue {
72			label = "a95x:system-status";
73			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
74			linux,default-trigger = "heartbeat";
75			default-state = "off";
76		};
77	};
78
79	gpio-keys-polled {
80		compatible = "gpio-keys-polled";
81		#address-cells = <1>;
82		#size-cells = <0>;
83		poll-interval = <100>;
84
85		button@0 {
86			label = "reset";
87			linux,code = <KEY_RESTART>;
88			gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
89		};
90	};
91
92	usb_pwr: regulator-usb-pwrs {
93		compatible = "regulator-fixed";
94
95		regulator-name = "USB_PWR";
96
97		regulator-min-microvolt = <5000000>;
98		regulator-max-microvolt = <5000000>;
99
100		gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
101		enable-active-high;
102	};
103
104	vddio_card: gpio-regulator {
105		compatible = "regulator-gpio";
106
107		regulator-name = "VDDIO_CARD";
108		regulator-min-microvolt = <1800000>;
109		regulator-max-microvolt = <3300000>;
110
111		gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
112		gpios-states = <1>;
113
114		/* Based on P200 schematics, signal CARD_1.8V/3.3V_CTR */
115		states = <1800000 0
116			  3300000 1>;
117	};
118
119	vddio_boot: regulator-vddio_boot {
120		compatible = "regulator-fixed";
121		regulator-name = "VDDIO_BOOT";
122		regulator-min-microvolt = <1800000>;
123		regulator-max-microvolt = <1800000>;
124	};
125
126	vddao_3v3: regulator-vddao_3v3 {
127		compatible = "regulator-fixed";
128		regulator-name = "VDDAO_3V3";
129		regulator-min-microvolt = <3300000>;
130		regulator-max-microvolt = <3300000>;
131	};
132
133	vcc_3v3: regulator-vcc_3v3 {
134		compatible = "regulator-fixed";
135		regulator-name = "VCC_3V3";
136		regulator-min-microvolt = <3300000>;
137		regulator-max-microvolt = <3300000>;
138	};
139
140	emmc_pwrseq: emmc-pwrseq {
141		compatible = "mmc-pwrseq-emmc";
142		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
143	};
144
145	wifi32k: wifi32k {
146		compatible = "pwm-clock";
147		#clock-cells = <0>;
148		clock-frequency = <32768>;
149		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
150	};
151
152	sdio_pwrseq: sdio-pwrseq {
153		compatible = "mmc-pwrseq-simple";
154		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
155		clocks = <&wifi32k>;
156		clock-names = "ext_clock";
157	};
158
159	cvbs-connector {
160		compatible = "composite-video-connector";
161
162		port {
163			cvbs_connector_in: endpoint {
164				remote-endpoint = <&cvbs_vdac_out>;
165			};
166		};
167	};
168
169	hdmi-connector {
170		compatible = "hdmi-connector";
171		type = "a";
172
173		port {
174			hdmi_connector_in: endpoint {
175				remote-endpoint = <&hdmi_tx_tmds_out>;
176			};
177		};
178	};
179};
180
181&cvbs_vdac_port {
182	cvbs_vdac_out: endpoint {
183		remote-endpoint = <&cvbs_connector_in>;
184	};
185};
186
187&cec_AO {
188	status = "okay";
189	pinctrl-0 = <&ao_cec_pins>;
190	pinctrl-names = "default";
191	hdmi-phandle = <&hdmi_tx>;
192};
193
194&ethmac {
195	status = "okay";
196	pinctrl-0 = <&eth_rmii_pins>;
197	pinctrl-names = "default";
198
199	phy-handle = <&eth_phy0>;
200	phy-mode = "rmii";
201
202	snps,reset-gpio = <&gpio GPIOZ_14 0>;
203	snps,reset-delays-us = <0 10000 1000000>;
204	snps,reset-active-low;
205
206	mdio {
207		compatible = "snps,dwmac-mdio";
208		#address-cells = <1>;
209		#size-cells = <0>;
210
211		eth_phy0: ethernet-phy@0 {
212			/* IC Plus IP101GR (0x02430c54) */
213			reg = <0>;
214		};
215	};
216};
217
218&hdmi_tx {
219	status = "okay";
220	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
221	pinctrl-names = "default";
222};
223
224&hdmi_tx_tmds_port {
225	hdmi_tx_tmds_out: endpoint {
226		remote-endpoint = <&hdmi_connector_in>;
227	};
228};
229
230&ir {
231	status = "okay";
232	pinctrl-0 = <&remote_input_ao_pins>;
233	pinctrl-names = "default";
234};
235
236&pwm_ef {
237	status = "okay";
238	pinctrl-0 = <&pwm_e_pins>;
239	pinctrl-names = "default";
240	clocks = <&clkc CLKID_FCLK_DIV4>;
241	clock-names = "clkin0";
242};
243
244/* Wireless SDIO Module */
245&sd_emmc_a {
246	status = "okay";
247	pinctrl-0 = <&sdio_pins>;
248	pinctrl-1 = <&sdio_clk_gate_pins>;
249	pinctrl-names = "default", "clk-gate";
250	#address-cells = <1>;
251	#size-cells = <0>;
252
253	bus-width = <4>;
254	cap-sd-highspeed;
255	max-frequency = <100000000>;
256
257	non-removable;
258	disable-wp;
259
260	mmc-pwrseq = <&sdio_pwrseq>;
261
262	vmmc-supply = <&vddao_3v3>;
263	vqmmc-supply = <&vddio_boot>;
264};
265
266/* SD card */
267&sd_emmc_b {
268	status = "okay";
269	pinctrl-0 = <&sdcard_pins>;
270	pinctrl-1 = <&sdcard_clk_gate_pins>;
271	pinctrl-names = "default", "clk-gate";
272
273	bus-width = <4>;
274	cap-sd-highspeed;
275	max-frequency = <100000000>;
276	disable-wp;
277
278	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
279	cd-inverted;
280
281	vmmc-supply = <&vddao_3v3>;
282	vqmmc-supply = <&vddio_card>;
283};
284
285/* eMMC */
286&sd_emmc_c {
287	status = "okay";
288	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
289	pinctrl-1 = <&emmc_clk_gate_pins>;
290	pinctrl-names = "default", "clk-gate";
291
292	bus-width = <8>;
293	cap-mmc-highspeed;
294	max-frequency = <200000000>;
295	non-removable;
296	disable-wp;
297	mmc-ddr-1_8v;
298	mmc-hs200-1_8v;
299
300	mmc-pwrseq = <&emmc_pwrseq>;
301	vmmc-supply = <&vcc_3v3>;
302	vqmmc-supply = <&vddio_boot>;
303};
304
305&uart_AO {
306	status = "okay";
307	pinctrl-0 = <&uart_ao_a_pins>;
308	pinctrl-names = "default";
309};
310
311&usb0_phy {
312	status = "okay";
313	phy-supply = <&usb_pwr>;
314};
315
316&usb1_phy {
317	status = "okay";
318};
319
320&usb0 {
321	status = "okay";
322};
323
324&usb1 {
325	status = "okay";
326};
327