]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
[PATCH] nand: Fix problem with oobsize calculation
authorStefan Roese <sr@denx.de>
Fri, 5 Jan 2007 10:46:05 +0000 (11:46 +0100)
committerStefan Roese <sr@denx.de>
Fri, 5 Jan 2007 10:46:05 +0000 (11:46 +0100)
Here the description from Brian Brelsford <Brian_Brelsford@dell.com>:

The Hynix part returns a 0x1d in the 4th ID byte. The Samsung part
returns a 0x15. In the code fragment below bits [1:0] determine the
page size, it is ANDed via "(extid & 0x3)" then shifted out. The
next field is also ANDed with 0x3. However this is a one bit field
as defined in the Hynix and Samsung parts in the 4th ID byte that
determins the oobsize, not a two bit field. It works on Samsung as
bits[3:2] are 01. However for the Hynix there is a 11 in these two
bits, so the oob size gets messed up.

I checked the correct linux code and the suggested fix from Brian is
also available in the linux nand mtd driver.

Signed-off-by: Stefan Roese <sr@denx.de>
drivers/nand/nand_base.c

index 7fdf57b1779163975b1fb4e89293887eb7d0c927..8495829900c4a179642d80ddadbbe04ad748fad7 100644 (file)
@@ -2338,7 +2338,7 @@ int nand_scan (struct mtd_info *mtd, int maxchips)
                        mtd->oobblock = 1024 << (extid & 0x3);
                        extid >>= 2;
                        /* Calc oobsize */
-                       mtd->oobsize = (8 << (extid & 0x03)) * (mtd->oobblock / 512);
+                       mtd->oobsize = (8 << (extid & 0x01)) * (mtd->oobblock / 512);
                        extid >>= 2;
                        /* Calc blocksize. Blocksize is multiples of 64KiB */
                        mtd->erasesize = (64 * 1024)  << (extid & 0x03);