mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: barebox@lists.infradead.org
Subject: [PATCH] CFI NOR flash: fix write timeout units.
Date: Sun, 16 Jan 2011 22:40:41 +0100	[thread overview]
Message-ID: <m362towmqu.fsf@intrepid.localdomain> (raw)

Write timeouts are expressed in microseconds. Milliseconds are 1000 times
longer than microseconds, not 1000 times shorter.

Before (Intel 28F128J3D75):

CFI conformant FLASH (16 x 16)  Size: 16 MB in 128 Sectors
  Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x18
  Erase timeout: 4096 ms, write timeout: 256000 ms
  Buffer write timeout: 1024000 ms, buffer size: 32 bytes

After:
  ...
  Erase timeout: 4096 ms, write timeout: 256 us
  Buffer write timeout: 1024 us, buffer size: 32 bytes

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>

diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 1118b6a..5768980 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -424,14 +424,12 @@ static ulong flash_get_size (struct flash_info *info, ulong base)
 		/* multiply the size by the number of chips */
 		info->size = (1 << qry.dev_size) * size_ratio;
 		info->buffer_size = (1 << le16_to_cpu(qry.max_buf_write_size));
-		tmp = 1 << qry.block_erase_timeout_typ;
-		info->erase_blk_tout = (tmp * (1 << qry.block_erase_timeout_max));
-		tmp = (1 << qry.buf_write_timeout_typ) *
-			(1 << qry.buf_write_timeout_max);
-		info->buffer_write_tout = tmp * 1000;
-		tmp = (1 << qry.word_write_timeout_typ) *
-		      (1 << qry.word_write_timeout_max);
-		info->write_tout = tmp * 1000;
+		info->erase_blk_tout = 1 << (qry.block_erase_timeout_typ +
+					     qry.block_erase_timeout_max);
+		info->buffer_write_tout = 1 << (qry.buf_write_timeout_typ +
+						qry.buf_write_timeout_max);
+		info->write_tout = 1 << (qry.word_write_timeout_typ +
+					 qry.word_write_timeout_max);
 		info->flash_id = FLASH_MAN_CFI;
 		if ((info->interface == FLASH_CFI_X8X16) && (info->chipwidth == FLASH_CFI_BY8)) {
 			info->portwidth >>= 1;	/* XXX - Need to test on x8/x16 in parallel. */
@@ -699,11 +697,11 @@ static void cfi_info (struct device_d* dev)
 	if (info->device_id == 0x7E) {
 		printf("%04X", info->device_id2);
 	}
-	printf ("\n  Erase timeout: %ld ms, write timeout: %ld ms\n",
+	printf ("\n  Erase timeout: %ld ms, write timeout: %ld us\n",
 		info->erase_blk_tout,
 		info->write_tout);
 	if (info->buffer_size > 1) {
-		printf ("  Buffer write timeout: %ld ms, buffer size: %d bytes\n",
+		printf ("  Buffer write timeout: %ld us, buffer size: %d bytes\n",
 		info->buffer_write_tout,
 		info->buffer_size);
 	}

-- 
Krzysztof Halasa

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

                 reply	other threads:[~2011-01-16 21:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m362towmqu.fsf@intrepid.localdomain \
    --to=khc@pm.waw.pl \
    --cc=barebox@lists.infradead.org \
    /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