From: Heinrich Schuchardt Date: Thu, 27 Jun 2019 06:50:55 +0200 Subject: [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A In-Reply-To: <20190627010937.19773-1-takahiro.akashi@linaro.org> References: <20190627010937.19773-1-takahiro.akashi@linaro.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 6/27/19 3:09 AM, 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 at 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 at 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. > > NOTE: you will not have to modify SYS_TEXT_BASE any more once > Yamada-san's patch[1] is merged. > > [1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html > > Signed-off-by: AKASHI Takahiro Thanks a lot for solving this problem. CONFIG_TFABOOT is in arch/arm/cpu/armv8/fsl-layerscape/Kconfig. If the configuration option is relevant for more systems, shouldn't it be moved to arch/arm/cpu/armv8/Kconfig (in a separate patch)? In that case we could also adapt the help text and add 'ARM trusted firmware' to make it easier to understand. Tested-by: Heinrich Schuchardt > --- > include/configs/qemu-arm.h | 5 +++++ > 1 file changed, 5 insertions(+) > > 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 */ >