diff options
author | Magnus Damm <damm@opensource.se> | 2014-03-13 08:36:17 +0900 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-04-14 11:30:11 +0900 |
commit | 25f5550f5a4b18fd77a2e719ba63cb34931ab66a (patch) | |
tree | 134410e2b2c6e2f26c545dc5bf3bb31539c7046a /arch/arm/mach-shmobile/clock.c | |
parent | edcf139081f501b1468ae6665217e8320d4c75e8 (diff) | |
download | lwn-25f5550f5a4b18fd77a2e719ba63cb34931ab66a.tar.gz lwn-25f5550f5a4b18fd77a2e719ba63cb34931ab66a.zip |
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.c | 28 |
1 files changed, 28 insertions, 0 deletions
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 @@ */ #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 */ |