Re: AVR32 architecture patch against Linux 2.6.18-rc1 available

Russell King
2006-07-06T09:52:00Z

On Thu, Jul 06, 2006 at 02:19:06AM -0700, Andrew Morton wrote:
> - What are these for?
>
> +EXPORT_SYMBOL(clk_get);
> +EXPORT_SYMBOL(clk_put);
> +EXPORT_SYMBOL(clk_enable);
> +EXPORT_SYMBOL(clk_disable);
> +EXPORT_SYMBOL(clk_get_rate);
> +EXPORT_SYMBOL(clk_round_rate);
> +EXPORT_SYMBOL(clk_set_rate);
> +EXPORT_SYMBOL(clk_set_parent);
> +EXPORT_SYMBOL(clk_get_parent);

Part of the clock framework. No, not the one that you've probably
heard about (which is in connection with time, and IMHO incorrectly
named).

This one is to do with controlling the clock sources for peripherals
in systems, to allow drivers to be shared between platforms with the
minimum of crap in drivers.

For example, the ARM Ltd AMBA "devices" end up being embedded into ARM
SoCs, MIPS SoCs and now probably AVR32 SoCs. These drivers need a way
to be told, eg, their clock source rate in the case of a UART, and be
able to control the clock rate in the case of an LCD controller. It's
also advantageous for power saving to be able to turn clock sources
on and off.

You can have hardware situations where the clock source for UARTs
depend on where they are on the bus, possibly clocked at different
rates, or all UARTs are clocked from one source.

How that is achieved is extremely SoC or platform specific, and as such
I put together a well defined API (include/linux/clk.h) which gives:

1. an API for drivers to follow to achieve achieve inter-operability and
re-use with the minimum of fuss.
2. complete flexibility to the platform code to implement the backend
how they see fit, using whatever structures they see fit.

It's great that the AVR32 folk are reusing this.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core