xref: /freebsd-src/sys/contrib/device-tree/src/riscv/allwinner/sun20i-d1-nezha.dts (revision 84943d6f38e936ac3b7a3947ca26eeb27a39f938)
1*84943d6fSEmmanuel Vadot// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2cb7aa33aSEmmanuel Vadot// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
3cb7aa33aSEmmanuel Vadot
4fac71e4eSEmmanuel Vadot/*
5fac71e4eSEmmanuel Vadot * gpio line names
6fac71e4eSEmmanuel Vadot *
7fac71e4eSEmmanuel Vadot * The Nezha-D1 has a 40-pin IO header. Some of these pins are routed
8fac71e4eSEmmanuel Vadot * directly to pads on the SoC, others come from an 8-bit pcf857x IO
9fac71e4eSEmmanuel Vadot * expander. Therefore, these line names are specified in two places:
10fac71e4eSEmmanuel Vadot * one set for the pcf857x, and one set for the pio controller.
11fac71e4eSEmmanuel Vadot *
12fac71e4eSEmmanuel Vadot * Lines which are routed to the 40-pin header are named as follows:
13fac71e4eSEmmanuel Vadot *	<pin#> [<pin name>]
14fac71e4eSEmmanuel Vadot * where:
15fac71e4eSEmmanuel Vadot *	<pin#>		is the actual pin number of the 40-pin header
16fac71e4eSEmmanuel Vadot *	<pin name>	is the name of the pin by function/gpio#
17fac71e4eSEmmanuel Vadot *
18fac71e4eSEmmanuel Vadot * For details regarding pin numbers and names see the schematics (under
19fac71e4eSEmmanuel Vadot * "IO EXPAND"):
20fac71e4eSEmmanuel Vadot * http://dl.linux-sunxi.org/D1/D1_Nezha_development_board_schematic_diagram_20210224.pdf
21fac71e4eSEmmanuel Vadot */
22fac71e4eSEmmanuel Vadot
23cb7aa33aSEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
24cb7aa33aSEmmanuel Vadot#include <dt-bindings/input/input.h>
25cb7aa33aSEmmanuel Vadot
26cb7aa33aSEmmanuel Vadot/dts-v1/;
27cb7aa33aSEmmanuel Vadot
28cb7aa33aSEmmanuel Vadot#include "sun20i-d1.dtsi"
29cb7aa33aSEmmanuel Vadot#include "sun20i-common-regulators.dtsi"
30cb7aa33aSEmmanuel Vadot
31cb7aa33aSEmmanuel Vadot/ {
32cb7aa33aSEmmanuel Vadot	model = "Allwinner D1 Nezha";
33cb7aa33aSEmmanuel Vadot	compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
34cb7aa33aSEmmanuel Vadot
35cb7aa33aSEmmanuel Vadot	aliases {
36cb7aa33aSEmmanuel Vadot		ethernet0 = &emac;
37cb7aa33aSEmmanuel Vadot		ethernet1 = &xr829;
38cb7aa33aSEmmanuel Vadot		serial0 = &uart0;
39cb7aa33aSEmmanuel Vadot	};
40cb7aa33aSEmmanuel Vadot
41cb7aa33aSEmmanuel Vadot	chosen {
42cb7aa33aSEmmanuel Vadot		stdout-path = "serial0:115200n8";
43cb7aa33aSEmmanuel Vadot	};
44cb7aa33aSEmmanuel Vadot
45cb7aa33aSEmmanuel Vadot	reg_usbvbus: usbvbus {
46cb7aa33aSEmmanuel Vadot		compatible = "regulator-fixed";
47cb7aa33aSEmmanuel Vadot		regulator-name = "usbvbus";
48cb7aa33aSEmmanuel Vadot		regulator-min-microvolt = <5000000>;
49cb7aa33aSEmmanuel Vadot		regulator-max-microvolt = <5000000>;
50cb7aa33aSEmmanuel Vadot		gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
51cb7aa33aSEmmanuel Vadot		enable-active-high;
52cb7aa33aSEmmanuel Vadot		vin-supply = <&reg_vcc>;
53cb7aa33aSEmmanuel Vadot	};
54cb7aa33aSEmmanuel Vadot
55cb7aa33aSEmmanuel Vadot	/*
56cb7aa33aSEmmanuel Vadot	 * This regulator is PWM-controlled, but the PWM controller is not
57cb7aa33aSEmmanuel Vadot	 * yet supported, so fix the regulator to its default voltage.
58cb7aa33aSEmmanuel Vadot	 */
59cb7aa33aSEmmanuel Vadot	reg_vdd_cpu: vdd-cpu {
60cb7aa33aSEmmanuel Vadot		compatible = "regulator-fixed";
61cb7aa33aSEmmanuel Vadot		regulator-name = "vdd-cpu";
62cb7aa33aSEmmanuel Vadot		regulator-min-microvolt = <1100000>;
63cb7aa33aSEmmanuel Vadot		regulator-max-microvolt = <1100000>;
64cb7aa33aSEmmanuel Vadot		vin-supply = <&reg_vcc>;
65cb7aa33aSEmmanuel Vadot	};
66cb7aa33aSEmmanuel Vadot
67cb7aa33aSEmmanuel Vadot	wifi_pwrseq: wifi-pwrseq {
68cb7aa33aSEmmanuel Vadot		compatible = "mmc-pwrseq-simple";
69cb7aa33aSEmmanuel Vadot		reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
70cb7aa33aSEmmanuel Vadot	};
71cb7aa33aSEmmanuel Vadot};
72cb7aa33aSEmmanuel Vadot
73cb7aa33aSEmmanuel Vadot&cpu0 {
74cb7aa33aSEmmanuel Vadot	cpu-supply = <&reg_vdd_cpu>;
75cb7aa33aSEmmanuel Vadot};
76cb7aa33aSEmmanuel Vadot
77cb7aa33aSEmmanuel Vadot&dcxo {
78cb7aa33aSEmmanuel Vadot	clock-frequency = <24000000>;
79cb7aa33aSEmmanuel Vadot};
80cb7aa33aSEmmanuel Vadot
81cb7aa33aSEmmanuel Vadot&ehci0 {
82cb7aa33aSEmmanuel Vadot	status = "okay";
83cb7aa33aSEmmanuel Vadot};
84cb7aa33aSEmmanuel Vadot
85cb7aa33aSEmmanuel Vadot&ehci1 {
86cb7aa33aSEmmanuel Vadot	status = "okay";
87cb7aa33aSEmmanuel Vadot};
88cb7aa33aSEmmanuel Vadot
89cb7aa33aSEmmanuel Vadot&emac {
90cb7aa33aSEmmanuel Vadot	pinctrl-0 = <&rgmii_pe_pins>;
91cb7aa33aSEmmanuel Vadot	pinctrl-names = "default";
92cb7aa33aSEmmanuel Vadot	phy-handle = <&ext_rgmii_phy>;
93cb7aa33aSEmmanuel Vadot	phy-mode = "rgmii-id";
94cb7aa33aSEmmanuel Vadot	phy-supply = <&reg_vcc_3v3>;
95cb7aa33aSEmmanuel Vadot	status = "okay";
96cb7aa33aSEmmanuel Vadot};
97cb7aa33aSEmmanuel Vadot
98cb7aa33aSEmmanuel Vadot&i2c2 {
99cb7aa33aSEmmanuel Vadot	pinctrl-0 = <&i2c2_pb0_pins>;
100cb7aa33aSEmmanuel Vadot	pinctrl-names = "default";
101cb7aa33aSEmmanuel Vadot	status = "okay";
102cb7aa33aSEmmanuel Vadot
103cb7aa33aSEmmanuel Vadot	pcf8574a: gpio@38 {
104cb7aa33aSEmmanuel Vadot		compatible = "nxp,pcf8574a";
105cb7aa33aSEmmanuel Vadot		reg = <0x38>;
106cb7aa33aSEmmanuel Vadot		interrupt-parent = <&pio>;
107cb7aa33aSEmmanuel Vadot		interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */
108cb7aa33aSEmmanuel Vadot		interrupt-controller;
109cb7aa33aSEmmanuel Vadot		gpio-controller;
110cb7aa33aSEmmanuel Vadot		#gpio-cells = <2>;
111cb7aa33aSEmmanuel Vadot		#interrupt-cells = <2>;
112fac71e4eSEmmanuel Vadot		gpio-line-names =
113fac71e4eSEmmanuel Vadot			"pin13 [gpio8]",
114fac71e4eSEmmanuel Vadot			"pin16 [gpio10]",
115fac71e4eSEmmanuel Vadot			"pin18 [gpio11]",
116fac71e4eSEmmanuel Vadot			"pin26 [gpio17]",
117fac71e4eSEmmanuel Vadot			"pin22 [gpio14]",
118fac71e4eSEmmanuel Vadot			"pin28 [gpio19]",
119fac71e4eSEmmanuel Vadot			"pin37 [gpio23]",
120fac71e4eSEmmanuel Vadot			"pin11 [gpio6]";
121cb7aa33aSEmmanuel Vadot	};
122cb7aa33aSEmmanuel Vadot};
123cb7aa33aSEmmanuel Vadot
124cb7aa33aSEmmanuel Vadot&mdio {
125cb7aa33aSEmmanuel Vadot	ext_rgmii_phy: ethernet-phy@1 {
126cb7aa33aSEmmanuel Vadot		compatible = "ethernet-phy-ieee802.3-c22";
127cb7aa33aSEmmanuel Vadot		reg = <1>;
128cb7aa33aSEmmanuel Vadot	};
129cb7aa33aSEmmanuel Vadot};
130cb7aa33aSEmmanuel Vadot
131cb7aa33aSEmmanuel Vadot&mmc0 {
132cb7aa33aSEmmanuel Vadot	bus-width = <4>;
133cb7aa33aSEmmanuel Vadot	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
134cb7aa33aSEmmanuel Vadot	disable-wp;
135cb7aa33aSEmmanuel Vadot	vmmc-supply = <&reg_vcc_3v3>;
136cb7aa33aSEmmanuel Vadot	vqmmc-supply = <&reg_vcc_3v3>;
137cb7aa33aSEmmanuel Vadot	pinctrl-0 = <&mmc0_pins>;
138cb7aa33aSEmmanuel Vadot	pinctrl-names = "default";
139cb7aa33aSEmmanuel Vadot	status = "okay";
140cb7aa33aSEmmanuel Vadot};
141cb7aa33aSEmmanuel Vadot
142cb7aa33aSEmmanuel Vadot&mmc1 {
143cb7aa33aSEmmanuel Vadot	bus-width = <4>;
144cb7aa33aSEmmanuel Vadot	mmc-pwrseq = <&wifi_pwrseq>;
145cb7aa33aSEmmanuel Vadot	non-removable;
146cb7aa33aSEmmanuel Vadot	vmmc-supply = <&reg_vcc_3v3>;
147cb7aa33aSEmmanuel Vadot	vqmmc-supply = <&reg_vcc_3v3>;
148cb7aa33aSEmmanuel Vadot	pinctrl-0 = <&mmc1_pins>;
149cb7aa33aSEmmanuel Vadot	pinctrl-names = "default";
150cb7aa33aSEmmanuel Vadot	status = "okay";
151cb7aa33aSEmmanuel Vadot
152cb7aa33aSEmmanuel Vadot	xr829: wifi@1 {
153cb7aa33aSEmmanuel Vadot		reg = <1>;
154cb7aa33aSEmmanuel Vadot		interrupt-parent = <&pio>;
155cb7aa33aSEmmanuel Vadot		interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
156cb7aa33aSEmmanuel Vadot		interrupt-names = "host-wake";
157cb7aa33aSEmmanuel Vadot	};
158cb7aa33aSEmmanuel Vadot};
159cb7aa33aSEmmanuel Vadot
160cb7aa33aSEmmanuel Vadot&ohci0 {
161cb7aa33aSEmmanuel Vadot	status = "okay";
162cb7aa33aSEmmanuel Vadot};
163cb7aa33aSEmmanuel Vadot
164cb7aa33aSEmmanuel Vadot&ohci1 {
165cb7aa33aSEmmanuel Vadot	status = "okay";
166cb7aa33aSEmmanuel Vadot};
167cb7aa33aSEmmanuel Vadot
168cb7aa33aSEmmanuel Vadot&uart0 {
169cb7aa33aSEmmanuel Vadot	pinctrl-0 = <&uart0_pb8_pins>;
170cb7aa33aSEmmanuel Vadot	pinctrl-names = "default";
171cb7aa33aSEmmanuel Vadot	status = "okay";
172cb7aa33aSEmmanuel Vadot};
173cb7aa33aSEmmanuel Vadot
174cb7aa33aSEmmanuel Vadot&uart1 {
175cb7aa33aSEmmanuel Vadot	uart-has-rtscts;
176cb7aa33aSEmmanuel Vadot	pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
177cb7aa33aSEmmanuel Vadot	pinctrl-names = "default";
178cb7aa33aSEmmanuel Vadot	status = "okay";
179cb7aa33aSEmmanuel Vadot
180cb7aa33aSEmmanuel Vadot	/* XR829 bluetooth is connected here */
181cb7aa33aSEmmanuel Vadot};
182cb7aa33aSEmmanuel Vadot
183cb7aa33aSEmmanuel Vadot&usb_otg {
184cb7aa33aSEmmanuel Vadot	dr_mode = "otg";
185cb7aa33aSEmmanuel Vadot	status = "okay";
186cb7aa33aSEmmanuel Vadot};
187cb7aa33aSEmmanuel Vadot
188cb7aa33aSEmmanuel Vadot&usbphy {
189cb7aa33aSEmmanuel Vadot	usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
190cb7aa33aSEmmanuel Vadot	usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
191cb7aa33aSEmmanuel Vadot	usb0_vbus-supply = <&reg_usbvbus>;
192cb7aa33aSEmmanuel Vadot	usb1_vbus-supply = <&reg_vcc>;
193cb7aa33aSEmmanuel Vadot	status = "okay";
194cb7aa33aSEmmanuel Vadot};
195fac71e4eSEmmanuel Vadot
196fac71e4eSEmmanuel Vadot&pio {
197fac71e4eSEmmanuel Vadot	gpio-line-names =
198fac71e4eSEmmanuel Vadot		/* Port A */
199fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
200fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
201fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
202fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
203fac71e4eSEmmanuel Vadot		/* Port B */
204fac71e4eSEmmanuel Vadot		"pin5 [gpio2/twi2-sck]",
205fac71e4eSEmmanuel Vadot		"pin3 [gpio1/twi2-sda]",
206fac71e4eSEmmanuel Vadot		"",
207fac71e4eSEmmanuel Vadot		"pin38 [gpio24/i2s2-din]",
208fac71e4eSEmmanuel Vadot		"pin40 [gpio25/i2s2-dout]",
209fac71e4eSEmmanuel Vadot		"pin12 [gpio7/i2s-clk]",
210fac71e4eSEmmanuel Vadot		"pin35 [gpio22/i2s2-lrck]",
211fac71e4eSEmmanuel Vadot		"",
212fac71e4eSEmmanuel Vadot		"pin8 [gpio4/uart0-txd]",
213fac71e4eSEmmanuel Vadot		"pin10 [gpio5/uart0-rxd]",
214fac71e4eSEmmanuel Vadot		"",
215fac71e4eSEmmanuel Vadot		"",
216fac71e4eSEmmanuel Vadot		"pin15 [gpio9]",
217fac71e4eSEmmanuel Vadot		"", "", "", "",
218fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
219fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
220fac71e4eSEmmanuel Vadot		/* Port C */
221fac71e4eSEmmanuel Vadot		"",
222fac71e4eSEmmanuel Vadot		"pin31 [gpio21]",
223fac71e4eSEmmanuel Vadot		"", "", "", "", "", "",
224fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
225fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
226fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
227fac71e4eSEmmanuel Vadot		/* Port D */
228fac71e4eSEmmanuel Vadot		"", "", "", "", "", "", "", "",
229fac71e4eSEmmanuel Vadot		"", "",
230fac71e4eSEmmanuel Vadot		"pin24 [gpio16/spi1-ce0]",
231fac71e4eSEmmanuel Vadot		"pin23 [gpio15/spi1-clk]",
232fac71e4eSEmmanuel Vadot		"pin19 [gpio12/spi1-mosi]",
233fac71e4eSEmmanuel Vadot		"pin21 [gpio13/spi1-miso]",
234fac71e4eSEmmanuel Vadot		"pin27 [gpio18/spi1-hold]",
235fac71e4eSEmmanuel Vadot		"pin29 [gpio20/spi1-wp]",
236fac71e4eSEmmanuel Vadot		"", "", "", "", "", "",
237fac71e4eSEmmanuel Vadot		"pin7 [gpio3/pwm]";
238fac71e4eSEmmanuel Vadot};
239