diff options
author | Josh Wu <josh.wu@atmel.com> | 2015-04-02 02:12:33 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-04-05 20:47:56 -0400 |
commit | 477478aedc8bdf1925785835609bc7e790f69aef (patch) | |
tree | 6ab87ad3f0c947dfa2a94a56126cdd0c210cf244 /drivers/mtd | |
parent | 3a434f66e6dab645d74a59c95651cdbe16497a50 (diff) |
mtd: atmel_nand: add a definition for the oob reserved bytes
It's better to use a macro instead of just a number.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 5 | ||||
-rw-r--r-- | drivers/mtd/nand/atmel_nand_ecc.h | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index feaac9099bb9..0361c1992673 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -485,7 +485,7 @@ static void pmecc_config_ecc_layout(struct nand_ecclayout *layout, | |||
485 | for (i = 0; i < ecc_len; i++) | 485 | for (i = 0; i < ecc_len; i++) |
486 | layout->eccpos[i] = oobsize - ecc_len + i; | 486 | layout->eccpos[i] = oobsize - ecc_len + i; |
487 | 487 | ||
488 | layout->oobfree[0].offset = 2; | 488 | layout->oobfree[0].offset = PMECC_OOB_RESERVED_BYTES; |
489 | layout->oobfree[0].length = | 489 | layout->oobfree[0].length = |
490 | oobsize - ecc_len - layout->oobfree[0].offset; | 490 | oobsize - ecc_len - layout->oobfree[0].offset; |
491 | } | 491 | } |
@@ -1254,7 +1254,8 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev, | |||
1254 | nand_chip->ecc.steps = mtd->writesize / sector_size; | 1254 | nand_chip->ecc.steps = mtd->writesize / sector_size; |
1255 | nand_chip->ecc.total = nand_chip->ecc.bytes * | 1255 | nand_chip->ecc.total = nand_chip->ecc.bytes * |
1256 | nand_chip->ecc.steps; | 1256 | nand_chip->ecc.steps; |
1257 | if (nand_chip->ecc.total > mtd->oobsize - 2) { | 1257 | if (nand_chip->ecc.total > |
1258 | mtd->oobsize - PMECC_OOB_RESERVED_BYTES) { | ||
1258 | dev_err(host->dev, "No room for ECC bytes\n"); | 1259 | dev_err(host->dev, "No room for ECC bytes\n"); |
1259 | err_no = -EINVAL; | 1260 | err_no = -EINVAL; |
1260 | goto err; | 1261 | goto err; |
diff --git a/drivers/mtd/nand/atmel_nand_ecc.h b/drivers/mtd/nand/atmel_nand_ecc.h index d4035e335ad8..668e7358f19b 100644 --- a/drivers/mtd/nand/atmel_nand_ecc.h +++ b/drivers/mtd/nand/atmel_nand_ecc.h | |||
@@ -152,4 +152,7 @@ | |||
152 | /* Time out value for reading PMECC status register */ | 152 | /* Time out value for reading PMECC status register */ |
153 | #define PMECC_MAX_TIMEOUT_MS 100 | 153 | #define PMECC_MAX_TIMEOUT_MS 100 |
154 | 154 | ||
155 | /* Reserved bytes in oob area */ | ||
156 | #define PMECC_OOB_RESERVED_BYTES 2 | ||
157 | |||
155 | #endif | 158 | #endif |