diff mbox

mtd: nand: mtk: deselect the chip that was selected in resume function

Message ID 1509517197-60350-1-git-send-email-xiaolei.li@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

xiaolei li Nov. 1, 2017, 6:19 a.m. UTC
From: Xiaolei Li <xiaolei.li@mediatek.com>

It is necessary to deselect the chip if it was selected before.
But now we only select chips when resume nand driver.
So, deselect the chip after doing nand reset.

Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
---
 drivers/mtd/nand/mtk_nand.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Boris BREZILLON Nov. 1, 2017, 10 a.m. UTC | #1
Hi Xiaolei,

On Wed, 1 Nov 2017 14:19:57 +0800
<xiaolei.li@mediatek.com> wrote:

> From: Xiaolei Li <xiaolei.li@mediatek.com>
> 
> It is necessary to deselect the chip if it was selected before.
> But now we only select chips when resume nand driver.
> So, deselect the chip after doing nand reset.
> 
> Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> ---
>  drivers/mtd/nand/mtk_nand.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
> index d86a7d1..a8bf61a 100644
> --- a/drivers/mtd/nand/mtk_nand.c
> +++ b/drivers/mtd/nand/mtk_nand.c
> @@ -1557,6 +1557,7 @@ static int mtk_nfc_resume(struct device *dev)
>  		for (i = 0; i < chip->nsels; i++) {
>  			nand->select_chip(mtd, i);
>  			nand->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
> +			nand->select_chip(mtd, -1);

Can you use nand_reset() instead of open-coding this sequence?

Thanks,

Boris

>  		}
>  	}
>
xiaolei li Nov. 1, 2017, 10:07 a.m. UTC | #2
Hi Boris,

On Wed, 2017-11-01 at 11:00 +0100, Boris Brezillon wrote:
> Hi Xiaolei,
> 
> On Wed, 1 Nov 2017 14:19:57 +0800
> <xiaolei.li@mediatek.com> wrote:
> 
> > From: Xiaolei Li <xiaolei.li@mediatek.com>
> > 
> > It is necessary to deselect the chip if it was selected before.
> > But now we only select chips when resume nand driver.
> > So, deselect the chip after doing nand reset.
> > 
> > Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
> > ---
> >  drivers/mtd/nand/mtk_nand.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
> > index d86a7d1..a8bf61a 100644
> > --- a/drivers/mtd/nand/mtk_nand.c
> > +++ b/drivers/mtd/nand/mtk_nand.c
> > @@ -1557,6 +1557,7 @@ static int mtk_nfc_resume(struct device *dev)
> >  		for (i = 0; i < chip->nsels; i++) {
> >  			nand->select_chip(mtd, i);
> >  			nand->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
> > +			nand->select_chip(mtd, -1);
> 
> Can you use nand_reset() instead of open-coding this sequence?
> 
OK. Got it.
Will update it in PATCH v2.

Thanks,

Xiaolei

> Thanks,
> 
> Boris
> 
> >  		}
> >  	}
> >  
>
diff mbox

Patch

diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
index d86a7d1..a8bf61a 100644
--- a/drivers/mtd/nand/mtk_nand.c
+++ b/drivers/mtd/nand/mtk_nand.c
@@ -1557,6 +1557,7 @@  static int mtk_nfc_resume(struct device *dev)
 		for (i = 0; i < chip->nsels; i++) {
 			nand->select_chip(mtd, i);
 			nand->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
+			nand->select_chip(mtd, -1);
 		}
 	}