summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Gherzan <andrei@gherzan.ro>2019-07-18 13:30:32 +0100
committerAndrei Gherzan <andrei@gherzan.ro>2019-07-18 17:00:07 +0100
commitc33649a678401783a23ffbb59c1afbf1f5c2b9c4 (patch)
tree95a06d0a1b8d3aed9be2c6be20c20c92c5898de2
parente4936f361b63a57ee324abe71ce0642d36b81172 (diff)
downloadmeta-raspberrypi-c33649a678401783a23ffbb59c1afbf1f5c2b9c4.tar.gz
u-boot: Replace custom fork by patches
The upstream branch might suffer rebases due to effort of pushing the patches upstream. To avoid issues, let's have here the patches we need for RPi 4 support. Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0001-configs-rpi4-Add-defconfigs-for-rpi4-32-64.patch111
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0002-dts-Create-a-dtsi-for-BCM2835-6-7-specific-configura.patch209
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0003-dts-Add-initial-support-for-bcm2838.patch333
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0004-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch67
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0005-arm-mach-bcm283x-Define-mbox-address-for-BCM2838.patch35
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0006-rpi-Add-rpi_model-entry-for-RaspberryPi-4.patch35
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0007-dt-bindings-Define-BCM2838_CLOCK_EMMC2-needed-for-Ra.patch27
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0008-arm-bcm283x-Include-definition-for-additional-emmc-c.patch32
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0009-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch53
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0010-arm-bcm283x-Define-device-base-addresses-for-bcm2835.patch64
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0011-rpi-Add-memory-map-for-bcm2838.patch59
-rw-r--r--recipes-bsp/u-boot/u-boot-2019.07/0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch68
-rw-r--r--recipes-bsp/u-boot/u-boot_2019.07.bbappend21
13 files changed, 1110 insertions, 4 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0001-configs-rpi4-Add-defconfigs-for-rpi4-32-64.patch b/recipes-bsp/u-boot/u-boot-2019.07/0001-configs-rpi4-Add-defconfigs-for-rpi4-32-64.patch
new file mode 100644
index 0000000..2fe7b9e
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0001-configs-rpi4-Add-defconfigs-for-rpi4-32-64.patch
@@ -0,0 +1,111 @@
1From 2a59e8a0d574c5f878e7cf640dd2337ac5721372 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:32:11 +0100
4Subject: [PATCH 01/12] configs: rpi4: Add defconfigs for rpi4 (32/64)
5
6Signed-off-by: Andrei Gherzan <andrei@balena.io>
7Upstream-status: Pending
8---
9 configs/rpi_4_32b_defconfig | 41 +++++++++++++++++++++++++++++++++++++
10 configs/rpi_4_defconfig | 41 +++++++++++++++++++++++++++++++++++++
11 2 files changed, 82 insertions(+)
12 create mode 100644 configs/rpi_4_32b_defconfig
13 create mode 100644 configs/rpi_4_defconfig
14
15diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
16new file mode 100644
17index 0000000000..3ee33174bc
18--- /dev/null
19+++ b/configs/rpi_4_32b_defconfig
20@@ -0,0 +1,41 @@
21+CONFIG_ARM=y
22+CONFIG_ARCH_BCM283X=y
23+CONFIG_SYS_TEXT_BASE=0x00008000
24+CONFIG_TARGET_RPI_4_32B=y
25+CONFIG_SYS_MALLOC_F_LEN=0x2000
26+CONFIG_DISTRO_DEFAULTS=y
27+CONFIG_NR_DRAM_BANKS=1
28+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
29+CONFIG_OF_BOARD_SETUP=y
30+CONFIG_MISC_INIT_R=y
31+# CONFIG_DISPLAY_CPUINFO is not set
32+# CONFIG_DISPLAY_BOARDINFO is not set
33+CONFIG_SYS_PROMPT="U-Boot> "
34+# CONFIG_CMD_FLASH is not set
35+CONFIG_CMD_GPIO=y
36+CONFIG_CMD_MMC=y
37+CONFIG_CMD_USB=y
38+CONFIG_CMD_FS_UUID=y
39+CONFIG_OF_EMBED=y
40+CONFIG_DEFAULT_DEVICE_TREE="bcm2838-rpi-4-b"
41+CONFIG_ENV_FAT_INTERFACE="mmc"
42+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
43+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
44+CONFIG_DM_KEYBOARD=y
45+CONFIG_DM_MMC=y
46+CONFIG_MMC_SDHCI=y
47+CONFIG_MMC_SDHCI_BCM2835=y
48+CONFIG_PHYLIB=y
49+CONFIG_DM_ETH=y
50+CONFIG_PINCTRL=y
51+# CONFIG_PINCTRL_GENERIC is not set
52+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
53+CONFIG_USB=y
54+CONFIG_DM_USB=y
55+CONFIG_USB_KEYBOARD=y
56+CONFIG_USB_HOST_ETHER=y
57+CONFIG_DM_VIDEO=y
58+CONFIG_SYS_WHITE_ON_BLACK=y
59+CONFIG_CONSOLE_SCROLL_LINES=10
60+CONFIG_PHYS_TO_BUS=y
61+CONFIG_OF_LIBFDT_OVERLAY=y
62diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
63new file mode 100644
64index 0000000000..b91b0869e5
65--- /dev/null
66+++ b/configs/rpi_4_defconfig
67@@ -0,0 +1,41 @@
68+CONFIG_ARM=y
69+CONFIG_ARCH_BCM283X=y
70+CONFIG_SYS_TEXT_BASE=0x00080000
71+CONFIG_TARGET_RPI_4=y
72+CONFIG_SYS_MALLOC_F_LEN=0x2000
73+CONFIG_DISTRO_DEFAULTS=y
74+CONFIG_NR_DRAM_BANKS=1
75+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
76+CONFIG_OF_BOARD_SETUP=y
77+CONFIG_MISC_INIT_R=y
78+# CONFIG_DISPLAY_CPUINFO is not set
79+# CONFIG_DISPLAY_BOARDINFO is not set
80+CONFIG_SYS_PROMPT="U-Boot> "
81+# CONFIG_CMD_FLASH is not set
82+CONFIG_CMD_GPIO=y
83+CONFIG_CMD_MMC=y
84+CONFIG_CMD_USB=y
85+CONFIG_CMD_FS_UUID=y
86+CONFIG_OF_EMBED=y
87+CONFIG_DEFAULT_DEVICE_TREE="bcm2838-rpi-4-b"
88+CONFIG_ENV_FAT_INTERFACE="mmc"
89+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
90+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
91+CONFIG_DM_KEYBOARD=y
92+CONFIG_DM_MMC=y
93+CONFIG_MMC_SDHCI=y
94+CONFIG_MMC_SDHCI_BCM2835=y
95+CONFIG_PHYLIB=y
96+CONFIG_DM_ETH=y
97+CONFIG_PINCTRL=y
98+# CONFIG_PINCTRL_GENERIC is not set
99+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
100+CONFIG_USB=y
101+CONFIG_DM_USB=y
102+CONFIG_USB_KEYBOARD=y
103+CONFIG_USB_HOST_ETHER=y
104+CONFIG_DM_VIDEO=y
105+CONFIG_SYS_WHITE_ON_BLACK=y
106+CONFIG_CONSOLE_SCROLL_LINES=10
107+CONFIG_PHYS_TO_BUS=y
108+CONFIG_OF_LIBFDT_OVERLAY=y
109--
1102.22.0
111
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0002-dts-Create-a-dtsi-for-BCM2835-6-7-specific-configura.patch b/recipes-bsp/u-boot/u-boot-2019.07/0002-dts-Create-a-dtsi-for-BCM2835-6-7-specific-configura.patch
new file mode 100644
index 0000000..eda8b56
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0002-dts-Create-a-dtsi-for-BCM2835-6-7-specific-configura.patch
@@ -0,0 +1,209 @@
1From 9ef5ac66aaa8e52d1ed3a6fd6390d7d8d91a537d Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:32:34 +0100
4Subject: [PATCH 02/12] dts: Create a dtsi for BCM2835/6/7 specific
5 configuration
6
7This follows a similar change in kernel[1]. The change moves
8configuration that was not applicable for all bcm2835/6/7/8 out of
9bcm283x.dtsi. The new file is bcm2835-common.dtsi and contains
10conifguration that is common for bcm2835/6/7 (not bcm2838).
11
12[1] https://github.com/raspberrypi/linux/commit/769a7330aa5bebcc98b1ff12ecb767db4e5c644d#diff-5979fba23a5bab2cf66dde09db872dfc
13
14Signed-off-by: Andrei Gherzan <andrei@balena.io>
15Upstream-status: Pending
16---
17 arch/arm/dts/bcm2835-common.dtsi | 53 ++++++++++++++++++++++++++++++++
18 arch/arm/dts/bcm2835.dtsi | 1 +
19 arch/arm/dts/bcm2836.dtsi | 1 +
20 arch/arm/dts/bcm2837.dtsi | 1 +
21 arch/arm/dts/bcm283x.dtsi | 45 +--------------------------
22 5 files changed, 57 insertions(+), 44 deletions(-)
23 create mode 100644 arch/arm/dts/bcm2835-common.dtsi
24
25diff --git a/arch/arm/dts/bcm2835-common.dtsi b/arch/arm/dts/bcm2835-common.dtsi
26new file mode 100644
27index 0000000000..17771730a3
28--- /dev/null
29+++ b/arch/arm/dts/bcm2835-common.dtsi
30@@ -0,0 +1,53 @@
31+// SPDX-License-Identifier: GPL-2.0
32+
33+/* This include file covers the common peripherals and configuration between
34+ * bcm2835, bcm2836 and bcm2837 implementations.
35+ */
36+
37+/ {
38+ soc {
39+ timer@7e003000 {
40+ compatible = "brcm,bcm2835-system-timer";
41+ reg = <0x7e003000 0x1000>;
42+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
43+ /* This could be a reference to BCM2835_CLOCK_TIMER,
44+ * but we don't have the driver using the common clock
45+ * support yet.
46+ */
47+ clock-frequency = <1000000>;
48+ };
49+
50+ intc: interrupt-controller@7e00b200 {
51+ compatible = "brcm,bcm2835-armctrl-ic";
52+ reg = <0x7e00b200 0x200>;
53+ interrupt-controller;
54+ #interrupt-cells = <2>;
55+ };
56+
57+ thermal: thermal@7e212000 {
58+ compatible = "brcm,bcm2835-thermal";
59+ reg = <0x7e212000 0x8>;
60+ clocks = <&clocks BCM2835_CLOCK_TSENS>;
61+ #thermal-sensor-cells = <0>;
62+ status = "disabled";
63+ };
64+
65+ v3d: v3d@7ec00000 {
66+ compatible = "brcm,bcm2835-v3d";
67+ reg = <0x7ec00000 0x1000>;
68+ interrupts = <1 10>;
69+ };
70+ };
71+};
72+
73+&gpio {
74+ i2c_slave_gpio18: i2c_slave_gpio18 {
75+ brcm,pins = <18 19 20 21>;
76+ brcm,function = <BCM2835_FSEL_ALT3>;
77+ };
78+
79+ jtag_gpio4: jtag_gpio4 {
80+ brcm,pins = <4 5 6 12 13>;
81+ brcm,function = <BCM2835_FSEL_ALT5>;
82+ };
83+};
84diff --git a/arch/arm/dts/bcm2835.dtsi b/arch/arm/dts/bcm2835.dtsi
85index a5c3824c80..53bf4579cc 100644
86--- a/arch/arm/dts/bcm2835.dtsi
87+++ b/arch/arm/dts/bcm2835.dtsi
88@@ -1,5 +1,6 @@
89 // SPDX-License-Identifier: GPL-2.0
90 #include "bcm283x.dtsi"
91+#include "bcm2835-common.dtsi"
92
93 / {
94 compatible = "brcm,bcm2835";
95diff --git a/arch/arm/dts/bcm2836.dtsi b/arch/arm/dts/bcm2836.dtsi
96index c933e84138..82d6c4662a 100644
97--- a/arch/arm/dts/bcm2836.dtsi
98+++ b/arch/arm/dts/bcm2836.dtsi
99@@ -1,5 +1,6 @@
100 // SPDX-License-Identifier: GPL-2.0
101 #include "bcm283x.dtsi"
102+#include "bcm2835-common.dtsi"
103
104 / {
105 compatible = "brcm,bcm2836";
106diff --git a/arch/arm/dts/bcm2837.dtsi b/arch/arm/dts/bcm2837.dtsi
107index beb6c502da..9e95fee78e 100644
108--- a/arch/arm/dts/bcm2837.dtsi
109+++ b/arch/arm/dts/bcm2837.dtsi
110@@ -1,4 +1,5 @@
111 #include "bcm283x.dtsi"
112+#include "bcm2835-common.dtsi"
113
114 / {
115 compatible = "brcm,bcm2837";
116diff --git a/arch/arm/dts/bcm283x.dtsi b/arch/arm/dts/bcm283x.dtsi
117index 9777644c6c..a024727e4d 100644
118--- a/arch/arm/dts/bcm283x.dtsi
119+++ b/arch/arm/dts/bcm283x.dtsi
120@@ -56,17 +56,6 @@
121 #address-cells = <1>;
122 #size-cells = <1>;
123
124- timer@7e003000 {
125- compatible = "brcm,bcm2835-system-timer";
126- reg = <0x7e003000 0x1000>;
127- interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
128- /* This could be a reference to BCM2835_CLOCK_TIMER,
129- * but we don't have the driver using the common clock
130- * support yet.
131- */
132- clock-frequency = <1000000>;
133- };
134-
135 txp@7e004000 {
136 compatible = "brcm,bcm2835-txp";
137 reg = <0x7e004000 0x20>;
138@@ -114,13 +103,6 @@
139 brcm,dma-channel-mask = <0x7f35>;
140 };
141
142- intc: interrupt-controller@7e00b200 {
143- compatible = "brcm,bcm2835-armctrl-ic";
144- reg = <0x7e00b200 0x200>;
145- interrupt-controller;
146- #interrupt-cells = <2>;
147- };
148-
149 pm: watchdog@7e100000 {
150 compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
151 #power-domain-cells = <1>;
152@@ -184,8 +166,7 @@
153 interrupt-controller;
154 #interrupt-cells = <2>;
155
156- /* Defines pin muxing groups according to
157- * BCM2835-ARM-Peripherals.pdf page 102.
158+ /* Defines common pin muxing groups
159 *
160 * While each pin can have its mux selected
161 * for various functions individually, some
162@@ -263,15 +244,6 @@
163 brcm,pins = <44 45>;
164 brcm,function = <BCM2835_FSEL_ALT2>;
165 };
166- i2c_slave_gpio18: i2c_slave_gpio18 {
167- brcm,pins = <18 19 20 21>;
168- brcm,function = <BCM2835_FSEL_ALT3>;
169- };
170-
171- jtag_gpio4: jtag_gpio4 {
172- brcm,pins = <4 5 6 12 13>;
173- brcm,function = <BCM2835_FSEL_ALT5>;
174- };
175 jtag_gpio22: jtag_gpio22 {
176 brcm,pins = <22 23 24 25 26 27>;
177 brcm,function = <BCM2835_FSEL_ALT4>;
178@@ -488,14 +460,6 @@
179
180 };
181
182- thermal: thermal@7e212000 {
183- compatible = "brcm,bcm2835-thermal";
184- reg = <0x7e212000 0x8>;
185- clocks = <&clocks BCM2835_CLOCK_TSENS>;
186- #thermal-sensor-cells = <0>;
187- status = "disabled";
188- };
189-
190 aux: aux@7e215000 {
191 compatible = "brcm,bcm2835-aux";
192 #clock-cells = <1>;
193@@ -635,13 +599,6 @@
194 phy-names = "usb2-phy";
195 };
196
197- v3d: v3d@7ec00000 {
198- compatible = "brcm,bcm2835-v3d";
199- reg = <0x7ec00000 0x1000>;
200- interrupts = <1 10>;
201- power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>;
202- };
203-
204 vc4: gpu {
205 compatible = "brcm,bcm2835-vc4";
206 };
207--
2082.22.0
209
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0003-dts-Add-initial-support-for-bcm2838.patch b/recipes-bsp/u-boot/u-boot-2019.07/0003-dts-Add-initial-support-for-bcm2838.patch
new file mode 100644
index 0000000..b6b8ca7
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0003-dts-Add-initial-support-for-bcm2838.patch
@@ -0,0 +1,333 @@
1From 9a6dca219480423f6c9dd5804e5890d434cc11b8 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:32:46 +0100
4Subject: [PATCH 03/12] dts: Add initial support for bcm2838
5
6Signed-off-by: Andrei Gherzan <andrei@balena.io>
7Upstream-status: Pending
8---
9 arch/arm/dts/Makefile | 3 +-
10 arch/arm/dts/bcm2838-rpi-4-b.dts | 52 +++++++
11 arch/arm/dts/bcm2838.dtsi | 237 +++++++++++++++++++++++++++++++
12 3 files changed, 291 insertions(+), 1 deletion(-)
13 create mode 100644 arch/arm/dts/bcm2838-rpi-4-b.dts
14 create mode 100644 arch/arm/dts/bcm2838.dtsi
15
16diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
17index 20dbc2ff84..fdb55f7fde 100644
18--- a/arch/arm/dts/Makefile
19+++ b/arch/arm/dts/Makefile
20@@ -749,7 +749,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
21 bcm2837-rpi-3-a-plus.dtb \
22 bcm2837-rpi-3-b.dtb \
23 bcm2837-rpi-3-b-plus.dtb \
24- bcm2837-rpi-cm3-io3.dtb
25+ bcm2837-rpi-cm3-io3.dtb \
26+ bcm2838-rpi-4-b.dtb
27
28 dtb-$(CONFIG_ARCH_BCM63158) += \
29 bcm963158.dtb
30diff --git a/arch/arm/dts/bcm2838-rpi-4-b.dts b/arch/arm/dts/bcm2838-rpi-4-b.dts
31new file mode 100644
32index 0000000000..fa7fcfed9d
33--- /dev/null
34+++ b/arch/arm/dts/bcm2838-rpi-4-b.dts
35@@ -0,0 +1,52 @@
36+/dts-v1/;
37+#include "bcm2838.dtsi"
38+
39+/ {
40+ compatible = "raspberrypi,4-model-b","brcm,bcm2838","brcm,bcm2837";
41+ model = "Raspberry Pi 4 Model B";
42+
43+ memory {
44+ reg = <0 0 0x0>;
45+ };
46+
47+ leds {
48+ act {
49+ gpios = <&gpio 47 0>;
50+ };
51+ };
52+};
53+
54+/* uart0 communicates with the BT module */
55+&uart0 {
56+ pinctrl-names = "default";
57+ pinctrl-0 = <&uart0_gpio32 &gpclk2_gpio43>;
58+ status = "okay";
59+};
60+
61+/* uart1 is mapped to the pin header */
62+&uart1 {
63+ pinctrl-names = "default";
64+ pinctrl-0 = <&uart1_pins>;
65+ status = "okay";
66+};
67+
68+&sdhci {
69+ status = "disabled";
70+};
71+
72+&sdhost {
73+ status = "disabled";
74+};
75+
76+&emmc2 {
77+ compatible = "brcm,bcm2711-emmc2";
78+ status = "okay";
79+};
80+
81+&gpio {
82+ uart1_pins: uart1_pins {
83+ brcm,pins;
84+ brcm,function;
85+ brcm,pull;
86+ };
87+};
88diff --git a/arch/arm/dts/bcm2838.dtsi b/arch/arm/dts/bcm2838.dtsi
89new file mode 100644
90index 0000000000..19b2d7b905
91--- /dev/null
92+++ b/arch/arm/dts/bcm2838.dtsi
93@@ -0,0 +1,237 @@
94+#include "bcm283x.dtsi"
95+#include <dt-bindings/interrupt-controller/arm-gic.h>
96+#include <dt-bindings/power/raspberrypi-power.h>
97+
98+/ {
99+ compatible = "brcm,bcm2838";
100+
101+ #address-cells = <2>;
102+ #size-cells = <1>;
103+
104+ interrupt-parent = <&gic>;
105+
106+ soc {
107+ ranges = <0x7e000000 0x0 0xfe000000 0x01800000>,
108+ <0x7c000000 0x0 0xfc000000 0x02000000>,
109+ <0x40000000 0x0 0xff800000 0x00800000>;
110+ dma-ranges = <0xc0000000 0x0 0x00000000 0x3c000000>;
111+
112+ gic: gic400@40041000 {
113+ interrupt-controller;
114+ #interrupt-cells = <3>;
115+ compatible = "arm,gic-400";
116+ reg = <0x40041000 0x1000>,
117+ <0x40042000 0x2000>,
118+ <0x40044000 0x2000>,
119+ <0x40046000 0x2000>;
120+ };
121+
122+ thermal: thermal@7d5d2200 {
123+ compatible = "brcm,avs-tmon-bcm2838";
124+ reg = <0x7d5d2200 0x2c>;
125+ interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
126+ interrupt-names = "tmon";
127+ clocks = <&clocks BCM2835_CLOCK_TSENS>;
128+ #thermal-sensor-cells = <0>;
129+ status = "okay";
130+ };
131+
132+ spi@7e204000 {
133+ reg = <0x7e204000 0x0200>;
134+ interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
135+ };
136+
137+ pixelvalve@7e206000 {
138+ interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
139+ };
140+
141+ pixelvalve@7e207000 {
142+ interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
143+ };
144+
145+ hvs@7e400000 {
146+ interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
147+ };
148+
149+ emmc2: emmc2@7e340000 {
150+ compatible = "brcm,bcm2711-emmc2";
151+ status = "okay";
152+ interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
153+ clocks = <&clocks BCM2838_CLOCK_EMMC2>;
154+ reg = <0x7e340000 0x100>;
155+ };
156+
157+ pixelvalve@7e807000 {
158+ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
159+ };
160+
161+ };
162+
163+ arm-pmu {
164+ /*
165+ * N.B. the A72 PMU support only exists in arch/arm64, hence
166+ * the fallback to the A53 version.
167+ */
168+ compatible = "arm,cortex-a72-pmu", "arm,cortex-a53-pmu";
169+ interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
170+ <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
171+ <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
172+ <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
173+ };
174+
175+ timer {
176+ compatible = "arm,armv7-timer";
177+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
178+ IRQ_TYPE_LEVEL_LOW)>,
179+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
180+ IRQ_TYPE_LEVEL_LOW)>,
181+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
182+ IRQ_TYPE_LEVEL_LOW)>,
183+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
184+ IRQ_TYPE_LEVEL_LOW)>;
185+ arm,cpu-registers-not-fw-configured;
186+ always-on;
187+ };
188+
189+ cpus: cpus {
190+ #address-cells = <1>;
191+ #size-cells = <0>;
192+ enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit
193+
194+ cpu0: cpu@0 {
195+ device_type = "cpu";
196+ compatible = "arm,cortex-a72";
197+ reg = <0>;
198+ enable-method = "spin-table";
199+ cpu-release-addr = <0x0 0x000000d8>;
200+ };
201+
202+ cpu1: cpu@1 {
203+ device_type = "cpu";
204+ compatible = "arm,cortex-a72";
205+ reg = <1>;
206+ enable-method = "spin-table";
207+ cpu-release-addr = <0x0 0x000000e0>;
208+ };
209+
210+ cpu2: cpu@2 {
211+ device_type = "cpu";
212+ compatible = "arm,cortex-a72";
213+ reg = <2>;
214+ enable-method = "spin-table";
215+ cpu-release-addr = <0x0 0x000000e8>;
216+ };
217+
218+ cpu3: cpu@3 {
219+ device_type = "cpu";
220+ compatible = "arm,cortex-a72";
221+ reg = <3>;
222+ enable-method = "spin-table";
223+ cpu-release-addr = <0x0 0x000000f0>;
224+ };
225+ };
226+};
227+
228+&clk_osc {
229+ clock-frequency = <54000000>;
230+};
231+
232+&clocks {
233+ compatible = "brcm,bcm2838-cprman";
234+};
235+
236+&cpu_thermal {
237+ coefficients = <(-487) 410040>;
238+};
239+
240+&dsi0 {
241+ interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
242+};
243+
244+&dsi1 {
245+ interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
246+};
247+
248+&gpio {
249+ compatible = "brcm,bcm2838-gpio", "brcm,bcm2835-gpio";
250+ interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
251+ <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
252+ <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
253+ <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
254+};
255+
256+&vec {
257+ interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
258+};
259+
260+&usb {
261+ interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
262+};
263+
264+&hdmi {
265+ interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
266+ <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
267+};
268+
269+&uart1 {
270+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
271+};
272+
273+&spi1 {
274+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
275+};
276+
277+&spi2 {
278+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
279+};
280+
281+&i2c0 {
282+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
283+};
284+
285+&i2c1 {
286+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
287+};
288+
289+&i2c2 {
290+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
291+};
292+
293+&mailbox {
294+ interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
295+};
296+
297+&sdhost {
298+ interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
299+};
300+
301+&uart0 {
302+ interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
303+};
304+
305+&dma {
306+ reg = <0x7e007000 0xb00>;
307+ interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>,
308+ <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>,
309+ <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>,
310+ <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>,
311+ <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>,
312+ <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>,
313+ <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>,
314+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, /* dmalite 7 */
315+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, /* dmalite 8 */
316+ <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, /* dmalite 9 */
317+ <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>; /* dmalite 10 */
318+ interrupt-names = "dma0",
319+ "dma1",
320+ "dma2",
321+ "dma3",
322+ "dma4",
323+ "dma5",
324+ "dma6",
325+ "dma7",
326+ "dma8",
327+ "dma9",
328+ "dma10";
329+ brcm,dma-channel-mask = <0x07f5>;
330+};
331--
3322.22.0
333
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0004-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch b/recipes-bsp/u-boot/u-boot-2019.07/0004-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch
new file mode 100644
index 0000000..ce2a664
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0004-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch
@@ -0,0 +1,67 @@
1From a343e3755ff8b85f453800fe165624687e4d5879 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:33:01 +0100
4Subject: [PATCH 04/12] arm: mach-bcm283x: Define configs for RaspberryPi 4
5
6Signed-off-by: Andrei Gherzan <andrei@balena.io>
7Upstream-status: Pending
8---
9 arch/arm/mach-bcm283x/Kconfig | 35 +++++++++++++++++++++++++++++++++++
10 1 file changed, 35 insertions(+)
11
12diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
13index 3eb5a9a897..d5069fe688 100644
14--- a/arch/arm/mach-bcm283x/Kconfig
15+++ b/arch/arm/mach-bcm283x/Kconfig
16@@ -26,6 +26,23 @@ config BCM2837_64B
17 select BCM2837
18 select ARM64
19
20+config BCM2838
21+ bool "Broadcom BCM2838 SoC support"
22+ depends on ARCH_BCM283X
23+
24+config BCM2838_32B
25+ bool "Broadcom BCM2838 SoC 32-bit support"
26+ depends on ARCH_BCM283X
27+ select BCM2838
28+ select ARMV7_LPAE
29+ select CPU_V7A
30+
31+config BCM2838_64B
32+ bool "Broadcom BCM2838 SoC 64-bit support"
33+ depends on ARCH_BCM283X
34+ select BCM2838
35+ select ARM64
36+
37 menu "Broadcom BCM283X family"
38 depends on ARCH_BCM283X
39
40@@ -127,6 +144,24 @@ config TARGET_RPI_3
41 This option creates a build targeting the ARMv8/AArch64 ISA.
42 select BCM2837_64B
43
44+config TARGET_RPI_4
45+ bool "Raspberry Pi 4 64-bit build"
46+ help
47+ Support for all BCM2838-based Raspberry Pi variants, such as
48+ the RPi 4 model B, in AArch64 (64-bit) mode.
49+
50+ This option creates a build targeting the ARMv8/AArch64 ISA.
51+ select BCM2838_64B
52+
53+config TARGET_RPI_4_32B
54+ bool "Raspberry Pi 4 32-bit build"
55+ help
56+ Support for all BCM2838-based Raspberry Pi variants, such as
57+ the RPi 4 model B, in AArch32 (32-bit) mode.
58+
59+ This option creates a build targeting the ARMv7/AArch32 ISA.
60+ select BCM2838_32B
61+
62 endchoice
63
64 config SYS_BOARD
65--
662.22.0
67
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0005-arm-mach-bcm283x-Define-mbox-address-for-BCM2838.patch b/recipes-bsp/u-boot/u-boot-2019.07/0005-arm-mach-bcm283x-Define-mbox-address-for-BCM2838.patch
new file mode 100644
index 0000000..a7def93
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0005-arm-mach-bcm283x-Define-mbox-address-for-BCM2838.patch
@@ -0,0 +1,35 @@
1From 32546abed12ff4c9b8b1480b31e6306bec876218 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:34:07 +0100
4Subject: [PATCH 05/12] arm: mach-bcm283x: Define mbox address for BCM2838
5
6Signed-off-by: Andrei Gherzan <andrei@balena.io>
7Upstream-status: Pending
8---
9 arch/arm/mach-bcm283x/include/mach/mbox.h | 5 +++++
10 1 file changed, 5 insertions(+)
11
12diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
13index e3a893e49c..2d711daaa8 100644
14--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
15+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
16@@ -38,11 +38,16 @@
17 /* Raw mailbox HW */
18
19 #ifndef CONFIG_BCM2835
20+#ifdef CONFIG_BCM2838
21+#define BCM2835_MBOX_PHYSADDR 0xfe00b880
22+#else
23 #define BCM2835_MBOX_PHYSADDR 0x3f00b880
24+#endif
25 #else
26 #define BCM2835_MBOX_PHYSADDR 0x2000b880
27 #endif
28
29+
30 struct bcm2835_mbox_regs {
31 u32 read;
32 u32 rsvd0[5];
33--
342.22.0
35
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0006-rpi-Add-rpi_model-entry-for-RaspberryPi-4.patch b/recipes-bsp/u-boot/u-boot-2019.07/0006-rpi-Add-rpi_model-entry-for-RaspberryPi-4.patch
new file mode 100644
index 0000000..b279d11
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0006-rpi-Add-rpi_model-entry-for-RaspberryPi-4.patch
@@ -0,0 +1,35 @@
1From 8a8e6c7364d41bbd3eb20dc7e4ec1c0a3e3b5259 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:34:18 +0100
4Subject: [PATCH 06/12] rpi: Add rpi_model entry for RaspberryPi 4
5
6The Raspebrry Pi 4 uses the new revision code scheme as documented by
7the foundation[1]. This change adds an entry for this board as well.
8
9[1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
10
11Signed-off-by: Andrei Gherzan <andrei@balena.io>
12Upstream-status: Pending
13---
14 board/raspberrypi/rpi/rpi.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
18index 617c892dde..6d6f1ef39a 100644
19--- a/board/raspberrypi/rpi/rpi.c
20+++ b/board/raspberrypi/rpi/rpi.c
21@@ -148,6 +148,11 @@ static const struct rpi_model rpi_models_new_scheme[] = {
22 DTB_DIR "bcm2837-rpi-cm3.dtb",
23 false,
24 },
25+ [0x11] = {
26+ "4 Model B",
27+ DTB_DIR "bcm2711-rpi-4-b.dtb",
28+ true,
29+ },
30 };
31
32 static const struct rpi_model rpi_models_old_scheme[] = {
33--
342.22.0
35
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0007-dt-bindings-Define-BCM2838_CLOCK_EMMC2-needed-for-Ra.patch b/recipes-bsp/u-boot/u-boot-2019.07/0007-dt-bindings-Define-BCM2838_CLOCK_EMMC2-needed-for-Ra.patch
new file mode 100644
index 0000000..597b492
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0007-dt-bindings-Define-BCM2838_CLOCK_EMMC2-needed-for-Ra.patch
@@ -0,0 +1,27 @@
1From 8ba1934b184fcdb967c5046ddace112bf3be21f1 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Wed, 17 Jul 2019 15:34:28 +0100
4Subject: [PATCH 07/12] dt-bindings: Define BCM2838_CLOCK_EMMC2 needed for
5 RaspberryPi 4
6
7On BCM2838 there is an additional clock. This clock was added in the
8same bcm2835-cprman driver and is used by the emmc2 dt node.
9
10Signed-off-by: Andrei Gherzan <andrei@balena.io>
11Upstream-status: Pending
12---
13 include/dt-bindings/clock/bcm2835.h | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/include/dt-bindings/clock/bcm2835.h b/include/dt-bindings/clock/bcm2835.h
17index 2cec01f968..b75031abb1 100644
18--- a/include/dt-bindings/clock/bcm2835.h
19+++ b/include/dt-bindings/clock/bcm2835.h
20@@ -58,3 +58,4 @@
21 #define BCM2835_CLOCK_DSI1E 48
22 #define BCM2835_CLOCK_DSI0P 49
23 #define BCM2835_CLOCK_DSI1P 50
24+#define BCM2838_CLOCK_EMMC2 51
25--
262.22.0
27
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0008-arm-bcm283x-Include-definition-for-additional-emmc-c.patch b/recipes-bsp/u-boot/u-boot-2019.07/0008-arm-bcm283x-Include-definition-for-additional-emmc-c.patch
new file mode 100644
index 0000000..546e786
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0008-arm-bcm283x-Include-definition-for-additional-emmc-c.patch
@@ -0,0 +1,32 @@
1From cb85ecba76fde3c96007eae9eda58a083f177333 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Fri, 12 Jul 2019 11:26:10 +0100
4Subject: [PATCH 08/12] arm: bcm283x: Include definition for additional emmc
5 clock
6
7This clock has a different mbox ID[1] so have this included in the
8relevant header file.
9
10[1] https://github.com/raspberrypi/firmware/issues/1179
11
12Signed-off-by: Andrei Gherzan <andrei@balena.io>
13Upstream-status: Pending
14---
15 arch/arm/mach-bcm283x/include/mach/mbox.h | 1 +
16 1 file changed, 1 insertion(+)
17
18diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
19index 2d711daaa8..cad035e8cd 100644
20--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
21+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
22@@ -239,6 +239,7 @@ struct bcm2835_mbox_tag_set_power_state {
23 #define BCM2835_MBOX_CLOCK_ID_SDRAM 8
24 #define BCM2835_MBOX_CLOCK_ID_PIXEL 9
25 #define BCM2835_MBOX_CLOCK_ID_PWM 10
26+#define BCM2835_MBOX_CLOCK_ID_EMMC2 12
27
28 struct bcm2835_mbox_tag_get_clock_rate {
29 struct bcm2835_mbox_tag_hdr tag_hdr;
30--
312.22.0
32
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0009-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch b/recipes-bsp/u-boot/u-boot-2019.07/0009-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch
new file mode 100644
index 0000000..762cb7e
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0009-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch
@@ -0,0 +1,53 @@
1From 8fd71dfaeab0ae350c8fa56b039eaafd577a1787 Mon Sep 17 00:00:00 2001
2From: Matthias Brugger <mbrugger@suse.com>
3Date: Wed, 10 Jul 2019 13:24:36 +0200
4Subject: [PATCH 09/12] mmc: bcm2835_sdhci: Add support for bcm2711 device
5
6The bcm2711 has two emmc controller. The difference is the clocks
7they use. Add support for the second emmc contoller.
8
9Signed-off-by: Matthias Brugger <mbrugger@suse.com>
10Signed-off-by: Andrei Gherzan <andrei@balena.io>
11Upstream-status: Pending
12---
13 drivers/mmc/bcm2835_sdhci.c | 12 ++++++++++--
14 1 file changed, 10 insertions(+), 2 deletions(-)
15
16diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
17index 08bddd410e..e68dec3be7 100644
18--- a/drivers/mmc/bcm2835_sdhci.c
19+++ b/drivers/mmc/bcm2835_sdhci.c
20@@ -178,12 +178,13 @@ static int bcm2835_sdhci_probe(struct udevice *dev)
21 fdt_addr_t base;
22 int emmc_freq;
23 int ret;
24+ int clock_id = (int)dev_get_driver_data(dev);
25
26 base = devfdt_get_addr(dev);
27 if (base == FDT_ADDR_T_NONE)
28 return -EINVAL;
29
30- ret = bcm2835_get_mmc_clock(BCM2835_MBOX_CLOCK_ID_EMMC);
31+ ret = bcm2835_get_mmc_clock(clock_id);
32 if (ret < 0) {
33 debug("%s: Failed to set MMC clock (err=%d)\n", __func__, ret);
34 return ret;
35@@ -228,7 +229,14 @@ static int bcm2835_sdhci_probe(struct udevice *dev)
36 }
37
38 static const struct udevice_id bcm2835_sdhci_match[] = {
39- { .compatible = "brcm,bcm2835-sdhci" },
40+ {
41+ .compatible = "brcm,bcm2835-sdhci",
42+ .data = BCM2835_MBOX_CLOCK_ID_EMMC
43+ },
44+ {
45+ .compatible = "brcm,bcm2711-emmc2",
46+ .data = BCM2835_MBOX_CLOCK_ID_EMMC2
47+ },
48 { /* sentinel */ }
49 };
50
51--
522.22.0
53
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0010-arm-bcm283x-Define-device-base-addresses-for-bcm2835.patch b/recipes-bsp/u-boot/u-boot-2019.07/0010-arm-bcm283x-Define-device-base-addresses-for-bcm2835.patch
new file mode 100644
index 0000000..bfba764
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0010-arm-bcm283x-Define-device-base-addresses-for-bcm2835.patch
@@ -0,0 +1,64 @@
1From 1f7bbd8ee6f4781473d87f6194ad2f815b1c1a19 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Fri, 12 Jul 2019 11:38:11 +0100
4Subject: [PATCH 10/12] arm: bcm283x: Define device base addresses for bcm2835
5
6Signed-off-by: Andrei Gherzan <andrei@balena.io>
7Upstream-status: Pending
8---
9 arch/arm/mach-bcm283x/include/mach/sdhci.h | 4 ++++
10 arch/arm/mach-bcm283x/include/mach/timer.h | 4 ++++
11 arch/arm/mach-bcm283x/include/mach/wdog.h | 4 ++++
12 3 files changed, 12 insertions(+)
13
14diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h
15index 5cb6ec3340..262b016a1b 100644
16--- a/arch/arm/mach-bcm283x/include/mach/sdhci.h
17+++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h
18@@ -7,7 +7,11 @@
19 #define _BCM2835_SDHCI_H_
20
21 #ifndef CONFIG_BCM2835
22+#ifdef CONFIG_BCM2838
23+#define BCM2835_SDHCI_BASE 0xfe300000
24+#else
25 #define BCM2835_SDHCI_BASE 0x3f300000
26+#endif
27 #else
28 #define BCM2835_SDHCI_BASE 0x20300000
29 #endif
30diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h
31index 56b0c356bb..dc3ed98879 100644
32--- a/arch/arm/mach-bcm283x/include/mach/timer.h
33+++ b/arch/arm/mach-bcm283x/include/mach/timer.h
34@@ -7,7 +7,11 @@
35 #define _BCM2835_TIMER_H
36
37 #ifndef CONFIG_BCM2835
38+#ifdef CONFIG_BCM2838
39+#define BCM2835_TIMER_PHYSADDR 0xfe003000
40+#else
41 #define BCM2835_TIMER_PHYSADDR 0x3f003000
42+#endif
43 #else
44 #define BCM2835_TIMER_PHYSADDR 0x20003000
45 #endif
46diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h
47index 99c88e5df7..ef040f385d 100644
48--- a/arch/arm/mach-bcm283x/include/mach/wdog.h
49+++ b/arch/arm/mach-bcm283x/include/mach/wdog.h
50@@ -7,7 +7,11 @@
51 #define _BCM2835_WDOG_H
52
53 #ifndef CONFIG_BCM2835
54+#ifdef CONFIG_BCM2838
55+#define BCM2835_WDOG_PHYSADDR 0xfe100000
56+#else
57 #define BCM2835_WDOG_PHYSADDR 0x3f100000
58+#endif
59 #else
60 #define BCM2835_WDOG_PHYSADDR 0x20100000
61 #endif
62--
632.22.0
64
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0011-rpi-Add-memory-map-for-bcm2838.patch b/recipes-bsp/u-boot/u-boot-2019.07/0011-rpi-Add-memory-map-for-bcm2838.patch
new file mode 100644
index 0000000..b2d25d0
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0011-rpi-Add-memory-map-for-bcm2838.patch
@@ -0,0 +1,59 @@
1From ab0137601cea84296f607da22d27f0bbf1265e1a Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei@balena.io>
3Date: Fri, 12 Jul 2019 14:27:31 +0100
4Subject: [PATCH 11/12] rpi: Add memory map for bcm2838
5
6Signed-off-by: Andrei Gherzan <andrei@balena.io>
7Upstream-status: Pending
8---
9 board/raspberrypi/rpi/rpi.c | 27 ++++++++++++++++++++++++---
10 1 file changed, 24 insertions(+), 3 deletions(-)
11
12diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
13index 6d6f1ef39a..1c4fae9166 100644
14--- a/board/raspberrypi/rpi/rpi.c
15+++ b/board/raspberrypi/rpi/rpi.c
16@@ -249,7 +249,8 @@ static uint32_t rev_type;
17 static const struct rpi_model *model;
18
19 #ifdef CONFIG_ARM64
20-static struct mm_region bcm2837_mem_map[] = {
21+#ifndef CONFIG_BCM2838
22+static struct mm_region bcm283x_mem_map[] = {
23 {
24 .virt = 0x00000000UL,
25 .phys = 0x00000000UL,
26@@ -268,8 +269,28 @@ static struct mm_region bcm2837_mem_map[] = {
27 0,
28 }
29 };
30-
31-struct mm_region *mem_map = bcm2837_mem_map;
32+#else
33+static struct mm_region bcm283x_mem_map[] = {
34+ {
35+ .virt = 0x00000000UL,
36+ .phys = 0x00000000UL,
37+ .size = 0xfe000000UL,
38+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
39+ PTE_BLOCK_INNER_SHARE
40+ }, {
41+ .virt = 0xfe000000UL,
42+ .phys = 0xfe000000UL,
43+ .size = 0x01800000UL,
44+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
45+ PTE_BLOCK_NON_SHARE |
46+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
47+ }, {
48+ /* List terminator */
49+ 0,
50+ }
51+};
52+#endif
53+struct mm_region *mem_map = bcm283x_mem_map;
54 #endif
55
56 int dram_init(void)
57--
582.22.0
59
diff --git a/recipes-bsp/u-boot/u-boot-2019.07/0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch b/recipes-bsp/u-boot/u-boot-2019.07/0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch
new file mode 100644
index 0000000..47d443b
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2019.07/0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch
@@ -0,0 +1,68 @@
1From 29f48584f6c4b40124396c77547e34febc015a36 Mon Sep 17 00:00:00 2001
2From: Fabian Vogt <fvogt@suse.com>
3Date: Fri, 28 Jun 2019 14:25:53 +0200
4Subject: [PATCH 12/12] bcm283x mbox: Correctly wait for space to send
5
6For sending, the second mailbox is used, but previously the status register of
7the first one was read.
8
9Signed-off-by: Andrei Gherzan <andrei@balena.io>
10Upstream-status: Submitted [https://lists.denx.de/pipermail/u-boot/2019-July/376774.html]
11---
12 arch/arm/mach-bcm283x/include/mach/mbox.h | 7 +++++--
13 arch/arm/mach-bcm283x/mbox.c | 6 +++---
14 2 files changed, 8 insertions(+), 5 deletions(-)
15
16diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
17index cad035e8cd..cd78966150 100644
18--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
19+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
20@@ -51,9 +51,12 @@
21 struct bcm2835_mbox_regs {
22 u32 read;
23 u32 rsvd0[5];
24- u32 status;
25- u32 config;
26+ u32 status_r;
27+ u32 config_r;
28 u32 write;
29+ u32 rsvd1[5];
30+ u32 status_w;
31+ u32 config_w;
32 };
33
34 #define BCM2835_MBOX_STATUS_WR_FULL 0x80000000
35diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
36index 1642ebd103..f7483bf423 100644
37--- a/arch/arm/mach-bcm283x/mbox.c
38+++ b/arch/arm/mach-bcm283x/mbox.c
39@@ -27,7 +27,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
40 /* Drain any stale responses */
41
42 for (;;) {
43- val = readl(&regs->status);
44+ val = readl(&regs->status_r);
45 if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
46 break;
47 if (get_timer(0) >= endtime) {
48@@ -40,7 +40,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
49 /* Wait for space to send */
50
51 for (;;) {
52- val = readl(&regs->status);
53+ val = readl(&regs->status_w);
54 if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
55 break;
56 if (get_timer(0) >= endtime) {
57@@ -58,7 +58,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
58 /* Wait for the response */
59
60 for (;;) {
61- val = readl(&regs->status);
62+ val = readl(&regs->status_r);
63 if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
64 break;
65 if (get_timer(0) >= endtime) {
66--
672.22.0
68
diff --git a/recipes-bsp/u-boot/u-boot_2019.07.bbappend b/recipes-bsp/u-boot/u-boot_2019.07.bbappend
index 6dfcc2c..f39db10 100644
--- a/recipes-bsp/u-boot/u-boot_2019.07.bbappend
+++ b/recipes-bsp/u-boot/u-boot_2019.07.bbappend
@@ -1,4 +1,17 @@
1SRC_URI_raspberrypi4 = "git://github.com/balena-os/u-boot;branch=ag/rpi4" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
2SRCREV_raspberrypi4 = "62b6e39a53c56a9085aeab1b47b5cc6020fcdb6f" 2UBOOT_RPI4_SUPPORT_PATCHES = " \
3SRC_URI_raspberrypi4-64 = "git://github.com/balena-os/u-boot;branch=ag/rpi4" 3 file://0001-configs-rpi4-Add-defconfigs-for-rpi4-32-64.patch \
4SRCREV_raspberrypi4-64 = "62b6e39a53c56a9085aeab1b47b5cc6020fcdb6f" 4 file://0002-dts-Create-a-dtsi-for-BCM2835-6-7-specific-configura.patch \
5 file://0003-dts-Add-initial-support-for-bcm2838.patch \
6 file://0004-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch \
7 file://0005-arm-mach-bcm283x-Define-mbox-address-for-BCM2838.patch \
8 file://0006-rpi-Add-rpi_model-entry-for-RaspberryPi-4.patch \
9 file://0007-dt-bindings-Define-BCM2838_CLOCK_EMMC2-needed-for-Ra.patch \
10 file://0008-arm-bcm283x-Include-definition-for-additional-emmc-c.patch \
11 file://0009-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch \
12 file://0010-arm-bcm283x-Define-device-base-addresses-for-bcm2835.patch \
13 file://0011-rpi-Add-memory-map-for-bcm2838.patch \
14 file://0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch \
15"
16
17SRC_URI_append_raspberrypi4 = "${UBOOT_RPI4_SUPPORT_PATCHES}"