Skip to content

Commit 477478a

Browse files
JoshWucomputersforpeace
authored andcommitted
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 <[email protected]> Signed-off-by: Brian Norris <[email protected]>
1 parent 3a434f6 commit 477478a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/mtd/nand/atmel_nand.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static void pmecc_config_ecc_layout(struct nand_ecclayout *layout,
485485
for (i = 0; i < ecc_len; i++)
486486
layout->eccpos[i] = oobsize - ecc_len + i;
487487

488-
layout->oobfree[0].offset = 2;
488+
layout->oobfree[0].offset = PMECC_OOB_RESERVED_BYTES;
489489
layout->oobfree[0].length =
490490
oobsize - ecc_len - layout->oobfree[0].offset;
491491
}
@@ -1254,7 +1254,8 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
12541254
nand_chip->ecc.steps = mtd->writesize / sector_size;
12551255
nand_chip->ecc.total = nand_chip->ecc.bytes *
12561256
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) {
12581259
dev_err(host->dev, "No room for ECC bytes\n");
12591260
err_no = -EINVAL;
12601261
goto err;

drivers/mtd/nand/atmel_nand_ecc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,7 @@
152152
/* Time out value for reading PMECC status register */
153153
#define PMECC_MAX_TIMEOUT_MS 100
154154

155+
/* Reserved bytes in oob area */
156+
#define PMECC_OOB_RESERVED_BYTES 2
157+
155158
#endif

0 commit comments

Comments
 (0)