Skip to content

Commit b247649

Browse files
Mike Turquettearndb
authored andcommitted
clk: introduce the common clock framework
The common clock framework defines a common struct clk useful across most platforms as well as an implementation of the clk api that drivers can use safely for managing clocks. The net result is consolidation of many different struct clk definitions and platform-specific clock framework implementations. This patch introduces the common struct clk, struct clk_ops and an implementation of the well-known clock api in include/clk/clk.h. Platforms may define their own hardware-specific clock structure and their own clock operation callbacks, so long as it wraps an instance of struct clk_hw. See Documentation/clk.txt for more details. This patch is based on the work of Jeremy Kerr, which in turn was based on the work of Ben Herrenschmidt. Signed-off-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Mike Turquette <mturquette@ti.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Rob Herring <rob.herring <at> calxeda.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Jeremy Kerr <jeremy.kerr@canonical.com> Cc: Arnd Bergman <arnd.bergmann@linaro.org> Cc: Paul Walmsley <paul@pwsan.com> Cc: Shawn Guo <shawn.guo@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Richard Zhao <richard.zhao@linaro.org> Cc: Saravana Kannan <skannan@codeaurora.org> Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Linus Walleij <linus.walleij@stericsson.com> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Amit Kucheria <amit.kucheria@linaro.org> Cc: Deepak Saxena <dsaxena@linaro.org> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 69fe8a8 commit b247649

6 files changed

Lines changed: 1810 additions & 5 deletions

File tree

‎drivers/clk/Kconfig‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,43 @@ config HAVE_CLK_PREPARE
88

99
config HAVE_MACH_CLKDEV
1010
bool
11+
12+
menuconfig COMMON_CLK
13+
bool "Common Clock Framework"
14+
select HAVE_CLK_PREPARE
15+
---help---
16+
The common clock framework is a single definition of struct
17+
clk, useful across many platforms, as well as an
18+
implementation of the clock API in include/linux/clk.h.
19+
Architectures utilizing the common struct clk should select
20+
this automatically, but it may be necessary to manually select
21+
this option for loadable modules requiring the common clock
22+
framework.
23+
24+
If in doubt, say "N".
25+
26+
if COMMON_CLK
27+
28+
config COMMON_CLK_DISABLE_UNUSED
29+
bool "Disabled unused clocks at boot"
30+
depends on COMMON_CLK
31+
---help---
32+
Traverses the entire clock tree and disables any clocks that are
33+
enabled in hardware but have not been enabled by any device drivers.
34+
This saves power and keeps the software model of the clock in line
35+
with reality.
36+
37+
If in doubt, say "N".
38+
39+
config COMMON_CLK_DEBUG
40+
bool "DebugFS representation of clock tree"
41+
depends on COMMON_CLK
42+
select DEBUG_FS
43+
---help---
44+
Creates a directory hierchy in debugfs for visualizing the clk
45+
tree structure. Each directory contains read-only members
46+
that export information specific to that clk node: clk_rate,
47+
clk_flags, clk_prepare_count, clk_enable_count &
48+
clk_notifier_count.
49+
50+
endif

‎drivers/clk/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11

22
obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o
3+
obj-$(CONFIG_COMMON_CLK) += clk.o

0 commit comments

Comments
 (0)