mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 08/14] ARM: i.MX: xload nand: Pull ECC status checking out of read page
Date: Wed, 2 Nov 2022 09:33:14 +0100	[thread overview]
Message-ID: <20221102083314.2zebgpxr6pyyutuo@pengutronix.de> (raw)
In-Reply-To: <20221101153048.772146-9-s.hauer@pengutronix.de>

Hi Sascha,

On 22-11-01, Sascha Hauer wrote:
> The read page code can be reused by upcoming i.MX7 support, but the ECC
> checking will be different. Pull ECC status checking out of the read
> page code to make that reusable on i.MX7.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/mach-imx/xload-gpmi-nand.c | 42 ++++++++++++++++++++---------
>  1 file changed, 29 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/xload-gpmi-nand.c b/arch/arm/mach-imx/xload-gpmi-nand.c
> index dc4cc45be0..543ec108ba 100644
> --- a/arch/arm/mach-imx/xload-gpmi-nand.c
> +++ b/arch/arm/mach-imx/xload-gpmi-nand.c
> @@ -236,8 +236,6 @@ static int mxs_nand_read_page(struct mxs_nand_info *info, int writesize,
>  	int cmd_queue_len;
>  	u8 *cmd_buf;
>  	int ret;
> -	uint8_t	*status;
> -	int i;
>  	int timeout;
>  	int descnum = 0;
>  	int max_pagenum = info->nand_size /
> @@ -375,20 +373,26 @@ static int mxs_nand_read_page(struct mxs_nand_info *info, int writesize,
>  	writel(BCH_CTRL_COMPLETE_IRQ,
>  		bch_regs + BCH_CTRL + STMP_OFFSET_REG_CLR);
>  
> -	/* Loop over status bytes, accumulating ECC status. */
> -	status = databuf + writesize + mxs_nand_aux_status_offset();
> -	for (i = 0; i < writesize / MXS_NAND_CHUNK_DATA_CHUNK_SIZE; i++) {
> -		if (status[i] == 0xfe) {
> -			ret = -EBADMSG;
> -			goto err;
> -		}
> -	}
> -
>  	ret = 0;
>  err:
>  	return ret;
>  }
>  
> +static int mxs_nand_get_ecc_status(struct mxs_nand_info *info, void *databuf)
> +{
> +	uint8_t	*status;
> +	int i;
> +
> +	/* Loop over status bytes, accumulating ECC status. */
> +	status = databuf + info->organization.pagesize + mxs_nand_aux_status_offset();
> +	for (i = 0; i < info->organization.pagesize / MXS_NAND_CHUNK_DATA_CHUNK_SIZE; i++) {
> +		if (status[i] == 0xfe)
> +			return -EBADMSG;
> +	}
> +
> +	return 0;
> +}
> +
>  static int mxs_nand_get_read_status(struct mxs_nand_info *info, void *databuf)
>  {
>  	int ret;
> @@ -851,6 +855,10 @@ static int get_fcb(struct mxs_nand_info *info, void *databuf)
>  		if (ret)
>  			continue;
>  
> +		ret = mxs_nand_get_ecc_status(info, databuf);
> +		if (ret)
> +			continue;
> +
>  		memcpy(fcb, databuf + mxs_nand_aux_status_offset(),
>  			sizeof(*fcb));
>  
> @@ -886,7 +894,11 @@ static int get_dbbt(struct mxs_nand_info *info, void *databuf)
>  		page = startpage + i * info->organization.pages_per_eraseblock;
>  
>  		ret = mxs_nand_read_page(info, info->organization.pagesize,
> -			info->organization.oobsize, page, databuf, 0);
> +			info->organization.oobsize, page, databuf, 0, false);

Maybe I didn't saw the change, but where did you changed the function
declaration?

Regards,
  Marco

> +		if (ret)
> +			continue;
> +
> +		ret = mxs_nand_get_ecc_status(info, databuf);
>  		if (ret)
>  			continue;
>  
> @@ -900,7 +912,11 @@ static int get_dbbt(struct mxs_nand_info *info, void *databuf)
>  			return -ENOENT;
>  
>  		ret = mxs_nand_read_page(info, info->organization.pagesize,
> -			info->organization.oobsize, page + 4, databuf, 0);
> +			info->organization.oobsize, page + 4, databuf, 0, false);
> +		if (ret)
> +			continue;
> +
> +		ret = mxs_nand_get_ecc_status(info, databuf);
>  		if (ret)
>  			continue;
>  
> -- 
> 2.30.2
> 
> 
> 



  reply	other threads:[~2022-11-02  8:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 15:30 [PATCH 00/14] Add i.MX7 NAND xload support Sascha Hauer
2022-11-01 15:30 ` [PATCH 01/14] mtd: nand: nand-mxs: Move register definitions to separate file Sascha Hauer
2022-11-02  8:08   ` Marco Felsch
2022-11-01 15:30 ` [PATCH 02/14] ARM: i.MX: xload nand: Use common register defines Sascha Hauer
2022-11-02  8:10   ` Marco Felsch
2022-11-01 15:30 ` [PATCH 03/14] ARM: i.MX: xload nand: add common readid Sascha Hauer
2022-11-02  8:23   ` Marco Felsch
2022-11-01 15:30 ` [PATCH 04/14] dma: apbh-dma: Simplify code Sascha Hauer
2022-11-01 15:30 ` [PATCH 05/14] dma: apbh-dma: unify register defines Sascha Hauer
2022-11-01 15:30 ` [PATCH 06/14] ARM: i.MX: xload-gpmi-nand: refactor for more SoC support Sascha Hauer
2022-11-01 15:30 ` [PATCH 07/14] imx-bbu-nand-fcb: pull printing debug info out of get_fcb() Sascha Hauer
2022-11-01 15:30 ` [PATCH 08/14] ARM: i.MX: xload nand: Pull ECC status checking out of read page Sascha Hauer
2022-11-02  8:33   ` Marco Felsch [this message]
2022-11-01 15:30 ` [PATCH 09/14] ARM: i.MX: xload nand: Use final page layout from FCB Sascha Hauer
2022-11-01 15:30 ` [PATCH 10/14] imx-bbu-nand-fcb: Fix reading FCB information from BCH registers Sascha Hauer
2022-11-01 15:30 ` [PATCH 11/14] ARM: i.MX: xload nand: reset NAND before accessing it Sascha Hauer
2022-11-01 15:30 ` [PATCH 12/14] ARM: i.MX: xload nand: Move mxs_nand_mode_fcb_62bit() to header file Sascha Hauer
2022-11-02  8:37   ` Marco Felsch
2022-11-01 15:30 ` [PATCH 13/14] ARM: i.MX: xload nand: Implement i.MX7 support Sascha Hauer
2022-11-02  8:41   ` Marco Felsch
2022-11-02  8:46     ` Sascha Hauer
2022-11-01 15:30 ` [PATCH 14/14] imx-bbu-nand-fcb: Add fcb command Sascha Hauer
2022-11-02  8:44   ` Marco Felsch
2022-11-02 10:55     ` Sascha Hauer
2022-11-02 11:01       ` Marco Felsch
2022-11-02 11:29         ` 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=20221102083314.2zebgpxr6pyyutuo@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox