diff options
author | Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> | 2023-09-20 08:24:50 +0530 |
---|---|---|
committer | Michal Simek <michal.simek@amd.com> | 2023-09-21 13:20:12 +0200 |
commit | 1290262292473bd89b6beacf2e4e43b27c3c3617 (patch) | |
tree | 8d5d1c8be0397e1304765e4b9d0a7694c4fbef62 /cmd | |
parent | b764e84f9fb57954f601bc33514167d9ddad626f (diff) | |
download | u-boot-1290262292473bd89b6beacf2e4e43b27c3c3617.zip u-boot-1290262292473bd89b6beacf2e4e43b27c3c3617.tar.gz u-boot-1290262292473bd89b6beacf2e4e43b27c3c3617.tar.bz2 |
cmd: sf: Fix the flash_is_unlocked api size parameter
When flash erase is called with size parameter, code is checking
if sectors are locked or not. But for checking, the whole device
length minus offset is used instead of actual size which should
be erased. That's why when only some sectors are locked it is
not possible to erase unlocked sectors.
The length is calculated as "length = max_chipsize - offset",
flash_is_unlocked() api is getting updated with length which is
incorrect. Fix this flash_is_unlocked() api by passing the size
parameter.
ZynqMP> sf erase 0 100000
len=0x8000000 which is flash size
size=0x100000
We need to update the size in the flash_is_unlocked() api and not
the length.
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230920025450.6281-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/sf.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -366,7 +366,7 @@ static int do_spi_flash_erase(int argc, char *const argv[]) } if (flash->flash_is_unlocked && - !flash->flash_is_unlocked(flash, offset, len)) { + !flash->flash_is_unlocked(flash, offset, size)) { printf("ERROR: flash area is locked\n"); return CMD_RET_FAILURE; } |