arm: qemu: fix failure in flash initialization if booting from TF-A
authorAKASHI Takahiro <takahiro.akashi@linaro.org>
Wed, 3 Jul 2019 01:44:40 +0000 (10:44 +0900)
committerTom Rini <trini@konsulko.com>
Thu, 18 Jul 2019 15:31:28 +0000 (11:31 -0400)
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
include/configs/qemu-arm.h

index 602d61ee3d8c1f6a20ff44caaedc35ad35e8f7b8..51d4acedac4494aea7df6e99bd66838eb7eb75e8 100644 (file)
@@ -840,6 +840,7 @@ config ARCH_OWL
 
 config ARCH_QEMU
        bool "QEMU Virtual Platform"
+       select ARCH_SUPPORT_TFABOOT
        select DM
        select DM_SERIAL
        select OF_CONTROL
index 65fdb1e9298189ed0128abe2956f8341c526bab1..35e3c5ad7a8da0294c7d5e61d60732f251fd7f07 100644 (file)
 #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 */