/* Note: it takes about as long to flash all sectors together with Chip Erase as it does to flash them one at a time (about 30 seconds for 2 MB). Also since we want to be able to treat subsets of sectors as if they were complete devices, we don't use Chip Erase.  */
STATUS flashErase(flash_dev_t *dev)
/* Note: it takes about as long to flash all sectors together with Chip Erase as it does to flash them one at a time (about 30 seconds for 2 MB). Also since we want to be able to treat subsets of sectors as if they were complete devices, we don't use Chip Erase.  */
STATUS flashErase(flash_dev_t *dev)
{
	int sector;
	PRINTF ("flashErase: dev=%d sectors=%d\n", DEV_NO (dev), dev->sectors);
	if (flashCheck (dev) == ERROR)
		return ERROR;
	for (sector = 0; sector < dev->sectors; sector++) {
		if (flashEraseSector (dev, sector) == ERROR)
			return ERROR;
	}
	return OK;
}