ARM: imx6: dh-imx6: Enable d-cache early in SPL
Subsystems (6)
v6 cover ARM: imx6: dh-imx6: Enable d-cache early in SPL
This patch series enables d-cache in SPL for i.MX6 based boards from DH in order to improve boot time.
This can only be achieved after migrating the corresponding symbols to Kconfig, which is done in patch 1/3 and 2/3.
Changes in v6:
- Once more improve the dcache_disable() comment
Changes in v5:
- Clarify dcache_disable() comment
Changes in v4:
- Reduce diffstat by using 'select' statements for omap2, mvebu and mx6 based boards
- Elaborate on dcache_disable() comment
Changes in v3:
- Introduce CONFIG_SPL_SYS_L2_PL310
- Convert CONFIG_SYS_L2_PL310 to Kconfig
- Use newly introduced Kconfig symbol for dh_imx6_defconfig
Changes in v2:
- Add comment to explain the relevance of dcache_disable()
Marek Vasut (1):
ARM: imx6: dh-imx6: Enable d-cache early in SPL
Philip Oberfichtner (2):
Convert CONFIG_SYS_L2_PL310 to Kconfig
ARM: cache: Allow SPL to build cache-pl310.c
README | 2 -- arch/arm/Kconfig | 10 ++++++ arch/arm/lib/Makefile | 2 +- arch/arm/mach-mvebu/Kconfig | 1 + arch/arm/mach-mvebu/include/mach/config.h | 2 -- arch/arm/mach-omap2/Kconfig | 1 + board/dhelectronics/dh_imx6/dh_imx6_spl.c | 41 +++++++++++++++++++++++ configs/dh_imx6_defconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap4_sdp4430_defconfig | 1 + configs/poleg_evb_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_chameleonv3_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_dbm_soc1_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de10_standard_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_secu1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stemmy_defconfig | 1 + include/configs/am43xx_evm.h | 1 - include/configs/brppt2.h | 1 - include/configs/cm_t43.h | 1 - include/configs/mx6_common.h | 1 - include/configs/odroid.h | 1 - include/configs/poleg.h | 1 - include/configs/socfpga_common.h | 1 - include/configs/stemmy.h | 1 - include/configs/ti_omap4_common.h | 1 - include/configs/trats.h | 1 - include/configs/trats2.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 41 files changed, 75 insertions(+), 18 deletions(-)
Signature · 1 line
2.37.1
PATCH v6 1/3 Convert CONFIG_SYS_L2_PL310 to Kconfig
This converts CONFIG_SYS_L2_PL310 to Kconfig.
For omap2 and mvebu the 'select SYS_L2_PL310' locations were determined using ./tools/moveconfig -i CONFIG_SYS_L2_PL310.
For mx6 I manually chose ARCH_MX6 as 'select' location. The correctness has been verified using
$ ./tools/moveconfig.py -f ARCH_MX6 ~SYS_L2_PL310 ~SYS_L2CACHE_OFF 0 matches
That means whenever an ARCH_MX6 board had SYS_L2_PL310 disabled, this was correctly reflected in SYS_L2CACHE_OFF. Thus it's safe to insert the 'select' statement under ARCH_MX6.
---
I wonder if we could further reduce the diffstat by using 'select' for all the socfpga boards. I did not find an appropriate way - I'm open for suggestions, though.
(no changes since v4)
Changes in v4:
- Reduce diffstat by using 'select' statements for omap2, mvebu and mx6 based boards
Changes in v3:
new
README | 2 -- arch/arm/Kconfig | 5 +++++ arch/arm/mach-mvebu/Kconfig | 1 + arch/arm/mach-mvebu/include/mach/config.h | 2 -- arch/arm/mach-omap2/Kconfig | 1 + configs/omap4_panda_defconfig | 1 + configs/omap4_sdp4430_defconfig | 1 + configs/poleg_evb_defconfig | 1 + configs/socfpga_arria10_defconfig | 1 + configs/socfpga_arria5_defconfig | 1 + configs/socfpga_chameleonv3_defconfig | 1 + configs/socfpga_cyclone5_defconfig | 1 + configs/socfpga_dbm_soc1_defconfig | 1 + configs/socfpga_de0_nano_soc_defconfig | 1 + configs/socfpga_de10_nano_defconfig | 1 + configs/socfpga_de10_standard_defconfig | 1 + configs/socfpga_de1_soc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/socfpga_mcvevk_defconfig | 1 + configs/socfpga_secu1_defconfig | 1 + configs/socfpga_sockit_defconfig | 1 + configs/socfpga_socrates_defconfig | 1 + configs/socfpga_sr1500_defconfig | 1 + configs/socfpga_vining_fpga_defconfig | 1 + configs/stemmy_defconfig | 1 + include/configs/am43xx_evm.h | 1 - include/configs/brppt2.h | 1 - include/configs/cm_t43.h | 1 - include/configs/mx6_common.h | 1 - include/configs/odroid.h | 1 - include/configs/poleg.h | 1 - include/configs/socfpga_common.h | 1 - include/configs/stemmy.h | 1 - include/configs/ti_omap4_common.h | 1 - include/configs/trats.h | 1 - include/configs/trats2.h | 1 - include/configs/zynq-common.h | 1 - scripts/config_whitelist.txt | 1 - 38 files changed, 27 insertions(+), 17 deletions(-)
README +0 -2
@@ -496,8 +496,6 @@ The following options need to be configured: the defaults discussed just above. - Cache Configuration for ARM: - CONFIG_SYS_L2_PL310 - Enable support for ARM PL310 L2 cache - controller CONFIG_SYS_PL310_BASE - Physical base address of PL310 controller register space
arch/arm/Kconfig +5 -0
@@ -488,6 +488,10 @@ config TPL_SYS_THUMB_BUILD density. For ARM architectures that support Thumb2 this flag will result in Thumb2 code generated by GCC. +config SYS_L2_PL310 + bool "ARM PL310 L2 cache controller" + help + Enable support for ARM PL310 L2 cache controller in U-Boot config SYS_L2CACHE_OFF bool "L2cache off"
@@ -989,6 +993,7 @@ config ARCH_MX6 select SYS_FSL_HAS_SEC select SYS_FSL_SEC_COMPAT_4 select SYS_FSL_SEC_LE + select SYS_L2_PL310 if !SYS_L2CACHE_OFF imply MXC_GPIO imply SYS_THUMB_BUILD imply SPL_SEPARATE_BSS
arch/arm/mach-mvebu/Kconfig +1 -0
@@ -14,6 +14,7 @@ config ARMADA_32BIT select SPL_SKIP_LOWLEVEL_INIT if SPL select SPL_SIMPLE_BUS if SPL select SUPPORT_SPL + select SYS_L2_PL310 if !SYS_L2CACHE_OFF select TRANSLATION_OFFSET select SPL_SYS_NO_VECTOR_TABLE if SPL select ARCH_VERY_EARLY_INIT
arch/arm/mach-mvebu/include/mach/config.h +0 -2
@@ -25,8 +25,6 @@#define MV88F78X60 /* for the DDR training bin_hdr code */ #endif -#define CONFIG_SYS_L2_PL310 -#define MV_UART_CONSOLE_BASE MVEBU_UART0_BASE/* Needed for SPI NOR booting in SPL */
arch/arm/mach-omap2/Kconfig +1 -0
@@ -96,6 +96,7 @@ config TI816X config AM43XX bool "AM43XX SoC" select SPECIFY_CONSOLE_INDEX + select SYS_L2_PL310 if !SYS_L2CACHE_OFF imply NAND_OMAP_ELM imply NAND_OMAP_GPMC imply SPL_DM
configs/omap4_panda_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_OMAP2PLUS=y CONFIG_SYS_MALLOC_F_LEN=0x4000 CONFIG_DEFAULT_DEVICE_TREE="omap4-panda"
configs/omap4_sdp4430_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y # CONFIG_SPL_USE_ARCH_MEMCPY is not set # CONFIG_SPL_USE_ARCH_MEMSET is not set CONFIG_ARCH_OMAP2PLUS=y
configs/poleg_evb_defconfig +1 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_CPU_INIT=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_NPCM=y CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_SYS_MALLOC_LEN=0x240000
configs/socfpga_arria10_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_arria5_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_chameleonv3_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_ENV_SIZE=0x10000 CONFIG_ENV_OFFSET=0x4400
configs/socfpga_cyclone5_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_dbm_soc1_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_de0_nano_soc_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_de10_nano_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_de10_standard_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_de1_soc_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_is1_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_mcvevk_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_secu1_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_SYS_MALLOC_F_LEN=0x800
configs/socfpga_sockit_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_socrates_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x2000
configs/socfpga_sr1500_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x4000
configs/socfpga_vining_fpga_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_MALLOC_LEN=0x4000000 CONFIG_ENV_SIZE=0x4000
configs/stemmy_defconfig +1 -0
@@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_SYS_L2_PL310=y CONFIG_ARCH_U8500=y CONFIG_SUPPORT_PASSING_ATAGS=y # CONFIG_SETUP_MEMORY_TAGS is not set
include/configs/am43xx_evm.h +0 -1
@@ -29,7 +29,6 @@/* SPL defines. */ /* Enabling L2 Cache */ -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE 0x48242000/*
include/configs/brppt2.h +0 -1
@@ -13,7 +13,6 @@/* -- i.mx6 specifica -- */ #ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE L2_PL310_BASE#endif /* !CONFIG_SYS_L2CACHE_OFF */
include/configs/cm_t43.h +0 -1
@@ -36,7 +36,6 @@#define CONFIG_POWER_TPS65218 /* Enabling L2 Cache */ -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE 0x48242000/*
include/configs/mx6_common.h +0 -1
@@ -12,7 +12,6 @@#define CONFIG_SC_TIMER_CLK 8000000/* 8Mhz */ #else #ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE L2_PL310_BASE#endif
include/configs/odroid.h +0 -1
@@ -14,7 +14,6 @@#include <configs/exynos4-common.h> #ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE 0x10502000#endif
include/configs/poleg.h +0 -1
@@ -7,7 +7,6 @@#define __CONFIG_POLEG_H#ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 1#define CONFIG_SYS_PL310_BASE 0xF03FC000/* L2 - Cache Regs Base (4k Space)*/ #endif
include/configs/socfpga_common.h +0 -1
@@ -48,7 +48,6 @@/* * Cache */ -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE SOCFPGA_MPUL2_ADDRESS/*
include/configs/stemmy.h +0 -1
@@ -15,7 +15,6 @@*/ /* FIXME: This should be loaded from device tree... */ -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE 0xa0412000/* Linux does not boot if FDT / initrd is loaded to end of RAM */
include/configs/ti_omap4_common.h +0 -1
@@ -12,7 +12,6 @@#define __CONFIG_TI_OMAP4_COMMON_H#ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 1#define CONFIG_SYS_PL310_BASE 0x48242000#endif
include/configs/trats.h +0 -1
@@ -12,7 +12,6 @@#include <configs/exynos4-common.h> #ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE 0x10502000#endif
include/configs/trats2.h +0 -1
@@ -13,7 +13,6 @@#include <configs/exynos4-common.h> #ifndef CONFIG_SYS_L2CACHE_OFF -#define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE 0x10502000#endif
include/configs/zynq-common.h +0 -1
@@ -11,7 +11,6 @@/* Cache options */ #ifndef CONFIG_SYS_L2CACHE_OFF -# define CONFIG_SYS_L2_PL310 # define CONFIG_SYS_PL310_BASE 0xf8f02000#endif
scripts/config_whitelist.txt +0 -1
@@ -908,7 +908,6 @@ CONFIG_SYS_JFFS2_FIRST_SECTOR CONFIG_SYS_JFFS2_NUM_BANKS CONFIG_SYS_KMBEC_FPGA_BASE CONFIG_SYS_KMBEC_FPGA_SIZE -CONFIG_SYS_L2_PL310 CONFIG_SYS_L2_SIZE CONFIG_SYS_L3_SIZE CONFIG_SYS_LATCH_ADDR
Signature · 1 line
2.37.1
Re: [PATCH v6 1/3] Convert CONFIG_SYS_L2_PL310 to Kconfig
Quoted 8 lines · Philip Oberfichtner
This converts
CONFIG_SYS_L2_PL310toKconfig.For omap2 and mvebu the 'select
SYS_L2_PL310' locations were determined using./tools/moveconfig-iCONFIG_SYS_L2_PL310.For mx6 I manually chose
ARCH_MX6as 'select' location. The correctness has been verified using
Quoted 8 lines
$ ./tools/moveconfig.py -f ARCH_MX6 ~SYS_L2_PL310 ~SYS_L2CACHE_OFF 0 matchesThat means whenever an
ARCH_MX6board hadSYS_L2_PL310disabled, this was correctly reflected inSYS_L2CACHE_OFF. Thus it's safe to insert the 'select' statement underARCH_MX6.Signed-off-by Philip Oberfichtner <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v6 2/3 ARM: cache: Allow SPL to build cache-pl310.c
In reply to Philip OberfichtnerIntroduce the new Kconfig symbol CONFIG_SPL_SYS_L2_PL310 to allow the SPL to build cache-pl310.c.
Before this commit, the SPL could enable the PL310 L2 cache [1], but the cache maintenance functions from cache-pl310.c were only useable for non-SPL builds.
After enabling the cache one must be able to flush it, too. Thus this commit allows cache-pl310.c to be included in the SPL build.
[1] See for example arch/arm/mach-imx/cache.c: v7_outer_cache_enable()
---
(no changes since v3)
Changes in v3:
- Introduce CONFIG_SPL_SYS_L2_PL310
arch/arm/Kconfig | 5 +++++ arch/arm/lib/Makefile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/Kconfig +5 -0
@@ -493,6 +493,11 @@ config SYS_L2_PL310 help Enable support for ARM PL310 L2 cache controller in U-Boot +config SPL_SYS_L2_PL310 + bool "ARM PL310 L2 cache controller in SPL" + help + Enable support for ARM PL310 L2 cache controller in SPL + config SYS_L2CACHE_OFF bool "L2cache off" help
arch/arm/lib/Makefile +1 -1
@@ -33,7 +33,6 @@ obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o obj-$(CONFIG_CMD_BOOTI) += bootm.o image.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o -obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o else obj-$(CONFIG_$(SPL_TPL_)FRAMEWORK) += spl.o obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
@@ -46,6 +45,7 @@ else obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o endif +obj-$(CONFIG_$(SPL_TPL_)SYS_L2_PL310) += cache-pl310.o obj-$(CONFIG_$(SPL_TPL_)SEMIHOSTING) += semihosting.o ifneq ($(filter y,$(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) $(CONFIG_SAVE_PREV_BL_FDT_ADDR)),)
Signature · 1 line
2.37.1
Re: [PATCH v6 2/3] ARM: cache: Allow SPL to build cache-pl310.c
Quoted 7 lines · Philip Oberfichtner
Introduce the new
KconfigsymbolCONFIG_SPL_SYS_L2_PL310to allow the SPL to buildcache-pl310.c.Before this commit, the SPL could enable the PL310 L2 cache [1], but the cache maintenance functions from
cache-pl310.cwere only useable for non-SPL builds.
Quoted 6 lines
After enabling the cache one must be able to flush it, too. Thus this commit allows
cache-pl310.cto be included in the SPL build.[1] See for example
arch/arm/mach-imx/cache.c:v7_outer_cache_enable()Signed-off-by Philip Oberfichtner <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH v6 3/3 ARM: imx6: dh-imx6: Enable d-cache early in SPL
In reply to Philip OberfichtnerFrom: Marek Vasut <[email protected]>
Enable d-cache early in SPL right after DRAM is started up. This reduces U-Boot proper load time by 650ms when loaded from SPI NOR.
---
Changes in v6:
- Once more improve the dcache_disable() comment
Changes in v5:
- Clarify dcache_disable() comment
Changes in v4:
- Elaborate on dcache_disable() comment
Changes in v3:
- Use newly introduced Kconfig symbol for dh_imx6_defconfig
Changes in v2:
- Add comment to explain the relevance of dcache_disable()
board/dhelectronics/dh_imx6/dh_imx6_spl.c | 41 +++++++++++++++++++++++ configs/dh_imx6_defconfig | 1 + 2 files changed, 42 insertions(+)
board/dhelectronics/dh_imx6/dh_imx6_spl.c +41 -0
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <cpu_func.h> #include <init.h> #include <asm/arch/clock.h> #include <asm/arch/crm_regs.h>
@@ -14,11 +15,13 @@#include <asm/arch/mx6-ddr.h> #include <asm/arch/mx6-pins.h> #include <asm/arch/sys_proto.h> +#include <asm/cache.h> #include <asm/gpio.h> #include <asm/mach-imx/boot_mode.h> #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/io.h> +#include <asm/system.h> #include <errno.h> #include <fuse.h> #include <fsl_esdhc_imx.h>
@@ -610,6 +613,20 @@ static void dhcom_spl_dram_init(void) } } +void dram_bank_mmu_setup (int bank) +{ +int i; + +set_section_dcache (ROMCP_ARB_BASE_ADDR >>MMU_SECTION_SHIFT ,DCACHE_DEFAULT_OPTION ); +set_section_dcache (IRAM_BASE_ADDR >>MMU_SECTION_SHIFT ,DCACHE_DEFAULT_OPTION ); + +for (i =MMDC0_ARB_BASE_ADDR >>MMU_SECTION_SHIFT ; + i < ((MMDC0_ARB_BASE_ADDR >>MMU_SECTION_SHIFT ) + + (SZ_1G >>MMU_SECTION_SHIFT )); + i++) +set_section_dcache (i,DCACHE_DEFAULT_OPTION ); +} +void board_init_f (ulong dummy) {/* setup AIPS and disable watchdog */
@@ -636,9 +653,33 @@ void board_init_f(ulong dummy)/* DDR3 initialization */ dhcom_spl_dram_init (); +/* Set up early MMU tables at the beginning of DRAM and start d-cache */ + gd->arch.tlb_addr =MMDC0_ARB_BASE_ADDR +SZ_32M ; + gd->arch.tlb_size =PGTABLE_SIZE ; +enable_caches (); +/* Clear the BSS. */ memset (__bss_start,0 , __bss_end - __bss_start);/* load/boot image from boot device */ board_init_r (NULL ,0 ); } + +void spl_board_prepare_for_boot (void ) +{ +/* +* Flush and disable dcache. Without it, the following bootstage might fail randomly because +* dirty cache lines may not have been written back to DRAM. +* +* If dcache_disable() would be omitted, the following scenario may occur: +* +* The SPL enables dcache and cachelines get populated with data. Then dcache gets disabled +* in U-Boot proper, but still contains dirty data, i.e. the corresponding DRAM locations +* have not yet been updated. When U-Boot reads these locations, it sees an (incorrect) old +* state of the content. +* +* Furthermore, the DRAM contents have likely been modified by U-Boot while dcache was +* disabled. Thus, U-Boot flushing dcache would corrupt DRAM with stale data. +*/ +dcache_disable ();/* implies flush_dcache_all() */ +}
configs/dh_imx6_defconfig +1 -0
@@ -1,4 +1,5 @@ CONFIG_ARM=y +CONFIG_SPL_SYS_L2_PL310=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x17800000 CONFIG_SYS_MALLOC_F_LEN=0x1000
Signature · 1 line
2.37.1
Quoted 8 lines · Philip Oberfichtner
From: Marek Vasut <[email protected]>
Enable d-cache early in SPL right after DRAM is started up. This reduces U-Boot proper load time by 650ms when loaded from SPI NOR.
Signed-off-by Marek Vasut <[email protected]>Signed-off-by Philip Oberfichtner <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom