Re: [PATCH] mtd: rawnand: marvell: Ensure the ND_RUN bit is reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Boris,

Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Mon, 8 Apr
2019 10:07:47 +0200:

> On Sun,  7 Apr 2019 21:34:01 +0200
> Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
> 
> > Since the migration of the driver to stop using the legacy  
> > ->select_chip() hook, there is nothing deselecting the target anymore,    
> > thus the selection is not forced at the next access. Ensure the ND_RUN
> > bit is always in a clean state.
> > 
> > Cc: Daniel Mack <daniel@xxxxxxxxxx>
> > Cc: stable@xxxxxxxxxxxxxxx
> > Fixes: b25251414f6e00 ("mtd: rawnand: marvell: Stop implementing ->select_chip()")
> > Suggested-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
> > Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> > ---
> > 
> > Hi Daniel, could you please test this version of the fix?
> > 
> > Thanks,
> > Miquèl
> > 
> > 
> >  drivers/mtd/nand/raw/marvell_nand.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> > index f38e5c1b87e4..a7d7f17d8682 100644
> > --- a/drivers/mtd/nand/raw/marvell_nand.c
> > +++ b/drivers/mtd/nand/raw/marvell_nand.c
> > @@ -722,12 +722,6 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
> >  	struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
> >  	u32 ndcr_generic;
> >  
> > -	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
> > -		return;
> > -
> > -	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
> > -	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
> > -
> >  	/*
> >  	 * Reset the NDCR register to a clean state for this particular chip,
> >  	 * also clear ND_RUN bit.
> > @@ -736,6 +730,12 @@ static void marvell_nfc_select_target(struct nand_chip *chip,
> >  		       NDCR_GENERIC_FIELDS_MASK & ~NDCR_ND_RUN;
> >  	writel_relaxed(ndcr_generic | marvell_nand->ndcr, nfc->regs + NDCR);
> >  
> > +	if (chip == nfc->selected_chip && die_nr == marvell_nand->selected_die)
> > +		return;
> > +
> > +	writel_relaxed(marvell_nand->ndtr0, nfc->regs + NDTR0);
> > +	writel_relaxed(marvell_nand->ndtr1, nfc->regs + NDTR1);
> > +
> >  	/* Also reset the interrupt status register */
> >  	marvell_nfc_clear_int(nfc, NDCR_ALL_INT);  
> 
> I think this should also be moved before the
> 
> 	if (chip == nfc->selected_chip &&
> 	    die_nr == marvell_nand->selected_die)
> 
> check.

Yes, I think it is not needed, I wanted Daniel to test. But maybe it is
better to ensure interrupts are always cleared anyway. I'll send a v2
then.


Thanks,
Miquèl



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux