Lines Matching refs:mtd

136 static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
139 static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) in pmc551_erase() argument
141 struct mypriv *priv = mtd->priv; in pmc551_erase()
159 pmc551_point(mtd, instr->addr, instr->len, &retlen, in pmc551_erase()
162 if (soff_hi == eoff_hi || mtd->size == priv->asize) { in pmc551_erase()
175 if (soff_hi + priv->asize >= mtd->size) { in pmc551_erase()
179 pmc551_point(mtd, (priv->base_map0 | soff_hi), in pmc551_erase()
196 static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, in pmc551_point() argument
199 struct mypriv *priv = mtd->priv; in pmc551_point()
222 static int pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len) in pmc551_unpoint() argument
230 static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, in pmc551_read() argument
233 struct mypriv *priv = mtd->priv; in pmc551_read()
251 pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL); in pmc551_read()
268 if (soff_hi + priv->asize >= mtd->size) { in pmc551_read()
272 pmc551_point(mtd, soff_hi, priv->asize, retlen, in pmc551_read()
287 static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, in pmc551_write() argument
290 struct mypriv *priv = mtd->priv; in pmc551_write()
308 pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL); in pmc551_write()
325 if (soff_hi >= mtd->size) { in pmc551_write()
329 pmc551_point(mtd, soff_hi, priv->asize, retlen, in pmc551_write()
665 struct mtd_info *mtd; in init_pmc551() local
727 mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL); in init_pmc551()
728 if (!mtd) in init_pmc551()
733 kfree(mtd); in init_pmc551()
736 mtd->priv = priv; in init_pmc551()
756 kfree(mtd->priv); in init_pmc551()
757 kfree(mtd); in init_pmc551()
777 mtd->size = msize; in init_pmc551()
778 mtd->flags = MTD_CAP_RAM; in init_pmc551()
779 mtd->_erase = pmc551_erase; in init_pmc551()
780 mtd->_read = pmc551_read; in init_pmc551()
781 mtd->_write = pmc551_write; in init_pmc551()
782 mtd->_point = pmc551_point; in init_pmc551()
783 mtd->_unpoint = pmc551_unpoint; in init_pmc551()
784 mtd->type = MTD_RAM; in init_pmc551()
785 mtd->name = "PMC551 RAM board"; in init_pmc551()
786 mtd->erasesize = 0x10000; in init_pmc551()
787 mtd->writesize = 1; in init_pmc551()
788 mtd->owner = THIS_MODULE; in init_pmc551()
790 if (mtd_device_register(mtd, NULL, 0)) { in init_pmc551()
793 kfree(mtd->priv); in init_pmc551()
794 kfree(mtd); in init_pmc551()
810 pmc551list = mtd; in init_pmc551()
832 struct mtd_info *mtd; in cleanup_pmc551() local
835 while ((mtd = pmc551list)) { in cleanup_pmc551()
836 priv = mtd->priv; in cleanup_pmc551()
846 kfree(mtd->priv); in cleanup_pmc551()
847 mtd_device_unregister(mtd); in cleanup_pmc551()
848 kfree(mtd); in cleanup_pmc551()