aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/psc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-davinci/psc.c')
-rw-r--r--arch/arm/mach-davinci/psc.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 84171abf5f7..a78b657e916 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 */
45int __init davinci_psc_is_clk_active(unsigned int id) 43int __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 */
55void davinci_psc_config(unsigned int domain, unsigned int id, char enable) 63void 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;