[PATCH 3/5] mtd: rawnand: gpmi: add iMX8QXP support.

Frank Li Frank.li at nxp.com
Fri May 17 12:56:13 PDT 2024


On Fri, May 17, 2024 at 08:39:04PM +0200, Miquel Raynal wrote:
> Hi Frank,
> 
> Frank.Li at nxp.com wrote on Fri, 17 May 2024 14:09:50 -0400:
> 
> > From: Han Xu <han.xu at nxp.com>
> > 
> > Add "fsl,imx8qxp-gpmi-nand" compatible string. iMX8QXP gpmi nand is similar
> > with iMX7D. But it using 4 clock: "gpmi_io", "gpmi_apb", "gpmi_bch" and
> 
>   to?             is         clocks
> 
> > "gpmi_bch_apb".
> > 
> > Signed-off-by: Han Xu <han.xu at nxp.com>
> > Signed-off-by: Frank Li <Frank.Li at nxp.com>
> > ---
> >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 20 +++++++++++++++++---
> >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h |  4 ++++
> >  2 files changed, 21 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > index e71ad2fcec232..f90c5207bacb6 100644
> > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > @@ -983,7 +983,8 @@ static int gpmi_setup_interface(struct nand_chip *chip, int chipnr,
> >  		return PTR_ERR(sdr);
> >  
> >  	/* Only MX28/MX6 GPMI controller can reach EDO timings */
> > -	if (sdr->tRC_min <= 25000 && !GPMI_IS_MX28(this) && !GPMI_IS_MX6(this))
> > +	if (sdr->tRC_min <= 25000 && !GPMI_IS_MX28(this) &&
> > +	    !(GPMI_IS_MX6(this) || GPMI_IS_MX8(this)))
> 
> Feels completely redundant, no? If it's not an imx6 nor an imx28, it
> already returns -ENOTSUPP.

if this is mx8

	sdr->tRC_min <= 25000:   true
        !GPMI_IS_MX28(this):     true
        !GPMI_IS_MX6(this):      true

        so whole statement is true

after change
       sdr->tRC_min <= 25000:   true                                      
       !GPMI_IS_MX28(this):     true                                      
       !(GPMI_IS_MX6(this) || GPMI_IS_MX8(this)): false
        (GPMI_IS_MX6(this) || GPMI_IS_MX8(this)): true
            GPMI_IS_MX6(this):   false
            GPMI_IS_MX8(this):   true

so whole statement is false. Maybe use 

sdr->tRC_min <= 25000 && !GPMI_IS_MX28(this) && !(GPMI_IS_MX6(this) &&
!(GPMI_IS_MX8(this))

looks better.

Or use a drvflag. 
     if (sdr->tRC_min <= 25000 && (!this->drvflag->support_tRC_min))

Frank

> 
> >  		return -ENOTSUPP;
> 
> 
> Fine otherwise.
> 
> Thanks,
> Miquèl



More information about the linux-mtd mailing list