diff options
author | Mark A. Greer <mgreer@mvista.com> | 2009-04-15 15:39:33 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-26 11:16:46 -0400 |
commit | d81d188cafecbc9e01df51527ac4c84a5b19e033 (patch) | |
tree | 40b26ea71d32547e50913dbdc4a2adec5fc8e809 /arch/arm/mach-davinci/psc.c | |
parent | 66e0c3991c5a1735dd8add77ab8aff5005f57681 (diff) |
davinci: Add support for multiple PSCs
The current code to support the DaVinci Power and Sleep Controller (PSC)
assumes that there is only one controller. This assumption is no longer
valid so expand the support to allow greater than one PSC.
To accomplish this, put the base addresses for the PSCs in the SoC
infrastructure so it can be referenced by the PSC code. This also
requires adding an extra parameter to davinci_psc_config() to specify
the PSC that is to be enabled/disabled.
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/psc.c')
-rw-r--r-- | arch/arm/mach-davinci/psc.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c index 84171abf5f7b..a78b657e916e 100644 --- a/arch/arm/mach-davinci/psc.c +++ b/arch/arm/mach-davinci/psc.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <mach/psc.h> | 28 | #include <mach/psc.h> |
29 | #include <mach/mux.h> | 29 | #include <mach/mux.h> |
30 | 30 | ||
31 | #define DAVINCI_PWR_SLEEP_CNTRL_BASE 0x01C41000 | ||
32 | |||
33 | /* PSC register offsets */ | 31 | /* PSC register offsets */ |
34 | #define EPCPR 0x070 | 32 | #define EPCPR 0x070 |
35 | #define PTCMD 0x120 | 33 | #define PTCMD 0x120 |
@@ -42,22 +40,42 @@ | |||
42 | #define MDSTAT_STATE_MASK 0x1f | 40 | #define MDSTAT_STATE_MASK 0x1f |
43 | 41 | ||
44 | /* Return nonzero iff the domain's clock is active */ | 42 | /* Return nonzero iff the domain's clock is active */ |
45 | int __init davinci_psc_is_clk_active(unsigned int id) | 43 | int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) |
46 | { | 44 | { |
47 | void __iomem *psc_base = IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE); | 45 | void __iomem *psc_base; |
48 | u32 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); | 46 | u32 mdstat; |
47 | struct davinci_soc_info *soc_info = &davinci_soc_info; | ||
48 | |||
49 | if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { | ||
50 | pr_warning("PSC: Bad psc data: 0x%x[%d]\n", | ||
51 | (int)soc_info->psc_bases, ctlr); | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | psc_base = soc_info->psc_bases[ctlr]; | ||
56 | mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); | ||
49 | 57 | ||
50 | /* if clocked, state can be "Enable" or "SyncReset" */ | 58 | /* if clocked, state can be "Enable" or "SyncReset" */ |
51 | return mdstat & BIT(12); | 59 | return mdstat & BIT(12); |
52 | } | 60 | } |
53 | 61 | ||
54 | /* Enable or disable a PSC domain */ | 62 | /* Enable or disable a PSC domain */ |
55 | void davinci_psc_config(unsigned int domain, unsigned int id, char enable) | 63 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, |
64 | unsigned int id, char enable) | ||
56 | { | 65 | { |
57 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; | 66 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; |
58 | void __iomem *psc_base = IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE); | 67 | void __iomem *psc_base; |
68 | struct davinci_soc_info *soc_info = &davinci_soc_info; | ||
59 | u32 next_state = enable ? 0x3 : 0x2; /* 0x3 enables, 0x2 disables */ | 69 | u32 next_state = enable ? 0x3 : 0x2; /* 0x3 enables, 0x2 disables */ |
60 | 70 | ||
71 | if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { | ||
72 | pr_warning("PSC: Bad psc data: 0x%x[%d]\n", | ||
73 | (int)soc_info->psc_bases, ctlr); | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | psc_base = soc_info->psc_bases[ctlr]; | ||
78 | |||
61 | mdctl = __raw_readl(psc_base + MDCTL + 4 * id); | 79 | mdctl = __raw_readl(psc_base + MDCTL + 4 * id); |
62 | mdctl &= ~MDSTAT_STATE_MASK; | 80 | mdctl &= ~MDSTAT_STATE_MASK; |
63 | mdctl |= next_state; | 81 | mdctl |= next_state; |