Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read
@ 2020-10-09  8:07 Praveenkumar I
  2020-10-28 10:08 ` Miquel Raynal
  2020-10-30 17:27 ` Miquel Raynal
  0 siblings, 2 replies; 4+ messages in thread
From: Praveenkumar I @ 2020-10-09  8:07 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, sivaprak, peter.ujfalusi,
	boris.brezillon, linux-mtd, linux-kernel
  Cc: kathirav, Praveenkumar I, stable

After each codeword NAND_FLASH_STATUS is read for possible operational
failures. But there is no DMA sync for CPU operation before reading it
and this leads to incorrect or older copy of DMA buffer in reg_read_buf.

This patch adds the DMA sync on reg_read_buf for CPU before reading it.

Fixes: 5bc36b2bf6e2 ("mtd: rawnand: qcom: check for operation errors in case of raw read")
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org>
---
 drivers/mtd/nand/raw/qcom_nandc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index bd7a7251429b..5bb85f1ba84c 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -1570,6 +1570,8 @@ static int check_flash_errors(struct qcom_nand_host *host, int cw_cnt)
 	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
 	int i;
 
+	nandc_read_buffer_sync(nandc, true);
+
 	for (i = 0; i < cw_cnt; i++) {
 		u32 flash = le32_to_cpu(nandc->reg_read_buf[i]);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read
  2020-10-09  8:07 [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read Praveenkumar I
@ 2020-10-28 10:08 ` Miquel Raynal
       [not found]   ` <24a781a3-488c-b638-1b92-0f279807446f@codeaurora.org>
  2020-10-30 17:27 ` Miquel Raynal
  1 sibling, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2020-10-28 10:08 UTC (permalink / raw)
  To: Praveenkumar I
  Cc: kathirav, vigneshr, richard, linux-kernel, stable,
	peter.ujfalusi, boris.brezillon, linux-mtd, sivaprak

Hello,

Praveenkumar I <ipkumar@codeaurora.org> wrote on Fri,  9 Oct 2020
13:37:52 +0530:

> After each codeword NAND_FLASH_STATUS is read for possible operational
> failures. But there is no DMA sync for CPU operation before reading it
> and this leads to incorrect or older copy of DMA buffer in reg_read_buf.
> 
> This patch adds the DMA sync on reg_read_buf for CPU before reading it.
> 
> Fixes: 5bc36b2bf6e2 ("mtd: rawnand: qcom: check for operation errors in case of raw read")

I guess this deserves a proper Cc: stable tag?

> Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org>

I think your full name is required in the SoB line (should match the
authorship).

Otherwise looks good to me.

> ---
>  drivers/mtd/nand/raw/qcom_nandc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> index bd7a7251429b..5bb85f1ba84c 100644
> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> @@ -1570,6 +1570,8 @@ static int check_flash_errors(struct qcom_nand_host *host, int cw_cnt)
>  	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
>  	int i;
>  
> +	nandc_read_buffer_sync(nandc, true);
> +
>  	for (i = 0; i < cw_cnt; i++) {
>  		u32 flash = le32_to_cpu(nandc->reg_read_buf[i]);
>  

Thanks,
Miquèl

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read
       [not found]   ` <24a781a3-488c-b638-1b92-0f279807446f@codeaurora.org>
@ 2020-10-28 14:23     ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2020-10-28 14:23 UTC (permalink / raw)
  To: Praveenkumar I
  Cc: kathirav, vigneshr, richard, linux-kernel, stable,
	peter.ujfalusi, boris.brezillon, linux-mtd, sivaprak

Hello,

Praveenkumar I <ipkumar@codeaurora.org> wrote on Wed, 28 Oct 2020
19:48:34 +0530:

> Hi Miquel,
> 
> Please find the inline reply.
> 
> Thanks,
> Praveenkumar I
> 
> 
> On 10/28/2020 3:38 PM, Miquel Raynal wrote:
> > Hello,
> >
> > Praveenkumar I <ipkumar@codeaurora.org> wrote on Fri,  9 Oct 2020
> > 13:37:52 +0530:
> >  
> >> After each codeword NAND_FLASH_STATUS is read for possible operational
> >> failures. But there is no DMA sync for CPU operation before reading it
> >> and this leads to incorrect or older copy of DMA buffer in reg_read_buf.
> >>
> >> This patch adds the DMA sync on reg_read_buf for CPU before reading it.
> >>
> >> Fixes: 5bc36b2bf6e2 ("mtd: rawnand: qcom: check for operation errors in case of raw read")  
> > I guess this deserves a proper Cc: stable tag?  
> >    >> Yes. I will send a V2 Patch with stable tag in Cc  

That's fine for this one, I'll add it myself.

> >> Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org>  
> > I think your full name is required in the SoB line (should match the
> > authorship).  
> >     >> "Praveenkumar I" is my full name and it is same as the authorship.  

Ok, sorry for the confusion.

> > Otherwise looks good to me.
> >  
> >> ---
> >>   drivers/mtd/nand/raw/qcom_nandc.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> >> index bd7a7251429b..5bb85f1ba84c 100644
> >> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> >> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> >> @@ -1570,6 +1570,8 @@ static int check_flash_errors(struct qcom_nand_host *host, int cw_cnt)
> >>   	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> >>   	int i;  
> >>   >> +	nandc_read_buffer_sync(nandc, true);  
> >> +
> >>   	for (i = 0; i < cw_cnt; i++) {
> >>   		u32 flash = le32_to_cpu(nandc->reg_read_buf[i]);  
> >>   > Thanks,  
> > Miquèl  
> 

Cheers,
Miquèl

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read
  2020-10-09  8:07 [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read Praveenkumar I
  2020-10-28 10:08 ` Miquel Raynal
@ 2020-10-30 17:27 ` Miquel Raynal
  1 sibling, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2020-10-30 17:27 UTC (permalink / raw)
  To: Praveenkumar I, miquel.raynal, richard, vigneshr, sivaprak,
	peter.ujfalusi, boris.brezillon, linux-mtd, linux-kernel
  Cc: kathirav, stable

On Fri, 2020-10-09 at 08:07:52 UTC, Praveenkumar I wrote:
> After each codeword NAND_FLASH_STATUS is read for possible operational
> failures. But there is no DMA sync for CPU operation before reading it
> and this leads to incorrect or older copy of DMA buffer in reg_read_buf.
> 
> This patch adds the DMA sync on reg_read_buf for CPU before reading it.
> 
> Fixes: 5bc36b2bf6e2 ("mtd: rawnand: qcom: check for operation errors in case of raw read")
> Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  8:07 [PATCH] mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read Praveenkumar I
2020-10-28 10:08 ` Miquel Raynal
     [not found]   ` <24a781a3-488c-b638-1b92-0f279807446f@codeaurora.org>
2020-10-28 14:23     ` Miquel Raynal
2020-10-30 17:27 ` Miquel Raynal

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org
	public-inbox-index linux-mtd

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git