diff options
Diffstat (limited to 'arch/arm/mach-davinci/mux.c')
-rw-r--r-- | arch/arm/mach-davinci/mux.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/mux.c b/arch/arm/mach-davinci/mux.c new file mode 100644 index 000000000000..92d26bd305b7 --- /dev/null +++ b/arch/arm/mach-davinci/mux.c | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * DaVinci pin multiplexing configurations | ||
3 | * | ||
4 | * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com> | ||
5 | * | ||
6 | * 2007 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/spinlock.h> | ||
13 | |||
14 | #include <asm/hardware.h> | ||
15 | |||
16 | #include <asm/arch/mux.h> | ||
17 | |||
18 | /* System control register offsets */ | ||
19 | #define PINMUX0 0x00 | ||
20 | #define PINMUX1 0x04 | ||
21 | |||
22 | static DEFINE_SPINLOCK(mux_lock); | ||
23 | |||
24 | void davinci_mux_peripheral(unsigned int mux, unsigned int enable) | ||
25 | { | ||
26 | u32 pinmux, muxreg = PINMUX0; | ||
27 | |||
28 | if (mux >= DAVINCI_MUX_LEVEL2) { | ||
29 | muxreg = PINMUX1; | ||
30 | mux -= DAVINCI_MUX_LEVEL2; | ||
31 | } | ||
32 | |||
33 | spin_lock(&mux_lock); | ||
34 | pinmux = davinci_readl(DAVINCI_SYSTEM_MODULE_BASE + muxreg); | ||
35 | if (enable) | ||
36 | pinmux |= (1 << mux); | ||
37 | else | ||
38 | pinmux &= ~(1 << mux); | ||
39 | davinci_writel(pinmux, DAVINCI_SYSTEM_MODULE_BASE + muxreg); | ||
40 | spin_unlock(&mux_lock); | ||
41 | } | ||