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