1// SPDX-License-Identifier: (GPL-2.0+ or MIT)
2// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
3
4#include <dt-bindings/gpio/gpio.h>
5#include <dt-bindings/input/input.h>
6
7/dts-v1/;
8
9#include "sun20i-d1.dtsi"
10#include "sun20i-common-regulators.dtsi"
11
12/ {
13	model = "Allwinner D1 Nezha";
14	compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
15
16	aliases {
17		ethernet0 = &emac;
18		ethernet1 = &xr829;
19		serial0 = &uart0;
20	};
21
22	chosen {
23		stdout-path = "serial0:115200n8";
24	};
25
26	reg_usbvbus: usbvbus {
27		compatible = "regulator-fixed";
28		regulator-name = "usbvbus";
29		regulator-min-microvolt = <5000000>;
30		regulator-max-microvolt = <5000000>;
31		gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
32		enable-active-high;
33		vin-supply = <&reg_vcc>;
34	};
35
36	/*
37	 * This regulator is PWM-controlled, but the PWM controller is not
38	 * yet supported, so fix the regulator to its default voltage.
39	 */
40	reg_vdd_cpu: vdd-cpu {
41		compatible = "regulator-fixed";
42		regulator-name = "vdd-cpu";
43		regulator-min-microvolt = <1100000>;
44		regulator-max-microvolt = <1100000>;
45		vin-supply = <&reg_vcc>;
46	};
47
48	wifi_pwrseq: wifi-pwrseq {
49		compatible = "mmc-pwrseq-simple";
50		reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
51	};
52};
53
54&cpu0 {
55	cpu-supply = <&reg_vdd_cpu>;
56};
57
58&dcxo {
59	clock-frequency = <24000000>;
60};
61
62&ehci0 {
63	status = "okay";
64};
65
66&ehci1 {
67	status = "okay";
68};
69
70&emac {
71	pinctrl-0 = <&rgmii_pe_pins>;
72	pinctrl-names = "default";
73	phy-handle = <&ext_rgmii_phy>;
74	phy-mode = "rgmii-id";
75	phy-supply = <&reg_vcc_3v3>;
76	status = "okay";
77};
78
79&i2c2 {
80	pinctrl-0 = <&i2c2_pb0_pins>;
81	pinctrl-names = "default";
82	status = "okay";
83
84	pcf8574a: gpio@38 {
85		compatible = "nxp,pcf8574a";
86		reg = <0x38>;
87		interrupt-parent = <&pio>;
88		interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */
89		interrupt-controller;
90		gpio-controller;
91		#gpio-cells = <2>;
92		#interrupt-cells = <2>;
93	};
94};
95
96&mdio {
97	ext_rgmii_phy: ethernet-phy@1 {
98		compatible = "ethernet-phy-ieee802.3-c22";
99		reg = <1>;
100	};
101};
102
103&mmc0 {
104	bus-width = <4>;
105	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
106	disable-wp;
107	vmmc-supply = <&reg_vcc_3v3>;
108	vqmmc-supply = <&reg_vcc_3v3>;
109	pinctrl-0 = <&mmc0_pins>;
110	pinctrl-names = "default";
111	status = "okay";
112};
113
114&mmc1 {
115	bus-width = <4>;
116	mmc-pwrseq = <&wifi_pwrseq>;
117	non-removable;
118	vmmc-supply = <&reg_vcc_3v3>;
119	vqmmc-supply = <&reg_vcc_3v3>;
120	pinctrl-0 = <&mmc1_pins>;
121	pinctrl-names = "default";
122	status = "okay";
123
124	xr829: wifi@1 {
125		reg = <1>;
126		interrupt-parent = <&pio>;
127		interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
128		interrupt-names = "host-wake";
129	};
130};
131
132&ohci0 {
133	status = "okay";
134};
135
136&ohci1 {
137	status = "okay";
138};
139
140&uart0 {
141	pinctrl-0 = <&uart0_pb8_pins>;
142	pinctrl-names = "default";
143	status = "okay";
144};
145
146&uart1 {
147	uart-has-rtscts;
148	pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
149	pinctrl-names = "default";
150	status = "okay";
151
152	/* XR829 bluetooth is connected here */
153};
154
155&usb_otg {
156	dr_mode = "otg";
157	status = "okay";
158};
159
160&usbphy {
161	usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
162	usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
163	usb0_vbus-supply = <&reg_usbvbus>;
164	usb1_vbus-supply = <&reg_vcc>;
165	status = "okay";
166};
167