1/*
2 * Copyright 2015 Chen-Yu Tsai
3 *
4 * Chen-Yu Tsai <wens@csie.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 file 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 file 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#include "sun8i-a33.dtsi"
47#include "sunxi-common-regulators.dtsi"
48
49#include <dt-bindings/gpio/gpio.h>
50#include <dt-bindings/input/input.h>
51#include <dt-bindings/pinctrl/sun4i-a10.h>
52
53/ {
54	model = "Sinlinx SinA33";
55	compatible = "sinlinx,sina33", "allwinner,sun8i-a33";
56
57	aliases {
58		serial0 = &uart0;
59	};
60
61	chosen {
62		stdout-path = "serial0:115200n8";
63	};
64
65	panel {
66		compatible = "netron-dy,e231732";
67		#address-cells = <1>;
68		#size-cells = <0>;
69
70		port@0 {
71			reg = <0>;
72			#address-cells = <1>;
73			#size-cells = <0>;
74
75			panel_input: endpoint@0 {
76				reg = <0>;
77				remote-endpoint = <&tcon0_out_panel>;
78			};
79		};
80	};
81};
82
83&de {
84	status = "okay";
85};
86
87&cpu0 {
88	cpu-supply = <&reg_dcdc3>;
89};
90
91&ehci0 {
92	status = "okay";
93};
94
95&lradc {
96	vref-supply = <&reg_dcdc1>;
97	status = "okay";
98
99	button@200 {
100		label = "Volume Up";
101		linux,code = <KEY_VOLUMEUP>;
102		channel = <0>;
103		voltage = <191011>;
104	};
105
106	button@400 {
107		label = "Volume Down";
108		linux,code = <KEY_VOLUMEDOWN>;
109		channel = <0>;
110		voltage = <391304>;
111	};
112
113	button@600 {
114		label = "Home";
115		linux,code = <KEY_HOME>;
116		channel = <0>;
117		voltage = <600000>;
118	};
119};
120
121&mmc0 {
122	pinctrl-names = "default";
123	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_sina33>;
124	vmmc-supply = <&reg_dcdc1>;
125	bus-width = <4>;
126	cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
127	cd-inverted;
128	status = "okay";
129};
130
131&mmc2 {
132	pinctrl-names = "default";
133	pinctrl-0 = <&mmc2_8bit_pins>;
134	vmmc-supply = <&reg_dcdc1>;
135	bus-width = <8>;
136	non-removable;
137	cap-mmc-hw-reset;
138	status = "okay";
139};
140
141&mmc2_8bit_pins {
142	/* Increase drive strength for DDR modes */
143	allwinner,drive = <SUN4I_PINCTRL_40_MA>;
144	/* eMMC is missing pull-ups */
145	allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
146};
147
148&ohci0 {
149	status = "okay";
150};
151
152&pio {
153	mmc0_cd_pin_sina33: mmc0_cd_pin@0 {
154		allwinner,pins = "PB4";
155		allwinner,function = "gpio_in";
156		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
157		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
158	};
159};
160
161&r_rsb {
162	status = "okay";
163
164	axp22x: pmic@3a3 {
165		compatible = "x-powers,axp223";
166		reg = <0x3a3>;
167		interrupt-parent = <&nmi_intc>;
168		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
169		eldoin-supply = <&reg_dcdc1>;
170	};
171};
172
173#include "axp22x.dtsi"
174
175&reg_aldo1 {
176	regulator-always-on;
177	regulator-min-microvolt = <3000000>;
178	regulator-max-microvolt = <3000000>;
179	regulator-name = "vcc-io";
180};
181
182&reg_aldo2 {
183	regulator-always-on;
184	regulator-min-microvolt = <2350000>;
185	regulator-max-microvolt = <2650000>;
186	regulator-name = "vdd-dll";
187};
188
189&reg_aldo3 {
190	regulator-always-on;
191	regulator-min-microvolt = <2700000>;
192	regulator-max-microvolt = <3300000>;
193	regulator-name = "vcc-pll-avcc";
194};
195
196&reg_dc5ldo {
197	regulator-always-on;
198	regulator-min-microvolt = <900000>;
199	regulator-max-microvolt = <1400000>;
200	regulator-name = "vdd-cpus";
201};
202
203&reg_dcdc1 {
204	regulator-always-on;
205	regulator-min-microvolt = <3000000>;
206	regulator-max-microvolt = <3000000>;
207	regulator-name = "vcc-3v0";
208};
209
210&reg_dcdc2 {
211	regulator-always-on;
212	regulator-min-microvolt = <900000>;
213	regulator-max-microvolt = <1400000>;
214	regulator-name = "vdd-sys";
215};
216
217&reg_dcdc3 {
218	regulator-always-on;
219	regulator-min-microvolt = <900000>;
220	regulator-max-microvolt = <1400000>;
221	regulator-name = "vdd-cpu";
222};
223
224&reg_dcdc5 {
225	regulator-always-on;
226	regulator-min-microvolt = <1500000>;
227	regulator-max-microvolt = <1500000>;
228	regulator-name = "vcc-dram";
229};
230
231&reg_rtc_ldo {
232	regulator-name = "vcc-rtc";
233};
234
235&tcon0 {
236	pinctrl-names = "default";
237	pinctrl-0 = <&lcd_rgb666_pins>;
238	status = "okay";
239};
240
241&tcon0_out {
242	tcon0_out_panel: endpoint@0 {
243		reg = <0>;
244		remote-endpoint = <&panel_input>;
245	};
246};
247
248&uart0 {
249	pinctrl-names = "default";
250	pinctrl-0 = <&uart0_pins_b>;
251	status = "okay";
252};
253
254&usb_otg {
255	dr_mode = "peripheral";
256	status = "okay";
257};
258
259&usbphy {
260	status = "okay";
261	usb1_vbus-supply = <&reg_vcc5v0>; /* USB1 VBUS is always on */
262};
263