From: Cyril Brulebois Date: Mon, 03 Jan 2022 21:59:36 +0100 Subject: arm64: dts: Add support for Raspberry Pi Compute Module 4 IO Board It was introduced in mainline during the v5.16 release cycle. Since many broadcom includes were reworked since v5.10, adding support would involve more than cherry-picking a DTS addition that uses a few includes. To avoid side effects on other models, introduce a DTS that leverages some existing includes (bcm2711.dtsi and bcm283x-rpi-usb-host.dtsi) and describes the rest without re-using parts of the Raspberry Pi 4 B model. To avoid phandle rotation (0x16, 0x17, and 0x18) across 3 nodes (dma@7e007000, i2c@7e205000, and interrupt-controller@7ef00100), and the related changes in other nodes referencing them, hardcode 0x16 as the phandle for interrupt-controller@7ef00100. This leads to an empty dtdiff between this new DTB and the one produced by a v5.16-rc8 build. Authored-by: Uwe Kleine-König Reviewed-by: Cyril Brulebois --- a/arch/arm64/boot/dts/broadcom/Makefile +++ b/arch/arm64/boot/dts/broadcom/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-io.dtb \ bcm2837-rpi-3-a-plus.dtb \ bcm2837-rpi-3-b.dtb \ bcm2837-rpi-3-b-plus.dtb \ --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-cm4-io.dts @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "arm/bcm2711-rpi-cm4-io.dts" --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -93,6 +93,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-3-b-plus.dtb \ bcm2837-rpi-cm3-io3.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-cm4-io.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtb dtb-$(CONFIG_ARCH_BCM_5301X) += \ --- /dev/null +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts @@ -0,0 +1,373 @@ +/dts-v1/; + +#include "bcm2711.dtsi" +#include "bcm283x-rpi-usb-host.dtsi" + +/ { + model = "Raspberry Pi Compute Module 4 IO Board"; + compatible = "raspberrypi,4-compute-module\0brcm,bcm2711"; + + aliases { + emmc2bus = "/emmc2bus"; + ethernet0 = "/scb/ethernet@7d580000"; + pcie0 = "/scb/pcie@7d500000"; + blconfig = &blconfig; + }; + + chosen { + stdout-path = "serial1:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led-act { + label = "ACT"; + default-state = "keep"; + linux,default-trigger = "heartbeat"; + gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; + }; + + led-pwr { + label = "PWR"; + gpios = <&expgpio 2 GPIO_ACTIVE_LOW>; + default-state = "keep"; + linux,default-trigger = "default-on"; + }; + }; + + soc { + aon_intr: interrupt-controller@7ef00100 { + compatible = "brcm,bcm2711-l2-intc", "brcm,l2-intc"; + reg = <0x7ef00100 0x30>; + phandle = <0x16>; + interrupts = ; + interrupt-controller; + #interrupt-cells = <1>; + }; + + firmware: firmware { + compatible = "raspberrypi,bcm2835-firmware\0simple-mfd"; + #address-cells = <0x01>; + #size-cells = <0x01>; + mboxes = <&mailbox>; + dma-ranges; + + firmware_clocks: clocks { + compatible = "raspberrypi,firmware-clocks"; + #clock-cells = <0x01>; + }; + + expgpio: gpio { + compatible = "raspberrypi,firmware-gpio"; + gpio-controller; + #gpio-cells = <2>; + status = "okay"; + gpio-line-names = "BT_ON", "WL_ON", "PWR_LED_OFF", "ANT1", "VDD_SD_IO_SEL", "CAM_GPIO", "SD_PWR_ON", "ANT2"; + ant1-hog { + gpio-hog; + gpios = <0x03 0x00>; + output-high; + line-name = "ant1"; + }; + + ant2-hog { + gpio-hog; + gpios = <0x07 0x00>; + output-low; + line-name = "ant2"; + }; + }; + + reset { + compatible = "raspberrypi,firmware-reset"; + #reset-cells = <1>; + }; + }; + + power: power { + compatible = "raspberrypi,bcm2835-power"; + firmware = <&firmware>; + #power-domain-cells = <1>; + }; + + mailbox@7e00b840 { + compatible = "brcm,bcm2835-vchiq"; + reg = <0x7e00b840 0x3c>; + interrupts = ; + }; + + vec@7ec13000 { + compatible = "brcm,bcm2711-vec"; + reg = <0x7ec13000 0x1000>; + clocks = <&clocks BCM2835_CLOCK_VEC>; + interrupts = ; + status = "disabled"; + power-domains = <&power /* RPI_POWER_DOMAIN_VEC = */ 7>; + }; + }; + + memory@0 { + device_type = "memory"; + reg = <0x00 0x00 0x00>; + }; + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&expgpio 0x01 0x01>; + }; + + sd_io_1v8_reg: sd_io_1v8_reg { + compatible = "regulator-gpio"; + regulator-name = "vdd-sd-io"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + regulator-settling-time-us = <5000>; + gpios = <&expgpio 0x04 GPIO_ACTIVE_HIGH>; + states = <1800000 0x1>, + <3300000 0x0>; + status = "okay"; + }; + + sd_vcc_reg: sd_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "vcc-sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + enable-active-high; + gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>; + }; +}; + +&ddc0 { + status = "okay"; +}; + +&ddc1 { + status = "okay"; +}; + +&dsi0 { + power-domains = <&power 17>; +}; + +&dsi1 { + compatible = "brcm,bcm2711-dsi1"; + power-domains = <&power 18>; +}; + +&emmc2 { + status = "okay"; + bus-width = <8>; + vqmmc-supply = <&sd_io_1v8_reg>; + vmmc-supply = <&sd_vcc_reg>; + broken-cd; + mmc-hs200-1_8v; +}; + +&gpio { + pinctrl-names = "default"; + /* + * Parts taken from rpi_SCH_4b_4p0_reduced.pdf and + * the official GPU firmware DT blob. + * + * Legend: + * "FOO" = GPIO line named "FOO" on the schematic + * "FOO_N" = GPIO line named "FOO" on schematic, active low + */ + gpio-line-names = "ID_SDA", + "ID_SCL", + "SDA1", + "SCL1", + "GPIO_GCLK", + "GPIO5", + "GPIO6", + "SPI_CE1_N", + "SPI_CE0_N", + "SPI_MISO", + "SPI_MOSI", + "SPI_SCLK", + "GPIO12", + "GPIO13", + /* Serial port */ + "TXD1", + "RXD1", + "GPIO16", + "GPIO17", + "GPIO18", + "GPIO19", + "GPIO20", + "GPIO21", + "GPIO22", + "GPIO23", + "GPIO24", + "GPIO25", + "GPIO26", + "GPIO27", + "RGMII_MDIO", + "RGMIO_MDC", + /* Used by BT module */ + "CTS0", + "RTS0", + "TXD0", + "RXD0", + /* Used by Wifi */ + "SD1_CLK", + "SD1_CMD", + "SD1_DATA0", + "SD1_DATA1", + "SD1_DATA2", + "SD1_DATA3", + /* Shared with SPI flash */ + "PWM0_MISO", + "PWM1_MOSI", + "STATUS_LED_G_CLK", + "SPIFLASH_CE_N", + "SDA0", + "SCL0", + "RGMII_RXCLK", + "RGMII_RXCTL", + "RGMII_RXD0", + "RGMII_RXD1", + "RGMII_RXD2", + "RGMII_RXD3", + "RGMII_TXCLK", + "RGMII_TXCTL", + "RGMII_TXD0", + "RGMII_TXD1", + "RGMII_TXD2", + "RGMII_TXD3"; + + gpioout { + brcm,pins = <0x06>; + brcm,function = <0x01>; + }; + + alt0 { + brcm,pins = <0x04 0x05 0x07 0x08 0x09 0x0a 0x0b>; + brcm,function = <0x04>; + }; +}; + +&hdmi0 { + status = "okay"; + interrupt-parent = <&aon_intr>; + interrupts = <0>, <1>, <2>, <3>, <4>, <5>; + interrupt-names = "cec-tx", "cec-rx", "cec-low", "wakeup", "hpd-connected", "hpd-removed"; + clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>; + wifi-2.4ghz-coexistence; +}; + +&hdmi1 { + status = "okay"; + interrupt-parent = <&aon_intr>; + interrupts = <8>, <7>, <6>, <9>, <10>, <11>; + interrupt-names = "cec-tx", "cec-rx", "cec-low", "wakeup", "hpd-connected", "hpd-removed"; + clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>; + wifi-2.4ghz-coexistence; +}; + +&hvs { + clocks = <&firmware_clocks 4>; +}; + +&i2c0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio0>; + clock-frequency = <100000>; +}; + +&i2c1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_gpio2>; + clock-frequency = <100000>; +}; + +&genet { + status = "okay"; + phy-handle = <ðphy0>; + phy-mode = "rgmii-rxid"; +}; + +&genet_mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&pixelvalve0 { + status = "okay"; +}; + +&pixelvalve1 { + status = "okay"; +}; + +&pixelvalve2 { + status = "okay"; +}; + +&pixelvalve4 { + status = "okay"; +}; + +&rmem { + blconfig: nvram@0 { + compatible = "raspberrypi,bootloader-config", "nvmem-rmem"; + #address-cells = <0x01>; + #size-cells = <0x01>; + reg = <0x00 0x00 0x00>; + no-map; + status = "disabled"; + }; +}; + +&sdhci { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_gpio34>; + bus-width = <4>; + non-removable; + mmc-pwrseq = <&wifi_pwrseq>; + + wifi@1 { + reg = <0x01>; + compatible = "brcm,bcm4329-fmac"; + }; +}; + +&uart0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>; + uart-has-rtscts; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + max-speed = <0x1e8480>; + shutdown-gpios = <&expgpio 0x00 0x00>; + }; +}; + +&uart1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&uart1_gpio14>; +}; + +&usb { + power-domains = <&power 6>; +}; + +&vc4 { + status = "okay"; +}; + +/delete-node/ &vec;