From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEE27C19F2D for ; Tue, 9 Aug 2022 10:08:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5CDE5849DF; Tue, 9 Aug 2022 12:08:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1660039726; bh=ecraVR+8HLMUPkjYVVdY+eJwWHQAe+6TCam0Ga4P4yI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ziPQX7zxTDQahUPHr0ziDKEvJF0jOe6ufFFBnu5Pu82G+qQZL0F3PNRrqNjIwK5tX iUovRkityDqwp8J32vl0WNEBVIPxoR+5Xjjnhq3J02AvMxUOzNvPbSyD0MdPm4Uk0c N6D5Nqe3HuTj/kuwITYtR4fyd+iMWF6Hx0JO5CS8AvI/pn7qURuP82Fuy6MyIXO/YI k0QdFeN06bXqALQtzc1pBPCvpvrymS7QmDoYDPMjxyM4TdOm0ioCW2M++2V2RzGVZN ZEcb4QGsJuuz21Ewuan19F8E4Paud0yhOWcvZj3Osl8lZCy17qkAQp6dELV1BRyNx7 hwliXzyZPD70g== Received: by phobos.denx.de (Postfix, from userid 109) id 04134849DE; Tue, 9 Aug 2022 12:08:39 +0200 (CEST) Received: from xpert.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 18DB2849BA for ; Tue, 9 Aug 2022 12:08:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=pro@denx.de Received: by xpert.denx.de (Postfix, from userid 535) id C4C023E0389; Tue, 9 Aug 2022 12:08:36 +0200 (CEST) From: Philip Oberfichtner To: u-boot@lists.denx.de Cc: Christoph Niedermaier , Stefano Babic , Marek Vasut , Philip Oberfichtner , Andreas Geisreiter , Tom Rini , u-boot@dh-electronics.com Subject: [PATCH v3 3/3] ARM: imx6: dh-imx6: Enable d-cache early in SPL Date: Tue, 9 Aug 2022 12:07:02 +0200 Message-Id: <20220809100703.3101047-4-pro@denx.de> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220809100703.3101047-1-pro@denx.de> References: <20220809100703.3101047-1-pro@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Marek Vasut 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 Signed-off-by: Philip Oberfichtner --- 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 | 28 +++++++++++++++++++++++ configs/dh_imx6_defconfig | 1 + 2 files changed, 29 insertions(+) diff --git a/board/dhelectronics/dh_imx6/dh_imx6_spl.c b/board/dhelectronics/dh_imx6/dh_imx6_spl.c index e49e97724a..4b0e13493d 100644 --- a/board/dhelectronics/dh_imx6/dh_imx6_spl.c +++ b/board/dhelectronics/dh_imx6/dh_imx6_spl.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -14,11 +15,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -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,20 @@ 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 dcache. Without it U-Boot proper would hang at random locations. */ + dcache_disable(); +} diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig index 11db9bac2c..e0075e7e87 100644 --- a/configs/dh_imx6_defconfig +++ b/configs/dh_imx6_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_SYS_L2_PL310=y +CONFIG_SPL_SYS_L2_PL310=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x17800000 CONFIG_SYS_MALLOC_F_LEN=0x1000 -- 2.37.1