this function is  only  being called for a whole chip erase  so i am pretty sure this is overkill  and it is not even what is expected  you should be trying to send the whole chip erase opcode  not erasing individual sectors  among the overkill  you do not need to be passing an  erase info  struct  you re actually abusing the struct  as it should be set up only by the upper layers  never by a hw driver like this 