forked from Imagelibrary/rtems
bsps/aarch64/zynqmp/nand: Erase using offset
Prefer use of XNandPsu_Erase instead of XNandPsu_EraseBlock since the XNandPsu driver does not expose the primitives necessary to ensure device readiness after the operation is complete.
This commit is contained in:
committed by
Joel Sherrill
parent
f6b1840f70
commit
3339afb82e
@@ -105,21 +105,15 @@ static int flash_erase(
|
||||
{
|
||||
XNandPsu *nandpsu = get_flash_control(super)->nandpsu;
|
||||
rtems_status_code sc;
|
||||
uint32_t BlockSize = nandpsu->Geometry.BlockSize;
|
||||
uint32_t DeviceSize = nandpsu->Geometry.DeviceSize;
|
||||
uint32_t BlockIndex;
|
||||
uint32_t DeviceIndex;
|
||||
uint64_t BlockSize = nandpsu->Geometry.BlockSize;
|
||||
|
||||
if (offset > nandpsu->Geometry.DeviceSize) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
DeviceIndex = offset / DeviceSize;
|
||||
BlockIndex = (offset % DeviceSize) / BlockSize;
|
||||
|
||||
/* Perform erase operation. */
|
||||
rtems_mutex_lock(&(get_flash_control(super)->access_lock));
|
||||
sc = XNandPsu_EraseBlock(nandpsu, DeviceIndex, BlockIndex);
|
||||
sc = XNandPsu_Erase(nandpsu, RTEMS_ALIGN_DOWN(offset, BlockSize), BlockSize);
|
||||
rtems_mutex_unlock(&(get_flash_control(super)->access_lock));
|
||||
if (sc ) {
|
||||
return -EIO;
|
||||
|
||||
Reference in New Issue
Block a user