Lines Matching full:mtd

4     drivers/mtd/afs.c: ARM Flash Layout/Partitioning
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/map.h>
24 #include <linux/mtd/partitions.h>
78 static bool afs_is_v1(struct mtd_info *mtd, u_int off) in afs_is_v1() argument
81 u_int ptr = off + mtd->erasesize - 12; in afs_is_v1()
86 ret = mtd_read(mtd, ptr, 4, &sz, (u_char *)&magic); in afs_is_v1()
88 printk(KERN_ERR "AFS: mtd read failed at 0x%x: %d\n", in afs_is_v1()
98 static bool afs_is_v2(struct mtd_info *mtd, u_int off) in afs_is_v2() argument
101 u_int ptr = off + mtd->erasesize - 8; in afs_is_v2()
106 ret = mtd_read(mtd, ptr, 8, &sz, (u_char *)foot); in afs_is_v2()
108 printk(KERN_ERR "AFS: mtd read failed at 0x%x: %d\n", in afs_is_v2()
119 static int afs_parse_v1_partition(struct mtd_info *mtd, in afs_parse_v1_partition() argument
140 mask = mtd->size - 1; in afs_parse_v1_partition()
142 ptr = off + mtd->erasesize - sizeof(fs); in afs_parse_v1_partition()
143 ret = mtd_read(mtd, ptr, sizeof(fs), &sz, (u_char *)&fs); in afs_parse_v1_partition()
147 printk(KERN_ERR "AFS: mtd read failed at 0x%x: %d\n", in afs_parse_v1_partition()
182 ret = mtd_read(mtd, iis_ptr, sizeof(iis), &sz, (u_char *)&iis); in afs_parse_v1_partition()
184 printk(KERN_ERR "AFS: mtd read failed at 0x%x: %d\n", in afs_parse_v1_partition()
205 part->size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1); in afs_parse_v1_partition()
209 printk(" mtd: at 0x%08x, %5lluKiB, %8u, %s\n", in afs_parse_v1_partition()
216 static int afs_parse_v2_partition(struct mtd_info *mtd, in afs_parse_v2_partition() argument
236 off, off + mtd->erasesize); in afs_parse_v2_partition()
239 ptr = off + mtd->erasesize - sizeof(footer); in afs_parse_v2_partition()
240 ret = mtd_read(mtd, ptr, sizeof(footer), &sz, (u_char *)footer); in afs_parse_v2_partition()
242 pr_err("AFS: mtd read failed at 0x%x: %d\n", in afs_parse_v2_partition()
248 ptr = off + mtd->erasesize - sizeof(footer) - footer[8]; in afs_parse_v2_partition()
254 ret = mtd_read(mtd, ptr, sizeof(imginfo), &sz, (u_char *)imginfo); in afs_parse_v2_partition()
256 pr_err("AFS: mtd read failed at 0x%x: %d\n", in afs_parse_v2_partition()
306 region_end += (mtd->erasesize - 1); in afs_parse_v2_partition()
307 region_end &= ~(mtd->erasesize -1); in afs_parse_v2_partition()
323 static int parse_afs_partitions(struct mtd_info *mtd, in parse_afs_partitions() argument
333 for (i = off = sz = 0; off < mtd->size; off += mtd->erasesize) { in parse_afs_partitions()
334 if (afs_is_v1(mtd, off)) { in parse_afs_partitions()
338 if (afs_is_v2(mtd, off)) { in parse_afs_partitions()
354 for (i = off = 0; off < mtd->size; off += mtd->erasesize) { in parse_afs_partitions()
355 if (afs_is_v1(mtd, off)) { in parse_afs_partitions()
356 ret = afs_parse_v1_partition(mtd, off, &parts[i]); in parse_afs_partitions()
361 if (afs_is_v2(mtd, off)) { in parse_afs_partitions()
362 ret = afs_parse_v2_partition(mtd, off, &parts[i]); in parse_afs_partitions()