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