summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-03-28 22:10:54 +0300
committerScott Wood <scottwood@freescale.com>2008-08-12 11:31:26 -0500
commit9c814b0a716aae884bec977b9a032dfa59cfb79a (patch)
tree6dff09b10e545767db8d595ccadbcefcd5905ef6
parent9fd020d6b4b36b9fb67cd834bc1ae7fdba15ee9e (diff)
downloadu-boot-imx-9c814b0a716aae884bec977b9a032dfa59cfb79a.zip
u-boot-imx-9c814b0a716aae884bec977b9a032dfa59cfb79a.tar.gz
u-boot-imx-9c814b0a716aae884bec977b9a032dfa59cfb79a.tar.bz2
fsl_elbc_nand: workaround for hangs during nand write
Using current driver elbc sometimes hangs during nand write. Reading back last byte helps though (thanks to Scott Wood for the idea). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index c1644c0..ab3e0fd 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -489,7 +489,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
struct fsl_elbc_ctrl *ctrl = priv->ctrl;
unsigned int bufsize = mtd->writesize + mtd->oobsize;
- if (len < 0) {
+ if (len <= 0) {
printf("write_buf of %d bytes", len);
ctrl->status = 0;
return;
@@ -503,6 +503,15 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
}
memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
+ /*
+ * This is workaround for the weird elbc hangs during nand write,
+ * Scott Wood says: "...perhaps difference in how long it takes a
+ * write to make it through the localbus compared to a write to IMMR
+ * is causing problems, and sync isn't helping for some reason."
+ * Reading back the last byte helps though.
+ */
+ in_8(&ctrl->addr[ctrl->index] + len - 1);
+
ctrl->index += len;
}