]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mtd: do not assume oobsize is power of 2
authorBrian Norris <computersforpeace@gmail.com>
Wed, 24 Aug 2011 00:17:32 +0000 (17:17 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 24 Aug 2011 12:53:00 +0000 (15:53 +0300)
commit08ab8d51cfe9131094c5732055bc5642eb4b77fb
tree25a54d1481073e58d744cddd13f1f5276a35b2d6
parentbbceead478e2feba7a906577a284e1429f5fa683
mtd: do not assume oobsize is power of 2

Previous generations of MTDs all used OOB sizes that were powers of 2,
(e.g., 64, 128). However, newer generations of flash, especially NAND,
use irregular OOB sizes that are not powers of 2 (e.g., 218, 224, 448).
This means we cannot use masks like "mtd->oobsize - 1" to assume that we
will get a proper bitmask for OOB operations.

These masks are really only intended to hide the "page" portion of the
offset, leaving any OOB offset intact, so a masking with the writesize
(which *is* always a power of 2) is valid and makes more sense.

This has been tested for read/write of NAND devices (nanddump/nandwrite)
using nandsim and actual NAND flash.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
drivers/mtd/mtdchar.c