All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Md Sadre Alam <mdalam@codeaurora.org>
Cc: sricharan@codeaurora.org, boris.brezillon@collabora.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	mani@kernel.org
Subject: Re: [PATCH] mtd: rawnand: qcom: update last code word register
Date: Tue, 23 Feb 2021 17:34:49 +0100	[thread overview]
Message-ID: <20210223173449.1a55df1e@xps13> (raw)
In-Reply-To: <1614024267-12529-1-git-send-email-mdalam@codeaurora.org>

Hello,

Md Sadre Alam <mdalam@codeaurora.org> wrote on Tue, 23 Feb 2021
01:34:27 +0530:

> From QPIC version 2.0 onwards new register got added to read last

                               a new

> codeword. This change will add the READ_LOCATION_LAST_CW_n register.

            Add support for this READ_LOCATION_LAST_CW_n register.

> 
> For first three code word READ_LOCATION_n register will be
> use.For last code word READ_LOCATION_LAST_CW_n register will be
> use.

"
In the case of QPIC v2, codewords 0, 1 and 2 will be accessed through
READ_LOCATION_n, while codeword 3 will be accessed through
READ_LOCATION_LAST_CW_n.
"

When I read my own sentence, I feel that there is something wrong.
If there are only 4 codewords, I guess a QPIC v2 is able to use
READ_LOCATION_3 or READ_LOCATION_LAST_CW_0 interchangeably. Isn't it?

I guess the point of having these "last_cw_n" registers is to support
up to 8 codewords, am I wrong? If this the case, the current patch
completely fails doing that I don't get the point of such change.

> Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
> ---

[...]

>  /* helper to configure address register values */
> @@ -700,8 +727,9 @@ static void set_address(struct qcom_nand_host *host, u16 column, int page)
>   *
>   * @num_cw:		number of steps for the read/write operation
>   * @read:		read or write operation
> + * @cw	:		which code word
>   */
> -static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read)
> +static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read, int cw)
>  {
>  	struct nand_chip *chip = &host->chip;
>  	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> @@ -740,7 +768,7 @@ static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read)
>  	nandc_set_reg(nandc, NAND_EXEC_CMD, 1);
>  
>  	if (read)
> -		nandc_set_read_loc(chip, 0, 0, 0, host->use_ecc ?
> +		nandc_set_read_loc(chip, cw, 0, 0, host->use_ecc ?
>  				   host->cw_data : host->cw_size, 1);
>  }
>  
> @@ -1111,18 +1139,34 @@ static void config_nand_page_read(struct nand_chip *chip)
>  		      NAND_ERASED_CW_SET | NAND_BAM_NEXT_SGL);
>  }
>  
> +/* helper to check which location register should be use for this

    /*
     * Check which location...

> + * code word. NAND_READ_LOCATION or NAND_READ_LOCATION_LAST_CW
> + */
> +static bool config_loc_last_reg(struct nand_chip *chip, int cw)
> +{
> +	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> +	struct nand_ecc_ctrl *ecc = &chip->ecc;
> +
> +	if (nandc->props->qpic_v2 && qcom_nandc_is_last_cw(ecc, cw))
> +		return true;

Not sure this is really useful, it's probably better to drop this
helper and just use...

> +
> +	return false;
> +}
>  /*
>   * Helper to prepare DMA descriptors for configuring registers
>   * before reading each codeword in NAND page.
>   */
>  static void
> -config_nand_cw_read(struct nand_chip *chip, bool use_ecc)
> +config_nand_cw_read(struct nand_chip *chip, bool use_ecc, int cw)
>  {
>  	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> +	int reg = NAND_READ_LOCATION_0;
> +
> +	if (config_loc_last_reg(chip, cw))

...     if (nandc->props->qpic_v2 && qcom_nandc_is_lastcw()) here.

> +		reg = NAND_READ_LOCATION_LAST_CW_0;
>  
>  	if (nandc->props->is_bam)
> -		write_reg_dma(nandc, NAND_READ_LOCATION_0, 4,
> -			      NAND_BAM_NEXT_SGL);
> +		write_reg_dma(nandc, reg, 4, NAND_BAM_NEXT_SGL);
>  
>  	write_reg_dma(nandc, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
>  	write_reg_dma(nandc, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
> @@ -1142,12 +1186,12 @@ config_nand_cw_read(struct nand_chip *chip, bool use_ecc)

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: Md Sadre Alam <mdalam@codeaurora.org>
Cc: mani@kernel.org, boris.brezillon@collabora.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	sricharan@codeaurora.org
Subject: Re: [PATCH] mtd: rawnand: qcom: update last code word register
Date: Tue, 23 Feb 2021 17:34:49 +0100	[thread overview]
Message-ID: <20210223173449.1a55df1e@xps13> (raw)
In-Reply-To: <1614024267-12529-1-git-send-email-mdalam@codeaurora.org>

Hello,

Md Sadre Alam <mdalam@codeaurora.org> wrote on Tue, 23 Feb 2021
01:34:27 +0530:

> From QPIC version 2.0 onwards new register got added to read last

                               a new

> codeword. This change will add the READ_LOCATION_LAST_CW_n register.

            Add support for this READ_LOCATION_LAST_CW_n register.

> 
> For first three code word READ_LOCATION_n register will be
> use.For last code word READ_LOCATION_LAST_CW_n register will be
> use.

"
In the case of QPIC v2, codewords 0, 1 and 2 will be accessed through
READ_LOCATION_n, while codeword 3 will be accessed through
READ_LOCATION_LAST_CW_n.
"

When I read my own sentence, I feel that there is something wrong.
If there are only 4 codewords, I guess a QPIC v2 is able to use
READ_LOCATION_3 or READ_LOCATION_LAST_CW_0 interchangeably. Isn't it?

I guess the point of having these "last_cw_n" registers is to support
up to 8 codewords, am I wrong? If this the case, the current patch
completely fails doing that I don't get the point of such change.

> Signed-off-by: Md Sadre Alam <mdalam@codeaurora.org>
> ---

[...]

>  /* helper to configure address register values */
> @@ -700,8 +727,9 @@ static void set_address(struct qcom_nand_host *host, u16 column, int page)
>   *
>   * @num_cw:		number of steps for the read/write operation
>   * @read:		read or write operation
> + * @cw	:		which code word
>   */
> -static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read)
> +static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read, int cw)
>  {
>  	struct nand_chip *chip = &host->chip;
>  	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> @@ -740,7 +768,7 @@ static void update_rw_regs(struct qcom_nand_host *host, int num_cw, bool read)
>  	nandc_set_reg(nandc, NAND_EXEC_CMD, 1);
>  
>  	if (read)
> -		nandc_set_read_loc(chip, 0, 0, 0, host->use_ecc ?
> +		nandc_set_read_loc(chip, cw, 0, 0, host->use_ecc ?
>  				   host->cw_data : host->cw_size, 1);
>  }
>  
> @@ -1111,18 +1139,34 @@ static void config_nand_page_read(struct nand_chip *chip)
>  		      NAND_ERASED_CW_SET | NAND_BAM_NEXT_SGL);
>  }
>  
> +/* helper to check which location register should be use for this

    /*
     * Check which location...

> + * code word. NAND_READ_LOCATION or NAND_READ_LOCATION_LAST_CW
> + */
> +static bool config_loc_last_reg(struct nand_chip *chip, int cw)
> +{
> +	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> +	struct nand_ecc_ctrl *ecc = &chip->ecc;
> +
> +	if (nandc->props->qpic_v2 && qcom_nandc_is_last_cw(ecc, cw))
> +		return true;

Not sure this is really useful, it's probably better to drop this
helper and just use...

> +
> +	return false;
> +}
>  /*
>   * Helper to prepare DMA descriptors for configuring registers
>   * before reading each codeword in NAND page.
>   */
>  static void
> -config_nand_cw_read(struct nand_chip *chip, bool use_ecc)
> +config_nand_cw_read(struct nand_chip *chip, bool use_ecc, int cw)
>  {
>  	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> +	int reg = NAND_READ_LOCATION_0;
> +
> +	if (config_loc_last_reg(chip, cw))

...     if (nandc->props->qpic_v2 && qcom_nandc_is_lastcw()) here.

> +		reg = NAND_READ_LOCATION_LAST_CW_0;
>  
>  	if (nandc->props->is_bam)
> -		write_reg_dma(nandc, NAND_READ_LOCATION_0, 4,
> -			      NAND_BAM_NEXT_SGL);
> +		write_reg_dma(nandc, reg, 4, NAND_BAM_NEXT_SGL);
>  
>  	write_reg_dma(nandc, NAND_FLASH_CMD, 1, NAND_BAM_NEXT_SGL);
>  	write_reg_dma(nandc, NAND_EXEC_CMD, 1, NAND_BAM_NEXT_SGL);
> @@ -1142,12 +1186,12 @@ config_nand_cw_read(struct nand_chip *chip, bool use_ecc)

Thanks,
Miquèl

  reply	other threads:[~2021-02-23 16:35 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22 20:04 [PATCH] mtd: rawnand: qcom: update last code word register Md Sadre Alam
2021-02-22 20:04 ` Md Sadre Alam
2021-02-23 16:34 ` Miquel Raynal [this message]
2021-02-23 16:34   ` Miquel Raynal
2021-02-23 19:43   ` mdalam
2021-02-23 19:43     ` mdalam
2021-02-24  4:39     ` mdalam
2021-02-24  4:39       ` mdalam
2021-02-24  6:48       ` Miquel Raynal
2021-02-24  6:48         ` Miquel Raynal
2021-02-24 16:30         ` mdalam
2021-02-24 16:30           ` mdalam
2021-02-24 16:36           ` Miquel Raynal
2021-02-24 16:36             ` Miquel Raynal
2021-02-26 18:25             ` mdalam
2021-02-26 18:25               ` mdalam
  -- strict thread matches above, loose matches on Subject: below --
2021-02-15 19:16 Md Sadre Alam
2021-02-15 19:16 ` Md Sadre Alam
2021-02-16  8:16 ` Miquel Raynal
2021-02-16  8:16   ` Miquel Raynal
2021-02-16 17:53   ` mdalam
2021-02-16 17:53     ` mdalam
2021-02-18  9:20     ` Miquel Raynal
2021-02-18  9:20       ` Miquel Raynal
2021-02-18 16:29       ` mdalam
2021-02-18 16:29         ` mdalam
2021-02-21 20:27         ` mdalam
2021-02-21 20:27           ` mdalam
2021-02-14 21:17 Md Sadre Alam
2021-02-14 21:17 ` Md Sadre Alam
2021-02-15  8:40 ` Miquel Raynal
2021-02-15  8:40   ` Miquel Raynal
2021-02-15 19:19   ` mdalam
2021-02-15 19:19     ` mdalam
2020-12-17 14:02 Md Sadre Alam
2020-12-17 14:02 ` Md Sadre Alam
2020-12-31 10:53 ` Manivannan Sadhasivam
2020-12-31 10:53   ` Manivannan Sadhasivam
2021-01-04 18:54   ` mdalam
2021-01-04 18:54     ` mdalam
2021-01-05 15:45     ` Manivannan Sadhasivam
2021-01-05 15:45       ` Manivannan Sadhasivam
2021-01-10  3:49       ` mdalam
2021-01-10  3:49         ` mdalam

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=20210223173449.1a55df1e@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=boris.brezillon@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=mdalam@codeaurora.org \
    --cc=sricharan@codeaurora.org \
    /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.