diff options
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/clkctl-imx31.c')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/clkctl-imx31.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/clkctl-imx31.c b/firmware/target/arm/imx31/gigabeat-s/clkctl-imx31.c new file mode 100644 index 0000000000..a01fab07d0 --- /dev/null +++ b/firmware/target/arm/imx31/gigabeat-s/clkctl-imx31.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2008 Michael Sevakis | ||
11 | * | ||
12 | * Clock control functions for IMX31 processor | ||
13 | * | ||
14 | * All files in this archive are subject to the GNU General Public License. | ||
15 | * See the file COPYING in the source tree root for full license agreement. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "system.h" | ||
22 | #include "cpu.h" | ||
23 | #include "clkctl-imx31.h" | ||
24 | |||
25 | void imx31_clkctl_module_clock_gating(enum IMX31_CG_LIST cg, | ||
26 | enum IMX31_CG_MODES mode) | ||
27 | { | ||
28 | volatile unsigned long *reg; | ||
29 | unsigned long mask; | ||
30 | int shift; | ||
31 | int oldlevel; | ||
32 | |||
33 | if (cg >= CG_NUM_CLOCKS) | ||
34 | return; | ||
35 | |||
36 | reg = &CLKCTL_CGR0 + cg / 16; /* Select CGR0, CGR1, CGR2 */ | ||
37 | shift = 2*(cg % 16); /* Get field shift */ | ||
38 | mask = CG_MASK << shift; /* Select field */ | ||
39 | |||
40 | oldlevel = disable_interrupt_save(IRQ_FIQ_STATUS); | ||
41 | |||
42 | *reg = (*reg & ~mask) | ((mode << shift) & mask); | ||
43 | |||
44 | restore_interrupt(oldlevel); | ||
45 | } | ||