erase block < 8KiB
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
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:
Quoted 34 lines
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.htmlI 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,
RegardsAngelo Dureghello
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 8 lines
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
Quoted 20 lines · angelo
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.htmlI 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.
Quoted 5 lines
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.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 22 lines · Artem Bityutskiy
Quoted 20 lines · angelo
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.htmlI 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.
Quoted 10 lines
Quoted 6 lines
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
Quoted 6 lines · angelo
I already done this, and posted the patch for 64 KB sector.
But i none here still answered to the question :
why thecfi_cmdset_0002selects 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.
Signature · 2 lines
Best Regards, Artem Bityutskiy
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
Quoted 13 lines · Artem Bityutskiy
Quoted 7 lines · angelo
I already done this, and posted the patch for 64 KB sector.
But i none here still answered to the question :
why thecfi_cmdset_0002selects 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.
2011/10/14 angelo <[email protected]>:
Quoted 8 lines
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.
Quoted 8 lines
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 ?
Signature · 2 lines
Guillaume LECERF OpenBricks developer - www.openbricks.org
Use block instead of sector erase for some SST chips
From: Guillaume LECERF <[email protected]>
Use block erase size and block erase command for SST chips, making JFFS happy with a 64KiB sector size instead of 4/8 KiB
--- drivers/mtd/chips/cfi_cmdset_0002.c | 38 ++++++++++++++--------------------- 1 files changed, 15 insertions(+), 23 deletions(-)
drivers/mtd/chips/cfi_cmdset_0002.c +15 -23
@@ -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