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
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		#address-cells = <1>;
37		#size-cells = <0>;
38		poll-interval = <100>;
39
40		button@0 {
41			label = "power";
42			linux,code = <KEY_POWER>;
43			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
44		};
45	};
46
47	pwmleds {
48		compatible = "pwm-leds";
49
50		power {
51			label = "vim:red:power";
52			pwms = <&pwm_AO_ab 1 7812500 0>;
53			max-brightness = <255>;
54			linux,default-trigger = "default-on";
55		};
56	};
57
58	hdmi-connector {
59		compatible = "hdmi-connector";
60		type = "a";
61
62		port {
63			hdmi_connector_in: endpoint {
64				remote-endpoint = <&hdmi_tx_tmds_out>;
65			};
66		};
67	};
68};
69
70&cec_AO {
71	status = "okay";
72	pinctrl-0 = <&ao_cec_pins>;
73	pinctrl-names = "default";
74	hdmi-phandle = <&hdmi_tx>;
75};
76
77&hdmi_tx {
78	status = "okay";
79	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
80	pinctrl-names = "default";
81	hdmi-supply = <&hdmi_5v>;
82};
83
84&hdmi_tx_tmds_port {
85	hdmi_tx_tmds_out: endpoint {
86		remote-endpoint = <&hdmi_connector_in>;
87	};
88};
89
90&i2c_A {
91	status = "okay";
92	pinctrl-0 = <&i2c_a_pins>;
93	pinctrl-names = "default";
94};
95
96&i2c_B {
97	status = "okay";
98	pinctrl-0 = <&i2c_b_pins>;
99	pinctrl-names = "default";
100
101	rtc: rtc@51 {
102		/* has to be enabled manually when a battery is connected: */
103		status = "disabled";
104		compatible = "haoyu,hym8563";
105		reg = <0x51>;
106		#clock-cells = <0>;
107		clock-frequency = <32768>;
108		clock-output-names = "xin32k";
109	};
110};
111
112&ir {
113	linux,rc-map-name = "rc-geekbox";
114};
115
116&pinctrl_aobus {
117	gpio-line-names = "UART TX",
118			  "UART RX",
119			  "Power Key In",
120			  "J9 Header Pin35",
121			  "J9 Header Pin16",
122			  "J9 Header Pin15",
123			  "J9 Header Pin33",
124			  "IR In",
125			  "HDMI CEC",
126			  "SYS LED",
127			  /* GPIO_TEST_N */
128			  "";
129};
130
131&pinctrl_periphs {
132	gpio-line-names = /* Bank GPIOZ */
133			  "", "", "", "", "", "", "",
134			  "", "", "", "", "", "", "",
135			  "Power OFF",
136			  "VCCK Enable",
137			  /* Bank GPIOH */
138			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
139			  "HDMI_5V_EN", "SPDIF",
140			  "J9 Header Pin37",
141			  "J9 Header Pin30",
142			  "J9 Header Pin29",
143			  "J9 Header Pin32",
144			  "J9 Header Pin31",
145			  /* Bank BOOT */
146			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
147			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
148			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
149			  "", "BOOT_MODE", "", "", "eMMC Data Strobe",
150			  /* Bank CARD */
151			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
152			  "SDCard D3", "SDCard D2", "SDCard Det",
153			  /* Bank GPIODV */
154			  "", "", "", "", "", "", "", "", "", "", "", "",
155			  "", "", "", "", "", "", "", "", "", "", "", "",
156			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
157			  "VCCK Regulator", "VDDEE Regulator",
158			  /* Bank GPIOX */
159			  "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
160			  "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
161			  "WIFI Power Enable", "WIFI WAKE HOST",
162			  "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
163			  "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
164			  "Bluetooth UART TX", "Bluetooth UART RX",
165			  "Bluetooth UART CTS", "Bluetooth UART RTS",
166			  "WIFI 32K", "Bluetooth Enable",
167			  "Bluetooth WAKE HOST",
168			  /* Bank GPIOCLK */
169			  "", "J9 Header Pin39";
170};
171
172&pwm_AO_ab {
173	status = "okay";
174	pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
175	pinctrl-names = "default";
176	clocks = <&xtal> , <&xtal>;
177	clock-names = "clkin0", "clkin1" ;
178};
179
180&pwm_ef {
181	pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
182};
183
184&sd_emmc_a {
185	brcmf: wifi@1 {
186		reg = <1>;
187		compatible = "brcm,bcm4329-fmac";
188	};
189};
190
191/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
192&uart_AO {
193	status = "okay";
194};
195
196/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
197&uart_AO_B {
198	status = "okay";
199	pinctrl-0 = <&uart_ao_b_pins>;
200	pinctrl-names = "default";
201};
202