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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index adf6b5c7f1e5..1b15dbd0a77b 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -38,8 +38,9 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id)
38 return 0; 38 return 0;
39 } 39 }
40 40
41 psc_base = soc_info->psc_bases[ctlr]; 41 psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K);
42 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 42 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
43 iounmap(psc_base);
43 44
44 /* if clocked, state can be "Enable" or "SyncReset" */ 45 /* if clocked, state can be "Enable" or "SyncReset" */
45 return mdstat & BIT(12); 46 return mdstat & BIT(12);
@@ -47,12 +48,11 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id)
47 48
48/* Enable or disable a PSC domain */ 49/* Enable or disable a PSC domain */
49void davinci_psc_config(unsigned int domain, unsigned int ctlr, 50void davinci_psc_config(unsigned int domain, unsigned int ctlr,
50 unsigned int id, char enable) 51 unsigned int id, u32 next_state)
51{ 52{
52 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; 53 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl;
53 void __iomem *psc_base; 54 void __iomem *psc_base;
54 struct davinci_soc_info *soc_info = &davinci_soc_info; 55 struct davinci_soc_info *soc_info = &davinci_soc_info;
55 u32 next_state = enable ? 0x3 : 0x2; /* 0x3 enables, 0x2 disables */
56 56
57 if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { 57 if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) {
58 pr_warning("PSC: Bad psc data: 0x%x[%d]\n", 58 pr_warning("PSC: Bad psc data: 0x%x[%d]\n",
@@ -60,7 +60,7 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
60 return; 60 return;
61 } 61 }
62 62
63 psc_base = soc_info->psc_bases[ctlr]; 63 psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K);
64 64
65 mdctl = __raw_readl(psc_base + MDCTL + 4 * id); 65 mdctl = __raw_readl(psc_base + MDCTL + 4 * id);
66 mdctl &= ~MDSTAT_STATE_MASK; 66 mdctl &= ~MDSTAT_STATE_MASK;
@@ -100,4 +100,6 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
100 do { 100 do {
101 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 101 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
102 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state)); 102 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state));
103
104 iounmap(psc_base);
103} 105}