GNU Linux-libre 4.19.286-gnu1
[releases.git] / arch / arm64 / boot / dts / amlogic / meson-gxm-khadas-vim2.dts
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3  * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
4  * Copyright (c) 2017 BayLibre, SAS
5  * Author: Neil Armstrong <narmstrong@baylibre.com>
6  */
7
8 /dts-v1/;
9
10 #include <dt-bindings/input/input.h>
11 #include <dt-bindings/thermal/thermal.h>
12
13 #include "meson-gxm.dtsi"
14
15 / {
16         compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
17         model = "Khadas VIM2";
18
19         aliases {
20                 serial0 = &uart_AO;
21                 serial2 = &uart_AO_B;
22         };
23
24         chosen {
25                 stdout-path = "serial0:115200n8";
26         };
27
28         memory@0 {
29                 device_type = "memory";
30                 reg = <0x0 0x0 0x0 0x80000000>;
31         };
32
33         adc-keys {
34                 compatible = "adc-keys";
35                 io-channels = <&saradc 0>;
36                 io-channel-names = "buttons";
37                 keyup-threshold-microvolt = <1710000>;
38
39                 button-function {
40                         label = "Function";
41                         linux,code = <KEY_FN>;
42                         press-threshold-microvolt = <10000>;
43                 };
44         };
45
46         emmc_pwrseq: emmc-pwrseq {
47                 compatible = "mmc-pwrseq-emmc";
48                 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
49         };
50
51         gpio_fan: gpio-fan {
52                 compatible = "gpio-fan";
53                 gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
54                          &gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
55                 /* Dummy RPM values since fan is optional */
56                 gpio-fan,speed-map = <0 0
57                                       1 1
58                                       2 2
59                                       3 3>;
60                 #cooling-cells = <2>;
61         };
62
63         gpio-keys-polled {
64                 compatible = "gpio-keys-polled";
65                 poll-interval = <100>;
66
67                 power-button {
68                         label = "power";
69                         linux,code = <KEY_POWER>;
70                         gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
71                 };
72         };
73
74         hdmi-connector {
75                 compatible = "hdmi-connector";
76                 type = "a";
77
78                 port {
79                         hdmi_connector_in: endpoint {
80                                 remote-endpoint = <&hdmi_tx_tmds_out>;
81                         };
82                 };
83         };
84
85         pwmleds {
86                 compatible = "pwm-leds";
87
88                 power {
89                         label = "vim:red:power";
90                         pwms = <&pwm_AO_ab 1 7812500 0>;
91                         max-brightness = <255>;
92                         linux,default-trigger = "default-on";
93                 };
94         };
95
96         sdio_pwrseq: sdio-pwrseq {
97                 compatible = "mmc-pwrseq-simple";
98                 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
99                 clocks = <&wifi32k>;
100                 clock-names = "ext_clock";
101         };
102
103         thermal-zones {
104                 cpu-thermal {
105                         polling-delay-passive = <250>; /* milliseconds */
106                         polling-delay = <1000>; /* milliseconds */
107
108                         thermal-sensors = <&scpi_sensors 0>;
109
110                         trips {
111                                 cpu_alert0: cpu-alert0 {
112                                         temperature = <70000>; /* millicelsius */
113                                         hysteresis = <2000>; /* millicelsius */
114                                         type = "active";
115                                 };
116
117                                 cpu_alert1: cpu-alert1 {
118                                         temperature = <80000>; /* millicelsius */
119                                         hysteresis = <2000>; /* millicelsius */
120                                         type = "passive";
121                                 };
122                         };
123
124                         cooling-maps {
125                                 map0 {
126                                         trip = <&cpu_alert0>;
127                                         cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
128                                 };
129
130                                 map1 {
131                                         trip = <&cpu_alert1>;
132                                         cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>;
133                                 };
134
135                                 map2 {
136                                         trip = <&cpu_alert1>;
137                                         cooling-device =
138                                                 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
139                                 };
140
141                                 map3 {
142                                         trip = <&cpu_alert1>;
143                                         cooling-device =
144                                                 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
145                                 };
146                         };
147                 };
148         };
149
150         hdmi_5v: regulator-hdmi-5v {
151                 compatible = "regulator-fixed";
152
153                 regulator-name = "HDMI_5V";
154                 regulator-min-microvolt = <5000000>;
155                 regulator-max-microvolt = <5000000>;
156
157                 gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
158                 enable-active-high;
159                 regulator-always-on;
160         };
161
162         vcc_3v3: regulator-vcc_3v3 {
163                 compatible = "regulator-fixed";
164                 regulator-name = "VCC_3V3";
165                 regulator-min-microvolt = <3300000>;
166                 regulator-max-microvolt = <3300000>;
167         };
168
169         vddio_ao18: regulator-vddio_ao18 {
170                 compatible = "regulator-fixed";
171                 regulator-name = "VDDIO_AO18";
172                 regulator-min-microvolt = <1800000>;
173                 regulator-max-microvolt = <1800000>;
174         };
175
176         vddio_boot: regulator-vddio_boot {
177                 compatible = "regulator-fixed";
178                 regulator-name = "VDDIO_BOOT";
179                 regulator-min-microvolt = <1800000>;
180                 regulator-max-microvolt = <1800000>;
181         };
182
183         vddao_3v3: regulator-vddao_3v3 {
184                 compatible = "regulator-fixed";
185                 regulator-name = "VDDAO_3V3";
186                 regulator-min-microvolt = <3300000>;
187                 regulator-max-microvolt = <3300000>;
188         };
189
190         wifi32k: wifi32k {
191                 compatible = "pwm-clock";
192                 #clock-cells = <0>;
193                 clock-frequency = <32768>;
194                 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
195         };
196 };
197
198 &cec_AO {
199         status = "okay";
200         pinctrl-0 = <&ao_cec_pins>;
201         pinctrl-names = "default";
202         hdmi-phandle = <&hdmi_tx>;
203 };
204
205 &cpu0 {
206         #cooling-cells = <2>;
207 };
208
209 &cpu1 {
210         #cooling-cells = <2>;
211 };
212
213 &cpu2 {
214         #cooling-cells = <2>;
215 };
216
217 &cpu3 {
218         #cooling-cells = <2>;
219 };
220
221 &cpu4 {
222         #cooling-cells = <2>;
223 };
224
225 &cpu5 {
226         #cooling-cells = <2>;
227 };
228
229 &cpu6 {
230         #cooling-cells = <2>;
231 };
232
233 &cpu7 {
234         #cooling-cells = <2>;
235 };
236
237 &ethmac {
238         pinctrl-0 = <&eth_pins>;
239         pinctrl-names = "default";
240
241         /* Select external PHY by default */
242         phy-handle = <&external_phy>;
243
244         amlogic,tx-delay-ns = <2>;
245
246         /* External PHY reset is shared with internal PHY Led signals */
247         snps,reset-gpio = <&gpio GPIOZ_14 0>;
248         snps,reset-delays-us = <0 10000 1000000>;
249         snps,reset-active-low;
250
251         /* External PHY is in RGMII */
252         phy-mode = "rgmii";
253
254         status = "okay";
255 };
256
257 &external_mdio {
258         external_phy: ethernet-phy@0 {
259                 /* Realtek RTL8211F (0x001cc916) */
260                 reg = <0>;
261                 interrupt-parent = <&gpio_intc>;
262                 /* MAC_INTR on GPIOZ_15 */
263                 interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
264         };
265 };
266
267 &hdmi_tx {
268         status = "okay";
269         pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
270         pinctrl-names = "default";
271         hdmi-supply = <&hdmi_5v>;
272 };
273
274 &hdmi_tx_tmds_port {
275         hdmi_tx_tmds_out: endpoint {
276                 remote-endpoint = <&hdmi_connector_in>;
277         };
278 };
279
280 &i2c_A {
281         status = "okay";
282         pinctrl-0 = <&i2c_a_pins>;
283         pinctrl-names = "default";
284 };
285
286 &i2c_B {
287         status = "okay";
288         pinctrl-0 = <&i2c_b_pins>;
289         pinctrl-names = "default";
290
291         rtc: rtc@51 {
292                 /* has to be enabled manually when a battery is connected: */
293                 status = "disabled";
294                 compatible = "haoyu,hym8563";
295                 reg = <0x51>;
296                 #clock-cells = <0>;
297                 clock-frequency = <32768>;
298                 clock-output-names = "xin32k";
299         };
300 };
301
302 &ir {
303         status = "okay";
304         pinctrl-0 = <&remote_input_ao_pins>;
305         pinctrl-names = "default";
306         linux,rc-map-name = "rc-geekbox";
307 };
308
309 &pwm_AO_ab {
310         status = "okay";
311         pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
312         pinctrl-names = "default";
313         clocks = <&clkc CLKID_FCLK_DIV4>;
314         clock-names = "clkin0";
315 };
316
317 &pwm_ef {
318         status = "okay";
319         pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
320         pinctrl-names = "default";
321         clocks = <&clkc CLKID_FCLK_DIV4>;
322         clock-names = "clkin0";
323 };
324
325 &sd_emmc_a {
326         status = "okay";
327         pinctrl-0 = <&sdio_pins>;
328         pinctrl-names = "default";
329         #address-cells = <1>;
330         #size-cells = <0>;
331
332         bus-width = <4>;
333         max-frequency = <100000000>;
334
335         non-removable;
336         disable-wp;
337
338         mmc-pwrseq = <&sdio_pwrseq>;
339
340         vmmc-supply = <&vddao_3v3>;
341         vqmmc-supply = <&vddio_boot>;
342
343         brcmf: wifi@1 {
344                 reg = <1>;
345                 compatible = "brcm,bcm4329-fmac";
346         };
347 };
348
349 /* SD card */
350 &sd_emmc_b {
351         status = "okay";
352         pinctrl-0 = <&sdcard_pins>;
353         pinctrl-names = "default";
354
355         bus-width = <4>;
356         cap-sd-highspeed;
357         max-frequency = <100000000>;
358         disable-wp;
359
360         cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
361         cd-inverted;
362
363         vmmc-supply = <&vddao_3v3>;
364         vqmmc-supply = <&vddio_boot>;
365 };
366
367 /* eMMC */
368 &sd_emmc_c {
369         status = "okay";
370         pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
371         pinctrl-names = "default";
372
373         bus-width = <8>;
374         cap-sd-highspeed;
375         cap-mmc-highspeed;
376         max-frequency = <200000000>;
377         non-removable;
378         disable-wp;
379         mmc-ddr-1_8v;
380         mmc-hs200-1_8v;
381         mmc-hs400-1_8v;
382
383         mmc-pwrseq = <&emmc_pwrseq>;
384         vmmc-supply = <&vcc_3v3>;
385         vqmmc-supply = <&vddio_boot>;
386 };
387
388 /*
389  * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
390  * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
391  */
392 &spifc {
393         status = "disabled";
394         pinctrl-0 = <&nor_pins>;
395         pinctrl-names = "default";
396
397         w25q32: spi-flash@0 {
398                 #address-cells = <1>;
399                 #size-cells = <1>;
400                 compatible = "winbond,w25q16", "jedec,spi-nor";
401                 reg = <0>;
402                 spi-max-frequency = <104000000>;
403         };
404 };
405
406 /* This one is connected to the Bluetooth module */
407 &uart_A {
408         status = "okay";
409         pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
410         pinctrl-names = "default";
411         uart-has-rtscts;
412
413         bluetooth {
414                 compatible = "brcm,bcm43438-bt";
415                 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
416                 max-speed = <2000000>;
417                 clocks = <&wifi32k>;
418                 clock-names = "lpo";
419         };
420 };
421
422 /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
423 &uart_AO {
424         status = "okay";
425         pinctrl-0 = <&uart_ao_a_pins>;
426         pinctrl-names = "default";
427 };
428
429 /* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
430 &uart_AO_B {
431         status = "okay";
432         pinctrl-0 = <&uart_ao_b_pins>;
433         pinctrl-names = "default";
434 };
435
436 &saradc {
437         status = "okay";
438         vref-supply = <&vddio_ao18>;
439 };
440
441 &usb0 {
442         status = "okay";
443 };