All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
@ 2009-10-29 12:05 Hans-Christian Egtvedt
  2009-11-03  7:05 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Hans-Christian Egtvedt @ 2009-10-29 12:05 UTC (permalink / raw)
  To: linux-mtd; +Cc: Hans-Christian Egtvedt

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>
---
 drivers/mtd/chips/cfi_cmdset_0001.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index e7563a9..6228115 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -52,6 +52,7 @@
 #define M50FLW080A	0x0080
 #define M50FLW080B	0x0081
 #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 *);
@@ -255,6 +256,11 @@ static void fixup_use_point(struct mtd_info *mtd, void *param)
 	}
 }
 
+static void fixup_use_at49bv640dx_lock(struct mtd_info *mtd, void *param)
+{
+	mtd->flags |= MTD_POWERUP_LOCK;
+}
+
 static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
 {
 	struct map_info *map = mtd->priv;
@@ -313,6 +319,8 @@ static struct cfi_fixup fixup_table[] = {
 	 * we know that is the case.
 	 */
 	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_point, NULL },
+	{ CFI_MFR_ATMEL, AT49BV640D, fixup_use_at49bv640dx_lock, NULL },
+	{ CFI_MFR_ATMEL, AT49BV640DT, fixup_use_at49bv640dx_lock, NULL },
 	{ 0, 0, NULL, NULL }
 };
 
-- 
1.6.0.4

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

* Re: [PATCH] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
  2009-10-29 12:05 [PATCH] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips Hans-Christian Egtvedt
@ 2009-11-03  7:05 ` Artem Bityutskiy
  2009-11-03  7:44   ` Hans-Christian Egtvedt
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2009-11-03  7:05 UTC (permalink / raw)
  To: Hans-Christian Egtvedt; +Cc: linux-mtd

On Thu, 2009-10-29 at 13:05 +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>
> ---
>  drivers/mtd/chips/cfi_cmdset_0001.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
> index e7563a9..6228115 100644
> --- a/drivers/mtd/chips/cfi_cmdset_0001.c
> +++ b/drivers/mtd/chips/cfi_cmdset_0001.c
> @@ -52,6 +52,7 @@
>  #define M50FLW080A	0x0080
>  #define M50FLW080B	0x0081
>  #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 *);
> @@ -255,6 +256,11 @@ static void fixup_use_point(struct mtd_info *mtd, void *param)
>  	}
>  }
>  
> +static void fixup_use_at49bv640dx_lock(struct mtd_info *mtd, void *param)
> +{
> +	mtd->flags |= MTD_POWERUP_LOCK;
> +}
> +
>  static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
>  {
>  	struct map_info *map = mtd->priv;
> @@ -313,6 +319,8 @@ static struct cfi_fixup fixup_table[] = {
>  	 * we know that is the case.
>  	 */
>  	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_point, NULL },
> +	{ CFI_MFR_ATMEL, AT49BV640D, fixup_use_at49bv640dx_lock, NULL },
> +	{ CFI_MFR_ATMEL, AT49BV640DT, fixup_use_at49bv640dx_lock, NULL },
>  	{ 0, 0, NULL, NULL }
>  };

Why you add this to the fixup_table, not cfi_fixup_table?

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

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

* Re: [PATCH] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
  2009-11-03  7:05 ` Artem Bityutskiy
@ 2009-11-03  7:44   ` Hans-Christian Egtvedt
  2009-11-03  7:47     ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Hans-Christian Egtvedt @ 2009-11-03  7:44 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

On Tue, 03 Nov 2009 09:05:14 +0200
Artem Bityutskiy <dedekind1@gmail.com> wrote:

<snipp Atmel AT49BV640D(T) powerup lock fixup patch>

> >  static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
> >  {
> >  	struct map_info *map = mtd->priv;
> > @@ -313,6 +319,8 @@ static struct cfi_fixup fixup_table[] = {
> >  	 * we know that is the case.
> >  	 */
> >  	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_point, NULL },
> > +	{ CFI_MFR_ATMEL, AT49BV640D, fixup_use_at49bv640dx_lock, NULL },
> > +	{ CFI_MFR_ATMEL, AT49BV640DT, fixup_use_at49bv640dx_lock, NULL },
> >  	{ 0, 0, NULL, NULL }
> >  };
> 
> Why you add this to the fixup_table, not cfi_fixup_table?
> 

It would probably be more appropriate to place it after the first Atmel
fixup in the cfi_fixup_table, yes.

Really unsure why I ended up putting it in the fixup_table, because I
used the fixup_unlock_powerup_lock as reference.

It is probably more correct that I set the FeatureSupport 0x20 (32)
feature to indicate that the flash has "Instant block lock". I'll
submit a v2 for the latter unless you have some other feedback?

-- 
Best regards,
Hans-Christian Egtvedt

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

* Re: [PATCH] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips
  2009-11-03  7:44   ` Hans-Christian Egtvedt
@ 2009-11-03  7:47     ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2009-11-03  7:47 UTC (permalink / raw)
  To: Hans-Christian Egtvedt; +Cc: linux-mtd

On Tue, 2009-11-03 at 08:44 +0100, Hans-Christian Egtvedt wrote:
> On Tue, 03 Nov 2009 09:05:14 +0200
> Artem Bityutskiy <dedekind1@gmail.com> wrote:
> 
> <snipp Atmel AT49BV640D(T) powerup lock fixup patch>
> 
> > >  static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
> > >  {
> > >  	struct map_info *map = mtd->priv;
> > > @@ -313,6 +319,8 @@ static struct cfi_fixup fixup_table[] = {
> > >  	 * we know that is the case.
> > >  	 */
> > >  	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_point, NULL },
> > > +	{ CFI_MFR_ATMEL, AT49BV640D, fixup_use_at49bv640dx_lock, NULL },
> > > +	{ CFI_MFR_ATMEL, AT49BV640DT, fixup_use_at49bv640dx_lock, NULL },
> > >  	{ 0, 0, NULL, NULL }
> > >  };
> > 
> > Why you add this to the fixup_table, not cfi_fixup_table?
> > 
> 
> It would probably be more appropriate to place it after the first Atmel
> fixup in the cfi_fixup_table, yes.
> 
> Really unsure why I ended up putting it in the fixup_table, because I
> used the fixup_unlock_powerup_lock as reference.
> 
> It is probably more correct that I set the FeatureSupport 0x20 (32)
> feature to indicate that the flash has "Instant block lock". I'll
> submit a v2 for the latter unless you have some other feedback?

The only other feed-back would be to CC Nicolas Pitre <nico@fluxnic.net>
when you re-submit v2.

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

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-29 12:05 [PATCH] mtd: add lock fixup for AT49BV640D and AT49BV640DT chips Hans-Christian Egtvedt
2009-11-03  7:05 ` Artem Bityutskiy
2009-11-03  7:44   ` Hans-Christian Egtvedt
2009-11-03  7:47     ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.