Index: drivers/mtd/maps/ipaq-flash.c =================================================================== RCS file: /cvs/linux/kernel/drivers/mtd/maps/ipaq-flash.c,v retrieving revision 1.9 diff -r1.9 ipaq-flash.c 5a6 > * (C) 2003 Christian Pellegrin , : concatenation of multiple flashes 13a15 > #include 17a20,22 > #ifdef CONFIG_MTD_CONCAT > #include > #endif 28c33 < return map->map_priv_1 + ofs; --- > return (u_char *) map->map_priv_1 + ofs; 101,112c106,123 < static struct map_info ipaq_map = { < name: "IPAQ flash", < point: ipaq_point, < unpoint: ipaq_unpoint, < read8: ipaq_read8, < read16: ipaq_read16, < read32: ipaq_read32, < copy_from: ipaq_copy_from, < write8: ipaq_write8, < write16: ipaq_write16, < write32: ipaq_write32, < copy_to: ipaq_copy_to, --- > #define MAX_IPAQ_CS 2 /* Number of CS we are going to test */ > > #define IPAQ_MAP_INIT(X) \ > { \ > name: "IPAQ flash " X, \ > point: ipaq_point, \ > unpoint: ipaq_unpoint, \ > read8: ipaq_read8, \ > read16: ipaq_read16, \ > read32: ipaq_read32, \ > copy_from: ipaq_copy_from, \ > write8: ipaq_write8, \ > write16: ipaq_write16, \ > write32: ipaq_write32, \ > copy_to: ipaq_copy_to, \ > map_priv_1: 0, \ > } > 114c125,127 < map_priv_1: 0, --- > static struct map_info ipaq_map[MAX_IPAQ_CS] = { > IPAQ_MAP_INIT("bank 1"), > IPAQ_MAP_INIT("bank 2") 116a130,133 > static struct mtd_info *my_sub_mtd[MAX_IPAQ_CS] = { > NULL, > NULL > }; 140c157,158 < }, { --- > }, > { 142c160 < size: MTDPART_SIZ_FULL, --- > size: 0x2000000 - 2*0x40000, /* Warning, this is fixed later */ 143a162,167 > }, > { > name: "asset", > size: 0x40000, > offset: 0x2000000 - 0x40000, /* Warning, this is fixed later */ > mask_flags: MTD_WRITEABLE, /* force read-only */ 146a171,187 > static struct mtd_partition h3xxx_partitions_bank2[] = { > /* this is used only on 2 CS machines when concat is not present */ > { > name: "second H3XXX root jffs2", > size: 0x1000000 - 0x40000, /* Warning, this is fixed later */ > offset: 0x00000000, > }, > { > name: "second asset", > size: 0x40000, > offset: 0x1000000 - 0x40000, /* Warning, this is fixed later */ > mask_flags: MTD_WRITEABLE, /* force read-only */ > } > }; > > static spinlock_t ipaq_vpp_lock = SPIN_LOCK_UNLOCKED; > 149c190,201 < assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp); --- > static int nest = 0; > > spin_lock(&ipaq_vpp_lock); > if (vpp) > nest++; > else > nest--; > if (nest) > assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, 1); > else > assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, 0); > spin_unlock(&ipaq_vpp_lock); 150a203 > 181a235,236 > int i; /* used when we have >1 flash chips */ > unsigned long tot_flashsize = 0; /* used when we have >1 flash chips */ 185c240,241 < ipaq_map.buswidth = 4; --- > for(i=0; i ipaq_map[i].buswidth = 4; 196,200c252,258 < ipaq_map.size = h3xxx_max_flash_size; < ipaq_map.set_vpp = h3xxx_set_vpp; < ipaq_map.map_priv_1 = (__u32)__ioremap(0x0, 0x04000000, 0); < if (machine_is_h3100 ()) < ipaq_map.buswidth = 2; --- > for(i=0; i ipaq_map[i].size = h3xxx_max_flash_size; > ipaq_map[i].set_vpp = h3xxx_set_vpp; > ipaq_map[i].map_priv_1 = (__u32)__ioremap(0x04000000*i, 0x04000000, 0); > if (machine_is_h3100 ()) > ipaq_map[i].buswidth = 2; > } 207,209c265,267 < ipaq_map.size = jornada_max_flash_size; < ipaq_map.set_vpp = jornada56x_set_vpp; < ipaq_map.map_priv_1 = (__u32)__ioremap(0x0, 0x04000000, 0); --- > ipaq_map[0].size = jornada_max_flash_size; > ipaq_map[0].set_vpp = jornada56x_set_vpp; > ipaq_map[0].map_priv_1 = (__u32)__ioremap(0x0, 0x04000000, 0); 216,217c274,275 < ipaq_map.size = jornada_max_flash_size; < ipaq_map.set_vpp = jornada720_set_vpp; --- > ipaq_map[0].size = jornada_max_flash_size; > ipaq_map[0].set_vpp = jornada720_set_vpp; 221,229c279,329 < /* < * Now let's probe for the actual flash. Do it here since < * specific machine settings might have been set above. < */ < printk(KERN_NOTICE "IPAQ flash: probing %d-bit flash bus, window=%x\n", ipaq_map.buswidth*8, ipaq_map.map_priv_1); < mymtd = do_map_probe("cfi_probe", &ipaq_map); < if (!mymtd) < return -ENXIO; < mymtd->module = THIS_MODULE; --- > > if (machine_is_ipaq()) { /* for iPAQs only */ > for(i=0; i printk(KERN_NOTICE "IPAQ flash: probing %d-bit flash bus, window=%lx ... ", ipaq_map[i].buswidth*8, ipaq_map[i].map_priv_1); > my_sub_mtd[i] = do_map_probe("cfi_probe", &ipaq_map[i]); > if (!my_sub_mtd[i]) { > printk("not found\n"); > if (i) > break; > else > return -ENXIO; > } > else { > printk("found %ld bytes\n", my_sub_mtd[i]->size); > } > my_sub_mtd[i]->module = THIS_MODULE; > tot_flashsize += my_sub_mtd[i]->size; > } > #ifdef CONFIG_MTD_CONCAT > /* fix the asset location */ > h3xxx_partitions[1].size = tot_flashsize - 2 * 0x40000; > h3xxx_partitions[2].offset = tot_flashsize - 0x40000; > /* and concat the devices */ > mymtd = mtd_concat_create(&my_sub_mtd[0], i, > "iPAQ flash"); > if (!mymtd) { > printk("Cannot create iPAQ concat device\n"); > return -ENXIO; > } > #else > mymtd = my_sub_mtd[0]; > > h3xxx_partitions[1].size = my_sub_mtd[0]->size - 2 * 0x40000; > h3xxx_partitions[2].offset = my_sub_mtd[0]->size - 0x40000; > > h3xxx_partitions_bank2[0].size = my_sub_mtd[1]->size - 0x40000; > h3xxx_partitions_bank2[1].offset = my_sub_mtd[1]->size - 0x40000; > #endif > } > else { > /* > * Now let's probe for the actual flash. Do it here since > * specific machine settings might have been set above. > */ > printk(KERN_NOTICE "IPAQ flash: probing %d-bit flash bus, window=%lx\n", ipaq_map[0].buswidth*8, ipaq_map[0].map_priv_1); > mymtd = do_map_probe("cfi_probe", &ipaq_map[0]); > if (!mymtd) > return -ENXIO; > mymtd->module = THIS_MODULE; > } > 236,241c336,341 < int ret = parse_redboot_partitions(mymtd, &parsed_parts); < < if (ret > 0) { < part_type = "RedBoot"; < parsed_nr_parts = ret; < } --- > int ret = parse_redboot_partitions(mymtd, &parsed_parts); > > if (ret > 0) { > part_type = "RedBoot"; > parsed_nr_parts = ret; > } 246,250c346,350 < int ret = parse_cmdline_partitions(mymtd, &parsed_parts, "ipaq"); < if (ret > 0) { < part_type = "cmdline"; < parsed_nr_parts = ret; < } --- > int ret = parse_cmdline_partitions(mymtd, &parsed_parts, "ipaq"); > if (ret > 0) { > part_type = "cmdline"; > parsed_nr_parts = ret; > } 261a362,365 > #ifndef CONFIG_MTD_CONCAT > if (my_sub_mtd[1]) > add_mtd_device(my_sub_mtd[1]); > #endif 264a369,372 > #ifndef CONFIG_MTD_CONCAT > if (my_sub_mtd[1]) > add_mtd_partitions(my_sub_mtd[1], h3xxx_partitions_bank2, ARRAY_SIZE(h3xxx_partitions_bank2)); > #endif 265a374 > 270a380,381 > int i; > 272a384,387 > #ifndef CONFIG_MTD_CONCAT > if (my_sub_mtd[1]) > del_mtd_partitions(my_sub_mtd[1]); > #endif 273a389,397 > #ifdef CONFIG_MTD_CONCAT > for(i=0; i #else > for(i=1; i #endif > { > if (my_sub_mtd[i]) > map_destroy(my_sub_mtd[i]); > }