1// SPDX-License-Identifier: GPL-2.0+ OR MIT
2// Copyright (C) 2021 Ivan Uvarov <i.uvarov@cognitivepilot.com>
3// Based on the sun8i-r40-bananapi-m2-ultra.dts, which is:
4//	Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
5//	Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
6
7/dts-v1/;
8#include "sun8i-r40-feta40i.dtsi"
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/leds/common.h>
12
13/ {
14	model = "Forlinx OKA40i-C";
15	compatible = "forlinx,oka40i-c", "forlinx,feta40i-c", "allwinner,sun8i-r40";
16
17	aliases {
18		ethernet0 = &gmac;
19		serial0 = &uart0;
20		serial2 = &uart2;
21		serial3 = &uart3;
22		serial4 = &uart4;
23		serial5 = &uart5; /* RS485 */
24		serial7 = &uart7;
25	};
26
27	chosen {
28		stdout-path = "serial0:115200n8";
29	};
30
31	connector {
32		compatible = "hdmi-connector";
33		type = "a";
34
35		port {
36			hdmi_con_in: endpoint {
37				remote-endpoint = <&hdmi_out_con>;
38			};
39		};
40	};
41
42	leds {
43		compatible = "gpio-leds";
44
45		led-5 { /* this is how the leds are labeled on the board */
46			gpios = <&pio 7 26 GPIO_ACTIVE_LOW>; /* PH26 */
47			color = <LED_COLOR_ID_GREEN>;
48			function = LED_FUNCTION_STATUS;
49		};
50
51		led-6 {
52			gpios = <&pio 8 15 GPIO_ACTIVE_LOW>; /* PI15 */
53			color = <LED_COLOR_ID_BLUE>;
54			function = LED_FUNCTION_STATUS;
55		};
56	};
57
58	reg_vcc5v0: vcc5v0 {
59		compatible = "regulator-fixed";
60		regulator-name = "vcc5v0";
61		regulator-min-microvolt = <5000000>;
62		regulator-max-microvolt = <5000000>;
63	};
64
65	wifi_pwrseq: wifi_pwrseq {
66		compatible = "mmc-pwrseq-simple";
67		reset-gpios = <&pio 1 10 GPIO_ACTIVE_LOW>; // PB10 WIFI_EN
68		clocks = <&ccu CLK_OUTA>;
69		clock-names = "ext_clock";
70	};
71};
72
73&ahci {
74	ahci-supply = <&reg_dldo4>;
75	phy-supply = <&reg_eldo2>;
76	status = "okay";
77};
78
79&de {
80	status = "okay";
81};
82
83&ehci1 {
84	status = "okay";
85};
86
87&ehci2 {
88	status = "okay";
89};
90
91&gmac {
92	pinctrl-names = "default";
93	pinctrl-0 = <&gmac_rgmii_pins>;
94	phy-handle = <&phy1>;
95	phy-mode = "rgmii-id";
96	phy-supply = <&reg_dcdc1>;
97	status = "okay";
98};
99
100&gmac_mdio {
101	phy1: ethernet-phy@1 {
102		compatible = "ethernet-phy-ieee802.3-c22";
103		reg = <1>;
104	};
105};
106
107&hdmi {
108	status = "okay";
109};
110
111&hdmi_out {
112	hdmi_out_con: endpoint {
113		remote-endpoint = <&hdmi_con_in>;
114	};
115};
116
117&i2c2 {
118	status = "okay";
119};
120
121&mmc0 {
122	vmmc-supply = <&reg_dcdc1>;
123	vqmmc-supply = <&reg_dcdc1>;
124	bus-width = <4>;
125	cd-gpios = <&pio 8 11 GPIO_ACTIVE_LOW>; // PI11
126	status = "okay";
127};
128
129&mmc3 {
130	vmmc-supply = <&reg_dcdc1>;
131	vqmmc-supply = <&reg_dcdc1>;
132	bus-width = <4>;
133	cd-gpios = <&pio 8 10 GPIO_ACTIVE_LOW>; // PI10
134	status = "okay";
135};
136
137&ohci1 {
138	status = "okay";
139};
140
141&ohci2 {
142	status = "okay";
143};
144
145&reg_dc1sw {
146	regulator-min-microvolt = <3300000>;
147	regulator-max-microvolt = <3300000>;
148	regulator-name = "vcc-lcd";
149};
150
151&reg_dldo2 {
152	regulator-min-microvolt = <3300000>;
153	regulator-max-microvolt = <3300000>;
154	regulator-name = "vcc-wifi";
155};
156
157&tcon_tv0 {
158	status = "okay";
159};
160
161&uart0 {
162	pinctrl-names = "default";
163	pinctrl-0 = <&uart0_pb_pins>;
164	status = "okay";
165};
166
167&uart2 {
168	pinctrl-names = "default";
169	pinctrl-0 = <&uart2_pi_pins>, <&uart2_rts_cts_pi_pins>;
170	uart-has-rtscts;
171	status = "okay";
172};
173
174&uart3 {
175	pinctrl-names = "default";
176	pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
177	uart-has-rtscts;
178	status = "okay";
179};
180
181&uart4 {
182	pinctrl-names = "default";
183	pinctrl-0 = <&uart4_pg_pins>;
184	status = "okay";
185};
186
187&uart5 { /* RS485 */
188	pinctrl-names = "default";
189	pinctrl-0 = <&uart5_ph_pins>;
190	status = "okay";
191};
192
193&uart7 {
194	pinctrl-names = "default";
195	pinctrl-0 = <&uart7_pi_pins>;
196	status = "okay";
197};
198
199&usbphy {
200	usb1_vbus-supply = <&reg_vcc5v0>;
201	usb2_vbus-supply = <&reg_vcc5v0>;
202	status = "okay";
203};
204