aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2014-03-12 19:36:17 -0400
committerSimon Horman <horms+renesas@verge.net.au>2014-04-13 22:30:11 -0400
commit25f5550f5a4b18fd77a2e719ba63cb34931ab66a (patch)
tree134410e2b2c6e2f26c545dc5bf3bb31539c7046a /arch
parentedcf139081f501b1468ae6665217e8320d4c75e8 (diff)
ARM: shmobile: Introduce shmobile_clk_workaround()
Introduce a new clock workaround function used by DT reference code on the mach-shmobile subarchitecture. The new function shmobile_clk_workaround() is used to configure clkdev to allow DT and platform devices to coexist. It is possible for the DT reference board code to also request enabling of the clock in case the driver does not implement clock control. Signed-off-by: Magnus Damm <damm@opensource.se> [horms+renesas@verge.net.au: Removed trailing blank line] Reviewed-by: Wolfram Sang <wsa@sang-engineering.com> Tested-by: Wolfram Sang <wsa@sang-engineering.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-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