1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) Jisheng Zhang <jszhang@kernel.org>
4 */
5
6/dts-v1/;
7
8#include "sun50i-h618-longan-module-3h.dtsi"
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/interrupt-controller/arm-gic.h>
12#include <dt-bindings/leds/common.h>
13
14/ {
15	model = "Sipeed Longan Pi 3H";
16	compatible = "sipeed,longan-pi-3h", "sipeed,longan-module-3h", "allwinner,sun50i-h618";
17
18	aliases {
19		ethernet0 = &emac0;
20		serial0 = &uart0;
21	};
22
23	chosen {
24		stdout-path = "serial0:115200n8";
25	};
26
27	leds {
28		compatible = "gpio-leds";
29
30		led-0 {
31			color = <LED_COLOR_ID_ORANGE>;
32			function = LED_FUNCTION_INDICATOR;
33			function-enumerator = <0>;
34			gpios = <&pio 6 2 GPIO_ACTIVE_LOW>; /* PG2 */
35		};
36
37		led-1 {
38			color = <LED_COLOR_ID_ORANGE>;
39			function = LED_FUNCTION_INDICATOR;
40			function-enumerator = <1>;
41			gpios = <&pio 6 4 GPIO_ACTIVE_LOW>; /* PG4 */
42		};
43	};
44
45	reg_vcc5v: regulator-vcc5v {
46		/* board wide 5V supply directly from the USB-C socket */
47		compatible = "regulator-fixed";
48		regulator-name = "vcc-5v";
49		regulator-min-microvolt = <5000000>;
50		regulator-max-microvolt = <5000000>;
51		regulator-always-on;
52	};
53
54	reg_vcc3v3: regulator-vcc3v3 {
55		compatible = "regulator-fixed";
56		regulator-name = "vcc-3v3";
57		regulator-min-microvolt = <3300000>;
58		regulator-max-microvolt = <3300000>;
59		regulator-always-on;
60		vin-supply = <&reg_vcc5v>;
61	};
62};
63
64&axp313 {
65	vin1-supply = <&reg_vcc5v>;
66	vin2-supply = <&reg_vcc5v>;
67	vin3-supply = <&reg_vcc5v>;
68};
69
70&ehci1 {
71	status = "okay";
72};
73
74&ohci1 {
75	status = "okay";
76};
77
78&ehci2 {
79	status = "okay";
80};
81
82&ohci2 {
83	status = "okay";
84};
85
86/* WiFi & BT combo module is connected to this Host */
87&ehci3 {
88	status = "okay";
89};
90
91&ohci3 {
92	status = "okay";
93};
94
95&emac0 {
96	pinctrl-names = "default";
97	pinctrl-0 = <&ext_rgmii_pins>;
98	phy-mode = "rgmii";
99	phy-handle = <&ext_rgmii_phy>;
100	allwinner,rx-delay-ps = <3100>;
101	allwinner,tx-delay-ps = <700>;
102	phy-supply = <&reg_vcc3v3>;
103	status = "okay";
104};
105
106&mdio0 {
107	ext_rgmii_phy: ethernet-phy@1 {
108		compatible = "ethernet-phy-ieee802.3-c22";
109		reg = <1>;
110	};
111};
112
113&mmc0 {
114	bus-width = <4>;
115	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;	/* PF6 */
116	vmmc-supply = <&reg_vcc3v3>;
117	status = "okay";
118};
119
120&uart0 {
121	status = "okay";
122};
123
124&usbotg {
125	/*
126	 * PHY0 pins are connected to a USB-C socket, but a role switch
127	 * is not implemented: both CC pins are pulled to GND.
128	 * The VBUS pins power the device, so a fixed peripheral mode
129	 * is the best choice.
130	 * The board can be powered via GPIOs, in this case port0 *can*
131	 * act as a host (with a cable/adapter ignoring CC), as VBUS is
132	 * then provided by the GPIOs. Any user of this setup would
133	 * need to adjust the DT accordingly: dr_mode set to "host",
134	 * enabling OHCI0 and EHCI0.
135	 */
136	dr_mode = "peripheral";
137	status = "okay";
138};
139
140&usbphy {
141	usb1_vbus-supply = <&reg_vcc5v>;
142	usb2_vbus-supply = <&reg_vcc5v>;
143	status = "okay";
144};
145