8c2b616468449b3e8b4aca192578ccf2de3569da
[platform/kernel/linux-rpi.git] / arch / arm / boot / dts / bcm2711-rpi-4-b.dts
1 // SPDX-License-Identifier: GPL-2.0
2 /dts-v1/;
3 #include "bcm2711.dtsi"
4 #include "bcm2835-rpi.dtsi"
5 #include <dt-bindings/input/input.h>
6
7 / {
8         compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
9         model = "Raspberry Pi 4 Model B";
10
11         chosen {
12                 /* 8250 auxiliary UART instead of pl011 */
13                 stdout-path = "serial1:115200n8";
14         };
15
16         /* Will be filled by the bootloader */
17         memory@0 {
18                 device_type = "memory";
19                 reg = <0 0 0>;
20         };
21
22         aliases {
23                 ethernet0 = &genet;
24         };
25
26         rpi_backlight: rpi_backlight {
27                 compatible = "raspberrypi,rpi-backlight";
28                 firmware = <&firmware>;
29                 status = "okay";
30         };
31
32         rpi_ft5406: rpi_ft5406 {
33                 compatible = "rpi,rpi-ft5406";
34                 firmware = <&firmware>;
35                 status = "okay";
36         };
37
38         gpio-keys {
39                 compatible = "gpio-keys";
40
41                 key-volume-up {
42                         lable = "volume-up";
43                         linux,code = <KEY_VOLUMEUP>;
44                         gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
45                 };
46
47                 key-volume-down {
48                         lable = "volume-down";
49                         linux,code = <KEY_VOLUMEDOWN>;
50                         gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
51                 };
52
53                 key-fastforward {
54                         lable = "fastforward";
55                         linux,code = <KEY_FASTFORWARD>;
56                         gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
57                 };
58
59                 key-rewind {
60                         lable = "rewind";
61                         linux,code = <KEY_REWIND>;
62                         gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
63                 };
64
65                 key-playpause {
66                         lable = "playpause";
67                         linux,code = <KEY_PLAYPAUSE>;
68                         gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
69                 };
70         };
71
72         leds {
73                 act {
74                         gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
75                 };
76
77                 pwr {
78                         label = "PWR";
79                         gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
80                 };
81         };
82
83         wifi_pwrseq: wifi-pwrseq {
84                 compatible = "mmc-pwrseq-simple";
85                 reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
86         };
87
88         sd_io_1v8_reg: sd_io_1v8_reg {
89                 compatible = "regulator-gpio";
90                 regulator-name = "vdd-sd-io";
91                 regulator-min-microvolt = <1800000>;
92                 regulator-max-microvolt = <3300000>;
93                 regulator-boot-on;
94                 regulator-always-on;
95                 regulator-settling-time-us = <5000>;
96                 gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>;
97                 states = <1800000 0x1
98                           3300000 0x0>;
99                 status = "okay";
100         };
101 };
102
103 &firmware {
104         expgpio: gpio {
105                 compatible = "raspberrypi,firmware-gpio";
106                 gpio-controller;
107                 #gpio-cells = <2>;
108                 gpio-line-names = "BT_ON",
109                                   "WL_ON",
110                                   "PWR_LED_OFF",
111                                   "GLOBAL_RESET",
112                                   "VDD_SD_IO_SEL",
113                                   "CAM_GPIO",
114                                   "SD_PWR_ON",
115                                   "SD_OC_N";
116                 status = "okay";
117         };
118 };
119
120 &pwm1 {
121         pinctrl-names = "default";
122         pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
123         status = "okay";
124 };
125
126 /* SDHCI is used to control the SDIO for wireless */
127 &sdhci {
128         #address-cells = <1>;
129         #size-cells = <0>;
130         pinctrl-names = "default";
131         pinctrl-0 = <&emmc_gpio34>;
132         bus-width = <4>;
133         non-removable;
134         mmc-pwrseq = <&wifi_pwrseq>;
135         status = "okay";
136
137         brcmf: wifi@1 {
138                 reg = <1>;
139                 compatible = "brcm,bcm4329-fmac";
140         };
141 };
142
143 /* EMMC2 is used to drive the SD card */
144 &emmc2 {
145         vqmmc-supply = <&sd_io_1v8_reg>;
146         broken-cd;
147         status = "okay";
148 };
149
150 &genet {
151         phy-handle = <&phy1>;
152         phy-mode = "rgmii-rxid";
153         status = "okay";
154 };
155
156 &genet_mdio {
157         phy1: ethernet-phy@1 {
158                 /* No PHY interrupt */
159                 reg = <0x1>;
160         };
161 };
162
163 /* uart0 communicates with the BT module */
164 &uart0 {
165         pinctrl-names = "default";
166         pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
167         uart-has-rtscts;
168         status = "okay";
169
170         bluetooth {
171                 compatible = "brcm,bcm43438-bt";
172                 max-speed = <2000000>;
173                 shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
174         };
175 };
176
177 /* uart1 is mapped to the pin header */
178 &uart1 {
179         pinctrl-names = "default";
180         pinctrl-0 = <&uart1_gpio14>;
181         status = "okay";
182 };
183
184 &vchiq {
185         interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
186 };
187
188 &vc4 {
189         status = "okay";
190 };
191
192 &pixelvalve0 {
193         status = "okay";
194 };
195
196 &pixelvalve1 {
197         status = "okay";
198 };
199
200 &pixelvalve2 {
201         status = "okay";
202 };
203
204 &pixelvalve3 {
205         status = "okay";
206 };
207
208 &pixelvalve4 {
209         status = "okay";
210 };
211
212 &hdmi0 {
213         status = "okay";
214 };
215
216 &ddc0 {
217         status = "okay";
218 };
219
220 &hdmi1 {
221         status = "okay";
222 };
223
224 &ddc1 {
225         status = "okay";
226 };
227
228 // =============================================
229 // Downstream rpi- changes
230
231 #include "bcm270x.dtsi"
232 #include "bcm271x-rpi-bt.dtsi"
233
234 / {
235         soc {
236                 /delete-node/ pixelvalve@7e807000;
237                 /delete-node/ hdmi@7e902000;
238         };
239 };
240
241 #include "bcm2711-rpi.dtsi"
242 #include "bcm283x-rpi-csi1-2lane.dtsi"
243 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
244
245 /delete-node/ &emmc2;
246
247 / {
248         chosen {
249                 bootargs = "coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1";
250         };
251
252         aliases {
253                 serial0 = &uart1;
254                 serial1 = &uart0;
255                 mmc0 = &emmc2;
256                 mmc1 = &mmcnr;
257                 mmc2 = &sdhost;
258                 /delete-property/ i2c2;
259                 i2c3 = &i2c3;
260                 i2c4 = &i2c4;
261                 i2c5 = &i2c5;
262                 i2c6 = &i2c6;
263                 /delete-property/ ethernet;
264                 /delete-property/ intc;
265                 pcie0 = &pcie0;
266                 emmc2bus = &emmc2bus;
267         };
268
269         emmc2bus: emmc2bus {
270                 compatible = "simple-bus";
271                 #address-cells = <2>;
272                 #size-cells = <1>;
273
274                 ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
275                 dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;
276
277                 emmc2: emmc2@7e340000 {
278                         compatible = "brcm,bcm2711-emmc2";
279                         status = "okay";
280                         interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
281                         clocks = <&clocks BCM2711_CLOCK_EMMC2>;
282                         reg = <0x0 0x7e340000 0x100>;
283                         vqmmc-supply = <&sd_io_1v8_reg>;
284                 };
285         };
286
287         /delete-node/ wifi-pwrseq;
288 };
289
290 &mmcnr {
291         #address-cells = <1>;
292         #size-cells = <0>;
293         pinctrl-names = "default";
294         pinctrl-0 = <&sdio_pins>;
295         bus-width = <4>;
296         status = "okay";
297         brcmf: wifi@1 {
298                 reg = <1>;
299                 compatible = "brcm,bcm4329-fmac";
300                 brcm,feature-disable = <0x2000>; /* BIT[13] : sup-wpa */
301         };
302 };
303
304 &uart0 {
305         pinctrl-0 = <&uart0_pins &bt_pins &uart0_ctsrts_gpio30>;
306         status = "okay";
307 };
308
309 &uart1 {
310         pinctrl-0 = <&uart1_pins>;
311 };
312
313 &uart2 {
314         pinctrl-names = "default";
315         pinctrl-0 = <&uart2_pins>;
316         status = "okay";
317 };
318
319 &spi0 {
320         pinctrl-names = "default";
321         pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
322         cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
323         status = "okay";
324
325         spidev0: spidev@0{
326                 compatible = "spidev";
327                 reg = <0>;      /* CE0 */
328                 #address-cells = <1>;
329                 #size-cells = <0>;
330                 spi-max-frequency = <125000000>;
331         };
332
333         spidev1: spidev@1{
334                 compatible = "spidev";
335                 reg = <1>;      /* CE1 */
336                 #address-cells = <1>;
337                 #size-cells = <0>;
338                 spi-max-frequency = <125000000>;
339         };
340 };
341
342 &gpio {
343         spi0_pins: spi0_pins {
344                 brcm,pins = <9 10 11>;
345                 brcm,function = <BCM2835_FSEL_ALT0>;
346         };
347
348         spi0_cs_pins: spi0_cs_pins {
349                 brcm,pins = <8 7>;
350                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
351         };
352
353         spi3_pins: spi3_pins {
354                 brcm,pins = <1 2 3>;
355                 brcm,function = <BCM2835_FSEL_ALT3>;
356         };
357
358         spi3_cs_pins: spi3_cs_pins {
359                 brcm,pins = <0 24>;
360                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
361         };
362
363         spi4_pins: spi4_pins {
364                 brcm,pins = <5 6 7>;
365                 brcm,function = <BCM2835_FSEL_ALT3>;
366         };
367
368         spi4_cs_pins: spi4_cs_pins {
369                 brcm,pins = <4 25>;
370                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
371         };
372
373         spi5_pins: spi5_pins {
374                 brcm,pins = <13 14 15>;
375                 brcm,function = <BCM2835_FSEL_ALT3>;
376         };
377
378         spi5_cs_pins: spi5_cs_pins {
379                 brcm,pins = <12 26>;
380                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
381         };
382
383         spi6_pins: spi6_pins {
384                 brcm,pins = <19 20 21>;
385                 brcm,function = <BCM2835_FSEL_ALT3>;
386         };
387
388         spi6_cs_pins: spi6_cs_pins {
389                 brcm,pins = <18 27>;
390                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
391         };
392
393         i2c0_pins: i2c0 {
394                 brcm,pins = <0 1>;
395                 brcm,function = <BCM2835_FSEL_ALT0>;
396                 brcm,pull = <BCM2835_PUD_UP>;
397         };
398
399         i2c1_pins: i2c1 {
400                 brcm,pins = <2 3>;
401                 brcm,function = <BCM2835_FSEL_ALT0>;
402                 brcm,pull = <BCM2835_PUD_UP>;
403         };
404
405         i2c3_pins: i2c3 {
406                 brcm,pins = <4 5>;
407                 brcm,function = <BCM2835_FSEL_ALT5>;
408                 brcm,pull = <BCM2835_PUD_UP>;
409         };
410
411         i2c4_pins: i2c4 {
412                 brcm,pins = <8 9>;
413                 brcm,function = <BCM2835_FSEL_ALT5>;
414                 brcm,pull = <BCM2835_PUD_UP>;
415         };
416
417         i2c5_pins: i2c5 {
418                 brcm,pins = <12 13>;
419                 brcm,function = <BCM2835_FSEL_ALT5>;
420                 brcm,pull = <BCM2835_PUD_UP>;
421         };
422
423         i2c6_pins: i2c6 {
424                 brcm,pins = <22 23>;
425                 brcm,function = <BCM2835_FSEL_ALT5>;
426                 brcm,pull = <BCM2835_PUD_UP>;
427         };
428
429         i2s_pins: i2s {
430                 brcm,pins = <18 19 20 21>;
431                 brcm,function = <BCM2835_FSEL_ALT0>;
432         };
433
434         sdio_pins: sdio_pins {
435                 brcm,pins =     <34 35 36 37 38 39>;
436                 brcm,function = <BCM2835_FSEL_ALT3>; // alt3 = SD1
437                 brcm,pull =     <0 2 2 2 2 2>;
438         };
439
440         bt_pins: bt_pins {
441                 brcm,pins = "-"; // non-empty to keep btuart happy, //4 = 0
442                                  // to fool pinctrl
443                 brcm,function = <0>;
444                 brcm,pull = <2>;
445         };
446
447         uart0_pins: uart0_pins {
448                 brcm,pins = <32 33>;
449                 brcm,function = <BCM2835_FSEL_ALT3>;
450                 brcm,pull = <0 2>;
451         };
452
453         uart1_pins: uart1_pins {
454                 brcm,pins;
455                 brcm,function;
456                 brcm,pull;
457         };
458
459         uart2_pins: uart2_pins {
460                 brcm,pins = <0 1>;
461                 brcm,function = <BCM2835_FSEL_ALT4>;
462                 brcm,pull = <0 2>;
463         };
464
465         uart3_pins: uart3_pins {
466                 brcm,pins = <4 5>;
467                 brcm,function = <BCM2835_FSEL_ALT4>;
468                 brcm,pull = <0 2>;
469         };
470
471         uart4_pins: uart4_pins {
472                 brcm,pins = <8 9>;
473                 brcm,function = <BCM2835_FSEL_ALT4>;
474                 brcm,pull = <0 2>;
475         };
476
477         uart5_pins: uart5_pins {
478                 brcm,pins = <12 13>;
479                 brcm,function = <BCM2835_FSEL_ALT4>;
480                 brcm,pull = <0 2>;
481         };
482
483         /* Needs to describe gpio settings at config.txt */
484         key_volume_up: key_volume_up {
485                 brcm,pins = <16>;
486                 brcm,function = <1>; /* BCM2835_FSEL_GPIO_IN */
487                 brcm,pull = <2>; /* BCM2835_PUD_UP */
488         };
489
490         key_volume_down: key_volume_down {
491                 brcm,pins = <13>;
492                 brcm,function = <1>;
493                 brcm,pull = <2>;
494         };
495
496         key_fastforward: key_fastforward {
497                 brcm,pins = <6>;
498                 brcm,function = <1>;
499                 brcm,pull = <2>;
500         };
501
502         key_rewind: key_rewind {
503                 brcm,pins = <12>;
504                 brcm,function = <1>;
505                 brcm,pull = <2>;
506         };
507
508         key_playpause: key_playpause {
509                 brcm,pins = <25>;
510                 brcm,function = <1>;
511                 brcm,pull = <2>;
512         };
513 };
514
515 &i2c0if {
516         clock-frequency = <100000>;
517 };
518
519 &i2c1 {
520         pinctrl-names = "default";
521         pinctrl-0 = <&i2c1_pins>;
522         clock-frequency = <100000>;
523         status = "okay";
524
525         #address-cells = <1>;
526         #size-cells = <0>;
527
528         ac108_a: ac108@3b{
529                 compatible = "x-power,ac108_0";
530                 reg = <0x3b>;
531                 #sound-dai-cells = <0>;
532                 data-protocol = <0>;
533         };
534 };
535
536 &i2s {
537         pinctrl-names = "default";
538         pinctrl-0 = <&i2s_pins>;
539
540         #sound-dai-cells = <0>;
541         status = "okay";
542 };
543
544 &sound {
545         compatible = "seeed-voicecard";
546         seeed-voice-card,format = "dsp_a";
547         seeed-voice-card,name = "seeed-4mic-voicecard";
548         status = "okay";
549
550         seeed-voice-card,bitclock-master = <&codec_dai>;
551         seeed-voice-card,frame-master = <&codec_dai>;
552         seeed-voice-card,channels-playback-override = <4>;
553         seeed-voice-card,channels-capture-override  = <4>;
554
555         cpu_dai: seeed-voice-card,cpu {
556                 sound-dai = <&i2s>;
557                 dai-tdm-slot-num     = <2>;
558                 dai-tdm-slot-width   = <32>;
559                 dai-tdm-slot-tx-mask = <1 1 0 0>;
560                 dai-tdm-slot-rx-mask = <1 1 0 0>;
561         };
562         codec_dai: seeed-voice-card,codec {
563                 sound-dai = <&ac108_a>;
564                 system-clock-frequency = <24000000>;
565         };
566 };
567
568 / {
569         __overrides__ {
570                 /delete-property/ i2c2_baudrate;
571                 /delete-property/ i2c2_iknowwhatimdoing;
572         };
573 };
574
575 &firmwarekms {
576         compatible = "raspberrypi,rpi-firmware-kms-2711";
577 };
578
579 // =============================================
580 // Board specific stuff here
581
582 / {
583         sd_vcc_reg: sd_vcc_reg {
584                 compatible = "regulator-fixed";
585                 regulator-name = "vcc-sd";
586                 regulator-min-microvolt = <3300000>;
587                 regulator-max-microvolt = <3300000>;
588                 regulator-boot-on;
589                 enable-active-high;
590                 gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
591         };
592 };
593
594 &sdhost {
595         status = "disabled";
596 };
597
598 &emmc2 {
599         vmmc-supply = <&sd_vcc_reg>;
600         non-removable;
601 };
602
603 &phy1 {
604         led-modes = <0x00 0x08>; /* link/activity link */
605 };
606
607 &gpio {
608         audio_pins: audio_pins {
609                 brcm,pins = <40 41>;
610                 brcm,function = <4>;
611         };
612 };
613
614 &leds {
615         act_led: act {
616                 label = "led0";
617                 linux,default-trigger = "mmc0";
618                 gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
619         };
620
621         pwr_led: pwr {
622                 label = "led1";
623                 linux,default-trigger = "default-on";
624                 gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
625         };
626 };
627
628 &pwm1 {
629         status = "disabled";
630 };
631
632 &audio {
633         pinctrl-names = "default";
634         pinctrl-0 = <&audio_pins>;
635         status = "okay";
636 };
637
638 &usb {
639         compatible = "brcm,bcm2835-usb";
640         dr_mode = "otg";
641         g-np-tx-fifo-size = <32>;
642         g-rx-fifo-size = <558>;
643         g-tx-fifo-size = <512 512 512 512 512 256 256>;
644         status = "okay";
645         g-extcon-always-on;
646 };
647
648 &vc4 {
649         status = "okay";
650 };
651
652 &pixelvalve0 {
653         status = "okay";
654 };
655
656 &pixelvalve1 {
657         status = "okay";
658 };
659
660 &pixelvalve2 {
661         status = "okay";
662 };
663
664 &pixelvalve3 {
665         status = "okay";
666 };
667
668 &pixelvalve4 {
669         status = "okay";
670 };
671
672 &hdmi0 {
673         status = "okay";
674 };
675
676 &ddc0 {
677         status = "okay";
678 };
679
680 &hdmi1 {
681         status = "okay";
682 };
683
684 &ddc1 {
685         status = "okay";
686 };
687
688 &hvs {
689         status = "okay";
690 };
691
692 &v3d {
693         status = "okay";
694 };
695
696 &txp {
697         status = "okay";
698 };
699
700 &fb {
701         status = "disabled";
702 };
703
704 &firmwarekms {
705         status = "disabled";
706 };
707
708 &vec {
709         status = "disabled";
710 };
711
712 &cma {
713         size = <0x20000000>; /* 512MB */
714 };
715
716 / {
717         __overrides__ {
718                 act_led_gpio = <&act_led>,"gpios:4";
719                 act_led_activelow = <&act_led>,"gpios:8";
720                 act_led_trigger = <&act_led>,"linux,default-trigger";
721
722                 pwr_led_gpio = <&pwr_led>,"gpios:4";
723                 pwr_led_activelow = <&pwr_led>,"gpios:8";
724                 pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
725
726                 eth_led0 = <&phy1>,"led-modes:0";
727                 eth_led1 = <&phy1>,"led-modes:4";
728
729                 spi_dma4 = <&spi0>, "dmas:0=", <&dma40>,
730                            <&spi0>, "dmas:8=", <&dma40>;
731         };
732 };