xref: /freebsd/sys/contrib/device-tree/src/arm/allwinner/sun8i-h2-plus-orangepi-zero.dts (revision 7d0873ebb83b19ba1e8a89e679470d885efe12e3)
1f126890aSEmmanuel Vadot/*
2f126890aSEmmanuel Vadot * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
3f126890aSEmmanuel Vadot *
4f126890aSEmmanuel Vadot * Based on sun8i-h3-orangepi-one.dts, which is:
5f126890aSEmmanuel Vadot *   Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
6f126890aSEmmanuel Vadot *
7f126890aSEmmanuel Vadot * This file is dual-licensed: you can use it either under the terms
8f126890aSEmmanuel Vadot * of the GPL or the X11 license, at your option. Note that this dual
9f126890aSEmmanuel Vadot * licensing only applies to this file, and not this project as a
10f126890aSEmmanuel Vadot * whole.
11f126890aSEmmanuel Vadot *
12f126890aSEmmanuel Vadot *  a) This file is free software; you can redistribute it and/or
13f126890aSEmmanuel Vadot *     modify it under the terms of the GNU General Public License as
14f126890aSEmmanuel Vadot *     published by the Free Software Foundation; either version 2 of the
15f126890aSEmmanuel Vadot *     License, or (at your option) any later version.
16f126890aSEmmanuel Vadot *
17f126890aSEmmanuel Vadot *     This file is distributed in the hope that it will be useful,
18f126890aSEmmanuel Vadot *     but WITHOUT ANY WARRANTY; without even the implied warranty of
19f126890aSEmmanuel Vadot *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20f126890aSEmmanuel Vadot *     GNU General Public License for more details.
21f126890aSEmmanuel Vadot *
22f126890aSEmmanuel Vadot * Or, alternatively,
23f126890aSEmmanuel Vadot *
24f126890aSEmmanuel Vadot *  b) Permission is hereby granted, free of charge, to any person
25f126890aSEmmanuel Vadot *     obtaining a copy of this software and associated documentation
26f126890aSEmmanuel Vadot *     files (the "Software"), to deal in the Software without
27f126890aSEmmanuel Vadot *     restriction, including without limitation the rights to use,
28f126890aSEmmanuel Vadot *     copy, modify, merge, publish, distribute, sublicense, and/or
29f126890aSEmmanuel Vadot *     sell copies of the Software, and to permit persons to whom the
30f126890aSEmmanuel Vadot *     Software is furnished to do so, subject to the following
31f126890aSEmmanuel Vadot *     conditions:
32f126890aSEmmanuel Vadot *
33f126890aSEmmanuel Vadot *     The above copyright notice and this permission notice shall be
34f126890aSEmmanuel Vadot *     included in all copies or substantial portions of the Software.
35f126890aSEmmanuel Vadot *
36f126890aSEmmanuel Vadot *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37f126890aSEmmanuel Vadot *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38f126890aSEmmanuel Vadot *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39f126890aSEmmanuel Vadot *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40f126890aSEmmanuel Vadot *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41f126890aSEmmanuel Vadot *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42f126890aSEmmanuel Vadot *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43f126890aSEmmanuel Vadot *     OTHER DEALINGS IN THE SOFTWARE.
44f126890aSEmmanuel Vadot */
45f126890aSEmmanuel Vadot
46f126890aSEmmanuel Vadot/dts-v1/;
47f126890aSEmmanuel Vadot#include "sun8i-h3.dtsi"
48f126890aSEmmanuel Vadot#include "sunxi-common-regulators.dtsi"
49f126890aSEmmanuel Vadot
50f126890aSEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
51f126890aSEmmanuel Vadot#include <dt-bindings/input/input.h>
52f126890aSEmmanuel Vadot
53f126890aSEmmanuel Vadot/ {
54f126890aSEmmanuel Vadot	model = "Xunlong Orange Pi Zero";
55f126890aSEmmanuel Vadot	compatible = "xunlong,orangepi-zero", "allwinner,sun8i-h2-plus";
56f126890aSEmmanuel Vadot
57f126890aSEmmanuel Vadot	aliases {
58f126890aSEmmanuel Vadot		serial0 = &uart0;
59f126890aSEmmanuel Vadot		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
60f126890aSEmmanuel Vadot		ethernet0 = &emac;
61f126890aSEmmanuel Vadot		ethernet1 = &xr819;
62f126890aSEmmanuel Vadot	};
63f126890aSEmmanuel Vadot
64f126890aSEmmanuel Vadot	chosen {
65f126890aSEmmanuel Vadot		stdout-path = "serial0:115200n8";
66f126890aSEmmanuel Vadot	};
67f126890aSEmmanuel Vadot
68f126890aSEmmanuel Vadot	leds {
69f126890aSEmmanuel Vadot		compatible = "gpio-leds";
70f126890aSEmmanuel Vadot
71f126890aSEmmanuel Vadot		pwr_led {
72f126890aSEmmanuel Vadot			label = "orangepi:green:pwr";
73f126890aSEmmanuel Vadot			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
74f126890aSEmmanuel Vadot			default-state = "on";
75f126890aSEmmanuel Vadot		};
76f126890aSEmmanuel Vadot
77f126890aSEmmanuel Vadot		status_led {
78f126890aSEmmanuel Vadot			label = "orangepi:red:status";
79f126890aSEmmanuel Vadot			gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
80f126890aSEmmanuel Vadot		};
81f126890aSEmmanuel Vadot	};
82f126890aSEmmanuel Vadot
83*7d0873ebSEmmanuel Vadot	reg_vcc_wifi: reg-vcc-wifi {
84f126890aSEmmanuel Vadot		compatible = "regulator-fixed";
85f126890aSEmmanuel Vadot		regulator-min-microvolt = <3300000>;
86f126890aSEmmanuel Vadot		regulator-max-microvolt = <3300000>;
87f126890aSEmmanuel Vadot		regulator-name = "vcc-wifi";
88f126890aSEmmanuel Vadot		enable-active-high;
89f126890aSEmmanuel Vadot		gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
90f126890aSEmmanuel Vadot	};
91f126890aSEmmanuel Vadot
92f126890aSEmmanuel Vadot	reg_vdd_cpux: vdd-cpux-regulator {
93f126890aSEmmanuel Vadot		compatible = "regulator-gpio";
94f126890aSEmmanuel Vadot		regulator-name = "vdd-cpux";
95f126890aSEmmanuel Vadot		regulator-type = "voltage";
96f126890aSEmmanuel Vadot		regulator-boot-on;
97f126890aSEmmanuel Vadot		regulator-always-on;
98f126890aSEmmanuel Vadot		regulator-min-microvolt = <1100000>;
99f126890aSEmmanuel Vadot		regulator-max-microvolt = <1300000>;
100f126890aSEmmanuel Vadot		regulator-ramp-delay = <50>; /* 4ms */
101f126890aSEmmanuel Vadot
102f126890aSEmmanuel Vadot		gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
103f126890aSEmmanuel Vadot		enable-active-high;
104f126890aSEmmanuel Vadot		gpios-states = <1>;
105f126890aSEmmanuel Vadot		states = <1100000 0>, <1300000 1>;
106f126890aSEmmanuel Vadot	};
107f126890aSEmmanuel Vadot
108*7d0873ebSEmmanuel Vadot	wifi_pwrseq: pwrseq {
109f126890aSEmmanuel Vadot		compatible = "mmc-pwrseq-simple";
110f126890aSEmmanuel Vadot		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
111f126890aSEmmanuel Vadot		post-power-on-delay-ms = <200>;
112f126890aSEmmanuel Vadot	};
113f126890aSEmmanuel Vadot};
114f126890aSEmmanuel Vadot
115f126890aSEmmanuel Vadot&cpu0 {
116f126890aSEmmanuel Vadot	cpu-supply = <&reg_vdd_cpux>;
117f126890aSEmmanuel Vadot};
118f126890aSEmmanuel Vadot
119f126890aSEmmanuel Vadot&ehci0 {
120f126890aSEmmanuel Vadot	status = "okay";
121f126890aSEmmanuel Vadot};
122f126890aSEmmanuel Vadot
123f126890aSEmmanuel Vadot&ehci1 {
124f126890aSEmmanuel Vadot	status = "okay";
125f126890aSEmmanuel Vadot};
126f126890aSEmmanuel Vadot
127f126890aSEmmanuel Vadot&emac {
128f126890aSEmmanuel Vadot	phy-handle = <&int_mii_phy>;
129f126890aSEmmanuel Vadot	phy-mode = "mii";
130f126890aSEmmanuel Vadot	allwinner,leds-active-low;
131f126890aSEmmanuel Vadot	status = "okay";
132f126890aSEmmanuel Vadot};
133f126890aSEmmanuel Vadot
134f126890aSEmmanuel Vadot&mmc0 {
135f126890aSEmmanuel Vadot	vmmc-supply = <&reg_vcc3v3>;
136f126890aSEmmanuel Vadot	bus-width = <4>;
137f126890aSEmmanuel Vadot	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
138f126890aSEmmanuel Vadot	status = "okay";
139f126890aSEmmanuel Vadot};
140f126890aSEmmanuel Vadot
141f126890aSEmmanuel Vadot&mmc1 {
142f126890aSEmmanuel Vadot	vmmc-supply = <&reg_vcc_wifi>;
143f126890aSEmmanuel Vadot	mmc-pwrseq = <&wifi_pwrseq>;
144f126890aSEmmanuel Vadot	bus-width = <4>;
145f126890aSEmmanuel Vadot	non-removable;
146f126890aSEmmanuel Vadot	status = "okay";
147f126890aSEmmanuel Vadot
148f126890aSEmmanuel Vadot	/*
149f126890aSEmmanuel Vadot	 * Explicitly define the sdio device, so that we can add an ethernet
150f126890aSEmmanuel Vadot	 * alias for it (which e.g. makes u-boot set a mac-address).
151f126890aSEmmanuel Vadot	 */
152*7d0873ebSEmmanuel Vadot	xr819: wifi@1 {
153f126890aSEmmanuel Vadot		reg = <1>;
154f126890aSEmmanuel Vadot	};
155f126890aSEmmanuel Vadot};
156f126890aSEmmanuel Vadot
157f126890aSEmmanuel Vadot&ohci0 {
158f126890aSEmmanuel Vadot	status = "okay";
159f126890aSEmmanuel Vadot};
160f126890aSEmmanuel Vadot
161f126890aSEmmanuel Vadot&ohci1 {
162f126890aSEmmanuel Vadot	status = "okay";
163f126890aSEmmanuel Vadot};
164f126890aSEmmanuel Vadot
165f126890aSEmmanuel Vadot&spi0 {
166f126890aSEmmanuel Vadot	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
167f126890aSEmmanuel Vadot	status = "disabled";
168f126890aSEmmanuel Vadot
169f126890aSEmmanuel Vadot	flash@0 {
170f126890aSEmmanuel Vadot		#address-cells = <1>;
171f126890aSEmmanuel Vadot		#size-cells = <1>;
172f126890aSEmmanuel Vadot		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
173f126890aSEmmanuel Vadot		reg = <0>;
174f126890aSEmmanuel Vadot		spi-max-frequency = <40000000>;
175f126890aSEmmanuel Vadot	};
176f126890aSEmmanuel Vadot};
177f126890aSEmmanuel Vadot
178f126890aSEmmanuel Vadot&uart0 {
179f126890aSEmmanuel Vadot	pinctrl-names = "default";
180f126890aSEmmanuel Vadot	pinctrl-0 = <&uart0_pa_pins>;
181f126890aSEmmanuel Vadot	status = "okay";
182f126890aSEmmanuel Vadot};
183f126890aSEmmanuel Vadot
184f126890aSEmmanuel Vadot&uart1 {
185f126890aSEmmanuel Vadot	pinctrl-names = "default";
186f126890aSEmmanuel Vadot	pinctrl-0 = <&uart1_pins>;
187f126890aSEmmanuel Vadot	status = "disabled";
188f126890aSEmmanuel Vadot};
189f126890aSEmmanuel Vadot
190f126890aSEmmanuel Vadot&uart2 {
191f126890aSEmmanuel Vadot	pinctrl-names = "default";
192f126890aSEmmanuel Vadot	pinctrl-0 = <&uart2_pins>;
193f126890aSEmmanuel Vadot	status = "disabled";
194f126890aSEmmanuel Vadot};
195f126890aSEmmanuel Vadot
196f126890aSEmmanuel Vadot&usb_otg {
197f126890aSEmmanuel Vadot	dr_mode = "peripheral";
198f126890aSEmmanuel Vadot	status = "okay";
199f126890aSEmmanuel Vadot};
200f126890aSEmmanuel Vadot
201f126890aSEmmanuel Vadot&usbphy {
202f126890aSEmmanuel Vadot	/*
203f126890aSEmmanuel Vadot	 * USB Type-A port VBUS is always on. However, MicroUSB VBUS can only
204f126890aSEmmanuel Vadot	 * power up the board; when it's used as OTG port, this VBUS is
205f126890aSEmmanuel Vadot	 * always off even if the board is powered via GPIO pins.
206f126890aSEmmanuel Vadot	 */
207f126890aSEmmanuel Vadot	status = "okay";
208f126890aSEmmanuel Vadot	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
209f126890aSEmmanuel Vadot};
210