[U-Boot] [PATCH 3/5] api: Flush cache when closing api

Emmanuel Vadot manu at freebsd.org
Mon Apr 30 08:34:31 UTC 2018


Signed-off-by: Emmanuel Vadot <manu at freebsd.org>
---
 api/api.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/api/api.c b/api/api.c
index 7eee2fc083..7d1608b520 100644
--- a/api/api.c
+++ b/api/api.c
@@ -290,6 +290,17 @@ static int API_dev_close(va_list ap)
 	if (!err)
 		di->state = DEV_STA_CLOSED;
 
+#if defined(CONFIG_SYS_HAVE_DCACHE_MAINTENANCE) && \
+	!defined(CONFIG_SYS_DCACHE_OFF)
+	if (dcache_status())
+		flush_dcache_all();
+#endif
+#if defined(CONFIG_SYS_HAVE_ICACHE_MAINTENANCE) && \
+	!defined(CONFIG_SYS_ICACHE_OFF)
+	if (icache_status())
+		invalidate_icache_all();
+#endif
+
 	return err;
 }
 
-- 
2.16.3



More information about the U-Boot mailing list