public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
@ 2009-11-05 14:53 Hans-Christian Egtvedt
  2009-11-05 18:23 ` Nicolas Pitre
  2009-11-11  7:57 ` Artem Bityutskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Hans-Christian Egtvedt @ 2009-11-05 14:53 UTC (permalink / raw)
  To: linux-mtd; +Cc: Hans-Christian Egtvedt, nico

This patch sets the MTD_POWERUP_LOCK flag for AT49BV640D and AT49BV640DT
devices, since the devices are locked when powered up and needs to be unlocked
before interfaced.

Quote datasheet; "At power-up and reset, all sectors have their Softlock
protection mode enabled.".

Tested on AVR32 hardware platform with an AT49BV640D flash device.

Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
---
Changes in v2:
 moved fixup_at49bv640dx_lock to cfi_fixup_table.
 also set the FeatureSupport bit for protection bits in cfi_pri_intelext

 drivers/mtd/chips/cfi_cmdset_0001.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index e7563a9..31e9c43 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -51,7 +51,9 @@
 #define M50LPW080       0x002F
 #define M50FLW080A	0x0080
 #define M50FLW080B	0x0081
+/* Atmel chips */
 #define AT49BV640D	0x02de
+#define AT49BV640DT	0x02db
 
 static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -199,6 +201,16 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
 	cfi->cfiq->BufWriteTimeoutMax = 0;
 }
 
+static void fixup_at49bv640dx_lock(struct mtd_info *mtd, void *param)
+{
+	struct map_info *map = mtd->priv;
+	struct cfi_private *cfi = map->fldrv_priv;
+	struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
+
+	cfip->FeatureSupport |= (1 << 5);
+	mtd->flags |= MTD_POWERUP_LOCK;
+}
+
 #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
 /* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
 static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
@@ -283,6 +295,8 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd, void *param)
 
 static struct cfi_fixup cfi_fixup_table[] = {
 	{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
+	{ CFI_MFR_ATMEL, AT49BV640D, fixup_at49bv640dx_lock, NULL },
+	{ CFI_MFR_ATMEL, AT49BV640DT, fixup_at49bv640dx_lock, NULL },
 #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
 	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
 #endif
-- 
1.6.0.4

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

* Re: [PATCH v2] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
  2009-11-05 14:53 [PATCH v2] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips Hans-Christian Egtvedt
@ 2009-11-05 18:23 ` Nicolas Pitre
  2009-11-11  7:57 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Pitre @ 2009-11-05 18:23 UTC (permalink / raw)
  To: Hans-Christian Egtvedt; +Cc: linux-mtd

On Thu, 5 Nov 2009, Hans-Christian Egtvedt wrote:

> This patch sets the MTD_POWERUP_LOCK flag for AT49BV640D and AT49BV640DT
> devices, since the devices are locked when powered up and needs to be unlocked
> before interfaced.
> 
> Quote datasheet; "At power-up and reset, all sectors have their Softlock
> protection mode enabled.".
> 
> Tested on AVR32 hardware platform with an AT49BV640D flash device.
> 
> Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>

Acked-by: Nicolas Pitre <nico@fluxnic.net>


> ---
> Changes in v2:
>  moved fixup_at49bv640dx_lock to cfi_fixup_table.
>  also set the FeatureSupport bit for protection bits in cfi_pri_intelext
> 
>  drivers/mtd/chips/cfi_cmdset_0001.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
> index e7563a9..31e9c43 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0001.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0001.c
> @@ -51,7 +51,9 @@
>  #define M50LPW080       0x002F
>  #define M50FLW080A	0x0080
>  #define M50FLW080B	0x0081
> +/* Atmel chips */
>  #define AT49BV640D	0x02de
> +#define AT49BV640DT	0x02db
>  
>  static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
>  static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
> @@ -199,6 +201,16 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
>  	cfi->cfiq->BufWriteTimeoutMax = 0;
>  }
>  
> +static void fixup_at49bv640dx_lock(struct mtd_info *mtd, void *param)
> +{
> +	struct map_info *map = mtd->priv;
> +	struct cfi_private *cfi = map->fldrv_priv;
> +	struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
> +
> +	cfip->FeatureSupport |= (1 << 5);
> +	mtd->flags |= MTD_POWERUP_LOCK;
> +}
> +
>  #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
>  /* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
>  static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
> @@ -283,6 +295,8 @@ static void fixup_unlock_powerup_lock(struct mtd_info *mtd, void *param)
>  
>  static struct cfi_fixup cfi_fixup_table[] = {
>  	{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
> +	{ CFI_MFR_ATMEL, AT49BV640D, fixup_at49bv640dx_lock, NULL },
> +	{ CFI_MFR_ATMEL, AT49BV640DT, fixup_at49bv640dx_lock, NULL },
>  #ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
>  	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
>  #endif
> -- 
> 1.6.0.4
> 

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

* Re: [PATCH v2] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
  2009-11-05 14:53 [PATCH v2] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips Hans-Christian Egtvedt
  2009-11-05 18:23 ` Nicolas Pitre
@ 2009-11-11  7:57 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2009-11-11  7:57 UTC (permalink / raw)
  To: Hans-Christian Egtvedt; +Cc: linux-mtd, nico

On Thu, 2009-11-05 at 15:53 +0100, Hans-Christian Egtvedt wrote:
> This patch sets the MTD_POWERUP_LOCK flag for AT49BV640D and AT49BV640DT
> devices, since the devices are locked when powered up and needs to be unlocked
> before interfaced.
> 
> Quote datasheet; "At power-up and reset, all sectors have their Softlock
> protection mode enabled.".
> 
> Tested on AVR32 hardware platform with an AT49BV640D flash device.
> 
> Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>

Applied to my l2-mtd-2.6 tree, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

end of thread, other threads:[~2009-11-11  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-05 14:53 [PATCH v2] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips Hans-Christian Egtvedt
2009-11-05 18:23 ` Nicolas Pitre
2009-11-11  7:57 ` Artem Bityutskiy

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