Commit 1bc008da authored by Chun-Chieh Li's avatar Chun-Chieh Li Committed by Fabio Baltieri
Browse files

drivers: misc: ethos_u: support default dcache flush/invalidate



This provides default ethosu_flush_dcache and ethosu_invalidate_dcache
overrides. User application can disable it through Kconfig option if it
needs to provide its own.

Signed-off-by: default avatarChun-Chieh Li <ccli8@nuvoton.com>
parent f6bee983
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -18,3 +18,8 @@ config ETHOS_U_NUMAKER
	  Enables Nuvoton NuMaker frontend of Arm Ethos-U NPU driver

endchoice

config ETHOS_U_DCACHE
	bool "Override Ethos-U driver DCache functions"
	depends on ETHOS_U
	default y if CACHE_MANAGEMENT
+17 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <zephyr/devicetree.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include <zephyr/cache.h>

#include <ethosu_driver.h>

@@ -100,3 +101,19 @@ int ethosu_semaphore_give(void *sem)
	k_sem_give((struct k_sem *)sem);
	return 0;
}

#if defined(CONFIG_ETHOS_U_DCACHE)
void ethosu_flush_dcache(uint32_t *p, size_t bytes)
{
	if (p && bytes) {
		sys_cache_data_flush_range((void *)p, bytes);
	}
}

void ethosu_invalidate_dcache(uint32_t *p, size_t bytes)
{
	if (p && bytes) {
		sys_cache_data_invd_range((void *)p, bytes);
	}
}
#endif