microblaze: cache: improve icache Kconfig options
authorOvidiu Panait <ovpanait@gmail.com>
Tue, 31 May 2022 18:14:27 +0000 (21:14 +0300)
committerMichal Simek <michal.simek@amd.com>
Fri, 24 Jun 2022 12:16:00 +0000 (14:16 +0200)
Replace CONFIG_ICACHE with a Kconfig option more limited in scope -
XILINX_MICROBLAZE0_USE_WIC. It should be enabled if the processor supports
the "wic" (Write to Instruction Cache) instruction. It will be used to
guard "wic" invocations in microblaze cache code.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Link: https://lore.kernel.org/r/20220531181435.3473549-6-ovpanait@gmail.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
arch/microblaze/Kconfig
arch/microblaze/cpu/cache.c
board/xilinx/microblaze-generic/Kconfig

index 11ccbcc9f205290fb647cf20c3ed50e6af97655a..ce157a79ccc17c88dcff163b7ddb70ad7d8ae8db 100644 (file)
@@ -39,10 +39,6 @@ config TARGET_MICROBLAZE_GENERIC
 
 endchoice
 
-config ICACHE
-       bool "Enable icache support"
-       default y
-
 source "board/xilinx/Kconfig"
 source "board/xilinx/microblaze-generic/Kconfig"
 
index 4e8e228a22ceb35a0f9f332f88838c1b8198f5ae..b6bbc215b37b0c3daef8dc90d57ceda804e8a804 100644 (file)
@@ -58,14 +58,14 @@ void flush_cache(ulong addr, ulong size)
 {
        int i;
        for (i = 0; i < size; i += 4) {
-               asm volatile (
-#ifdef CONFIG_ICACHE
+               if (CONFIG_IS_ENABLED(XILINX_MICROBLAZE0_USE_WIC)) {
+                       asm volatile (
                                "wic    %0, r0;"
-#endif
                                "nop;"
                                :
                                : "r" (addr + i)
                                : "memory");
+               }
 
                if (CONFIG_IS_ENABLED(XILINX_MICROBLAZE0_USE_WDC)) {
                        asm volatile (
index b00ce6f59a48b8b73f2b6bee507bce659e190746..98b4814b95a648138bf77e8b555e43162e1dda2f 100644 (file)
@@ -74,4 +74,15 @@ config SPL_XILINX_MICROBLAZE0_USE_WDC
        bool
        default XILINX_MICROBLAZE0_USE_WDC
 
+config XILINX_MICROBLAZE0_USE_WIC
+       bool "MicroBlaze wic instruction support"
+       default y
+       help
+         Enable this option if the MicroBlaze processor is configured with
+         support for the "wic" (Write to Instruction Cache) instruction.
+
+config SPL_XILINX_MICROBLAZE0_USE_WIC
+       bool
+       default XILINX_MICROBLAZE0_USE_WIC
+
 endif