* [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X
@ 2008-03-28 18:43 Anton Vorontsov
2008-03-28 18:53 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2008-03-28 18:43 UTC (permalink / raw)
To: linux-mtd, linuxppc-dev; +Cc: Scott Wood
Using current driver on the MPC837X CPUs elbc hangs during nand write.
Reading last byte helps though (thanks to Scott Wood for the idea).
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/mtd/nand/fsl_elbc_nand.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 378b7aa..be4c05d 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -480,7 +480,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) {
dev_err(ctrl->dev, "write_buf of %d bytes", len);
ctrl->status = 0;
return;
@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
}
memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
+#ifdef CONFIG_PPC_MPC837x
+ /*
+ * This is workaround for the weird elbc hangs on the MPC837X CPUs,
+ * 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);
+#endif
ctrl->index += len;
}
--
1.5.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X
2008-03-28 18:43 [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X Anton Vorontsov
@ 2008-03-28 18:53 ` Scott Wood
2008-03-28 19:10 ` [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X] Anton Vorontsov
0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2008-03-28 18:53 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, linux-mtd
Anton Vorontsov wrote:
> @@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
> }
>
> memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
> +#ifdef CONFIG_PPC_MPC837x
> + /*
> + * This is workaround for the weird elbc hangs on the MPC837X CPUs,
> + * 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);
> +#endif
Let's do it regardless of chip -- odds are the issue exists on all
implementations, and it's just a function of what frequencies things are
running at.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X]
2008-03-28 18:53 ` Scott Wood
@ 2008-03-28 19:10 ` Anton Vorontsov
2008-03-28 19:15 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2008-03-28 19:10 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, linux-mtd
On Fri, Mar 28, 2008 at 01:53:57PM -0500, Scott Wood wrote:
> Anton Vorontsov wrote:
> >@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd,
> >const u8 *buf, int len)
> > }
> >
> > memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
> >+#ifdef CONFIG_PPC_MPC837x
> >+ /*
> >+ * This is workaround for the weird elbc hangs on the MPC837X CPUs,
> >+ * 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);
> >+#endif
>
> Let's do it regardless of chip -- odds are the issue exists on all
> implementations, and it's just a function of what frequencies things are
> running at.
Ok.
- - - -
From: Anton Vorontsov <avorontsov@ru.mvista.com>
Subject: mtd/nand/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>
---
drivers/mtd/nand/fsl_elbc_nand.c | 11 ++++++++++-
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 378b7aa..2f4ce2a 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -480,7 +480,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) {
dev_err(ctrl->dev, "write_buf of %d bytes", len);
ctrl->status = 0;
return;
@@ -495,6 +495,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;
}
--
1.5.2.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X]
2008-03-28 19:10 ` [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X] Anton Vorontsov
@ 2008-03-28 19:15 ` Scott Wood
0 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2008-03-28 19:15 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev, linux-mtd
Anton Vorontsov wrote:
> From: Anton Vorontsov <avorontsov@ru.mvista.com>
> Subject: mtd/nand/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>
Acked-by: Scott Wood <scottwood@freescale.com>
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-28 19:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 18:43 [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X Anton Vorontsov
2008-03-28 18:53 ` Scott Wood
2008-03-28 19:10 ` [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X] Anton Vorontsov
2008-03-28 19:15 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).