summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorwdenk <wdenk>2005-05-16 15:23:22 +0000
committerwdenk <wdenk>2005-05-16 15:23:22 +0000
commit7680c140af9cac62c834f30d2d3c1479723ced69 (patch)
tree5f315fe7db8e19fabd9034f6f8e44a0ba440b207 /drivers
parentc01766307c1140955b71a9a842d742ee6478bd24 (diff)
downloadblackbird-obmc-uboot-7680c140af9cac62c834f30d2d3c1479723ced69.tar.gz
blackbird-obmc-uboot-7680c140af9cac62c834f30d2d3c1479723ced69.zip
Add PCI support for Sorcery board.
Code cleanup (especially Sorcery / Alaska / Yukon serial driver).
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cfi_flash.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
index 2531e9da86..d8489d46c0 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/cfi_flash.c
@@ -189,6 +189,7 @@ static ulong flash_get_size (ulong base, int banknum);
static int flash_write_cfiword (flash_info_t * info, ulong dest, cfiword_t cword);
static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
ulong tout, char *prompt);
+static flash_info_t *flash_get_info(ulong base);
#ifdef CFG_FLASH_USE_BUFFER_WRITE
static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, int len);
#endif
@@ -341,8 +342,8 @@ unsigned long flash_init (void)
#if (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
flash_protect (FLAG_PROTECT_SET,
CFG_MONITOR_BASE,
- CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
- &flash_info[0]);
+ CFG_MONITOR_BASE + monitor_flash_len - 1,
+ flash_get_info(CFG_MONITOR_BASE));
#endif
/* Environment protection ON by default */
@@ -350,7 +351,7 @@ unsigned long flash_init (void)
flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR,
CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
- &flash_info[0]);
+ flash_get_info(CFG_ENV_ADDR));
#endif
/* Redundant environment protection ON by default */
@@ -358,13 +359,30 @@ unsigned long flash_init (void)
flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR_REDUND,
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
- &flash_info[0]);
+ flash_get_info(CFG_ENV_ADDR_REDUND));
#endif
return (size);
}
/*-----------------------------------------------------------------------
*/
+static flash_info_t *flash_get_info(ulong base)
+{
+ int i;
+ flash_info_t * info;
+
+ for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) {
+ info = & flash_info[i];
+ if (info->size && info->start[0] <= base &&
+ base <= info->start[0] + info->size - 1)
+ break;
+ }
+
+ return i == CFG_MAX_FLASH_BANKS ? 0 : info;
+}
+
+/*-----------------------------------------------------------------------
+ */
int flash_erase (flash_info_t * info, int s_first, int s_last)
{
int rcode = 0;
OpenPOWER on IntegriCloud