summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2022-07-18 15:37:38 -0400
committerTom Rini <[email protected]>2022-07-18 15:37:38 -0400
commit905e779b9e0bd29255ebc6244f017690fdc10fc4 (patch)
treef89cf036d16b31ded49d9e541d12636ab57c7801 /cmd
parent26f6f7fb5c0651d65afdee6d8ed36063606179a8 (diff)
parent47ed8b22fd561b65e8541919becc76ab3d86f7a3 (diff)
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-spi
- add Macronix Octal flash (JaimeLiao)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/sf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/sf.c b/cmd/sf.c
index 8713736b2a3..cd50b38081c 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -294,6 +294,12 @@ static int do_spi_flash_read_write(int argc, char *const argv[])
return 1;
}
+ if (strncmp(argv[0], "read", 4) != 0 && flash->flash_is_unlocked &&
+ !flash->flash_is_unlocked(flash, offset, len)) {
+ printf("ERROR: flash area is locked\n");
+ return 1;
+ }
+
buf = map_physmem(addr, len, MAP_WRBACK);
if (!buf && addr) {
puts("Failed to map physical memory\n");
@@ -350,6 +356,12 @@ static int do_spi_flash_erase(int argc, char *const argv[])
return 1;
}
+ if (flash->flash_is_unlocked &&
+ !flash->flash_is_unlocked(flash, offset, len)) {
+ printf("ERROR: flash area is locked\n");
+ return 1;
+ }
+
ret = spi_flash_erase(flash, offset, size);
printf("SF: %zu bytes @ %#x Erased: ", (size_t)size, (u32)offset);
if (ret)