b2bb94981838f2b47df39b41d53c0997f99bee8f
[platform/kernel/linux-starfive.git] / arch / arm64 / boot / dts / amlogic / meson-g12a-x96-max.dts
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3  * Copyright (c) 2018 BayLibre SAS. All rights reserved.
4  */
5
6 /dts-v1/;
7
8 #include "meson-g12a.dtsi"
9 #include <dt-bindings/gpio/gpio.h>
10 #include <dt-bindings/gpio/meson-g12a-gpio.h>
11 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13 / {
14         compatible = "amediatech,x96-max", "amlogic,g12a";
15         model = "Shenzhen Amediatech Technology Co., Ltd X96 Max";
16
17         aliases {
18                 serial0 = &uart_AO;
19                 ethernet0 = &ethmac;
20         };
21
22         spdif_dit: audio-codec-1 {
23                 #sound-dai-cells = <0>;
24                 compatible = "linux,spdif-dit";
25                 status = "okay";
26                 sound-name-prefix = "DIT";
27         };
28
29         chosen {
30                 stdout-path = "serial0:115200n8";
31         };
32         memory@0 {
33                 device_type = "memory";
34                 reg = <0x0 0x0 0x0 0x40000000>;
35         };
36
37         cvbs-connector {
38                 compatible = "composite-video-connector";
39
40                 port {
41                         cvbs_connector_in: endpoint {
42                                 remote-endpoint = <&cvbs_vdac_out>;
43                         };
44                 };
45         };
46
47         hdmi-connector {
48                 compatible = "hdmi-connector";
49                 type = "a";
50
51                 port {
52                         hdmi_connector_in: endpoint {
53                                 remote-endpoint = <&hdmi_tx_tmds_out>;
54                         };
55                 };
56         };
57
58         emmc_pwrseq: emmc-pwrseq {
59                 compatible = "mmc-pwrseq-emmc";
60                 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
61         };
62
63         sdio_pwrseq: sdio-pwrseq {
64                 compatible = "mmc-pwrseq-simple";
65                 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
66                 clocks = <&wifi32k>;
67                 clock-names = "ext_clock";
68         };
69
70         flash_1v8: regulator-flash_1v8 {
71                 compatible = "regulator-fixed";
72                 regulator-name = "FLASH_1V8";
73                 regulator-min-microvolt = <1800000>;
74                 regulator-max-microvolt = <1800000>;
75                 vin-supply = <&vcc_3v3>;
76                 regulator-always-on;
77         };
78
79         dc_in: regulator-dc_in {
80                 compatible = "regulator-fixed";
81                 regulator-name = "DC_IN";
82                 regulator-min-microvolt = <5000000>;
83                 regulator-max-microvolt = <5000000>;
84                 regulator-always-on;
85         };
86
87         vcc_1v8: regulator-vcc_1v8 {
88                 compatible = "regulator-fixed";
89                 regulator-name = "VCC_1V8";
90                 regulator-min-microvolt = <1800000>;
91                 regulator-max-microvolt = <1800000>;
92                 vin-supply = <&vcc_3v3>;
93                 regulator-always-on;
94         };
95
96         vcc_3v3: regulator-vcc_3v3 {
97                 compatible = "regulator-fixed";
98                 regulator-name = "VCC_3V3";
99                 regulator-min-microvolt = <3300000>;
100                 regulator-max-microvolt = <3300000>;
101                 vin-supply = <&vddao_3v3>;
102                 regulator-always-on;
103                 /* FIXME: actually controlled by VDDCPU_B_EN */
104         };
105
106         vcc_5v: regulator-vcc_5v {
107                 compatible = "regulator-fixed";
108                 regulator-name = "VCC_5V";
109                 regulator-min-microvolt = <5000000>;
110                 regulator-max-microvolt = <5000000>;
111                 vin-supply = <&dc_in>;
112
113                 gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
114         };
115
116         vddao_1v8: regulator-vddao_1v8 {
117                 compatible = "regulator-fixed";
118                 regulator-name = "VDDAO_1V8";
119                 regulator-min-microvolt = <1800000>;
120                 regulator-max-microvolt = <1800000>;
121                 vin-supply = <&vddao_3v3>;
122                 regulator-always-on;
123         };
124
125         vddao_3v3: regulator-vddao_3v3 {
126                 compatible = "regulator-fixed";
127                 regulator-name = "VDDAO_3V3";
128                 regulator-min-microvolt = <3300000>;
129                 regulator-max-microvolt = <3300000>;
130                 vin-supply = <&dc_in>;
131                 regulator-always-on;
132         };
133
134         vddcpu: regulator-vddcpu {
135                 compatible = "pwm-regulator";
136
137                 regulator-name = "VDDCPU";
138                 regulator-min-microvolt = <721000>;
139                 regulator-max-microvolt = <1022000>;
140
141                 pwm-supply = <&dc_in>;
142
143                 pwms = <&pwm_AO_cd 1 1250 0>;
144                 pwm-dutycycle-range = <100 0>;
145
146                 regulator-boot-on;
147                 regulator-always-on;
148         };
149
150         sound {
151                 compatible = "amlogic,axg-sound-card";
152                 model = "X96-MAX";
153                 audio-aux-devs = <&tdmout_b>;
154                 audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
155                                 "TDMOUT_B IN 1", "FRDDR_B OUT 1",
156                                 "TDMOUT_B IN 2", "FRDDR_C OUT 1",
157                                 "TDM_B Playback", "TDMOUT_B OUT",
158                                 "SPDIFOUT IN 0", "FRDDR_A OUT 3",
159                                 "SPDIFOUT IN 1", "FRDDR_B OUT 3",
160                                 "SPDIFOUT IN 2", "FRDDR_C OUT 3";
161
162                 assigned-clocks = <&clkc CLKID_MPLL2>,
163                                   <&clkc CLKID_MPLL0>,
164                                   <&clkc CLKID_MPLL1>;
165                 assigned-clock-parents = <0>, <0>, <0>;
166                 assigned-clock-rates = <294912000>,
167                                        <270950400>,
168                                        <393216000>;
169                 status = "okay";
170
171                 dai-link-0 {
172                         sound-dai = <&frddr_a>;
173                 };
174
175                 dai-link-1 {
176                         sound-dai = <&frddr_b>;
177                 };
178
179                 dai-link-2 {
180                         sound-dai = <&frddr_c>;
181                 };
182
183                 /* 8ch hdmi interface */
184                 dai-link-3 {
185                         sound-dai = <&tdmif_b>;
186                         dai-format = "i2s";
187                         dai-tdm-slot-tx-mask-0 = <1 1>;
188                         dai-tdm-slot-tx-mask-1 = <1 1>;
189                         dai-tdm-slot-tx-mask-2 = <1 1>;
190                         dai-tdm-slot-tx-mask-3 = <1 1>;
191                         mclk-fs = <256>;
192
193                         codec {
194                                 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
195                         };
196                 };
197
198                 /* spdif hdmi or toslink interface */
199                 dai-link-4 {
200                         sound-dai = <&spdifout>;
201
202                         codec-0 {
203                                 sound-dai = <&spdif_dit>;
204                         };
205
206                         codec-1 {
207                                 sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>;
208                         };
209                 };
210
211                 /* spdif hdmi interface */
212                 dai-link-5 {
213                         sound-dai = <&spdifout_b>;
214
215                         codec {
216                                 sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>;
217                         };
218                 };
219
220                 /* hdmi glue */
221                 dai-link-6 {
222                         sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
223
224                         codec {
225                                 sound-dai = <&hdmi_tx>;
226                         };
227                 };
228         };
229
230         wifi32k: wifi32k {
231                 compatible = "pwm-clock";
232                 #clock-cells = <0>;
233                 clock-frequency = <32768>;
234                 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
235         };
236 };
237
238 &arb {
239         status = "okay";
240 };
241
242 &cec_AO {
243         pinctrl-0 = <&cec_ao_a_h_pins>;
244         pinctrl-names = "default";
245         status = "disabled";
246         hdmi-phandle = <&hdmi_tx>;
247 };
248
249 &cecb_AO {
250         pinctrl-0 = <&cec_ao_b_h_pins>;
251         pinctrl-names = "default";
252         status = "okay";
253         hdmi-phandle = <&hdmi_tx>;
254 };
255
256 &clkc_audio {
257         status = "okay";
258 };
259
260 &cpu0 {
261         cpu-supply = <&vddcpu>;
262         operating-points-v2 = <&cpu_opp_table>;
263         clocks = <&clkc CLKID_CPU_CLK>;
264         clock-latency = <50000>;
265 };
266
267 &cpu1 {
268         cpu-supply = <&vddcpu>;
269         operating-points-v2 = <&cpu_opp_table>;
270         clocks = <&clkc CLKID_CPU_CLK>;
271         clock-latency = <50000>;
272 };
273
274 &cpu2 {
275         cpu-supply = <&vddcpu>;
276         operating-points-v2 = <&cpu_opp_table>;
277         clocks = <&clkc CLKID_CPU_CLK>;
278         clock-latency = <50000>;
279 };
280
281 &cpu3 {
282         cpu-supply = <&vddcpu>;
283         operating-points-v2 = <&cpu_opp_table>;
284         clocks = <&clkc CLKID_CPU_CLK>;
285         clock-latency = <50000>;
286 };
287
288 &cvbs_vdac_port {
289         cvbs_vdac_out: endpoint {
290                 remote-endpoint = <&cvbs_connector_in>;
291         };
292 };
293
294 &frddr_a {
295         status = "okay";
296 };
297
298 &frddr_b {
299         status = "okay";
300 };
301
302 &frddr_c {
303         status = "okay";
304 };
305
306 &hdmi_tx {
307         status = "okay";
308         pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
309         pinctrl-names = "default";
310         hdmi-supply = <&vcc_5v>;
311 };
312
313 &hdmi_tx_tmds_port {
314         hdmi_tx_tmds_out: endpoint {
315                 remote-endpoint = <&hdmi_connector_in>;
316         };
317 };
318
319 &ir {
320         status = "okay";
321         pinctrl-0 = <&remote_input_ao_pins>;
322         pinctrl-names = "default";
323         linux,rc-map-name = "rc-x96max";
324 };
325
326 &pwm_AO_cd {
327         pinctrl-0 = <&pwm_ao_d_e_pins>;
328         pinctrl-names = "default";
329         clocks = <&xtal>;
330         clock-names = "clkin1";
331         status = "okay";
332 };
333
334 &ext_mdio {
335         external_phy: ethernet-phy@0 {
336                 /* Realtek RTL8211F (0x001cc916) */
337                 reg = <0>;
338                 max-speed = <1000>;
339                 eee-broken-1000t;
340
341                 reset-assert-us = <10000>;
342                 reset-deassert-us = <80000>;
343                 reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
344
345                 interrupt-parent = <&gpio_intc>;
346                 /* MAC_INTR on GPIOZ_14 */
347                 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
348         };
349 };
350
351 &ethmac {
352         pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
353         pinctrl-names = "default";
354         status = "okay";
355         phy-mode = "rgmii";
356         phy-handle = <&external_phy>;
357         amlogic,tx-delay-ns = <2>;
358 };
359
360 &pwm_ef {
361         status = "okay";
362         pinctrl-0 = <&pwm_e_pins>;
363         pinctrl-names = "default";
364         clocks = <&xtal>;
365         clock-names = "clkin0";
366 };
367
368 &uart_A {
369         status = "okay";
370         pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
371         pinctrl-names = "default";
372         uart-has-rtscts;
373
374         bluetooth {
375                 compatible = "brcm,bcm43438-bt";
376                 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
377                 max-speed = <2000000>;
378                 clocks = <&wifi32k>;
379                 clock-names = "lpo";
380         };
381 };
382
383 &uart_AO {
384         status = "okay";
385         pinctrl-0 = <&uart_ao_a_pins>;
386         pinctrl-names = "default";
387 };
388
389 &usb {
390         status = "okay";
391         dr_mode = "host";
392 };
393
394 /* SDIO */
395 &sd_emmc_a {
396         status = "okay";
397         pinctrl-0 = <&sdio_pins>;
398         pinctrl-1 = <&sdio_clk_gate_pins>;
399         pinctrl-names = "default", "clk-gate";
400         #address-cells = <1>;
401         #size-cells = <0>;
402
403         bus-width = <4>;
404         cap-sd-highspeed;
405         sd-uhs-sdr50;
406         max-frequency = <100000000>;
407
408         non-removable;
409         disable-wp;
410
411         /* WiFi firmware requires power to be kept while in suspend */
412         keep-power-in-suspend;
413
414         mmc-pwrseq = <&sdio_pwrseq>;
415
416         vmmc-supply = <&vddao_3v3>;
417         vqmmc-supply = <&vddao_1v8>;
418
419         brcmf: wifi@1 {
420                 reg = <1>;
421                 compatible = "brcm,bcm4329-fmac";
422         };
423 };
424
425 /* SD card */
426 &sd_emmc_b {
427         status = "okay";
428         pinctrl-0 = <&sdcard_c_pins>;
429         pinctrl-1 = <&sdcard_clk_gate_c_pins>;
430         pinctrl-names = "default", "clk-gate";
431
432         bus-width = <4>;
433         cap-sd-highspeed;
434         max-frequency = <100000000>;
435         disable-wp;
436
437         cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
438         vmmc-supply = <&vddao_3v3>;
439         vqmmc-supply = <&vddao_3v3>;
440 };
441
442 /* eMMC */
443 &sd_emmc_c {
444         status = "okay";
445         pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
446         pinctrl-1 = <&emmc_clk_gate_pins>;
447         pinctrl-names = "default", "clk-gate";
448
449         bus-width = <8>;
450         cap-mmc-highspeed;
451         max-frequency = <100000000>;
452         non-removable;
453         disable-wp;
454
455         mmc-pwrseq = <&emmc_pwrseq>;
456         vmmc-supply = <&vcc_3v3>;
457         vqmmc-supply = <&flash_1v8>;
458 };
459
460 &spdifout {
461         pinctrl-0 = <&spdif_out_h_pins>;
462         pinctrl-names = "default";
463         status = "okay";
464 };
465
466 &spdifout_b {
467         status = "okay";
468 };
469
470 &tdmif_b {
471         status = "okay";
472 };
473
474 &tdmout_b {
475         status = "okay";
476 };
477
478 &tohdmitx {
479         status = "okay";
480 };