[U-Boot] [PATCH v2 09/16] mtd/nand/tegra: alignment workaround

Scott Wood scottwood at freescale.com
Thu Aug 6 00:16:10 CEST 2015


On Wed, 2015-08-05 at 22:12 +0000, Marcel Ziswiler wrote:
> On Tue, 2015-07-28 at 03:55 +0200, Marcel Ziswiler wrote:
> > 
> > On 27 July 2015 21:57:14 CEST, Scott Wood <scottwood at freescale.com> 
> > wrote:
> > > > -     writel(virt_to_phys(buf), &info->reg->data_block_ptr);
> > > > +     writel((u32)bbstate.bounce_buffer, &info->reg
> > > > ->data_block_ptr);
> > > 
> > > Why are you converting usage of virt_to_phys() into a u32 cast?
> > 
> > Good question. I believe this I took straight from the MMC driver but 
> > will double check it again for a v3.
> 
> Yes, the MMC driver actually even does a double cast. Don't knowexactly 
> what that should bring but that's how it looks there:
> writel((u32)(unsigned long)bbstate->bounce_buffer, &host->reg->sysad);
> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/mmc/tegra_mmc.c;hb=HEAD#l70
> Nonetheless I changed it back to using virt_to_phys() for the v3 to 
> beposted soon.

The double cast suppresses a warning in 64-bit builds (converting directly 
from a pointer to an integer of a different size), but ideally virt_to_phys() 
should be used.

-Scott



More information about the U-Boot mailing list