u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Liviu Dudau <liviu.dudau@foss.arm.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Peter Hoyes <peter.hoyes@arm.com>, Tom Rini <trini@konsulko.com>,
	Simon Glass <sjg@chromium.org>,
	u-boot@lists.denx.de, Sean Anderson <sean.anderson@seco.com>
Subject: [PATCH 04/11] vexpress64: fvp: enable OF_CONTROL
Date: Fri,  4 Mar 2022 16:30:11 +0000	[thread overview]
Message-ID: <20220304163018.3167841-5-andre.przywara@arm.com> (raw)
In-Reply-To: <20220304163018.3167841-1-andre.przywara@arm.com>

The FVP base model is relying on a DT for Linux operation, so there is
no reason we would need to rely on hardcoded information for U-Boot.
Letting U-Boot use a DT will open up the usage of actual peripherals,
beyond the support for semihosting only.

Enable OF_CONTROL in the Kconfig, and use the latest dts files from
Linux. Depending on whether we use the boot-wrapper or TF-A, there is
already a DTB provided or not, respectively.

To cover the boot-wrapper, we add an arm64 Linux kernel header, which
allows the boot-wrapper to treat U-Boot like a Linux kernel. U-Boot will
find the pointer to the DTB in x0, and will use it.

Even though TF-A carries a DT, at the moment this is not made available
to non-secure world, so to not break users, we use the U-Boot provided
DTB copy in that case. For some reason TF-A puts some DT like structure
at the address x0 is pointing at, but that is very small and doesn't
carry any hardware information. Make the code to ignore those small DTBs.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 arch/arm/Kconfig                       | 2 ++
 arch/arm/dts/Makefile                  | 1 +
 board/armltd/vexpress64/Kconfig        | 8 ++++++--
 board/armltd/vexpress64/vexpress64.c   | 8 +++++++-
 configs/vexpress_aemv8a_semi_defconfig | 2 +-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 34dbd73cce..afb42e62d8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1241,6 +1241,8 @@ config ARCH_VEXPRESS64
 	select DM
 	select DM_SERIAL
 	select PL01X_SERIAL
+	select OF_CONTROL
+	select CLK
 
 config TARGET_TOTAL_COMPUTE
 	bool "Support Total Compute Platform"
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 960f1a9fd4..4c8492cd7d 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1180,6 +1180,7 @@ dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
 # TODO(Linus Walleij <linus.walleij@linaro.org>): Should us a single vexpress
 # Kconfig option to build all of these. See examples above.
 dtb-$(CONFIG_TARGET_VEXPRESS_CA9X4) += vexpress-v2p-ca9.dtb
+dtb-$(CONFIG_TARGET_VEXPRESS64_BASE_FVP) += fvp-base-revc.dtb
 dtb-$(CONFIG_TARGET_VEXPRESS64_JUNO) += juno-r2.dtb
 
 dtb-$(CONFIG_TARGET_TOTAL_COMPUTE) += total_compute.dtb
diff --git a/board/armltd/vexpress64/Kconfig b/board/armltd/vexpress64/Kconfig
index 55fe0118e1..34126446a7 100644
--- a/board/armltd/vexpress64/Kconfig
+++ b/board/armltd/vexpress64/Kconfig
@@ -15,13 +15,14 @@ choice
 config TARGET_VEXPRESS64_BASE_FVP
 	bool "Support Versatile Express ARMv8a FVP BASE model"
 	select SEMIHOSTING
+	select LINUX_KERNEL_IMAGE_HEADER
+	select POSITION_INDEPENDENT
+	select OF_BOARD
 
 config TARGET_VEXPRESS64_JUNO
 	bool "Support Versatile Express Juno Development Platform"
 	select DM_ETH
 	select USB
-	select OF_CONTROL
-	select CLK
 	select BLK
 	imply OF_HAS_PRIOR_STAGE
 
@@ -34,4 +35,7 @@ config JUNO_DTB_PART
 	  The ARM partition name in the NOR flash memory holding the
 	  device tree blob to configure U-Boot.
 
+config LNX_KRNL_IMG_TEXT_OFFSET_BASE
+	default SYS_TEXT_BASE
+
 endif
diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c
index 5e22e89824..7d5e5516f9 100644
--- a/board/armltd/vexpress64/vexpress64.c
+++ b/board/armltd/vexpress64/vexpress64.c
@@ -168,11 +168,17 @@ void *board_fdt_blob_setup(int *err)
 	}
 #endif
 
-	if (fdt_magic(prior_stage_fdt_address) == FDT_MAGIC) {
+	if (fdt_magic(prior_stage_fdt_address) == FDT_MAGIC &&
+	    fdt_totalsize(prior_stage_fdt_address) > 0x100) {
 		*err = 0;
 		return (void *)prior_stage_fdt_address;
 	}
 
+	if (fdt_magic(gd->fdt_blob) == FDT_MAGIC) {
+		*err = 0;
+		return (void *)gd->fdt_blob;
+	}
+
 	*err = -ENXIO;
 	return NULL;
 }
diff --git a/configs/vexpress_aemv8a_semi_defconfig b/configs/vexpress_aemv8a_semi_defconfig
index 24af87904f..cbabc2f96a 100644
--- a/configs/vexpress_aemv8a_semi_defconfig
+++ b/configs/vexpress_aemv8a_semi_defconfig
@@ -9,6 +9,7 @@ CONFIG_SYS_MEMTEST_START=0x80000000
 CONFIG_SYS_MEMTEST_END=0xff000000
 CONFIG_ENV_SIZE=0x40000
 CONFIG_ENV_SECT_SIZE=0x40000
+CONFIG_DEFAULT_DEVICE_TREE="fvp-base-revc"
 CONFIG_IDENT_STRING=" vexpress_aemv8a"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_REMAKE_ELF=y
@@ -45,4 +46,3 @@ CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_PROTECTION=y
 CONFIG_SYS_FLASH_CFI=y
-CONFIG_OF_LIBFDT=y
-- 
2.25.1


  parent reply	other threads:[~2022-03-04 16:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 16:30 [PATCH 00/11] vexpress64: OF_CONTROL and ARMv8-R64 support Andre Przywara
2022-03-04 16:30 ` [PATCH 01/11] vexpress64: fvp: Fix automatic boot Andre Przywara
2022-03-14 18:14   ` Tom Rini
2022-03-04 16:30 ` [PATCH 02/11] vexpress64: Kconfig: move board definitions out of arch/arm Andre Przywara
2022-04-03  0:13   ` Tom Rini
2022-03-04 16:30 ` [PATCH 03/11] arm: dts: Add Arm FVP Fastmodel RevC .dts files from Linux Andre Przywara
2022-04-03  0:13   ` Tom Rini
2022-03-04 16:30 ` Andre Przywara [this message]
2022-04-03  0:14   ` [PATCH 04/11] vexpress64: fvp: enable OF_CONTROL Tom Rini
2022-03-04 16:30 ` [PATCH 05/11] vexpress64: config header: unify environment definition Andre Przywara
2022-04-03  0:14   ` Tom Rini
2022-03-04 16:30 ` [PATCH 06/11] vexpress64: move hardware setting from defconfig to Kconfig Andre Przywara
2022-04-03  0:14   ` Tom Rini
2022-03-04 16:30 ` [PATCH 07/11] vexpress64: fvp: add distro_boot support Andre Przywara
2022-03-04 16:30 ` [PATCH 08/11] vexpress64: defconfigs: allow default commands Andre Przywara
2022-04-03  0:14   ` Tom Rini
2022-03-04 16:30 ` [PATCH 09/11] vexpress64: generalise page table generation Andre Przywara
2022-04-03  0:14   ` Tom Rini
2022-03-04 16:30 ` [PATCH 10/11] vexpress64: pick DRAM size from DT Andre Przywara
2022-04-03  0:14   ` Tom Rini
2022-03-04 16:30 ` [PATCH 11/11] vexpress64: Add ARMv8R-64 board variant Andre Przywara
2022-03-11 18:29   ` Liviu Dudau
2022-04-03  0:14   ` Tom Rini
2022-03-08  0:28 ` [PATCH 00/11] vexpress64: OF_CONTROL and ARMv8-R64 support Linus Walleij

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=20220304163018.3167841-5-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=liviu.dudau@foss.arm.com \
    --cc=peter.hoyes@arm.com \
    --cc=sean.anderson@seco.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).