Skip to content

Commit c8d9103

Browse files
VynDragonkartben
authored andcommitted
soc: bflb: Enable bflb,l1c cache management for BL60x and BL70x
Enables controlling the cache of BL60x and BL70x Signed-off-by: Camille BAUD <[email protected]>
1 parent e6ad1da commit c8d9103

File tree

8 files changed

+22
-0
lines changed

8 files changed

+22
-0
lines changed

soc/bflb/bl60x/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ zephyr_code_relocate_ifdef(CONFIG_PINCTRL_BFLB LIBRARY drivers__pinctrl LOCATION
1414
zephyr_code_relocate_ifdef(CONFIG_SYSCON_BFLB_EFUSE LIBRARY drivers__syscon LOCATION ITCM NOKEEP)
1515
zephyr_code_relocate_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL60X
1616
LIBRARY drivers__clock_control LOCATION ITCM NOKEEP)
17+
zephyr_code_relocate_ifdef(CONFIG_CACHE_BFLB_L1C LIBRARY drivers__cache LOCATION ITCM NOKEEP)

soc/bflb/bl60x/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55

66
config SOC_SERIES_BL60X
77
select ATOMIC_OPERATIONS_C
8+
select CACHE_MANAGEMENT
89
select CLOCK_CONTROL
910
select CODE_DATA_RELOCATION
1011
select CPU_HAS_FPU
12+
select CPU_HAS_ICACHE
13+
select CPU_HAS_DCACHE
1114
select FLOAT_HARD
1215
select FPU
1316
select GEN_IRQ_VECTOR_TABLE

soc/bflb/bl60x/Kconfig.defconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ config ARCH_SW_ISR_TABLE_ALIGN
1818
config RISCV_MCAUSE_EXCEPTION_MASK
1919
default 0x3FF
2020

21+
choice CACHE_TYPE
22+
default EXTERNAL_CACHE
23+
endchoice
24+
2125
endif # SOC_SERIES_BL60X

soc/bflb/bl60x/soc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <zephyr/device.h>
1515
#include <zephyr/init.h>
1616
#include <zephyr/irq.h>
17+
#include <zephyr/cache.h>
1718

1819
#include <clic.h>
1920
#include <bflb_soc.h>
@@ -94,4 +95,6 @@ GLB_JTAG_SWAP_SET_POS);
9495

9596
/* init bor for all platform */
9697
system_bor_init();
98+
99+
sys_cache_data_flush_and_invd_all();
97100
}

soc/bflb/bl70x/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ zephyr_code_relocate_ifdef(CONFIG_PINCTRL_BFLB LIBRARY drivers__pinctrl LOCATION
1313
zephyr_code_relocate_ifdef(CONFIG_SYSCON_BFLB_EFUSE LIBRARY drivers__syscon LOCATION ITCM NOKEEP)
1414
zephyr_code_relocate_ifdef(CONFIG_CLOCK_CONTROL_BOUFFALOLAB_BL70X
1515
LIBRARY drivers__clock_control LOCATION ITCM NOKEEP)
16+
zephyr_code_relocate_ifdef(CONFIG_CACHE_BFLB_L1C LIBRARY drivers__cache LOCATION ITCM NOKEEP)

soc/bflb/bl70x/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
config SOC_SERIES_BL70X
66
select ATOMIC_OPERATIONS_C
7+
select CACHE_MANAGEMENT
78
select CLOCK_CONTROL
89
select CODE_DATA_RELOCATION
910
select CPU_HAS_FPU
11+
select CPU_HAS_ICACHE
12+
select CPU_HAS_DCACHE
1013
select FLOAT_HARD
1114
select FPU
1215
select GEN_IRQ_VECTOR_TABLE

soc/bflb/bl70x/Kconfig.defconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ config ARCH_SW_ISR_TABLE_ALIGN
1818
config RISCV_MCAUSE_EXCEPTION_MASK
1919
default 0x3FF
2020

21+
choice CACHE_TYPE
22+
default EXTERNAL_CACHE
23+
endchoice
24+
2125
endif # SOC_SERIES_BL70X

soc/bflb/bl70x/soc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <zephyr/device.h>
1414
#include <zephyr/init.h>
1515
#include <zephyr/irq.h>
16+
#include <zephyr/cache.h>
1617

1718
#include <clic.h>
1819
#include <bflb_soc.h>
@@ -78,4 +79,6 @@ void soc_early_init_hook(void)
7879

7980
/* init bor for all platform */
8081
system_bor_init();
82+
83+
sys_cache_data_flush_and_invd_all();
8184
}

0 commit comments

Comments
 (0)