[U-Boot] [PATCH 4/7] DNS323 CFI driver changes (hacks, testing only)
rogan at dawes.za.net
rogan at dawes.za.net
Fri Mar 18 09:10:00 CET 2011
From: Rogan Dawes <rogan at dawes.za.net>
---
drivers/mtd/cfi_flash.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index dd394a8..74e9ade 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -291,6 +291,9 @@ static inline uchar flash_read_uchar (flash_info_t * info, uint offset)
uchar *cp;
uchar retval;
+#if 1 // test-only
+ offset = offset * 2;
+#endif
cp = flash_map (info, 0, offset);
#if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA)
retval = flash_read8(cp);
@@ -308,6 +311,9 @@ static inline ushort flash_read_word (flash_info_t * info, uint offset)
{
ushort *addr, retval;
+#if 1 // test-only
+ offset = offset * 2;
+#endif
addr = flash_map (info, 0, offset);
retval = flash_read16 (addr);
flash_unmap (info, 0, offset, addr);
@@ -328,6 +334,9 @@ static ulong flash_read_long (flash_info_t * info, flash_sect_t sect,
#ifdef DEBUG
int x;
#endif
+#if 1 // test-only
+ offset = offset * 2;
+#endif
addr = flash_map (info, sect, offset);
#ifdef DEBUG
@@ -363,6 +372,9 @@ void flash_write_cmd (flash_info_t * info, flash_sect_t sect,
void *addr;
cfiword_t cword;
+#if 1 // test-only
+ offset = offset * 2;
+#endif
addr = flash_map (info, sect, offset);
flash_make_cmd (info, cmd, &cword);
switch (info->portwidth) {
@@ -420,6 +432,9 @@ static int flash_isequal (flash_info_t * info, flash_sect_t sect,
cfiword_t cword;
int retval;
+#if 1 // test-only
+ offset = offset * 2;
+#endif
addr = flash_map (info, sect, offset);
flash_make_cmd (info, cmd, &cword);
@@ -1762,6 +1777,7 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry)
info->addr_unlock1 = 0x555;
info->addr_unlock2 = 0x2aa;
+#if 0 // test-only
/*
* modify the unlock address if we are
* in compatibility mode
@@ -1776,6 +1792,7 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry)
info->addr_unlock1 = 0xaaa;
info->addr_unlock2 = 0x555;
}
+#endif
info->name = "CFI conformant";
return 1;
@@ -1942,11 +1959,13 @@ ulong flash_get_size (phys_addr_t base, int banknum)
debug ("cfi version is 0x%04x\n", info->cfi_version);
size_ratio = info->portwidth / info->chipwidth;
+#if 0 // test-only
/* if the chip is x8/x16 reduce the ratio by half */
if ((info->interface == FLASH_CFI_X8X16)
&& (info->chipwidth == FLASH_CFI_BY8)) {
size_ratio >>= 1;
}
+#endif
debug ("size_ratio %d port %d bits chip %d bits\n",
size_ratio, info->portwidth << CFI_FLASH_SHIFT_WIDTH,
info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
@@ -2034,12 +2053,13 @@ ulong flash_get_size (phys_addr_t base, int banknum)
/* round up when converting to ms */
info->write_tout = (tmp + 999) / 1000;
info->flash_id = FLASH_MAN_CFI;
+#if 0
if ((info->interface == FLASH_CFI_X8X16) &&
(info->chipwidth == FLASH_CFI_BY8)) {
/* XXX - Need to test on x8/x16 in parallel. */
info->portwidth >>= 1;
}
-
+#endif
flash_write_cmd (info, 0, 0, info->cmd_reset);
}
--
1.7.1
More information about the U-Boot
mailing list