All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Sivaprakash Murugesan <sivaprak@codeaurora.org>
Cc: peter.ujfalusi@ti.com, richard@nod.at,
	linux-mtd@lists.infradead.org, vigneshr@ti.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: raw: qcom_nand: Fix register write error
Date: Mon, 8 Jun 2020 14:37:39 +0200	[thread overview]
Message-ID: <20200608143739.368f2b53@xps13> (raw)
In-Reply-To: <1591613254-1065-1-git-send-email-sivaprak@codeaurora.org>

Hi Sivaprakash,

Sivaprakash Murugesan <sivaprak@codeaurora.org> wrote on Mon,  8 Jun
2020 16:17:34 +0530:

Subject prefix should be mtd: rawnand: qcom:

And I don't think "Fix register write error" is relevant in any of the
two following cases.

> 1. SFLASHC_BURST_CFG register is not available on all ipq nand platforms,
>    it is available only on ipq8064 devices and the nand controller works
>    without configuring these registers in this platform, so register
>    write to this can be removed.
> 
> 2. Once BAM mode is enabled register writes to NAND_CTRL should be
>    performed through BAM command descriptors. The NAND BAM mode will
>    be enabled by bootloaders. Check if BAM mode is already enabled and
>    enable it only if not enabled already.
> 

It looks like there are two completely different changes that you are
doing here, please split.

Also, please explain why #2 is needed, it is not very clear.

Thanks,
Miquèl

> Signed-off-by: Sivaprakash Murugesan <sivaprak@codeaurora.org>
> ---
>  drivers/mtd/nand/raw/qcom_nandc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> index 5b11c70..7bfd93a 100644
> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> @@ -36,7 +36,6 @@
>  #define	NAND_DEV_CMD1			0xa4
>  #define	NAND_DEV_CMD2			0xa8
>  #define	NAND_DEV_CMD_VLD		0xac
> -#define	SFLASHC_BURST_CFG		0xe0
>  #define	NAND_ERASED_CW_DETECT_CFG	0xe8
>  #define	NAND_ERASED_CW_DETECT_STATUS	0xec
>  #define	NAND_EBI2_ECC_BUF_CFG		0xf0
> @@ -2774,14 +2773,20 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc)
>  	u32 nand_ctrl;
>  
>  	/* kill onenand */
> -	nandc_write(nandc, SFLASHC_BURST_CFG, 0);
>  	nandc_write(nandc, dev_cmd_reg_addr(nandc, NAND_DEV_CMD_VLD),
>  		    NAND_DEV_CMD_VLD_VAL);
>  
>  	/* enable ADM or BAM DMA */
>  	if (nandc->props->is_bam) {
>  		nand_ctrl = nandc_read(nandc, NAND_CTRL);
> -		nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
> +		/* Once BAM_MODE_EN bit is set, writes to the NAND_CTRL
> +		 * should be done through BAM command descriptors.
> +		 * in most cases bootloader enables the bam mode we
> +		 * need to set the BAM mode only if it is not set by
> +		 * bootloader
> +		 */
> +		if (!(nand_ctrl & BAM_MODE_EN))
> +			nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
>  	} else {
>  		nandc_write(nandc, NAND_FLASH_CHIP_SELECT, DM_EN);
>  	}


______________________________________________________
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: Sivaprakash Murugesan <sivaprak@codeaurora.org>
Cc: richard@nod.at, vigneshr@ti.com, peter.ujfalusi@ti.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: raw: qcom_nand: Fix register write error
Date: Mon, 8 Jun 2020 14:37:39 +0200	[thread overview]
Message-ID: <20200608143739.368f2b53@xps13> (raw)
In-Reply-To: <1591613254-1065-1-git-send-email-sivaprak@codeaurora.org>

Hi Sivaprakash,

Sivaprakash Murugesan <sivaprak@codeaurora.org> wrote on Mon,  8 Jun
2020 16:17:34 +0530:

Subject prefix should be mtd: rawnand: qcom:

And I don't think "Fix register write error" is relevant in any of the
two following cases.

> 1. SFLASHC_BURST_CFG register is not available on all ipq nand platforms,
>    it is available only on ipq8064 devices and the nand controller works
>    without configuring these registers in this platform, so register
>    write to this can be removed.
> 
> 2. Once BAM mode is enabled register writes to NAND_CTRL should be
>    performed through BAM command descriptors. The NAND BAM mode will
>    be enabled by bootloaders. Check if BAM mode is already enabled and
>    enable it only if not enabled already.
> 

It looks like there are two completely different changes that you are
doing here, please split.

Also, please explain why #2 is needed, it is not very clear.

Thanks,
Miquèl

> Signed-off-by: Sivaprakash Murugesan <sivaprak@codeaurora.org>
> ---
>  drivers/mtd/nand/raw/qcom_nandc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> index 5b11c70..7bfd93a 100644
> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> @@ -36,7 +36,6 @@
>  #define	NAND_DEV_CMD1			0xa4
>  #define	NAND_DEV_CMD2			0xa8
>  #define	NAND_DEV_CMD_VLD		0xac
> -#define	SFLASHC_BURST_CFG		0xe0
>  #define	NAND_ERASED_CW_DETECT_CFG	0xe8
>  #define	NAND_ERASED_CW_DETECT_STATUS	0xec
>  #define	NAND_EBI2_ECC_BUF_CFG		0xf0
> @@ -2774,14 +2773,20 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc)
>  	u32 nand_ctrl;
>  
>  	/* kill onenand */
> -	nandc_write(nandc, SFLASHC_BURST_CFG, 0);
>  	nandc_write(nandc, dev_cmd_reg_addr(nandc, NAND_DEV_CMD_VLD),
>  		    NAND_DEV_CMD_VLD_VAL);
>  
>  	/* enable ADM or BAM DMA */
>  	if (nandc->props->is_bam) {
>  		nand_ctrl = nandc_read(nandc, NAND_CTRL);
> -		nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
> +		/* Once BAM_MODE_EN bit is set, writes to the NAND_CTRL
> +		 * should be done through BAM command descriptors.
> +		 * in most cases bootloader enables the bam mode we
> +		 * need to set the BAM mode only if it is not set by
> +		 * bootloader
> +		 */
> +		if (!(nand_ctrl & BAM_MODE_EN))
> +			nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
>  	} else {
>  		nandc_write(nandc, NAND_FLASH_CHIP_SELECT, DM_EN);
>  	}


  reply	other threads:[~2020-06-08 12:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 10:47 [PATCH] mtd: raw: qcom_nand: Fix register write error Sivaprakash Murugesan
2020-06-08 10:47 ` Sivaprakash Murugesan
2020-06-08 12:37 ` Miquel Raynal [this message]
2020-06-08 12:37   ` Miquel Raynal

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=20200608143739.368f2b53@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=richard@nod.at \
    --cc=sivaprak@codeaurora.org \
    --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.