summaryrefslogtreecommitdiff
path: root/arch/arm/mach-shmobile/clock.c
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2014-03-12 23:36:17 (GMT)
committerSimon Horman <horms+renesas@verge.net.au>2014-04-14 02:30:11 (GMT)
commit25f5550f5a4b18fd77a2e719ba63cb34931ab66a (patch)
tree134410e2b2c6e2f26c545dc5bf3bb31539c7046a /arch/arm/mach-shmobile/clock.c
parentedcf139081f501b1468ae6665217e8320d4c75e8 (diff)
downloadlinux-25f5550f5a4b18fd77a2e719ba63cb34931ab66a.tar.xz
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/arm/mach-shmobile/clock.c')
-rw-r--r--arch/arm/mach-shmobile/clock.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index ad7df62..e7232a0 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -21,6 +21,32 @@
*/
#include <linux/kernel.h>
#include <linux/init.h>
+
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <mach/clock.h>
+
+void __init shmobile_clk_workaround(const struct clk_name *clks,
+ int nr_clks, bool enable)
+{
+ const struct clk_name *clkn;
+ struct clk *clk;
+ unsigned int i;
+
+ for (i = 0; i < nr_clks; ++i) {
+ clkn = clks + i;
+ clk = clk_get(NULL, clkn->clk);
+ if (!IS_ERR(clk)) {
+ clk_register_clkdev(clk, clkn->con_id, clkn->dev_id);
+ if (enable)
+ clk_prepare_enable(clk);
+ clk_put(clk);
+ }
+ }
+}
+
+#else /* CONFIG_COMMON_CLK */
#include <linux/sh_clk.h>
#include <linux/export.h>
#include <mach/clock.h>
@@ -58,3 +84,5 @@ void __clk_put(struct clk *clk)
{
}
EXPORT_SYMBOL(__clk_put);
+
+#endif /* CONFIG_COMMON_CLK */