-static int do_atmel_lock(struct map_info *map, struct flchip *chip,
- unsigned long adr, int len, void *thunk)
-{
- struct cfi_private *cfi = map->fldrv_priv;
- int ret;
-
- spin_lock(chip->mutex);
- ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
- if (ret)
- goto out_unlock;
- chip->state = FL_LOCKING;
-
- DEBUG(MTD_DEBUG_LEVEL3, "MTD %s(): LOCK 0x%08lx len %d\n",
- __func__, adr, len);
-
- cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi,
- cfi->device_type, NULL);
- cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi,
- cfi->device_type, NULL);
- cfi_send_gen_cmd(0x80, cfi->addr_unlock1, chip->start, map, cfi,
- cfi->device_type, NULL);
- cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi,
- cfi->device_type, NULL);
- cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi,
- cfi->device_type, NULL);
- map_write(map, CMD(0x40), chip->start + adr);
-
- chip->state = FL_READY;
- put_chip(map, chip, adr + chip->start);
- ret = 0;
-
-out_unlock:
- spin_unlock(chip->mutex);
- return ret;
-}
-
-static int do_atmel_unlock(struct map_info *map, struct flchip *chip,
- unsigned long adr, int len, void *thunk)
-{
- struct cfi_private *cfi = map->fldrv_priv;
- int ret;
-
- spin_lock(chip->mutex);
- ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING);
- if (ret)
- goto out_unlock;
- chip->state = FL_UNLOCKING;
-
- DEBUG(MTD_DEBUG_LEVEL3, "MTD %s(): LOCK 0x%08lx len %d\n",
- __func__, adr, len);
-
- cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi,
- cfi->device_type, NULL);
- map_write(map, CMD(0x70), adr);
-
- chip->state = FL_READY;
- put_chip(map, chip, adr + chip->start);
- ret = 0;
-
-out_unlock:
- spin_unlock(chip->mutex);
- return ret;
-}
-
-static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
-{
- return cfi_varsize_frob(mtd, do_atmel_lock, ofs, len, NULL);
-}
-
-static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
-{
- return cfi_varsize_frob(mtd, do_atmel_unlock, ofs, len, NULL);
-}
-