Debian Codegraph @

arch/arm64/boot/dts/amlogic/meson-libretech-cottonwood.dtsi

raw
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3 * Copyright (c) 2023 BayLibre, SAS.
4 * Author: Jerome Brunet <[email protected]>
5 */
6
7 #include <dt-bindings/clock/g12a-clkc.h>
8 #include <dt-bindings/input/input.h>
9 #include <dt-bindings/leds/common.h>
10 #include <dt-bindings/gpio/gpio.h>
11 #include <dt-bindings/gpio/meson-g12a-gpio.h>
12 #include <dt-bindings/sound/meson-g12a-toacodec.h>
13 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
14
15 / {
16 aliases {
17 serial0 = &uart_AO;
18 ethernet0 = &ethmac;
19 spi0 = &spifc;
20 };
21
22 memory@0 {
23 device_type = "memory";
24 reg = <0x0 0x0 0x0 0x80000000>;
25 };
26
27 chosen {
28 stdout-path = "serial0:115200n8";
29 };
30
31 dioo2133: audio-amplifier-0 {
32 compatible = "simple-audio-amplifier";
33 enable-gpios = <&gpio GPIOX_0 GPIO_ACTIVE_HIGH>;
34 VCC-supply = <&vcc_5v>;
35 sound-name-prefix = "10U2";
36 };
37
38 /* TOFIX: handle CVBS_DET on SARADC channel 0 */
39 cvbs-connector {
40 compatible = "composite-video-connector";
41
42 port {
43 cvbs_connector_in: endpoint {
44 remote-endpoint = <&cvbs_vdac_out>;
45 };
46 };
47 };
48
49 emmc_pwrseq: emmc-pwrseq {
50 compatible = "mmc-pwrseq-emmc";
51 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
52 };
53
54 hdmi-connector {
55 compatible = "hdmi-connector";
56 type = "a";
57
58 port {
59 hdmi_connector_in: endpoint {
60 remote-endpoint = <&hdmi_tx_tmds_out>;
61 };
62 };
63 };
64
65 led-blue {
66 compatible = "pwm-leds";
67
68 led {
69 color = <LED_COLOR_ID_BLUE>;
70 function = LED_FUNCTION_ACTIVITY;
71 linux,default-trigger = "heartbeat";
72 max-brightness = <255>;
73 pwms = <&pwm_ab 1 1250 0>;
74 active-low;
75 };
76 };
77
78 led-green {
79 compatible = "pwm-leds";
80
81 led {
82 color = <LED_COLOR_ID_GREEN>;
83 function = LED_FUNCTION_STATUS;
84 linux,default-trigger = "default-on";
85 max-brightness = <255>;
86 pwms = <&pwm_cd 1 1250 0>;
87 active-low;
88 };
89 };
90
91 led-orange {
92 compatible = "gpio-leds";
93
94 led {
95 color = <LED_COLOR_ID_AMBER>;
96 function = LED_FUNCTION_STANDBY;
97 gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
98 panic-indicator;
99 };
100 };
101
102 dc_in: regulator-dc-in {
103 compatible = "regulator-fixed";
104 regulator-name = "5V_IN";
105 regulator-min-microvolt = <5000000>;
106 regulator-max-microvolt = <5000000>;
107 regulator-always-on;
108 };
109
110 flash_1v8: regulator-flash-1v8 {
111 compatible = "regulator-fixed";
112 regulator-name = "FLASH_1V8";
113 regulator-min-microvolt = <1800000>;
114 regulator-max-microvolt = <1800000>;
115 regulator-always-on;
116 vin-supply = <&vcc_3v3>;
117 };
118
119 vcc_card: regulator-vcc-card {
120 compatible = "regulator-fixed";
121 regulator-name = "VCC_CARD";
122 regulator-min-microvolt = <3300000>;
123 regulator-max-microvolt = <3300000>;
124 vin-supply = <&vddao_3v3>;
125 gpio = <&gpio GPIOX_2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
126 enable-active-high;
127 gpio-open-drain;
128 };
129
130 vcc_3v3: regulator-vcc-3v3 {
131 compatible = "regulator-fixed";
132 regulator-name = "VCC_3V3";
133 regulator-min-microvolt = <3300000>;
134 regulator-max-microvolt = <3300000>;
135 regulator-always-on;
136 vin-supply = <&vddao_3v3>;
137
138 /* FIXME: controlled by TEST_N */
139 };
140
141 vcc_5v: regulator-vcc-5v {
142 compatible = "regulator-fixed";
143 regulator-name = "VCC_5V";
144 regulator-min-microvolt = <5000000>;
145 regulator-max-microvolt = <5000000>;
146 regulator-always-on;
147 vin-supply = <&dc_in>;
148 gpio = <&gpio GPIOH_8 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
149 enable-active-high;
150 gpio-open-drain;
151 };
152
153 vddao_3v3: regulator-vddao-3v3 {
154 compatible = "regulator-fixed";
155 regulator-name = "VDDAO_3V3";
156 regulator-min-microvolt = <3300000>;
157 regulator-max-microvolt = <3300000>;
158 regulator-always-on;
159 vin-supply = <&dc_in>;
160 };
161
162 vddcpu_b: regulator-vddcpu-b {
163 compatible = "pwm-regulator";
164 regulator-name = "VDDCPU_B";
165 regulator-min-microvolt = <730000>;
166 regulator-max-microvolt = <1011000>;
167 regulator-boot-on;
168 regulator-always-on;
169 pwm-supply = <&dc_in>;
170 pwms = <&pwm_AO_cd 1 1250 0>;
171 pwm-dutycycle-range = <100 0>;
172 };
173
174 vddio_ao18: regulator-vddio-ao18 {
175 compatible = "regulator-fixed";
176 regulator-name = "VDDIO_AO18";
177 regulator-min-microvolt = <1800000>;
178 regulator-max-microvolt = <1800000>;
179 regulator-always-on;
180 vin-supply = <&vddao_3v3>;
181 };
182
183 vddio_c: regulator-vddio-c {
184 compatible = "regulator-gpio";
185 regulator-name = "VDDIO_C";
186 regulator-min-microvolt = <1800000>;
187 regulator-max-microvolt = <3300000>;
188 regulator-settling-time-up-us = <200>;
189 regulator-settling-time-down-us = <50000>;
190 vin-supply = <&vddao_3v3>;
191 gpios = <&gpio GPIOX_4 GPIO_ACTIVE_HIGH>;
192 states = <3300000 0>,
193 <1800000 1>;
194 };
195
196 sound {
197 compatible = "amlogic,axg-sound-card";
198 audio-widgets = "Line", "Lineout";
199 audio-aux-devs = <&tdmout_a>, <&tdmout_b>, <&tdmout_c>,
200 <&tdmin_a>, <&tdmin_b>, <&tdmin_c>,
201 <&dioo2133>;
202
203 clocks = <&clkc CLKID_MPLL2>,
204 <&clkc CLKID_MPLL0>,
205 <&clkc CLKID_MPLL1>;
206
207 assigned-clocks = <&clkc CLKID_MPLL2>,
208 <&clkc CLKID_MPLL0>,
209 <&clkc CLKID_MPLL1>;
210 assigned-clock-rates = <294912000>,
211 <270950400>,
212 <393216000>;
213
214 dai-link-0 {
215 sound-dai = <&frddr_a>;
216 };
217
218 dai-link-1 {
219 sound-dai = <&frddr_b>;
220 };
221
222 dai-link-2 {
223 sound-dai = <&frddr_c>;
224 };
225
226 dai-link-3 {
227 sound-dai = <&toddr_a>;
228 };
229
230 dai-link-4 {
231 sound-dai = <&toddr_b>;
232 };
233
234 dai-link-5 {
235 sound-dai = <&toddr_c>;
236 };
237
238 /*
239 * Audio setup: The 40 pins header provides access to 2 TDMs,
240 * SPDIF In/Out and PDM inputs.
241 * - TDM A: 2 lanes
242 * D0: 40/X9
243 * D1: 38/X8
244 * BCLK: 12/X11
245 * FS: 35/X10
246 * - TDM B: 4 lanes
247 * D0: 37/A3
248 * D1: 16/A4
249 * D2: 18/A5 or 7/AO6
250 * D3: 22/A6 or 21/H5
251 * BCLK: 29/A1 or 8/AO8
252 * FS: 31/A2 or 11/AO7
253 * - 2 Master Clocks:
254 * MCLK0: 15/A0 or 10/AO9
255 * MCLK1: 33/X15
256 * - SPDIF:
257 * OUT: 32/A11
258 * IN: 21/H5
259 * - PDM Input:
260 * DO: 13/A8
261 * D1: 26/A9
262 * D2: 22/A6
263 * D3: 18/A5
264 * DCLK: 36/A7
265 *
266 * TDM C is not usable on the 40 pins connector so it is
267 * setup for the HDMI 4 lanes i2s.
268 *
269 * No pinctrl is enabled by default to preserve the
270 * genericity of the 40 pins header. Many configurations are
271 * possible based on the desired use case. Please adjust TDM
272 * masks, clock setups and pinctrl accordingly.
273 */
274
275 dai-link-6 {
276 sound-dai = <&tdmif_a>;
277 dai-format = "dsp_a";
278 dai-tdm-slot-tx-mask-0 = <1 1>;
279 mclk-fs = <256>;
280
281 codec-0 {
282 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
283 };
284
285 codec-1 {
286 sound-dai = <&toacodec TOACODEC_IN_A>;
287 };
288 };
289
290 dai-link-7 {
291 sound-dai = <&tdmif_b>;
292 dai-format = "i2s";
293 dai-tdm-slot-tx-mask-0 = <1 1>;
294 dai-tdm-slot-rx-mask-1 = <1 1>;
295 mclk-fs = <256>;
296
297 codec-0 {
298 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
299 };
300
301 codec-1 {
302 sound-dai = <&toacodec TOACODEC_IN_B>;
303 };
304 };
305
306 dai-link-8 {
307 sound-dai = <&tdmif_c>;
308 dai-format = "i2s";
309 dai-tdm-slot-tx-mask-0 = <1 1>;
310 dai-tdm-slot-tx-mask-1 = <1 1>;
311 dai-tdm-slot-tx-mask-2 = <1 1>;
312 dai-tdm-slot-tx-mask-3 = <1 1>;
313 mclk-fs = <256>;
314
315 codec-0 {
316 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
317 };
318
319 codec-1 {
320 sound-dai = <&toacodec TOACODEC_IN_C>;
321 };
322 };
323
324 dai-link-9 {
325 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
326
327 codec {
328 sound-dai = <&hdmi_tx>;
329 };
330 };
331
332 dai-link-10 {
333 sound-dai = <&toacodec TOACODEC_OUT>;
334
335 codec {
336 sound-dai = <&acodec>;
337 };
338 };
339 };
340 };
341
342 &acodec {
343 status = "okay";
344 AVDD-supply = <&vddio_ao18>;
345 };
346
347 &arb {
348 status = "okay";
349 };
350
351 &cecb_AO {
352 status = "okay";
353 pinctrl-0 = <&cec_ao_b_h_pins>;
354 pinctrl-names = "default";
355 hdmi-phandle = <&hdmi_tx>;
356 };
357
358 &clkc_audio {
359 status = "okay";
360 };
361
362 &cvbs_vdac_port {
363 cvbs_vdac_out: endpoint {
364 remote-endpoint = <&cvbs_connector_in>;
365 };
366 };
367
368 &dwc3 {
369 #address-cells = <1>;
370 #size-cells = <0>;
371
372 hub: hub@1 {
373 compatible = "usb5e3,626";
374 reg = <1>;
375 reset-gpios = <&gpio GPIOC_7 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
376 vdd-supply = <&vcc_5v>;
377 };
378 };
379
380 &ethmac {
381 pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>, <&eth_phy_irq_pins>;
382 pinctrl-names = "default";
383 status = "okay";
384 phy-mode = "rgmii";
385 phy-handle = <&external_phy>;
386 amlogic,tx-delay-ns = <2>;
387 };
388
389 &ext_mdio {
390 external_phy: ethernet-phy@0 {
391 /* Realtek RTL8211F (0x001cc916) */
392 reg = <0>;
393 max-speed = <1000>;
394
395 reset-assert-us = <100000>;
396 reset-deassert-us = <100000>;
397 reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
398
399 interrupt-parent = <&gpio_intc>;
400 /* MAC_INTR on GPIOZ_14 */
401 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
402 };
403 };
404
405 &frddr_a {
406 status = "okay";
407 };
408
409 &frddr_b {
410 status = "okay";
411 };
412
413 &frddr_c {
414 status = "okay";
415 };
416
417 &hdmi_tx {
418 status = "okay";
419 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
420 pinctrl-names = "default";
421 hdmi-supply = <&vcc_5v>;
422 };
423
424 &hdmi_tx_tmds_port {
425 hdmi_tx_tmds_out: endpoint {
426 remote-endpoint = <&hdmi_connector_in>;
427 };
428 };
429
430 &ir {
431 status = "okay";
432 pinctrl-0 = <&remote_input_ao_pins>;
433 pinctrl-names = "default";
434 };
435
436 &periphs_pinctrl {
437 spi_cs_disable_pins: spi-cs-disable {
438 mux {
439 groups = "BOOT_14";
440 function = "gpio_periphs";
441 bias-disable;
442 output-high;
443 };
444 };
445
446 eth_phy_irq_pins: eth-phy-irq {
447 mux {
448 groups = "GPIOZ_14";
449 function = "gpio_periphs";
450 bias-pull-up;
451 output-disable;
452 };
453 };
454 };
455
456 &pwm_AO_cd {
457 status = "okay";
458 pinctrl-0 = <&pwm_ao_d_e_pins>;
459 pinctrl-names = "default";
460 };
461
462 &pwm_ab {
463 status = "okay";
464 pinctrl-0 = <&pwm_b_x7_pins>;
465 pinctrl-names = "default";
466 };
467
468 &pwm_cd {
469 status = "okay";
470 pinctrl-0 = <&pwm_d_x3_pins>;
471 pinctrl-names = "default";
472 };
473
474 &saradc {
475 status = "okay";
476 vref-supply = <&vddio_ao18>;
477 };
478
479 /* SD card */
480 &sd_emmc_b {
481 status = "okay";
482 pinctrl-0 = <&sdcard_c_pins>;
483 pinctrl-1 = <&sdcard_clk_gate_c_pins>;
484 pinctrl-names = "default", "clk-gate";
485
486 bus-width = <4>;
487 cap-sd-highspeed;
488 sd-uhs-sdr12;
489 sd-uhs-sdr25;
490 sd-uhs-sdr50;
491 sd-uhs-sdr104;
492 max-frequency = <200000000>;
493 disable-wp;
494
495 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
496 vmmc-supply = <&vcc_card>;
497 vqmmc-supply = <&vddio_c>;
498 };
499
500 /*
501 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
502 * and eMMC Data 4 to 7 pins.
503 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
504 * and change bus-width to 4 then spifc can be enabled.
505 */
506 &sd_emmc_c {
507 status = "okay";
508 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>,
509 <&spi_cs_disable_pins>;
510 pinctrl-1 = <&emmc_clk_gate_pins>;
511 pinctrl-names = "default", "clk-gate";
512
513 bus-width = <8>;
514 cap-mmc-highspeed;
515 mmc-hs200-1_8v;
516 max-frequency = <200000000>;
517 disable-wp;
518
519 mmc-pwrseq = <&emmc_pwrseq>;
520 vmmc-supply = <&vcc_3v3>;
521 vqmmc-supply = <&flash_1v8>;
522 };
523
524 &spifc {
525 status = "disabled";
526 pinctrl-0 = <&nor_pins>;
527 pinctrl-names = "default";
528 cs-gpios = <&gpio BOOT_14 GPIO_ACTIVE_LOW>;
529
530 w25lq128d: flash@0 {
531 compatible = "jedec,spi-nor";
532 reg = <0>;
533 #address-cells = <1>;
534 #size-cells = <1>;
535 spi-max-frequency = <80000000>;
536 };
537 };
538
539 &tdmif_a {
540 status = "okay";
541 };
542
543 &tdmif_b {
544 status = "okay";
545 };
546
547 &tdmif_c {
548 status = "okay";
549 };
550
551 &tdmin_a {
552 status = "okay";
553 };
554
555 &tdmin_b {
556 status = "okay";
557 };
558
559 &tdmin_c {
560 status = "okay";
561 };
562
563 &tdmout_a {
564 status = "okay";
565 };
566
567 &tdmout_b {
568 status = "okay";
569 };
570
571 &tdmout_c {
572 status = "okay";
573 };
574
575 &toacodec {
576 status = "okay";
577 };
578
579 &toddr_a {
580 status = "okay";
581 };
582
583 &toddr_b {
584 status = "okay";
585 };
586
587 &toddr_c {
588 status = "okay";
589 };
590
591 &tohdmitx {
592 status = "okay";
593 };
594
595 &uart_AO {
596 status = "okay";
597 pinctrl-0 = <&uart_ao_a_pins>;
598 pinctrl-names = "default";
599 };
600
601 &usb2_phy1 {
602 phy-supply = <&dc_in>;
603 };
604
605 &usb3_pcie_phy {
606 phy-supply = <&vcc_5v>;
607 };
608
609 &usb {
610 status = "okay";
611 };