[U-Boot] [U-Boot,05/10] mtd: nand: s3c: Add S3C2440 specifics

Scott Wood scottwood at freescale.com
Sat May 2 03:05:12 CEST 2015


On Sat, 2015-05-02 at 02:48 +0200, Marek Vasut wrote:
> On Thursday, November 27, 2014 at 03:20:53 AM, Scott Wood wrote:
> > On Sat, Oct 11, 2014 at 06:42:53PM +0200, Marek Vasut wrote:
> > > +#ifdef CONFIG_S3C2410
> > > +		sel_reg = (uint32_t)&nand->nfconf;
> > > +		sel_bit = S3C2410_NFCONF_nFCE;
> > > +#else
> > > +		sel_reg = (uint32_t)&nand->nfcont;
> > > +		sel_bit = S3C2440_NFCONT_nFCE;
> > > +#endif
> > 
> > Why are you casting &nand->nfcon[ft] to an integer...
> 
> Where exactly ?

	sel_reg = (uint32_t)&nand->nfconf;

> > >  		if (ctrl & NAND_NCE)
> > > 
> > > -			writel(readl(&nand->nfconf) & ~S3C2410_NFCONF_nFCE,
> > > -			       &nand->nfconf);
> > > +			clrbits_le32(sel_reg, sel_bit);
> > > 
> > >  		else
> > > 
> > > -			writel(readl(&nand->nfconf) | S3C2410_NFCONF_nFCE,
> > > -			       &nand->nfconf);
> > > +			setbits_le32(sel_reg, sel_bit);
> > 
> > ...only to pass that integer to something that normally accepts a
> > pointer, which doesn't cause a warning only because of ARM's crappy I/O
> > accessors that don't do type checking?
> > 
> > At least the code that was there before used ulong for inappropriate
> > pointer-to-integer casts rather than uint32_t. :-P
> 
> So what do you suggest ?

Store it in a proper pointer type.

-Scott




More information about the U-Boot mailing list