mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: ukl@pengutronix.de, "Daniel Brát" <danek.brat@gmail.com>,
	ore@pengutronix.de, "Ahmad Fatoum" <a.fatoum@pengutronix.de>
Subject: [PATCH 05/15] ARM: rpi: add Raspberry Pi 3 64-bit build support
Date: Thu,  5 May 2022 10:01:42 +0200	[thread overview]
Message-ID: <20220505080152.1068424-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220505080152.1068424-1-a.fatoum@pengutronix.de>

Have the subarch select the needed symbols to display a 32-bit/64-bit
menu and hide the boards that aren't capable of 64-bit when
CONFIG_64BIT=y. Building for 64-bit throws some warning about mismatched
type sizes, so fix those as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig                              |  4 ++++
 arch/arm/mach-bcm283x/Kconfig                 | 21 +++++++++++++++----
 arch/arm/mach-bcm283x/include/mach/platform.h |  4 ++--
 arch/arm/mach-bcm283x/mbox.c                  |  2 +-
 images/Makefile.bcm283x                       |  6 ++++++
 5 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 299e0ab08049..ff970e537aec 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -60,6 +60,10 @@ config ARCH_BCM283X
 	select OFTREE
 	select OFDEVICE
 	select HAVE_PBL_MULTI_IMAGES
+	select CPU_SUPPORTS_64BIT_KERNEL
+	select SYS_SUPPORTS_64BIT_KERNEL
+	select CPU_SUPPORTS_32BIT_KERNEL
+	select SYS_SUPPORTS_32BIT_KERNEL
 
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 75acee8dad56..4ffaef694d2f 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -9,29 +9,42 @@ config ARCH_TEXT_BASE
 config MACH_RPI_COMMON
 	bool
 
+config MACH_RPI_AARCH_32_64
+	select MACH_RPI_COMMON
+	select CPU_V7 if 32BIT
+	select ARM_SECURE_MONITOR if 32BIT
+	select CPU_V8 if 64BIT
+	select BOARD_ARM_GENERIC_DT if 64BIT
+	bool
+	help
+	  Select this from CPUs that support both AArch32 and AArch64
+	  execution modes. barebox can be compiled for only one of
+	  these states, depending on the value of
+	  CONFIG_32BIT/CONFIG_64BIT.
+
 menu "select Broadcom BCM283X boards to be built"
 
 config MACH_RPI
 	bool "RaspberryPi (BCM2835/ARM1176JZF-S)"
+	depends on 32BIT
 	select CPU_V6
 	select MACH_RPI_COMMON
 
 config MACH_RPI2
 	bool "RaspberryPi 2 (BCM2836/CORTEX-A7)"
+	depends on 32BIT
 	select CPU_V7
 	select MACH_RPI_COMMON
 
 config MACH_RPI3
 	bool "RaspberryPi 3 (BCM2837/CORTEX-A53)"
-	select CPU_V7
+	select MACH_RPI_AARCH_32_64
 	select MACH_RPI_COMMON
-	select ARM_SECURE_MONITOR
 
 config MACH_RPI_CM3
 	bool "RaspberryPi Compute Module 3 (BCM2837/CORTEX-A53)"
-	select CPU_V7
+	select MACH_RPI_AARCH_32_64
 	select MACH_RPI_COMMON
-	select ARM_SECURE_MONITOR
 
 endmenu
 
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index 310f2463f2e5..6917e1f345d7 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -31,9 +31,9 @@
 #define BCM2835_CACHELINE_SIZE	64
 
 #define BCM2835_PL011_BASE 0x20201000
-#define BCM2836_PL011_BASE 0x3f201000
+#define BCM2836_PL011_BASE 0x3f201000UL
 #define BCM2835_MINIUART_BASE 0x20215040
-#define BCM2836_MINIUART_BASE 0x3f215040
+#define BCM2836_MINIUART_BASE 0x3f215040UL
 
 #endif
 
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 4b14afcfe45b..3a029b8eb33f 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -143,7 +143,7 @@ int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
 	ret = bcm2835_mbox_call_raw(chan, buffer, &rbuffer);
 	if (ret)
 		return ret;
-	if (rbuffer != (u32)buffer) {
+	if (rbuffer != (uintptr_t)buffer) {
 		pr_err("mbox: Response buffer mismatch\n");
 		return -EIO;
 	}
diff --git a/images/Makefile.bcm283x b/images/Makefile.bcm283x
index 82787f972c2d..4c04133bc571 100644
--- a/images/Makefile.bcm283x
+++ b/images/Makefile.bcm283x
@@ -3,6 +3,10 @@
 # barebox image generation Makefile for BCM283x images
 #
 
+# New boards use board-dt-2nd.img as common binary
+# and have the videocore pass the correct DT.
+ifeq ($(CONFIG_32BIT),y)
+
 pblb-$(CONFIG_MACH_RPI) += start_raspberry_pi1
 FILE_barebox-raspberry-pi-1.img = start_raspberry_pi1.pblb
 image-$(CONFIG_MACH_RPI) += barebox-raspberry-pi-1.img
@@ -18,3 +22,5 @@ image-$(CONFIG_MACH_RPI3) += barebox-raspberry-pi-3.img
 pblb-$(CONFIG_MACH_RPI_CM3) += start_raspberry_pi_cm3
 FILE_barebox-raspberry-pi-cm3.img = start_raspberry_pi_cm3.pblb
 image-$(CONFIG_MACH_RPI_CM3) += barebox-raspberry-pi-cm3.img
+
+endif
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2022-05-05  8:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  8:01 [PATCH 00/15] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 01/15] PBL: fdt: fix /memory parsing when #address-cells != #size-cells Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 02/15] of: address: fix printing of OF node name in error message Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 03/15] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 04/15] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-05-05  8:01 ` Ahmad Fatoum [this message]
2022-05-05  8:01 ` [PATCH 06/15] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 07/15] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 08/15] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 09/15] serial: ns16550: rpi: skip baudrate changes for bcm2711 Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 10/15] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 11/15] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 12/15] ARM: rpi: add debug_ll support for Raspberry Pi 4 Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 13/15] ARM: rpi: add heuristic for skipping detection of SDIO card Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 14/15] doc: bcm283x: add initial docs for Raspberry Pi 4 support Ahmad Fatoum
2022-05-05  8:01 ` [PATCH 15/15] doc: bcm283x: reference newer firmware Ahmad Fatoum
2022-05-06 12:47 ` [PATCH 00/15] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220505080152.1068424-6-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=danek.brat@gmail.com \
    --cc=ore@pengutronix.de \
    --cc=ukl@pengutronix.de \
    --subject='Re: [PATCH 05/15] ARM: rpi: add Raspberry Pi 3 64-bit build support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox