[PATCH 1/2] ARM: imx6q: add pll round_rate support
Richard Zhao
richard.zhao at freescale.com
Sun Mar 18 21:54:34 EDT 2012
> +static unsigned long pll_av_round_rate(struct clk *clk, unsigned long rate)
> +{
> + unsigned long parent_rate = clk_get_rate(clk->parent);
> + u32 div;
> + u32 mfn, mfd = 1000000;
> + s64 temp64;
> +
> + rate = rate < FREQ_650M ? FREQ_650M : rate;
> + rate = rate > FREQ_1300M ? FREQ_1300M : rate;
> +
> + div = rate / parent_rate;
> + temp64 = (u64) (parent_rate - (div * parent_rate));
Be rate here.
Sorry.
> + temp64 *= mfd;
> + do_div(temp64, parent_rate);
> + mfn = temp64;
> +
> + return (parent_rate * div) + ((parent_rate / mfd) * mfn);
> +}
> +
Thanks
Richard
More information about the linux-arm-kernel
mailing list