From patchwork Fri Dec 16 12:59:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LECERF X-Patchwork-Id: 131822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 229041007D7 for ; Sat, 17 Dec 2011 00:00:59 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RbXNo-00084X-2L; Fri, 16 Dec 2011 12:59:28 +0000 Received: from mail-vx0-f177.google.com ([209.85.220.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RbXNl-00083j-56 for linux-mtd@lists.infradead.org; Fri, 16 Dec 2011 12:59:26 +0000 Received: by vcbf11 with SMTP id f11so1932696vcb.36 for ; Fri, 16 Dec 2011 04:59:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=EE+7BbAvDGjTyinSAxDaIMkjEQPFUOeq8vkyJA0QZQ4=; b=rdXfpJTvsYitXvnLVfMw6dpJduR/Sn6o+Y64OmTuURFpEmLWh2kOMtleUwJ0O7I5lv OuCuhkbEwhI1LdNPV0uuzbIe498cAMpePs28zSpSc0iLcS8ZFmj7bFtV790Uol12is7E Q840OaGqjjL/jJwoj3jQM1QBp9D1OlV16PaM8= Received: by 10.220.225.70 with SMTP id ir6mr2921484vcb.25.1324040363186; Fri, 16 Dec 2011 04:59:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.52.182.98 with HTTP; Fri, 16 Dec 2011 04:59:02 -0800 (PST) In-Reply-To: <4E98021F.1060200@gmail.com> References: <4E8977DF.1030808@gmail.com> <1318581933.12351.70.camel@sauron> <4E97F7C2.1050803@gmail.com> <1318583721.12351.80.camel@sauron> <4E98021F.1060200@gmail.com> From: Guillaume LECERF Date: Fri, 16 Dec 2011 13:59:02 +0100 X-Google-Sender-Auth: -D5N_59DNjUtGdjei9oycupheyo Message-ID: Subject: Re: erase block < 8KiB To: angelo X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (glecerf[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: "linux-mtd@lists.infradead.org" X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 2011/10/14 angelo : > 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 ? Use block instead of sector erase for some SST chips From: Guillaume LECERF 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 --- 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