diff mbox series

[U-Boot,v2,3/8] ARM: bcm283x: Define configs for RaspberryPi 4

Message ID 20190724143911.29770-4-andrei@balena.io
State Changes Requested
Delegated to: Matthias Brugger
Headers show
Series Raspberry Pi 32/64 support | expand

Commit Message

Andrei Gherzan July 24, 2019, 2:39 p.m. UTC
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>
---
 arch/arm/mach-bcm283x/Kconfig | 62 +++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

Comments

Matthias Brugger July 26, 2019, 11 a.m. UTC | #1
On 24/07/2019 16:39, Andrei Gherzan wrote:
> 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>
> ---
>  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
>  

In upstream kernel the SoC uses bcm2711 as identifier. So this get's messy here,
because we have all the bcm283x stuff. Anyway we should try to keep the
confusion as low as possible, so I propose to rename all BCM2838 in here to BCM2711.

It's not perfect but I think it's the best we can get right now.

Regards,
Matthias
diff mbox series

Patch

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