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		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	pwmleds {
46		compatible = "pwm-leds";
47
48		power {
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
68&cec_AO {
69	status = "okay";
70	pinctrl-0 = <&ao_cec_pins>;
71	pinctrl-names = "default";
72	hdmi-phandle = <&hdmi_tx>;
73};
74
75&hdmi_tx {
76	status = "okay";
77	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
78	pinctrl-names = "default";
79	hdmi-supply = <&hdmi_5v>;
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		status = "okay";
101		compatible = "haoyu,hym8563";
102		reg = <0x51>;
103		#clock-cells = <0>;
104		clock-frequency = <32768>;
105		clock-output-names = "xin32k";
106	};
107};
108
109&ir {
110	linux,rc-map-name = "rc-khadas";
111};
112
113&gpio_ao {
114	gpio-line-names = "UART TX",
115			  "UART RX",
116			  "Power Key In",
117			  "J9 Header Pin35",
118			  "J9 Header Pin16",
119			  "J9 Header Pin15",
120			  "J9 Header Pin33",
121			  "IR In",
122			  "HDMI CEC",
123			  "SYS LED",
124			  /* GPIO_TEST_N */
125			  "";
126};
127
128&gpio {
129	gpio-line-names = /* Bank GPIOZ */
130			  "", "", "", "", "", "", "",
131			  "", "", "", "", "", "", "",
132			  "Power OFF",
133			  "VCCK Enable",
134			  /* Bank GPIOH */
135			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
136			  "HDMI_5V_EN", "SPDIF",
137			  "J9 Header Pin37",
138			  "J9 Header Pin30",
139			  "J9 Header Pin29",
140			  "J9 Header Pin32",
141			  "J9 Header Pin31",
142			  /* Bank BOOT */
143			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
144			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
145			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
146			  "", "BOOT_MODE", "", "", "eMMC Data Strobe",
147			  /* Bank CARD */
148			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
149			  "SDCard D3", "SDCard D2", "SDCard Det",
150			  /* Bank GPIODV */
151			  "", "", "", "", "", "", "", "", "", "", "", "",
152			  "", "", "", "", "", "", "", "", "", "", "", "",
153			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
154			  "VCCK Regulator", "VDDEE Regulator",
155			  /* Bank GPIOX */
156			  "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
157			  "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
158			  "WIFI Power Enable", "WIFI WAKE HOST",
159			  "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
160			  "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
161			  "Bluetooth UART TX", "Bluetooth UART RX",
162			  "Bluetooth UART CTS", "Bluetooth UART RTS",
163			  "WIFI 32K", "Bluetooth Enable",
164			  "Bluetooth WAKE HOST",
165			  /* Bank GPIOCLK */
166			  "", "J9 Header Pin39";
167};
168
169&pwm_AO_ab {
170	status = "okay";
171	pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
172	pinctrl-names = "default";
173	clocks = <&xtal> , <&xtal>;
174	clock-names = "clkin0", "clkin1" ;
175};
176
177&pwm_ef {
178	pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
179};
180
181&sd_emmc_a {
182	brcmf: wifi@1 {
183		reg = <1>;
184		compatible = "brcm,bcm4329-fmac";
185	};
186};
187
188&uart_A {
189	bluetooth {
190		compatible = "brcm,bcm43438-bt";
191		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
192		max-speed = <2000000>;
193		clocks = <&wifi32k>;
194		clock-names = "lpo";
195	};
196};
197
198/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
199&uart_AO {
200	status = "okay";
201};
202
203/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
204&uart_AO_B {
205	status = "okay";
206	pinctrl-0 = <&uart_ao_b_pins>;
207	pinctrl-names = "default";
208};
209
210&usb {
211	dr_mode = "peripheral";
212};
213