1565
1566 if (!chip_good(map, adr, map_word_ff(map))) {
1567
1568 map_write( map, CMD(0xF0), chip->start );
1569
1570
1571 ret = -EIO;
1572 }
1573
1574 chip->state = FL_READY;
1575 xip_enable(map, chip, adr);
1576 put_chip(map, chip, adr);
1577 spin_unlock(chip->mutex);
1578
1579 return ret;
1580}
1581
1582
1583static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, unsigned long adr, int len, void *thunk)
1584{
1585 struct cfi_private *cfi = map->fldrv_priv;
1586 unsigned long timeo = jiffies + HZ;
1587 DECLARE_WAITQUEUE(wait, current);
1588 int ret = 0;
1589
1590 adr += chip->start;
1591
1592 spin_lock(chip->mutex);
1593 ret = get_chip(map, chip, adr, FL_ERASING);
1594 if (ret) {
1595 spin_unlock(chip->mutex);
1596 return ret;
1597 }
1598
1599 DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): ERASE 0x%.8lx\n",
1600 __func__, adr );
1601
1602 XIP_INVAL_CACHED_RANGE(map, adr, len);
1603 ENABLE_VPP(map);
1604 xip_disable(map, chip, adr);
1605