u-boot: Update patches for RPi4

After a review in upstream, some of the patches were modified. Most
notable changes:
1. use directly the dtb passed by the firmware and make sure uboot
doesn't tweak memory/reg
2. remove known unimplemented support (usb, eth etc.)
3. drop patches that are not needed anymore with the new firmware update
(for example 0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
This commit is contained in:
Andrei Gherzan 2019-07-19 16:17:38 +01:00
parent 03488c6159
commit 9381de8f91
15 changed files with 258 additions and 861 deletions

View File

@ -1,23 +1,32 @@
From 2a59e8a0d574c5f878e7cf640dd2337ac5721372 Mon Sep 17 00:00:00 2001
From 5bf85d04b440ce874310e701abded823dc1864bc Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:32:11 +0100
Subject: [PATCH 01/12] configs: rpi4: Add defconfigs for rpi4 (32/64)
Subject: [PATCH 1/7] configs: rpi4: Add defconfigs for rpi4 (32/64)
This defines a minimum defconfig for each of the two Raspberry Pi 4
variants. One notable difference is that we don't have a embedded dt for
this board given that the fw supplies us with one which we can reuse.
Furthermore, the ram size is not queryable through mbox interface as the
maximum reported size is 1G. The fw patches the dt with the right
memory configuration and uboot uses it as it is. We avoid u-boot
touching this configuration by making sure CONFIG_ARCH_FIXUP_FDT_MEMORY
is deactivated.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
configs/rpi_4_32b_defconfig | 41 +++++++++++++++++++++++++++++++++++++
configs/rpi_4_defconfig | 41 +++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+)
configs/rpi_4_32b_defconfig | 33 +++++++++++++++++++++++++++++++++
configs/rpi_4_defconfig | 33 +++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
create mode 100644 configs/rpi_4_32b_defconfig
create mode 100644 configs/rpi_4_defconfig
diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
new file mode 100644
index 0000000000..3ee33174bc
index 0000000000..a31a617a5f
--- /dev/null
+++ b/configs/rpi_4_32b_defconfig
@@ -0,0 +1,41 @@
@@ -0,0 +1,33 @@
+CONFIG_ARM=y
+CONFIG_ARCH_BCM283X=y
+CONFIG_SYS_TEXT_BASE=0x00008000
@ -26,6 +35,7 @@ index 0000000000..3ee33174bc
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=1
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_OF_BOARD=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
@ -34,10 +44,7 @@ index 0000000000..3ee33174bc
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_FS_UUID=y
+CONFIG_OF_EMBED=y
+CONFIG_DEFAULT_DEVICE_TREE="bcm2838-rpi-4-b"
+CONFIG_ENV_FAT_INTERFACE="mmc"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
@ -45,15 +52,9 @@ index 0000000000..3ee33174bc
+CONFIG_DM_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_BCM2835=y
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_PINCTRL=y
+# CONFIG_PINCTRL_GENERIC is not set
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_CONSOLE_SCROLL_LINES=10
@ -61,10 +62,10 @@ index 0000000000..3ee33174bc
+CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
new file mode 100644
index 0000000000..b91b0869e5
index 0000000000..da8c960a2a
--- /dev/null
+++ b/configs/rpi_4_defconfig
@@ -0,0 +1,41 @@
@@ -0,0 +1,33 @@
+CONFIG_ARM=y
+CONFIG_ARCH_BCM283X=y
+CONFIG_SYS_TEXT_BASE=0x00080000
@ -73,6 +74,7 @@ index 0000000000..b91b0869e5
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=1
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_OF_BOARD=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_MISC_INIT_R=y
+# CONFIG_DISPLAY_CPUINFO is not set
@ -81,10 +83,7 @@ index 0000000000..b91b0869e5
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_FS_UUID=y
+CONFIG_OF_EMBED=y
+CONFIG_DEFAULT_DEVICE_TREE="bcm2838-rpi-4-b"
+CONFIG_ENV_FAT_INTERFACE="mmc"
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
@ -92,15 +91,9 @@ index 0000000000..b91b0869e5
+CONFIG_DM_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_BCM2835=y
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_PINCTRL=y
+# CONFIG_PINCTRL_GENERIC is not set
+# CONFIG_REQUIRE_SERIAL_CONSOLE is not set
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_CONSOLE_SCROLL_LINES=10

View File

@ -0,0 +1,105 @@
From df2aa4c6be33b468adc09de337a055556d1f37fb Mon Sep 17 00:00:00 2001
From: Matthias Brugger <mbrugger@suse.com>
Date: Fri, 12 Jul 2019 18:20:53 +0200
Subject: [PATCH 2/7] ARM: bcm283x: Add BCM283x_BASE define
Devices of bcm283x have different base address, depending if they are on
bcm2835 or bcm2836/7. Use BCM283x_BASE depending on the SoC you want to
build and only add the offset in the header files.
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
arch/arm/mach-bcm283x/Kconfig | 5 +++++
arch/arm/mach-bcm283x/include/mach/mbox.h | 6 +-----
arch/arm/mach-bcm283x/include/mach/sdhci.h | 6 +-----
arch/arm/mach-bcm283x/include/mach/timer.h | 6 +-----
arch/arm/mach-bcm283x/include/mach/wdog.h | 6 +-----
5 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 3eb5a9a897..8e69914a83 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -141,4 +141,9 @@ config SYS_SOC
config SYS_CONFIG_NAME
default "rpi"
+config BCM283x_BASE
+ hex
+ default "0x20000000" if BCM2835
+ default "0x3f000000" if BCM2836 || BCM2837
+
endmenu
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index e3a893e49c..e44c7577da 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -37,11 +37,7 @@
/* Raw mailbox HW */
-#ifndef CONFIG_BCM2835
-#define BCM2835_MBOX_PHYSADDR 0x3f00b880
-#else
-#define BCM2835_MBOX_PHYSADDR 0x2000b880
-#endif
+#define BCM2835_MBOX_PHYSADDR (CONFIG_BCM283x_BASE + 0x0000b880)
struct bcm2835_mbox_regs {
u32 read;
diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h
index 5cb6ec3340..b443c379d8 100644
--- a/arch/arm/mach-bcm283x/include/mach/sdhci.h
+++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h
@@ -6,11 +6,7 @@
#ifndef _BCM2835_SDHCI_H_
#define _BCM2835_SDHCI_H_
-#ifndef CONFIG_BCM2835
-#define BCM2835_SDHCI_BASE 0x3f300000
-#else
-#define BCM2835_SDHCI_BASE 0x20300000
-#endif
+#define BCM2835_SDHCI_BASE (CONFIG_BCM283x_BASE + 0x00300000)
int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq);
diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h
index 56b0c356bb..014355e759 100644
--- a/arch/arm/mach-bcm283x/include/mach/timer.h
+++ b/arch/arm/mach-bcm283x/include/mach/timer.h
@@ -6,11 +6,7 @@
#ifndef _BCM2835_TIMER_H
#define _BCM2835_TIMER_H
-#ifndef CONFIG_BCM2835
-#define BCM2835_TIMER_PHYSADDR 0x3f003000
-#else
-#define BCM2835_TIMER_PHYSADDR 0x20003000
-#endif
+#define BCM2835_TIMER_PHYSADDR (CONFIG_BCM283x_BASE + 0x00003000)
#define BCM2835_TIMER_CS_M3 (1 << 3)
#define BCM2835_TIMER_CS_M2 (1 << 2)
diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h
index 99c88e5df7..00b5e06c3a 100644
--- a/arch/arm/mach-bcm283x/include/mach/wdog.h
+++ b/arch/arm/mach-bcm283x/include/mach/wdog.h
@@ -6,11 +6,7 @@
#ifndef _BCM2835_WDOG_H
#define _BCM2835_WDOG_H
-#ifndef CONFIG_BCM2835
-#define BCM2835_WDOG_PHYSADDR 0x3f100000
-#else
-#define BCM2835_WDOG_PHYSADDR 0x20100000
-#endif
+#define BCM2835_WDOG_PHYSADDR (CONFIG_BCM283x_BASE + 0x00100000)
struct bcm2835_wdog_regs {
u32 unknown0[7];
--
2.22.0

View File

@ -1,209 +0,0 @@
From 9ef5ac66aaa8e52d1ed3a6fd6390d7d8d91a537d Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:32:34 +0100
Subject: [PATCH 02/12] dts: Create a dtsi for BCM2835/6/7 specific
configuration
This follows a similar change in kernel[1]. The change moves
configuration that was not applicable for all bcm2835/6/7/8 out of
bcm283x.dtsi. The new file is bcm2835-common.dtsi and contains
conifguration that is common for bcm2835/6/7 (not bcm2838).
[1] https://github.com/raspberrypi/linux/commit/769a7330aa5bebcc98b1ff12ecb767db4e5c644d#diff-5979fba23a5bab2cf66dde09db872dfc
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
arch/arm/dts/bcm2835-common.dtsi | 53 ++++++++++++++++++++++++++++++++
arch/arm/dts/bcm2835.dtsi | 1 +
arch/arm/dts/bcm2836.dtsi | 1 +
arch/arm/dts/bcm2837.dtsi | 1 +
arch/arm/dts/bcm283x.dtsi | 45 +--------------------------
5 files changed, 57 insertions(+), 44 deletions(-)
create mode 100644 arch/arm/dts/bcm2835-common.dtsi
diff --git a/arch/arm/dts/bcm2835-common.dtsi b/arch/arm/dts/bcm2835-common.dtsi
new file mode 100644
index 0000000000..17771730a3
--- /dev/null
+++ b/arch/arm/dts/bcm2835-common.dtsi
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/* This include file covers the common peripherals and configuration between
+ * bcm2835, bcm2836 and bcm2837 implementations.
+ */
+
+/ {
+ soc {
+ timer@7e003000 {
+ compatible = "brcm,bcm2835-system-timer";
+ reg = <0x7e003000 0x1000>;
+ interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
+ /* This could be a reference to BCM2835_CLOCK_TIMER,
+ * but we don't have the driver using the common clock
+ * support yet.
+ */
+ clock-frequency = <1000000>;
+ };
+
+ intc: interrupt-controller@7e00b200 {
+ compatible = "brcm,bcm2835-armctrl-ic";
+ reg = <0x7e00b200 0x200>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ thermal: thermal@7e212000 {
+ compatible = "brcm,bcm2835-thermal";
+ reg = <0x7e212000 0x8>;
+ clocks = <&clocks BCM2835_CLOCK_TSENS>;
+ #thermal-sensor-cells = <0>;
+ status = "disabled";
+ };
+
+ v3d: v3d@7ec00000 {
+ compatible = "brcm,bcm2835-v3d";
+ reg = <0x7ec00000 0x1000>;
+ interrupts = <1 10>;
+ };
+ };
+};
+
+&gpio {
+ i2c_slave_gpio18: i2c_slave_gpio18 {
+ brcm,pins = <18 19 20 21>;
+ brcm,function = <BCM2835_FSEL_ALT3>;
+ };
+
+ jtag_gpio4: jtag_gpio4 {
+ brcm,pins = <4 5 6 12 13>;
+ brcm,function = <BCM2835_FSEL_ALT5>;
+ };
+};
diff --git a/arch/arm/dts/bcm2835.dtsi b/arch/arm/dts/bcm2835.dtsi
index a5c3824c80..53bf4579cc 100644
--- a/arch/arm/dts/bcm2835.dtsi
+++ b/arch/arm/dts/bcm2835.dtsi
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcm283x.dtsi"
+#include "bcm2835-common.dtsi"
/ {
compatible = "brcm,bcm2835";
diff --git a/arch/arm/dts/bcm2836.dtsi b/arch/arm/dts/bcm2836.dtsi
index c933e84138..82d6c4662a 100644
--- a/arch/arm/dts/bcm2836.dtsi
+++ b/arch/arm/dts/bcm2836.dtsi
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcm283x.dtsi"
+#include "bcm2835-common.dtsi"
/ {
compatible = "brcm,bcm2836";
diff --git a/arch/arm/dts/bcm2837.dtsi b/arch/arm/dts/bcm2837.dtsi
index beb6c502da..9e95fee78e 100644
--- a/arch/arm/dts/bcm2837.dtsi
+++ b/arch/arm/dts/bcm2837.dtsi
@@ -1,4 +1,5 @@
#include "bcm283x.dtsi"
+#include "bcm2835-common.dtsi"
/ {
compatible = "brcm,bcm2837";
diff --git a/arch/arm/dts/bcm283x.dtsi b/arch/arm/dts/bcm283x.dtsi
index 9777644c6c..a024727e4d 100644
--- a/arch/arm/dts/bcm283x.dtsi
+++ b/arch/arm/dts/bcm283x.dtsi
@@ -56,17 +56,6 @@
#address-cells = <1>;
#size-cells = <1>;
- timer@7e003000 {
- compatible = "brcm,bcm2835-system-timer";
- reg = <0x7e003000 0x1000>;
- interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
- /* This could be a reference to BCM2835_CLOCK_TIMER,
- * but we don't have the driver using the common clock
- * support yet.
- */
- clock-frequency = <1000000>;
- };
-
txp@7e004000 {
compatible = "brcm,bcm2835-txp";
reg = <0x7e004000 0x20>;
@@ -114,13 +103,6 @@
brcm,dma-channel-mask = <0x7f35>;
};
- intc: interrupt-controller@7e00b200 {
- compatible = "brcm,bcm2835-armctrl-ic";
- reg = <0x7e00b200 0x200>;
- interrupt-controller;
- #interrupt-cells = <2>;
- };
-
pm: watchdog@7e100000 {
compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
#power-domain-cells = <1>;
@@ -184,8 +166,7 @@
interrupt-controller;
#interrupt-cells = <2>;
- /* Defines pin muxing groups according to
- * BCM2835-ARM-Peripherals.pdf page 102.
+ /* Defines common pin muxing groups
*
* While each pin can have its mux selected
* for various functions individually, some
@@ -263,15 +244,6 @@
brcm,pins = <44 45>;
brcm,function = <BCM2835_FSEL_ALT2>;
};
- i2c_slave_gpio18: i2c_slave_gpio18 {
- brcm,pins = <18 19 20 21>;
- brcm,function = <BCM2835_FSEL_ALT3>;
- };
-
- jtag_gpio4: jtag_gpio4 {
- brcm,pins = <4 5 6 12 13>;
- brcm,function = <BCM2835_FSEL_ALT5>;
- };
jtag_gpio22: jtag_gpio22 {
brcm,pins = <22 23 24 25 26 27>;
brcm,function = <BCM2835_FSEL_ALT4>;
@@ -488,14 +460,6 @@
};
- thermal: thermal@7e212000 {
- compatible = "brcm,bcm2835-thermal";
- reg = <0x7e212000 0x8>;
- clocks = <&clocks BCM2835_CLOCK_TSENS>;
- #thermal-sensor-cells = <0>;
- status = "disabled";
- };
-
aux: aux@7e215000 {
compatible = "brcm,bcm2835-aux";
#clock-cells = <1>;
@@ -635,13 +599,6 @@
phy-names = "usb2-phy";
};
- v3d: v3d@7ec00000 {
- compatible = "brcm,bcm2835-v3d";
- reg = <0x7ec00000 0x1000>;
- interrupts = <1 10>;
- power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>;
- };
-
vc4: gpu {
compatible = "brcm,bcm2835-vc4";
};
--
2.22.0

View File

@ -0,0 +1,108 @@
From c03f551cab8fe38de8f0e1781f0e2e339419b003 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:33:01 +0100
Subject: [PATCH 3/7] arm: mach-bcm283x: Define configs for RaspberryPi 4
Define two target configs for Raspberry Pi 4 (32 and 64bit) and the
corresponding BCM2838* configs.
Be aware of the current limitation in firmware which requires an
explicit configuration to force the arm in 64bit mode when the
respective target is used.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Upstream-status: Pending
---
arch/arm/mach-bcm283x/Kconfig | 62 +++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 8e69914a83..09a5b42bbb 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -26,6 +26,23 @@ config BCM2837_64B
select BCM2837
select ARM64
+config BCM2838
+ bool "Broadcom BCM2838 SoC support"
+ depends on ARCH_BCM283X
+
+config BCM2838_32B
+ bool "Broadcom BCM2838 SoC 32-bit support"
+ depends on ARCH_BCM283X
+ select BCM2838
+ select ARMV7_LPAE
+ select CPU_V7A
+
+config BCM2838_64B
+ bool "Broadcom BCM2838 SoC 64-bit support"
+ depends on ARCH_BCM283X
+ select BCM2838
+ select ARM64
+
menu "Broadcom BCM283X family"
depends on ARCH_BCM283X
@@ -127,6 +144,50 @@ config TARGET_RPI_3
This option creates a build targeting the ARMv8/AArch64 ISA.
select BCM2837_64B
+config TARGET_RPI_4_32B
+ bool "Raspberry Pi 4 32-bit build"
+ help
+ Support for all BCM2838-based Raspberry Pi variants, such as
+ the RPi 4 model B, in AArch32 (32-bit) mode.
+
+ This option assumes the VideoCore firmware is configured to use the
+ mini UART (rather than PL011) for the serial console. This is the
+ default on the RPi 4. To enable the UART console, the following non-
+ default option must be present in config.txt: enable_uart=1. This is
+ required for U-Boot to operate correctly, even if you only care
+ about the HDMI/usbkbd console.
+
+ Due to hardware incompatibilities, this can't be used with
+ BCM283/5/6/7.
+
+ This option creates a build targeting the ARMv7/AArch32 ISA.
+ select BCM2838_32B
+
+config TARGET_RPI_4
+ bool "Raspberry Pi 4 64-bit build"
+ help
+ Support for all BCM2838-based Raspberry Pi variants, such as
+ the RPi 4 model B, in AArch64 (64-bit) mode.
+
+ This option assumes the VideoCore firmware is configured to use the
+ mini UART (rather than PL011) for the serial console. This is the
+ default on the RPi 4. To enable the UART console, the following non-
+ default option must be present in config.txt: enable_uart=1. This is
+ required for U-Boot to operate correctly, even if you only care
+ about the HDMI/usbkbd console.
+
+ Due to hardware incompatibilities, this can't be used with
+ BCM283/5/6/7.
+
+ Also, due to a bug in firmware, switching to 64bit mode doesn't
+ happen automatically based on the kernel's image filename. See
+ https://github.com/raspberrypi/firmware/issues/1193 for more details.
+ Until that is resolved, the configuration (config.txt) needs to
+ explicitly set: arm_64bit=1.
+
+ This option creates a build targeting the ARMv8/AArch64 ISA.
+ select BCM2838_64B
+
endchoice
config SYS_BOARD
@@ -145,5 +206,6 @@ config BCM283x_BASE
hex
default "0x20000000" if BCM2835
default "0x3f000000" if BCM2836 || BCM2837
+ default "0xfe000000" if BCM2838
endmenu
--
2.22.0

View File

@ -1,333 +0,0 @@
From 9a6dca219480423f6c9dd5804e5890d434cc11b8 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:32:46 +0100
Subject: [PATCH 03/12] dts: Add initial support for bcm2838
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
arch/arm/dts/Makefile | 3 +-
arch/arm/dts/bcm2838-rpi-4-b.dts | 52 +++++++
arch/arm/dts/bcm2838.dtsi | 237 +++++++++++++++++++++++++++++++
3 files changed, 291 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/dts/bcm2838-rpi-4-b.dts
create mode 100644 arch/arm/dts/bcm2838.dtsi
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 20dbc2ff84..fdb55f7fde 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -749,7 +749,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
bcm2837-rpi-3-a-plus.dtb \
bcm2837-rpi-3-b.dtb \
bcm2837-rpi-3-b-plus.dtb \
- bcm2837-rpi-cm3-io3.dtb
+ bcm2837-rpi-cm3-io3.dtb \
+ bcm2838-rpi-4-b.dtb
dtb-$(CONFIG_ARCH_BCM63158) += \
bcm963158.dtb
diff --git a/arch/arm/dts/bcm2838-rpi-4-b.dts b/arch/arm/dts/bcm2838-rpi-4-b.dts
new file mode 100644
index 0000000000..fa7fcfed9d
--- /dev/null
+++ b/arch/arm/dts/bcm2838-rpi-4-b.dts
@@ -0,0 +1,52 @@
+/dts-v1/;
+#include "bcm2838.dtsi"
+
+/ {
+ compatible = "raspberrypi,4-model-b","brcm,bcm2838","brcm,bcm2837";
+ model = "Raspberry Pi 4 Model B";
+
+ memory {
+ reg = <0 0 0x0>;
+ };
+
+ leds {
+ act {
+ gpios = <&gpio 47 0>;
+ };
+ };
+};
+
+/* uart0 communicates with the BT module */
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_gpio32 &gpclk2_gpio43>;
+ status = "okay";
+};
+
+/* uart1 is mapped to the pin header */
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>;
+ status = "okay";
+};
+
+&sdhci {
+ status = "disabled";
+};
+
+&sdhost {
+ status = "disabled";
+};
+
+&emmc2 {
+ compatible = "brcm,bcm2711-emmc2";
+ status = "okay";
+};
+
+&gpio {
+ uart1_pins: uart1_pins {
+ brcm,pins;
+ brcm,function;
+ brcm,pull;
+ };
+};
diff --git a/arch/arm/dts/bcm2838.dtsi b/arch/arm/dts/bcm2838.dtsi
new file mode 100644
index 0000000000..19b2d7b905
--- /dev/null
+++ b/arch/arm/dts/bcm2838.dtsi
@@ -0,0 +1,237 @@
+#include "bcm283x.dtsi"
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/power/raspberrypi-power.h>
+
+/ {
+ compatible = "brcm,bcm2838";
+
+ #address-cells = <2>;
+ #size-cells = <1>;
+
+ interrupt-parent = <&gic>;
+
+ soc {
+ ranges = <0x7e000000 0x0 0xfe000000 0x01800000>,
+ <0x7c000000 0x0 0xfc000000 0x02000000>,
+ <0x40000000 0x0 0xff800000 0x00800000>;
+ dma-ranges = <0xc0000000 0x0 0x00000000 0x3c000000>;
+
+ gic: gic400@40041000 {
+ interrupt-controller;
+ #interrupt-cells = <3>;
+ compatible = "arm,gic-400";
+ reg = <0x40041000 0x1000>,
+ <0x40042000 0x2000>,
+ <0x40044000 0x2000>,
+ <0x40046000 0x2000>;
+ };
+
+ thermal: thermal@7d5d2200 {
+ compatible = "brcm,avs-tmon-bcm2838";
+ reg = <0x7d5d2200 0x2c>;
+ interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "tmon";
+ clocks = <&clocks BCM2835_CLOCK_TSENS>;
+ #thermal-sensor-cells = <0>;
+ status = "okay";
+ };
+
+ spi@7e204000 {
+ reg = <0x7e204000 0x0200>;
+ interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pixelvalve@7e206000 {
+ interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pixelvalve@7e207000 {
+ interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ hvs@7e400000 {
+ interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ emmc2: emmc2@7e340000 {
+ compatible = "brcm,bcm2711-emmc2";
+ status = "okay";
+ interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clocks BCM2838_CLOCK_EMMC2>;
+ reg = <0x7e340000 0x100>;
+ };
+
+ pixelvalve@7e807000 {
+ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ };
+
+ arm-pmu {
+ /*
+ * N.B. the A72 PMU support only exists in arch/arm64, hence
+ * the fallback to the A53 version.
+ */
+ compatible = "arm,cortex-a72-pmu", "arm,cortex-a53-pmu";
+ interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ timer {
+ compatible = "arm,armv7-timer";
+ interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+ IRQ_TYPE_LEVEL_LOW)>;
+ arm,cpu-registers-not-fw-configured;
+ always-on;
+ };
+
+ cpus: cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit
+
+ cpu0: cpu@0 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a72";
+ reg = <0>;
+ enable-method = "spin-table";
+ cpu-release-addr = <0x0 0x000000d8>;
+ };
+
+ cpu1: cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a72";
+ reg = <1>;
+ enable-method = "spin-table";
+ cpu-release-addr = <0x0 0x000000e0>;
+ };
+
+ cpu2: cpu@2 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a72";
+ reg = <2>;
+ enable-method = "spin-table";
+ cpu-release-addr = <0x0 0x000000e8>;
+ };
+
+ cpu3: cpu@3 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a72";
+ reg = <3>;
+ enable-method = "spin-table";
+ cpu-release-addr = <0x0 0x000000f0>;
+ };
+ };
+};
+
+&clk_osc {
+ clock-frequency = <54000000>;
+};
+
+&clocks {
+ compatible = "brcm,bcm2838-cprman";
+};
+
+&cpu_thermal {
+ coefficients = <(-487) 410040>;
+};
+
+&dsi0 {
+ interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&dsi1 {
+ interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&gpio {
+ compatible = "brcm,bcm2838-gpio", "brcm,bcm2835-gpio";
+ interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&vec {
+ interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&usb {
+ interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&hdmi {
+ interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&uart1 {
+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&spi1 {
+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&spi2 {
+ interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&i2c0 {
+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&i2c1 {
+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&i2c2 {
+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&mailbox {
+ interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&sdhost {
+ interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&uart0 {
+ interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
+};
+
+&dma {
+ reg = <0x7e007000 0xb00>;
+ interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, /* dmalite 7 */
+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>, /* dmalite 8 */
+ <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, /* dmalite 9 */
+ <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>; /* dmalite 10 */
+ interrupt-names = "dma0",
+ "dma1",
+ "dma2",
+ "dma3",
+ "dma4",
+ "dma5",
+ "dma6",
+ "dma7",
+ "dma8",
+ "dma9",
+ "dma10";
+ brcm,dma-channel-mask = <0x07f5>;
+};
--
2.22.0

View File

@ -1,67 +0,0 @@
From a343e3755ff8b85f453800fe165624687e4d5879 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:33:01 +0100
Subject: [PATCH 04/12] arm: mach-bcm283x: Define configs for RaspberryPi 4
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
arch/arm/mach-bcm283x/Kconfig | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 3eb5a9a897..d5069fe688 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -26,6 +26,23 @@ config BCM2837_64B
select BCM2837
select ARM64
+config BCM2838
+ bool "Broadcom BCM2838 SoC support"
+ depends on ARCH_BCM283X
+
+config BCM2838_32B
+ bool "Broadcom BCM2838 SoC 32-bit support"
+ depends on ARCH_BCM283X
+ select BCM2838
+ select ARMV7_LPAE
+ select CPU_V7A
+
+config BCM2838_64B
+ bool "Broadcom BCM2838 SoC 64-bit support"
+ depends on ARCH_BCM283X
+ select BCM2838
+ select ARM64
+
menu "Broadcom BCM283X family"
depends on ARCH_BCM283X
@@ -127,6 +144,24 @@ config TARGET_RPI_3
This option creates a build targeting the ARMv8/AArch64 ISA.
select BCM2837_64B
+config TARGET_RPI_4
+ bool "Raspberry Pi 4 64-bit build"
+ help
+ Support for all BCM2838-based Raspberry Pi variants, such as
+ the RPi 4 model B, in AArch64 (64-bit) mode.
+
+ This option creates a build targeting the ARMv8/AArch64 ISA.
+ select BCM2838_64B
+
+config TARGET_RPI_4_32B
+ bool "Raspberry Pi 4 32-bit build"
+ help
+ Support for all BCM2838-based Raspberry Pi variants, such as
+ the RPi 4 model B, in AArch32 (32-bit) mode.
+
+ This option creates a build targeting the ARMv7/AArch32 ISA.
+ select BCM2838_32B
+
endchoice
config SYS_BOARD
--
2.22.0

View File

@ -1,12 +1,10 @@
From 8a8e6c7364d41bbd3eb20dc7e4ec1c0a3e3b5259 Mon Sep 17 00:00:00 2001
From 12fbbd5bc12e225b19d3b4cb193a1bf3d9fa752a Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:34:18 +0100
Subject: [PATCH 06/12] rpi: Add rpi_model entry for RaspberryPi 4
Subject: [PATCH 4/7] rpi: Add entry for Raspberry Pi 4 model B
The Raspebrry Pi 4 uses the new revision code scheme as documented by
the foundation[1]. This change adds an entry for this board as well.
[1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
the foundation. This change adds an entry for this board as well.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
@ -15,7 +13,7 @@ Upstream-status: Pending
1 file changed, 5 insertions(+)
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 617c892dde..6d6f1ef39a 100644
index 617c892dde..92c6534da6 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -148,6 +148,11 @@ static const struct rpi_model rpi_models_new_scheme[] = {
@ -24,7 +22,7 @@ index 617c892dde..6d6f1ef39a 100644
},
+ [0x11] = {
+ "4 Model B",
+ DTB_DIR "bcm2711-rpi-4-b.dtb",
+ DTB_DIR "bcm2838-rpi-4-b.dtb",
+ true,
+ },
};

View File

@ -1,13 +1,11 @@
From cb85ecba76fde3c96007eae9eda58a083f177333 Mon Sep 17 00:00:00 2001
From fd99a249e6faf234066a6b5da2ed34aaead3d6d9 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Fri, 12 Jul 2019 11:26:10 +0100
Subject: [PATCH 08/12] arm: bcm283x: Include definition for additional emmc
Subject: [PATCH 5/7] arm: bcm283x: Include definition for additional emmc
clock
This clock has a different mbox ID[1] so have this included in the
relevant header file.
[1] https://github.com/raspberrypi/firmware/issues/1179
This clock has a different mbox ID so have this included in the relevant
header file.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
@ -16,10 +14,10 @@ Upstream-status: Pending
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index 2d711daaa8..cad035e8cd 100644
index e44c7577da..f2a98acddd 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -239,6 +239,7 @@ struct bcm2835_mbox_tag_set_power_state {
@@ -230,6 +230,7 @@ struct bcm2835_mbox_tag_set_power_state {
#define BCM2835_MBOX_CLOCK_ID_SDRAM 8
#define BCM2835_MBOX_CLOCK_ID_PIXEL 9
#define BCM2835_MBOX_CLOCK_ID_PWM 10

View File

@ -1,35 +0,0 @@
From 32546abed12ff4c9b8b1480b31e6306bec876218 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:34:07 +0100
Subject: [PATCH 05/12] arm: mach-bcm283x: Define mbox address for BCM2838
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
arch/arm/mach-bcm283x/include/mach/mbox.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index e3a893e49c..2d711daaa8 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -38,11 +38,16 @@
/* Raw mailbox HW */
#ifndef CONFIG_BCM2835
+#ifdef CONFIG_BCM2838
+#define BCM2835_MBOX_PHYSADDR 0xfe00b880
+#else
#define BCM2835_MBOX_PHYSADDR 0x3f00b880
+#endif
#else
#define BCM2835_MBOX_PHYSADDR 0x2000b880
#endif
+
struct bcm2835_mbox_regs {
u32 read;
u32 rsvd0[5];
--
2.22.0

View File

@ -1,7 +1,7 @@
From 8fd71dfaeab0ae350c8fa56b039eaafd577a1787 Mon Sep 17 00:00:00 2001
From 1f42758fe69648340cfae6cae98e667b88923cf6 Mon Sep 17 00:00:00 2001
From: Matthias Brugger <mbrugger@suse.com>
Date: Wed, 10 Jul 2019 13:24:36 +0200
Subject: [PATCH 09/12] mmc: bcm2835_sdhci: Add support for bcm2711 device
Subject: [PATCH 6/7] mmc: bcm2835_sdhci: Add support for bcm2711 device
The bcm2711 has two emmc controller. The difference is the clocks
they use. Add support for the second emmc contoller.

View File

@ -1,27 +0,0 @@
From 8ba1934b184fcdb967c5046ddace112bf3be21f1 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Wed, 17 Jul 2019 15:34:28 +0100
Subject: [PATCH 07/12] dt-bindings: Define BCM2838_CLOCK_EMMC2 needed for
RaspberryPi 4
On BCM2838 there is an additional clock. This clock was added in the
same bcm2835-cprman driver and is used by the emmc2 dt node.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
include/dt-bindings/clock/bcm2835.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/dt-bindings/clock/bcm2835.h b/include/dt-bindings/clock/bcm2835.h
index 2cec01f968..b75031abb1 100644
--- a/include/dt-bindings/clock/bcm2835.h
+++ b/include/dt-bindings/clock/bcm2835.h
@@ -58,3 +58,4 @@
#define BCM2835_CLOCK_DSI1E 48
#define BCM2835_CLOCK_DSI0P 49
#define BCM2835_CLOCK_DSI1P 50
+#define BCM2838_CLOCK_EMMC2 51
--
2.22.0

View File

@ -1,7 +1,10 @@
From ab0137601cea84296f607da22d27f0bbf1265e1a Mon Sep 17 00:00:00 2001
From 76b656349a6786fa81cf69ac7762c31675cd567e Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Fri, 12 Jul 2019 14:27:31 +0100
Subject: [PATCH 11/12] rpi: Add memory map for bcm2838
Subject: [PATCH 7/7] rpi: Add memory map for bcm2838
Define the memory map for the BCM2838 based on the dt configuration
available in the Raspberry Pi kernel fork.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
@ -10,7 +13,7 @@ Upstream-status: Pending
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 6d6f1ef39a..1c4fae9166 100644
index 92c6534da6..bddf2a578d 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -249,7 +249,8 @@ static uint32_t rev_type;

View File

@ -1,64 +0,0 @@
From 1f7bbd8ee6f4781473d87f6194ad2f815b1c1a19 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei@balena.io>
Date: Fri, 12 Jul 2019 11:38:11 +0100
Subject: [PATCH 10/12] arm: bcm283x: Define device base addresses for bcm2835
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Pending
---
arch/arm/mach-bcm283x/include/mach/sdhci.h | 4 ++++
arch/arm/mach-bcm283x/include/mach/timer.h | 4 ++++
arch/arm/mach-bcm283x/include/mach/wdog.h | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h
index 5cb6ec3340..262b016a1b 100644
--- a/arch/arm/mach-bcm283x/include/mach/sdhci.h
+++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h
@@ -7,7 +7,11 @@
#define _BCM2835_SDHCI_H_
#ifndef CONFIG_BCM2835
+#ifdef CONFIG_BCM2838
+#define BCM2835_SDHCI_BASE 0xfe300000
+#else
#define BCM2835_SDHCI_BASE 0x3f300000
+#endif
#else
#define BCM2835_SDHCI_BASE 0x20300000
#endif
diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h
index 56b0c356bb..dc3ed98879 100644
--- a/arch/arm/mach-bcm283x/include/mach/timer.h
+++ b/arch/arm/mach-bcm283x/include/mach/timer.h
@@ -7,7 +7,11 @@
#define _BCM2835_TIMER_H
#ifndef CONFIG_BCM2835
+#ifdef CONFIG_BCM2838
+#define BCM2835_TIMER_PHYSADDR 0xfe003000
+#else
#define BCM2835_TIMER_PHYSADDR 0x3f003000
+#endif
#else
#define BCM2835_TIMER_PHYSADDR 0x20003000
#endif
diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h
index 99c88e5df7..ef040f385d 100644
--- a/arch/arm/mach-bcm283x/include/mach/wdog.h
+++ b/arch/arm/mach-bcm283x/include/mach/wdog.h
@@ -7,7 +7,11 @@
#define _BCM2835_WDOG_H
#ifndef CONFIG_BCM2835
+#ifdef CONFIG_BCM2838
+#define BCM2835_WDOG_PHYSADDR 0xfe100000
+#else
#define BCM2835_WDOG_PHYSADDR 0x3f100000
+#endif
#else
#define BCM2835_WDOG_PHYSADDR 0x20100000
#endif
--
2.22.0

View File

@ -1,68 +0,0 @@
From 29f48584f6c4b40124396c77547e34febc015a36 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.com>
Date: Fri, 28 Jun 2019 14:25:53 +0200
Subject: [PATCH 12/12] bcm283x mbox: Correctly wait for space to send
For sending, the second mailbox is used, but previously the status register of
the first one was read.
Signed-off-by: Andrei Gherzan <andrei@balena.io>
Upstream-status: Submitted [https://lists.denx.de/pipermail/u-boot/2019-July/376774.html]
---
arch/arm/mach-bcm283x/include/mach/mbox.h | 7 +++++--
arch/arm/mach-bcm283x/mbox.c | 6 +++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index cad035e8cd..cd78966150 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -51,9 +51,12 @@
struct bcm2835_mbox_regs {
u32 read;
u32 rsvd0[5];
- u32 status;
- u32 config;
+ u32 status_r;
+ u32 config_r;
u32 write;
+ u32 rsvd1[5];
+ u32 status_w;
+ u32 config_w;
};
#define BCM2835_MBOX_STATUS_WR_FULL 0x80000000
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 1642ebd103..f7483bf423 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -27,7 +27,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
/* Drain any stale responses */
for (;;) {
- val = readl(&regs->status);
+ val = readl(&regs->status_r);
if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
break;
if (get_timer(0) >= endtime) {
@@ -40,7 +40,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
/* Wait for space to send */
for (;;) {
- val = readl(&regs->status);
+ val = readl(&regs->status_w);
if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
break;
if (get_timer(0) >= endtime) {
@@ -58,7 +58,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv)
/* Wait for the response */
for (;;) {
- val = readl(&regs->status);
+ val = readl(&regs->status_r);
if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
break;
if (get_timer(0) >= endtime) {
--
2.22.0

View File

@ -1,17 +1,12 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
UBOOT_RPI4_SUPPORT_PATCHES = " \
file://0001-configs-rpi4-Add-defconfigs-for-rpi4-32-64.patch \
file://0002-dts-Create-a-dtsi-for-BCM2835-6-7-specific-configura.patch \
file://0003-dts-Add-initial-support-for-bcm2838.patch \
file://0004-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch \
file://0005-arm-mach-bcm283x-Define-mbox-address-for-BCM2838.patch \
file://0006-rpi-Add-rpi_model-entry-for-RaspberryPi-4.patch \
file://0007-dt-bindings-Define-BCM2838_CLOCK_EMMC2-needed-for-Ra.patch \
file://0008-arm-bcm283x-Include-definition-for-additional-emmc-c.patch \
file://0009-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch \
file://0010-arm-bcm283x-Define-device-base-addresses-for-bcm2835.patch \
file://0011-rpi-Add-memory-map-for-bcm2838.patch \
file://0012-bcm283x-mbox-Correctly-wait-for-space-to-send.patch \
file://0002-ARM-bcm283x-Add-BCM283x_BASE-define.patch \
file://0003-arm-mach-bcm283x-Define-configs-for-RaspberryPi-4.patch \
file://0004-rpi-Add-entry-for-Raspberry-Pi-4-model-B.patch \
file://0005-arm-bcm283x-Include-definition-for-additional-emmc-c.patch \
file://0006-mmc-bcm2835_sdhci-Add-support-for-bcm2711-device.patch \
file://0007-rpi-Add-memory-map-for-bcm2838.patch \
"
SRC_URI_append_raspberrypi4 = "${UBOOT_RPI4_SUPPORT_PATCHES}"