public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 V2 2/2] mtd: rawnand: qcom: set BAM mode only if not set already
Date: Thu, 11 Jun 2020 09:13:36 +0200	[thread overview]
Message-ID: <20200611091336.1f22ad55@xps13> (raw)
In-Reply-To: <2abac8fb-28ac-5137-70cc-47cbd20613b7@codeaurora.org>

Hi Sivaprakash,

Sivaprakash Murugesan <sivaprak@codeaurora.org> wrote on Thu, 11 Jun
2020 09:57:59 +0530:

> Hi Miquel,
> 
> Thanks for the review.
> 
> On 6/9/2020 7:33 PM, Miquel Raynal wrote:
> > Hi Sivaprakash,
> >
> > Sivaprakash Murugesan <sivaprak@codeaurora.org> wrote on Tue,  9 Jun
> > 2020 16:40:56 +0530:
> >  
> >> BAM mode is set by writing BAM_MODE_EN bit on NAND_CTRL register.
> >> NAND_CTRL is an operational register and in BAM mode operational
> >> registers are read only.
> >>
> >> So, before writing into NAND_CTRL register check if BAM mode is already
> >> enabled by bootloader, and set BAM mode only if it is not set already.
> >>
> >> Signed-off-by: Sivaprakash Murugesan <sivaprak@codeaurora.org>
> >> ---
> >>   drivers/mtd/nand/raw/qcom_nandc.c | 9 ++++++++-
> >>   1 file changed, 8 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> >> index e0afa2c..7740059 100644
> >> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> >> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> >> @@ -2779,7 +2779,14 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc)
> >>   	/* 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);
> >> +		/* NAND_CTRL is an operational registers, and CPU
> >> +		 * access to operational registers are read only
> >> +		 * in BAM mode. So update the NAND_CTRL register
> >> +		 * only if it is not in BAM mode. In most cases BAM
> >> +		 * mode will be enabled in 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);
> >>   	}  
> > Does this currently produces an issue at runtime?
> >
> > If yes, you should have a Fixes/CC: stable pair of tags.
> >
> > Also, what is BAM mode? Please tell us in the commit log.  
> 
> Currently this is not causing any issue on run time.
> 
> The writes to this register is silently ignored.
> 
> However, this could be an issue in future Hardware designs.
> 
> BAM is the DMA engine on QCOM IPQ platforms, sure will explain this
> 
> mode in next patchset.

I don't like so much the idea of DMA being enabled by the Bootloader or
not, this is something that should need to be fixed.


Thanks,
Miquèl

      reply	other threads:[~2020-06-11  7:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 11:10 [PATCH V2 0/2] Fix issues related to register access in IPQ NAND Sivaprakash Murugesan
2020-06-09 11:10 ` [PATCH V2 1/2] mtd: rawnand: qcom: remove write to unavailable register Sivaprakash Murugesan
2020-06-09 14:02   ` Miquel Raynal
2020-06-11  4:30     ` Sivaprakash Murugesan
2020-06-09 11:10 ` [PATCH V2 2/2] mtd: rawnand: qcom: set BAM mode only if not set already Sivaprakash Murugesan
2020-06-09 14:03   ` Miquel Raynal
2020-06-11  4:27     ` Sivaprakash Murugesan
2020-06-11  7:13       ` Miquel Raynal [this message]

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=20200611091336.1f22ad55@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox