Lines Matching defs:mtd
16 #include <linux/mtd/mtd.h>
17 #include <linux/mtd/partitions.h>
31 struct mtd_info mtd;
46 static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op,
49 struct powernv_flash *info = (struct powernv_flash *)mtd->priv;
50 struct device *dev = &mtd->dev;
87 * If we return the mtd core will free the
129 * @mtd: the device
137 static int powernv_flash_read(struct mtd_info *mtd, loff_t from, size_t len,
140 return powernv_flash_async_op(mtd, FLASH_OP_READ, from,
145 * @mtd: the device
153 static int powernv_flash_write(struct mtd_info *mtd, loff_t to, size_t len,
156 return powernv_flash_async_op(mtd, FLASH_OP_WRITE, to,
161 * @mtd: the device
165 static int powernv_flash_erase(struct mtd_info *mtd, struct erase_info *erase)
169 rc = powernv_flash_async_op(mtd, FLASH_OP_ERASE, erase->addr,
180 * @mtd: The structure to fill
183 struct mtd_info *mtd)
206 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
207 mtd->type = MTD_NORFLASH;
208 mtd->flags = MTD_WRITEABLE;
209 mtd->size = size;
210 mtd->erasesize = erase_size;
211 mtd->writebufsize = mtd->writesize = 1;
212 mtd->owner = THIS_MODULE;
213 mtd->_erase = powernv_flash_erase;
214 mtd->_read = powernv_flash_read;
215 mtd->_write = powernv_flash_write;
216 mtd->dev.parent = dev;
217 mtd_set_of_node(mtd, dev->of_node);
237 data->mtd.priv = data;
245 ret = powernv_flash_set_driver_info(dev, &data->mtd);
256 return mtd_device_register(&data->mtd, NULL, 0);
270 return mtd_device_unregister(&(data->mtd));