summaryrefslogtreecommitdiffstats
path: root/include/linux/clk.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-20 22:03:42 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-04 15:19:55 +0200
commitf2e2e596a221c146082821aa4d9ae249fe9d561a (patch)
tree2f267a4ad613fcc06bd6a02235c364a4dc2c15e3 /include/linux/clk.h
parent89b710e5094fb5721b18c6501a7c813df9f40b14 (diff)
downloadbarebox-f2e2e596a221c146082821aa4d9ae249fe9d561a.tar.gz
barebox-f2e2e596a221c146082821aa4d9ae249fe9d561a.tar.xz
clk: initial common clk support
This adds barebox common clk support loosely based on the Kernel common clk support. differences are: - barebox does not need prepare/unprepare - no parent rate propagation for set_rate - struct clk is not really encapsulated from the drivers Along with the clk support we have support for some basic clk building blocks: - clk-fixed - clk-fixed-factor - clk-mux - clk-divider clk-fixed and clk-fixed-factor are completely generic, clk-mux and clk-divider are currently the way i.MX muxes/dividers are implemented. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/clk.h')
-rw-r--r--include/linux/clk.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1478c97381..e9031dd17a 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -155,4 +155,46 @@ struct clk *clk_get_sys(const char *dev_id, const char *con_id);
int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
struct device_d *dev);
+#ifdef CONFIG_COMMON_CLK
+struct clk_ops {
+ int (*enable)(struct clk *clk);
+ void (*disable)(struct clk *clk);
+ int (*is_enabled)(struct clk *clk);
+ unsigned long (*recalc_rate)(struct clk *clk,
+ unsigned long parent_rate);
+ long (*round_rate)(struct clk *clk, unsigned long,
+ unsigned long *);
+ int (*set_parent)(struct clk *clk, u8 index);
+ int (*get_parent)(struct clk *clk);
+ int (*set_rate)(struct clk *clk, unsigned long,
+ unsigned long);
+};
+
+struct clk {
+ const struct clk_ops *ops;
+ int enable_count;
+ struct list_head list;
+ const char *name;
+ const char **parent_names;
+ int num_parents;
+
+ struct clk **parents;
+};
+
+struct clk *clk_fixed(const char *name, int rate);
+struct clk *clk_divider(const char *name, const char *parent,
+ void __iomem *reg, u8 shift, u8 width);
+struct clk *clk_fixed_factor(const char *name,
+ const char *parent, unsigned int mult, unsigned int div);
+struct clk *clk_mux(const char *name, void __iomem *reg,
+ u8 shift, u8 width, const char **parents, u8 num_parents);
+
+int clk_register(struct clk *clk);
+
+struct clk *clk_lookup(const char *name);
+
+void clk_dump(int verbose);
+
+#endif
+
#endif