Lines Matching refs:mtd

16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/spi-nor.h>
1072 bool multi_die = nor->mtd.size != die_size;
1754 (unsigned long)(nor->mtd.size / SZ_2M));
1789 static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
1791 struct spi_nor *nor = mtd_to_spi_nor(mtd);
1802 div_u64_rem(instr->len, mtd->erasesize, &rem);
1811 die_size = div_u64(mtd->size, n_dice);
1815 die_size = mtd->size;
1823 if ((len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) ||
1856 addr += mtd->erasesize;
1857 len -= mtd->erasesize;
2051 static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
2054 struct spi_nor *nor = mtd_to_spi_nor(mtd);
2098 static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
2101 struct spi_nor *nor = mtd_to_spi_nor(mtd);
2458 * eXecution In Place is out of the scope of the mtd sub-system.
2546 struct mtd_info *mtd = &nor->mtd;
2562 mtd->erasesize = erase->size;
2567 * For non-uniform SPI flash memory, set mtd->erasesize to the
2580 mtd->erasesize = erase->size;
3238 /* mtd suspend handler */
3239 static int spi_nor_suspend(struct mtd_info *mtd)
3241 struct spi_nor *nor = mtd_to_spi_nor(mtd);
3252 /* mtd resume handler */
3253 static void spi_nor_resume(struct mtd_info *mtd)
3255 struct spi_nor *nor = mtd_to_spi_nor(mtd);
3265 static int spi_nor_get_device(struct mtd_info *mtd)
3267 struct mtd_info *master = mtd_get_master(mtd);
3282 static void spi_nor_put_device(struct mtd_info *mtd)
3284 struct mtd_info *master = mtd_get_master(mtd);
3359 * mtd apply them anyway, since some partitions may be
3394 struct mtd_info *mtd = &nor->mtd;
3413 mtd->numeraseregions = map->n_regions;
3414 mtd->eraseregions = mtd_region;
3421 struct mtd_info *mtd = &nor->mtd;
3427 mtd->dev.parent = dev;
3428 if (!mtd->name)
3429 mtd->name = dev_name(dev);
3430 mtd->type = MTD_NORFLASH;
3431 mtd->flags = MTD_CAP_NORFLASH;
3434 mtd->flags &= ~MTD_BIT_WRITEABLE;
3436 mtd->flags |= MTD_NO_ERASE;
3438 mtd->_erase = spi_nor_erase;
3439 mtd->writesize = nor->params->writesize;
3440 mtd->writebufsize = nor->params->page_size;
3441 mtd->size = nor->params->size;
3442 mtd->_read = spi_nor_read;
3444 if (!mtd->_write)
3445 mtd->_write = spi_nor_write;
3446 mtd->_suspend = spi_nor_suspend;
3447 mtd->_resume = spi_nor_resume;
3448 mtd->_get_device = spi_nor_get_device;
3449 mtd->_put_device = spi_nor_put_device;
3640 nor->mtd.name = data->name;
3642 if (!nor->mtd.name)
3643 nor->mtd.name = spi_mem_get_name(spimem);
3687 return mtd_device_register(&nor->mtd, data ? data->parts : NULL,
3698 return mtd_device_unregister(&nor->mtd);