blob: 87a3574783e7d9620e26998a5307697f882e8789 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Helpers for clock control and gating on Allwinner CPUs
*
* Copyright (C) 2013 Alexandru Gagniuc <mr.nuke.me@gmail.com>
* Subject to the GNU GPL v2, or (at your option) any later version.
*/
#include "clock.h"
#include <arch/io.h>
/**
* \brief Enable the clock source for the peripheral
*
* @param[in] periph peripheral and clock type to enable @see a1x_clken
*/
void a1x_periph_clock_enable(enum a1x_clken periph)
{
void *addr;
u32 reg32;
addr = (void *)A1X_CCM_BASE + (periph >> 5);
reg32 = read32(addr);
reg32 |= 1 << (periph & 0x1f);
write32(reg32, addr);
}
/**
* \brief Disable the clock source for the peripheral
*
* @param[in] periph peripheral and clock type to disable @see a1x_clken
*/
void a1x_periph_clock_disable(enum a1x_clken periph)
{
void *addr;
u32 reg32;
addr = (void *)A1X_CCM_BASE + (periph >> 5);
reg32 = read32(addr);
reg32 &= ~(1 << (periph & 0x1f));
write32(reg32, addr);
}
|