public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: cfi_cmdset_0002: fix sector erase command for AM29LV040B
@ 2011-02-10 21:04 Antony Pavlov
  2011-02-10 21:41 ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Antony Pavlov @ 2011-02-10 21:04 UTC (permalink / raw)
  To: dwmw2; +Cc: Antony Pavlov, linux-mtd, linux-kernel

The AM29LV040B chips use 0x50 as sector erase command instead of 0x30 [1].

[1] http://www.datasheetcatalog.com/datasheets_pdf/A/M/2/9/AM29LV040B.shtml

Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
---
 drivers/mtd/chips/cfi_cmdset_0002.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index f072fcf..a401dbe 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -332,6 +332,14 @@ static void fixup_s29gl032n_sectors(struct mtd_info *mtd)
 	}
 }
 
+static void fixup_use_sector_erase_cmd_30(struct mtd_info *mtd)
+{
+	struct map_info *map = mtd->priv;
+	struct cfi_private *cfi = map->fldrv_priv;
+
+	cfi->sector_erase_cmd = CMD(0x30);
+}
+
 /* 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 }, /* SST39VF1602 */
@@ -374,6 +382,7 @@ static struct cfi_fixup jedec_fixup_table[] = {
 	{ CFI_MFR_SST, SST49LF004B, fixup_use_fwh_lock },
 	{ CFI_MFR_SST, SST49LF040B, fixup_use_fwh_lock },
 	{ CFI_MFR_SST, SST49LF008A, fixup_use_fwh_lock },
+	{ CFI_MFR_AMD, 0x004F, fixup_use_sector_erase_cmd_30 }, /* AM29LV040B */
 	{ 0, 0, NULL }
 };
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: cfi_cmdset_0002: fix sector erase command for AM29LV040B
  2011-02-10 21:04 [PATCH] mtd: cfi_cmdset_0002: fix sector erase command for AM29LV040B Antony Pavlov
@ 2011-02-10 21:41 ` Wolfram Sang
  2011-02-11 10:00   ` Antony N. Pavlov
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2011-02-10 21:41 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: linux-mtd, dwmw2, linux-kernel

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

On Fri, Feb 11, 2011 at 12:04:37AM +0300, Antony Pavlov wrote:
> The AM29LV040B chips use 0x50 as sector erase command instead of 0x30 [1].
> 
> [1] http://www.datasheetcatalog.com/datasheets_pdf/A/M/2/9/AM29LV040B.shtml

I am confused. The datasheet says on page 15 it uses 0x30 while your
description above says it uses 0x50...

> Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
> ---
>  drivers/mtd/chips/cfi_cmdset_0002.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> index f072fcf..a401dbe 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> @@ -332,6 +332,14 @@ static void fixup_s29gl032n_sectors(struct mtd_info *mtd)
>  	}
>  }
>  
> +static void fixup_use_sector_erase_cmd_30(struct mtd_info *mtd)
> +{
> +	struct map_info *map = mtd->priv;
> +	struct cfi_private *cfi = map->fldrv_priv;
> +
> +	cfi->sector_erase_cmd = CMD(0x30);

... but here you change it to 0x30 (which is the default) instead of 0x50?

Please clarify,

   Wolfram

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: cfi_cmdset_0002: fix sector erase command for AM29LV040B
  2011-02-10 21:41 ` Wolfram Sang
@ 2011-02-11 10:00   ` Antony N. Pavlov
  0 siblings, 0 replies; 3+ messages in thread
From: Antony N. Pavlov @ 2011-02-11 10:00 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mtd, dwmw2, linux-kernel

On Thu, 10 Feb 2011 22:41:31 +0100
Wolfram Sang <w.sang@pengutronix.de> wrote:

Thank you for your quick response.

> On Fri, Feb 11, 2011 at 12:04:37AM +0300, Antony Pavlov wrote:
> > The AM29LV040B chips use 0x50 as sector erase command instead of 0x30 [1].
> > 
> > [1] http://www.datasheetcatalog.com/datasheets_pdf/A/M/2/9/AM29LV040B.shtml
> 
> I am confused. The datasheet says on page 15 it uses 0x30 while your
> description above says it uses 0x50...

It is my mistake! Of course it uses 0x30.

> > Signed-off-by: Antony Pavlov <antony@niisi.msk.ru>
> > ---
> >  drivers/mtd/chips/cfi_cmdset_0002.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
> > index f072fcf..a401dbe 100644
> > --- a/drivers/mtd/chips/cfi_cmdset_0002.c
> > +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
> > @@ -332,6 +332,14 @@ static void fixup_s29gl032n_sectors(struct mtd_info *mtd)
> >  	}
> >  }
> >  
> > +static void fixup_use_sector_erase_cmd_30(struct mtd_info *mtd)
> > +{
> > +	struct map_info *map = mtd->priv;
> > +	struct cfi_private *cfi = map->fldrv_priv;
> > +
> > +	cfi->sector_erase_cmd = CMD(0x30);
> cfi_chip_setup
> ... but here you change it to 0x30 (which is the default) instead of 0x50?
> 

In the commit 08968041bef437ec363623cd3218c2b083537ada
 (mtd: cfi_cmdset_0002: make sector erase command variable)
introdused field sector_erase_cmd. In this commit initialisation
of cfi->sector_erase_cmd made in cfi_chip_setup()
(file drivers/mtd/chips/cfi_probe.c), so the CFI chip has no problem:

...
        cfi->cfi_mode = CFI_MODE_CFI;
        cfi->sector_erase_cmd = CMD(0x30);
...

But for the JEDEC chips this initialisation is not carried out.
In my case (AM29LV040B) I have sector_erase_cmd == 0.

I shall send the patch in a few seconds.

-- 
Best regards,
  Antony Pavlov

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-11  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10 21:04 [PATCH] mtd: cfi_cmdset_0002: fix sector erase command for AM29LV040B Antony Pavlov
2011-02-10 21:41 ` Wolfram Sang
2011-02-11 10:00   ` Antony N. Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox