Re: [PATCH 2/2] mtd: nand: fsl-ifc: fixup SRAM init for newer ctrl versions

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

 



Hi Kurt,


> > > @@ -769,6 +770,23 @@ static int fsl_ifc_sram_init(struct fsl_ifc_mtd *priv)
> > >  	uint32_t csor = 0, csor_8k = 0, csor_ext = 0;
> > >  	uint32_t cs = priv->bank;
> > >
> > > +	if (ctrl->version > FSL_IFC_VERSION_1_1_0) {  
> >
> > This is redundant and fsl_ifc_sram_init() is called only if
> > "ctrl->version > FSL_FC_VERSION_1_1_0".  
> 
> No, it's not. It's called when ctrl->version >=
> FSL_IFC_VERSION_1_1_0. Therefore, this check is needed.

Oh right, I missed the "=".

> 
> >
> > So this means this function has never worked?  
> 
> It did work for e.g. IFC controller in version 1.1.0.
> 
> However, it worked for the newer versions by accident, because U-Boot
> already initialized the SRAM correctly. If you boot without NAND
> initialization in U-Boot, then you'll hit the issue.
> 
> >
> > If this is the case, there should be at least a Fixes: tag.
> >
> > Maybe it would be cleaner to always call fsl_ifc_sram_init() from the
> > probe(), and just exit with a "return 0" here if the version is old?
> > (I'll let you choose the way you prefer).  
> 
> Sounds like a good idea. Otherwise we have to check the version twice.
> 
> >  
> > > +		u32 ncfgr, status;
> > > +		int ret;
> > > +
> > > +		/* Trigger auto initialization */
> > > +		ncfgr = ifc_in32(&ifc_runtime->ifc_nand.ncfgr);
> > > +		ifc_out32(ncfgr | IFC_NAND_NCFGR_SRAM_INIT_EN, &ifc_runtime->ifc_nand.ncfgr);
> > > +
> > > +		/* Wait until done */
> > > +		ret = readx_poll_timeout(ifc_in32, &ifc_runtime->ifc_nand.ncfgr,
> > > +					 status, !(status & IFC_NAND_NCFGR_SRAM_INIT_EN),
> > > +					 10, 1000);  
> >
> > Nit: I always prefer when delays/timeouts are defined (and may be
> > reused).  
> 
> Me too. I've missed that there is already a timeout constant
> IFC_TIMEOUT_MSECS (500). As it's huge, I'll add a second one.

Well, I'm not bothered with huge timeouts, it's in the error path so we
don't really care.

Thanks,
Miquèl

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




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

  Powered by Linux