diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-08-27 10:52:02 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-09-28 15:59:48 +0200 |
commit | 53576c7bfc3589fc7cd58cc952168db0449886a7 (patch) | |
tree | ac40227c3cb2678579f7788fdea63fe1bf886b2c /drivers/mtd/nand/raw/nand_toshiba.c | |
parent | 3316c8e3ad1fcaeefd4ffa93587dd78fb24e8afa (diff) | |
download | lwn-53576c7bfc3589fc7cd58cc952168db0449886a7.tar.gz lwn-53576c7bfc3589fc7cd58cc952168db0449886a7.zip |
mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant
Instead of accessing ->strength/step_size directly.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-15-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd/nand/raw/nand_toshiba.c')
-rw-r--r-- | drivers/mtd/nand/raw/nand_toshiba.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mtd/nand/raw/nand_toshiba.c b/drivers/mtd/nand/raw/nand_toshiba.c index 7ba0516c6247..fb6662337b90 100644 --- a/drivers/mtd/nand/raw/nand_toshiba.c +++ b/drivers/mtd/nand/raw/nand_toshiba.c @@ -145,6 +145,8 @@ static void toshiba_nand_benand_init(struct nand_chip *chip) static void toshiba_nand_decode_id(struct nand_chip *chip) { + struct nand_device *base = &chip->base; + struct nand_ecc_props requirements = {}; struct mtd_info *mtd = nand_to_mtd(chip); struct nand_memory_organization *memorg; @@ -175,23 +177,25 @@ static void toshiba_nand_decode_id(struct nand_chip *chip) * - 24nm: 8 bit ECC for each 512Byte is required. */ if (chip->id.len >= 6 && nand_is_slc(chip)) { - chip->base.eccreq.step_size = 512; + requirements.step_size = 512; switch (chip->id.data[5] & 0x7) { case 0x4: - chip->base.eccreq.strength = 1; + requirements.strength = 1; break; case 0x5: - chip->base.eccreq.strength = 4; + requirements.strength = 4; break; case 0x6: - chip->base.eccreq.strength = 8; + requirements.strength = 8; break; default: WARN(1, "Could not get ECC info"); - chip->base.eccreq.step_size = 0; + requirements.step_size = 0; break; } } + + nanddev_set_ecc_requirements(base, &requirements); } static int |