diff options
author | Wolfgang Denk <wd@denx.de> | 2009-12-01 12:10:51 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-12-01 12:10:51 +0100 |
commit | 57bf140ac66f95c9c36c494e4d027551b5477b01 (patch) | |
tree | 78cc2602ee9dca3284e47f38d29380171fb53646 /cpu/arm926ejs/davinci/psc.c | |
parent | 34ddbd171ba154e9afd83f07a07ad8b57ac592e3 (diff) | |
parent | 71636fa7c3de63de29c0f514d5c725eccb011657 (diff) |
Merge branch 'next-sync' of git://git.denx.de/u-boot-arm into next
Diffstat (limited to 'cpu/arm926ejs/davinci/psc.c')
-rw-r--r-- | cpu/arm926ejs/davinci/psc.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/cpu/arm926ejs/davinci/psc.c b/cpu/arm926ejs/davinci/psc.c index 5bb972f18..8273a7fae 100644 --- a/cpu/arm926ejs/davinci/psc.c +++ b/cpu/arm926ejs/davinci/psc.c @@ -25,6 +25,7 @@ #include <common.h> #include <asm/arch/hardware.h> +#include <asm/io.h> /* * The PSC manages three inputs to a "module" which may be a peripheral or @@ -47,21 +48,45 @@ /* Works on Always On power domain only (no PD argument) */ void lpsc_on(unsigned int id) { - dv_reg_p mdstat, mdctl; + dv_reg_p mdstat, mdctl, ptstat, ptcmd; +#ifdef CONFIG_SOC_DA8XX + struct davinci_psc_regs *psc_regs; +#endif +#ifndef CONFIG_SOC_DA8XX if (id >= DAVINCI_LPSC_GEM) return; /* Don't work on DSP Power Domain */ mdstat = REG_P(PSC_MDSTAT_BASE + (id * 4)); mdctl = REG_P(PSC_MDCTL_BASE + (id * 4)); + ptstat = REG_P(PSC_PTSTAT); + ptcmd = REG_P(PSC_PTCMD); +#else + if (id < DAVINCI_LPSC_PSC1_BASE) { + if (id >= PSC_PSC0_MODULE_ID_CNT) + return; + psc_regs = davinci_psc0_regs; + mdstat = &psc_regs->psc0.mdstat[id]; + mdctl = &psc_regs->psc0.mdctl[id]; + } else { + id -= DAVINCI_LPSC_PSC1_BASE; + if (id >= PSC_PSC1_MODULE_ID_CNT) + return; + psc_regs = davinci_psc1_regs; + mdstat = &psc_regs->psc1.mdstat[id]; + mdctl = &psc_regs->psc1.mdctl[id]; + } + ptstat = &psc_regs->ptstat; + ptcmd = &psc_regs->ptcmd; +#endif - while (REG(PSC_PTSTAT) & 0x01) + while (readl(ptstat) & 0x01) continue; - if ((*mdstat & 0x1f) == 0x03) - return; /* Already on and enabled */ + if ((readl(mdstat) & 0x1f) == 0x03) + return; /* Already on and enabled */ - *mdctl |= 0x03; + writel(readl(mdctl) | 0x03, mdctl); switch (id) { #ifdef CONFIG_SOC_DM644X @@ -80,16 +105,16 @@ void lpsc_on(unsigned int id) case DAVINCI_LPSC_MEMSTICK: case DAVINCI_LPSC_McBSP: case DAVINCI_LPSC_GPIO: - *mdctl |= 0x200; + writel(readl(mdctl) | 0x200, mdctl); break; #endif } - REG(PSC_PTCMD) = 0x01; + writel(0x01, ptcmd); - while (REG(PSC_PTSTAT) & 0x03) + while (readl(ptstat) & 0x01) continue; - while ((*mdstat & 0x1f) != 0x03) /* Probably an overkill... */ + while ((readl(mdstat) & 0x1f) != 0x03) continue; } |