diff mbox series

[U-Boot,v2,2/2] arm: qemu: fix failure in flash initialization if booting from TF-A

Message ID 20190703014440.25449-3-takahiro.akashi@linaro.org
State Accepted
Commit 70a64a070e79b657dcb4903299ccad0f5fff8267
Delegated to: Tom Rini
Headers show
Series arm: qemu: fix failure if booting from TF-A | expand

Commit Message

AKASHI Takahiro July 3, 2019, 1:44 a.m. UTC
If U-Boot is loaded and started from TF-A (you need to change
SYS_TEXT_BASE to 0x60000000), it will hang up at flash initialization.

If secure mode is off (default, or -machine virt,secure=off) at qemu,
it will provide dtb with two flash memory banks:
	flash@0 {
		bank-width = <0x4>;
		reg = <0x0 0x0 0x0 0x4000000 0x0 0x4000000 0x0 0x4000000>;
		compatible = "cfi-flash";
	};
If secure mode is on, on the other hand, qemu provides dtb with 1 bank:
	flash@0 {
		bank-width = <0x4>;
		reg = <0x0 0x4000000 0x0 0x4000000>;
		compatible = "cfi-flash";
	};

As a result, flash_init()/flash_get_size() will eventually fail.
With this patch applied, relevant CONFIG values are modified.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 arch/arm/Kconfig           | 1 +
 include/configs/qemu-arm.h | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Tom Rini July 18, 2019, 11:58 p.m. UTC | #1
On Wed, Jul 03, 2019 at 10:44:40AM +0900, AKASHI Takahiro wrote:

> If U-Boot is loaded and started from TF-A (you need to change
> SYS_TEXT_BASE to 0x60000000), it will hang up at flash initialization.
> 
> If secure mode is off (default, or -machine virt,secure=off) at qemu,
> it will provide dtb with two flash memory banks:
> 	flash@0 {
> 		bank-width = <0x4>;
> 		reg = <0x0 0x0 0x0 0x4000000 0x0 0x4000000 0x0 0x4000000>;
> 		compatible = "cfi-flash";
> 	};
> If secure mode is on, on the other hand, qemu provides dtb with 1 bank:
> 	flash@0 {
> 		bank-width = <0x4>;
> 		reg = <0x0 0x4000000 0x0 0x4000000>;
> 		compatible = "cfi-flash";
> 	};
> 
> As a result, flash_init()/flash_get_size() will eventually fail.
> With this patch applied, relevant CONFIG values are modified.
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fe174d02d75a..64552ac5607e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -830,6 +830,7 @@  config ARCH_OWL
 
 config ARCH_QEMU
 	bool "QEMU Virtual Platform"
+	select ARCH_SUPPORT_TFABOOT
 	select DM
 	select DM_SERIAL
 	select OF_CONTROL
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index 65fdb1e92981..35e3c5ad7a8d 100644
--- a/include/configs/qemu-arm.h
+++ b/include/configs/qemu-arm.h
@@ -46,8 +46,13 @@ 
 #define CONFIG_SYS_CBSIZE 512
 
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
+#ifdef CONFIG_TFABOOT
+#define CONFIG_SYS_FLASH_BASE		0x4000000
+#define CONFIG_SYS_MAX_FLASH_BANKS	1
+#else
 #define CONFIG_SYS_FLASH_BASE		0x0
 #define CONFIG_SYS_MAX_FLASH_BANKS	2
+#endif
 #define CONFIG_SYS_MAX_FLASH_SECT	256 /* Sector: 256K, Bank: 64M */
 
 #endif /* __CONFIG_H */