@@ -41,6 +41,8 @@
#include <mach/clock.h>
#include <mach/hardware.h>
+#ifndef CONFIG_GENERIC_CLK
+
static LIST_HEAD(clocks);
static DEFINE_MUTEX(clocks_mutex);
@@ -199,6 +201,7 @@ struct clk *clk_get_parent(struct clk *clk)
return clk->parent;
}
EXPORT_SYMBOL(clk_get_parent);
+#endif
/*
* Get the resulting clock rate from a PLL register value and the input
@@ -244,3 +247,8 @@ unsigned long mxc_decode_pll(unsigned int reg_val, u32 freq)
return ll;
}
+
+#ifdef CONFIG_GENERIC_CLK
+DEFINE_SPINLOCK(imx_ccm_lock);
+EXPORT_SYMBOL_GPL(imx_ccm_lock);
+#endif /* CONFIG_USE_COMMON_STRUCT_CLK */
@@ -81,9 +81,13 @@ struct clk_pllv2 {
extern struct clk_hw_ops clk_pllv2_ops;
-#define DEFINE_CLK_PLLV2(name, _parent, _base) \
- struct clk_pllv2 name = { \
- .parent = (_parent), \
+#define DEFINE_CLK_PLLV2(_name, _parent, _base) \
+ struct clk_pllv2 _name = { \
+ .clk = { \
+ .name = #_name, \
+ .ops = &clk_pllv2_ops, \
+ .parent = _parent, \
+ }, \
.base = (_base), \
}
@@ -109,6 +113,38 @@ extern struct clk_hw_ops clk_gate2b_ops;
int clk_gate2b_set_val(struct clk *clk, int en, int dis);
+extern spinlock_t imx_ccm_lock;
+
+#define DEFINE_CLK_GATE2B(_name, _parent, _reg, _shift) \
+ struct clk_gate2b _name = { \
+ .clk = { \
+ .name = #_name, \
+ .ops = &clk_gate2b_ops, \
+ .parent = _parent, \
+ }, \
+ .reg = (_reg), \
+ .shift = (_shift) * 2, \
+ .val_en = 0x3, \
+ .val_dis = 0x0, \
+ .lock = &imx_ccm_lock, \
+ }
+
+#define IMX_DEFINE_CLK_DIVIDER(_name, _parent, _flags, _reg, _shift, _width) \
+ DEFINE_CLK_DIVIDER(_name, _parent, _flags, _reg, _shift, _width, \
+ &imx_ccm_lock)
+
+#define IMX_DEFINE_CLK_MUX(_name, _reg, _shift, _width, _clks) \
+ DEFINE_CLK_MUX(_name, _reg, _shift, _width, _clks, &imx_ccm_lock)
+
+#define DEFINE_CLK_FIXED(_name, _rate) \
+ struct clk_hw_fixed _name = { \
+ .clk = { \
+ .name = #_name, \
+ .ops = &clk_hw_fixed_ops, \
+ }, \
+ .fixed_rate = (_rate), \
+ }
+
#endif /* CONFIG_GENERIC_CLK */
#endif /* __ASSEMBLY__ */
#endif /* __ASM_ARCH_MXC_CLOCK_H__ */