Skip to content
Commit 12902622 authored by Venkatesh Yadav Abbarapu's avatar Venkatesh Yadav Abbarapu Committed by Michal Simek
Browse files

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: default avatarVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230920025450.6281-1-venkatesh.abbarapu@amd.com


Signed-off-by: default avatarMichal Simek <michal.simek@amd.com>
parent b764e84f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment