aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-03-05 09:30:51 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-05 19:02:51 -0500
commit2405fc9728a3ed7dffc36bee68f0c36e4488212d (patch)
tree60f0a574896868e087d4edf6f22f326c9aa0d52f /arch/arm
parent17ec38a8b6d95100a585ed66ccc7bada13e09d0d (diff)
ARM: imx: merge audmux-v1 and audmux-v2
It merges audmux-v1 and audmux-v2 under arch/arm/plat-mxc into one. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/Kconfig12
-rw-r--r--arch/arm/plat-mxc/Kconfig5
-rw-r--r--arch/arm/plat-mxc/Makefile3
-rw-r--r--arch/arm/plat-mxc/audmux-v1.c64
-rw-r--r--arch/arm/plat-mxc/audmux.c (renamed from arch/arm/plat-mxc/audmux-v2.c)29
5 files changed, 34 insertions, 79 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 4defb97bbfc..495a8543e71 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -46,7 +46,7 @@ config SOC_IMX21
46 bool 46 bool
47 select MACH_MX21 47 select MACH_MX21
48 select CPU_ARM926T 48 select CPU_ARM926T
49 select ARCH_MXC_AUDMUX_V1 49 select ARCH_MXC_AUDMUX
50 select IMX_HAVE_DMA_V1 50 select IMX_HAVE_DMA_V1
51 select IMX_HAVE_IOMUX_V1 51 select IMX_HAVE_IOMUX_V1
52 select MXC_AVIC 52 select MXC_AVIC
@@ -55,7 +55,7 @@ config SOC_IMX25
55 bool 55 bool
56 select ARCH_MX25 56 select ARCH_MX25
57 select CPU_ARM926T 57 select CPU_ARM926T
58 select ARCH_MXC_AUDMUX_V2 58 select ARCH_MXC_AUDMUX
59 select ARCH_MXC_IOMUX_V3 59 select ARCH_MXC_IOMUX_V3
60 select MXC_AVIC 60 select MXC_AVIC
61 61
@@ -63,7 +63,7 @@ config SOC_IMX27
63 bool 63 bool
64 select MACH_MX27 64 select MACH_MX27
65 select CPU_ARM926T 65 select CPU_ARM926T
66 select ARCH_MXC_AUDMUX_V1 66 select ARCH_MXC_AUDMUX
67 select IMX_HAVE_DMA_V1 67 select IMX_HAVE_DMA_V1
68 select IMX_HAVE_IOMUX_V1 68 select IMX_HAVE_IOMUX_V1
69 select MXC_AVIC 69 select MXC_AVIC
@@ -72,7 +72,7 @@ config SOC_IMX31
72 bool 72 bool
73 select CPU_V6 73 select CPU_V6
74 select IMX_HAVE_PLATFORM_MXC_RNGA 74 select IMX_HAVE_PLATFORM_MXC_RNGA
75 select ARCH_MXC_AUDMUX_V2 75 select ARCH_MXC_AUDMUX
76 select MXC_AVIC 76 select MXC_AVIC
77 select SMP_ON_UP if SMP 77 select SMP_ON_UP if SMP
78 78
@@ -80,7 +80,7 @@ config SOC_IMX35
80 bool 80 bool
81 select CPU_V6 81 select CPU_V6
82 select ARCH_MXC_IOMUX_V3 82 select ARCH_MXC_IOMUX_V3
83 select ARCH_MXC_AUDMUX_V2 83 select ARCH_MXC_AUDMUX
84 select HAVE_EPIT 84 select HAVE_EPIT
85 select MXC_AVIC 85 select MXC_AVIC
86 select SMP_ON_UP if SMP 86 select SMP_ON_UP if SMP
@@ -89,7 +89,7 @@ config SOC_IMX5
89 select CPU_V7 89 select CPU_V7
90 select MXC_TZIC 90 select MXC_TZIC
91 select ARCH_MXC_IOMUX_V3 91 select ARCH_MXC_IOMUX_V3
92 select ARCH_MXC_AUDMUX_V2 92 select ARCH_MXC_AUDMUX
93 select ARCH_HAS_CPUFREQ 93 select ARCH_HAS_CPUFREQ
94 select ARCH_MX5 94 select ARCH_MX5
95 bool 95 bool
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index dcebb1230f7..0461d16e5ca 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -88,10 +88,7 @@ config IMX_HAVE_IOMUX_V1
88config ARCH_MXC_IOMUX_V3 88config ARCH_MXC_IOMUX_V3
89 bool 89 bool
90 90
91config ARCH_MXC_AUDMUX_V1 91config ARCH_MXC_AUDMUX
92 bool
93
94config ARCH_MXC_AUDMUX_V2
95 bool 92 bool
96 93
97config IRAM_ALLOC 94config IRAM_ALLOC
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 076db84f3e3..530c81dfd9b 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -14,8 +14,7 @@ obj-$(CONFIG_IRAM_ALLOC) += iram_alloc.o
14obj-$(CONFIG_MXC_PWM) += pwm.o 14obj-$(CONFIG_MXC_PWM) += pwm.o
15obj-$(CONFIG_MXC_ULPI) += ulpi.o 15obj-$(CONFIG_MXC_ULPI) += ulpi.o
16obj-$(CONFIG_MXC_USE_EPIT) += epit.o 16obj-$(CONFIG_MXC_USE_EPIT) += epit.o
17obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o 17obj-$(CONFIG_ARCH_MXC_AUDMUX) += audmux.o
18obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
19obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 18obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
20obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o 19obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
21ifdef CONFIG_SND_IMX_SOC 20ifdef CONFIG_SND_IMX_SOC
diff --git a/arch/arm/plat-mxc/audmux-v1.c b/arch/arm/plat-mxc/audmux-v1.c
deleted file mode 100644
index 1180bef7664..00000000000
--- a/arch/arm/plat-mxc/audmux-v1.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
3 *
4 * Initial development of this code was funded by
5 * Phytec Messtechnik GmbH, http://www.phytec.de
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/module.h>
19#include <linux/err.h>
20#include <linux/io.h>
21#include <linux/clk.h>
22#include <mach/audmux.h>
23#include <mach/hardware.h>
24
25static void __iomem *audmux_base;
26
27static unsigned char port_mapping[] = {
28 0x0, 0x4, 0x8, 0x10, 0x14, 0x1c,
29};
30
31int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr)
32{
33 if (!audmux_base) {
34 printk("%s: not configured\n", __func__);
35 return -ENOSYS;
36 }
37
38 if (port >= ARRAY_SIZE(port_mapping))
39 return -EINVAL;
40
41 writel(pcr, audmux_base + port_mapping[port]);
42
43 return 0;
44}
45EXPORT_SYMBOL_GPL(mxc_audmux_v1_configure_port);
46
47static int mxc_audmux_v1_init(void)
48{
49#ifdef CONFIG_MACH_MX21
50 if (cpu_is_mx21())
51 audmux_base = MX21_IO_ADDRESS(MX21_AUDMUX_BASE_ADDR);
52 else
53#endif
54#ifdef CONFIG_MACH_MX27
55 if (cpu_is_mx27())
56 audmux_base = MX27_IO_ADDRESS(MX27_AUDMUX_BASE_ADDR);
57 else
58#endif
59 (void)0;
60
61 return 0;
62}
63
64postcore_initcall(mxc_audmux_v1_init);
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux.c
index 8cced35009b..b49a39ff99d 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux.c
@@ -165,6 +165,24 @@ static inline void audmux_debugfs_init(void)
165} 165}
166#endif 166#endif
167 167
168static const uint8_t port_mapping[] = {
169 0x0, 0x4, 0x8, 0x10, 0x14, 0x1c,
170};
171
172int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr)
173{
174 if (!audmux_base)
175 return -ENOSYS;
176
177 if (port >= ARRAY_SIZE(port_mapping))
178 return -EINVAL;
179
180 writel(pcr, audmux_base + port_mapping[port]);
181
182 return 0;
183}
184EXPORT_SYMBOL_GPL(mxc_audmux_v1_configure_port);
185
168int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr, 186int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
169 unsigned int pdcr) 187 unsigned int pdcr)
170{ 188{
@@ -184,7 +202,7 @@ int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
184} 202}
185EXPORT_SYMBOL_GPL(mxc_audmux_v2_configure_port); 203EXPORT_SYMBOL_GPL(mxc_audmux_v2_configure_port);
186 204
187static int mxc_audmux_v2_init(void) 205static int mxc_audmux_init(void)
188{ 206{
189 int ret; 207 int ret;
190 if (cpu_is_mx51()) { 208 if (cpu_is_mx51()) {
@@ -209,11 +227,16 @@ static int mxc_audmux_v2_init(void)
209 return ret; 227 return ret;
210 } 228 }
211 audmux_base = MX25_IO_ADDRESS(MX25_AUDMUX_BASE_ADDR); 229 audmux_base = MX25_IO_ADDRESS(MX25_AUDMUX_BASE_ADDR);
230 } else if (cpu_is_mx27()) {
231 audmux_base = MX27_IO_ADDRESS(MX27_AUDMUX_BASE_ADDR);
232 } else if (cpu_is_mx21()) {
233 audmux_base = MX21_IO_ADDRESS(MX21_AUDMUX_BASE_ADDR);
212 } 234 }
213 235
214 audmux_debugfs_init(); 236 if (!cpu_is_mx2())
237 audmux_debugfs_init();
215 238
216 return 0; 239 return 0;
217} 240}
218 241
219postcore_initcall(mxc_audmux_v2_init); 242postcore_initcall(mxc_audmux_init);