12ff28361SIcenowy Zheng/*
22ff28361SIcenowy Zheng * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
32ff28361SIcenowy Zheng *
42ff28361SIcenowy Zheng * Based on sun50i-h5-orangepi-pc2.dts, which is:
52ff28361SIcenowy Zheng *   Copyright (C) 2016 ARM Ltd.
62ff28361SIcenowy Zheng *
72ff28361SIcenowy Zheng * This file is dual-licensed: you can use it either under the terms
82ff28361SIcenowy Zheng * of the GPL or the X11 license, at your option. Note that this dual
92ff28361SIcenowy Zheng * licensing only applies to this file, and not this project as a
102ff28361SIcenowy Zheng * whole.
112ff28361SIcenowy Zheng *
122ff28361SIcenowy Zheng *  a) This file is free software; you can redistribute it and/or
132ff28361SIcenowy Zheng *     modify it under the terms of the GNU General Public License as
142ff28361SIcenowy Zheng *     published by the Free Software Foundation; either version 2 of the
152ff28361SIcenowy Zheng *     License, or (at your option) any later version.
162ff28361SIcenowy Zheng *
172ff28361SIcenowy Zheng *     This file is distributed in the hope that it will be useful,
182ff28361SIcenowy Zheng *     but WITHOUT ANY WARRANTY; without even the implied warranty of
192ff28361SIcenowy Zheng *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
202ff28361SIcenowy Zheng *     GNU General Public License for more details.
212ff28361SIcenowy Zheng *
222ff28361SIcenowy Zheng * Or, alternatively,
232ff28361SIcenowy Zheng *
242ff28361SIcenowy Zheng *  b) Permission is hereby granted, free of charge, to any person
252ff28361SIcenowy Zheng *     obtaining a copy of this software and associated documentation
262ff28361SIcenowy Zheng *     files (the "Software"), to deal in the Software without
272ff28361SIcenowy Zheng *     restriction, including without limitation the rights to use,
282ff28361SIcenowy Zheng *     copy, modify, merge, publish, distribute, sublicense, and/or
292ff28361SIcenowy Zheng *     sell copies of the Software, and to permit persons to whom the
302ff28361SIcenowy Zheng *     Software is furnished to do so, subject to the following
312ff28361SIcenowy Zheng *     conditions:
322ff28361SIcenowy Zheng *
332ff28361SIcenowy Zheng *     The above copyright notice and this permission notice shall be
342ff28361SIcenowy Zheng *     included in all copies or substantial portions of the Software.
352ff28361SIcenowy Zheng *
362ff28361SIcenowy Zheng *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
372ff28361SIcenowy Zheng *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
382ff28361SIcenowy Zheng *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
392ff28361SIcenowy Zheng *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
402ff28361SIcenowy Zheng *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
412ff28361SIcenowy Zheng *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
422ff28361SIcenowy Zheng *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
432ff28361SIcenowy Zheng *     OTHER DEALINGS IN THE SOFTWARE.
442ff28361SIcenowy Zheng */
452ff28361SIcenowy Zheng
462ff28361SIcenowy Zheng/dts-v1/;
472ff28361SIcenowy Zheng#include "sun50i-h5.dtsi"
482ff28361SIcenowy Zheng
492ff28361SIcenowy Zheng#include <dt-bindings/gpio/gpio.h>
502ff28361SIcenowy Zheng#include <dt-bindings/input/input.h>
512ff28361SIcenowy Zheng
522ff28361SIcenowy Zheng/ {
532ff28361SIcenowy Zheng	model = "Xunlong Orange Pi Prime";
542ff28361SIcenowy Zheng	compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
552ff28361SIcenowy Zheng
562ff28361SIcenowy Zheng	aliases {
5744a94c7eSCorentin Labbe		ethernet0 = &emac;
582ff28361SIcenowy Zheng		serial0 = &uart0;
592ff28361SIcenowy Zheng	};
602ff28361SIcenowy Zheng
612ff28361SIcenowy Zheng	chosen {
622ff28361SIcenowy Zheng		stdout-path = "serial0:115200n8";
632ff28361SIcenowy Zheng	};
642ff28361SIcenowy Zheng
6522821975SJernej Skrabec	connector {
6622821975SJernej Skrabec		compatible = "hdmi-connector";
6722821975SJernej Skrabec		type = "a";
6822821975SJernej Skrabec
6922821975SJernej Skrabec		port {
7022821975SJernej Skrabec			hdmi_con_in: endpoint {
7122821975SJernej Skrabec				remote-endpoint = <&hdmi_out_con>;
7222821975SJernej Skrabec			};
7322821975SJernej Skrabec		};
7422821975SJernej Skrabec	};
7522821975SJernej Skrabec
762ff28361SIcenowy Zheng	leds {
772ff28361SIcenowy Zheng		compatible = "gpio-leds";
782ff28361SIcenowy Zheng
792ff28361SIcenowy Zheng		pwr {
802ff28361SIcenowy Zheng			label = "orangepi:green:pwr";
812ff28361SIcenowy Zheng			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
822ff28361SIcenowy Zheng			default-state = "on";
832ff28361SIcenowy Zheng		};
842ff28361SIcenowy Zheng
852ff28361SIcenowy Zheng		status {
862ff28361SIcenowy Zheng			label = "orangepi:red:status";
872ff28361SIcenowy Zheng			gpios = <&pio 0 20 GPIO_ACTIVE_HIGH>;
882ff28361SIcenowy Zheng		};
892ff28361SIcenowy Zheng	};
902ff28361SIcenowy Zheng
912ff28361SIcenowy Zheng	r-gpio-keys {
922ff28361SIcenowy Zheng		compatible = "gpio-keys";
932ff28361SIcenowy Zheng
942ff28361SIcenowy Zheng		sw4 {
952ff28361SIcenowy Zheng			label = "sw4";
962ff28361SIcenowy Zheng			linux,code = <BTN_0>;
972ff28361SIcenowy Zheng			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
982ff28361SIcenowy Zheng		};
992ff28361SIcenowy Zheng	};
1002ff28361SIcenowy Zheng
1014b157a5cSIcenowy Zheng	reg_gmac_3v3: gmac-3v3 {
1024b157a5cSIcenowy Zheng		compatible = "regulator-fixed";
1034b157a5cSIcenowy Zheng		regulator-name = "gmac-3v3";
1044b157a5cSIcenowy Zheng		regulator-min-microvolt = <3300000>;
1054b157a5cSIcenowy Zheng		regulator-max-microvolt = <3300000>;
1064b157a5cSIcenowy Zheng		startup-delay-us = <100000>;
1074b157a5cSIcenowy Zheng		enable-active-high;
1084b157a5cSIcenowy Zheng		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
1094b157a5cSIcenowy Zheng	};
1104b157a5cSIcenowy Zheng
1119907da07SIcenowy Zheng	reg_vcc3v3: vcc3v3 {
1129907da07SIcenowy Zheng		compatible = "regulator-fixed";
1139907da07SIcenowy Zheng		regulator-name = "vcc3v3";
1149907da07SIcenowy Zheng		regulator-min-microvolt = <3300000>;
1159907da07SIcenowy Zheng		regulator-max-microvolt = <3300000>;
1169907da07SIcenowy Zheng	};
1179907da07SIcenowy Zheng
1182ff28361SIcenowy Zheng	reg_usb0_vbus: usb0-vbus {
1192ff28361SIcenowy Zheng		compatible = "regulator-fixed";
1202ff28361SIcenowy Zheng		regulator-name = "usb0-vbus";
1212ff28361SIcenowy Zheng		regulator-min-microvolt = <5000000>;
1222ff28361SIcenowy Zheng		regulator-max-microvolt = <5000000>;
1232ff28361SIcenowy Zheng		enable-active-high;
1242ff28361SIcenowy Zheng		gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
1252ff28361SIcenowy Zheng		status = "okay";
1262ff28361SIcenowy Zheng	};
1272ff28361SIcenowy Zheng
1282ff28361SIcenowy Zheng	wifi_pwrseq: wifi_pwrseq {
1292ff28361SIcenowy Zheng		compatible = "mmc-pwrseq-simple";
1302ff28361SIcenowy Zheng		reset-gpios = <&pio 2 14 GPIO_ACTIVE_LOW>; /* PC14 */
1312ff28361SIcenowy Zheng	};
1322ff28361SIcenowy Zheng};
1332ff28361SIcenowy Zheng
1342ff28361SIcenowy Zheng&codec {
1352ff28361SIcenowy Zheng	allwinner,audio-routing =
1362ff28361SIcenowy Zheng		"Line Out", "LINEOUT",
1372ff28361SIcenowy Zheng		"MIC1", "Mic",
1382ff28361SIcenowy Zheng		"Mic",  "MBIAS";
1392ff28361SIcenowy Zheng	status = "okay";
1402ff28361SIcenowy Zheng};
1412ff28361SIcenowy Zheng
14222821975SJernej Skrabec&de {
14322821975SJernej Skrabec	status = "okay";
14422821975SJernej Skrabec};
14522821975SJernej Skrabec
1462ff28361SIcenowy Zheng&ehci0 {
1472ff28361SIcenowy Zheng	status = "okay";
1482ff28361SIcenowy Zheng};
1492ff28361SIcenowy Zheng
1502ff28361SIcenowy Zheng&ehci1 {
1512ff28361SIcenowy Zheng	status = "okay";
1522ff28361SIcenowy Zheng};
1532ff28361SIcenowy Zheng
1542ff28361SIcenowy Zheng&ehci2 {
1552ff28361SIcenowy Zheng	status = "okay";
1562ff28361SIcenowy Zheng};
1572ff28361SIcenowy Zheng
1582ff28361SIcenowy Zheng&ehci3 {
1592ff28361SIcenowy Zheng	status = "okay";
1602ff28361SIcenowy Zheng};
1612ff28361SIcenowy Zheng
16244a94c7eSCorentin Labbe&emac {
16344a94c7eSCorentin Labbe	pinctrl-names = "default";
16444a94c7eSCorentin Labbe	pinctrl-0 = <&emac_rgmii_pins>;
16544a94c7eSCorentin Labbe	phy-supply = <&reg_gmac_3v3>;
16644a94c7eSCorentin Labbe	phy-handle = <&ext_rgmii_phy>;
16744a94c7eSCorentin Labbe	phy-mode = "rgmii";
16844a94c7eSCorentin Labbe	status = "okay";
16944a94c7eSCorentin Labbe};
17044a94c7eSCorentin Labbe
17144a94c7eSCorentin Labbe&external_mdio {
17244a94c7eSCorentin Labbe	ext_rgmii_phy: ethernet-phy@1 {
17344a94c7eSCorentin Labbe		compatible = "ethernet-phy-ieee802.3-c22";
17444a94c7eSCorentin Labbe		reg = <1>;
17544a94c7eSCorentin Labbe	};
17644a94c7eSCorentin Labbe};
17744a94c7eSCorentin Labbe
17822821975SJernej Skrabec&hdmi {
17922821975SJernej Skrabec	status = "okay";
18022821975SJernej Skrabec};
18122821975SJernej Skrabec
18222821975SJernej Skrabec&hdmi_out {
18322821975SJernej Skrabec	hdmi_out_con: endpoint {
18422821975SJernej Skrabec		remote-endpoint = <&hdmi_con_in>;
18522821975SJernej Skrabec	};
18622821975SJernej Skrabec};
18722821975SJernej Skrabec
1882ff28361SIcenowy Zheng&ir {
1892ff28361SIcenowy Zheng	pinctrl-names = "default";
1902ff28361SIcenowy Zheng	pinctrl-0 = <&ir_pins_a>;
1912ff28361SIcenowy Zheng	status = "okay";
1922ff28361SIcenowy Zheng};
1932ff28361SIcenowy Zheng
1942ff28361SIcenowy Zheng&mmc0 {
1952ff28361SIcenowy Zheng	vmmc-supply = <&reg_vcc3v3>;
1962ff28361SIcenowy Zheng	bus-width = <4>;
1972ff28361SIcenowy Zheng	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
1982ff28361SIcenowy Zheng	status = "okay";
1992ff28361SIcenowy Zheng};
2002ff28361SIcenowy Zheng
2012ff28361SIcenowy Zheng&mmc1 {
2022ff28361SIcenowy Zheng	vmmc-supply = <&reg_vcc3v3>;
2032ff28361SIcenowy Zheng	mmc-pwrseq = <&wifi_pwrseq>;
2042ff28361SIcenowy Zheng	bus-width = <4>;
2052ff28361SIcenowy Zheng	non-removable;
2062ff28361SIcenowy Zheng	status = "okay";
2072ff28361SIcenowy Zheng};
2082ff28361SIcenowy Zheng
2092ff28361SIcenowy Zheng&ohci0 {
2102ff28361SIcenowy Zheng	status = "okay";
2112ff28361SIcenowy Zheng};
2122ff28361SIcenowy Zheng
2132ff28361SIcenowy Zheng&ohci1 {
2142ff28361SIcenowy Zheng	status = "okay";
2152ff28361SIcenowy Zheng};
2162ff28361SIcenowy Zheng
2172ff28361SIcenowy Zheng&ohci2 {
2182ff28361SIcenowy Zheng	status = "okay";
2192ff28361SIcenowy Zheng};
2202ff28361SIcenowy Zheng
2212ff28361SIcenowy Zheng&ohci3 {
2222ff28361SIcenowy Zheng	status = "okay";
2232ff28361SIcenowy Zheng};
2242ff28361SIcenowy Zheng
2252ff28361SIcenowy Zheng&uart0 {
2262ff28361SIcenowy Zheng	pinctrl-names = "default";
2272ff28361SIcenowy Zheng	pinctrl-0 = <&uart0_pins_a>;
2282ff28361SIcenowy Zheng	status = "okay";
2292ff28361SIcenowy Zheng};
2302ff28361SIcenowy Zheng
2312ff28361SIcenowy Zheng&uart1 {
2322ff28361SIcenowy Zheng	pinctrl-names = "default";
2332ff28361SIcenowy Zheng	pinctrl-0 = <&uart1_pins>;
2342ff28361SIcenowy Zheng	status = "disabled";
2352ff28361SIcenowy Zheng};
2362ff28361SIcenowy Zheng
2372ff28361SIcenowy Zheng&uart2 {
2382ff28361SIcenowy Zheng	pinctrl-names = "default";
2392ff28361SIcenowy Zheng	pinctrl-0 = <&uart2_pins>;
2402ff28361SIcenowy Zheng	status = "disabled";
2412ff28361SIcenowy Zheng};
2422ff28361SIcenowy Zheng
2432ff28361SIcenowy Zheng&usb_otg {
2442ff28361SIcenowy Zheng	dr_mode = "otg";
2452ff28361SIcenowy Zheng	status = "okay";
2462ff28361SIcenowy Zheng};
2472ff28361SIcenowy Zheng
2482ff28361SIcenowy Zheng&usbphy {
2492ff28361SIcenowy Zheng	/* USB Type-A ports' VBUS is always on */
2502ff28361SIcenowy Zheng	usb0_id_det-gpios = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
2512ff28361SIcenowy Zheng	usb0_vbus-supply = <&reg_usb0_vbus>;
2522ff28361SIcenowy Zheng	status = "okay";
2532ff28361SIcenowy Zheng};
254