summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/clock.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2013-03-27 08:55:41 +0100
committerSimon Horman <horms+renesas@verge.net.au>2013-04-02 04:02:16 +0200
commitf5942c76217e3f4c2a62a72c9d64997b8765f9e2 (patch)
treef3eaa01107d9b320f5bd15a245f014092e5c181c /arch/arm/mach-shmobile/clock.c
parentARM: shmobile: sh7372: remove DIV4_ZT* clocks (diff)
downloadlinux-f5942c76217e3f4c2a62a72c9d64997b8765f9e2.tar.xz
linux-f5942c76217e3f4c2a62a72c9d64997b8765f9e2.zip
ARM: shmobile: add struct clk_ratio and fixed ratio clock macro
Renesas chip has many clocks inside, and some of them are using fixed ratio via parent clock. Current shmobile clock code is using own divX_recalc function and divX_clk_ops. This patch can reduce these code Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> 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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index e816ca9bd213..ad7df629d995 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -23,6 +23,19 @@
#include <linux/init.h>
#include <linux/sh_clk.h>
#include <linux/export.h>
+#include <mach/clock.h>
+#include <mach/common.h>
+
+unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
+{
+ struct clk_ratio *p = clk->priv;
+
+ return clk->parent->rate / p->div * p->mul;
+};
+
+struct sh_clk_ops shmobile_fixed_ratio_clk_ops = {
+ .recalc = shmobile_fixed_ratio_clk_recalc,
+};
int __init shmobile_clk_init(void)
{