components/bootloader: fix enabling cache for APP CPU

This is a workaround for a hardware bug with cache initialization.
Only two lines of code related to DPORT_APP_CACHE_MMU_IA_CLR were added around mmu_init(1); call,
and two lines at the end of comment block.
I reformatted surrounding lines to use spaces for indentation, like the rest of the code in this file does.
This commit is contained in:
Ivan Grokhotkov 2016-08-24 16:25:04 +08:00
parent be112daa71
commit 4d1084120c

View file

@ -92,23 +92,28 @@ void IRAM_ATTR call_start_cpu0()
//Clear bss //Clear bss
memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start)); memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start));
/* completely reset MMU for both CPUs /* completely reset MMU for both CPUs
(in case serial bootloader was running) */ (in case serial bootloader was running) */
Cache_Read_Disable(0); Cache_Read_Disable(0);
Cache_Read_Disable(1); Cache_Read_Disable(1);
Cache_Flush(0); Cache_Flush(0);
Cache_Flush(1); Cache_Flush(1);
mmu_init(0); mmu_init(0);
mmu_init(1); REG_SET_BIT(APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MMU_IA_CLR);
/* (above steps probably unnecessary for most serial bootloader mmu_init(1);
usage, all that's absolutely needed is that we unmask DROM0 REG_CLR_BIT(APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MMU_IA_CLR);
cache on the following two lines - normal ROM boot exits with /* (above steps probably unnecessary for most serial bootloader
DROM0 cache unmasked, but serial bootloader exits with it usage, all that's absolutely needed is that we unmask DROM0
masked. However can't hurt to be thorough and reset cache on the following two lines - normal ROM boot exits with
everything.) DROM0 cache unmasked, but serial bootloader exits with it
*/ masked. However can't hurt to be thorough and reset
REG_CLR_BIT(PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MASK_DROM0); everything.)
REG_CLR_BIT(APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MASK_DROM0);
The lines which manipulate DPORT_APP_CACHE_MMU_IA_CLR bit are
necessary to work around a hardware bug.
*/
REG_CLR_BIT(PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MASK_DROM0);
REG_CLR_BIT(APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MASK_DROM0);
bootloader_main(); bootloader_main();
} }