Re: [PATCH v5 22/28] mtd: rawnand: Add the ->choose_data_interface() hook

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

 



Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Tue, 26 May
2020 23:52:25 +0200:

> On Tue, 26 May 2020 21:17:19 +0200
> Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
> 
> > This hook can be overloaded by NAND manufacturer drivers to propose
> > alternative timings when not following the main standards. In this
> > case, the manufacturer drivers is responsible for choosing the best
> > data interface and configuration that fits both the controller and  
> 
> 		  ^ s/and//
> 
> > chip capabilities.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
> > ---
> >  drivers/mtd/nand/raw/nand_base.c | 9 +++++++--
> >  include/linux/mtd/rawnand.h      | 3 +++
> >  2 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> > index b2e833a8ab9d..f14d297c50f4 100644
> > --- a/drivers/mtd/nand/raw/nand_base.c
> > +++ b/drivers/mtd/nand/raw/nand_base.c
> > @@ -1046,7 +1046,6 @@ int nand_choose_best_sdr_timings(struct nand_chip *chip,
> >  		}
> >  	}
> >  
> > -  
> 
> Should this line removal be part of another patch?

Absoluely.

> 
> >  	for (mode = best_mode; mode >= 0; mode--) {
> >  		ret = onfi_fill_data_interface(chip, iface, NAND_SDR_IFACE,
> >  					       mode);
> > @@ -1068,7 +1067,9 @@ int nand_choose_best_sdr_timings(struct nand_chip *chip,
> >   * @chip: The NAND chip
> >   *
> >   * Find the best data interface and NAND timings supported by the chip
> > - * and the driver.
> > + * and the driver. Eventually let the NAND manufacturer driver propose his own
> > + * set of timings.
> > + *
> >   * After this function nand_chip->data_interface is initialized with the best
> >   * timing mode available.
> >   *
> > @@ -1079,6 +1080,10 @@ static int nand_choose_data_interface(struct nand_chip *chip)
> >  	if (!nand_controller_has_setup_data_iface(chip))
> >  		return 0;
> >  
> > +	if (chip->ops.choose_data_interface)
> > +		return chip->ops.choose_data_interface(chip,
> > +						       &chip->data_interface);
> > +
> >  	return nand_choose_best_sdr_timings(chip, &chip->data_interface, NULL);
> >  }
> >  
> > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> > index 2995d29587c3..5bd79e853140 100644
> > --- a/include/linux/mtd/rawnand.h
> > +++ b/include/linux/mtd/rawnand.h
> > @@ -1034,6 +1034,7 @@ struct nand_legacy {
> >   * @lock_area: Lock operation
> >   * @unlock_area: Unlock operation
> >   * @setup_read_retry: Set the read-retry mode (mostly needed for MLC NANDs)
> > + * @choose_data_interface: Choose the best data interface
> >   */
> >  struct nand_chip_ops {
> >  	int (*suspend)(struct nand_chip *chip);
> > @@ -1041,6 +1042,8 @@ struct nand_chip_ops {
> >  	int (*lock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
> >  	int (*unlock_area)(struct nand_chip *chip, loff_t ofs, uint64_t len);
> >  	int (*setup_read_retry)(struct nand_chip *chip, int retry_mode);
> > +	int (*choose_data_interface)(struct nand_chip *chip,
> > +				     struct nand_data_interface *iface);
> >  };
> >  
> >  /**  
> 

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



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux