1// SPDX-License-Identifier: GPL-2.0
2/dts-v1/;
3#include "bcm2711.dtsi"
4#include "bcm2835-rpi.dtsi"
5#include "bcm283x-rpi-usb-peripheral.dtsi"
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	leds {
32		act {
33			gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
34		};
35
36		pwr {
37			label = "PWR";
38			gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
39			default-state = "keep";
40			linux,default-trigger = "default-on";
41		};
42	};
43
44	wifi_pwrseq: wifi-pwrseq {
45		compatible = "mmc-pwrseq-simple";
46		reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
47	};
48
49	sd_io_1v8_reg: sd_io_1v8_reg {
50		compatible = "regulator-gpio";
51		regulator-name = "vdd-sd-io";
52		regulator-min-microvolt = <1800000>;
53		regulator-max-microvolt = <3300000>;
54		regulator-boot-on;
55		regulator-always-on;
56		regulator-settling-time-us = <5000>;
57		gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>;
58		states = <1800000 0x1
59			  3300000 0x0>;
60		status = "okay";
61	};
62
63	sd_vcc_reg: sd_vcc_reg {
64		compatible = "regulator-fixed";
65		regulator-name = "vcc-sd";
66		regulator-min-microvolt = <3300000>;
67		regulator-max-microvolt = <3300000>;
68		regulator-boot-on;
69		enable-active-high;
70		gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
71	};
72};
73
74&ddc0 {
75	status = "okay";
76};
77
78&ddc1 {
79	status = "okay";
80};
81
82&firmware {
83	firmware_clocks: clocks {
84		compatible = "raspberrypi,firmware-clocks";
85		#clock-cells = <1>;
86	};
87
88	expgpio: gpio {
89		compatible = "raspberrypi,firmware-gpio";
90		gpio-controller;
91		#gpio-cells = <2>;
92		gpio-line-names = "BT_ON",
93				  "WL_ON",
94				  "PWR_LED_OFF",
95				  "GLOBAL_RESET",
96				  "VDD_SD_IO_SEL",
97				  "CAM_GPIO",
98				  "SD_PWR_ON",
99				  "";
100		status = "okay";
101	};
102
103	reset: reset {
104		compatible = "raspberrypi,firmware-reset";
105		#reset-cells = <1>;
106	};
107};
108
109&gpio {
110	/*
111	 * Parts taken from rpi_SCH_4b_4p0_reduced.pdf and
112	 * the official GPU firmware DT blob.
113	 *
114	 * Legend:
115	 * "FOO" = GPIO line named "FOO" on the schematic
116	 * "FOO_N" = GPIO line named "FOO" on schematic, active low
117	 */
118	gpio-line-names = "ID_SDA",
119			  "ID_SCL",
120			  "SDA1",
121			  "SCL1",
122			  "GPIO_GCLK",
123			  "GPIO5",
124			  "GPIO6",
125			  "SPI_CE1_N",
126			  "SPI_CE0_N",
127			  "SPI_MISO",
128			  "SPI_MOSI",
129			  "SPI_SCLK",
130			  "GPIO12",
131			  "GPIO13",
132			  /* Serial port */
133			  "TXD1",
134			  "RXD1",
135			  "GPIO16",
136			  "GPIO17",
137			  "GPIO18",
138			  "GPIO19",
139			  "GPIO20",
140			  "GPIO21",
141			  "GPIO22",
142			  "GPIO23",
143			  "GPIO24",
144			  "GPIO25",
145			  "GPIO26",
146			  "GPIO27",
147			  "RGMII_MDIO",
148			  "RGMIO_MDC",
149			  /* Used by BT module */
150			  "CTS0",
151			  "RTS0",
152			  "TXD0",
153			  "RXD0",
154			  /* Used by Wifi */
155			  "SD1_CLK",
156			  "SD1_CMD",
157			  "SD1_DATA0",
158			  "SD1_DATA1",
159			  "SD1_DATA2",
160			  "SD1_DATA3",
161			  /* Shared with SPI flash */
162			  "PWM0_MISO",
163			  "PWM1_MOSI",
164			  "STATUS_LED_G_CLK",
165			  "SPIFLASH_CE_N",
166			  "SDA0",
167			  "SCL0",
168			  "RGMII_RXCLK",
169			  "RGMII_RXCTL",
170			  "RGMII_RXD0",
171			  "RGMII_RXD1",
172			  "RGMII_RXD2",
173			  "RGMII_RXD3",
174			  "RGMII_TXCLK",
175			  "RGMII_TXCTL",
176			  "RGMII_TXD0",
177			  "RGMII_TXD1",
178			  "RGMII_TXD2",
179			  "RGMII_TXD3";
180};
181
182&hdmi0 {
183	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>;
184	clock-names = "hdmi", "bvb", "audio", "cec";
185	wifi-2.4ghz-coexistence;
186	status = "okay";
187};
188
189&hdmi1 {
190	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>;
191	clock-names = "hdmi", "bvb", "audio", "cec";
192	wifi-2.4ghz-coexistence;
193	status = "okay";
194};
195
196&hvs {
197	clocks = <&firmware_clocks 4>;
198};
199
200&pixelvalve0 {
201	status = "okay";
202};
203
204&pixelvalve1 {
205	status = "okay";
206};
207
208&pixelvalve2 {
209	status = "okay";
210};
211
212&pixelvalve4 {
213	status = "okay";
214};
215
216&pwm1 {
217	pinctrl-names = "default";
218	pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
219	status = "okay";
220};
221
222&rmem {
223	/*
224	 * RPi4's co-processor will copy the board's bootloader configuration
225	 * into memory for the OS to consume. It'll also update this node with
226	 * its placement information.
227	 */
228	blconfig: nvram@0 {
229		compatible = "raspberrypi,bootloader-config", "nvmem-rmem";
230		#address-cells = <1>;
231		#size-cells = <1>;
232		reg = <0x0 0x0 0x0>;
233		no-map;
234		status = "disabled";
235	};
236};
237
238/* SDHCI is used to control the SDIO for wireless */
239&sdhci {
240	#address-cells = <1>;
241	#size-cells = <0>;
242	pinctrl-names = "default";
243	pinctrl-0 = <&emmc_gpio34>;
244	bus-width = <4>;
245	non-removable;
246	mmc-pwrseq = <&wifi_pwrseq>;
247	status = "okay";
248
249	brcmf: wifi@1 {
250		reg = <1>;
251		compatible = "brcm,bcm4329-fmac";
252	};
253};
254
255/* EMMC2 is used to drive the SD card */
256&emmc2 {
257	vqmmc-supply = <&sd_io_1v8_reg>;
258	vmmc-supply = <&sd_vcc_reg>;
259	broken-cd;
260	status = "okay";
261};
262
263&genet {
264	phy-handle = <&phy1>;
265	phy-mode = "rgmii-rxid";
266	status = "okay";
267};
268
269&genet_mdio {
270	phy1: ethernet-phy@1 {
271		/* No PHY interrupt */
272		reg = <0x1>;
273	};
274};
275
276&pcie0 {
277	pci@1,0 {
278		#address-cells = <3>;
279		#size-cells = <2>;
280		ranges;
281
282		reg = <0 0 0 0 0>;
283
284		usb@1,0 {
285			reg = <0x10000 0 0 0 0>;
286			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
287		};
288	};
289};
290
291/* uart0 communicates with the BT module */
292&uart0 {
293	pinctrl-names = "default";
294	pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
295	uart-has-rtscts;
296	status = "okay";
297
298	bluetooth {
299		compatible = "brcm,bcm43438-bt";
300		max-speed = <2000000>;
301		shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
302	};
303};
304
305/* uart1 is mapped to the pin header */
306&uart1 {
307	pinctrl-names = "default";
308	pinctrl-0 = <&uart1_gpio14>;
309	status = "okay";
310};
311
312&vchiq {
313	interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
314};
315
316&vc4 {
317	status = "okay";
318};
319
320&vec {
321	status = "disabled";
322};
323