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