1*59603d02SIcenowy Zheng/*
2*59603d02SIcenowy Zheng * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
3*59603d02SIcenowy Zheng *
4*59603d02SIcenowy Zheng * Based on sun8i-h3-orangepi-one.dts, which is:
5*59603d02SIcenowy Zheng *   Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
6*59603d02SIcenowy Zheng *
7*59603d02SIcenowy Zheng * This file is dual-licensed: you can use it either under the terms
8*59603d02SIcenowy Zheng * of the GPL or the X11 license, at your option. Note that this dual
9*59603d02SIcenowy Zheng * licensing only applies to this file, and not this project as a
10*59603d02SIcenowy Zheng * whole.
11*59603d02SIcenowy Zheng *
12*59603d02SIcenowy Zheng *  a) This file is free software; you can redistribute it and/or
13*59603d02SIcenowy Zheng *     modify it under the terms of the GNU General Public License as
14*59603d02SIcenowy Zheng *     published by the Free Software Foundation; either version 2 of the
15*59603d02SIcenowy Zheng *     License, or (at your option) any later version.
16*59603d02SIcenowy Zheng *
17*59603d02SIcenowy Zheng *     This file is distributed in the hope that it will be useful,
18*59603d02SIcenowy Zheng *     but WITHOUT ANY WARRANTY; without even the implied warranty of
19*59603d02SIcenowy Zheng *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20*59603d02SIcenowy Zheng *     GNU General Public License for more details.
21*59603d02SIcenowy Zheng *
22*59603d02SIcenowy Zheng * Or, alternatively,
23*59603d02SIcenowy Zheng *
24*59603d02SIcenowy Zheng *  b) Permission is hereby granted, free of charge, to any person
25*59603d02SIcenowy Zheng *     obtaining a copy of this software and associated documentation
26*59603d02SIcenowy Zheng *     files (the "Software"), to deal in the Software without
27*59603d02SIcenowy Zheng *     restriction, including without limitation the rights to use,
28*59603d02SIcenowy Zheng *     copy, modify, merge, publish, distribute, sublicense, and/or
29*59603d02SIcenowy Zheng *     sell copies of the Software, and to permit persons to whom the
30*59603d02SIcenowy Zheng *     Software is furnished to do so, subject to the following
31*59603d02SIcenowy Zheng *     conditions:
32*59603d02SIcenowy Zheng *
33*59603d02SIcenowy Zheng *     The above copyright notice and this permission notice shall be
34*59603d02SIcenowy Zheng *     included in all copies or substantial portions of the Software.
35*59603d02SIcenowy Zheng *
36*59603d02SIcenowy Zheng *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37*59603d02SIcenowy Zheng *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38*59603d02SIcenowy Zheng *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39*59603d02SIcenowy Zheng *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40*59603d02SIcenowy Zheng *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41*59603d02SIcenowy Zheng *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42*59603d02SIcenowy Zheng *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43*59603d02SIcenowy Zheng *     OTHER DEALINGS IN THE SOFTWARE.
44*59603d02SIcenowy Zheng */
45*59603d02SIcenowy Zheng
46*59603d02SIcenowy Zheng/dts-v1/;
47*59603d02SIcenowy Zheng#include "sun8i-h3.dtsi"
48*59603d02SIcenowy Zheng#include "sunxi-common-regulators.dtsi"
49*59603d02SIcenowy Zheng
50*59603d02SIcenowy Zheng#include <dt-bindings/gpio/gpio.h>
51*59603d02SIcenowy Zheng#include <dt-bindings/input/input.h>
52*59603d02SIcenowy Zheng#include <dt-bindings/pinctrl/sun4i-a10.h>
53*59603d02SIcenowy Zheng
54*59603d02SIcenowy Zheng/ {
55*59603d02SIcenowy Zheng	model = "Xunlong Orange Pi Zero";
56*59603d02SIcenowy Zheng	compatible = "xunlong,orangepi-zero", "allwinner,sun8i-h2-plus";
57*59603d02SIcenowy Zheng
58*59603d02SIcenowy Zheng	aliases {
59*59603d02SIcenowy Zheng		serial0 = &uart0;
60*59603d02SIcenowy Zheng		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
61*59603d02SIcenowy Zheng		ethernet1 = &xr819;
62*59603d02SIcenowy Zheng	};
63*59603d02SIcenowy Zheng
64*59603d02SIcenowy Zheng	chosen {
65*59603d02SIcenowy Zheng		stdout-path = "serial0:115200n8";
66*59603d02SIcenowy Zheng	};
67*59603d02SIcenowy Zheng
68*59603d02SIcenowy Zheng	leds {
69*59603d02SIcenowy Zheng		compatible = "gpio-leds";
70*59603d02SIcenowy Zheng
71*59603d02SIcenowy Zheng		pwr_led {
72*59603d02SIcenowy Zheng			label = "orangepi:green:pwr";
73*59603d02SIcenowy Zheng			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
74*59603d02SIcenowy Zheng			default-state = "on";
75*59603d02SIcenowy Zheng		};
76*59603d02SIcenowy Zheng
77*59603d02SIcenowy Zheng		status_led {
78*59603d02SIcenowy Zheng			label = "orangepi:red:status";
79*59603d02SIcenowy Zheng			gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
80*59603d02SIcenowy Zheng		};
81*59603d02SIcenowy Zheng	};
82*59603d02SIcenowy Zheng
83*59603d02SIcenowy Zheng	reg_vcc_wifi: reg_vcc_wifi {
84*59603d02SIcenowy Zheng		compatible = "regulator-fixed";
85*59603d02SIcenowy Zheng		regulator-min-microvolt = <3300000>;
86*59603d02SIcenowy Zheng		regulator-max-microvolt = <3300000>;
87*59603d02SIcenowy Zheng		regulator-name = "vcc-wifi";
88*59603d02SIcenowy Zheng		enable-active-high;
89*59603d02SIcenowy Zheng		gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
90*59603d02SIcenowy Zheng	};
91*59603d02SIcenowy Zheng
92*59603d02SIcenowy Zheng	wifi_pwrseq: wifi_pwrseq {
93*59603d02SIcenowy Zheng		compatible = "mmc-pwrseq-simple";
94*59603d02SIcenowy Zheng		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
95*59603d02SIcenowy Zheng	};
96*59603d02SIcenowy Zheng};
97*59603d02SIcenowy Zheng
98*59603d02SIcenowy Zheng&ehci1 {
99*59603d02SIcenowy Zheng	status = "okay";
100*59603d02SIcenowy Zheng};
101*59603d02SIcenowy Zheng
102*59603d02SIcenowy Zheng&mmc0 {
103*59603d02SIcenowy Zheng	pinctrl-names = "default";
104*59603d02SIcenowy Zheng	pinctrl-0 = <&mmc0_pins_a>;
105*59603d02SIcenowy Zheng	vmmc-supply = <&reg_vcc3v3>;
106*59603d02SIcenowy Zheng	bus-width = <4>;
107*59603d02SIcenowy Zheng	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
108*59603d02SIcenowy Zheng	cd-inverted;
109*59603d02SIcenowy Zheng	status = "okay";
110*59603d02SIcenowy Zheng};
111*59603d02SIcenowy Zheng
112*59603d02SIcenowy Zheng&mmc1 {
113*59603d02SIcenowy Zheng	pinctrl-names = "default";
114*59603d02SIcenowy Zheng	pinctrl-0 = <&mmc1_pins_a>;
115*59603d02SIcenowy Zheng	vmmc-supply = <&reg_vcc_wifi>;
116*59603d02SIcenowy Zheng	mmc-pwrseq = <&wifi_pwrseq>;
117*59603d02SIcenowy Zheng	bus-width = <4>;
118*59603d02SIcenowy Zheng	non-removable;
119*59603d02SIcenowy Zheng	status = "okay";
120*59603d02SIcenowy Zheng
121*59603d02SIcenowy Zheng	/*
122*59603d02SIcenowy Zheng	 * Explicitly define the sdio device, so that we can add an ethernet
123*59603d02SIcenowy Zheng	 * alias for it (which e.g. makes u-boot set a mac-address).
124*59603d02SIcenowy Zheng	 */
125*59603d02SIcenowy Zheng	xr819: sdio_wifi@1 {
126*59603d02SIcenowy Zheng		reg = <1>;
127*59603d02SIcenowy Zheng	};
128*59603d02SIcenowy Zheng};
129*59603d02SIcenowy Zheng
130*59603d02SIcenowy Zheng&ohci1 {
131*59603d02SIcenowy Zheng	status = "okay";
132*59603d02SIcenowy Zheng};
133*59603d02SIcenowy Zheng
134*59603d02SIcenowy Zheng&uart0 {
135*59603d02SIcenowy Zheng	pinctrl-names = "default";
136*59603d02SIcenowy Zheng	pinctrl-0 = <&uart0_pins_a>;
137*59603d02SIcenowy Zheng	status = "okay";
138*59603d02SIcenowy Zheng};
139*59603d02SIcenowy Zheng
140*59603d02SIcenowy Zheng&usbphy {
141*59603d02SIcenowy Zheng	/* USB VBUS is always on */
142*59603d02SIcenowy Zheng	status = "okay";
143*59603d02SIcenowy Zheng};
144