Lines Matching defs:mtd

21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/partitions.h>
49 struct mtd_info mtd;
60 #define to_sst25l_flash(x) container_of(x, struct sst25l_flash, mtd)
166 static int sst25l_erase(struct mtd_info *mtd, struct erase_info *instr)
168 struct sst25l_flash *flash = to_sst25l_flash(mtd);
173 if ((uint32_t)instr->len % mtd->erasesize)
176 if ((uint32_t)instr->addr % mtd->erasesize)
198 addr += mtd->erasesize;
206 static int sst25l_read(struct mtd_info *mtd, loff_t from, size_t len,
209 struct sst25l_flash *flash = to_sst25l_flash(mtd);
249 static int sst25l_write(struct mtd_info *mtd, loff_t to, size_t len,
252 struct sst25l_flash *flash = to_sst25l_flash(mtd);
256 if ((uint32_t)to % mtd->writesize)
265 for (i = 0; i < len; i += mtd->writesize) {
285 bytes = min_t(uint32_t, mtd->writesize, len - i);
369 flash->mtd.name = data->name;
371 flash->mtd.dev.parent = &spi->dev;
372 flash->mtd.type = MTD_NORFLASH;
373 flash->mtd.flags = MTD_CAP_NORFLASH;
374 flash->mtd.erasesize = flash_info->erase_size;
375 flash->mtd.writesize = flash_info->page_size;
376 flash->mtd.writebufsize = flash_info->page_size;
377 flash->mtd.size = flash_info->page_size * flash_info->nr_pages;
378 flash->mtd._erase = sst25l_erase;
379 flash->mtd._read = sst25l_read;
380 flash->mtd._write = sst25l_write;
383 (long long)flash->mtd.size >> 10);
385 pr_debug("mtd .name = %s, .size = 0x%llx (%lldMiB) "
387 flash->mtd.name,
388 (long long)flash->mtd.size, (long long)(flash->mtd.size >> 20),
389 flash->mtd.erasesize, flash->mtd.erasesize / 1024,
390 flash->mtd.numeraseregions);
393 ret = mtd_device_register(&flash->mtd, data ? data->parts : NULL,
405 return mtd_device_unregister(&flash->mtd);