Add cmdlinepart and default static partition table support for ARM Integrator - resend
Ok, hopefully I'm using the correct e-mail account for list postings now. So here is a repost with the patch attached this time!
Greetings,
The attached patch adds cmdlinepart and default static partition table support to integrator-flash. I've tested this on an ARM Integrator/AP with CM920T core module. The patch is against recent MTD CVS checkout +/- 1 day. I'ld like to get this committed to the MTD CVS repository. TIA!
--
Regards,
George
Index: drivers/mtd/maps/integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v retrieving revision 1.12
mtd/maps/integrator-flash.c +43 -10
@@ -154,14 +154,43 @@static struct map_info armflash_map = { - .name ="AFS" , + .name ="integrator-flash" , .set_vpp = armflash_set_vpp, .phys =FLASH_BASE , }; + +/* +* Default static MTD partition definition. +* +* See include/linux/mtd/partitions.h for definition of the mtd_partition +* structure. +*/ + +static struct mtd_partition integrator_partitions[] = { + { + .name ="Kernel" , + .size =0x00400000 , + .offset =0 , + }, { + .name ="Root Filesystem" , + .size =0x00c00000 , + .offset =MTDPART_OFS_APPEND , + }, { + .name ="User Filesystem" , + .size =0x00fc0000 , + .offset =MTDPART_OFS_APPEND , + }, { + .name ="ARM Boot Monitor SIB" , + .size =0x00040000 , + .offset =MTDPART_OFS_APPEND , + .mask_flags =MTD_WRITEABLE ,/* force read-only */ + } +}; +static struct mtd_info *mtd;static struct mtd_partition *parts; -static const char *probes[] = {"RedBoot" ,"afs" ,NULL }; +static const char *probes[] = {"cmdlinepart" ,"RedBoot" ,"afs" ,NULL };static int __init armflash_cfi_init (void *base,u_int size) {
@@ -180,9 +209,8 @@simple_map_init (&armflash_map);/* -* Also, the CFI layer automatically works out what size -* of chips we have, and does the necessary identification -* for us automatically. +* The CFI layer automatically works out what size chips we have +* and does the necessary identification for us automatically. */ mtd =do_map_probe ("cfi_probe" , &armflash_map);if (!mtd)
@@ -191,12 +219,17 @@ mtd->owner =THIS_MODULE ; ret =parse_mtd_partitions (mtd, probes, &parts, (void *)0 ); -if (ret >0 ) { - ret =add_mtd_partitions (mtd, parts, ret); -if (ret) -printk (KERN_ERR "mtd partition registration " -"failed: %d\n" , ret); +if (ret <=0 ) { +/* +* Use default static MTD partition definition: +*/ + parts = integrator_partitions; + ret =ARRAY_SIZE (integrator_partitions); } + + ret =add_mtd_partitions (mtd, parts, ret); +if (ret) +printk (KERN_ERR "mtd partition registration failed: %d\n" , ret);/* * If we got an error, free all resources.