* [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB
@ 2011-07-06 17:04 helmut.raiger at hale.at
2011-07-20 6:55 ` Helmut Raiger
2011-08-02 20:12 ` Scott Wood
0 siblings, 2 replies; 4+ messages in thread
From: helmut.raiger at hale.at @ 2011-07-06 17:04 UTC (permalink / raw)
To: u-boot
From: Helmut Raiger <helmut.raiger@hale.at>
When writing 0x4000 to the unlockend_blkaddr register, large writes to
a 2k page NAND sometimes fail. The current kernel driver writes 0xFFFF
to this register for V2 of the nand controller.
However on an i.MX31 this also fixes writes larger than 32MB.
The datasheet is very unspecific, but (0x4000=16384)*2000
roughly fits the limits we're encountering with NAND writes.
This problem might be NAND chip specific.
Signed-off-by: Helmut Raiger <helmut.raiger@hale.at>
---
drivers/mtd/nand/mxc_nand.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 78e07cc..35e89a0 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1371,7 +1371,18 @@ int board_nand_init(struct nand_chip *this)
/* Blocks to be unlocked */
writew(0x0, &host->regs->nfc_unlockstart_blkaddr);
- writew(0x4000, &host->regs->nfc_unlockend_blkaddr);
+ /* Originally (Freescale LTIB 2.6.21) 0x4000 was written to the
+ * unlockend_blkaddr, but the magic 0x4000 does not always work
+ * when writing more than some 32 megabytes (on 2k page nands)
+ * However 0xFFFF doesn't seem to have this kind
+ * of limitation (tried it back and forth several times).
+ * The linux kernel driver sets this to 0xFFFF for the v2 controller
+ * only, but probably this was not tested there for v1.
+ * The very same limitation seems to apply to this kernel driver.
+ * This might be NAND chip specific and the i.MX31 datasheet is
+ * extremely vague about the semantics of this register.
+ */
+ writew(0xFFFF, &host->regs->nfc_unlockend_blkaddr);
/* Unlock Block Command for given address range */
writew(0x4, &host->regs->nfc_wrprot);
--
1.7.4.4
--
Scanned by MailScanner.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB
2011-07-06 17:04 [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB helmut.raiger at hale.at
@ 2011-07-20 6:55 ` Helmut Raiger
2011-07-20 17:53 ` Scott Wood
2011-08-02 20:12 ` Scott Wood
1 sibling, 1 reply; 4+ messages in thread
From: Helmut Raiger @ 2011-07-20 6:55 UTC (permalink / raw)
To: u-boot
On 07/06/2011 07:04 PM, helmut.raiger at hale.at wrote:
> From: Helmut Raiger<helmut.raiger@hale.at>
>
> When writing 0x4000 to the unlockend_blkaddr register, large writes to
> a 2k page NAND sometimes fail. The current kernel driver writes 0xFFFF
> to this register for V2 of the nand controller.
>
> However on an i.MX31 this also fixes writes larger than 32MB.
> The datasheet is very unspecific, but (0x4000=16384)*2000
> roughly fits the limits we're encountering with NAND writes.
> This problem might be NAND chip specific.
Any comments?
Helmut
--
Scanned by MailScanner.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB
2011-07-20 6:55 ` Helmut Raiger
@ 2011-07-20 17:53 ` Scott Wood
0 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2011-07-20 17:53 UTC (permalink / raw)
To: u-boot
On Wed, 20 Jul 2011 08:55:00 +0200
Helmut Raiger <helmut.raiger@hale.at> wrote:
> On 07/06/2011 07:04 PM, helmut.raiger at hale.at wrote:
> > From: Helmut Raiger<helmut.raiger@hale.at>
> >
> > When writing 0x4000 to the unlockend_blkaddr register, large writes to
> > a 2k page NAND sometimes fail. The current kernel driver writes 0xFFFF
> > to this register for V2 of the nand controller.
> >
> > However on an i.MX31 this also fixes writes larger than 32MB.
> > The datasheet is very unspecific, but (0x4000=16384)*2000
> > roughly fits the limits we're encountering with NAND writes.
> > This problem might be NAND chip specific.
> Any comments?
I'll apply it (with a minor formatting fix), if nobody has any more
specific information about this register.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB
2011-07-06 17:04 [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB helmut.raiger at hale.at
2011-07-20 6:55 ` Helmut Raiger
@ 2011-08-02 20:12 ` Scott Wood
1 sibling, 0 replies; 4+ messages in thread
From: Scott Wood @ 2011-08-02 20:12 UTC (permalink / raw)
To: u-boot
On Wed, Jul 06, 2011 at 07:04:41PM +0200, helmut.raiger at hale.at wrote:
> From: Helmut Raiger <helmut.raiger@hale.at>
>
> When writing 0x4000 to the unlockend_blkaddr register, large writes to
> a 2k page NAND sometimes fail. The current kernel driver writes 0xFFFF
> to this register for V2 of the nand controller.
>
> However on an i.MX31 this also fixes writes larger than 32MB.
> The datasheet is very unspecific, but (0x4000=16384)*2000
> roughly fits the limits we're encountering with NAND writes.
> This problem might be NAND chip specific.
>
> Signed-off-by: Helmut Raiger <helmut.raiger@hale.at>
> ---
> drivers/mtd/nand/mxc_nand.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
Applied to u-boot-nand-flash next
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-02 20:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-06 17:04 [U-Boot] [PATCH] mxc_nand: fix a problem writing more than 32MB helmut.raiger at hale.at
2011-07-20 6:55 ` Helmut Raiger
2011-07-20 17:53 ` Scott Wood
2011-08-02 20:12 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox