1/*
2 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
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 file 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 file 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 *     You should have received a copy of the GNU General Public
20 *     License along with this file; if not, write to the Free
21 *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 *     MA 02110-1301 USA
23 *
24 * Or, alternatively,
25 *
26 *  b) Permission is hereby granted, free of charge, to any person
27 *     obtaining a copy of this software and associated documentation
28 *     files (the "Software"), to deal in the Software without
29 *     restriction, including without limitation the rights to use,
30 *     copy, modify, merge, publish, distribute, sublicense, and/or
31 *     sell copies of the Software, and to permit persons to whom the
32 *     Software is furnished to do so, subject to the following
33 *     conditions:
34 *
35 *     The above copyright notice and this permission notice shall be
36 *     included in all copies or substantial portions of the Software.
37 *
38 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
40 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
42 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 *     OTHER DEALINGS IN THE SOFTWARE.
46 */
47
48/dts-v1/;
49#include "sun7i-a20.dtsi"
50#include "sunxi-common-regulators.dtsi"
51
52#include <dt-bindings/gpio/gpio.h>
53#include <dt-bindings/interrupt-controller/irq.h>
54#include <dt-bindings/pinctrl/sun4i-a10.h>
55
56/ {
57	model = "I12 / Q5 / QT840A A20 tvbox";
58	compatible = "allwinner,i12-tvbox", "allwinner,sun7i-a20";
59
60	aliases {
61		serial0 = &uart0;
62	};
63
64	chosen {
65		stdout-path = "serial0:115200n8";
66	};
67
68	leds {
69		compatible = "gpio-leds";
70		pinctrl-names = "default";
71		pinctrl-0 = <&led_pins_i12_tvbox>;
72
73		red {
74			label = "i12_tvbox:red:usr";
75			gpios = <&pio 7 9 GPIO_ACTIVE_LOW>;
76		};
77
78		blue {
79			label = "i12_tvbox:blue:usr";
80			gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
81		};
82	};
83
84	reg_vmmc3: vmmc3 {
85		compatible = "regulator-fixed";
86		pinctrl-names = "default";
87		pinctrl-0 = <&vmmc3_pin_i12_tvbox>;
88		regulator-name = "vmmc3";
89		regulator-min-microvolt = <3300000>;
90		regulator-max-microvolt = <3300000>;
91		enable-active-high;
92		gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>;
93	};
94
95	reg_vmmc3_io: vmmc3-io {
96		compatible = "regulator-fixed";
97		pinctrl-names = "default";
98		pinctrl-0 = <&vmmc3_io_pin_i12_tvbox>;
99		regulator-name = "vmmc3-io";
100		regulator-min-microvolt = <3300000>;
101		regulator-max-microvolt = <3300000>;
102		/* This controls VCC-PI, must be always on! */
103		regulator-always-on;
104		enable-active-high;
105		gpio = <&pio 7 12 GPIO_ACTIVE_HIGH>;
106	};
107
108	reg_gmac_3v3: gmac-3v3 {
109		compatible = "regulator-fixed";
110		pinctrl-names = "default";
111		pinctrl-0 = <&gmac_power_pin_i12_tvbox>;
112		regulator-name = "gmac-3v3";
113		regulator-min-microvolt = <3300000>;
114		regulator-max-microvolt = <3300000>;
115		startup-delay-us = <50000>;
116		enable-active-high;
117		gpio = <&pio 7 21 GPIO_ACTIVE_HIGH>;
118	};
119};
120
121&ehci0 {
122	status = "okay";
123};
124
125&ehci1 {
126	status = "okay";
127};
128
129&gmac {
130	pinctrl-names = "default";
131	pinctrl-0 = <&gmac_pins_mii_a>;
132	phy = <&phy1>;
133	phy-mode = "mii";
134	phy-supply = <&reg_gmac_3v3>;
135	status = "okay";
136
137	phy1: ethernet-phy@1 {
138		reg = <1>;
139	};
140};
141
142&i2c0 {
143	pinctrl-names = "default";
144	pinctrl-0 = <&i2c0_pins_a>;
145	status = "okay";
146
147	axp209: pmic@34 {
148		compatible = "x-powers,axp209";
149		reg = <0x34>;
150		interrupt-parent = <&nmi_intc>;
151		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
152
153		interrupt-controller;
154		#interrupt-cells = <1>;
155	};
156};
157
158&ir0 {
159	pinctrl-names = "default";
160	pinctrl-0 = <&ir0_pins_a>;
161	status = "okay";
162};
163
164&mmc0 {
165	pinctrl-names = "default";
166	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
167	vmmc-supply = <&reg_vcc3v3>;
168	bus-width = <4>;
169	cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
170	cd-inverted;
171	status = "okay";
172};
173
174&mmc3 {
175	pinctrl-names = "default";
176	pinctrl-0 = <&mmc3_pins_a>;
177	vmmc-supply = <&reg_vmmc3>;
178	bus-width = <4>;
179	non-removable;
180	status = "okay";
181
182	brcmf: bcrmf@1 {
183		reg = <1>;
184		compatible = "brcm,bcm4329-fmac";
185		interrupt-parent = <&pio>;
186		interrupts = <10 IRQ_TYPE_LEVEL_LOW>; /* PH10 / EINT10 */
187		interrupt-names = "host-wake";
188	};
189};
190
191&mmc3_pins_a {
192	/* AP6210 / AP6330 requires pull-up */
193	allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
194};
195
196&ohci0 {
197	status = "okay";
198};
199
200&ohci1 {
201	status = "okay";
202};
203
204&pio {
205	vmmc3_pin_i12_tvbox: vmmc3_pin@0 {
206		allwinner,pins = "PH2";
207		allwinner,function = "gpio_out";
208		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
209		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
210	};
211
212	vmmc3_io_pin_i12_tvbox: vmmc3_io_pin@0 {
213		allwinner,pins = "PH12";
214		allwinner,function = "gpio_out";
215		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
216		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
217	};
218
219	gmac_power_pin_i12_tvbox: gmac_power_pin@0 {
220		allwinner,pins = "PH21";
221		allwinner,function = "gpio_out";
222		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
223		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
224	};
225
226	led_pins_i12_tvbox: led_pins@0 {
227		allwinner,pins = "PH9", "PH20";
228		allwinner,function = "gpio_out";
229		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
230		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
231	};
232};
233
234&reg_usb1_vbus {
235	status = "okay";
236};
237
238&reg_usb2_vbus {
239	status = "okay";
240};
241
242&uart0 {
243	pinctrl-names = "default";
244	pinctrl-0 = <&uart0_pins_a>;
245	status = "okay";
246};
247
248&usbphy {
249	usb1_vbus-supply = <&reg_usb1_vbus>;
250	usb2_vbus-supply = <&reg_usb2_vbus>;
251	status = "okay";
252};
253