mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Eric Bénard" <eric@eukrea.com>
To: s.hauer@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: [PATCH] cfi_flash_intel: support 1024b buffer write
Date: Fri, 30 Jul 2010 11:49:55 +0200	[thread overview]
Message-ID: <1280483395-9043-1-git-send-email-eric@eukrea.com> (raw)

newer Numonyx Strataflash P3x have 1024b buffer, thus, it's possible
to write a buffer size of 0x200 which the actual flash_write_cmd
doesn't permit as it's limited to a uchar parameter.

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 drivers/nor/cfi_flash.c       |   11 +++++++++++
 drivers/nor/cfi_flash.h       |    1 +
 drivers/nor/cfi_flash_intel.c |    5 ++++-
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index fa5e5ee..6f45da6 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -886,6 +886,17 @@ void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, u
 	flash_write_word(info, cword, addr);
 }
 
+void flash_write_cmd16 (struct flash_info *info, flash_sect_t sect, uint offset, ushort cmd)
+{
+
+	uchar *addr;
+	cfiword_t cword;
+
+	addr = flash_make_addr (info, sect, offset);
+	cword.w = cmd;
+	flash_write_word(info, cword, addr);
+}
+
 int flash_isequal (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd)
 {
 	cfiptr_t cptr;
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index 057e56c..d7e6ea2 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -189,6 +189,7 @@ extern struct cfi_cmd_set cfi_cmd_set_amd;
 
 int flash_isset (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
 void flash_write_cmd (struct flash_info *info, flash_sect_t sect, uint offset, uchar cmd);
+void flash_write_cmd16 (struct flash_info * info, flash_sect_t sect, uint offset, ushort cmd);
 flash_sect_t find_sector (struct flash_info *info, ulong addr);
 int flash_status_check (struct flash_info *info, flash_sect_t sector,
 			       uint64_t tout, char *prompt);
diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
index 4344760..96bf33f 100644
--- a/drivers/nor/cfi_flash_intel.c
+++ b/drivers/nor/cfi_flash_intel.c
@@ -71,7 +71,10 @@ static int intel_flash_write_cfibuffer (struct flash_info *info, ulong dest, con
 	/* reduce the number of loops by the width of the port	*/
 	cnt = len >> (info->portwidth - 1);
 
-	flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
+	if (cnt >= 0x100)
+		flash_write_cmd16 (info, sector, 0, (ushort) cnt - 1);
+	else
+		flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
 	while (cnt-- > 0) {
 		if (bankwidth_is_1(info)) {
 			*dst.cp++ = *src.cp++;
-- 
1.6.3.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2010-07-30  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30  9:49 Eric Bénard [this message]
2010-08-04  7:42 ` Sascha Hauer
2010-08-04  7:48   ` Eric Bénard
2010-08-04  8:00     ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2010-05-17 16:14 Eric Bénard
2010-05-17 16:19 ` Eric Bénard

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=1280483395-9043-1-git-send-email-eric@eukrea.com \
    --to=eric@eukrea.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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