1d6d1291dSIcenowy Zheng/*
2d6d1291dSIcenowy Zheng * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
3d6d1291dSIcenowy Zheng *
4d6d1291dSIcenowy Zheng * This file is dual-licensed: you can use it either under the terms
5d6d1291dSIcenowy Zheng * of the GPL or the X11 license, at your option. Note that this dual
6d6d1291dSIcenowy Zheng * licensing only applies to this file, and not this project as a
7d6d1291dSIcenowy Zheng * whole.
8d6d1291dSIcenowy Zheng *
9d6d1291dSIcenowy Zheng *  a) This file is free software; you can redistribute it and/or
10d6d1291dSIcenowy Zheng *     modify it under the terms of the GNU General Public License as
11d6d1291dSIcenowy Zheng *     published by the Free Software Foundation; either version 2 of the
12d6d1291dSIcenowy Zheng *     License, or (at your option) any later version.
13d6d1291dSIcenowy Zheng *
14d6d1291dSIcenowy Zheng *     This file is distributed in the hope that it will be useful,
15d6d1291dSIcenowy Zheng *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16d6d1291dSIcenowy Zheng *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17d6d1291dSIcenowy Zheng *     GNU General Public License for more details.
18d6d1291dSIcenowy Zheng *
19d6d1291dSIcenowy Zheng * Or, alternatively,
20d6d1291dSIcenowy Zheng *
21d6d1291dSIcenowy Zheng *  b) Permission is hereby granted, free of charge, to any person
22d6d1291dSIcenowy Zheng *     obtaining a copy of this software and associated documentation
23d6d1291dSIcenowy Zheng *     files (the "Software"), to deal in the Software without
24d6d1291dSIcenowy Zheng *     restriction, including without limitation the rights to use,
25d6d1291dSIcenowy Zheng *     copy, modify, merge, publish, distribute, sublicense, and/or
26d6d1291dSIcenowy Zheng *     sell copies of the Software, and to permit persons to whom the
27d6d1291dSIcenowy Zheng *     Software is furnished to do so, subject to the following
28d6d1291dSIcenowy Zheng *     conditions:
29d6d1291dSIcenowy Zheng *
30d6d1291dSIcenowy Zheng *     The above copyright notice and this permission notice shall be
31d6d1291dSIcenowy Zheng *     included in all copies or substantial portions of the Software.
32d6d1291dSIcenowy Zheng *
33d6d1291dSIcenowy Zheng *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34d6d1291dSIcenowy Zheng *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35d6d1291dSIcenowy Zheng *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36d6d1291dSIcenowy Zheng *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37d6d1291dSIcenowy Zheng *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38d6d1291dSIcenowy Zheng *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39d6d1291dSIcenowy Zheng *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40d6d1291dSIcenowy Zheng *     OTHER DEALINGS IN THE SOFTWARE.
41d6d1291dSIcenowy Zheng */
42d6d1291dSIcenowy Zheng
43d6d1291dSIcenowy Zheng/dts-v1/;
44d6d1291dSIcenowy Zheng#include "sun50i-h5.dtsi"
45d6d1291dSIcenowy Zheng
46d6d1291dSIcenowy Zheng#include <dt-bindings/gpio/gpio.h>
47d6d1291dSIcenowy Zheng
48d6d1291dSIcenowy Zheng/ {
49d6d1291dSIcenowy Zheng	model = "FriendlyARM NanoPi NEO 2";
50d6d1291dSIcenowy Zheng	compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5";
51d6d1291dSIcenowy Zheng
52d6d1291dSIcenowy Zheng	aliases {
5363b95687SIcenowy Zheng		ethernet0 = &emac;
54d6d1291dSIcenowy Zheng		serial0 = &uart0;
55d6d1291dSIcenowy Zheng	};
56d6d1291dSIcenowy Zheng
57d6d1291dSIcenowy Zheng	chosen {
58d6d1291dSIcenowy Zheng		stdout-path = "serial0:115200n8";
59d6d1291dSIcenowy Zheng	};
60d6d1291dSIcenowy Zheng
61d6d1291dSIcenowy Zheng	leds {
62d6d1291dSIcenowy Zheng		compatible = "gpio-leds";
63d6d1291dSIcenowy Zheng
64d6d1291dSIcenowy Zheng		pwr {
65d6d1291dSIcenowy Zheng			label = "nanopi:green:pwr";
66d6d1291dSIcenowy Zheng			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
67d6d1291dSIcenowy Zheng			default-state = "on";
68d6d1291dSIcenowy Zheng		};
69d6d1291dSIcenowy Zheng
70d6d1291dSIcenowy Zheng		status {
71d6d1291dSIcenowy Zheng			label = "nanopi:blue:status";
72d6d1291dSIcenowy Zheng			gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
73d6d1291dSIcenowy Zheng		};
74d6d1291dSIcenowy Zheng	};
75d6d1291dSIcenowy Zheng
7663b95687SIcenowy Zheng	reg_gmac_3v3: gmac-3v3 {
7763b95687SIcenowy Zheng		compatible = "regulator-fixed";
7863b95687SIcenowy Zheng		regulator-name = "gmac-3v3";
7963b95687SIcenowy Zheng		regulator-min-microvolt = <3300000>;
8063b95687SIcenowy Zheng		regulator-max-microvolt = <3300000>;
8163b95687SIcenowy Zheng		startup-delay-us = <100000>;
8263b95687SIcenowy Zheng		enable-active-high;
8363b95687SIcenowy Zheng		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
8463b95687SIcenowy Zheng	};
8563b95687SIcenowy Zheng
869907da07SIcenowy Zheng	reg_vcc3v3: vcc3v3 {
879907da07SIcenowy Zheng		compatible = "regulator-fixed";
889907da07SIcenowy Zheng		regulator-name = "vcc3v3";
899907da07SIcenowy Zheng		regulator-min-microvolt = <3300000>;
909907da07SIcenowy Zheng		regulator-max-microvolt = <3300000>;
919907da07SIcenowy Zheng	};
929907da07SIcenowy Zheng
93d6d1291dSIcenowy Zheng	reg_usb0_vbus: usb0-vbus {
94d6d1291dSIcenowy Zheng		compatible = "regulator-fixed";
95d6d1291dSIcenowy Zheng		regulator-name = "usb0-vbus";
96d6d1291dSIcenowy Zheng		regulator-min-microvolt = <5000000>;
97d6d1291dSIcenowy Zheng		regulator-max-microvolt = <5000000>;
98d6d1291dSIcenowy Zheng		enable-active-high;
99d6d1291dSIcenowy Zheng		gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
100d6d1291dSIcenowy Zheng		status = "okay";
101d6d1291dSIcenowy Zheng	};
102d6d1291dSIcenowy Zheng};
103d6d1291dSIcenowy Zheng
104d6d1291dSIcenowy Zheng&ehci0 {
105d6d1291dSIcenowy Zheng	status = "okay";
106d6d1291dSIcenowy Zheng};
107d6d1291dSIcenowy Zheng
108d6d1291dSIcenowy Zheng&ehci3 {
109d6d1291dSIcenowy Zheng	status = "okay";
110d6d1291dSIcenowy Zheng};
111d6d1291dSIcenowy Zheng
11263b95687SIcenowy Zheng&emac {
11363b95687SIcenowy Zheng	pinctrl-names = "default";
11463b95687SIcenowy Zheng	pinctrl-0 = <&emac_rgmii_pins>;
11563b95687SIcenowy Zheng	phy-supply = <&reg_gmac_3v3>;
11663b95687SIcenowy Zheng	phy-handle = <&ext_rgmii_phy>;
11763b95687SIcenowy Zheng	phy-mode = "rgmii";
11863b95687SIcenowy Zheng	status = "okay";
11963b95687SIcenowy Zheng};
12063b95687SIcenowy Zheng
12163b95687SIcenowy Zheng&mdio {
12263b95687SIcenowy Zheng	ext_rgmii_phy: ethernet-phy@7 {
12363b95687SIcenowy Zheng		compatible = "ethernet-phy-ieee802.3-c22";
12463b95687SIcenowy Zheng		reg = <7>;
12563b95687SIcenowy Zheng	};
12663b95687SIcenowy Zheng};
12763b95687SIcenowy Zheng
128d6d1291dSIcenowy Zheng&mmc0 {
129d6d1291dSIcenowy Zheng	pinctrl-names = "default";
130d6d1291dSIcenowy Zheng	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
131d6d1291dSIcenowy Zheng	vmmc-supply = <&reg_vcc3v3>;
132d6d1291dSIcenowy Zheng	bus-width = <4>;
133d6d1291dSIcenowy Zheng	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
134d6d1291dSIcenowy Zheng	status = "okay";
135d6d1291dSIcenowy Zheng};
136d6d1291dSIcenowy Zheng
137d6d1291dSIcenowy Zheng&ohci0 {
138d6d1291dSIcenowy Zheng	status = "okay";
139d6d1291dSIcenowy Zheng};
140d6d1291dSIcenowy Zheng
141d6d1291dSIcenowy Zheng&ohci3 {
142d6d1291dSIcenowy Zheng	status = "okay";
143d6d1291dSIcenowy Zheng};
144d6d1291dSIcenowy Zheng
145d6d1291dSIcenowy Zheng&uart0 {
146d6d1291dSIcenowy Zheng	pinctrl-names = "default";
147d6d1291dSIcenowy Zheng	pinctrl-0 = <&uart0_pins_a>;
148d6d1291dSIcenowy Zheng	status = "okay";
149d6d1291dSIcenowy Zheng};
150d6d1291dSIcenowy Zheng
151d6d1291dSIcenowy Zheng&usb_otg {
152d6d1291dSIcenowy Zheng	dr_mode = "otg";
153d6d1291dSIcenowy Zheng	status = "okay";
154d6d1291dSIcenowy Zheng};
155d6d1291dSIcenowy Zheng
156d6d1291dSIcenowy Zheng&usbphy {
157d6d1291dSIcenowy Zheng	/* USB Type-A port's VBUS is always on */
158d6d1291dSIcenowy Zheng	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
159d6d1291dSIcenowy Zheng	usb0_vbus-supply = <&reg_usb0_vbus>;
160d6d1291dSIcenowy Zheng	status = "okay";
161d6d1291dSIcenowy Zheng};
162