All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] mtd: nand: mxc_nand: implement exec_op
Date: Mon, 6 May 2024 16:02:54 +0200	[thread overview]
Message-ID: <20240506160254.19089e94@xps-13> (raw)
In-Reply-To: <20240417-mtd-nand-mxc-nand-exec-op-v1-2-d12564fe54e9@pengutronix.de>

Hi Sascha,

s.hauer@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@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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] mtd: nand: mxc_nand: implement exec_op
Date: Mon, 6 May 2024 16:02:54 +0200	[thread overview]
Message-ID: <20240506160254.19089e94@xps-13> (raw)
In-Reply-To: <20240417-mtd-nand-mxc-nand-exec-op-v1-2-d12564fe54e9@pengutronix.de>

Hi Sascha,

s.hauer@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@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

  reply	other threads:[~2024-05-06 14:03 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17  7:13 [PATCH 0/4] mtd: nand: mxc_nand: Convert to exec_op Sascha Hauer
2024-04-17  7:13 ` Sascha Hauer
2024-04-17  7:13 ` [PATCH 1/4] mtd: nand: mxc_nand: separate page read from ecc calc Sascha Hauer
2024-04-17  7:13   ` Sascha Hauer
2024-04-17  7:13 ` [PATCH 2/4] mtd: nand: mxc_nand: implement exec_op Sascha Hauer
2024-04-17  7:13   ` Sascha Hauer
2024-05-06 14:02   ` Miquel Raynal [this message]
2024-05-06 14:02     ` Miquel Raynal
2024-04-17  7:13 ` [PATCH 3/4] mtd: nand: mxc_nand: support software ECC Sascha Hauer
2024-04-17  7:13   ` Sascha Hauer
2024-05-06 14:05   ` Miquel Raynal
2024-05-06 14:05     ` Miquel Raynal
2024-05-06 15:51     ` Miquel Raynal
2024-05-06 15:51       ` Miquel Raynal
2024-05-07  7:12       ` Sascha Hauer
2024-05-07  7:12         ` Sascha Hauer
2024-05-07  7:45         ` Miquel Raynal
2024-05-07  7:45           ` Miquel Raynal
2024-05-07 10:33           ` Sascha Hauer
2024-05-07 10:33             ` Sascha Hauer
2024-05-07 14:02             ` Miquel Raynal
2024-05-07 14:02               ` Miquel Raynal
2024-04-17  7:13 ` [PATCH 4/4] mtd: nand: mxc_nand: disable subpage reads Sascha Hauer
2024-04-17  7:13   ` Sascha Hauer
2024-04-18  6:48   ` Sascha Hauer
2024-04-18  6:48     ` Sascha Hauer
2024-04-18  9:32     ` Miquel Raynal
2024-04-18  9:32       ` Miquel Raynal
2024-04-18 11:43       ` Sascha Hauer
2024-04-18 11:43         ` Sascha Hauer
2024-04-19  9:46         ` Miquel Raynal
2024-04-19  9:46           ` Miquel Raynal
2024-04-22 10:53           ` Sascha Hauer
2024-04-22 10:53             ` Sascha Hauer
2024-05-06 16:41             ` Miquel Raynal
2024-05-06 16:41               ` Miquel Raynal
2024-05-07  7:28               ` Sascha Hauer
2024-05-07  7:28                 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240506160254.19089e94@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.