From 23fa18eaa71266feff7ba8d83022d9e1cc83c65a Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 10 May 2024 07:42:03 +0000
Subject: [PATCH] disable pwm7

---
 u-boot/cmd/cache.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/u-boot/cmd/cache.c b/u-boot/cmd/cache.c
index 37ab345..004dcc2 100644
--- a/u-boot/cmd/cache.c
+++ b/u-boot/cmd/cache.c
@@ -54,7 +54,24 @@
 
 static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
+	ulong start, size;
+
 	switch (argc) {
+	case 4:
+		start = simple_strtoul(argv[2], NULL, 16);
+		size = simple_strtoul(argv[3], NULL, 16);
+
+		switch (parse_argv(argv[1])) {
+		case 2:
+			printf("flush dcache: 0x%08lx - 0x%08lx\n", start, start + size);
+			flush_dcache_range(start, start + size);
+			break;
+		case 3:
+			printf("invalidate dcache: 0x%08lx - 0x%08lx\n", start, start + size);
+			invalidate_dcache_range(start, start + size);
+			break;
+		}
+		break;
 	case 2:			/* on / off */
 		switch (parse_argv(argv[1])) {
 		case 0:
@@ -65,6 +82,9 @@
 			break;
 		case 2:
 			flush_dcache_all();
+			break;
+		case 3:
+			printf("error: dcache invalidate require [start] [size]\n");
 			break;
 		}
 		break;
@@ -80,7 +100,9 @@
 
 static int parse_argv(const char *s)
 {
-	if (strcmp(s, "flush") == 0)
+	if (strcmp(s, "invalidate") == 0)
+		return 3;
+	else if (strcmp(s, "flush") == 0)
 		return 2;
 	else if (strcmp(s, "on") == 0)
 		return 1;
@@ -99,8 +121,8 @@
 );
 
 U_BOOT_CMD(
-	dcache,   2,   1,     do_dcache,
+	dcache,   4,   1,     do_dcache,
 	"enable or disable data cache",
-	"[on, off, flush]\n"
+	"[on, off, flush, invalidate] [start] [size]\n"
 	"    - enable, disable, or flush data (writethrough) cache"
 );

--
Gitblit v1.6.2