162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Based on sun8i-h3-orangepi-one.dts, which is:
562306a36Sopenharmony_ci *   Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * This file is dual-licensed: you can use it either under the terms
862306a36Sopenharmony_ci * of the GPL or the X11 license, at your option. Note that this dual
962306a36Sopenharmony_ci * licensing only applies to this file, and not this project as a
1062306a36Sopenharmony_ci * whole.
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *  a) This file is free software; you can redistribute it and/or
1362306a36Sopenharmony_ci *     modify it under the terms of the GNU General Public License as
1462306a36Sopenharmony_ci *     published by the Free Software Foundation; either version 2 of the
1562306a36Sopenharmony_ci *     License, or (at your option) any later version.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci *     This file is distributed in the hope that it will be useful,
1862306a36Sopenharmony_ci *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1962306a36Sopenharmony_ci *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2062306a36Sopenharmony_ci *     GNU General Public License for more details.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Or, alternatively,
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci *  b) Permission is hereby granted, free of charge, to any person
2562306a36Sopenharmony_ci *     obtaining a copy of this software and associated documentation
2662306a36Sopenharmony_ci *     files (the "Software"), to deal in the Software without
2762306a36Sopenharmony_ci *     restriction, including without limitation the rights to use,
2862306a36Sopenharmony_ci *     copy, modify, merge, publish, distribute, sublicense, and/or
2962306a36Sopenharmony_ci *     sell copies of the Software, and to permit persons to whom the
3062306a36Sopenharmony_ci *     Software is furnished to do so, subject to the following
3162306a36Sopenharmony_ci *     conditions:
3262306a36Sopenharmony_ci *
3362306a36Sopenharmony_ci *     The above copyright notice and this permission notice shall be
3462306a36Sopenharmony_ci *     included in all copies or substantial portions of the Software.
3562306a36Sopenharmony_ci *
3662306a36Sopenharmony_ci *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3762306a36Sopenharmony_ci *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
3862306a36Sopenharmony_ci *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3962306a36Sopenharmony_ci *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
4062306a36Sopenharmony_ci *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
4162306a36Sopenharmony_ci *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4262306a36Sopenharmony_ci *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4362306a36Sopenharmony_ci *     OTHER DEALINGS IN THE SOFTWARE.
4462306a36Sopenharmony_ci */
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/dts-v1/;
4762306a36Sopenharmony_ci#include "sun8i-h3.dtsi"
4862306a36Sopenharmony_ci#include "sunxi-common-regulators.dtsi"
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#include <dt-bindings/gpio/gpio.h>
5162306a36Sopenharmony_ci#include <dt-bindings/input/input.h>
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/ {
5462306a36Sopenharmony_ci	model = "Xunlong Orange Pi Zero";
5562306a36Sopenharmony_ci	compatible = "xunlong,orangepi-zero", "allwinner,sun8i-h2-plus";
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	aliases {
5862306a36Sopenharmony_ci		serial0 = &uart0;
5962306a36Sopenharmony_ci		/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
6062306a36Sopenharmony_ci		ethernet0 = &emac;
6162306a36Sopenharmony_ci		ethernet1 = &xr819;
6262306a36Sopenharmony_ci	};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	chosen {
6562306a36Sopenharmony_ci		stdout-path = "serial0:115200n8";
6662306a36Sopenharmony_ci	};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci	leds {
6962306a36Sopenharmony_ci		compatible = "gpio-leds";
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci		pwr_led {
7262306a36Sopenharmony_ci			label = "orangepi:green:pwr";
7362306a36Sopenharmony_ci			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
7462306a36Sopenharmony_ci			default-state = "on";
7562306a36Sopenharmony_ci		};
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci		status_led {
7862306a36Sopenharmony_ci			label = "orangepi:red:status";
7962306a36Sopenharmony_ci			gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
8062306a36Sopenharmony_ci		};
8162306a36Sopenharmony_ci	};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci	reg_vcc_wifi: reg_vcc_wifi {
8462306a36Sopenharmony_ci		compatible = "regulator-fixed";
8562306a36Sopenharmony_ci		regulator-min-microvolt = <3300000>;
8662306a36Sopenharmony_ci		regulator-max-microvolt = <3300000>;
8762306a36Sopenharmony_ci		regulator-name = "vcc-wifi";
8862306a36Sopenharmony_ci		enable-active-high;
8962306a36Sopenharmony_ci		gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
9062306a36Sopenharmony_ci	};
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci	reg_vdd_cpux: vdd-cpux-regulator {
9362306a36Sopenharmony_ci		compatible = "regulator-gpio";
9462306a36Sopenharmony_ci		regulator-name = "vdd-cpux";
9562306a36Sopenharmony_ci		regulator-type = "voltage";
9662306a36Sopenharmony_ci		regulator-boot-on;
9762306a36Sopenharmony_ci		regulator-always-on;
9862306a36Sopenharmony_ci		regulator-min-microvolt = <1100000>;
9962306a36Sopenharmony_ci		regulator-max-microvolt = <1300000>;
10062306a36Sopenharmony_ci		regulator-ramp-delay = <50>; /* 4ms */
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci		gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
10362306a36Sopenharmony_ci		enable-active-high;
10462306a36Sopenharmony_ci		gpios-states = <1>;
10562306a36Sopenharmony_ci		states = <1100000 0>, <1300000 1>;
10662306a36Sopenharmony_ci	};
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci	wifi_pwrseq: wifi_pwrseq {
10962306a36Sopenharmony_ci		compatible = "mmc-pwrseq-simple";
11062306a36Sopenharmony_ci		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
11162306a36Sopenharmony_ci		post-power-on-delay-ms = <200>;
11262306a36Sopenharmony_ci	};
11362306a36Sopenharmony_ci};
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci&cpu0 {
11662306a36Sopenharmony_ci	cpu-supply = <&reg_vdd_cpux>;
11762306a36Sopenharmony_ci};
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci&ehci0 {
12062306a36Sopenharmony_ci	status = "okay";
12162306a36Sopenharmony_ci};
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci&ehci1 {
12462306a36Sopenharmony_ci	status = "okay";
12562306a36Sopenharmony_ci};
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci&emac {
12862306a36Sopenharmony_ci	phy-handle = <&int_mii_phy>;
12962306a36Sopenharmony_ci	phy-mode = "mii";
13062306a36Sopenharmony_ci	allwinner,leds-active-low;
13162306a36Sopenharmony_ci	status = "okay";
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci&mmc0 {
13562306a36Sopenharmony_ci	vmmc-supply = <&reg_vcc3v3>;
13662306a36Sopenharmony_ci	bus-width = <4>;
13762306a36Sopenharmony_ci	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
13862306a36Sopenharmony_ci	status = "okay";
13962306a36Sopenharmony_ci};
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci&mmc1 {
14262306a36Sopenharmony_ci	vmmc-supply = <&reg_vcc_wifi>;
14362306a36Sopenharmony_ci	mmc-pwrseq = <&wifi_pwrseq>;
14462306a36Sopenharmony_ci	bus-width = <4>;
14562306a36Sopenharmony_ci	non-removable;
14662306a36Sopenharmony_ci	status = "okay";
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci	/*
14962306a36Sopenharmony_ci	 * Explicitly define the sdio device, so that we can add an ethernet
15062306a36Sopenharmony_ci	 * alias for it (which e.g. makes u-boot set a mac-address).
15162306a36Sopenharmony_ci	 */
15262306a36Sopenharmony_ci	xr819: sdio_wifi@1 {
15362306a36Sopenharmony_ci		reg = <1>;
15462306a36Sopenharmony_ci	};
15562306a36Sopenharmony_ci};
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci&ohci0 {
15862306a36Sopenharmony_ci	status = "okay";
15962306a36Sopenharmony_ci};
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci&ohci1 {
16262306a36Sopenharmony_ci	status = "okay";
16362306a36Sopenharmony_ci};
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci&spi0 {
16662306a36Sopenharmony_ci	/* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
16762306a36Sopenharmony_ci	status = "disabled";
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci	flash@0 {
17062306a36Sopenharmony_ci		#address-cells = <1>;
17162306a36Sopenharmony_ci		#size-cells = <1>;
17262306a36Sopenharmony_ci		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
17362306a36Sopenharmony_ci		reg = <0>;
17462306a36Sopenharmony_ci		spi-max-frequency = <40000000>;
17562306a36Sopenharmony_ci	};
17662306a36Sopenharmony_ci};
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci&uart0 {
17962306a36Sopenharmony_ci	pinctrl-names = "default";
18062306a36Sopenharmony_ci	pinctrl-0 = <&uart0_pa_pins>;
18162306a36Sopenharmony_ci	status = "okay";
18262306a36Sopenharmony_ci};
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci&uart1 {
18562306a36Sopenharmony_ci	pinctrl-names = "default";
18662306a36Sopenharmony_ci	pinctrl-0 = <&uart1_pins>;
18762306a36Sopenharmony_ci	status = "disabled";
18862306a36Sopenharmony_ci};
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci&uart2 {
19162306a36Sopenharmony_ci	pinctrl-names = "default";
19262306a36Sopenharmony_ci	pinctrl-0 = <&uart2_pins>;
19362306a36Sopenharmony_ci	status = "disabled";
19462306a36Sopenharmony_ci};
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci&usb_otg {
19762306a36Sopenharmony_ci	dr_mode = "peripheral";
19862306a36Sopenharmony_ci	status = "okay";
19962306a36Sopenharmony_ci};
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci&usbphy {
20262306a36Sopenharmony_ci	/*
20362306a36Sopenharmony_ci	 * USB Type-A port VBUS is always on. However, MicroUSB VBUS can only
20462306a36Sopenharmony_ci	 * power up the board; when it's used as OTG port, this VBUS is
20562306a36Sopenharmony_ci	 * always off even if the board is powered via GPIO pins.
20662306a36Sopenharmony_ci	 */
20762306a36Sopenharmony_ci	status = "okay";
20862306a36Sopenharmony_ci	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
20962306a36Sopenharmony_ci};
210