[PATCH 2/4] mtd: nand: mxc_nand: implement exec_op
Miquel Raynal
miquel.raynal at bootlin.com
Mon May 6 07:02:54 PDT 2024
Hi Sascha,
s.hauer at pengutronix.de wrote on Wed, 17 Apr 2024 09:13:29 +0200:
> This converts the driver to the more modern exec_op which gets us rid
> of a bunch of legacy code. Tested on i.MX27 and i.MX25.
Thanks a lot for this contribution!
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
...
> static int mxc_nand_read_page_raw(struct nand_chip *chip, uint8_t *buf,
> int oob_required, int page)
> {
> + struct mtd_info *mtd = nand_to_mtd(chip);
> struct mxc_nand_host *host = nand_get_controller_data(chip);
> - void *oob_buf;
> + int ret;
> +
> + host->devtype_data->enable_hwecc(chip, false);
In general the expected logic would be to keep the ECC engine disabled
and just enable/use it/disable in the page helpers.
> +
> + ret = nand_read_page_op(chip, page, 0, buf, mtd->writesize);
> + if (ret)
> + return ret;
>
> if (oob_required)
> - oob_buf = chip->oob_poi;
> - else
> - oob_buf = NULL;
> + copy_spare(mtd, true, chip->oob_poi);
>
> - return host->devtype_data->read_page(chip, buf, oob_buf, 0, page);
> + return 0;
> }
>
...
> static int mxcnd_probe(struct platform_device *pdev)
> @@ -1752,13 +1594,6 @@ static int mxcnd_probe(struct platform_device *pdev)
>
> nand_set_controller_data(this, host);
> nand_set_flash_node(this, pdev->dev.of_node);
> - this->legacy.dev_ready = mxc_nand_dev_ready;
> - this->legacy.cmdfunc = mxc_nand_command;
> - this->legacy.read_byte = mxc_nand_read_byte;
> - this->legacy.write_buf = mxc_nand_write_buf;
> - this->legacy.read_buf = mxc_nand_read_buf;
> - this->legacy.set_features = mxc_nand_set_features;
> - this->legacy.get_features = mxc_nand_get_features;
Very nice diff overall. I'm fine with the first two patches, do you
mind if I merge 1 and 2 for now? We need to discuss further the subpage
issue.
As mentioned above, I would welcome a patch setting the HW ECC engine to
false by default and only enabling it in the page helpers (when using
the on-host ECC engine of course). This would be a good minor step,
with or without software ECC support.
Thanks,
Miquèl
More information about the linux-mtd
mailing list