Lines Matching refs:mtd
31 struct mtd_info mtd; member
46 static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op, in powernv_flash_async_op() argument
49 struct powernv_flash *info = (struct powernv_flash *)mtd->priv; in powernv_flash_async_op()
50 struct device *dev = &mtd->dev; in powernv_flash_async_op()
138 static int powernv_flash_read(struct mtd_info *mtd, loff_t from, size_t len, in powernv_flash_read() argument
141 return powernv_flash_async_op(mtd, FLASH_OP_READ, from, in powernv_flash_read()
155 static int powernv_flash_write(struct mtd_info *mtd, loff_t to, size_t len, in powernv_flash_write() argument
158 return powernv_flash_async_op(mtd, FLASH_OP_WRITE, to, in powernv_flash_write()
168 static int powernv_flash_erase(struct mtd_info *mtd, struct erase_info *erase) in powernv_flash_erase() argument
172 rc = powernv_flash_async_op(mtd, FLASH_OP_ERASE, erase->addr, in powernv_flash_erase()
186 struct mtd_info *mtd) in powernv_flash_set_driver_info() argument
209 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node); in powernv_flash_set_driver_info()
210 if (!mtd->name) in powernv_flash_set_driver_info()
213 mtd->type = MTD_NORFLASH; in powernv_flash_set_driver_info()
214 mtd->flags = MTD_WRITEABLE; in powernv_flash_set_driver_info()
215 mtd->size = size; in powernv_flash_set_driver_info()
216 mtd->erasesize = erase_size; in powernv_flash_set_driver_info()
217 mtd->writebufsize = mtd->writesize = 1; in powernv_flash_set_driver_info()
218 mtd->owner = THIS_MODULE; in powernv_flash_set_driver_info()
219 mtd->_erase = powernv_flash_erase; in powernv_flash_set_driver_info()
220 mtd->_read = powernv_flash_read; in powernv_flash_set_driver_info()
221 mtd->_write = powernv_flash_write; in powernv_flash_set_driver_info()
222 mtd->dev.parent = dev; in powernv_flash_set_driver_info()
223 mtd_set_of_node(mtd, dev->of_node); in powernv_flash_set_driver_info()
243 data->mtd.priv = data; in powernv_flash_probe()
251 ret = powernv_flash_set_driver_info(dev, &data->mtd); in powernv_flash_probe()
262 return mtd_device_register(&data->mtd, NULL, 0); in powernv_flash_probe()
276 WARN_ON(mtd_device_unregister(&data->mtd)); in powernv_flash_release()