1// SPDX-License-Identifier: GPL-2.0
2/dts-v1/;
3#include "bcm2711.dtsi"
4#include "bcm2711-rpi.dtsi"
5#include "bcm283x-rpi-led-deprecated.dtsi"
6#include "bcm283x-rpi-usb-peripheral.dtsi"
7#include "bcm283x-rpi-wifi-bt.dtsi"
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	sd_io_1v8_reg: regulator-sd-io-1v8 {
19		compatible = "regulator-gpio";
20		regulator-name = "vdd-sd-io";
21		regulator-min-microvolt = <1800000>;
22		regulator-max-microvolt = <3300000>;
23		regulator-boot-on;
24		regulator-always-on;
25		regulator-settling-time-us = <5000>;
26		gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>;
27		states = <1800000 0x1>,
28			 <3300000 0x0>;
29		status = "okay";
30	};
31
32	sd_vcc_reg: regulator-sd-vcc {
33		compatible = "regulator-fixed";
34		regulator-name = "vcc-sd";
35		regulator-min-microvolt = <3300000>;
36		regulator-max-microvolt = <3300000>;
37		regulator-boot-on;
38		enable-active-high;
39		gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
40	};
41};
42
43&bt {
44	shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
45};
46
47&ddc0 {
48	status = "okay";
49};
50
51&ddc1 {
52	status = "okay";
53};
54
55&expgpio {
56	gpio-line-names = "BT_ON",		/*  0 */
57			  "WL_ON",
58			  "PWR_LED_OFF",
59			  "GLOBAL_RESET",
60			  "VDD_SD_IO_SEL",
61			  "CAM_GPIO",		/*  5 */
62			  "SD_PWR_ON",
63			  "";
64};
65
66&gpio {
67	/*
68	 * Parts taken from rpi_SCH_4b_4p0_reduced.pdf and
69	 * the official GPU firmware DT blob.
70	 *
71	 * Legend:
72	 * "FOO" = GPIO line named "FOO" on the schematic
73	 * "FOO_N" = GPIO line named "FOO" on schematic, active low
74	 */
75	gpio-line-names = "ID_SDA",		/*  0 */
76			  "ID_SCL",
77			  "SDA1",
78			  "SCL1",
79			  "GPIO_GCLK",
80			  "GPIO5",		/*  5 */
81			  "GPIO6",
82			  "SPI_CE1_N",
83			  "SPI_CE0_N",
84			  "SPI_MISO",
85			  "SPI_MOSI",		/* 10 */
86			  "SPI_SCLK",
87			  "GPIO12",
88			  "GPIO13",
89			  /* Serial port */
90			  "TXD1",
91			  "RXD1",		/* 15 */
92			  "GPIO16",
93			  "GPIO17",
94			  "GPIO18",
95			  "GPIO19",
96			  "GPIO20",		/* 20 */
97			  "GPIO21",
98			  "GPIO22",
99			  "GPIO23",
100			  "GPIO24",
101			  "GPIO25",		/* 25 */
102			  "GPIO26",
103			  "GPIO27",
104			  "RGMII_MDIO",
105			  "RGMIO_MDC",
106			  /* Used by BT module */
107			  "CTS0",		/* 30 */
108			  "RTS0",
109			  "TXD0",
110			  "RXD0",
111			  /* Used by Wifi */
112			  "SD1_CLK",
113			  "SD1_CMD",		/* 35 */
114			  "SD1_DATA0",
115			  "SD1_DATA1",
116			  "SD1_DATA2",
117			  "SD1_DATA3",
118			  /* Shared with SPI flash */
119			  "PWM0_MISO",		/* 40 */
120			  "PWM1_MOSI",
121			  "STATUS_LED_G_CLK",
122			  "SPIFLASH_CE_N",
123			  "SDA0",
124			  "SCL0",		/* 45 */
125			  "RGMII_RXCLK",
126			  "RGMII_RXCTL",
127			  "RGMII_RXD0",
128			  "RGMII_RXD1",
129			  "RGMII_RXD2",		/* 50 */
130			  "RGMII_RXD3",
131			  "RGMII_TXCLK",
132			  "RGMII_TXCTL",
133			  "RGMII_TXD0",
134			  "RGMII_TXD1",		/* 55 */
135			  "RGMII_TXD2",
136			  "RGMII_TXD3";
137};
138
139&hdmi0 {
140	status = "okay";
141};
142
143&hdmi1 {
144	status = "okay";
145};
146
147&led_act {
148	gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
149};
150
151&leds {
152	led_pwr: led-pwr {
153		label = "PWR";
154		gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
155		default-state = "keep";
156		linux,default-trigger = "default-on";
157	};
158};
159
160&pixelvalve0 {
161	status = "okay";
162};
163
164&pixelvalve1 {
165	status = "okay";
166};
167
168&pixelvalve2 {
169	status = "okay";
170};
171
172&pixelvalve4 {
173	status = "okay";
174};
175
176&pwm1 {
177	pinctrl-names = "default";
178	pinctrl-0 = <&pwm1_0_gpio40 &pwm1_1_gpio41>;
179	status = "okay";
180};
181
182/* EMMC2 is used to drive the SD card */
183&emmc2 {
184	vqmmc-supply = <&sd_io_1v8_reg>;
185	vmmc-supply = <&sd_vcc_reg>;
186	broken-cd;
187	status = "okay";
188};
189
190&genet {
191	phy-handle = <&phy1>;
192	phy-mode = "rgmii-rxid";
193	status = "okay";
194};
195
196&genet_mdio {
197	phy1: ethernet-phy@1 {
198		/* No PHY interrupt */
199		reg = <0x1>;
200	};
201};
202
203&pcie0 {
204	pci@0,0 {
205		device_type = "pci";
206		#address-cells = <3>;
207		#size-cells = <2>;
208		ranges;
209
210		reg = <0 0 0 0 0>;
211
212		usb@0,0 {
213			reg = <0 0 0 0 0>;
214			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
215		};
216	};
217};
218
219/* uart0 communicates with the BT module */
220&uart0 {
221	pinctrl-names = "default";
222	pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32>;
223	uart-has-rtscts;
224};
225
226/* uart1 is mapped to the pin header */
227&uart1 {
228	pinctrl-names = "default";
229	pinctrl-0 = <&uart1_gpio14>;
230	status = "okay";
231};
232
233&vc4 {
234	status = "okay";
235};
236
237&vec {
238	status = "disabled";
239};
240
241&wifi_pwrseq {
242	reset-gpios = <&expgpio 1 GPIO_ACTIVE_LOW>;
243};
244