1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Andreas Färber
4 */
5
6/dts-v1/;
7
8#include "meson-gxbb.dtsi"
9#include <dt-bindings/gpio/gpio.h>
10
11/ {
12	compatible = "friendlyarm,nanopi-k2", "amlogic,meson-gxbb";
13
14	aliases {
15		serial0 = &uart_AO;
16		ethernet0 = &ethmac;
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	memory@0 {
24		device_type = "memory";
25		reg = <0x0 0x0 0x0 0x80000000>;
26	};
27
28	leds {
29		compatible = "gpio-leds";
30
31		stat {
32			label = "nanopi-k2:blue:stat";
33			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
34			default-state = "on";
35			panic-indicator;
36		};
37	};
38
39	vdd_5v: regulator-vdd-5v {
40		compatible = "regulator-fixed";
41		regulator-name = "VDD_5V";
42		regulator-min-microvolt = <5000000>;
43		regulator-max-microvolt = <5000000>;
44	};
45
46	vddio_ao18: regulator-vddio-ao18 {
47		compatible = "regulator-fixed";
48		regulator-name = "VDDIO_AO18";
49		regulator-min-microvolt = <1800000>;
50		regulator-max-microvolt = <1800000>;
51	};
52
53	vddio_ao3v3: regulator-vddio-ao3v3 {
54		compatible = "regulator-fixed";
55		regulator-name = "VDDIO_AO3.3V";
56		regulator-min-microvolt = <3300000>;
57		regulator-max-microvolt = <3300000>;
58	};
59
60	vddio_tf: regulator-vddio-tf {
61		compatible = "regulator-gpio";
62
63		regulator-name = "VDDIO_TF";
64		regulator-min-microvolt = <1800000>;
65		regulator-max-microvolt = <3300000>;
66
67		gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
68		gpios-states = <0>;
69
70		states = <3300000 0>,
71		         <1800000 1>;
72
73		regulator-settling-time-up-us = <100>;
74		regulator-settling-time-down-us = <5000>;
75	};
76
77	wifi_32k: wifi-32k {
78		compatible = "pwm-clock";
79		#clock-cells = <0>;
80		clock-frequency = <32768>;
81		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
82	};
83
84	sdio_pwrseq: sdio-pwrseq {
85		compatible = "mmc-pwrseq-simple";
86		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
87		clocks = <&wifi_32k>;
88		clock-names = "ext_clock";
89	};
90
91	vcc1v8: regulator-vcc1v8 {
92		compatible = "regulator-fixed";
93		regulator-name = "VCC1.8V";
94		regulator-min-microvolt = <1800000>;
95		regulator-max-microvolt = <1800000>;
96	};
97
98	vcc3v3: regulator-vcc3v3 {
99		compatible = "regulator-fixed";
100		regulator-name = "VCC3.3V";
101		regulator-min-microvolt = <3300000>;
102		regulator-max-microvolt = <3300000>;
103	};
104
105	emmc_pwrseq: emmc-pwrseq {
106		compatible = "mmc-pwrseq-emmc";
107		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
108	};
109
110	/* CVBS is available on CON1 pin 36, disabled by default */
111	cvbs-connector {
112		compatible = "composite-video-connector";
113		status = "disabled";
114
115		port {
116			cvbs_connector_in: endpoint {
117				remote-endpoint = <&cvbs_vdac_out>;
118			};
119		};
120	};
121
122	hdmi-connector {
123		compatible = "hdmi-connector";
124		type = "a";
125
126		port {
127			hdmi_connector_in: endpoint {
128				remote-endpoint = <&hdmi_tx_tmds_out>;
129			};
130		};
131	};
132};
133
134&cec_AO {
135	status = "okay";
136	pinctrl-0 = <&ao_cec_pins>;
137	pinctrl-names = "default";
138	hdmi-phandle = <&hdmi_tx>;
139};
140
141&cvbs_vdac_port {
142	cvbs_vdac_out: endpoint {
143		remote-endpoint = <&cvbs_connector_in>;
144	};
145};
146
147&ethmac {
148	status = "okay";
149	pinctrl-0 = <&eth_rgmii_pins>;
150	pinctrl-names = "default";
151
152	phy-handle = <&eth_phy0>;
153	phy-mode = "rgmii";
154
155	amlogic,tx-delay-ns = <2>;
156
157	snps,reset-gpio = <&gpio GPIOZ_14 0>;
158	snps,reset-delays-us = <0 10000 1000000>;
159	snps,reset-active-low;
160
161	mdio {
162		compatible = "snps,dwmac-mdio";
163		#address-cells = <1>;
164		#size-cells = <0>;
165
166		eth_phy0: ethernet-phy@0 {
167			/* Realtek RTL8211F (0x001cc916) */
168			reg = <0>;
169			interrupt-parent = <&gpio_intc>;
170			/* MAC_INTR on GPIOZ_15 */
171			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
172		};
173	};
174};
175
176&hdmi_tx {
177	status = "okay";
178	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
179	pinctrl-names = "default";
180};
181
182&hdmi_tx_tmds_port {
183	hdmi_tx_tmds_out: endpoint {
184		remote-endpoint = <&hdmi_connector_in>;
185	};
186};
187
188&ir {
189	status = "okay";
190	pinctrl-0 = <&remote_input_ao_pins>;
191	pinctrl-names = "default";
192};
193
194&gpio_ao {
195	gpio-line-names = "UART TX", "UART RX", "Power Control", "Power Key In",
196			  "VCCK En", "CON1 Header Pin31",
197			  "I2S Header Pin6", "IR In", "I2S Header Pin7",
198			  "I2S Header Pin3", "I2S Header Pin4",
199			  "I2S Header Pin5", "HDMI CEC", "SYS LED",
200			  /* GPIO_TEST_N */
201			  "";
202};
203
204&gpio {
205	gpio-line-names = /* Bank GPIOZ */
206			  "Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
207			  "Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
208			  "Eth RX D3", "Eth RGMII TX Clk", "Eth TX En",
209			  "Eth TX D0", "Eth TX D1", "Eth TX D2", "Eth TX D3",
210			  "Eth PHY nRESET", "Eth PHY Intc",
211			  /* Bank GPIOH */
212			  "HDMI HPD", "HDMI DDC SDA", "HDMI DDC SCL",
213			  "CON1 Header Pin33",
214			  /* Bank BOOT */
215			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4",
216			  "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk",
217			  "eMMC Reset", "eMMC CMD",
218			  "", "", "", "", "eMMC DS",
219			  "", "",
220			  /* Bank CARD */
221			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
222			  "SDCard D3", "SDCard D2", "SDCard Det",
223			  /* Bank GPIODV */
224			  "", "", "", "", "", "", "", "", "", "", "", "", "",
225			  "", "", "", "", "", "", "", "", "", "", "",
226			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
227			  "VDDEE Regulator", "VCCK Regulator",
228			  /* Bank GPIOY */
229			  "CON1 Header Pin7", "CON1 Header Pin11",
230			  "CON1 Header Pin13", "CON1 Header Pin15",
231			  "CON1 Header Pin18", "CON1 Header Pin19",
232			  "CON1 Header Pin22", "CON1 Header Pin21",
233			  "CON1 Header Pin24", "CON1 Header Pin23",
234			  "CON1 Header Pin26", "CON1 Header Pin29",
235			  "CON1 Header Pin32", "CON1 Header Pin8",
236			  "CON1 Header Pin10", "CON1 Header Pin16",
237			  "CON1 Header Pin12",
238			  /* Bank GPIOX */
239			  "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
240			  "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
241			  "WIFI Power Enable", "WIFI WAKE HOST",
242			  "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
243			  "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
244			  "Bluetooth UART TX", "Bluetooth UART RX",
245			  "Bluetooth UART CTS", "Bluetooth UART RTS",
246			  "", "", "", "WIFI 32K", "Bluetooth Enable",
247			  "Bluetooth WAKE HOST", "",
248			  /* Bank GPIOCLK */
249			  "", "CON1 Header Pin35", "", "";
250};
251
252&pwm_ef {
253	status = "okay";
254	pinctrl-0 = <&pwm_e_pins>;
255	pinctrl-names = "default";
256	clocks = <&clkc CLKID_FCLK_DIV4>;
257	clock-names = "clkin0";
258};
259
260&saradc {
261	status = "okay";
262	vref-supply = <&vddio_ao18>;
263};
264
265/* SDIO */
266&sd_emmc_a {
267	status = "okay";
268	pinctrl-0 = <&sdio_pins>, <&sdio_irq_pins>;
269	pinctrl-1 = <&sdio_clk_gate_pins>;
270	pinctrl-names = "default", "clk-gate";
271	#address-cells = <1>;
272	#size-cells = <0>;
273
274	bus-width = <4>;
275	cap-sd-highspeed;
276	max-frequency = <200000000>;
277
278	non-removable;
279	disable-wp;
280
281	mmc-pwrseq = <&sdio_pwrseq>;
282
283	vmmc-supply = <&vddio_ao3v3>;
284	vqmmc-supply = <&vddio_ao18>;
285
286	brcmf: wifi@1 {
287		compatible = "brcm,bcm4329-fmac";
288		reg = <1>;
289	};
290};
291
292/* SD */
293&sd_emmc_b {
294	status = "okay";
295	pinctrl-0 = <&sdcard_pins>;
296	pinctrl-1 = <&sdcard_clk_gate_pins>;
297	pinctrl-names = "default", "clk-gate";
298
299	bus-width = <4>;
300	cap-sd-highspeed;
301	sd-uhs-sdr12;
302	sd-uhs-sdr25;
303	sd-uhs-sdr50;
304	sd-uhs-sdr104;
305	max-frequency = <200000000>;
306	disable-wp;
307
308	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
309
310	vmmc-supply = <&vddio_ao3v3>;
311	vqmmc-supply = <&vddio_tf>;
312};
313
314/* eMMC */
315&sd_emmc_c {
316	status = "disabled";
317	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
318	pinctrl-1 = <&emmc_clk_gate_pins>;
319	pinctrl-names = "default", "clk-gate";
320
321	bus-width = <8>;
322	max-frequency = <200000000>;
323	non-removable;
324	disable-wp;
325	cap-mmc-highspeed;
326	mmc-ddr-1_8v;
327	mmc-hs200-1_8v;
328
329	mmc-pwrseq = <&emmc_pwrseq>;
330	vmmc-supply = <&vcc3v3>;
331	vqmmc-supply = <&vcc1v8>;
332};
333
334/* DBG_UART */
335&uart_AO {
336	status = "okay";
337	pinctrl-0 = <&uart_ao_a_pins>;
338	pinctrl-names = "default";
339};
340
341/* Bluetooth on AP6212 */
342&uart_A {
343	status = "disabled";
344	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
345	pinctrl-names = "default";
346};
347
348/* 40-pin CON1 */
349&uart_C {
350	status = "disabled";
351	pinctrl-0 = <&uart_c_pins>;
352	pinctrl-names = "default";
353};
354
355&usb0_phy {
356	status = "okay";
357	phy-supply = <&vdd_5v>;
358};
359
360&usb1_phy {
361	status = "okay";
362};
363
364&usb0 {
365	status = "okay";
366};
367
368&usb1 {
369	status = "okay";
370};
371