[U-Boot] [PATCHv2] fsl_ddr: Don't use full 64-bit divides on32-bit PowerPC

York Sun yorksun at freescale.com
Thu Jul 28 23:41:56 CEST 2011


Kyle,

On Mon, 2011-03-14 at 16:35 -0500, Moffett, Kyle D wrote:
> On Mar 14, 2011, at 16:22, York Sun wrote:
> > On Wed, 2011-02-23 at 11:35 -0500, Kyle Moffett wrote:
> >> +	 * Now divide by 5^12 and track the 32-bit remainder, then divide
> >> +	 * by 2*(2^12) using shifts (and updating the remainder).
> >> +	 */
> >> +	clks_rem = do_div(clks, UL_5pow12);
> >> +	clks_rem <<= 13;
> > 
> > Shouldn't this be clks_rem >>= 13 ?
> >> 
> >> +	clks_rem |= clks & (UL_2pow13-1);
> >> +	clks >>= 13;
> >> +
> >> +	/* If we had a remainder, then round up */
> >> +	if (clks_rem)
> >> 		clks++;
> >> -	}

I found a problem with the round up. Please try

 picos_to_mclk(mclk_to_picos(3))

You will notice the result is round up. I am sure it is unexpected.

York





More information about the U-Boot mailing list