aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2013-10-22 04:47:08 -0400
committerMike Turquette <mturquette@linaro.org>2014-01-17 15:36:57 -0500
commit3ada6b10aaf2ff5c7dc6e8add6fdf1b7333d1b34 (patch)
tree477d264728d811e5c2738afb4ff2560bab71656a /arch
parent6a67920811c23320aa25d94e5891d229eab506d9 (diff)
ARM: OMAP2+: clock: add support for indexed memmaps
Using indexed memmaps is required for isolating the actual memory access from the clock code. Now, the driver providing the support for the clock IP block provides the low level routines for reading/writing clock registers also. Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/clock.c26
-rw-r--r--arch/arm/mach-omap2/clock.h5
2 files changed, 30 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 238be3f1ddce..be53bb21301c 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -26,7 +26,6 @@
26#include <linux/clk-private.h> 26#include <linux/clk-private.h>
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28 28
29
30#include <trace/events/power.h> 29#include <trace/events/power.h>
31 30
32#include "soc.h" 31#include "soc.h"
@@ -56,6 +55,31 @@ u16 cpu_mask;
56static bool clkdm_control = true; 55static bool clkdm_control = true;
57 56
58static LIST_HEAD(clk_hw_omap_clocks); 57static LIST_HEAD(clk_hw_omap_clocks);
58void __iomem *clk_memmaps[CLK_MAX_MEMMAPS];
59
60void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg)
61{
62 if (clk->flags & MEMMAP_ADDRESSING) {
63 struct clk_omap_reg *r = (struct clk_omap_reg *)&reg;
64 writel_relaxed(val, clk_memmaps[r->index] + r->offset);
65 } else {
66 writel_relaxed(val, reg);
67 }
68}
69
70u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg)
71{
72 u32 val;
73
74 if (clk->flags & MEMMAP_ADDRESSING) {
75 struct clk_omap_reg *r = (struct clk_omap_reg *)&reg;
76 val = readl_relaxed(clk_memmaps[r->index] + r->offset);
77 } else {
78 val = readl_relaxed(reg);
79 }
80
81 return val;
82}
59 83
60/* 84/*
61 * Used for clocks that have the same value as the parent clock, 85 * Used for clocks that have the same value as the parent clock,
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index cbe5ff770ec4..bda767a9dea8 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -254,6 +254,9 @@ void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
254 const char *core_ck_name, 254 const char *core_ck_name,
255 const char *mpu_ck_name); 255 const char *mpu_ck_name);
256 256
257u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg);
258void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg);
259
257extern u16 cpu_mask; 260extern u16 cpu_mask;
258 261
259extern const struct clkops clkops_omap2_dflt_wait; 262extern const struct clkops clkops_omap2_dflt_wait;
@@ -288,6 +291,8 @@ extern const struct clksel_rate div_1_3_rates[];
288extern const struct clksel_rate div_1_4_rates[]; 291extern const struct clksel_rate div_1_4_rates[];
289extern const struct clksel_rate div31_1to31_rates[]; 292extern const struct clksel_rate div31_1to31_rates[];
290 293
294extern void __iomem *clk_memmaps[];
295
291extern int am33xx_clk_init(void); 296extern int am33xx_clk_init(void);
292 297
293extern int omap2_clkops_enable_clkdm(struct clk_hw *hw); 298extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);