summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/clock.h
diff options
context:
space:
mode:
authorMagnus Damm <damm+renesas@opensource.se>2014-06-17 16:47:21 +0900
committerSimon Horman <horms+renesas@verge.net.au>2014-06-17 17:09:37 +0900
commitad6ffa0b59dc2c81474d7642fa2188e25cce99d6 (patch)
tree27d3cf9ab4f12ab522e785778d9f2496d0f18684 /arch/arm/mach-shmobile/clock.h
parent74ac0de8b7ee41246b8d6aae1df0618a64451435 (diff)
ARM: shmobile: Move clock.h
Change location of clock.h so it can be used as #include "clock.h" instead of the old style #include <mach/clock.h>. Signed-off-by: Magnus Damm <damm+renesas@opensource.se> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/clock.h')
-rw-r--r--arch/arm/mach-shmobile/clock.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/clock.h b/arch/arm/mach-shmobile/clock.h
new file mode 100644
index 00000000000..31b6417463e
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock.h
@@ -0,0 +1,56 @@
+#ifndef CLOCK_H
+#define CLOCK_H
+
+#ifdef CONFIG_COMMON_CLK
+/* temporary clock configuration helper for platform devices */
+
+struct clk_name {
+ const char *clk;
+ const char *con_id;
+ const char *dev_id;
+};
+
+void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
+ bool enable);
+
+#else /* CONFIG_COMMON_CLK */
+/* legacy clock implementation */
+
+struct clk;
+unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
+extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
+
+/* clock ratio */
+struct clk_ratio {
+ int mul;
+ int div;
+};
+
+#define SH_CLK_RATIO(name, m, d) \
+static struct clk_ratio name ##_ratio = { \
+ .mul = m, \
+ .div = d, \
+}
+
+#define SH_FIXED_RATIO_CLKg(name, p, r) \
+struct clk name = { \
+ .parent = &p, \
+ .ops = &shmobile_fixed_ratio_clk_ops,\
+ .priv = &r ## _ratio, \
+}
+
+#define SH_FIXED_RATIO_CLK(name, p, r) \
+static SH_FIXED_RATIO_CLKg(name, p, r)
+
+#define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \
+ SH_CLK_RATIO(name, m, d); \
+ SH_FIXED_RATIO_CLK(name, p, name)
+
+#define SH_CLK_SET_RATIO(p, m, d) \
+do { \
+ (p)->mul = m; \
+ (p)->div = d; \
+} while (0)
+
+#endif /* CONFIG_COMMON_CLK */
+#endif