Merge tag 'v5.15.57' into rpi-5.15.y
[platform/kernel/linux-rpi.git] / arch / arm / boot / dts / bcm2711-rpi-cm4.dts
1 // SPDX-License-Identifier: GPL-2.0
2 /dts-v1/;
3 #include "bcm2711.dtsi"
4 #include "bcm2711-rpi.dtsi"
5 //#include "bcm283x-rpi-usb-peripheral.dtsi"
6
7 / {
8         compatible = "raspberrypi,4-compute-module", "brcm,bcm2711";
9         model = "Raspberry Pi Compute Module 4";
10
11         chosen {
12                 /* 8250 auxiliary UART instead of pl011 */
13                 stdout-path = "serial1:115200n8";
14         };
15
16         leds {
17                 led-act {
18                         gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
19                 };
20
21                 led-pwr {
22                         label = "PWR";
23                         gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
24                         default-state = "keep";
25                         linux,default-trigger = "default-on";
26                 };
27         };
28
29         wifi_pwrseq: wifi-pwrseq {
30                 compatible = "mmc-pwrseq-simple";
31                 reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
32         };
33
34         sd_io_1v8_reg: sd_io_1v8_reg {
35                 compatible = "regulator-gpio";
36                 regulator-name = "vdd-sd-io";
37                 regulator-min-microvolt = <1800000>;
38                 regulator-max-microvolt = <3300000>;
39                 regulator-boot-on;
40                 regulator-always-on;
41                 regulator-settling-time-us = <5000>;
42                 gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>;
43                 states = <1800000 0x1>,
44                          <3300000 0x0>;
45                 status = "okay";
46         };
47
48         sd_vcc_reg: sd_vcc_reg {
49                 compatible = "regulator-fixed";
50                 regulator-name = "vcc-sd";
51                 regulator-min-microvolt = <3300000>;
52                 regulator-max-microvolt = <3300000>;
53                 regulator-boot-on;
54                 enable-active-high;
55                 gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
56         };
57 };
58
59 &ddc0 {
60         status = "okay";
61 };
62
63 &ddc1 {
64         status = "okay";
65 };
66
67 &expgpio {
68         gpio-line-names = "BT_ON",
69                           "WL_ON",
70                           "PWR_LED_OFF",
71                           "ANT1",
72                           "VDD_SD_IO_SEL",
73                           "CAM_GPIO",
74                           "SD_PWR_ON",
75                           "ANT2";
76
77         ant1: ant1 {
78                 gpio-hog;
79                 gpios = <3 GPIO_ACTIVE_HIGH>;
80                 output-high;
81         };
82
83         ant2: ant2 {
84                 gpio-hog;
85                 gpios = <7 GPIO_ACTIVE_HIGH>;
86                 output-low;
87         };
88 };
89
90 &gpio {
91         /*
92          * Parts taken from rpi_SCH_4b_4p0_reduced.pdf and
93          * the official GPU firmware DT blob.
94          *
95          * Legend:
96          * "FOO" = GPIO line named "FOO" on the schematic
97          * "FOO_N" = GPIO line named "FOO" on schematic, active low
98          */
99         gpio-line-names = "ID_SDA",
100                           "ID_SCL",
101                           "SDA1",
102                           "SCL1",
103                           "GPIO_GCLK",
104                           "GPIO5",
105                           "GPIO6",
106                           "SPI_CE1_N",
107                           "SPI_CE0_N",
108                           "SPI_MISO",
109                           "SPI_MOSI",
110                           "SPI_SCLK",
111                           "GPIO12",
112                           "GPIO13",
113                           /* Serial port */
114                           "TXD1",
115                           "RXD1",
116                           "GPIO16",
117                           "GPIO17",
118                           "GPIO18",
119                           "GPIO19",
120                           "GPIO20",
121                           "GPIO21",
122                           "GPIO22",
123                           "GPIO23",
124                           "GPIO24",
125                           "GPIO25",
126                           "GPIO26",
127                           "GPIO27",
128                           "RGMII_MDIO",
129                           "RGMIO_MDC",
130                           /* Used by BT module */
131                           "CTS0",
132                           "RTS0",
133                           "TXD0",
134                           "RXD0",
135                           /* Used by Wifi */
136                           "SD1_CLK",
137                           "SD1_CMD",
138                           "SD1_DATA0",
139                           "SD1_DATA1",
140                           "SD1_DATA2",
141                           "SD1_DATA3",
142                           /* Shared with SPI flash */
143                           "PWM0_MISO",
144                           "PWM1_MOSI",
145                           "STATUS_LED_G_CLK",
146                           "SPIFLASH_CE_N",
147                           "SDA0",
148                           "SCL0",
149                           "RGMII_RXCLK",
150                           "RGMII_RXCTL",
151                           "RGMII_RXD0",
152                           "RGMII_RXD1",
153                           "RGMII_RXD2",
154                           "RGMII_RXD3",
155                           "RGMII_TXCLK",
156                           "RGMII_TXCTL",
157                           "RGMII_TXD0",
158                           "RGMII_TXD1",
159                           "RGMII_TXD2",
160                           "RGMII_TXD3";
161 };
162
163 &hdmi0 {
164         status = "okay";
165 };
166
167 &hdmi1 {
168         status = "okay";
169 };
170
171 &pixelvalve0 {
172         status = "okay";
173 };
174
175 &pixelvalve1 {
176         status = "okay";
177 };
178
179 &pixelvalve2 {
180         status = "okay";
181 };
182
183 &pixelvalve4 {
184         status = "okay";
185 };
186
187 &pwm1 {
188         pinctrl-names = "default";
189         pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
190         status = "okay";
191 };
192
193 /* SDHCI is used to control the SDIO for wireless */
194 &sdhci {
195         #address-cells = <1>;
196         #size-cells = <0>;
197         pinctrl-names = "default";
198         pinctrl-0 = <&emmc_gpio34>;
199         bus-width = <4>;
200         non-removable;
201         mmc-pwrseq = <&wifi_pwrseq>;
202         status = "okay";
203
204         brcmf: wifi@1 {
205                 reg = <1>;
206                 compatible = "brcm,bcm4329-fmac";
207         };
208 };
209
210 /* EMMC2 is used to drive the EMMC card */
211 &emmc2 {
212         bus-width = <8>;
213         vqmmc-supply = <&sd_io_1v8_reg>;
214         vmmc-supply = <&sd_vcc_reg>;
215         broken-cd;
216         status = "okay";
217 };
218
219 &genet {
220         phy-handle = <&phy1>;
221         phy-mode = "rgmii-rxid";
222         status = "okay";
223 };
224
225 &genet_mdio {
226         phy1: ethernet-phy@0 {
227                 /* No PHY interrupt */
228                 reg = <0x0>;
229         };
230 };
231
232 &pcie0 {
233         pci@0,0 {
234                 device-type = "pci";
235                 #address-cells = <3>;
236                 #size-cells = <2>;
237                 ranges;
238
239                 reg = <0 0 0 0 0>;
240         };
241 };
242
243 /* uart0 communicates with the BT module */
244 &uart0 {
245         pinctrl-names = "default";
246         pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
247         uart-has-rtscts;
248         status = "okay";
249
250         bluetooth {
251                 compatible = "brcm,bcm43438-bt";
252                 max-speed = <2000000>;
253                 shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
254         };
255 };
256
257 /* uart1 is mapped to the pin header */
258 &uart1 {
259         pinctrl-names = "default";
260         pinctrl-0 = <&uart1_gpio14>;
261         status = "okay";
262 };
263
264 &vchiq {
265         interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
266 };
267
268 &vc4 {
269         status = "okay";
270 };
271
272 &vec {
273         status = "disabled";
274 };
275
276 // =============================================
277 // Downstream rpi- changes
278
279 #define BCM2711
280
281 #include "bcm270x.dtsi"
282 #include "bcm271x-rpi-bt.dtsi"
283
284 / {
285         soc {
286                 /delete-node/ pixelvalve@7e807000;
287                 /delete-node/ hdmi@7e902000;
288         };
289 };
290
291 #include "bcm2711-rpi-ds.dtsi"
292 #include "bcm283x-rpi-csi0-2lane.dtsi"
293 #include "bcm283x-rpi-csi1-4lane.dtsi"
294 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
295
296 / {
297         chosen {
298                 bootargs = "coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1";
299         };
300
301         aliases {
302                 serial0 = &uart1;
303                 serial1 = &uart0;
304                 mmc0 = &emmc2;
305                 mmc1 = &mmcnr;
306                 mmc2 = &sdhost;
307                 i2c3 = &i2c3;
308                 i2c4 = &i2c4;
309                 i2c5 = &i2c5;
310                 i2c6 = &i2c6;
311                 i2c20 = &ddc0;
312                 i2c21 = &ddc1;
313                 spi3 = &spi3;
314                 spi4 = &spi4;
315                 spi5 = &spi5;
316                 spi6 = &spi6;
317                 /delete-property/ intc;
318         };
319
320         /delete-node/ wifi-pwrseq;
321 };
322
323 &mmcnr {
324         pinctrl-names = "default";
325         pinctrl-0 = <&sdio_pins>;
326         bus-width = <4>;
327         status = "okay";
328 };
329
330 &uart0 {
331         pinctrl-0 = <&uart0_pins &bt_pins>;
332         status = "okay";
333 };
334
335 &uart1 {
336         pinctrl-0 = <&uart1_pins>;
337 };
338
339 &spi0 {
340         pinctrl-names = "default";
341         pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
342         cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
343
344         spidev0: spidev@0{
345                 compatible = "spidev";
346                 reg = <0>;      /* CE0 */
347                 #address-cells = <1>;
348                 #size-cells = <0>;
349                 spi-max-frequency = <125000000>;
350         };
351
352         spidev1: spidev@1{
353                 compatible = "spidev";
354                 reg = <1>;      /* CE1 */
355                 #address-cells = <1>;
356                 #size-cells = <0>;
357                 spi-max-frequency = <125000000>;
358         };
359 };
360
361 &gpio {
362         spi0_pins: spi0_pins {
363                 brcm,pins = <9 10 11>;
364                 brcm,function = <BCM2835_FSEL_ALT0>;
365         };
366
367         spi0_cs_pins: spi0_cs_pins {
368                 brcm,pins = <8 7>;
369                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
370         };
371
372         spi3_pins: spi3_pins {
373                 brcm,pins = <1 2 3>;
374                 brcm,function = <BCM2835_FSEL_ALT3>;
375         };
376
377         spi3_cs_pins: spi3_cs_pins {
378                 brcm,pins = <0 24>;
379                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
380         };
381
382         spi4_pins: spi4_pins {
383                 brcm,pins = <5 6 7>;
384                 brcm,function = <BCM2835_FSEL_ALT3>;
385         };
386
387         spi4_cs_pins: spi4_cs_pins {
388                 brcm,pins = <4 25>;
389                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
390         };
391
392         spi5_pins: spi5_pins {
393                 brcm,pins = <13 14 15>;
394                 brcm,function = <BCM2835_FSEL_ALT3>;
395         };
396
397         spi5_cs_pins: spi5_cs_pins {
398                 brcm,pins = <12 26>;
399                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
400         };
401
402         spi6_pins: spi6_pins {
403                 brcm,pins = <19 20 21>;
404                 brcm,function = <BCM2835_FSEL_ALT3>;
405         };
406
407         spi6_cs_pins: spi6_cs_pins {
408                 brcm,pins = <18 27>;
409                 brcm,function = <BCM2835_FSEL_GPIO_OUT>;
410         };
411
412         i2c0_pins: i2c0 {
413                 brcm,pins = <0 1>;
414                 brcm,function = <BCM2835_FSEL_ALT0>;
415                 brcm,pull = <BCM2835_PUD_UP>;
416         };
417
418         i2c1_pins: i2c1 {
419                 brcm,pins = <2 3>;
420                 brcm,function = <BCM2835_FSEL_ALT0>;
421                 brcm,pull = <BCM2835_PUD_UP>;
422         };
423
424         i2c3_pins: i2c3 {
425                 brcm,pins = <4 5>;
426                 brcm,function = <BCM2835_FSEL_ALT5>;
427                 brcm,pull = <BCM2835_PUD_UP>;
428         };
429
430         i2c4_pins: i2c4 {
431                 brcm,pins = <8 9>;
432                 brcm,function = <BCM2835_FSEL_ALT5>;
433                 brcm,pull = <BCM2835_PUD_UP>;
434         };
435
436         i2c5_pins: i2c5 {
437                 brcm,pins = <12 13>;
438                 brcm,function = <BCM2835_FSEL_ALT5>;
439                 brcm,pull = <BCM2835_PUD_UP>;
440         };
441
442         i2c6_pins: i2c6 {
443                 brcm,pins = <22 23>;
444                 brcm,function = <BCM2835_FSEL_ALT5>;
445                 brcm,pull = <BCM2835_PUD_UP>;
446         };
447
448         i2s_pins: i2s {
449                 brcm,pins = <18 19 20 21>;
450                 brcm,function = <BCM2835_FSEL_ALT0>;
451         };
452
453         sdio_pins: sdio_pins {
454                 brcm,pins =     <34 35 36 37 38 39>;
455                 brcm,function = <BCM2835_FSEL_ALT3>; // alt3 = SD1
456                 brcm,pull =     <0 2 2 2 2 2>;
457         };
458
459         bt_pins: bt_pins {
460                 brcm,pins = "-"; // non-empty to keep btuart happy, //4 = 0
461                                  // to fool pinctrl
462                 brcm,function = <0>;
463                 brcm,pull = <2>;
464         };
465
466         uart0_pins: uart0_pins {
467                 brcm,pins = <32 33>;
468                 brcm,function = <BCM2835_FSEL_ALT3>;
469                 brcm,pull = <0 2>;
470         };
471
472         uart1_pins: uart1_pins {
473                 brcm,pins;
474                 brcm,function;
475                 brcm,pull;
476         };
477
478         uart2_pins: uart2_pins {
479                 brcm,pins = <0 1>;
480                 brcm,function = <BCM2835_FSEL_ALT4>;
481                 brcm,pull = <0 2>;
482         };
483
484         uart3_pins: uart3_pins {
485                 brcm,pins = <4 5>;
486                 brcm,function = <BCM2835_FSEL_ALT4>;
487                 brcm,pull = <0 2>;
488         };
489
490         uart4_pins: uart4_pins {
491                 brcm,pins = <8 9>;
492                 brcm,function = <BCM2835_FSEL_ALT4>;
493                 brcm,pull = <0 2>;
494         };
495
496         uart5_pins: uart5_pins {
497                 brcm,pins = <12 13>;
498                 brcm,function = <BCM2835_FSEL_ALT4>;
499                 brcm,pull = <0 2>;
500         };
501 };
502
503 &i2c0if {
504         clock-frequency = <100000>;
505 };
506
507 &i2c1 {
508         pinctrl-names = "default";
509         pinctrl-0 = <&i2c1_pins>;
510         clock-frequency = <100000>;
511 };
512
513 &i2s {
514         pinctrl-names = "default";
515         pinctrl-0 = <&i2s_pins>;
516 };
517
518 // =============================================
519 // Board specific stuff here
520
521 &pcie0 {
522        brcm,enable-l1ss;
523 };
524
525 &sdhost {
526         status = "disabled";
527 };
528
529 &phy1 {
530         led-modes = <0x00 0x08>; /* link/activity link */
531 };
532
533 &gpio {
534         audio_pins: audio_pins {
535                 brcm,pins = <>;
536                 brcm,function = <>;
537         };
538 };
539
540 &leds {
541         act_led: led-act {
542                 label = "led0";
543                 linux,default-trigger = "mmc0";
544                 gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
545         };
546
547         pwr_led: led-pwr {
548                 label = "led1";
549                 linux,default-trigger = "default-on";
550                 gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
551         };
552 };
553
554 &pwm1 {
555         status = "disabled";
556 };
557
558 &audio {
559         pinctrl-names = "default";
560         pinctrl-0 = <&audio_pins>;
561         brcm,disable-headphones = <1>;
562 };
563
564 cam0_reg: &cam1_reg {
565         gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
566 };
567
568 / {
569         __overrides__ {
570                 act_led_gpio = <&act_led>,"gpios:4";
571                 act_led_activelow = <&act_led>,"gpios:8";
572                 act_led_trigger = <&act_led>,"linux,default-trigger";
573
574                 pwr_led_gpio = <&pwr_led>,"gpios:4";
575                 pwr_led_activelow = <&pwr_led>,"gpios:8";
576                 pwr_led_trigger = <&pwr_led>,"linux,default-trigger";
577
578                 eth_led0 = <&phy1>,"led-modes:0";
579                 eth_led1 = <&phy1>,"led-modes:4";
580
581                 ant1 =  <&ant1>,"output-high?=on",
582                         <&ant1>, "output-low?=off",
583                         <&ant2>, "output-high?=off",
584                         <&ant2>, "output-low?=on";
585                 ant2 =  <&ant1>,"output-high?=off",
586                         <&ant1>, "output-low?=on",
587                         <&ant2>, "output-high?=on",
588                         <&ant2>, "output-low?=off";
589                 noant = <&ant1>,"output-high?=off",
590                         <&ant1>, "output-low?=on",
591                         <&ant2>, "output-high?=off",
592                         <&ant2>, "output-low?=on";
593
594                 sd_poll_once = <&emmc2>, "non-removable?";
595                 spi_dma4 = <&spi0>, "dmas:0=", <&dma40>,
596                            <&spi0>, "dmas:8=", <&dma40>;
597         };
598 };