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