188ea6989SSamuel Holland// SPDX-License-Identifier: (GPL-2.0+ or MIT)
288ea6989SSamuel Holland// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
388ea6989SSamuel Holland
4*fce449f5STrevor Woerner/*
5*fce449f5STrevor Woerner * gpio line names
6*fce449f5STrevor Woerner *
7*fce449f5STrevor Woerner * The Nezha-D1 has a 40-pin IO header. Some of these pins are routed
8*fce449f5STrevor Woerner * directly to pads on the SoC, others come from an 8-bit pcf857x IO
9*fce449f5STrevor Woerner * expander. Therefore, these line names are specified in two places:
10*fce449f5STrevor Woerner * one set for the pcf857x, and one set for the pio controller.
11*fce449f5STrevor Woerner *
12*fce449f5STrevor Woerner * Lines which are routed to the 40-pin header are named as follows:
13*fce449f5STrevor Woerner *	<pin#> [<pin name>]
14*fce449f5STrevor Woerner * where:
15*fce449f5STrevor Woerner *	<pin#>		is the actual pin number of the 40-pin header
16*fce449f5STrevor Woerner *	<pin name>	is the name of the pin by function/gpio#
17*fce449f5STrevor Woerner *
18*fce449f5STrevor Woerner * For details regarding pin numbers and names see the schematics (under
19*fce449f5STrevor Woerner * "IO EXPAND"):
20*fce449f5STrevor Woerner * http://dl.linux-sunxi.org/D1/D1_Nezha_development_board_schematic_diagram_20210224.pdf
21*fce449f5STrevor Woerner */
22*fce449f5STrevor Woerner
2388ea6989SSamuel Holland#include <dt-bindings/gpio/gpio.h>
2488ea6989SSamuel Holland#include <dt-bindings/input/input.h>
2588ea6989SSamuel Holland
2688ea6989SSamuel Holland/dts-v1/;
2788ea6989SSamuel Holland
2888ea6989SSamuel Holland#include "sun20i-d1.dtsi"
2988ea6989SSamuel Holland#include "sun20i-common-regulators.dtsi"
3088ea6989SSamuel Holland
3188ea6989SSamuel Holland/ {
3288ea6989SSamuel Holland	model = "Allwinner D1 Nezha";
3388ea6989SSamuel Holland	compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
3488ea6989SSamuel Holland
3588ea6989SSamuel Holland	aliases {
3688ea6989SSamuel Holland		ethernet0 = &emac;
3788ea6989SSamuel Holland		ethernet1 = &xr829;
3888ea6989SSamuel Holland		serial0 = &uart0;
3988ea6989SSamuel Holland	};
4088ea6989SSamuel Holland
4188ea6989SSamuel Holland	chosen {
4288ea6989SSamuel Holland		stdout-path = "serial0:115200n8";
4388ea6989SSamuel Holland	};
4488ea6989SSamuel Holland
4588ea6989SSamuel Holland	reg_usbvbus: usbvbus {
4688ea6989SSamuel Holland		compatible = "regulator-fixed";
4788ea6989SSamuel Holland		regulator-name = "usbvbus";
4888ea6989SSamuel Holland		regulator-min-microvolt = <5000000>;
4988ea6989SSamuel Holland		regulator-max-microvolt = <5000000>;
5088ea6989SSamuel Holland		gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
5188ea6989SSamuel Holland		enable-active-high;
5288ea6989SSamuel Holland		vin-supply = <&reg_vcc>;
5388ea6989SSamuel Holland	};
5488ea6989SSamuel Holland
5588ea6989SSamuel Holland	/*
5688ea6989SSamuel Holland	 * This regulator is PWM-controlled, but the PWM controller is not
5788ea6989SSamuel Holland	 * yet supported, so fix the regulator to its default voltage.
5888ea6989SSamuel Holland	 */
5988ea6989SSamuel Holland	reg_vdd_cpu: vdd-cpu {
6088ea6989SSamuel Holland		compatible = "regulator-fixed";
6188ea6989SSamuel Holland		regulator-name = "vdd-cpu";
6288ea6989SSamuel Holland		regulator-min-microvolt = <1100000>;
6388ea6989SSamuel Holland		regulator-max-microvolt = <1100000>;
6488ea6989SSamuel Holland		vin-supply = <&reg_vcc>;
6588ea6989SSamuel Holland	};
6688ea6989SSamuel Holland
6788ea6989SSamuel Holland	wifi_pwrseq: wifi-pwrseq {
6888ea6989SSamuel Holland		compatible = "mmc-pwrseq-simple";
6988ea6989SSamuel Holland		reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
7088ea6989SSamuel Holland	};
7188ea6989SSamuel Holland};
7288ea6989SSamuel Holland
7388ea6989SSamuel Holland&cpu0 {
7488ea6989SSamuel Holland	cpu-supply = <&reg_vdd_cpu>;
7588ea6989SSamuel Holland};
7688ea6989SSamuel Holland
7788ea6989SSamuel Holland&dcxo {
7888ea6989SSamuel Holland	clock-frequency = <24000000>;
7988ea6989SSamuel Holland};
8088ea6989SSamuel Holland
8188ea6989SSamuel Holland&ehci0 {
8288ea6989SSamuel Holland	status = "okay";
8388ea6989SSamuel Holland};
8488ea6989SSamuel Holland
8588ea6989SSamuel Holland&ehci1 {
8688ea6989SSamuel Holland	status = "okay";
8788ea6989SSamuel Holland};
8888ea6989SSamuel Holland
8988ea6989SSamuel Holland&emac {
9088ea6989SSamuel Holland	pinctrl-0 = <&rgmii_pe_pins>;
9188ea6989SSamuel Holland	pinctrl-names = "default";
9288ea6989SSamuel Holland	phy-handle = <&ext_rgmii_phy>;
9388ea6989SSamuel Holland	phy-mode = "rgmii-id";
9488ea6989SSamuel Holland	phy-supply = <&reg_vcc_3v3>;
9588ea6989SSamuel Holland	status = "okay";
9688ea6989SSamuel Holland};
9788ea6989SSamuel Holland
9888ea6989SSamuel Holland&i2c2 {
9988ea6989SSamuel Holland	pinctrl-0 = <&i2c2_pb0_pins>;
10088ea6989SSamuel Holland	pinctrl-names = "default";
10188ea6989SSamuel Holland	status = "okay";
10288ea6989SSamuel Holland
10388ea6989SSamuel Holland	pcf8574a: gpio@38 {
10488ea6989SSamuel Holland		compatible = "nxp,pcf8574a";
10588ea6989SSamuel Holland		reg = <0x38>;
10688ea6989SSamuel Holland		interrupt-parent = <&pio>;
10788ea6989SSamuel Holland		interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */
10888ea6989SSamuel Holland		interrupt-controller;
10988ea6989SSamuel Holland		gpio-controller;
11088ea6989SSamuel Holland		#gpio-cells = <2>;
11188ea6989SSamuel Holland		#interrupt-cells = <2>;
112*fce449f5STrevor Woerner		gpio-line-names =
113*fce449f5STrevor Woerner			"pin13 [gpio8]",
114*fce449f5STrevor Woerner			"pin16 [gpio10]",
115*fce449f5STrevor Woerner			"pin18 [gpio11]",
116*fce449f5STrevor Woerner			"pin26 [gpio17]",
117*fce449f5STrevor Woerner			"pin22 [gpio14]",
118*fce449f5STrevor Woerner			"pin28 [gpio19]",
119*fce449f5STrevor Woerner			"pin37 [gpio23]",
120*fce449f5STrevor Woerner			"pin11 [gpio6]";
12188ea6989SSamuel Holland	};
12288ea6989SSamuel Holland};
12388ea6989SSamuel Holland
12488ea6989SSamuel Holland&mdio {
12588ea6989SSamuel Holland	ext_rgmii_phy: ethernet-phy@1 {
12688ea6989SSamuel Holland		compatible = "ethernet-phy-ieee802.3-c22";
12788ea6989SSamuel Holland		reg = <1>;
12888ea6989SSamuel Holland	};
12988ea6989SSamuel Holland};
13088ea6989SSamuel Holland
13188ea6989SSamuel Holland&mmc0 {
13288ea6989SSamuel Holland	bus-width = <4>;
13388ea6989SSamuel Holland	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
13488ea6989SSamuel Holland	disable-wp;
13588ea6989SSamuel Holland	vmmc-supply = <&reg_vcc_3v3>;
13688ea6989SSamuel Holland	vqmmc-supply = <&reg_vcc_3v3>;
13788ea6989SSamuel Holland	pinctrl-0 = <&mmc0_pins>;
13888ea6989SSamuel Holland	pinctrl-names = "default";
13988ea6989SSamuel Holland	status = "okay";
14088ea6989SSamuel Holland};
14188ea6989SSamuel Holland
14288ea6989SSamuel Holland&mmc1 {
14388ea6989SSamuel Holland	bus-width = <4>;
14488ea6989SSamuel Holland	mmc-pwrseq = <&wifi_pwrseq>;
14588ea6989SSamuel Holland	non-removable;
14688ea6989SSamuel Holland	vmmc-supply = <&reg_vcc_3v3>;
14788ea6989SSamuel Holland	vqmmc-supply = <&reg_vcc_3v3>;
14888ea6989SSamuel Holland	pinctrl-0 = <&mmc1_pins>;
14988ea6989SSamuel Holland	pinctrl-names = "default";
15088ea6989SSamuel Holland	status = "okay";
15188ea6989SSamuel Holland
15288ea6989SSamuel Holland	xr829: wifi@1 {
15388ea6989SSamuel Holland		reg = <1>;
15488ea6989SSamuel Holland		interrupt-parent = <&pio>;
15588ea6989SSamuel Holland		interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
15688ea6989SSamuel Holland		interrupt-names = "host-wake";
15788ea6989SSamuel Holland	};
15888ea6989SSamuel Holland};
15988ea6989SSamuel Holland
16088ea6989SSamuel Holland&ohci0 {
16188ea6989SSamuel Holland	status = "okay";
16288ea6989SSamuel Holland};
16388ea6989SSamuel Holland
16488ea6989SSamuel Holland&ohci1 {
16588ea6989SSamuel Holland	status = "okay";
16688ea6989SSamuel Holland};
16788ea6989SSamuel Holland
16888ea6989SSamuel Holland&uart0 {
16988ea6989SSamuel Holland	pinctrl-0 = <&uart0_pb8_pins>;
17088ea6989SSamuel Holland	pinctrl-names = "default";
17188ea6989SSamuel Holland	status = "okay";
17288ea6989SSamuel Holland};
17388ea6989SSamuel Holland
17488ea6989SSamuel Holland&uart1 {
17588ea6989SSamuel Holland	uart-has-rtscts;
17688ea6989SSamuel Holland	pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
17788ea6989SSamuel Holland	pinctrl-names = "default";
17888ea6989SSamuel Holland	status = "okay";
17988ea6989SSamuel Holland
18088ea6989SSamuel Holland	/* XR829 bluetooth is connected here */
18188ea6989SSamuel Holland};
18288ea6989SSamuel Holland
18388ea6989SSamuel Holland&usb_otg {
18488ea6989SSamuel Holland	dr_mode = "otg";
18588ea6989SSamuel Holland	status = "okay";
18688ea6989SSamuel Holland};
18788ea6989SSamuel Holland
18888ea6989SSamuel Holland&usbphy {
18988ea6989SSamuel Holland	usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
19088ea6989SSamuel Holland	usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
19188ea6989SSamuel Holland	usb0_vbus-supply = <&reg_usbvbus>;
19288ea6989SSamuel Holland	usb1_vbus-supply = <&reg_vcc>;
19388ea6989SSamuel Holland	status = "okay";
19488ea6989SSamuel Holland};
195*fce449f5STrevor Woerner
196*fce449f5STrevor Woerner&pio {
197*fce449f5STrevor Woerner	gpio-line-names =
198*fce449f5STrevor Woerner		/* Port A */
199*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
200*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
201*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
202*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
203*fce449f5STrevor Woerner		/* Port B */
204*fce449f5STrevor Woerner		"pin5 [gpio2/twi2-sck]",
205*fce449f5STrevor Woerner		"pin3 [gpio1/twi2-sda]",
206*fce449f5STrevor Woerner		"",
207*fce449f5STrevor Woerner		"pin38 [gpio24/i2s2-din]",
208*fce449f5STrevor Woerner		"pin40 [gpio25/i2s2-dout]",
209*fce449f5STrevor Woerner		"pin12 [gpio7/i2s-clk]",
210*fce449f5STrevor Woerner		"pin35 [gpio22/i2s2-lrck]",
211*fce449f5STrevor Woerner		"",
212*fce449f5STrevor Woerner		"pin8 [gpio4/uart0-txd]",
213*fce449f5STrevor Woerner		"pin10 [gpio5/uart0-rxd]",
214*fce449f5STrevor Woerner		"",
215*fce449f5STrevor Woerner		"",
216*fce449f5STrevor Woerner		"pin15 [gpio9]",
217*fce449f5STrevor Woerner		"", "", "", "",
218*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
219*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
220*fce449f5STrevor Woerner		/* Port C */
221*fce449f5STrevor Woerner		"",
222*fce449f5STrevor Woerner		"pin31 [gpio21]",
223*fce449f5STrevor Woerner		"", "", "", "", "", "",
224*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
225*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
226*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
227*fce449f5STrevor Woerner		/* Port D */
228*fce449f5STrevor Woerner		"", "", "", "", "", "", "", "",
229*fce449f5STrevor Woerner		"", "",
230*fce449f5STrevor Woerner		"pin24 [gpio16/spi1-ce0]",
231*fce449f5STrevor Woerner		"pin23 [gpio15/spi1-clk]",
232*fce449f5STrevor Woerner		"pin19 [gpio12/spi1-mosi]",
233*fce449f5STrevor Woerner		"pin21 [gpio13/spi1-miso]",
234*fce449f5STrevor Woerner		"pin27 [gpio18/spi1-hold]",
235*fce449f5STrevor Woerner		"pin29 [gpio20/spi1-wp]",
236*fce449f5STrevor Woerner		"", "", "", "", "", "",
237*fce449f5STrevor Woerner		"pin7 [gpio3/pwm]";
238*fce449f5STrevor Woerner};
239