• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/mtd/devices/

Lines Matching defs:flash

30 #include <linux/spi/flash.h>
74 static int sst25l_status(struct sst25l_flash *flash, int *status)
90 err = spi_sync(flash->spi, &m);
98 static int sst25l_write_enable(struct sst25l_flash *flash, int enable)
104 err = spi_write(flash->spi, command, 1);
109 err = spi_write(flash->spi, command, 1);
115 err = spi_write(flash->spi, command, 2);
120 err = sst25l_status(flash, &status);
130 static int sst25l_wait_till_ready(struct sst25l_flash *flash)
137 err = sst25l_status(flash, &status);
149 static int sst25l_erase_sector(struct sst25l_flash *flash, uint32_t offset)
154 err = sst25l_write_enable(flash, 1);
162 err = spi_write(flash->spi, command, 4);
166 err = sst25l_wait_till_ready(flash);
170 return sst25l_write_enable(flash, 0);
175 struct sst25l_flash *flash = to_sst25l_flash(mtd);
180 if (instr->addr + instr->len > flash->mtd.size)
192 mutex_lock(&flash->lock);
194 err = sst25l_wait_till_ready(flash);
196 mutex_unlock(&flash->lock);
201 err = sst25l_erase_sector(flash, addr);
203 mutex_unlock(&flash->lock);
205 dev_err(&flash->spi->dev, "Erase failed\n");
212 mutex_unlock(&flash->lock);
222 struct sst25l_flash *flash = to_sst25l_flash(mtd);
232 if (from + len > flash->mtd.size)
254 mutex_lock(&flash->lock);
257 ret = sst25l_wait_till_ready(flash);
259 mutex_unlock(&flash->lock);
263 spi_sync(flash->spi, &message);
268 mutex_unlock(&flash->lock);
275 struct sst25l_flash *flash = to_sst25l_flash(mtd);
283 if (to + len > flash->mtd.size)
289 mutex_lock(&flash->lock);
291 ret = sst25l_write_enable(flash, 1);
296 ret = sst25l_wait_till_ready(flash);
306 ret = spi_write(flash->spi, command, 5);
317 ret = sst25l_wait_till_ready(flash);
322 ret = spi_write(flash->spi, command, 2);
329 ret = sst25l_write_enable(flash, 0);
334 mutex_unlock(&flash->lock);
381 struct sst25l_flash *flash;
389 flash = kzalloc(sizeof(struct sst25l_flash), GFP_KERNEL);
390 if (!flash)
393 flash->spi = spi;
394 mutex_init(&flash->lock);
395 dev_set_drvdata(&spi->dev, flash);
399 flash->mtd.name = data->name;
401 flash->mtd.name = dev_name(&spi->dev);
403 flash->mtd.type = MTD_NORFLASH;
404 flash->mtd.flags = MTD_CAP_NORFLASH;
405 flash->mtd.erasesize = flash_info->erase_size;
406 flash->mtd.writesize = flash_info->page_size;
407 flash->mtd.size = flash_info->page_size * flash_info->nr_pages;
408 flash->mtd.erase = sst25l_erase;
409 flash->mtd.read = sst25l_read;
410 flash->mtd.write = sst25l_write;
413 (long long)flash->mtd.size >> 10);
418 flash->mtd.name,
419 (long long)flash->mtd.size, (long long)(flash->mtd.size >> 20),
420 flash->mtd.erasesize, flash->mtd.erasesize / 1024,
421 flash->mtd.numeraseregions);
431 nr_parts = parse_mtd_partitions(&flash->mtd,
452 flash->partitioned = 1;
453 return add_mtd_partitions(&flash->mtd,
462 ret = add_mtd_device(&flash->mtd);
464 kfree(flash);
474 struct sst25l_flash *flash = dev_get_drvdata(&spi->dev);
477 if (mtd_has_partitions() && flash->partitioned)
478 ret = del_mtd_partitions(&flash->mtd);
480 ret = del_mtd_device(&flash->mtd);
482 kfree(flash);