aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-shmobile/Makefile2
-rw-r--r--arch/arm/mach-shmobile/clock.c28
-rw-r--r--arch/arm/mach-shmobile/include/mach/clock.h16
3 files changed, 45 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 4caffc912a81..c12a1c50e9d2 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -21,8 +21,8 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o 21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
22 22
23# Clock objects 23# Clock objects
24ifndef CONFIG_COMMON_CLK
25obj-y += clock.o 24obj-y += clock.o
25ifndef CONFIG_COMMON_CLK
26obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o 26obj-$(CONFIG_ARCH_SH7372) += clock-sh7372.o
27obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o 27obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o
28obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o 28obj-$(CONFIG_ARCH_R8A73A4) += clock-r8a73a4.o
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index ad7df629d995..e7232a0373b9 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -21,6 +21,32 @@
21 */ 21 */
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/init.h> 23#include <linux/init.h>
24
25#ifdef CONFIG_COMMON_CLK
26#include <linux/clk.h>
27#include <linux/clkdev.h>
28#include <mach/clock.h>
29
30void __init shmobile_clk_workaround(const struct clk_name *clks,
31 int nr_clks, bool enable)
32{
33 const struct clk_name *clkn;
34 struct clk *clk;
35 unsigned int i;
36
37 for (i = 0; i < nr_clks; ++i) {
38 clkn = clks + i;
39 clk = clk_get(NULL, clkn->clk);
40 if (!IS_ERR(clk)) {
41 clk_register_clkdev(clk, clkn->con_id, clkn->dev_id);
42 if (enable)
43 clk_prepare_enable(clk);
44 clk_put(clk);
45 }
46 }
47}
48
49#else /* CONFIG_COMMON_CLK */
24#include <linux/sh_clk.h> 50#include <linux/sh_clk.h>
25#include <linux/export.h> 51#include <linux/export.h>
26#include <mach/clock.h> 52#include <mach/clock.h>
@@ -58,3 +84,5 @@ void __clk_put(struct clk *clk)
58{ 84{
59} 85}
60EXPORT_SYMBOL(__clk_put); 86EXPORT_SYMBOL(__clk_put);
87
88#endif /* CONFIG_COMMON_CLK */
diff --git a/arch/arm/mach-shmobile/include/mach/clock.h b/arch/arm/mach-shmobile/include/mach/clock.h
index 03e56074928c..9a93cf924b9c 100644
--- a/arch/arm/mach-shmobile/include/mach/clock.h
+++ b/arch/arm/mach-shmobile/include/mach/clock.h
@@ -1,6 +1,21 @@
1#ifndef CLOCK_H 1#ifndef CLOCK_H
2#define CLOCK_H 2#define CLOCK_H
3 3
4#ifdef CONFIG_COMMON_CLK
5/* temporary clock configuration helper for platform devices */
6
7struct clk_name {
8 const char *clk;
9 const char *con_id;
10 const char *dev_id;
11};
12
13void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
14 bool enable);
15
16#else /* CONFIG_COMMON_CLK */
17/* legacy clock implementation */
18
4unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk); 19unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
5extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops; 20extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
6 21
@@ -36,4 +51,5 @@ do { \
36 (p)->div = d; \ 51 (p)->div = d; \
37} while (0) 52} while (0)
38 53
54#endif /* CONFIG_COMMON_CLK */
39#endif 55#endif