Re: [PATCH] clk: add flags to distinguish xtal clocks

Luca Coelho
2013-11-08T19:17:36Z

Hi Felipe,

On Fri, 2013-11-08 at 12:00 -0600, Felipe Balbi wrote:
> From: Luciano Coelho <luca@coelho.fi>
>
> Add a flag that indicate whether the clock is a crystal or not.
>
> Additionally, parse a new device tree binding in clk-fixed-rate to set
> this flag.
>
> If clock-xtal isn't set, the clock framework will assume clock to be
> generated by an oscillator. There's only one user for this binding
> right now which is Texas Instruments' WiLink devices which need to know
> details about the clock in order to initialize the underlying WiFi HW
> correctly.
>
> Signed-off-by: Luciano Coelho <luca@coelho.fi>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> ---
>
> Dropped CLK_IS_TYPE_DEFINED flag and just assume that if the flag
> isn't there, default behavior will be taken.

I don't think this is a good idea, because how would code that relies on
the CLK_IS_TYPE_XTAL flag know whether 0 means that the clock is *not*
crystal or if the flag is simply not defined?

There are many clocks which *are* crystal but don't define this flag
(obviously, because it didn't exist). That's the reason why I added the
CLK_IS_TYPE_DEFINED flag...

If you want to get rid of this flag, you should traverse all clocks and
set the CLK_IS_TYPE_XTAL on all those that are crystals.

--
Cheers,
Luca.