1/*
2 * Copyright (c) 2016 Andreas Färber
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 library 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 library 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#include "meson-gxbb.dtsi"
44
45/ {
46	compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb";
47
48	aliases {
49		serial0 = &uart_AO;
50		ethernet0 = &ethmac;
51	};
52
53	chosen {
54		stdout-path = "serial0:115200n8";
55	};
56
57	leds {
58		compatible = "gpio-leds";
59
60		blue {
61			label = "vega-s95:blue:on";
62			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
63			default-state = "on";
64			panic-indicator;
65		};
66	};
67
68	usb_vbus: regulator-usb0-vbus {
69		compatible = "regulator-fixed";
70
71		regulator-name = "USB0_VBUS";
72
73		regulator-min-microvolt = <5000000>;
74		regulator-max-microvolt = <5000000>;
75
76		gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
77		enable-active-high;
78	};
79
80	vcc_3v3: regulator-vcc_3v3 {
81		compatible = "regulator-fixed";
82		regulator-name = "VCC_3V3";
83		regulator-min-microvolt = <3300000>;
84		regulator-max-microvolt = <3300000>;
85	};
86
87	vcc_1v8: regulator-vcc_1v8 {
88		compatible = "regulator-fixed";
89		regulator-name = "VCC_1V8";
90		regulator-min-microvolt = <1800000>;
91		regulator-max-microvolt = <1800000>;
92	};
93
94	emmc_pwrseq: emmc-pwrseq {
95		compatible = "mmc-pwrseq-emmc";
96		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
97	};
98
99	wifi32k: wifi32k {
100		compatible = "pwm-clock";
101		#clock-cells = <0>;
102		clock-frequency = <32768>;
103		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
104	};
105
106	sdio_pwrseq: sdio-pwrseq {
107		compatible = "mmc-pwrseq-simple";
108		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>,
109				<&gpio GPIOX_20 GPIO_ACTIVE_LOW>;
110		clocks = <&wifi32k>;
111		clock-names = "ext_clock";
112	};
113};
114
115&ethmac {
116	status = "okay";
117	pinctrl-0 = <&eth_rgmii_pins>;
118	pinctrl-names = "default";
119
120	phy-handle = <&eth_phy0>;
121	phy-mode = "rgmii";
122
123	amlogic,tx-delay-ns = <2>;
124
125	snps,reset-gpio = <&gpio GPIOZ_14 0>;
126	snps,reset-delays-us = <0 10000 1000000>;
127	snps,reset-active-low;
128
129	mdio {
130		compatible = "snps,dwmac-mdio";
131		#address-cells = <1>;
132		#size-cells = <0>;
133
134		eth_phy0: ethernet-phy@0 {
135			/* Realtek RTL8211F (0x001cc916) */
136			reg = <0>;
137		};
138	};
139};
140
141&ir {
142	status = "okay";
143	pinctrl-0 = <&remote_input_ao_pins>;
144	pinctrl-names = "default";
145};
146
147&pwm_ef {
148	status = "okay";
149	pinctrl-0 = <&pwm_e_pins>;
150	pinctrl-names = "default";
151	clocks = <&clkc CLKID_FCLK_DIV4>;
152	clock-names = "clkin0";
153};
154
155/* Wireless SDIO Module */
156&sd_emmc_a {
157	status = "okay";
158	pinctrl-0 = <&sdio_pins &sdio_irq_pins>;
159	pinctrl-1 = <&sdio_clk_gate_pins>;
160	pinctrl-names = "default", "clk-gate";
161	#address-cells = <1>;
162	#size-cells = <0>;
163
164	bus-width = <4>;
165	cap-sd-highspeed;
166	max-frequency = <100000000>;
167
168	non-removable;
169	disable-wp;
170
171	mmc-pwrseq = <&sdio_pwrseq>;
172
173	vmmc-supply = <&vcc_3v3>;
174	vqmmc-supply = <&vcc_1v8>;
175
176	brcmf: wifi@1 {
177		reg = <1>;
178		compatible = "brcm,bcm4329-fmac";
179	};
180};
181
182/* SD card */
183&sd_emmc_b {
184	status = "okay";
185	pinctrl-0 = <&sdcard_pins>;
186	pinctrl-1 = <&sdcard_clk_gate_pins>;
187	pinctrl-names = "default", "clk-gate";
188
189	bus-width = <4>;
190	cap-sd-highspeed;
191	max-frequency = <100000000>;
192	disable-wp;
193
194	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
195	cd-inverted;
196
197	vmmc-supply = <&vcc_3v3>;
198};
199
200/* eMMC */
201&sd_emmc_c {
202	status = "okay";
203	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
204	pinctrl-1 = <&emmc_clk_gate_pins>;
205	pinctrl-names = "default", "clk-gate";
206
207	bus-width = <8>;
208	cap-mmc-highspeed;
209	max-frequency = <200000000>;
210	non-removable;
211	disable-wp;
212	mmc-ddr-1_8v;
213	mmc-hs200-1_8v;
214
215	mmc-pwrseq = <&emmc_pwrseq>;
216	vmmc-supply = <&vcc_3v3>;
217	vmmcq-sumpply = <&vcc_1v8>;
218};
219
220&uart_AO {
221	status = "okay";
222	pinctrl-0 = <&uart_ao_a_pins>;
223	pinctrl-names = "default";
224};
225
226&usb0_phy {
227	status = "okay";
228	phy-supply = <&usb_vbus>;
229};
230
231&usb1_phy {
232	status = "okay";
233};
234
235&usb0 {
236	status = "okay";
237};
238
239&usb1 {
240	status = "okay";
241};
242