Skip to content

Commit

Permalink
mtd: atmel_nand: avoid to report an error when lookup table offset is 0.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Josh Wu authored and Artem Bityutskiy committed Feb 12, 2013
1 parent f1a7c9d commit c0cf787
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/mtd/nand/atmel_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
static int atmel_of_init_port(struct atmel_nand_host *host,
struct device_node *np)
{
u32 val, table_offset;
u32 val;
u32 offset[2];
int ecc_mode;
struct atmel_nand_data *board = &host->board;
Expand Down Expand Up @@ -1288,13 +1288,12 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
dev_err(host->dev, "Cannot get PMECC lookup table offset\n");
return -EINVAL;
}
table_offset = host->pmecc_sector_size == 512 ? offset[0] : offset[1];

if (!table_offset) {
if (!offset[0] && !offset[1]) {
dev_err(host->dev, "Invalid PMECC lookup table offset\n");
return -EINVAL;
}
host->pmecc_lookup_table_offset = table_offset;
host->pmecc_lookup_table_offset =
(host->pmecc_sector_size == 512) ? offset[0] : offset[1];

return 0;
}
Expand Down

0 comments on commit c0cf787

Please sign in to comment.