Skip to content

Files

doc

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 30, 2020
Sep 4, 2021
Nov 12, 2021
Jun 23, 2022
May 28, 2022
Jun 17, 2022
May 28, 2022
Jul 15, 2021
Jul 8, 2022
Jun 23, 2022
Jun 6, 2022
Jun 20, 2019
Sep 30, 2021
Jun 20, 2019
Mar 25, 2022
Jul 29, 2021
Jul 13, 2022
Jul 24, 2019
Oct 18, 2008
Aug 1, 2021
Mar 4, 2015
May 22, 2017
Oct 7, 2016
Jun 12, 2017
Dec 3, 2005
Jul 17, 2020
Mar 27, 2012
Dec 3, 2019
Apr 15, 2004
Oct 22, 2012
Jan 14, 2015
Jul 17, 2020
Feb 1, 2017
Dec 6, 2019
Jul 17, 2020
Jan 21, 2019
Aug 2, 2019
Jul 10, 2018
Jul 29, 2020
Oct 27, 2009
Mar 23, 2022
Sep 21, 2016
May 7, 2018
Jan 2, 2017
Feb 23, 2004
Sep 30, 2021
Jul 17, 2020
Jul 13, 2020
Nov 3, 2011
Sep 30, 2021
Mar 11, 2013
Jul 23, 2009
Dec 9, 2019
May 7, 2018
Jan 22, 2018
Sep 30, 2021
Mar 18, 2022
Mar 21, 2016
Oct 29, 2015
Jul 27, 2020
Jul 11, 2011
Nov 30, 2015
Apr 28, 2013
Apr 28, 2013
Jul 17, 2020
Jul 7, 2022
Apr 17, 2020
May 4, 2021
Sep 20, 2013
Aug 6, 2015
May 7, 2018
Aug 26, 2016
Nov 7, 2014
Apr 18, 2015
Feb 6, 2016
Dec 7, 2020
Nov 29, 2018
Mar 11, 2013
Aug 10, 2007
Oct 7, 2016
Apr 26, 2022
Mar 28, 2022
Feb 6, 2016
Feb 6, 2016
Jul 17, 2020
Jun 3, 2013
Oct 6, 2021
Sep 30, 2021
Feb 12, 2012
Jul 9, 2020
Oct 16, 2013
Sep 30, 2021
Apr 18, 2014
Feb 11, 2022
Dec 2, 2016
Apr 9, 2019
Dec 24, 2021
Aug 8, 2018
Jul 29, 2020
Apr 3, 2010
Feb 6, 2016
Apr 5, 2003
Sep 19, 2019
Jun 16, 2017
Aug 1, 2016
Aug 23, 2020
Oct 9, 2020
May 20, 2019
Jun 20, 2013
Apr 25, 2022
Jan 28, 2016
Oct 7, 2018
Apr 26, 2019
Oct 16, 2019
Jul 22, 2016
Sep 11, 2011
Sep 30, 2020
Oct 27, 2014
Jul 24, 2018
Jul 16, 2020
Nov 15, 2021
Jun 3, 2013
Dec 28, 2018
Apr 25, 2022
Oct 14, 2013
Sep 12, 2017
Aug 14, 2021
Jul 13, 2022
May 8, 2020
Jun 16, 2022
Aug 17, 2021
Apr 23, 2022
Apr 15, 2022
Jul 13, 2022
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_DCACHE_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 before starting the DMA. In case there are any dirty
  lines from the DMA buffer in the cache, subsequent cache-line replacements
  may corrupt the buffer in memory while the DMA is still going on. Cache-line
  replacement can happen if the CPU tries to bring some other memory locations
  into the cache while the DMA is going on.
- Invalidate the buffer after the DMA is complete and before the MPU reads
  it. This may be needed in addition to the invalidation before the DMA
  mentioned above, because in some processors memory contents can spontaneously
  come to the cache due to speculative memory access by the CPU. If this
  happens with the DMA buffer while DMA is going on we have a coherency problem.

Buffer Requirements:
- Any buffer that is invalidated(that is, typically the peripheral to
  memory DMA buffer) should be aligned to cache-line boundary both at
  at the beginning and at the end of the buffer.
- If the buffer is not cache-line aligned invalidation will be restricted
  to the aligned part. That is, one cache-line at the respective boundary
  may be left out while doing invalidation.
- A suitable buffer can be alloced on the stack using the
  ALLOC_CACHE_ALIGN_BUFFER macro.

Cleanup Before Linux:
- cleanup_before_linux() should flush the D-cache, invalidate I-cache, and
  disable MMU and caches.
- The following sequence is advisable while disabling d-cache:
  1. dcache_disable() - flushes and disables d-cache
  2. invalidate_dcache_all() - invalid any entry that came to the cache
	in the short period after the cache was flushed but before the
	cache got disabled.