AP_FlashIface: make sure XIP flash is ready before returning

This commit is contained in:
Andy Piper 2022-03-31 21:34:33 +01:00 committed by Andrew Tridgell
parent 64743b73ca
commit 2d62da9298
1 changed files with 10 additions and 2 deletions

View File

@ -921,6 +921,9 @@ bool AP_FlashIface_JEDEC::start_xip_mode(void** addr)
Debug("XIP mode unsupported on this chip");
return false;
}
bool success = false;
switch(_desc.entry_method) {
case AP_FlashIface_JEDEC::XIP_ENTRY_METHOD_1:
{
@ -937,7 +940,8 @@ bool AP_FlashIface_JEDEC::start_xip_mode(void** addr)
cmd.addr = 0;
cmd.dummy = _desc.fast_read_dummy_cycles;
_dev->set_cmd_header(cmd);
return _dev->enter_xip_mode(addr);
success = _dev->enter_xip_mode(addr);
break;
}
case AP_FlashIface_JEDEC::XIP_ENTRY_METHOD_2:
{
@ -965,7 +969,8 @@ bool AP_FlashIface_JEDEC::start_xip_mode(void** addr)
// correct dummy bytes because of addition of alt bytes
cmd.dummy = _desc.fast_read_dummy_cycles - 1;
_dev->set_cmd_header(cmd);
return _dev->enter_xip_mode(addr);
success = _dev->enter_xip_mode(addr);
break;
}
default:
{
@ -973,6 +978,9 @@ bool AP_FlashIface_JEDEC::start_xip_mode(void** addr)
return false;
}
}
// make sure that the flash is ready once we enter XIP
DELAY_MICROS(100);
return success;
}
bool AP_FlashIface_JEDEC::stop_xip_mode()