From: timur at freescale.com <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Where does U-Boot's CFI driver check for top/bottom boot?
Date: Mon, 6 Nov 2006 17:46:52 -0600 [thread overview]
Message-ID: <11628568123033-git-send-email-timur@freescale.com> (raw)
From: Timur Tabi <timur@freescale.com>
This patch adds support for the reversed geometry data in some AMD flash
chips.
I'm not proud of this patch, so I'm posting it for review only. I know it
works on the my board that was the problem, but I have no idea if it will
break any other board. I'm sure this code could be improved a lot.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
drivers/cfi_flash.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
index fd0a186..8cc8d60 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/cfi_flash.c
@@ -1120,6 +1120,7 @@ ulong flash_get_size (ulong base, int ba
uchar num_erase_regions;
int erase_region_size;
int erase_region_count;
+ int geometry_reversed = 0;
#ifdef CFG_FLASH_PROTECTION
int ext_addr;
info->legacy_unlock = 0;
@@ -1148,6 +1149,8 @@ #endif
case CFI_CMDSET_AMD_STANDARD:
case CFI_CMDSET_AMD_EXTENDED:
info->cmd_reset = AMD_CMD_RESET;
+ if (flash_read_uchar(info, FLASH_OFFSET_CFI_RESP + (0x7E / info->portwidth)) == 3)
+ geometry_reversed = 1;
break;
}
@@ -1171,8 +1174,13 @@ #endif
num_erase_regions, NUM_ERASE_REGIONS);
break;
}
- tmp = flash_read_long (info, 0,
+ if (geometry_reversed)
+ tmp = flash_read_long (info, 0,
FLASH_OFFSET_ERASE_REGIONS +
+ (num_erase_regions - 1 - i) * 4);
+ else
+ tmp = flash_read_long (info, 0,
+ FLASH_OFFSET_ERASE_REGIONS +
i * 4);
erase_region_size =
(tmp & 0xffff) ? ((tmp & 0xffff) * 256) : 128;
--
1.4.2.1
next reply other threads:[~2006-11-06 23:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-06 23:46 timur at freescale.com [this message]
2006-11-07 0:51 ` [U-Boot-Users] [PATCH] Where does U-Boot's CFI driver check for top/bottom boot? Tolunay Orkun
2006-11-07 1:09 ` [U-Boot-Users] [PATCH] Where does U-Boot's CFI driver check fortop/bottom boot? Spence Nick-rxtd10
2006-11-07 10:57 ` [U-Boot-Users] [PATCH] Where does U-Boot's CFI driver check for top/bottom boot? Tolunay Orkun
2006-11-07 17:24 ` Timur Tabi
2006-11-07 18:01 ` Tolunay Orkun
2006-11-07 18:16 ` Stefan Roese
2006-11-07 23:05 ` Tolunay Orkun
2006-11-07 23:19 ` Tolunay Orkun
2006-11-07 17:50 ` Spence Nick-rxtd10
2006-11-07 18:14 ` Tolunay Orkun
2006-11-07 18:38 ` Timur Tabi
2006-11-07 18:46 ` Stefan Roese
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=11628568123033-git-send-email-timur@freescale.com \
--to=timur@freescale.com \
--cc=u-boot@lists.denx.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 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.