From: <far...@us...> - 2006-09-20 09:24:18
|
Revision: 570 http://svn.sourceforge.net/hackndev/?rev=570&view=rev Author: farcaller Date: 2006-09-20 02:24:07 -0700 (Wed, 20 Sep 2006) Log Message: ----------- palmt3: applied mtd autounlock patch (requires testing). changed mtd map (to use with midboot). Modified Paths: -------------- linux4palm/linux/trunk/drivers/mtd/chips/cfi_cmdset_0001.c linux4palm/linux/trunk/drivers/mtd/maps/palmt3-flash.c linux4palm/linux/trunk/drivers/mtd/mtdcore.c linux4palm/linux/trunk/drivers/mtd/mtdpart.c Modified: linux4palm/linux/trunk/drivers/mtd/chips/cfi_cmdset_0001.c =================================================================== --- linux4palm/linux/trunk/drivers/mtd/chips/cfi_cmdset_0001.c 2006-09-18 17:55:07 UTC (rev 569) +++ linux4palm/linux/trunk/drivers/mtd/chips/cfi_cmdset_0001.c 2006-09-20 09:24:07 UTC (rev 570) @@ -69,6 +69,7 @@ static int cfi_intelext_suspend (struct mtd_info *); static void cfi_intelext_resume (struct mtd_info *); static int cfi_intelext_reboot (struct notifier_block *, unsigned long, void *); +static void cfi_intelext_instantlock_add(struct mtd_info* mtd); static void cfi_intelext_destroy(struct mtd_info *); @@ -420,6 +421,7 @@ { struct map_info *map = mtd->priv; struct cfi_private *cfi = map->fldrv_priv; + struct cfi_pri_intelext *extp = cfi->cmdset_priv; unsigned long offset = 0; int i,j; unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave; @@ -474,6 +476,9 @@ mtd->get_user_prot_info = cfi_intelext_get_user_prot_info; #endif + if (extp && (extp->FeatureSupport & (1 << 5))) + mtd->notify_add = cfi_intelext_instantlock_add; + /* This function has the potential to distort the reality a bit and therefore should be called last. */ if (cfi_intelext_partition_fixup(mtd, &cfi) != 0) @@ -735,6 +740,8 @@ chip->oldstate = FL_ERASING; chip->state = FL_ERASE_SUSPENDING; chip->erase_suspended = 1; + printk(KERN_ERR "%s: timeouting\n", map->name); + ssleep(1); for (;;) { status = map_read(map, adr); if (map_word_andequal(map, status, status_OK, status_OK)) @@ -751,6 +758,7 @@ "suspended: status = 0x%lx\n", map->name, status.x[0]); return -EIO; } + printk(KERN_ERR "%s: Chip READY after erase\n", map->name); spin_unlock(chip->mutex); cfi_udelay(1); @@ -1808,6 +1816,7 @@ ret = -EINVAL; } else if (chipstatus & 0x02) { /* Protection bit set */ + printk(KERN_ERR "**protection bit set**\n"); ret = -EROFS; } else if (chipstatus & 0x8) { /* Voltage */ @@ -2307,6 +2316,28 @@ #endif +static void cfi_intelext_unlockall(struct mtd_info *mtd) +{ + int i; + + for (i = 0; i < mtd->numeraseregions; i++) { + int j; + + for (j = 0; j < mtd->eraseregions[i].numblocks; j++){ + mtd->unlock(mtd, mtd->eraseregions[i].offset + + j * mtd->eraseregions[i].erasesize, + mtd->eraseregions[i].erasesize); + } + } + +} + +static void cfi_intelext_instantlock_add(struct mtd_info *mtd) +{ + if (mtd->flags & MTD_WRITEABLE) + cfi_intelext_unlockall(mtd); +} + static int cfi_intelext_suspend(struct mtd_info *mtd) { struct map_info *map = mtd->priv; @@ -2380,6 +2411,7 @@ struct cfi_private *cfi = map->fldrv_priv; int i; struct flchip *chip; + struct cfi_pri_intelext *extp = cfi->cmdset_priv; for (i=0; i<cfi->numchips; i++) { @@ -2396,6 +2428,11 @@ spin_unlock(chip->mutex); } + + + if (extp && (extp->FeatureSupport & (1 << 5)) && + (mtd->flags & MTD_WRITEABLE)) + cfi_intelext_unlockall(mtd); } static int cfi_intelext_reset(struct mtd_info *mtd) Modified: linux4palm/linux/trunk/drivers/mtd/maps/palmt3-flash.c =================================================================== --- linux4palm/linux/trunk/drivers/mtd/maps/palmt3-flash.c 2006-09-18 17:55:07 UTC (rev 569) +++ linux4palm/linux/trunk/drivers/mtd/maps/palmt3-flash.c 2006-09-20 09:24:07 UTC (rev 570) @@ -42,18 +42,19 @@ .mask_flags = MTD_WRITEABLE, },{ .name = "BigROM", - .size = 0xf00000, // 16mb - 256kb(smallrom) - 256kb - 512kb + .size = 0xe00000, // 16mb - 256kb(smallrom) - 256kb - 512kb (14Mb) .offset = 0x40000, .mask_flags = MTD_WRITEABLE, },{ - .name = "lin256k", - .size = 0x40000, - .offset = 0xf40000, - },{ + .name = "lin", + .size = 1024*128, + .offset = 0xf00000, + } + /*,{ .name = "lin512k", .size = MTDPART_SIZ_FULL, .offset = MTDPART_OFS_APPEND, - } + }*/ }; #define NUM_PARTITIONS (sizeof(palmt3_partitions)/sizeof(palmt3_partitions[0])) @@ -97,8 +98,10 @@ part_type = "builtin"; } + printk(KERN_ERR "WARNING, FLASH PARTITION 2 (/dev/mtdblock2) WILL BE UNLOCKED FOR WRITES!\n"); - mymtd->unlock(mymtd, 0xf40000, 0x40000); + mymtd->unlock(mymtd, 0xf00000, 1024*128); + printk(KERN_INFO "Using %s partition table\n", part_type); add_mtd_partitions(mymtd, mtd_parts, nr_mtd_parts); Modified: linux4palm/linux/trunk/drivers/mtd/mtdcore.c =================================================================== --- linux4palm/linux/trunk/drivers/mtd/mtdcore.c 2006-09-18 17:55:07 UTC (rev 569) +++ linux4palm/linux/trunk/drivers/mtd/mtdcore.c 2006-09-20 09:24:07 UTC (rev 570) @@ -60,6 +60,10 @@ mtd->usecount = 0; DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name); + + if (mtd->notify_add) + mtd->notify_add(mtd); + /* No need to get a refcount on the module containing the notifier, since we hold the mtd_table_mutex */ list_for_each(this, &mtd_notifiers) { Modified: linux4palm/linux/trunk/drivers/mtd/mtdpart.c =================================================================== --- linux4palm/linux/trunk/drivers/mtd/mtdpart.c 2006-09-18 17:55:07 UTC (rev 569) +++ linux4palm/linux/trunk/drivers/mtd/mtdpart.c 2006-09-20 09:24:07 UTC (rev 570) @@ -435,6 +435,7 @@ slave->mtd.get_user_prot_info = part_get_user_prot_info; if(master->get_fact_prot_info) slave->mtd.get_fact_prot_info = part_get_fact_prot_info; + slave->mtd.notify_add = master->notify_add; if (master->sync) slave->mtd.sync = part_sync; if (!i && master->suspend && master->resume) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |