Signed-off-by: Syed Mohammed Khasim <kha...@beagleboard.org>
---
--- u-boot-arm/drivers/mtd/nand/omap_gpmc.c 2008-12-08
11:06:46.000000000 +0530
+++ u-boot-bb/drivers/mtd/nand/omap_gpmc.c 2008-12-10
19:38:13.000000000 +0530
@@ -249,12 +249,6 @@ void omap_nand_switch_ecc(int32_t hardwa
mtd = &nand_info[nand_curr_device];
nand = mtd->priv;
- /* clean up allocated buffers */
- nand_release(mtd);
- /* Switch back to the original value, mark me unscanned */
- nand->options = NAND_NO_PADDING | NAND_CACHEPRG | NAND_NO_AUTOINCR |
- NAND_NO_AUTOINCR;
-
/* Reset ecc interface */
nand->ecc.read_page = NULL;
nand->ecc.write_page = NULL;
hand applied and checked against zoom:
OMAP3 Zoom1# nand bad
Device 0 bad blocks:
00160000
02980000
029a0000
02da0000
04b40000
058e0000
05c40000
08120000
08300000
085c0000
08a00000
090c0000
0bc00000
0cd60000
0d380000
0d3a0000
0df80000
OMAP3 Zoom1# nandecc hw
HW ECC selected
OMAP3 Zoom1# nand erase 0 80000
NAND erase: device 0 offset 0x0, size 0x80000
Erasing at 0x0 -- 25% complete.
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
OK
OMAP3 Zoom1# nandecc sw
SW ECC selected
OMAP3 Zoom1# nand unlock
device 0 whole chip
OMAP3 Zoom1# nand erase 0 80000
NAND erase: device 0 offset 0x0, size 0x80000
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
OK
OMAP3 Zoom1# nandecc hw
HW ECC selected
OMAP3 Zoom1# nand erase 0 80000
NAND erase: device 0 offset 0x0, size 0x80000
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
NAND 256MiB 1,8V 16-bit: MTD Erase failure: -5
OK
OMAP3 Zoom1#
It just did not work for me.. I suppose I do need unlock here.. will
test against beagle at home..
Regards,
Nishanth Menon
For Beagle, you don't need an unlock
The below patch should be good, as it avoids the memory leak and works
for both hw and sw ecc
Signed-off-by: Syed Mohammed Khasim <kha...@ti.com>
---
--- u-boot-arm/drivers/mtd/nand/omap_gpmc.c 2008-12-08
11:06:46.000000000 +0530
+++ u-boot-bb/drivers/mtd/nand/omap_gpmc.c 2008-12-11
16:50:35.000000000 +0530
@@ -249,11 +249,7 @@ void omap_nand_switch_ecc(int32_t hardwa
mtd = &nand_info[nand_curr_device];
nand = mtd->priv;
- /* clean up allocated buffers */
- nand_release(mtd);
- /* Switch back to the original value, mark me unscanned */
- nand->options = NAND_NO_PADDING | NAND_CACHEPRG | NAND_NO_AUTOINCR |
- NAND_NO_AUTOINCR;
+ nand->options = NAND_OWN_BUFFERS | NAND_BBT_SCANNED;
First thanks for finding the root cause of the issues!
Do you like to test slightly reworked patch in attachment?
Ideas in this patch:
- board_nand_init() sets initial nand->options. Seems we used
NAND_NO_AUTOINCR twice :(
- In omap_nand_switch_ecc() don't set the same options (with same
wrong NAND_NO_AUTOINCR done twice) again. I.e. remove them.
- Don't touch initial options, set NAND_OWN_BUFFERS | NAND_BBT_SCANNED
*additionally* ("|=")
=> To be tested with some printf debugging: Is NAND_BBT_SCANNED
already set here, so we don't have to touch it here?
- Before omap_nand_switch_ecc() exit, un-set NAND_OWN_BUFFERS again to
be on the safe side. In case somebody later intentionally calls
nand_release(), we want to free the buffer.
=> To be tested with some printf debugging: Does nand_scan_tail()
modifiy NAND_BBT_SCANNED? I.e. how is NAND_BBT_SCANNED set if we
set/don't set it manually above, before calling nand_scan_tail().
Best regards
Dirk
Updated, final, tested patch in attachment.
Steve: If you like, please apply.
Best regards
Dirk
Btw: For the archives log of final testing:
http://www.beagleboard.org/irclogs/index.php?date=2008-12-12#T15:29:21