* erase block < 8KiB @ 2011-10-03 8:52 angelo 2011-10-06 12:47 ` Fabio Giovagnini 2011-10-14 8:45 ` Artem Bityutskiy 0 siblings, 2 replies; 7+ messages in thread From: angelo @ 2011-10-03 8:52 UTC (permalink / raw) To: linux-mtd@lists.infradead.org Hi all, i read several mail about this limitation. http://lists.infradead.org/pipermail/linux-mtd/2011-February/033851.html http://lists.infradead.org/pipermail/linux-mtd/2011-June/036498.html I have a 4 KiB erase-size, common of some SST nor flash'es like mine (SST 39VF3201B). From all the posts i read here in the list, there seems not to be any solution guaranteed. The tricky change to mkfs.jffs2 don't work for me. It seems to work for small files, but i still get error messages copying a 600KB file in the partition. If it's true that the minimal jffs2 block is 4KB + some bytes, of course the patch to mkfs.jffs2 can't work. Some one suggested the "virtual erase block" solution. I would like to try to implement it, if i have the time. In any case, for the common users, is there maybe another flash file system that can work with 4KiB erase size ? Many thanks, Regards Angelo Dureghello ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: erase block < 8KiB 2011-10-03 8:52 erase block < 8KiB angelo @ 2011-10-06 12:47 ` Fabio Giovagnini 2011-10-14 8:45 ` Artem Bityutskiy 1 sibling, 0 replies; 7+ messages in thread From: Fabio Giovagnini @ 2011-10-06 12:47 UTC (permalink / raw) To: angelo; +Cc: linux-mtd@lists.infradead.org I think the best solution is to modify mkfs.jffs2 tool. So your sectors are smaller and you flash better used. Regards Il giorno lun, 03/10/2011 alle 10.52 +0200, angelo ha scritto: > Hi all, > > i read several mail about this limitation. > > http://lists.infradead.org/pipermail/linux-mtd/2011-February/033851.html > http://lists.infradead.org/pipermail/linux-mtd/2011-June/036498.html > > > I have a 4 KiB erase-size, common of some SST nor flash'es like mine > (SST 39VF3201B). > > From all the posts i read here in the list, there seems not to be any > solution guaranteed. > > The tricky change to mkfs.jffs2 don't work for me. It seems to work for > small files, but i still get error messages copying a 600KB file in the > partition. > If it's true that the minimal jffs2 block is 4KB + some bytes, of course > the patch to mkfs.jffs2 can't work. > > Some one suggested the "virtual erase block" solution. I would like to > try to implement it, if i have the time. > > In any case, for the common users, is there maybe another flash file > system that can work with 4KiB erase size ? > > Many thanks, > Regards > > Angelo Dureghello > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ -- Fabio Giovagnini Aurion s.r.l. P.iva 00885711200 cell. +39.335.8350919 Tel. +39.051.594.78.24 Fax. +39 051.082.14.49 skype: aurion.giovagnini ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: erase block < 8KiB 2011-10-03 8:52 erase block < 8KiB angelo 2011-10-06 12:47 ` Fabio Giovagnini @ 2011-10-14 8:45 ` Artem Bityutskiy 2011-10-14 8:50 ` angelo 1 sibling, 1 reply; 7+ messages in thread From: Artem Bityutskiy @ 2011-10-14 8:45 UTC (permalink / raw) To: angelo; +Cc: linux-mtd@lists.infradead.org On Mon, 2011-10-03 at 10:52 +0200, angelo wrote: > Hi all, > > i read several mail about this limitation. > > http://lists.infradead.org/pipermail/linux-mtd/2011-February/033851.html > http://lists.infradead.org/pipermail/linux-mtd/2011-June/036498.html > > > I have a 4 KiB erase-size, common of some SST nor flash'es like mine > (SST 39VF3201B). > > From all the posts i read here in the list, there seems not to be any > solution guaranteed. > > The tricky change to mkfs.jffs2 don't work for me. It seems to work for > small files, but i still get error messages copying a 600KB file in the > partition. > If it's true that the minimal jffs2 block is 4KB + some bytes, of course > the patch to mkfs.jffs2 can't work. > > Some one suggested the "virtual erase block" solution. I would like to > try to implement it, if i have the time. > > In any case, for the common users, is there maybe another flash file > system that can work with 4KiB erase size ? Just hack your driver and make it emulate larger eraseblocks and make JFFS2 happy. Should not be difficult. -- Best Regards, Artem Bityutskiy ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: erase block < 8KiB 2011-10-14 8:45 ` Artem Bityutskiy @ 2011-10-14 8:50 ` angelo 2011-10-14 9:15 ` Artem Bityutskiy 0 siblings, 1 reply; 7+ messages in thread From: angelo @ 2011-10-14 8:50 UTC (permalink / raw) To: dedekind1; +Cc: linux-mtd@lists.infradead.org On 14/10/2011 10:45, Artem Bityutskiy wrote: > On Mon, 2011-10-03 at 10:52 +0200, angelo wrote: > >> Hi all, >> >> i read several mail about this limitation. >> >> http://lists.infradead.org/pipermail/linux-mtd/2011-February/033851.html >> http://lists.infradead.org/pipermail/linux-mtd/2011-June/036498.html >> >> >> I have a 4 KiB erase-size, common of some SST nor flash'es like mine >> (SST 39VF3201B). >> >> From all the posts i read here in the list, there seems not to be any >> solution guaranteed. >> >> The tricky change to mkfs.jffs2 don't work for me. It seems to work for >> small files, but i still get error messages copying a 600KB file in the >> partition. >> If it's true that the minimal jffs2 block is 4KB + some bytes, of course >> the patch to mkfs.jffs2 can't work. >> >> Some one suggested the "virtual erase block" solution. I would like to >> try to implement it, if i have the time. >> >> In any case, for the common users, is there maybe another flash file >> system that can work with 4KiB erase size ? >> > Just hack your driver and make it emulate larger eraseblocks and make > JFFS2 happy. Should not be difficult. > > I already done this, and posted the patch for 64 KB sector. But i none here still answered to the question : why the cfi_cmdset_0002 selects for this flash the 4KB sector instead of the 64KB ? In this way, the non-working of jffs2 is guaranteed, since the minimal block size is 4K + some bytes. regards. angelo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: erase block < 8KiB 2011-10-14 8:50 ` angelo @ 2011-10-14 9:15 ` Artem Bityutskiy 2011-10-14 9:34 ` angelo 0 siblings, 1 reply; 7+ messages in thread From: Artem Bityutskiy @ 2011-10-14 9:15 UTC (permalink / raw) To: angelo; +Cc: linux-mtd@lists.infradead.org On Fri, 2011-10-14 at 10:50 +0200, angelo wrote: > I already done this, and posted the patch for 64 KB sector. > > But i none here still answered to the question : > why the cfi_cmdset_0002 selects for this flash the 4KB sector instead of > the 64KB ? In this way, the non-working of jffs2 is guaranteed, since > the minimal block size is 4K + some bytes. I do not know CFI, sorry, but you probably should do this on a higher level than CFI, something between JFFS2 and MTD. -- Best Regards, Artem Bityutskiy ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: erase block < 8KiB 2011-10-14 9:15 ` Artem Bityutskiy @ 2011-10-14 9:34 ` angelo 2011-12-16 12:59 ` Guillaume LECERF 0 siblings, 1 reply; 7+ messages in thread From: angelo @ 2011-10-14 9:34 UTC (permalink / raw) To: linux-mtd@lists.infradead.org Hi Artem, i already managed my issue, this flash and jffs2 works perfect with a 64KB sector. There should be in the archive my patch posted. CFI driver actually do an operation called "fixup". It detect this flash, and know that this flash has 2 sector sizes, 4KB and 64KB. The fixup chose the 4KB as erasesize, so excluding the jffs2 usage. The patch to mkfs.jffs2 tool to allow the usage of 4KB erasesize works, but is not safe. If 4KB was not allowed, there was a reason. So i also tried to use some other FS, like logfs or UBIFS. But i couldn't easily port all the tools needed since i am in a "Coldfire" architecture and using uClinux for coldfire. So i decided to patch the erasesize to 64KB. At the end, who is interested can use it, the patch is very simple and is available searching the archive. Regards. angelo On 14/10/2011 11:15, Artem Bityutskiy wrote: > On Fri, 2011-10-14 at 10:50 +0200, angelo wrote: > >> I already done this, and posted the patch for 64 KB sector. >> >> But i none here still answered to the question : >> why the cfi_cmdset_0002 selects for this flash the 4KB sector instead of >> the 64KB ? In this way, the non-working of jffs2 is guaranteed, since >> the minimal block size is 4K + some bytes. >> > I do not know CFI, sorry, but you probably should do this on a higher > level than CFI, something between JFFS2 and MTD. > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: erase block < 8KiB 2011-10-14 9:34 ` angelo @ 2011-12-16 12:59 ` Guillaume LECERF 0 siblings, 0 replies; 7+ messages in thread From: Guillaume LECERF @ 2011-12-16 12:59 UTC (permalink / raw) To: angelo; +Cc: linux-mtd@lists.infradead.org [-- Attachment #1: Type: text/plain, Size: 928 bytes --] 2011/10/14 angelo <angelo70@gmail.com>: > Hi Artem, > i already managed my issue, this flash and jffs2 works perfect with a 64KB > sector. There should be in the archive my patch posted. > > CFI driver actually do an operation called "fixup". It detect this flash, > and know that this flash has 2 sector sizes, 4KB and 64KB. > The fixup chose the 4KB as erasesize, so excluding the jffs2 usage. > > The patch to mkfs.jffs2 tool to allow the usage of 4KB erasesize works, but > is not safe. > If 4KB was not allowed, there was a reason. > > So i also tried to use some other FS, like logfs or UBIFS. But i couldn't > easily port all the tools needed since i am in a "Coldfire" architecture and > using uClinux for coldfire. > So i decided to patch the erasesize to 64KB. Hi Angelo. Could you please test the attached patch, which uses block erase size/command ? -- Guillaume LECERF OpenBricks developer - www.openbricks.org [-- Attachment #2: sst-use-block-erase.patch --] [-- Type: text/x-patch, Size: 3292 bytes --] Use block instead of sector erase for some SST chips From: Guillaume LECERF <glecerf@gmail.com> Use block erase size and block erase command for SST chips, making JFFS happy with a 64KiB sector size instead of 4/8 KiB Signed-off-by: Guillaume LECERF <glecerf@gmail.com> --- drivers/mtd/chips/cfi_cmdset_0002.c | 38 ++++++++++++++--------------------- 1 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 8d70895..9a65aa7 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -261,10 +261,14 @@ static void fixup_old_sst_eraseregion(struct mtd_info *mtd) /* * These flashes report two separate eraseblock regions based on the - * sector_erase-size and block_erase-size, although they both operate on the - * same memory. This is not allowed according to CFI, so we just pick the - * sector_erase-size. + * sector_erase-size and block_erase-size, although they both operate on + * the same memory. + * This is not allowed according to CFI, so we should pick the + * sector_erase-size (4KiB). But the sector_erase-size is not adapted to + * JFFS2 for whom 4 KiB is too small. + * So just pick the block_erase-size (64KiB). */ + cfi->cfiq->EraseRegionInfo[0] = cfi->cfiq->EraseRegionInfo[1]; cfi->cfiq->NumEraseRegions = 1; } @@ -277,6 +281,9 @@ static void fixup_sst39vf(struct mtd_info *mtd) cfi->addr_unlock1 = 0x5555; cfi->addr_unlock2 = 0x2AAA; + + /* use block_erase_cmd (0x50) */ + cfi->sector_erase_cmd = CMD(0x50); } static void fixup_sst39vf_rev_b(struct mtd_info *mtd) @@ -289,22 +296,7 @@ static void fixup_sst39vf_rev_b(struct mtd_info *mtd) cfi->addr_unlock1 = 0x555; cfi->addr_unlock2 = 0x2AA; - cfi->sector_erase_cmd = CMD(0x50); -} - -static void fixup_sst38vf640x_sectorsize(struct mtd_info *mtd) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - - fixup_sst39vf_rev_b(mtd); - - /* - * CFI reports 1024 sectors (0x03ff+1) of 64KBytes (0x0100*256) where - * it should report a size of 8KBytes (0x0020*256). - */ - cfi->cfiq->EraseRegionInfo[0] = 0x002003ff; - pr_warning("%s: Bad 38VF640x CFI data; adjusting sector size from 64 to 8KiB\n", mtd->name); + /* sector_erase_cmd is already equals to block_erase_cmd (0x30) */ } static void fixup_s29gl064n_sectors(struct mtd_info *mtd) @@ -359,10 +351,10 @@ static struct cfi_fixup cfi_fixup_table[] = { { CFI_MFR_AMD, 0x1301, fixup_s29gl064n_sectors }, { CFI_MFR_AMD, 0x1a00, fixup_s29gl032n_sectors }, { CFI_MFR_AMD, 0x1a01, fixup_s29gl032n_sectors }, - { CFI_MFR_SST, 0x536a, fixup_sst38vf640x_sectorsize }, /* SST38VF6402 */ - { CFI_MFR_SST, 0x536b, fixup_sst38vf640x_sectorsize }, /* SST38VF6401 */ - { CFI_MFR_SST, 0x536c, fixup_sst38vf640x_sectorsize }, /* SST38VF6404 */ - { CFI_MFR_SST, 0x536d, fixup_sst38vf640x_sectorsize }, /* SST38VF6403 */ + { CFI_MFR_SST, 0x536a, fixup_sst39vf_rev_b }, /* SST38VF6402 */ + { CFI_MFR_SST, 0x536b, fixup_sst39vf_rev_b }, /* SST38VF6401 */ + { CFI_MFR_SST, 0x536c, fixup_sst39vf_rev_b }, /* SST38VF6404 */ + { CFI_MFR_SST, 0x536d, fixup_sst39vf_rev_b }, /* SST38VF6403 */ #if !FORCE_WORD_WRITE { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers }, #endif ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-16 12:59 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-03 8:52 erase block < 8KiB angelo 2011-10-06 12:47 ` Fabio Giovagnini 2011-10-14 8:45 ` Artem Bityutskiy 2011-10-14 8:50 ` angelo 2011-10-14 9:15 ` Artem Bityutskiy 2011-10-14 9:34 ` angelo 2011-12-16 12:59 ` Guillaume LECERF
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox