/* Erase all chip of Serial Flash device. 
The CE instruction is for erasing the data of the whole chip to be "1". */
enum status_code mx25l_erase_chip(void)
/* Erase all chip of Serial Flash device. 
The CE instruction is for erasing the data of the whole chip to be "1". */
enum status_code mx25l_erase_chip(void)
{
	enum status_code status;
	uint8_t tx_buf[1] = {MX25L_CMD_CE};
	if (_mx25l_is_flash_busy()) {
		return STATUS_BUSY;
	}
	_mx25l_send_cmd_write_latch(MX25L_CMD_WREN);
	_mx25l_chip_select();
	status = spi_write_buffer_wait(&_mx25l_spi, tx_buf, 1);
	if (status != STATUS_OK) {
		return STATUS_ERR_IO;
	}
	_mx25l_chip_deselect();
	if (!_mx25l_wait_flash_ready(MX25L_WAIT_TIMEOUT)) {
		return STATUS_ERR_IO;
	}
	return STATUS_OK;
}