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