aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorHuang Shijie <shijie8@gmail.com>2010-09-27 10:43:53 +0800
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-25 00:49:57 +0100
commit12a40a57f762f569f58a393437d8c13864db390a (patch)
tree2ab939b100ff7604422e31719fc1621e7b2f7ee3 /drivers/mtd/nand/nand_base.c
parent088bd455c954c0c42edde9d4463e44be10101aac (diff)
downloadmrst-s0i3-test-12a40a57f762f569f58a393437d8c13864db390a.tar.gz
mrst-s0i3-test-12a40a57f762f569f58a393437d8c13864db390a.tar.xz
mrst-s0i3-test-12a40a57f762f569f58a393437d8c13864db390a.zip
mtd: add init_size hook for NAND driver
Not all the NAND devices have all the information in additional id bytes. So add a hook in the nand_chip{} is a good method to calculate the right value of oobsize, erasesize and so on. Without the hook,you will get the wrong value, and you have to hack in the ->scan_bbt() to change the wrong value which make the code mess. Signed-off-by: Huang Shijie <shijie8@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0b70c175999..53f4e41836f 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2976,8 +2976,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
chip->chipsize = (uint64_t)type->chipsize << 20;
- /* Newer devices have all the information in additional id bytes */
- if (!type->pagesize) {
+ if (!type->pagesize && chip->init_size) {
+ /* set the pagesize, oobsize, erasesize by the driver*/
+ busw = chip->init_size(mtd, chip, id_data);
+ } else if (!type->pagesize) {
int extid;
/* The 3rd id byte holds MLC / multichip data */
chip->cellinfo = id_data[2];