[U-Boot] [PATCH 08/11] DNS323 CFI driver changes (hacks, testing only)

rogan at dawes.za.net
2011-03-18T08:04:57Z

From: Rogan Dawes <rogan@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 44ebb9d..7ee4f90 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -262,6 +262,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);
@@ -279,6 +282,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);
@@ -299,6 +305,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
@@ -334,6 +343,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) {
@@ -391,6 +403,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);

@@ -1728,6 +1743,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
@@ -1742,6 +1758,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;
@@ -1907,11 +1924,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);
@@ -1985,12 +2004,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