• Home
  • Raw
  • Download

Lines Matching refs:mtd

27 	struct mtd_info mtd;  member
47 static int part_read(struct mtd_info *mtd, loff_t from, size_t len, in part_read() argument
50 struct mtd_part *part = PART(mtd); in part_read()
53 if (from >= mtd->size) in part_read()
55 else if (from + len > mtd->size) in part_read()
56 len = mtd->size - from; in part_read()
61 mtd->ecc_stats.corrected++; in part_read()
63 mtd->ecc_stats.failed++; in part_read()
68 static int part_point(struct mtd_info *mtd, loff_t from, size_t len, in part_point() argument
71 struct mtd_part *part = PART(mtd); in part_point()
72 if (from >= mtd->size) in part_point()
74 else if (from + len > mtd->size) in part_point()
75 len = mtd->size - from; in part_point()
80 static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) in part_unpoint() argument
82 struct mtd_part *part = PART(mtd); in part_unpoint()
87 static int part_read_oob(struct mtd_info *mtd, loff_t from, in part_read_oob() argument
90 struct mtd_part *part = PART(mtd); in part_read_oob()
93 if (from >= mtd->size) in part_read_oob()
95 if (ops->datbuf && from + ops->len > mtd->size) in part_read_oob()
101 mtd->ecc_stats.corrected++; in part_read_oob()
103 mtd->ecc_stats.failed++; in part_read_oob()
108 static int part_read_user_prot_reg(struct mtd_info *mtd, loff_t from, in part_read_user_prot_reg() argument
111 struct mtd_part *part = PART(mtd); in part_read_user_prot_reg()
116 static int part_get_user_prot_info(struct mtd_info *mtd, in part_get_user_prot_info() argument
119 struct mtd_part *part = PART(mtd); in part_get_user_prot_info()
123 static int part_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, in part_read_fact_prot_reg() argument
126 struct mtd_part *part = PART(mtd); in part_read_fact_prot_reg()
131 static int part_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, in part_get_fact_prot_info() argument
134 struct mtd_part *part = PART(mtd); in part_get_fact_prot_info()
138 static int part_write(struct mtd_info *mtd, loff_t to, size_t len, in part_write() argument
141 struct mtd_part *part = PART(mtd); in part_write()
142 if (!(mtd->flags & MTD_WRITEABLE)) in part_write()
144 if (to >= mtd->size) in part_write()
146 else if (to + len > mtd->size) in part_write()
147 len = mtd->size - to; in part_write()
152 static int part_panic_write(struct mtd_info *mtd, loff_t to, size_t len, in part_panic_write() argument
155 struct mtd_part *part = PART(mtd); in part_panic_write()
156 if (!(mtd->flags & MTD_WRITEABLE)) in part_panic_write()
158 if (to >= mtd->size) in part_panic_write()
160 else if (to + len > mtd->size) in part_panic_write()
161 len = mtd->size - to; in part_panic_write()
166 static int part_write_oob(struct mtd_info *mtd, loff_t to, in part_write_oob() argument
169 struct mtd_part *part = PART(mtd); in part_write_oob()
171 if (!(mtd->flags & MTD_WRITEABLE)) in part_write_oob()
174 if (to >= mtd->size) in part_write_oob()
176 if (ops->datbuf && to + ops->len > mtd->size) in part_write_oob()
181 static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from, in part_write_user_prot_reg() argument
184 struct mtd_part *part = PART(mtd); in part_write_user_prot_reg()
189 static int part_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, in part_lock_user_prot_reg() argument
192 struct mtd_part *part = PART(mtd); in part_lock_user_prot_reg()
196 static int part_writev(struct mtd_info *mtd, const struct kvec *vecs, in part_writev() argument
199 struct mtd_part *part = PART(mtd); in part_writev()
200 if (!(mtd->flags & MTD_WRITEABLE)) in part_writev()
206 static int part_erase(struct mtd_info *mtd, struct erase_info *instr) in part_erase() argument
208 struct mtd_part *part = PART(mtd); in part_erase()
210 if (!(mtd->flags & MTD_WRITEABLE)) in part_erase()
212 if (instr->addr >= mtd->size) in part_erase()
226 if (instr->mtd->erase == part_erase) { in mtd_erase_callback()
227 struct mtd_part *part = PART(instr->mtd); in mtd_erase_callback()
238 static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) in part_lock() argument
240 struct mtd_part *part = PART(mtd); in part_lock()
241 if ((len + ofs) > mtd->size) in part_lock()
246 static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) in part_unlock() argument
248 struct mtd_part *part = PART(mtd); in part_unlock()
249 if ((len + ofs) > mtd->size) in part_unlock()
254 static void part_sync(struct mtd_info *mtd) in part_sync() argument
256 struct mtd_part *part = PART(mtd); in part_sync()
260 static int part_suspend(struct mtd_info *mtd) in part_suspend() argument
262 struct mtd_part *part = PART(mtd); in part_suspend()
266 static void part_resume(struct mtd_info *mtd) in part_resume() argument
268 struct mtd_part *part = PART(mtd); in part_resume()
272 static int part_block_isbad(struct mtd_info *mtd, loff_t ofs) in part_block_isbad() argument
274 struct mtd_part *part = PART(mtd); in part_block_isbad()
275 if (ofs >= mtd->size) in part_block_isbad()
281 static int part_block_markbad(struct mtd_info *mtd, loff_t ofs) in part_block_markbad() argument
283 struct mtd_part *part = PART(mtd); in part_block_markbad()
286 if (!(mtd->flags & MTD_WRITEABLE)) in part_block_markbad()
288 if (ofs >= mtd->size) in part_block_markbad()
293 mtd->ecc_stats.badblocks++; in part_block_markbad()
310 del_mtd_device(&slave->mtd); in del_mtd_partitions()
335 slave->mtd.type = master->type; in add_one_partition()
336 slave->mtd.flags = master->flags & ~part->mask_flags; in add_one_partition()
337 slave->mtd.size = part->size; in add_one_partition()
338 slave->mtd.writesize = master->writesize; in add_one_partition()
339 slave->mtd.oobsize = master->oobsize; in add_one_partition()
340 slave->mtd.oobavail = master->oobavail; in add_one_partition()
341 slave->mtd.subpage_sft = master->subpage_sft; in add_one_partition()
343 slave->mtd.name = part->name; in add_one_partition()
344 slave->mtd.owner = master->owner; in add_one_partition()
346 slave->mtd.read = part_read; in add_one_partition()
347 slave->mtd.write = part_write; in add_one_partition()
350 slave->mtd.panic_write = part_panic_write; in add_one_partition()
353 slave->mtd.point = part_point; in add_one_partition()
354 slave->mtd.unpoint = part_unpoint; in add_one_partition()
358 slave->mtd.read_oob = part_read_oob; in add_one_partition()
360 slave->mtd.write_oob = part_write_oob; in add_one_partition()
362 slave->mtd.read_user_prot_reg = part_read_user_prot_reg; in add_one_partition()
364 slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg; in add_one_partition()
366 slave->mtd.write_user_prot_reg = part_write_user_prot_reg; in add_one_partition()
368 slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg; in add_one_partition()
370 slave->mtd.get_user_prot_info = part_get_user_prot_info; in add_one_partition()
372 slave->mtd.get_fact_prot_info = part_get_fact_prot_info; in add_one_partition()
374 slave->mtd.sync = part_sync; in add_one_partition()
376 slave->mtd.suspend = part_suspend; in add_one_partition()
377 slave->mtd.resume = part_resume; in add_one_partition()
380 slave->mtd.writev = part_writev; in add_one_partition()
382 slave->mtd.lock = part_lock; in add_one_partition()
384 slave->mtd.unlock = part_unlock; in add_one_partition()
386 slave->mtd.block_isbad = part_block_isbad; in add_one_partition()
388 slave->mtd.block_markbad = part_block_markbad; in add_one_partition()
389 slave->mtd.erase = part_erase; in add_one_partition()
406 if (slave->mtd.size == MTDPART_SIZ_FULL) in add_one_partition()
407 slave->mtd.size = master->size - slave->offset; in add_one_partition()
410 (unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name); in add_one_partition()
416 slave->mtd.size = 0; in add_one_partition()
421 if (slave->offset + slave->mtd.size > master->size) { in add_one_partition()
422 slave->mtd.size = master->size - slave->offset; in add_one_partition()
424 part->name, master->name, (unsigned long long)slave->mtd.size); in add_one_partition()
429 u64 end = slave->offset + slave->mtd.size; in add_one_partition()
441 if (slave->mtd.erasesize < regions[i].erasesize) { in add_one_partition()
442 slave->mtd.erasesize = regions[i].erasesize; in add_one_partition()
445 BUG_ON(slave->mtd.erasesize == 0); in add_one_partition()
448 slave->mtd.erasesize = master->erasesize; in add_one_partition()
451 if ((slave->mtd.flags & MTD_WRITEABLE) && in add_one_partition()
452 mtd_mod_by_eb(slave->offset, &slave->mtd)) { in add_one_partition()
456 slave->mtd.flags &= ~MTD_WRITEABLE; in add_one_partition()
460 if ((slave->mtd.flags & MTD_WRITEABLE) && in add_one_partition()
461 mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { in add_one_partition()
462 slave->mtd.flags &= ~MTD_WRITEABLE; in add_one_partition()
467 slave->mtd.ecclayout = master->ecclayout; in add_one_partition()
471 while (offs < slave->mtd.size) { in add_one_partition()
474 slave->mtd.ecc_stats.badblocks++; in add_one_partition()
475 offs += slave->mtd.erasesize; in add_one_partition()
482 *part->mtdp = &slave->mtd; in add_one_partition()
486 add_mtd_device(&slave->mtd); in add_one_partition()
513 cur_offset = slave->offset + slave->mtd.size; in add_mtd_partitions()