• Home
  • Raw
  • Download

Lines Matching full:mtd

3  * MTD Oops/Panic logger
19 #include <linux/mtd/mtd.h>
22 /* Maximum MTD partition size */
31 "record size for MTD OOPS pages in bytes (default 4096)");
36 "name or index number of the MTD device to use");
49 struct mtd_info *mtd; member
75 struct mtd_info *mtd = cxt->mtd; in mtdoops_erase_block() local
76 u32 start_page_offset = mtd_div_by_eb(offset, mtd) * mtd->erasesize; in mtdoops_erase_block()
78 u32 erase_pages = mtd->erasesize / record_size; in mtdoops_erase_block()
84 erase.len = mtd->erasesize; in mtdoops_erase_block()
86 ret = mtd_erase(mtd, &erase); in mtdoops_erase_block()
124 struct mtd_info *mtd = cxt->mtd; in mtdoops_workfunc_erase() local
128 if (!mtd) in mtdoops_workfunc_erase()
131 mod = (cxt->nextpage * record_size) % mtd->erasesize; in mtdoops_workfunc_erase()
133 cxt->nextpage = cxt->nextpage + ((mtd->erasesize - mod) / record_size); in mtdoops_workfunc_erase()
138 while ((ret = mtd_block_isbad(mtd, cxt->nextpage * record_size)) > 0) { in mtdoops_workfunc_erase()
143 cxt->nextpage = cxt->nextpage + (mtd->erasesize / record_size); in mtdoops_workfunc_erase()
146 if (i == cxt->oops_pages / (mtd->erasesize / record_size)) { in mtdoops_workfunc_erase()
167 ret = mtd_block_markbad(mtd, cxt->nextpage * record_size); in mtdoops_workfunc_erase()
178 struct mtd_info *mtd = cxt->mtd; in mtdoops_write() local
189 ret = mtd_panic_write(mtd, cxt->nextpage * record_size, in mtdoops_write()
196 ret = mtd_write(mtd, cxt->nextpage * record_size, in mtdoops_write()
218 struct mtd_info *mtd = cxt->mtd; in find_next_position() local
224 if (mtd_block_isbad(mtd, page * record_size)) in find_next_position()
228 ret = mtd_read(mtd, page * record_size, MTDOOPS_HEADER_SIZE, in find_next_position()
291 static void mtdoops_notify_add(struct mtd_info *mtd) in mtdoops_notify_add() argument
294 u64 mtdoops_pages = div_u64(mtd->size, record_size); in mtdoops_notify_add()
297 if (!strcmp(mtd->name, mtddev)) in mtdoops_notify_add()
298 cxt->mtd_index = mtd->index; in mtdoops_notify_add()
300 if (mtd->index != cxt->mtd_index || cxt->mtd_index < 0) in mtdoops_notify_add()
303 if (mtd->size < mtd->erasesize * 2) { in mtdoops_notify_add()
304 printk(KERN_ERR "mtdoops: MTD partition %d not big enough for mtdoops\n", in mtdoops_notify_add()
305 mtd->index); in mtdoops_notify_add()
308 if (mtd->erasesize < record_size) { in mtdoops_notify_add()
309 printk(KERN_ERR "mtdoops: eraseblock size of MTD partition %d too small\n", in mtdoops_notify_add()
310 mtd->index); in mtdoops_notify_add()
313 if (mtd->size > MTDOOPS_MAX_MTD_SIZE) { in mtdoops_notify_add()
314 printk(KERN_ERR "mtdoops: mtd%d is too large (limit is %d MiB)\n", in mtdoops_notify_add()
315 mtd->index, MTDOOPS_MAX_MTD_SIZE / 1024 / 1024); in mtdoops_notify_add()
339 cxt->mtd = mtd; in mtdoops_notify_add()
340 cxt->oops_pages = (int)mtd->size / record_size; in mtdoops_notify_add()
342 printk(KERN_INFO "mtdoops: Attached to MTD device %d\n", mtd->index); in mtdoops_notify_add()
345 static void mtdoops_notify_remove(struct mtd_info *mtd) in mtdoops_notify_remove() argument
349 if (mtd->index != cxt->mtd_index || cxt->mtd_index < 0) in mtdoops_notify_remove()
355 cxt->mtd = NULL; in mtdoops_notify_remove()
373 printk(KERN_ERR "mtdoops: mtd device (mtddev=name/number) must be supplied\n"); in mtdoops_init()
385 /* Setup the MTD device to use */ in mtdoops_init()
420 MODULE_DESCRIPTION("MTD Oops/Panic console logger/driver");