1/*
2 * Copyright 2015 Jelle de Jong <jelledejong@powercraft.nl>
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 * 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/dts-v1/;
44#include "sun7i-a20.dtsi"
45#include "sunxi-common-regulators.dtsi"
46
47#include <dt-bindings/gpio/gpio.h>
48#include <dt-bindings/interrupt-controller/irq.h>
49#include <dt-bindings/pinctrl/sun4i-a10.h>
50
51/ {
52	model = "Lamobo R1";
53	compatible = "lamobo,lamobo-r1", "allwinner,sun7i-a20";
54
55	aliases {
56		serial0 = &uart0;
57		serial1 = &uart3;
58		serial2 = &uart7;
59	};
60
61	chosen {
62		stdout-path = "serial0:115200n8";
63	};
64
65	leds {
66		compatible = "gpio-leds";
67		pinctrl-names = "default";
68		pinctrl-0 = <&led_pins_lamobo_r1>;
69
70		green {
71			label = "lamobo_r1:green:usr";
72			gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>;
73		};
74	};
75
76	reg_gmac_3v3: gmac-3v3 {
77		compatible = "regulator-fixed";
78		pinctrl-names = "default";
79		pinctrl-0 = <&gmac_power_pin_lamobo_r1>;
80		regulator-name = "gmac-3v3";
81		regulator-min-microvolt = <3300000>;
82		regulator-max-microvolt = <3300000>;
83		startup-delay-us = <100000>;
84		enable-active-high;
85		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
86	};
87};
88
89&ahci_pwr_pin_a {
90	allwinner,pins = "PB3";
91};
92
93&ahci {
94	target-supply = <&reg_ahci_5v>;
95	status = "okay";
96};
97
98&cpu0 {
99	cpu-supply = <&reg_dcdc2>;
100	operating-points = <
101		/* kHz	  uV */
102		960000	1400000
103		912000	1400000
104		864000	1350000
105		720000	1250000
106		528000	1150000
107		312000	1100000
108		144000	1050000
109		>;
110};
111
112&ehci0 {
113	status = "okay";
114};
115
116&ehci1 {
117	status = "okay";
118};
119
120&gmac {
121	pinctrl-names = "default";
122	pinctrl-0 = <&gmac_pins_rgmii_a>;
123	phy = <&phy1>;
124	phy-mode = "rgmii";
125	phy-supply = <&reg_gmac_3v3>;
126	status = "okay";
127
128	phy1: ethernet-phy@1 {
129		reg = <1>;
130	};
131};
132
133&i2c0 {
134	pinctrl-names = "default";
135	pinctrl-0 = <&i2c0_pins_a>;
136	status = "okay";
137
138	axp209: pmic@34 {
139		reg = <0x34>;
140		interrupt-parent = <&nmi_intc>;
141		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
142	};
143};
144
145&i2c2 {
146	pinctrl-names = "default";
147	pinctrl-0 = <&i2c2_pins_a>;
148	status = "okay";
149};
150
151&ir0 {
152	pinctrl-names = "default";
153	pinctrl-0 = <&ir0_rx_pins_a>;
154	status = "okay";
155};
156
157&mmc0 {
158	pinctrl-names = "default";
159	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_lamobo_r1>;
160	vmmc-supply = <&reg_vcc3v3>;
161	bus-width = <4>;
162	cd-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
163	cd-inverted;
164	status = "okay";
165};
166
167&ohci0 {
168	status = "okay";
169};
170
171&ohci1 {
172	status = "okay";
173};
174
175&otg_sram {
176	status = "okay";
177};
178
179&pio {
180	usb0_id_detect_pin: usb0_id_detect_pin@0 {
181		allwinner,pins = "PH4";
182		allwinner,function = "gpio_in";
183		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
184		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
185	};
186
187	mmc0_cd_pin_lamobo_r1: mmc0_cd_pin@0 {
188		allwinner,pins = "PH10";
189		allwinner,function = "gpio_in";
190		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
191		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
192	};
193
194	gmac_power_pin_lamobo_r1: gmac_power_pin@0 {
195		allwinner,pins = "PH23";
196		allwinner,function = "gpio_out";
197		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
198		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
199	};
200
201	led_pins_lamobo_r1: led_pins@0 {
202		allwinner,pins = "PH24";
203		allwinner,function = "gpio_out";
204		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
205		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
206	};
207};
208
209#include "axp209.dtsi"
210
211&reg_ahci_5v {
212	gpio = <&pio 1 3 0>; /* PB3 */
213	status = "okay";
214};
215
216&reg_dcdc2 {
217	regulator-always-on;
218	regulator-min-microvolt = <1000000>;
219	regulator-max-microvolt = <1400000>;
220	regulator-name = "vdd-cpu";
221};
222
223&reg_dcdc3 {
224	regulator-always-on;
225	regulator-min-microvolt = <1000000>;
226	regulator-max-microvolt = <1400000>;
227	regulator-name = "vdd-int-dll";
228};
229
230&reg_ldo1 {
231	regulator-name = "vdd-rtc";
232};
233
234&reg_ldo2 {
235	regulator-always-on;
236	regulator-min-microvolt = <3000000>;
237	regulator-max-microvolt = <3000000>;
238	regulator-name = "avcc";
239};
240
241&reg_usb0_vbus {
242	status = "okay";
243};
244
245&reg_usb1_vbus {
246	status = "okay";
247};
248
249&reg_usb2_vbus {
250	status = "okay";
251};
252
253&spi0 {
254	pinctrl-names = "default";
255	pinctrl-0 = <&spi0_pins_a>,
256		    <&spi0_cs0_pins_a>,
257		    <&spi0_cs1_pins_a>;
258	status = "okay";
259};
260
261&uart0 {
262	pinctrl-names = "default";
263	pinctrl-0 = <&uart0_pins_a>;
264	status = "okay";
265};
266
267&uart3 {
268	pinctrl-names = "default";
269	pinctrl-0 = <&uart3_pins_b>;
270	status = "okay";
271};
272
273&uart7 {
274	pinctrl-names = "default";
275	pinctrl-0 = <&uart7_pins_a>;
276	status = "okay";
277};
278
279&usb_otg {
280	dr_mode = "otg";
281	status = "okay";
282};
283
284&usb_power_supply {
285	status = "okay";
286};
287
288&usbphy {
289	pinctrl-names = "default";
290	pinctrl-0 = <&usb0_id_detect_pin>;
291	usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
292	usb0_vbus_power-supply = <&usb_power_supply>;
293	usb0_vbus-supply = <&reg_usb0_vbus>;
294	usb1_vbus-supply = <&reg_usb1_vbus>;
295	usb2_vbus-supply = <&reg_usb2_vbus>;
296	status = "okay";
297};
298