Skip to contentSkip to conversation

sh: shared div4 clock code

PATCH New Magnus Damm 1 participant 1 message May 28, 2009 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: shared div4 clock code

From: Magnus Damm <[email protected]>

Add shared code for 4-bit divisor clocks.

Processor specific code can use SH_CLK_DIV4()
to initialize div4 clocks, and then use
sh_clk_div4_register() for registration.

---

 arch/sh/include/asm/clock.h    |   15 ++++++++++
 arch/sh/kernel/cpu/clock-cpg.c |   55 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
arch/sh/include/asm/clock.h +15 -0
@@ -3,6 +3,7 @@
 
 #include <linux/list.h>
 #include <linux/seq_file.h>
+#include <linux/cpufreq.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 
@@ -41,6 +42,7 @@ struct clk {
 	unsigned long		arch_flags;
 	void			*priv;
 	struct dentry		*dentry;
+	struct cpufreq_frequency_table *freq_table;
 };
 
 struct clk_lookup {
@@ -130,4 +132,17 @@ long clk_rate_table_round(struct clk *cl
 
 int sh_clk_mstp32_register(struct clk *clks, int nr);
 
+#define SH_CLK_DIV4(_name, _parent, _reg, _shift, _div_bitmap, _flags)	\
+{									\
+	.name = _name,							\
+	.parent = _parent,						\
+	.enable_reg = (void __iomem *)_reg,				\
+	.enable_bit = _shift,						\
+	.arch_flags = _div_bitmap,					\
+	.flags = _flags,						\
+}
+
+int sh_clk_div4_register(struct clk *clks, int nr,
+			 struct clk_div_mult_table *table);
+
 #endif /* __ASM_SH_CLOCK_H */
arch/sh/kernel/cpu/clock-cpg.c +55 -0

66 lines not on this page · raw message