Hi Hans,

On Sat, Dec 21, 2013 at 01:15:07PM +0100, Hans de Goede wrote:
> >I think that adding a new factors calculation function for sun5i's
> >PLL6, that would limit the factors returned to whatever frequency is
> >adequate would work. Emilio?
> 
> The problem is that the clk framework will first try to use PLL6
> as is, and if that is possible won't call sun4i_get_pll5_factors
> at all (I've add a pr_err to sun4i_get_pll5_factors and it never
> gets called).
> 
> What happens is that clk_factors_recalc_rate returns 2400 for PLL6,
> and since 2400 / 48 neatly is 50Mhz and the mmc clk divider can
> divide by 48, the clk framework never even tries to reconfigure
> PLL6, so sun4i_get_pll5_factors never gets called.
> 
> So fixing this in the kernel would require doing something earlier
> on, either in sunxi_init_clocks, or add a max valid freq attribute
> to clk_factors_config and make clk_factors_recalc_rate check that
> and return 0 when the clk has an invalid config, and hope that
> the clk framework will then decide to try clk_factors_determine_rate
> again with the CLK_SET_RATE_PARENT flag set and then will end up
> calling sun4i_get_pll5_factors. Thinking more about this, adding a
> max valid freq attribute is a good idea in general, and we should
> probably use this in other place too.
> 
> I'll happily give a patch for this a try. It is probably best if
> Emilio writes it as he knows the code best.

Yes, I think this max-frequency attribute is really the way to
go. That's something that could come from the DT as well.

I guess Emilio has some work :)

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Attachment: signature.asc
Description: Digital signature

Reply via email to