summaryrefslogtreecommitdiff
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorBo Shen <voice.shen@atmel.com>2014-08-06 17:24:54 +0800
committerAndreas Bießmann <andreas.devel@googlemail.com>2014-09-19 00:11:18 +0200
commitb24c1a10b53e831b28da6a69911061a28b34bbd6 (patch)
tree3ef440387dc87dbe90ce842312d72ae16dcd7ccf /arch/arm/cpu
parent7b1dc26fae813fcf7650340803972feb8829853e (diff)
ARM: atmel: use pcr to enable or disable peripheral clock
When use pcr (peripheral control register), then we won't need to care about the peripheral ID. Signed-off-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Diffstat (limited to 'arch/arm/cpu')
-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);
}