Lines Matching refs:mtd

15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/rawnand.h>
17 #include <linux/mtd/blktrans.h>
102 static int get_valid_cis_sector(struct mtd_info *mtd)
120 for (k = 0, offset = 0; k < 4; k++, offset += mtd->erasesize) {
121 if (mtd_block_isbad(mtd, offset)) {
122 ret = mtd_read(mtd, offset, SECTOR_SIZE, &retlen,
135 " on %s (mtd%d)\n", mtd->name,
136 mtd->index);
148 static int read_physical_sector(struct mtd_info *mtd, uint8_t *sect_buf,
155 ret = mtd_read(mtd, offset, SECTOR_SIZE, &retlen, sect_buf);
163 static int read_raw_oob(struct mtd_info *mtd, loff_t offs, uint8_t *buf)
174 ret = mtd_read_oob(mtd, offs, &ops);
244 struct mtd_info *mtd = ssfdc->mbd.mtd;
254 if (mtd_block_isbad(mtd, offset))
257 ret = read_raw_oob(mtd, offset, oob_buf);
259 pr_debug("SSFDC_RO: mtd read_oob() failed at %lu\n",
283 static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
289 if (!mtd_type_is_nand(mtd) || mtd->oobsize != OOB_SIZE ||
290 mtd->size > UINT_MAX)
294 cis_sector = get_valid_cis_sector(mtd);
302 ssfdc->mbd.mtd = mtd;
307 ssfdc->cis_block = cis_sector / (mtd->erasesize >> SECTOR_SHIFT);
308 ssfdc->erase_size = mtd->erasesize;
309 ssfdc->map_len = (u32)mtd->size / mtd->erasesize;
318 get_chs(mtd->size, NULL, &ssfdc->heads, &ssfdc->sectors);
319 ssfdc->cylinders = (unsigned short)(((u32)mtd->size >> SECTOR_SHIFT) /
347 printk(KERN_INFO "SSFDC_RO: Found ssfdc%c on mtd%d (%s)\n",
348 ssfdc->mbd.devnum + 'a', mtd->index, mtd->name);
397 if (read_physical_sector(ssfdc->mbd.mtd, buf, sect_no) < 0)