159603d02SIcenowy Zheng/*
259603d02SIcenowy Zheng * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
359603d02SIcenowy Zheng *
459603d02SIcenowy Zheng * Based on sun8i-h3-orangepi-one.dts, which is:
559603d02SIcenowy Zheng *   Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
659603d02SIcenowy Zheng *
759603d02SIcenowy Zheng * This file is dual-licensed: you can use it either under the terms
859603d02SIcenowy Zheng * of the GPL or the X11 license, at your option. Note that this dual
959603d02SIcenowy Zheng * licensing only applies to this file, and not this project as a
1059603d02SIcenowy Zheng * whole.
1159603d02SIcenowy Zheng *
1259603d02SIcenowy Zheng *  a) This file is free software; you can redistribute it and/or
1359603d02SIcenowy Zheng *     modify it under the terms of the GNU General Public License as
1459603d02SIcenowy Zheng *     published by the Free Software Foundation; either version 2 of the
1559603d02SIcenowy Zheng *     License, or (at your option) any later version.
1659603d02SIcenowy Zheng *
1759603d02SIcenowy Zheng *     This file is distributed in the hope that it will be useful,
1859603d02SIcenowy Zheng *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1959603d02SIcenowy Zheng *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2059603d02SIcenowy Zheng *     GNU General Public License for more details.
2159603d02SIcenowy Zheng *
2259603d02SIcenowy Zheng * Or, alternatively,
2359603d02SIcenowy Zheng *
2459603d02SIcenowy Zheng *  b) Permission is hereby granted, free of charge, to any person
2559603d02SIcenowy Zheng *     obtaining a copy of this software and associated documentation
2659603d02SIcenowy Zheng *     files (the "Software"), to deal in the Software without
2759603d02SIcenowy Zheng *     restriction, including without limitation the rights to use,
2859603d02SIcenowy Zheng *     copy, modify, merge, publish, distribute, sublicense, and/or
2959603d02SIcenowy Zheng *     sell copies of the Software, and to permit persons to whom the
3059603d02SIcenowy Zheng *     Software is furnished to do so, subject to the following
3159603d02SIcenowy Zheng *     conditions:
3259603d02SIcenowy Zheng *
3359603d02SIcenowy Zheng *     The above copyright notice and this permission notice shall be
3459603d02SIcenowy Zheng *     included in all copies or substantial portions of the Software.
3559603d02SIcenowy Zheng *
3659603d02SIcenowy Zheng *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3759603d02SIcenowy Zheng *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
3859603d02SIcenowy Zheng *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3959603d02SIcenowy Zheng *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
4059603d02SIcenowy Zheng *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
4159603d02SIcenowy Zheng *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4259603d02SIcenowy Zheng *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4359603d02SIcenowy Zheng *     OTHER DEALINGS IN THE SOFTWARE.
4459603d02SIcenowy Zheng */
4559603d02SIcenowy Zheng
4659603d02SIcenowy Zheng/dts-v1/;
4759603d02SIcenowy Zheng#include "sun8i-h3.dtsi"
4859603d02SIcenowy Zheng#include "sunxi-common-regulators.dtsi"
4959603d02SIcenowy Zheng
5059603d02SIcenowy Zheng#include <dt-bindings/gpio/gpio.h>
5159603d02SIcenowy Zheng#include <dt-bindings/input/input.h>
5259603d02SIcenowy Zheng#include <dt-bindings/pinctrl/sun4i-a10.h>
5359603d02SIcenowy Zheng
5459603d02SIcenowy Zheng/ {
5559603d02SIcenowy Zheng	model = "Xunlong Orange Pi Zero";
5659603d02SIcenowy Zheng	compatible = "xunlong,orangepi-zero", "allwinner,sun8i-h2-plus";
5759603d02SIcenowy Zheng
5859603d02SIcenowy Zheng	aliases {
5959603d02SIcenowy Zheng		serial0 = &uart0;
6059603d02SIcenowy Zheng		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
6159603d02SIcenowy Zheng		ethernet1 = &xr819;
6259603d02SIcenowy Zheng	};
6359603d02SIcenowy Zheng
6459603d02SIcenowy Zheng	chosen {
6559603d02SIcenowy Zheng		stdout-path = "serial0:115200n8";
6659603d02SIcenowy Zheng	};
6759603d02SIcenowy Zheng
6859603d02SIcenowy Zheng	leds {
6959603d02SIcenowy Zheng		compatible = "gpio-leds";
7059603d02SIcenowy Zheng
7159603d02SIcenowy Zheng		pwr_led {
7259603d02SIcenowy Zheng			label = "orangepi:green:pwr";
7359603d02SIcenowy Zheng			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
7459603d02SIcenowy Zheng			default-state = "on";
7559603d02SIcenowy Zheng		};
7659603d02SIcenowy Zheng
7759603d02SIcenowy Zheng		status_led {
7859603d02SIcenowy Zheng			label = "orangepi:red:status";
7959603d02SIcenowy Zheng			gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
8059603d02SIcenowy Zheng		};
8159603d02SIcenowy Zheng	};
8259603d02SIcenowy Zheng
8359603d02SIcenowy Zheng	reg_vcc_wifi: reg_vcc_wifi {
8459603d02SIcenowy Zheng		compatible = "regulator-fixed";
8559603d02SIcenowy Zheng		regulator-min-microvolt = <3300000>;
8659603d02SIcenowy Zheng		regulator-max-microvolt = <3300000>;
8759603d02SIcenowy Zheng		regulator-name = "vcc-wifi";
8859603d02SIcenowy Zheng		enable-active-high;
8959603d02SIcenowy Zheng		gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
9059603d02SIcenowy Zheng	};
9159603d02SIcenowy Zheng
9259603d02SIcenowy Zheng	wifi_pwrseq: wifi_pwrseq {
9359603d02SIcenowy Zheng		compatible = "mmc-pwrseq-simple";
9459603d02SIcenowy Zheng		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
9559603d02SIcenowy Zheng	};
9659603d02SIcenowy Zheng};
9759603d02SIcenowy Zheng
9859603d02SIcenowy Zheng&ehci1 {
9959603d02SIcenowy Zheng	status = "okay";
10059603d02SIcenowy Zheng};
10159603d02SIcenowy Zheng
102*8b15f8ebSAndre Przywara&emac {
103*8b15f8ebSAndre Przywara	phy = <&phy1>;
104*8b15f8ebSAndre Przywara	phy-mode = "mii";
105*8b15f8ebSAndre Przywara	allwinner,use-internal-phy;
106*8b15f8ebSAndre Przywara	allwinner,leds-active-low;
107*8b15f8ebSAndre Przywara	status = "okay";
108*8b15f8ebSAndre Przywara	phy1: ethernet-phy@1 {
109*8b15f8ebSAndre Przywara		reg = <1>;
110*8b15f8ebSAndre Przywara	};
111*8b15f8ebSAndre Przywara};
112*8b15f8ebSAndre Przywara
11359603d02SIcenowy Zheng&mmc0 {
11459603d02SIcenowy Zheng	pinctrl-names = "default";
11559603d02SIcenowy Zheng	pinctrl-0 = <&mmc0_pins_a>;
11659603d02SIcenowy Zheng	vmmc-supply = <&reg_vcc3v3>;
11759603d02SIcenowy Zheng	bus-width = <4>;
11859603d02SIcenowy Zheng	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
11959603d02SIcenowy Zheng	cd-inverted;
12059603d02SIcenowy Zheng	status = "okay";
12159603d02SIcenowy Zheng};
12259603d02SIcenowy Zheng
12359603d02SIcenowy Zheng&mmc1 {
12459603d02SIcenowy Zheng	pinctrl-names = "default";
12559603d02SIcenowy Zheng	pinctrl-0 = <&mmc1_pins_a>;
12659603d02SIcenowy Zheng	vmmc-supply = <&reg_vcc_wifi>;
12759603d02SIcenowy Zheng	mmc-pwrseq = <&wifi_pwrseq>;
12859603d02SIcenowy Zheng	bus-width = <4>;
12959603d02SIcenowy Zheng	non-removable;
13059603d02SIcenowy Zheng	status = "okay";
13159603d02SIcenowy Zheng
13259603d02SIcenowy Zheng	/*
13359603d02SIcenowy Zheng	 * Explicitly define the sdio device, so that we can add an ethernet
13459603d02SIcenowy Zheng	 * alias for it (which e.g. makes u-boot set a mac-address).
13559603d02SIcenowy Zheng	 */
13659603d02SIcenowy Zheng	xr819: sdio_wifi@1 {
13759603d02SIcenowy Zheng		reg = <1>;
13859603d02SIcenowy Zheng	};
13959603d02SIcenowy Zheng};
14059603d02SIcenowy Zheng
14159603d02SIcenowy Zheng&ohci1 {
14259603d02SIcenowy Zheng	status = "okay";
14359603d02SIcenowy Zheng};
14459603d02SIcenowy Zheng
14559603d02SIcenowy Zheng&uart0 {
14659603d02SIcenowy Zheng	pinctrl-names = "default";
14759603d02SIcenowy Zheng	pinctrl-0 = <&uart0_pins_a>;
14859603d02SIcenowy Zheng	status = "okay";
14959603d02SIcenowy Zheng};
15059603d02SIcenowy Zheng
15159603d02SIcenowy Zheng&usbphy {
15259603d02SIcenowy Zheng	/* USB VBUS is always on */
15359603d02SIcenowy Zheng	status = "okay";
15459603d02SIcenowy Zheng};
155