1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
4 */
5
6/dts-v1/;
7
8#include "meson-gxl-s905x-p212.dtsi"
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/sound/meson-aiu.h>
11
12/ {
13	compatible = "khadas,vim", "amlogic,s905x", "amlogic,meson-gxl";
14	model = "Khadas VIM";
15
16	adc-keys {
17		compatible = "adc-keys";
18		io-channels = <&saradc 0>;
19		io-channel-names = "buttons";
20		keyup-threshold-microvolt = <1710000>;
21
22		button-function {
23			label = "Function";
24			linux,code = <KEY_FN>;
25			press-threshold-microvolt = <10000>;
26		};
27	};
28
29	aliases {
30		serial2 = &uart_AO_B;
31		ethernet0 = &ethmac;
32	};
33
34	gpio-keys-polled {
35		compatible = "gpio-keys-polled";
36		poll-interval = <100>;
37
38		power-button {
39			label = "power";
40			linux,code = <KEY_POWER>;
41			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
42		};
43	};
44
45	led-controller {
46		compatible = "pwm-leds";
47
48		led-1 {
49			label = "vim:red:power";
50			pwms = <&pwm_AO_ab 1 7812500 0>;
51			max-brightness = <255>;
52			linux,default-trigger = "default-on";
53		};
54	};
55
56	hdmi-connector {
57		compatible = "hdmi-connector";
58		type = "a";
59
60		port {
61			hdmi_connector_in: endpoint {
62				remote-endpoint = <&hdmi_tx_tmds_out>;
63			};
64		};
65	};
66
67	sound {
68		compatible = "amlogic,gx-sound-card";
69		model = "KHADAS-VIM";
70		assigned-clocks = <&clkc CLKID_MPLL0>,
71				  <&clkc CLKID_MPLL1>,
72				  <&clkc CLKID_MPLL2>;
73		assigned-clock-parents = <0>, <0>, <0>;
74		assigned-clock-rates = <294912000>,
75				       <270950400>,
76				       <393216000>;
77		status = "okay";
78
79		dai-link-0 {
80			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
81		};
82
83		dai-link-1 {
84			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
85			dai-format = "i2s";
86			mclk-fs = <256>;
87
88			codec-0 {
89				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
90			};
91		};
92
93		dai-link-2 {
94			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
95
96			codec-0 {
97				sound-dai = <&hdmi_tx>;
98			};
99		};
100	};
101};
102
103&aiu {
104	status = "okay";
105};
106
107&cec_AO {
108	status = "okay";
109	pinctrl-0 = <&ao_cec_pins>;
110	pinctrl-names = "default";
111	hdmi-phandle = <&hdmi_tx>;
112};
113
114&hdmi_tx {
115	status = "okay";
116	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
117	pinctrl-names = "default";
118	hdmi-supply = <&hdmi_5v>;
119};
120
121&hdmi_tx_tmds_port {
122	hdmi_tx_tmds_out: endpoint {
123		remote-endpoint = <&hdmi_connector_in>;
124	};
125};
126
127&i2c_A {
128	status = "okay";
129	pinctrl-0 = <&i2c_a_pins>;
130	pinctrl-names = "default";
131};
132
133&i2c_B {
134	status = "okay";
135	pinctrl-0 = <&i2c_b_pins>;
136	pinctrl-names = "default";
137
138	rtc: rtc@51 {
139		status = "okay";
140		compatible = "haoyu,hym8563";
141		reg = <0x51>;
142		#clock-cells = <0>;
143		clock-frequency = <32768>;
144		clock-output-names = "xin32k";
145	};
146};
147
148&ir {
149	linux,rc-map-name = "rc-khadas";
150};
151
152&gpio_ao {
153	gpio-line-names = "UART TX",
154			  "UART RX",
155			  "Power Key In",
156			  "J9 Header Pin35",
157			  "J9 Header Pin16",
158			  "J9 Header Pin15",
159			  "J9 Header Pin33",
160			  "IR In",
161			  "HDMI CEC",
162			  "SYS LED",
163			  /* GPIO_TEST_N */
164			  "";
165};
166
167&gpio {
168	gpio-line-names = /* Bank GPIOZ */
169			  "", "", "", "", "", "", "",
170			  "", "", "", "", "", "", "",
171			  "Power OFF",
172			  "VCCK Enable",
173			  /* Bank GPIOH */
174			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
175			  "HDMI_5V_EN", "SPDIF",
176			  "J9 Header Pin37",
177			  "J9 Header Pin30",
178			  "J9 Header Pin29",
179			  "J9 Header Pin32",
180			  "J9 Header Pin31",
181			  /* Bank BOOT */
182			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
183			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
184			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
185			  "", "BOOT_MODE", "", "", "eMMC Data Strobe",
186			  /* Bank CARD */
187			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
188			  "SDCard D3", "SDCard D2", "SDCard Det",
189			  /* Bank GPIODV */
190			  "", "", "", "", "", "", "", "", "", "", "", "",
191			  "", "", "", "", "", "", "", "", "", "", "", "",
192			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
193			  "VCCK Regulator", "VDDEE Regulator",
194			  /* Bank GPIOX */
195			  "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
196			  "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
197			  "WIFI Power Enable", "WIFI WAKE HOST",
198			  "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
199			  "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
200			  "Bluetooth UART TX", "Bluetooth UART RX",
201			  "Bluetooth UART CTS", "Bluetooth UART RTS",
202			  "WIFI 32K", "Bluetooth Enable",
203			  "Bluetooth WAKE HOST",
204			  /* Bank GPIOCLK */
205			  "", "J9 Header Pin39";
206};
207
208&pwm_AO_ab {
209	status = "okay";
210	pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
211	pinctrl-names = "default";
212	clocks = <&xtal> , <&xtal>;
213	clock-names = "clkin0", "clkin1" ;
214};
215
216&pwm_ef {
217	pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
218};
219
220&sd_emmc_a {
221	brcmf: wifi@1 {
222		reg = <1>;
223		compatible = "brcm,bcm4329-fmac";
224	};
225};
226
227&uart_A {
228	bluetooth {
229		compatible = "brcm,bcm43438-bt";
230		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
231		max-speed = <2000000>;
232		clocks = <&wifi32k>;
233		clock-names = "lpo";
234	};
235};
236
237/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
238&uart_AO {
239	status = "okay";
240};
241
242/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
243&uart_AO_B {
244	status = "okay";
245	pinctrl-0 = <&uart_ao_b_pins>;
246	pinctrl-names = "default";
247};
248
249&usb {
250	dr_mode = "peripheral";
251};
252