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
78		dai-link-0 {
79			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
80		};
81
82		dai-link-1 {
83			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
84			dai-format = "i2s";
85			mclk-fs = <256>;
86
87			codec-0 {
88				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
89			};
90		};
91
92		dai-link-2 {
93			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
94
95			codec-0 {
96				sound-dai = <&hdmi_tx>;
97			};
98		};
99	};
100};
101
102&aiu {
103	status = "okay";
104};
105
106&cec_AO {
107	status = "okay";
108	pinctrl-0 = <&ao_cec_pins>;
109	pinctrl-names = "default";
110	hdmi-phandle = <&hdmi_tx>;
111};
112
113&hdmi_tx {
114	status = "okay";
115	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
116	pinctrl-names = "default";
117	hdmi-supply = <&hdmi_5v>;
118};
119
120&hdmi_tx_tmds_port {
121	hdmi_tx_tmds_out: endpoint {
122		remote-endpoint = <&hdmi_connector_in>;
123	};
124};
125
126&i2c_A {
127	status = "okay";
128	pinctrl-0 = <&i2c_a_pins>;
129	pinctrl-names = "default";
130};
131
132&i2c_B {
133	status = "okay";
134	pinctrl-0 = <&i2c_b_pins>;
135	pinctrl-names = "default";
136
137	rtc: rtc@51 {
138		status = "okay";
139		compatible = "haoyu,hym8563";
140		reg = <0x51>;
141		#clock-cells = <0>;
142		clock-output-names = "xin32k";
143	};
144};
145
146&ir {
147	linux,rc-map-name = "rc-khadas";
148};
149
150&gpio_ao {
151	gpio-line-names = "UART TX",
152			  "UART RX",
153			  "Power Key In",
154			  "J9 Header Pin35",
155			  "J9 Header Pin16",
156			  "J9 Header Pin15",
157			  "J9 Header Pin33",
158			  "IR In",
159			  "HDMI CEC",
160			  "SYS LED",
161			  /* GPIO_TEST_N */
162			  "";
163};
164
165&gpio {
166	gpio-line-names = /* Bank GPIOZ */
167			  "", "", "", "", "", "", "",
168			  "", "", "", "", "", "", "",
169			  "Power OFF",
170			  "VCCK Enable",
171			  /* Bank GPIOH */
172			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
173			  "HDMI_5V_EN", "SPDIF",
174			  "J9 Header Pin37",
175			  "J9 Header Pin30",
176			  "J9 Header Pin29",
177			  "J9 Header Pin32",
178			  "J9 Header Pin31",
179			  /* Bank BOOT */
180			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
181			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
182			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
183			  "", "BOOT_MODE", "", "", "eMMC Data Strobe",
184			  /* Bank CARD */
185			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
186			  "SDCard D3", "SDCard D2", "SDCard Det",
187			  /* Bank GPIODV */
188			  "", "", "", "", "", "", "", "", "", "", "", "",
189			  "", "", "", "", "", "", "", "", "", "", "", "",
190			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
191			  "VCCK Regulator", "VDDEE Regulator",
192			  /* Bank GPIOX */
193			  "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
194			  "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
195			  "WIFI Power Enable", "WIFI WAKE HOST",
196			  "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
197			  "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
198			  "Bluetooth UART TX", "Bluetooth UART RX",
199			  "Bluetooth UART CTS", "Bluetooth UART RTS",
200			  "WIFI 32K", "Bluetooth Enable",
201			  "Bluetooth WAKE HOST",
202			  /* Bank GPIOCLK */
203			  "", "J9 Header Pin39";
204};
205
206&pwm_AO_ab {
207	status = "okay";
208	pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
209	pinctrl-names = "default";
210	clocks = <&xtal> , <&xtal>;
211	clock-names = "clkin0", "clkin1" ;
212};
213
214&pwm_ef {
215	pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
216};
217
218&sd_emmc_a {
219	max-frequency = <100000000>;
220};
221
222/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
223&uart_AO {
224	status = "okay";
225};
226
227/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
228&uart_AO_B {
229	status = "okay";
230	pinctrl-0 = <&uart_ao_b_pins>;
231	pinctrl-names = "default";
232};
233
234&usb {
235	dr_mode = "peripheral";
236};
237