diff options
author | Mike Turquette <mturquette@linaro.org> | 2012-03-16 02:11:19 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-03-16 16:35:01 -0400 |
commit | b2476490ef11134b65544d8f062cff96c53e941b (patch) | |
tree | 35e341ae635a5608f6bef748d174d1dd5dcf8f9d /include/linux/clk-private.h | |
parent | 69fe8a8e92ae6877167f222838bd0c92b35c7d72 (diff) |
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>
Diffstat (limited to 'include/linux/clk-private.h')
-rw-r--r-- | include/linux/clk-private.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h new file mode 100644 index 000000000000..e2cce6fa6046 --- /dev/null +++ b/include/linux/clk-private.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * linux/include/linux/clk-private.h | ||
3 | * | ||
4 | * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com> | ||
5 | * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __LINUX_CLK_PRIVATE_H | ||
12 | #define __LINUX_CLK_PRIVATE_H | ||
13 | |||
14 | #include <linux/clk-provider.h> | ||
15 | #include <linux/list.h> | ||
16 | |||
17 | /* | ||
18 | * WARNING: Do not include clk-private.h from any file that implements struct | ||
19 | * clk_ops. Doing so is a layering violation! | ||
20 | * | ||
21 | * This header exists only to allow for statically initialized clock data. Any | ||
22 | * static clock data must be defined in a separate file from the logic that | ||
23 | * implements the clock operations for that same data. | ||
24 | */ | ||
25 | |||
26 | #ifdef CONFIG_COMMON_CLK | ||
27 | |||
28 | struct clk { | ||
29 | const char *name; | ||
30 | const struct clk_ops *ops; | ||
31 | struct clk_hw *hw; | ||
32 | struct clk *parent; | ||
33 | char **parent_names; | ||
34 | struct clk **parents; | ||
35 | u8 num_parents; | ||
36 | unsigned long rate; | ||
37 | unsigned long new_rate; | ||
38 | unsigned long flags; | ||
39 | unsigned int enable_count; | ||
40 | unsigned int prepare_count; | ||
41 | struct hlist_head children; | ||
42 | struct hlist_node child_node; | ||
43 | unsigned int notifier_count; | ||
44 | #ifdef CONFIG_COMMON_CLK_DEBUG | ||
45 | struct dentry *dentry; | ||
46 | #endif | ||
47 | }; | ||
48 | |||
49 | /** | ||
50 | * __clk_init - initialize the data structures in a struct clk | ||
51 | * @dev: device initializing this clk, placeholder for now | ||
52 | * @clk: clk being initialized | ||
53 | * | ||
54 | * Initializes the lists in struct clk, queries the hardware for the | ||
55 | * parent and rate and sets them both. | ||
56 | * | ||
57 | * Any struct clk passed into __clk_init must have the following members | ||
58 | * populated: | ||
59 | * .name | ||
60 | * .ops | ||
61 | * .hw | ||
62 | * .parent_names | ||
63 | * .num_parents | ||
64 | * .flags | ||
65 | * | ||
66 | * It is not necessary to call clk_register if __clk_init is used directly with | ||
67 | * statically initialized clock data. | ||
68 | */ | ||
69 | void __clk_init(struct device *dev, struct clk *clk); | ||
70 | |||
71 | #endif /* CONFIG_COMMON_CLK */ | ||
72 | #endif /* CLK_PRIVATE_H */ | ||