aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorJosh Wu <josh.wu@atmel.com>2013-01-23 07:47:08 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-02-12 10:00:48 -0500
commitc0cf787f10c6ffb050e85c8ac9c0a8161cb06cb9 (patch)
tree94d81074129bcb6536e48aef11a0040bf030a742 /drivers/mtd/nand
parentf1a7c9d350339e8a81cda9469ba9a591fb9c9a3b (diff)
mtd: atmel_nand: avoid to report an error when lookup table offset is 0.
Before this patch, we assume the whole ROM code are mapping to memory. So it is wrong if the lookup table offset is 0. After this patch, we can map only the lookup table of ROM code to memory intead of the whole ROM code (about 1M). In this case, one lookup table offset can be 0. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/atmel_nand.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index c516a9408087..1d989dba4ce5 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1215,7 +1215,7 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
1215static int atmel_of_init_port(struct atmel_nand_host *host, 1215static int atmel_of_init_port(struct atmel_nand_host *host,
1216 struct device_node *np) 1216 struct device_node *np)
1217{ 1217{
1218 u32 val, table_offset; 1218 u32 val;
1219 u32 offset[2]; 1219 u32 offset[2];
1220 int ecc_mode; 1220 int ecc_mode;
1221 struct atmel_nand_data *board = &host->board; 1221 struct atmel_nand_data *board = &host->board;
@@ -1288,13 +1288,12 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
1288 dev_err(host->dev, "Cannot get PMECC lookup table offset\n"); 1288 dev_err(host->dev, "Cannot get PMECC lookup table offset\n");
1289 return -EINVAL; 1289 return -EINVAL;
1290 } 1290 }
1291 table_offset = host->pmecc_sector_size == 512 ? offset[0] : offset[1]; 1291 if (!offset[0] && !offset[1]) {
1292
1293 if (!table_offset) {
1294 dev_err(host->dev, "Invalid PMECC lookup table offset\n"); 1292 dev_err(host->dev, "Invalid PMECC lookup table offset\n");
1295 return -EINVAL; 1293 return -EINVAL;
1296 } 1294 }
1297 host->pmecc_lookup_table_offset = table_offset; 1295 host->pmecc_lookup_table_offset =
1296 (host->pmecc_sector_size == 512) ? offset[0] : offset[1];
1298 1297
1299 return 0; 1298 return 0;
1300} 1299}