From: Aneesh V <aneesh@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v 1/3] arm: do not force d-cache enable on all boards
Date: Fri, 05 Aug 2011 20:37:07 +0530 [thread overview]
Message-ID: <4E3C071B.8060202@ti.com> (raw)
In-Reply-To: <1312197486-31712-2-git-send-email-aneesh@ti.com>
Hi Albert,
On Monday 01 August 2011 04:48 PM, Aneesh V wrote:
> c2dd0d45540397704de9b13287417d21049d34c6 added dcache_enable()
> to board_init_r(). This enables d-cache for all ARM boards.
> As a result some of the arm boards that are not cache-ready
> are broken. Revert this change and allow platform code to
> take the decision on d-cache enabling.
>
> Also add some documentation for cache usage in ARM.
>
> Signed-off-by: Aneesh V<aneesh@ti.com>
> ---
> MAKEALL pending. Will update the results tomorrow.
> ---
> arch/arm/lib/board.c | 8 +++-----
> arch/arm/lib/cache.c | 12 ++++++++++++
> doc/README.arm-caches | 40 ++++++++++++++++++++++++++++++++++++++++
> include/common.h | 1 +
> 4 files changed, 56 insertions(+), 5 deletions(-)
> create mode 100644 doc/README.arm-caches
>
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 90709d0..d093d5b 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -446,11 +446,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
> gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
>
> monitor_flash_len = _end_ofs;
> - /*
> - * Enable D$:
> - * I$, if needed, must be already enabled in start.S
> - */
> - dcache_enable();
> +
> + /* Enable caches */
> + enable_caches();
>
> debug ("monitor flash len: %08lX\n", monitor_flash_len);
> board_init(); /* Setup chipselects */
> diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c
> index 92b61a2..b545fb7 100644
> --- a/arch/arm/lib/cache.c
> +++ b/arch/arm/lib/cache.c
> @@ -53,3 +53,15 @@ void __flush_dcache_all(void)
> }
> void flush_dcache_all(void)
> __attribute__((weak, alias("__flush_dcache_all")));
> +
> +
> +/*
> + * Default implementation of enable_caches()
> + * Real implementation should be in platform code
> + */
> +void __enable_caches(void)
> +{
> + puts("WARNING: Caches not enabled\n");
> +}
> +void enable_caches(void)
> + __attribute__((weak, alias("__enable_caches")));
> diff --git a/doc/README.arm-caches b/doc/README.arm-caches
> new file mode 100644
> index 0000000..9edc252
> --- /dev/null
> +++ b/doc/README.arm-caches
> @@ -0,0 +1,40 @@
> +Disabling I-cache:
> +- Set CONFIG_SYS_ICACHE_OFF
> +
> +Disabling D-cache:
> +- Set CONFIG_SYS_DCACHE_OFF
> +
> +Enabling I-cache:
> +- Make sure CONFIG_SYS_ICACHE_OFF is not set and call icache_enable().
> +
> +Enabling D-cache:
> +- Make sure CONFIG_SYS_ICACHE_OFF is not set and call dcache_enable().
> +
> +Enabling Caches at System Startup:
> +- Implement enable_caches() for your platform and enable the I-cache and
> + D-cache from this function. This function is called immediately
> + after relocation.
> +
> +Guidelines for Working with D-cache:
> +
> +Memory to Peripheral DMA:
> +- Flush the buffer after the MPU writes the data and before the DMA is
> + initiated.
> +
> +Peripheral to Memory DMA:
> +- Invalidate the buffer after the DMA is complete and before the MPU reads
> + it.
The other discussion we are having about caches made me realize that I
need to improve the above guideline like this:
Peripheral to Memory DMA:
- Invalidate the buffer before starting the DMA(This is for preventing
cache-line replacements from corrupting the DMA buffer during the
course of DMA).
- Invalidate the buffer after the DMA is complete and before the MPU
reads it.
I shall submit an updated patch for this.
best regards,
Aneesh
next prev parent reply other threads:[~2011-08-05 15:07 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 11:18 [U-Boot] [PATCH v 0/3] arm: changes in cache handling Aneesh V
2011-08-01 11:18 ` [U-Boot] [PATCH v 1/3] arm: do not force d-cache enable on all boards Aneesh V
2011-08-01 16:33 ` Jason Liu
2011-08-01 16:46 ` Jason Liu
2011-08-01 19:45 ` Wolfgang Denk
2011-08-01 19:53 ` Albert ARIBAUD
2011-08-02 14:35 ` Jason Liu
2011-08-02 15:58 ` Albert ARIBAUD
2011-08-05 15:07 ` Aneesh V [this message]
2011-08-07 6:20 ` Albert ARIBAUD
2011-08-09 11:10 ` [U-Boot] [PATCH 0/4] arm: changes in cache handling Aneesh V
2011-08-09 11:25 ` Aneesh V
2011-08-09 11:10 ` [U-Boot] [PATCH 1/4] arm: do not force d-cache enable on all boards Aneesh V
2011-08-09 11:10 ` [U-Boot] [PATCH 2/4] omap: enable caches at system start-up Aneesh V
2011-08-09 11:10 ` [U-Boot] [PATCH 3/4] armv7: stronger barrier for cache-maintenance operations Aneesh V
2011-08-09 11:10 ` [U-Boot] [PATCH 4/4] armv7: cache: remove flush on un-aligned invalidate Aneesh V
2011-08-09 16:39 ` Anton Staaf
2011-08-10 6:29 ` Albert ARIBAUD
2011-08-10 6:48 ` Aneesh V
2011-08-10 18:11 ` Anton Staaf
2011-08-11 6:29 ` Aneesh V
2011-08-09 11:34 ` [U-Boot] [PATCH v2 0/4] arm: changes in cache handling Aneesh V
2011-08-09 11:34 ` [U-Boot] [PATCH v2 1/4] arm: do not force d-cache enable on all boards Aneesh V
2011-08-09 14:41 ` [U-Boot] d-cache enable Lukasz Majewski
2011-08-12 10:59 ` Aneesh V
2011-08-12 11:41 ` Lukasz Majewski
2011-08-12 12:16 ` Aneesh V
2011-08-12 12:21 ` Albert ARIBAUD
2011-08-12 12:32 ` Reinhard Meyer
2011-08-12 12:36 ` Albert ARIBAUD
2011-08-12 13:08 ` Lukasz Majewski
2011-08-12 13:19 ` Albert ARIBAUD
2011-08-09 11:34 ` [U-Boot] [PATCH v2 2/4] omap: enable caches at system start-up Aneesh V
2011-08-09 11:34 ` [U-Boot] [PATCH v2 3/4] armv7: stronger barrier for cache-maintenance operations Aneesh V
2011-08-09 11:34 ` [U-Boot] [PATCH v2 4/4] armv7: cache: remove flush on un-aligned invalidate Aneesh V
2011-08-11 14:35 ` [U-Boot] [PATCH v3 0/4] arm: changes in cache handling Aneesh V
2011-08-13 10:09 ` Albert ARIBAUD
2011-08-15 7:40 ` V, Aneesh
2011-08-11 14:35 ` [U-Boot] [PATCH v3 1/4] arm: do not force d-cache enable on all boards Aneesh V
2011-08-14 11:09 ` Simon Guinot
2011-08-15 7:34 ` V, Aneesh
2011-08-16 14:33 ` [U-Boot] [PATCH v4 " Aneesh V
2011-08-11 14:35 ` [U-Boot] [PATCH v3 2/4] omap: enable caches at system start-up Aneesh V
2011-08-11 14:35 ` [U-Boot] [PATCH v3 3/4] armv7: stronger barrier for cache-maintenance operations Aneesh V
2011-08-11 14:35 ` [U-Boot] [PATCH v3 4/4] armv7: cache: remove flush on un-aligned invalidate Aneesh V
2011-08-01 11:18 ` [U-Boot] [PATCH v 2/3] omap: enable caches at system start-up Aneesh V
2011-08-01 11:18 ` [U-Boot] [PATCH v 3/3] armv7: stronger barrier for cache-maintenance operations Aneesh V
2011-08-05 10:29 ` [U-Boot] [PATCH v 0/3] arm: changes in cache handling Aneesh V
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=4E3C071B.8060202@ti.com \
--to=aneesh@ti.com \
--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