Merge tag 'imx-dt64-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo...
[linux-2.6-microblaze.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
12 #include "meson-gxm.dtsi"
13
14 / {
15         compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
16         model = "Khadas VIM2";
17
18         aliases {
19                 serial0 = &uart_AO;
20                 serial2 = &uart_AO_B;
21         };
22
23         chosen {
24                 stdout-path = "serial0:115200n8";
25         };
26
27         memory@0 {
28                 device_type = "memory";
29                 reg = <0x0 0x0 0x0 0x80000000>;
30         };
31
32         adc-keys {
33                 compatible = "adc-keys";
34                 io-channels = <&saradc 0>;
35                 io-channel-names = "buttons";
36                 keyup-threshold-microvolt = <1710000>;
37
38                 button-function {
39                         label = "Function";
40                         linux,code = <KEY_FN>;
41                         press-threshold-microvolt = <10000>;
42                 };
43         };
44
45         emmc_pwrseq: emmc-pwrseq {
46                 compatible = "mmc-pwrseq-emmc";
47                 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
48         };
49
50         gpio_fan: gpio-fan {
51                 compatible = "gpio-fan";
52                 gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
53                          &gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
54                 /* Dummy RPM values since fan is optional */
55                 gpio-fan,speed-map = <0 0
56                                       1 1
57                                       2 2
58                                       3 3>;
59                 #cooling-cells = <2>;
60         };
61
62         gpio-keys-polled {
63                 compatible = "gpio-keys-polled";
64                 poll-interval = <100>;
65
66                 power-button {
67                         label = "power";
68                         linux,code = <KEY_POWER>;
69                         gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
70                 };
71         };
72
73         hdmi-connector {
74                 compatible = "hdmi-connector";
75                 type = "a";
76
77                 port {
78                         hdmi_connector_in: endpoint {
79                                 remote-endpoint = <&hdmi_tx_tmds_out>;
80                         };
81                 };
82         };
83
84         pwmleds {
85                 compatible = "pwm-leds";
86
87                 power {
88                         label = "vim:red:power";
89                         pwms = <&pwm_AO_ab 1 7812500 0>;
90                         max-brightness = <255>;
91                         linux,default-trigger = "default-on";
92                 };
93         };
94
95         sdio_pwrseq: sdio-pwrseq {
96                 compatible = "mmc-pwrseq-simple";
97                 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
98                 clocks = <&wifi32k>;
99                 clock-names = "ext_clock";
100         };
101
102         hdmi_5v: regulator-hdmi-5v {
103                 compatible = "regulator-fixed";
104
105                 regulator-name = "HDMI_5V";
106                 regulator-min-microvolt = <5000000>;
107                 regulator-max-microvolt = <5000000>;
108
109                 gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
110                 enable-active-high;
111                 regulator-always-on;
112         };
113
114         vcc_3v3: regulator-vcc_3v3 {
115                 compatible = "regulator-fixed";
116                 regulator-name = "VCC_3V3";
117                 regulator-min-microvolt = <3300000>;
118                 regulator-max-microvolt = <3300000>;
119         };
120
121         vddio_ao18: regulator-vddio_ao18 {
122                 compatible = "regulator-fixed";
123                 regulator-name = "VDDIO_AO18";
124                 regulator-min-microvolt = <1800000>;
125                 regulator-max-microvolt = <1800000>;
126         };
127
128         vddio_boot: regulator-vddio_boot {
129                 compatible = "regulator-fixed";
130                 regulator-name = "VDDIO_BOOT";
131                 regulator-min-microvolt = <1800000>;
132                 regulator-max-microvolt = <1800000>;
133         };
134
135         vddao_3v3: regulator-vddao_3v3 {
136                 compatible = "regulator-fixed";
137                 regulator-name = "VDDAO_3V3";
138                 regulator-min-microvolt = <3300000>;
139                 regulator-max-microvolt = <3300000>;
140         };
141
142         wifi32k: wifi32k {
143                 compatible = "pwm-clock";
144                 #clock-cells = <0>;
145                 clock-frequency = <32768>;
146                 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
147         };
148 };
149
150 &cec_AO {
151         status = "okay";
152         pinctrl-0 = <&ao_cec_pins>;
153         pinctrl-names = "default";
154         hdmi-phandle = <&hdmi_tx>;
155 };
156
157
158 &cpu_cooling_maps {
159         map0 {
160                 cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
161         };
162
163         map1 {
164                 cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>,
165                                  <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
166                                  <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
167                                  <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
168                                  <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
169                                  <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
170                                  <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
171                                  <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
172                                  <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
173         };
174 };
175
176 &ethmac {
177         pinctrl-0 = <&eth_pins>;
178         pinctrl-names = "default";
179
180         /* Select external PHY by default */
181         phy-handle = <&external_phy>;
182
183         amlogic,tx-delay-ns = <2>;
184
185         /* External PHY is in RGMII */
186         phy-mode = "rgmii";
187
188         status = "okay";
189 };
190
191 &external_mdio {
192         external_phy: ethernet-phy@0 {
193                 /* Realtek RTL8211F (0x001cc916) */
194                 reg = <0>;
195
196                 reset-assert-us = <10000>;
197                 reset-deassert-us = <30000>;
198                 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
199
200                 interrupt-parent = <&gpio_intc>;
201                 /* MAC_INTR on GPIOZ_15 */
202                 interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
203         };
204 };
205
206 &hdmi_tx {
207         status = "okay";
208         pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
209         pinctrl-names = "default";
210         hdmi-supply = <&hdmi_5v>;
211 };
212
213 &hdmi_tx_tmds_port {
214         hdmi_tx_tmds_out: endpoint {
215                 remote-endpoint = <&hdmi_connector_in>;
216         };
217 };
218
219 &i2c_A {
220         status = "okay";
221         pinctrl-0 = <&i2c_a_pins>;
222         pinctrl-names = "default";
223 };
224
225 &i2c_B {
226         status = "okay";
227         pinctrl-0 = <&i2c_b_pins>;
228         pinctrl-names = "default";
229
230         rtc: rtc@51 {
231                 status = "okay";
232                 compatible = "haoyu,hym8563";
233                 reg = <0x51>;
234                 #clock-cells = <0>;
235                 clock-frequency = <32768>;
236                 clock-output-names = "xin32k";
237         };
238 };
239
240 &ir {
241         status = "okay";
242         pinctrl-0 = <&remote_input_ao_pins>;
243         pinctrl-names = "default";
244         linux,rc-map-name = "rc-khadas";
245 };
246
247 &pwm_AO_ab {
248         status = "okay";
249         pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
250         pinctrl-names = "default";
251         clocks = <&clkc CLKID_FCLK_DIV4>;
252         clock-names = "clkin0";
253 };
254
255 &pwm_ef {
256         status = "okay";
257         pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
258         pinctrl-names = "default";
259         clocks = <&clkc CLKID_FCLK_DIV4>;
260         clock-names = "clkin0";
261 };
262
263 &sd_emmc_a {
264         status = "okay";
265         pinctrl-0 = <&sdio_pins>;
266         pinctrl-1 = <&sdio_clk_gate_pins>;
267         pinctrl-names = "default", "clk-gate";
268         #address-cells = <1>;
269         #size-cells = <0>;
270
271         bus-width = <4>;
272         max-frequency = <60000000>;
273
274         non-removable;
275         disable-wp;
276
277         /* WiFi firmware requires power to be kept while in suspend */
278         keep-power-in-suspend;
279
280         mmc-pwrseq = <&sdio_pwrseq>;
281
282         vmmc-supply = <&vddao_3v3>;
283         vqmmc-supply = <&vddio_boot>;
284
285         brcmf: wifi@1 {
286                 reg = <1>;
287                 compatible = "brcm,bcm4329-fmac";
288         };
289 };
290
291 /* SD card */
292 &sd_emmc_b {
293         status = "okay";
294         pinctrl-0 = <&sdcard_pins>;
295         pinctrl-1 = <&sdcard_clk_gate_pins>;
296         pinctrl-names = "default", "clk-gate";
297
298         bus-width = <4>;
299         cap-sd-highspeed;
300         max-frequency = <50000000>;
301         disable-wp;
302
303         cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
304
305         vmmc-supply = <&vddao_3v3>;
306         vqmmc-supply = <&vddio_boot>;
307 };
308
309 /* eMMC */
310 &sd_emmc_c {
311         status = "okay";
312         pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
313         pinctrl-1 = <&emmc_clk_gate_pins>;
314         pinctrl-names = "default", "clk-gate";
315
316         bus-width = <8>;
317         cap-mmc-highspeed;
318         max-frequency = <200000000>;
319         non-removable;
320         disable-wp;
321         mmc-ddr-1_8v;
322         mmc-hs200-1_8v;
323
324         mmc-pwrseq = <&emmc_pwrseq>;
325         vmmc-supply = <&vcc_3v3>;
326         vqmmc-supply = <&vddio_boot>;
327 };
328
329 /*
330  * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
331  * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
332  */
333 &spifc {
334         status = "disabled";
335         pinctrl-0 = <&nor_pins>;
336         pinctrl-names = "default";
337
338         w25q32: spi-flash@0 {
339                 #address-cells = <1>;
340                 #size-cells = <1>;
341                 compatible = "winbond,w25q16", "jedec,spi-nor";
342                 reg = <0>;
343                 spi-max-frequency = <104000000>;
344         };
345 };
346
347 /* This one is connected to the Bluetooth module */
348 &uart_A {
349         status = "okay";
350         pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
351         pinctrl-names = "default";
352         uart-has-rtscts;
353
354         bluetooth {
355                 compatible = "brcm,bcm43438-bt";
356                 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
357                 max-speed = <2000000>;
358                 clocks = <&wifi32k>;
359                 clock-names = "lpo";
360         };
361 };
362
363 /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
364 &uart_AO {
365         status = "okay";
366         pinctrl-0 = <&uart_ao_a_pins>;
367         pinctrl-names = "default";
368 };
369
370 /* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
371 &uart_AO_B {
372         status = "okay";
373         pinctrl-0 = <&uart_ao_b_pins>;
374         pinctrl-names = "default";
375 };
376
377 &saradc {
378         status = "okay";
379         vref-supply = <&vddio_ao18>;
380 };
381
382 &usb {
383         status = "okay";
384         dr_mode = "peripheral";
385 };