* [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning
@ 2010-05-07 5:25 Mike Frysinger
2010-05-07 17:51 ` Scott Wood
2010-05-07 19:10 ` [U-Boot] [PATCH v2] " Mike Frysinger
0 siblings, 2 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-05-07 5:25 UTC (permalink / raw)
To: u-boot
From: Andrew Caldwell <Andrew.Caldwell@analog.com>
The current Blackfin nand write function fills up the write buffer but
returns before it has had a chance to drain. On faster systems, this
isn't a problem as the operation finishes before the ECC registers are
read, but on slower systems the ECC may be incomplete when the core tries
to read it.
So wait for the buffer to drain once we're doing writing to it.
Signed-off-by: Andrew Caldwell <Andrew.Caldwell@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
drivers/mtd/nand/bfin_nand.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/bfin_nand.c b/drivers/mtd/nand/bfin_nand.c
index f134ef1..13a509d 100644
--- a/drivers/mtd/nand/bfin_nand.c
+++ b/drivers/mtd/nand/bfin_nand.c
@@ -75,7 +75,7 @@ static void bfin_nfc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
int bfin_nfc_devready(struct mtd_info *mtd)
{
pr_stamp();
- return (bfin_read_NFC_STAT() & NBUSY ? 1 : 0);
+ return (bfin_read_NFC_STAT() & NBUSY) ? 1 : 0;
}
/*
@@ -132,6 +132,11 @@ static void bfin_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len
bfin_write_NFC_DATA_WR(buf[i]);
}
+
+ /* Wait for the buffer to drain before we return */
+ while (bfin_read_NFC_STAT() & WB_EMPTY)
+ if (ctrlc())
+ return;
}
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning
2010-05-07 5:25 [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning Mike Frysinger
@ 2010-05-07 17:51 ` Scott Wood
2010-05-07 18:48 ` Mike Frysinger
2010-05-07 19:10 ` [U-Boot] [PATCH v2] " Mike Frysinger
1 sibling, 1 reply; 6+ messages in thread
From: Scott Wood @ 2010-05-07 17:51 UTC (permalink / raw)
To: u-boot
On Fri, May 07, 2010 at 01:25:48AM -0400, Mike Frysinger wrote:
> From: Andrew Caldwell <Andrew.Caldwell@analog.com>
>
> The current Blackfin nand write function fills up the write buffer but
> returns before it has had a chance to drain. On faster systems, this
> isn't a problem as the operation finishes before the ECC registers are
> read, but on slower systems the ECC may be incomplete when the core tries
> to read it.
>
> So wait for the buffer to drain once we're doing writing to it.
>
> Signed-off-by: Andrew Caldwell <Andrew.Caldwell@analog.com>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> drivers/mtd/nand/bfin_nand.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
Applied to u-boot-nand-flash.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning
2010-05-07 17:51 ` Scott Wood
@ 2010-05-07 18:48 ` Mike Frysinger
2010-05-07 18:54 ` Scott Wood
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2010-05-07 18:48 UTC (permalink / raw)
To: u-boot
On Friday 07 May 2010 13:51:51 Scott Wood wrote:
> On Fri, May 07, 2010 at 01:25:48AM -0400, Mike Frysinger wrote:
> > From: Andrew Caldwell <Andrew.Caldwell@analog.com>
> >
> > The current Blackfin nand write function fills up the write buffer but
> > returns before it has had a chance to drain. On faster systems, this
> > isn't a problem as the operation finishes before the ECC registers are
> > read, but on slower systems the ECC may be incomplete when the core tries
> > to read it.
> >
> > So wait for the buffer to drain once we're doing writing to it.
> >
> > Signed-off-by: Andrew Caldwell <Andrew.Caldwell@analog.com>
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> >
> > drivers/mtd/nand/bfin_nand.c | 7 ++++++-
> > 1 files changed, 6 insertions(+), 1 deletions(-)
>
> Applied to u-boot-nand-flash.
sorry, please drop this. Andrew pointed out that i committed/posted the wrong
version. i'll send an update shortly.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100507/c651a82d/attachment.pgp
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning
2010-05-07 18:48 ` Mike Frysinger
@ 2010-05-07 18:54 ` Scott Wood
0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2010-05-07 18:54 UTC (permalink / raw)
To: u-boot
On 05/07/2010 01:48 PM, Mike Frysinger wrote:
> On Friday 07 May 2010 13:51:51 Scott Wood wrote:
>> On Fri, May 07, 2010 at 01:25:48AM -0400, Mike Frysinger wrote:
>>> From: Andrew Caldwell<Andrew.Caldwell@analog.com>
>>>
>>> The current Blackfin nand write function fills up the write buffer but
>>> returns before it has had a chance to drain. On faster systems, this
>>> isn't a problem as the operation finishes before the ECC registers are
>>> read, but on slower systems the ECC may be incomplete when the core tries
>>> to read it.
>>>
>>> So wait for the buffer to drain once we're doing writing to it.
>>>
>>> Signed-off-by: Andrew Caldwell<Andrew.Caldwell@analog.com>
>>> Signed-off-by: Mike Frysinger<vapier@gentoo.org>
>>> ---
>>>
>>> drivers/mtd/nand/bfin_nand.c | 7 ++++++-
>>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> Applied to u-boot-nand-flash.
>
> sorry, please drop this. Andrew pointed out that i committed/posted the wrong
> version. i'll send an update shortly.
OK, done.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH v2] Blackfin: nand: drain the write buffer before returning
2010-05-07 5:25 [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning Mike Frysinger
2010-05-07 17:51 ` Scott Wood
@ 2010-05-07 19:10 ` Mike Frysinger
2010-05-20 21:31 ` Scott Wood
1 sibling, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2010-05-07 19:10 UTC (permalink / raw)
To: u-boot
From: Andrew Caldwell <Andrew.Caldwell@analog.com>
The current Blackfin nand write function fills up the write buffer but
returns before it has had a chance to drain. On faster systems, this
isn't a problem as the operation finishes before the ECC registers are
read, but on slower systems the ECC may be incomplete when the core tries
to read it.
So wait for the buffer to drain once we're done writing to it.
Signed-off-by: Andrew Caldwell <Andrew.Caldwell@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
- fix inverted logic reminded by Andrew
drivers/mtd/nand/bfin_nand.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/bfin_nand.c b/drivers/mtd/nand/bfin_nand.c
index f134ef1..6d3d450 100644
--- a/drivers/mtd/nand/bfin_nand.c
+++ b/drivers/mtd/nand/bfin_nand.c
@@ -75,7 +75,7 @@ static void bfin_nfc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
int bfin_nfc_devready(struct mtd_info *mtd)
{
pr_stamp();
- return (bfin_read_NFC_STAT() & NBUSY ? 1 : 0);
+ return (bfin_read_NFC_STAT() & NBUSY) ? 1 : 0;
}
/*
@@ -132,6 +132,11 @@ static void bfin_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len
bfin_write_NFC_DATA_WR(buf[i]);
}
+
+ /* Wait for the buffer to drain before we return */
+ while (!(bfin_read_NFC_STAT() & WB_EMPTY))
+ if (ctrlc())
+ return;
}
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [U-Boot] [PATCH v2] Blackfin: nand: drain the write buffer before returning
2010-05-07 19:10 ` [U-Boot] [PATCH v2] " Mike Frysinger
@ 2010-05-20 21:31 ` Scott Wood
0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2010-05-20 21:31 UTC (permalink / raw)
To: u-boot
On Fri, May 07, 2010 at 03:10:07PM -0400, Mike Frysinger wrote:
> From: Andrew Caldwell <Andrew.Caldwell@analog.com>
>
> The current Blackfin nand write function fills up the write buffer but
> returns before it has had a chance to drain. On faster systems, this
> isn't a problem as the operation finishes before the ECC registers are
> read, but on slower systems the ECC may be incomplete when the core tries
> to read it.
>
> So wait for the buffer to drain once we're done writing to it.
>
> Signed-off-by: Andrew Caldwell <Andrew.Caldwell@analog.com>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v2
> - fix inverted logic reminded by Andrew
Applied to u-boot-nand-flash.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-20 21:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 5:25 [U-Boot] [PATCH] Blackfin: nand: drain the write buffer before returning Mike Frysinger
2010-05-07 17:51 ` Scott Wood
2010-05-07 18:48 ` Mike Frysinger
2010-05-07 18:54 ` Scott Wood
2010-05-07 19:10 ` [U-Boot] [PATCH v2] " Mike Frysinger
2010-05-20 21:31 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox