linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: Guillaume LECERF <glecerf@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH v2 6/7] mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{16, 32}xx chips
Date: Thu, 8 Apr 2010 11:12:15 +0200	[thread overview]
Message-ID: <20100408091215.GD21805@pengutronix.de> (raw)
In-Reply-To: <20100330133513.20107.72328.stgit@shiryu.yomgui.biz>

[-- Attachment #1: Type: text/plain, Size: 4065 bytes --]

On Tue, Mar 30, 2010 at 03:35:13PM +0200, Guillaume LECERF wrote:
> SST 39VF{16,32}xx chips use the 0x0701 command set, fully compatible
> with the AMD one. This patch adds support for detecting them in CFI
> mode.
> 
> Based on a patch by Peter Turczaki [1].
> 
> [1] http://www.mail-archive.com/uclinux-dev@uclinux.org/msg05737.html
> 
> Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
> ---
>  drivers/mtd/chips/cfi_cmdset_0002.c |   41 +++++++++++++++++++++++++++++++++++
>  drivers/mtd/chips/gen_probe.c       |    1 +
>  2 files changed, 42 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index de1b4ba..e3e4a94 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -256,6 +256,36 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
>  	mtd->flags |= MTD_POWERUP_LOCK;
>  }
>  
> +/** While reporting a mostly-correct CFI-Information block
> +  * the eraseblock-region information is severely damaged in SST
> +  * parts at least those of the 39VF{16,32,64}xxB series.
> +  **/

Kernel mulit line comments, please.

> +static void fixup_old_sst_eraseregion(struct mtd_info *mtd)
> +{
> +	struct map_info *map = mtd->priv;
> +	struct cfi_private *cfi = map->fldrv_priv;
> +
> +	/** Although the part claims to have two eraseblock-regions
> +	  * these refer to the same region within the flash-array.
> +	  * Because a really CFI-Compliant part may only return

s/Compliant/compliant/?

> +	  * one eraseblock-length per physical memory region
> +	  * we pretend the part said it had just one region ;)
> +	  **/
> +	cfi->cfiq->NumEraseRegions = 1;
> +	cfi->cfiq->EraseRegionInfo[0] = cfi->cfiq->EraseRegionInfo[1];

Why is this last line needed? The comment says they are the same?

> +}
> +
> +static void fixup_sst39vf(struct mtd_info *mtd, void *param)
> +{
> +	struct map_info *map = mtd->priv;
> +	struct cfi_private *cfi = map->fldrv_priv;
> +
> +	fixup_old_sst_eraseregion(mtd);
> +
> +	cfi->addr_unlock1 = 0x5555;
> +	cfi->addr_unlock2 = 0x2AAA;
> +}
> +
>  static void fixup_s29gl064n_sectors(struct mtd_info *mtd, void *param)
>  {
>  	struct map_info *map = mtd->priv;
> @@ -278,6 +308,16 @@ static void fixup_s29gl032n_sectors(struct mtd_info *mtd, void *param)
>  	}
>  }
>  
> +/* Used to fix CFI-Tables of chips without Extended Query Tables
> + */
> +static struct cfi_fixup cfi_nopri_fixup_table[] = {
> +	{ CFI_MFR_SST, 0x234A, fixup_sst39vf, NULL, }, // SST39VF1602
> +	{ CFI_MFR_SST, 0x234B, fixup_sst39vf, NULL, }, // SST39VF1601
> +	{ CFI_MFR_SST, 0x235A, fixup_sst39vf, NULL, }, // SST39VF3202
> +	{ CFI_MFR_SST, 0x235B, fixup_sst39vf, NULL, }, // SST39VF3201
> +	{ 0, 0, NULL, NULL }
> +};
> +
>  static struct cfi_fixup cfi_fixup_table[] = {
>  	{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
>  #ifdef AMD_BOOTLOC_BUG
> @@ -408,6 +448,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
>  			cfi->addr_unlock1 = 0x555;
>  			cfi->addr_unlock2 = 0x2aa;
>  		}
> +		cfi_fixup(mtd, cfi_nopri_fixup_table);
>  
>  		if (!cfi->addr_unlock1 || !cfi->addr_unlock2) {
>  			kfree(mtd);
> diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c
> index 991c457..599c259 100644
> --- a/drivers/mtd/chips/gen_probe.c
> +++ b/drivers/mtd/chips/gen_probe.c
> @@ -249,6 +249,7 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
>  #endif
>  #ifdef CONFIG_MTD_CFI_AMDSTD
>  	case P_ID_AMD_STD:
> +	case P_ID_SST_OLD:
>  		return cfi_cmdset_0002(map, primary);
>  #endif
>  #ifdef CONFIG_MTD_CFI_STAA
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2010-04-08  9:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 13:34 [PATCH v2 1/7] mtd: cfi_probe: enter Auto Select Mode after filling cfi->cfiq members Guillaume LECERF
2010-03-30 13:34 ` [PATCH v2 2/7] mtd: cfi_probe: make the addresses used to enter Auto Select Mode variable Guillaume LECERF
2010-03-30 13:34 ` [PATCH v2 3/7] mtd: cfi_probe: add support for SST 0x0701 vendorname Guillaume LECERF
2010-04-08  9:05   ` Wolfram Sang
2010-04-12  3:36     ` Wolfram Sang
2010-03-30 13:35 ` [PATCH v2 4/7] mtd: cfi_probe: use P_ID_* definitions instead of hardcoded values Guillaume LECERF
2010-03-30 13:35 ` [PATCH v2 5/7] mtd: cfi_cmdset_0002: do not fail on no extended query table as they are both optional Guillaume LECERF
2010-03-30 13:35 ` [PATCH v2 6/7] mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{16, 32}xx chips Guillaume LECERF
2010-04-08  9:12   ` Wolfram Sang [this message]
2010-04-12  2:24     ` Wolfram Sang
2010-04-12 16:28       ` Fabio Giovagnini
2010-04-13  0:27         ` Wolfram Sang
2010-04-16 10:17       ` Guillaume LECERF
2010-04-18 23:29         ` Wolfram Sang
2010-04-20  9:44           ` Guillaume LECERF
2010-04-22  6:13             ` Wolfram Sang
2010-04-08 15:21   ` Wolfram Sang
2010-04-08 15:32     ` Guillaume LECERF
2010-04-09  8:55       ` Wolfram Sang
2010-03-30 13:35 ` [PATCH v2 7/7] mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{32, 64}xxB chips Guillaume LECERF
2010-03-31 13:28 ` [PATCH v2 1/7] mtd: cfi_probe: enter Auto Select Mode after filling cfi->cfiq members Artem Bityutskiy
2010-04-02 11:46   ` Guillaume LECERF
2010-04-02 12:11     ` Artem Bityutskiy
2010-04-08  8:59 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100408091215.GD21805@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=glecerf@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).