public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot]  [PATCH] for JEDEC flash, command of word programing should  be issued relatvie to base
@ 2009-07-07  5:27 Po-Yu Chuang
  2009-07-08  9:26 ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: Po-Yu Chuang @ 2009-07-07  5:27 UTC (permalink / raw)
  To: u-boot

For JEDEC flash, we should issue word programming command relative to
base address rather than sector base address. Original source makes
SST Flash fails to program sectors which are not on the 0x10000 boundaries.

e.g.
SST39LF040 uses addr1=0x5555 and addr2=0x2AAA, however, each sector
is 0x1000 bytes.

Thus, if we issue command to "sector base (0x41000) + offset(0x5555)",
it sends to 0x46555 and the chip fails to recognize that address.

This patch is tested with SST39LF040.

Signed-off-by: Po-Yu Chuang <ratbert@faraday-tech.com>
---
 drivers/mtd/cfi_flash.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index d0732f5..81ac5d3 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -835,14 +835,19 @@ static int flash_write_cfiword (flash_info_t *
info, ulong dest,
 		break;
 	case CFI_CMDSET_AMD_EXTENDED:
 	case CFI_CMDSET_AMD_STANDARD:
-#ifdef CONFIG_FLASH_CFI_LEGACY
-	case CFI_CMDSET_AMD_LEGACY:
-#endif
 		sect = find_sector(info, dest);
 		flash_unlock_seq (info, sect);
 		flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE);
 		sect_found = 1;
 		break;
+#ifdef CONFIG_FLASH_CFI_LEGACY
+	case CFI_CMDSET_AMD_LEGACY:
+		sect = find_sector(info, dest);
+		flash_unlock_seq (info, 0);
+		flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE);
+		sect_found = 1;
+		break;
+#endif
 	}

 	switch (info->portwidth) {
-- 
1.6.3.3

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

* [U-Boot] [PATCH] for JEDEC flash, command of word programing should be issued relatvie to base
  2009-07-07  5:27 [U-Boot] [PATCH] for JEDEC flash, command of word programing should be issued relatvie to base Po-Yu Chuang
@ 2009-07-08  9:26 ` Stefan Roese
  2009-07-08  9:49   ` Po-Yu Chuang
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2009-07-08  9:26 UTC (permalink / raw)
  To: u-boot

On Tuesday 07 July 2009 07:27:35 Po-Yu Chuang wrote:
> For JEDEC flash, we should issue word programming command relative to
> base address rather than sector base address. Original source makes
> SST Flash fails to program sectors which are not on the 0x10000 boundaries.
>
> e.g.
> SST39LF040 uses addr1=0x5555 and addr2=0x2AAA, however, each sector
> is 0x1000 bytes.
>
> Thus, if we issue command to "sector base (0x41000) + offset(0x5555)",
> it sends to 0x46555 and the chip fails to recognize that address.
>
> This patch is tested with SST39LF040.
>
> Signed-off-by: Po-Yu Chuang <ratbert@faraday-tech.com>

This patch is line wrapped and can't be applied. Please fix and resubmit. And 
while at it please use a somewhat shorted subject.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

* [U-Boot] [PATCH] for JEDEC flash, command of word programing  should be issued relatvie to base
  2009-07-08  9:26 ` Stefan Roese
@ 2009-07-08  9:49   ` Po-Yu Chuang
  2009-07-08  9:54     ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: Po-Yu Chuang @ 2009-07-08  9:49 UTC (permalink / raw)
  To: u-boot

Dear Stefan Roese,

2009/7/8 Stefan Roese <sr@denx.de>:
> This patch is line wrapped and can't be applied. Please fix and resubmit. And
> while at it please use a somewhat shorted subject.

Sorry, I don't understand what does "line wrapped" mean.
The source is 80 chars width max.
or... Did I send the mail in dos format?

regards,
Po-Yu Chuang

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

* [U-Boot] [PATCH] for JEDEC flash, command of word programing should be issued relatvie to base
  2009-07-08  9:49   ` Po-Yu Chuang
@ 2009-07-08  9:54     ` Stefan Roese
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2009-07-08  9:54 UTC (permalink / raw)
  To: u-boot

On Wednesday 08 July 2009 11:49:35 Po-Yu Chuang wrote:
> > This patch is line wrapped and can't be applied. Please fix and resubmit.
> > And while at it please use a somewhat shorted subject.
>
> Sorry, I don't understand what does "line wrapped" mean.
> The source is 80 chars width max.
> or... Did I send the mail in dos format?

The problem is that you mail client wrapped too long lines into 2 lines. The
patch can't be applied then anymore. Here a problematic line:

@ -835,14 +835,19 @@ static int flash_write_cfiword (flash_info_t *
info, ulong dest,

This should be a single line. I suggest you send using git send-email.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

end of thread, other threads:[~2009-07-08  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07  5:27 [U-Boot] [PATCH] for JEDEC flash, command of word programing should be issued relatvie to base Po-Yu Chuang
2009-07-08  9:26 ` Stefan Roese
2009-07-08  9:49   ` Po-Yu Chuang
2009-07-08  9:54     ` Stefan Roese

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