From 9df731a176aab8e03b984b681b1bea01ccff6644 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 06 Nov 2023 07:23:06 +0000 Subject: [PATCH] rk3568 rt uboot init --- 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