summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorGerald Van Baren <vanbaren@cideas.com>2008-03-29 18:08:02 -0400
committerGerald Van Baren <vanbaren@cideas.com>2008-03-29 18:08:02 -0400
commit3596d55eb22703d3f4f1b839fe4b000fabe081b3 (patch)
tree96d1ce693dc72c2fbc63da37928afd4761e82fd2 /drivers/mtd
parent493a2b1dc97367e904bf83869501f6290f3b374e (diff)
parent74d1e66d22dac91388bc538b2fe19f735edc5b82 (diff)
downloadu-boot-imx-3596d55eb22703d3f4f1b839fe4b000fabe081b3.zip
u-boot-imx-3596d55eb22703d3f4f1b839fe4b000fabe081b3.tar.gz
u-boot-imx-3596d55eb22703d3f4f1b839fe4b000fabe081b3.tar.bz2
Merge git://www.denx.de/git/u-boot into uboot
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/cfi_flash.c40
-rw-r--r--drivers/mtd/onenand/onenand_base.c6
2 files changed, 45 insertions, 1 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 439c950..f04c72d 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1180,6 +1180,27 @@ void flash_print_info (flash_info_t * info)
}
/*-----------------------------------------------------------------------
+ * This is used in a few places in write_buf() to show programming
+ * progress. Making it a function is nasty because it needs to do side
+ * effect updates to digit and dots. Repeated code is nasty too, so
+ * we define it once here.
+ */
+#ifdef CONFIG_FLASH_SHOW_PROGRESS
+#define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub) \
+ dots -= dots_sub; \
+ if ((scale > 0) && (dots <= 0)) { \
+ if ((digit % 5) == 0) \
+ printf ("%d", digit / 5); \
+ else \
+ putc ('.'); \
+ digit--; \
+ dots += scale; \
+ }
+#else
+#define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub)
+#endif
+
+/*-----------------------------------------------------------------------
* Copy memory to flash, returns:
* 0 - OK
* 1 - write timeout
@@ -1192,10 +1213,23 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
int aln;
cfiword_t cword;
int i, rc;
-
#ifdef CFG_FLASH_USE_BUFFER_WRITE
int buffered_size;
#endif
+#ifdef CONFIG_FLASH_SHOW_PROGRESS
+ int digit = CONFIG_FLASH_SHOW_PROGRESS;
+ int scale = 0;
+ int dots = 0;
+
+ /*
+ * Suppress if there are fewer than CONFIG_FLASH_SHOW_PROGRESS writes.
+ */
+ if (cnt >= CONFIG_FLASH_SHOW_PROGRESS) {
+ scale = (int)((cnt + CONFIG_FLASH_SHOW_PROGRESS - 1) /
+ CONFIG_FLASH_SHOW_PROGRESS);
+ }
+#endif
+
/* get lower aligned address */
wp = (addr & ~(info->portwidth - 1));
@@ -1219,6 +1253,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
return rc;
wp += i;
+ FLASH_SHOW_PROGRESS(scale, dots, digit, i);
}
/* handle the aligned part */
@@ -1248,6 +1283,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
wp += i;
src += i;
cnt -= i;
+ FLASH_SHOW_PROGRESS(scale, dots, digit, i);
}
#else
while (cnt >= info->portwidth) {
@@ -1259,8 +1295,10 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
return rc;
wp += info->portwidth;
cnt -= info->portwidth;
+ FLASH_SHOW_PROGRESS(scale, dots, digit, info->portwidth);
}
#endif /* CFG_FLASH_USE_BUFFER_WRITE */
+
if (cnt == 0) {
return (0);
}
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index d4003a2..3b828fb 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1180,6 +1180,12 @@ static int onenand_probe(struct mtd_info *mtd)
if (maf_id != bram_maf_id || dev_id != bram_dev_id)
return -ENXIO;
+ /* FIXME : Current OneNAND MTD doesn't support Flex-OneNAND */
+ if (dev_id & (1 << 9)) {
+ printk("Not yet support Flex-OneNAND\n");
+ return -ENXIO;
+ }
+
/* Flash device information */
onenand_print_device_info(dev_id, 0);
this->device_id = dev_id;