arm: stm32h7: Enable DCache when CONFIG_DCACHE is defined

Up till now the usage of CONFIG_NOCACHE_MEMORY also explicitly disables
data cache on the STM32H7 SoC.

With this change the usage of CONFIG_NOCACHE_MEMORY has been decoupled
from data cache enabling as new Kconfig option - namely
CONFIG_DCACHE is now used to explicitly enable it.

After this change it would be possible to use data cache on STM32H7
with DMA buffers, fragile to cache coherency issues, defined with
'__nocache' attribute.

Such approach would improve the overall STM32H7 performance until the
moment when proper (i.e. in-DMA) buffer cache management is developed.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Lukasz Majewski 2022-04-08 12:39:29 +02:00 committed by Marti Bolivar
commit 0f9c8c2935

View file

@ -62,12 +62,12 @@ static int stm32h7_init(const struct device *arg)
SCB_EnableICache();
#ifndef CONFIG_NOCACHE_MEMORY
if (!(SCB->CCR & SCB_CCR_DC_Msk)) {
SCB_EnableDCache();
if (IS_ENABLED(CONFIG_DCACHE)) {
if (!(SCB->CCR & SCB_CCR_DC_Msk)) {
SCB_EnableDCache();
}
}
#endif /* CONFIG_NOCACHE_MEMORY */
/* Install default handler that simply resets the CPU
* if configured in the kernel, NOP otherwise
*/