Skip to content

Commit 74c9186

Browse files
khoa-nguyen-18KhiemNguyenT
authored andcommitted
hal: renesas: ra: Disable Cache Lookup While Changing Voltage Scaling
Disable Cache Lookup While Changing Voltage Scaling for bsp_clocks.c Signed-off-by: Khoa Nguyen <[email protected]>
1 parent 9b7ad51 commit 74c9186

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

drivers/ra/README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,7 @@ Patch List:
175175
* Define `BSP_PARTITION_FLASH_CPU1_S_START` in bsp_cfg.h
176176
Impacted files:
177177
zephyr/ra/ra_cfg/fsp_cfg/bsp/ra8p1/bsp_cfg.h
178+
179+
* Disable Cache Lookup While Changing Voltage Scaling
180+
Impacted files:
181+
drivers/ra/fsp/src/bsp/mcu/all/bsp_clocks.c

drivers/ra/fsp/src/bsp/mcu/all/bsp_clocks.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,12 +2482,27 @@ void bsp_clock_init (void)
24822482
bsp_prv_software_delay_loop(BSP_DELAY_LOOPS_CALCULATE(BSP_PRV_MAX_HOCO_CYCLES_PER_US));
24832483
#endif
24842484

2485-
#if BSP_MCU_GROUP_RA8_GEN2
2485+
#if BSP_MCU_GROUP_RA8_GEN2 && (BSP_CFG_CPU_CORE == 0)
2486+
2487+
/* Do not access the CM85 ITCM, DTCM, I-Cache, or D-Cache during voltage scaling change. */
2488+
/* Disable CM85 I-Cache allocations and invalidate for later coherence. */
2489+
SCB_DisableICache();
2490+
2491+
/* Disable CM85 I-Cache and D-Cache lookups and allocations. D-Cache should already be clean and allocations disabled, so no cache maintenance required. */
2492+
MEMSYSCTL->MSCR &= ~(MEMSYSCTL_MSCR_ICACTIVE_Msk | MEMSYSCTL_MSCR_DCACTIVE_Msk);
2493+
__DSB();
2494+
__ISB();
24862495

24872496
/* Always set not high VSCR_1 (non-default), change before enabling PLL.
2488-
* - Note this will consume more power than necessary for certain configuraitons. See User Manual for more infomration. */
2497+
* - Note this will consume more power than necessary for certain configurations. See User Manual for more information. */
24892498
R_SYSTEM->VSCR_b.VSCM = 0x1U;
24902499
FSP_HARDWARE_REGISTER_WAIT(R_SYSTEM->VSCR_b.VSCMTSF, 0U);
2500+
2501+
/* Re-enable CM85 I-Cache and D-Cache lookups and allow allocations per CCR.xC (TZ banked) bits . */
2502+
MEMSYSCTL->MSCR |= (MEMSYSCTL_MSCR_ICACTIVE_Msk | MEMSYSCTL_MSCR_DCACTIVE_Msk);
2503+
__DSB();
2504+
__ISB();
2505+
SCB_EnableICache();
24912506
#endif
24922507

24932508
R_SYSTEM->PLLCR = 0U;

0 commit comments

Comments
 (0)