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	soc@01c00000 {
61		mmc0: mmc@01c0f000 {
62			pinctrl-names = "default";
63			pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
64			vmmc-supply = <&reg_vcc3v3>;
65			bus-width = <4>;
66			cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
67			cd-inverted;
68			status = "okay";
69		};
70
71		mmc3: mmc@01c12000 {
72			pinctrl-names = "default";
73			pinctrl-0 = <&mmc3_pins_a>;
74			vmmc-supply = <&reg_vmmc3>;
75			bus-width = <4>;
76			non-removable;
77			status = "okay";
78		};
79
80		usbphy: phy@01c13400 {
81			usb1_vbus-supply = <&reg_usb1_vbus>;
82			usb2_vbus-supply = <&reg_usb2_vbus>;
83			status = "okay";
84		};
85
86		ehci0: usb@01c14000 {
87			status = "okay";
88		};
89
90		ohci0: usb@01c14400 {
91			status = "okay";
92		};
93
94		ehci1: usb@01c1c000 {
95			status = "okay";
96		};
97
98		ohci1: usb@01c1c400 {
99			status = "okay";
100		};
101
102		pinctrl@01c20800 {
103			mmc3_pins_a: mmc3@0 {
104				/* AP6210 / AP6330 requires pull-up */
105				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
106			};
107
108			vmmc3_pin_i12_tvbox: vmmc3_pin@0 {
109				allwinner,pins = "PH2";
110				allwinner,function = "gpio_out";
111				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
112				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
113			};
114
115			vmmc3_io_pin_i12_tvbox: vmmc3_io_pin@0 {
116				allwinner,pins = "PH12";
117				allwinner,function = "gpio_out";
118				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
119				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
120			};
121
122			gmac_power_pin_i12_tvbox: gmac_power_pin@0 {
123				allwinner,pins = "PH21";
124				allwinner,function = "gpio_out";
125				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
126				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
127			};
128
129			led_pins_i12_tvbox: led_pins@0 {
130				allwinner,pins = "PH9", "PH20";
131				allwinner,function = "gpio_out";
132				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
133				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
134			};
135		};
136
137		ir0: ir@01c21800 {
138			pinctrl-names = "default";
139			pinctrl-0 = <&ir0_pins_a>;
140			status = "okay";
141		};
142
143		uart0: serial@01c28000 {
144			pinctrl-names = "default";
145			pinctrl-0 = <&uart0_pins_a>;
146			status = "okay";
147		};
148
149		i2c0: i2c@01c2ac00 {
150			pinctrl-names = "default";
151			pinctrl-0 = <&i2c0_pins_a>;
152			status = "okay";
153
154			axp209: pmic@34 {
155				compatible = "x-powers,axp209";
156				reg = <0x34>;
157				interrupt-parent = <&nmi_intc>;
158				interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
159
160				interrupt-controller;
161				#interrupt-cells = <1>;
162			};
163		};
164
165		gmac: ethernet@01c50000 {
166			pinctrl-names = "default";
167			pinctrl-0 = <&gmac_pins_mii_a>;
168			phy = <&phy1>;
169			phy-mode = "mii";
170			phy-supply = <&reg_gmac_3v3>;
171			status = "okay";
172
173			phy1: ethernet-phy@1 {
174				reg = <1>;
175			};
176		};
177	};
178
179	leds {
180		compatible = "gpio-leds";
181		pinctrl-names = "default";
182		pinctrl-0 = <&led_pins_i12_tvbox>;
183
184		red {
185			label = "i12_tvbox:red:usr";
186			gpios = <&pio 7 9 GPIO_ACTIVE_LOW>;
187		};
188
189		blue {
190			label = "i12_tvbox:blue:usr";
191			gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
192		};
193	};
194
195	reg_usb1_vbus: usb1-vbus {
196		status = "okay";
197	};
198
199	reg_usb2_vbus: usb2-vbus {
200		status = "okay";
201	};
202
203	reg_vmmc3: vmmc3 {
204		compatible = "regulator-fixed";
205		pinctrl-names = "default";
206		pinctrl-0 = <&vmmc3_pin_i12_tvbox>;
207		regulator-name = "vmmc3";
208		regulator-min-microvolt = <3300000>;
209		regulator-max-microvolt = <3300000>;
210		enable-active-high;
211		gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>;
212	};
213
214	reg_vmmc3_io: vmmc3-io {
215		compatible = "regulator-fixed";
216		pinctrl-names = "default";
217		pinctrl-0 = <&vmmc3_io_pin_i12_tvbox>;
218		regulator-name = "vmmc3-io";
219		regulator-min-microvolt = <3300000>;
220		regulator-max-microvolt = <3300000>;
221		/* This controls VCC-PI, must be always on! */
222		regulator-always-on;
223		enable-active-high;
224		gpio = <&pio 7 12 GPIO_ACTIVE_HIGH>;
225	};
226
227	reg_gmac_3v3: gmac-3v3 {
228		compatible = "regulator-fixed";
229		pinctrl-names = "default";
230		pinctrl-0 = <&gmac_power_pin_i12_tvbox>;
231		regulator-name = "gmac-3v3";
232		regulator-min-microvolt = <3300000>;
233		regulator-max-microvolt = <3300000>;
234		startup-delay-us = <50000>;
235		enable-active-high;
236		gpio = <&pio 7 21 GPIO_ACTIVE_HIGH>;
237	};
238};
239