[RFC PATCH 2/2] gpmi-nand: Add ERR007117 protection for nfc_apply_timings

han.xu at nxp.com han.xu at nxp.com
Fri Oct 22 07:35:14 PDT 2021


On 21/10/22 08:45AM, Stefan Riedmüller wrote:
> Hi Han,
> 
> sorry it took me some time to get back to you.
> 
> On Wed, 2021-10-13 at 00:01 -0500, Han Xu wrote:
> > On 21/10/12 11:02AM, Stefan Riedmueller wrote:
> > > According to i.MX 6 erratum ERR007117 gpmi clocks need to be gated off
> > > when doing a gpmi_io clk rate change. So gate the clocks off before
> > > the rate change in nfc_apply_timings and ungate them again after the
> > > change.
> > > 
> > > Otherwise this rate change can lead to an unresponsive GPMI core which
> > > results in DMA timeouts and failed driver probe:
> > > 
> > > [    4.072318] gpmi-nand 112000.gpmi-nand: DMA timeout, last DMA
> > > ...
> > > [    4.370355] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -110
> > > ...
> > > [    4.375988] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22
> > > [    4.381524] gpmi-nand 112000.gpmi-nand: Error in ECC-based read: -22
> > > [    4.387988] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22
> > > [    4.393535] gpmi-nand 112000.gpmi-nand: Chip: 0, Error -22
> > > ...
> > > 
> > > Signed-off-by: Stefan Riedmueller <s.riedmueller at phytec.de>
> > > ---
> > > Hi,
> > > 
> > > I'm not sure about the error handling here, if it is actually neccessary.
> > > So some feedback would be nice here.
> > > 
> > > Thanks,
> > > Stefan
> > > ---
> > >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 21 +++++++++++++++++++--
> > >  1 file changed, 19 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > index a1f7000f033e..326c8a895f1f 100644
> > > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > @@ -713,15 +713,28 @@ static void gpmi_nfc_compute_timings(struct
> > > gpmi_nand_data *this,
> > >  			      (use_half_period ? BM_GPMI_CTRL1_HALF_PERIOD :
> > > 0);
> > >  }
> > >  
> > > -static void gpmi_nfc_apply_timings(struct gpmi_nand_data *this)
> > > +static int gpmi_nfc_apply_timings(struct gpmi_nand_data *this)
> > >  {
> > >  	struct gpmi_nfc_hardware_timing *hw = &this->hw;
> > >  	struct resources *r = &this->resources;
> > >  	void __iomem *gpmi_regs = r->gpmi_regs;
> > >  	unsigned int dll_wait_time_us;
> > > +	int ret;
> > > +
> > > +	if (GPMI_IS_MX6Q(this)) {
> > 
> > Not only for 6Q but for GPMI_IS_MX6
> 
> Can you confirm that i.MX 6SX and i.MX 7 are affected by the ERR007117 erratum
> as well? Because the i.MX 6UL/ULL are included by the GPMI_IS_MX6Q already.

i.MX6SX has the glitch issue for sure, but I can double check if it's due to the
same errata. I will also go check if the errata will affect i.MX7

> 
> Or do we need another macro for i.MX 6UL/ULL as Christian has suggested
> earlier?
> 
> Thanks,
> Stefan
> 
> > 
> > > +		ret = __gpmi_enable_clk(this, false);
> > > +		if (ret)
> > > +			return ret;
> > > +	}
> > >  
> > >  	clk_set_rate(r->clock[0], hw->clk_rate);
> > >  
> > > +	if (GPMI_IS_MX6Q(this)) {
> > > +		ret = __gpmi_enable_clk(this, true);
> > > +		if (ret)
> > > +			return ret;
> > > +	}
> > > +
> > >  	writel(hw->timing0, gpmi_regs + HW_GPMI_TIMING0);
> > >  	writel(hw->timing1, gpmi_regs + HW_GPMI_TIMING1);
> > >  
> > > @@ -739,6 +752,8 @@ static void gpmi_nfc_apply_timings(struct
> > > gpmi_nand_data *this)
> > >  
> > >  	/* Wait for the DLL to settle. */
> > >  	udelay(dll_wait_time_us);
> > > +
> > > +	return 0;
> > >  }
> > >  
> > >  static int gpmi_setup_interface(struct nand_chip *chip, int chipnr,
> > > @@ -2271,7 +2286,9 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
> > >  	 */
> > >  	if (this->hw.must_apply_timings) {
> > >  		this->hw.must_apply_timings = false;
> > > -		gpmi_nfc_apply_timings(this);
> > > +		ret = gpmi_nfc_apply_timings(this);
> > > +		if (ret)
> > > +			return ret;
> > >  	}
> > >  
> > >  	dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
> > > -- 
> > > 2.25.1
> > > 



More information about the linux-mtd mailing list