summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/at91/clock.c
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2014-10-07 19:14:03 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2014-10-07 19:14:03 +0900
commit3cc83f9d08a80fddf4c1e8e766eff8273f30814c (patch)
tree831246a1b77d26d0296a84c90684e0fee0368737 /arch/arm/cpu/armv7/at91/clock.c
parent64f41212d880f3d00c6994d973aadeec5bda1b65 (diff)
parent6dd0e7c00bfa5ce861a72b8e4a3ef9e787306125 (diff)
Merge branch 'uboot'
Diffstat (limited to 'arch/arm/cpu/armv7/at91/clock.c')
-rw-r--r--arch/arm/cpu/armv7/at91/clock.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/arch/arm/cpu/armv7/at91/clock.c b/arch/arm/cpu/armv7/at91/clock.c
index 1588e0c8ea..36ed4a6394 100644
--- a/arch/arm/cpu/armv7/at91/clock.c
+++ b/arch/arm/cpu/armv7/at91/clock.c
@@ -114,9 +114,25 @@ int at91_clock_init(unsigned long main_clock)
void at91_periph_clk_enable(int id)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+ u32 regval;
- if (id > 31)
- writel(1 << (id - 32), &pmc->pcer1);
- else
- writel(1 << id, &pmc->pcer);
+ if (id > AT91_PMC_PCR_PID_MASK)
+ return;
+
+ regval = AT91_PMC_PCR_EN | AT91_PMC_PCR_CMD_WRITE | id;
+
+ writel(regval, &pmc->pcr);
+}
+
+void at91_periph_clk_disable(int id)
+{
+ struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+ u32 regval;
+
+ if (id > AT91_PMC_PCR_PID_MASK)
+ return;
+
+ regval = AT91_PMC_PCR_CMD_WRITE | id;
+
+ writel(regval, &pmc->pcr);
}