diff options
author | Sekhar Nori <nsekhar@ti.com> | 2011-07-06 02:01:21 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2011-07-08 01:21:40 -0400 |
commit | a51ca38b6330e463cc1a7adf64502ff735452915 (patch) | |
tree | 26c708d7e6cdeea454af2d730e4dd57e46e6c774 /arch/arm/mach-davinci | |
parent | 8d54297b90831b6e87e62ad910f833b8666094c8 (diff) |
davinci: pass clock flags to davinci_psc_config()
Enabling or disabling a PSC can take certain
modifiers like "disable with reset", "force
enable/disable" and "enable/disable with local
reset" apart from the regular clock gating
functionality.
Pass a flags argument to davinci_psc_config()
so these variations can be supported there.
At this time only "disable with reset" is
supported, but other functionality will be
added in subsequent patches.
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/clock.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/psc.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/psc.c | 12 |
3 files changed, 15 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index e4e3af179f02..d0450ac2c00e 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c | |||
@@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk) | |||
44 | __clk_enable(clk->parent); | 44 | __clk_enable(clk->parent); |
45 | if (clk->usecount++ == 0 && (clk->flags & CLK_PSC)) | 45 | if (clk->usecount++ == 0 && (clk->flags & CLK_PSC)) |
46 | davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, | 46 | davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, |
47 | PSC_STATE_ENABLE); | 47 | true, clk->flags); |
48 | } | 48 | } |
49 | 49 | ||
50 | static void __clk_disable(struct clk *clk) | 50 | static void __clk_disable(struct clk *clk) |
@@ -54,8 +54,7 @@ static void __clk_disable(struct clk *clk) | |||
54 | if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) && | 54 | if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) && |
55 | (clk->flags & CLK_PSC)) | 55 | (clk->flags & CLK_PSC)) |
56 | davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, | 56 | davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, |
57 | (clk->flags & PSC_SWRSTDISABLE) ? | 57 | false, clk->flags); |
58 | PSC_STATE_SWRSTDISABLE : PSC_STATE_DISABLE); | ||
59 | if (clk->parent) | 58 | if (clk->parent) |
60 | __clk_disable(clk->parent); | 59 | __clk_disable(clk->parent); |
61 | } | 60 | } |
@@ -239,8 +238,7 @@ static int __init clk_disable_unused(void) | |||
239 | pr_debug("Clocks: disable unused %s\n", ck->name); | 238 | pr_debug("Clocks: disable unused %s\n", ck->name); |
240 | 239 | ||
241 | davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc, | 240 | davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc, |
242 | (ck->flags & PSC_SWRSTDISABLE) ? | 241 | false, ck->flags); |
243 | PSC_STATE_SWRSTDISABLE : PSC_STATE_DISABLE); | ||
244 | } | 242 | } |
245 | spin_unlock_irq(&clockfw_lock); | 243 | spin_unlock_irq(&clockfw_lock); |
246 | 244 | ||
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h index a47e6f29206e..215fcca6bbdc 100644 --- a/arch/arm/mach-davinci/include/mach/psc.h +++ b/arch/arm/mach-davinci/include/mach/psc.h | |||
@@ -249,7 +249,7 @@ | |||
249 | 249 | ||
250 | extern int davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id); | 250 | extern int davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id); |
251 | extern void davinci_psc_config(unsigned int domain, unsigned int ctlr, | 251 | extern void davinci_psc_config(unsigned int domain, unsigned int ctlr, |
252 | unsigned int id, u32 next_state); | 252 | unsigned int id, bool enable, u32 flags); |
253 | 253 | ||
254 | #endif | 254 | #endif |
255 | 255 | ||
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c index a41580400701..823cb1b9e484 100644 --- a/arch/arm/mach-davinci/psc.c +++ b/arch/arm/mach-davinci/psc.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <mach/cputype.h> | 25 | #include <mach/cputype.h> |
26 | #include <mach/psc.h> | 26 | #include <mach/psc.h> |
27 | 27 | ||
28 | #include "clock.h" | ||
29 | |||
28 | /* Return nonzero iff the domain's clock is active */ | 30 | /* Return nonzero iff the domain's clock is active */ |
29 | int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) | 31 | int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) |
30 | { | 32 | { |
@@ -48,11 +50,12 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) | |||
48 | 50 | ||
49 | /* Enable or disable a PSC domain */ | 51 | /* Enable or disable a PSC domain */ |
50 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, | 52 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, |
51 | unsigned int id, u32 next_state) | 53 | unsigned int id, bool enable, u32 flags) |
52 | { | 54 | { |
53 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; | 55 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; |
54 | void __iomem *psc_base; | 56 | void __iomem *psc_base; |
55 | struct davinci_soc_info *soc_info = &davinci_soc_info; | 57 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
58 | u32 next_state = PSC_STATE_ENABLE; | ||
56 | 59 | ||
57 | if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { | 60 | if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { |
58 | pr_warning("PSC: Bad psc data: 0x%x[%d]\n", | 61 | pr_warning("PSC: Bad psc data: 0x%x[%d]\n", |
@@ -62,6 +65,13 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr, | |||
62 | 65 | ||
63 | psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K); | 66 | psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K); |
64 | 67 | ||
68 | if (!enable) { | ||
69 | if (flags & PSC_SWRSTDISABLE) | ||
70 | next_state = PSC_STATE_SWRSTDISABLE; | ||
71 | else | ||
72 | next_state = PSC_STATE_DISABLE; | ||
73 | } | ||
74 | |||
65 | mdctl = __raw_readl(psc_base + MDCTL + 4 * id); | 75 | mdctl = __raw_readl(psc_base + MDCTL + 4 * id); |
66 | mdctl &= ~MDSTAT_STATE_MASK; | 76 | mdctl &= ~MDSTAT_STATE_MASK; |
67 | mdctl |= next_state; | 77 | mdctl |= next_state; |