153ab4af3SHans de Goede/*
253ab4af3SHans de Goede * Copyright 2015 Adam Sampson <ats@offog.org>
353ab4af3SHans de Goede *
453ab4af3SHans de Goede * This file is dual-licensed: you can use it either under the terms
553ab4af3SHans de Goede * of the GPL or the X11 license, at your option. Note that this dual
653ab4af3SHans de Goede * licensing only applies to this file, and not this project as a
753ab4af3SHans de Goede * whole.
853ab4af3SHans de Goede *
953ab4af3SHans de Goede *  a) This file is free software; you can redistribute it and/or
1053ab4af3SHans de Goede *     modify it under the terms of the GNU General Public License as
1153ab4af3SHans de Goede *     published by the Free Software Foundation; either version 2 of the
1253ab4af3SHans de Goede *     License, or (at your option) any later version.
1353ab4af3SHans de Goede *
1453ab4af3SHans de Goede *     This file is distributed in the hope that it will be useful,
1553ab4af3SHans de Goede *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1653ab4af3SHans de Goede *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1753ab4af3SHans de Goede *     GNU General Public License for more details.
1853ab4af3SHans de Goede *
1953ab4af3SHans de Goede * Or, alternatively,
2053ab4af3SHans de Goede *
2153ab4af3SHans de Goede *  b) Permission is hereby granted, free of charge, to any person
2253ab4af3SHans de Goede *     obtaining a copy of this software and associated documentation
2353ab4af3SHans de Goede *     files (the "Software"), to deal in the Software without
2453ab4af3SHans de Goede *     restriction, including without limitation the rights to use,
2553ab4af3SHans de Goede *     copy, modify, merge, publish, distribute, sublicense, and/or
2653ab4af3SHans de Goede *     sell copies of the Software, and to permit persons to whom the
2753ab4af3SHans de Goede *     Software is furnished to do so, subject to the following
2853ab4af3SHans de Goede *     conditions:
2953ab4af3SHans de Goede *
3053ab4af3SHans de Goede *     The above copyright notice and this permission notice shall be
3153ab4af3SHans de Goede *     included in all copies or substantial portions of the Software.
3253ab4af3SHans de Goede *
3353ab4af3SHans de Goede *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3453ab4af3SHans de Goede *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
3553ab4af3SHans de Goede *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3653ab4af3SHans de Goede *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
3753ab4af3SHans de Goede *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
3853ab4af3SHans de Goede *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3953ab4af3SHans de Goede *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4053ab4af3SHans de Goede *     OTHER DEALINGS IN THE SOFTWARE.
4153ab4af3SHans de Goede */
4253ab4af3SHans de Goede
4353ab4af3SHans de Goede/dts-v1/;
4453ab4af3SHans de Goede#include "sun7i-a20.dtsi"
4553ab4af3SHans de Goede#include "sunxi-common-regulators.dtsi"
4653ab4af3SHans de Goede#include <dt-bindings/gpio/gpio.h>
4753ab4af3SHans de Goede#include <dt-bindings/interrupt-controller/arm-gic.h>
4853ab4af3SHans de Goede
4953ab4af3SHans de Goede/ {
5053ab4af3SHans de Goede	model = "LinkSprite pcDuino3 Nano";
5153ab4af3SHans de Goede	compatible = "linksprite,pcduino3-nano", "allwinner,sun7i-a20";
5253ab4af3SHans de Goede
5353ab4af3SHans de Goede	aliases {
5453ab4af3SHans de Goede		serial0 = &uart0;
5553ab4af3SHans de Goede	};
5653ab4af3SHans de Goede
5753ab4af3SHans de Goede	chosen {
5853ab4af3SHans de Goede		stdout-path = "serial0:115200n8";
5953ab4af3SHans de Goede	};
6053ab4af3SHans de Goede
6153ab4af3SHans de Goede	leds {
6253ab4af3SHans de Goede		compatible = "gpio-leds";
6353ab4af3SHans de Goede		pinctrl-names = "default";
6453ab4af3SHans de Goede		pinctrl-0 = <&led_pins_pcduino3_nano>;
6553ab4af3SHans de Goede
6653ab4af3SHans de Goede		/* Marked "LED3" on the PCB. */
6753ab4af3SHans de Goede		usr1 {
6853ab4af3SHans de Goede			label = "pcduino3-nano:green:usr1";
6953ab4af3SHans de Goede			gpios = <&pio 7 16 GPIO_ACTIVE_LOW>; /* PH16 */
7053ab4af3SHans de Goede		};
7153ab4af3SHans de Goede
7253ab4af3SHans de Goede		/* Marked "LED4" on the PCB. */
7353ab4af3SHans de Goede		usr2 {
7453ab4af3SHans de Goede			label = "pcduino3-nano:green:usr2";
7553ab4af3SHans de Goede			gpios = <&pio 7 15 GPIO_ACTIVE_LOW>; /* PH15 */
7653ab4af3SHans de Goede		};
7753ab4af3SHans de Goede	};
7853ab4af3SHans de Goede};
7953ab4af3SHans de Goede
8053ab4af3SHans de Goede&ahci {
8153ab4af3SHans de Goede	target-supply = <&reg_ahci_5v>;
8253ab4af3SHans de Goede	status = "okay";
8353ab4af3SHans de Goede};
8453ab4af3SHans de Goede
85*80e5f83cSHans de Goede&codec {
86*80e5f83cSHans de Goede	status = "okay";
87*80e5f83cSHans de Goede};
88*80e5f83cSHans de Goede
89*80e5f83cSHans de Goede&cpu0 {
90*80e5f83cSHans de Goede	cpu-supply = <&reg_dcdc2>;
91*80e5f83cSHans de Goede};
92*80e5f83cSHans de Goede
9353ab4af3SHans de Goede&ehci0 {
9453ab4af3SHans de Goede	status = "okay";
9553ab4af3SHans de Goede};
9653ab4af3SHans de Goede
9753ab4af3SHans de Goede&ehci1 {
9853ab4af3SHans de Goede	status = "okay";
9953ab4af3SHans de Goede};
10053ab4af3SHans de Goede
10153ab4af3SHans de Goede&gmac {
10253ab4af3SHans de Goede	pinctrl-names = "default";
10353ab4af3SHans de Goede	pinctrl-0 = <&gmac_pins_rgmii_a>;
10453ab4af3SHans de Goede	phy = <&phy1>;
10553ab4af3SHans de Goede	phy-mode = "rgmii";
10653ab4af3SHans de Goede	status = "okay";
10753ab4af3SHans de Goede
10853ab4af3SHans de Goede	phy1: ethernet-phy@1 {
10953ab4af3SHans de Goede		reg = <1>;
11053ab4af3SHans de Goede	};
11153ab4af3SHans de Goede};
11253ab4af3SHans de Goede
11353ab4af3SHans de Goede&i2c0 {
11453ab4af3SHans de Goede	pinctrl-names = "default";
11553ab4af3SHans de Goede	pinctrl-0 = <&i2c0_pins_a>;
11653ab4af3SHans de Goede	status = "okay";
11753ab4af3SHans de Goede
11853ab4af3SHans de Goede	axp209: pmic@34 {
11953ab4af3SHans de Goede		reg = <0x34>;
12053ab4af3SHans de Goede		interrupt-parent = <&nmi_intc>;
12153ab4af3SHans de Goede		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
12253ab4af3SHans de Goede	};
12353ab4af3SHans de Goede};
12453ab4af3SHans de Goede
12553ab4af3SHans de Goede&ir0 {
12653ab4af3SHans de Goede	pinctrl-names = "default";
1278b1ba941SHans de Goede	pinctrl-0 = <&ir0_rx_pins_a>;
12853ab4af3SHans de Goede	status = "okay";
12953ab4af3SHans de Goede};
13053ab4af3SHans de Goede
13153ab4af3SHans de Goede&mmc0 {
13253ab4af3SHans de Goede	pinctrl-names = "default";
13353ab4af3SHans de Goede	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
13453ab4af3SHans de Goede	vmmc-supply = <&reg_vcc3v3>;
13553ab4af3SHans de Goede	bus-width = <4>;
13653ab4af3SHans de Goede	cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
13753ab4af3SHans de Goede	cd-inverted;
13853ab4af3SHans de Goede	status = "okay";
13953ab4af3SHans de Goede};
14053ab4af3SHans de Goede
14153ab4af3SHans de Goede&ohci0 {
14253ab4af3SHans de Goede	status = "okay";
14353ab4af3SHans de Goede};
14453ab4af3SHans de Goede
14553ab4af3SHans de Goede&ohci1 {
14653ab4af3SHans de Goede	status = "okay";
14753ab4af3SHans de Goede};
14853ab4af3SHans de Goede
149*80e5f83cSHans de Goede&otg_sram {
150*80e5f83cSHans de Goede	status = "okay";
151*80e5f83cSHans de Goede};
152*80e5f83cSHans de Goede
15353ab4af3SHans de Goede&pio {
15453ab4af3SHans de Goede	ahci_pwr_pin_pcduino3_nano: ahci_pwr_pin@0 {
15553ab4af3SHans de Goede		allwinner,pins = "PH2";
15653ab4af3SHans de Goede		allwinner,function = "gpio_out";
15753ab4af3SHans de Goede		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
15853ab4af3SHans de Goede		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
15953ab4af3SHans de Goede	};
16053ab4af3SHans de Goede
16153ab4af3SHans de Goede	led_pins_pcduino3_nano: led_pins@0 {
16253ab4af3SHans de Goede		allwinner,pins = "PH16", "PH15";
16353ab4af3SHans de Goede		allwinner,function = "gpio_out";
16453ab4af3SHans de Goede		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
16553ab4af3SHans de Goede		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
16653ab4af3SHans de Goede	};
16753ab4af3SHans de Goede
168*80e5f83cSHans de Goede	usb0_id_detect_pin: usb0_id_detect_pin@0 {
169*80e5f83cSHans de Goede		allwinner,pins = "PH4";
170*80e5f83cSHans de Goede		allwinner,function = "gpio_in";
171*80e5f83cSHans de Goede		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
172*80e5f83cSHans de Goede		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
173*80e5f83cSHans de Goede	};
174*80e5f83cSHans de Goede
17553ab4af3SHans de Goede	usb1_vbus_pin_pcduino3_nano: usb1_vbus_pin@0 {
176*80e5f83cSHans de Goede		allwinner,pins = "PD2";
17753ab4af3SHans de Goede		allwinner,function = "gpio_out";
17853ab4af3SHans de Goede		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
17953ab4af3SHans de Goede		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
18053ab4af3SHans de Goede	};
18153ab4af3SHans de Goede};
18253ab4af3SHans de Goede
18353ab4af3SHans de Goede&reg_ahci_5v {
18453ab4af3SHans de Goede	pinctrl-0 = <&ahci_pwr_pin_pcduino3_nano>;
18553ab4af3SHans de Goede	gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */
18653ab4af3SHans de Goede	status = "okay";
18753ab4af3SHans de Goede};
18853ab4af3SHans de Goede
189*80e5f83cSHans de Goede#include "axp209.dtsi"
190*80e5f83cSHans de Goede
191*80e5f83cSHans de Goede&reg_dcdc2 {
192*80e5f83cSHans de Goede	regulator-always-on;
193*80e5f83cSHans de Goede	regulator-min-microvolt = <1000000>;
194*80e5f83cSHans de Goede	regulator-max-microvolt = <1400000>;
195*80e5f83cSHans de Goede	regulator-name = "vdd-cpu";
19653ab4af3SHans de Goede};
19753ab4af3SHans de Goede
198*80e5f83cSHans de Goede&reg_dcdc3 {
199*80e5f83cSHans de Goede	regulator-always-on;
200*80e5f83cSHans de Goede	regulator-min-microvolt = <1000000>;
201*80e5f83cSHans de Goede	regulator-max-microvolt = <1400000>;
202*80e5f83cSHans de Goede	regulator-name = "vdd-int-pll";
203*80e5f83cSHans de Goede};
204*80e5f83cSHans de Goede
205*80e5f83cSHans de Goede&reg_ldo1 {
206*80e5f83cSHans de Goede	regulator-name = "vdd-rtc";
207*80e5f83cSHans de Goede};
208*80e5f83cSHans de Goede
209*80e5f83cSHans de Goede&reg_ldo2 {
210*80e5f83cSHans de Goede	regulator-always-on;
211*80e5f83cSHans de Goede	regulator-min-microvolt = <3000000>;
212*80e5f83cSHans de Goede	regulator-max-microvolt = <3000000>;
213*80e5f83cSHans de Goede	regulator-name = "avcc";
214*80e5f83cSHans de Goede};
215*80e5f83cSHans de Goede
216*80e5f83cSHans de Goede/* A single regulator (U24) powers both USB host ports. */
217*80e5f83cSHans de Goede&reg_usb1_vbus {
218*80e5f83cSHans de Goede	pinctrl-0 = <&usb1_vbus_pin_pcduino3_nano>;
219*80e5f83cSHans de Goede	gpio = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */
22053ab4af3SHans de Goede	status = "okay";
22153ab4af3SHans de Goede};
22253ab4af3SHans de Goede
22353ab4af3SHans de Goede&uart0 {
22453ab4af3SHans de Goede	pinctrl-names = "default";
22553ab4af3SHans de Goede	pinctrl-0 = <&uart0_pins_a>;
22653ab4af3SHans de Goede	status = "okay";
22753ab4af3SHans de Goede};
22853ab4af3SHans de Goede
229*80e5f83cSHans de Goede&usb_otg {
230*80e5f83cSHans de Goede	dr_mode = "otg";
231*80e5f83cSHans de Goede	status = "okay";
232*80e5f83cSHans de Goede};
233*80e5f83cSHans de Goede
23453ab4af3SHans de Goede&usbphy {
235*80e5f83cSHans de Goede	pinctrl-names = "default";
236*80e5f83cSHans de Goede	pinctrl-0 = <&usb0_id_detect_pin>;
237*80e5f83cSHans de Goede	usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
23853ab4af3SHans de Goede	usb1_vbus-supply = <&reg_usb1_vbus>;
239*80e5f83cSHans de Goede	usb2_vbus-supply = <&reg_usb1_vbus>;
24053ab4af3SHans de Goede	status = "okay";
24153ab4af3SHans de Goede};
242