From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/2] arm: stm32mp: activate data cache on DDR in SPL
Date: Fri, 3 Apr 2020 23:32:57 +0200 [thread overview]
Message-ID: <2b133f06-e111-e709-8bdb-b01e791df284@denx.de> (raw)
In-Reply-To: <20200403105644.v2.2.Ib571c64a8c50fcbe386e728e38bbd320427e4efb@changeid>
On 4/3/20 11:25 AM, Patrick Delaunay wrote:
> Activate cache on DDR to improves the accesses to DDR used by SPL:
> - CONFIG_SPL_BSS_START_ADDR
> - CONFIG_SYS_SPL_MALLOC_START
>
> Cache is configured only when DDR is fully initialized,
> to avoid speculative access and issue in get_ram_size().
> Data cache is deactivated at the end of SPL, to flush the data cache
> and the TLB.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
> Changes in v2:
> - new
>
> arch/arm/mach-stm32mp/spl.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
> index 9cd7b418a4..279121af75 100644
> --- a/arch/arm/mach-stm32mp/spl.c
> +++ b/arch/arm/mach-stm32mp/spl.c
> @@ -4,6 +4,7 @@
> */
>
> #include <common.h>
> +#include <cpu_func.h>
> #include <dm.h>
> #include <hang.h>
> #include <spl.h>
> @@ -117,4 +118,24 @@ void board_init_f(ulong dummy)
> printf("DRAM init failed: %d\n", ret);
> hang();
> }
> +
> + /*
> + * activate cache on DDR only when DDR is fully initialized
> + * to avoid speculative access and issue in get_ram_size()
> + */
> + if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
> + mmu_set_region_dcache_behaviour(STM32_DDR_BASE, STM32_DDR_SIZE,
> + DCACHE_DEFAULT_OPTION);
> +}
> +
> +void spl_board_prepare_for_boot(void)
> +{
> + dcache_disable();
> + debug("SPL bye\n");
> +}
> +
> +void spl_board_prepare_for_boot_linux(void)
> +{
> + dcache_disable();
> + debug("SPL bye\n");
Is the debug() statement really needed ? I think the common SPL code
already has some.
next prev parent reply other threads:[~2020-04-03 21:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 9:25 [PATCH v2 0/2] arm: stm32mp1: activate data cache in SPL and before relocation Patrick Delaunay
2020-04-03 9:25 ` [PATCH v2 1/2] arm: stm32mp: " Patrick Delaunay
2020-04-03 21:31 ` Marek Vasut
2020-04-09 18:32 ` Patrick DELAUNAY
2020-04-10 8:15 ` Marek Vasut
2020-04-03 9:25 ` [PATCH v2 2/2] arm: stm32mp: activate data cache on DDR in SPL Patrick Delaunay
2020-04-03 21:32 ` Marek Vasut [this message]
2020-04-09 18:10 ` Patrick DELAUNAY
2020-04-10 8:15 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b133f06-e111-e709-8bdb-b01e791df284@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox