aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 21:19:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 21:19:05 -0400
commit61464c8357c8f6b780e4c44f5c79471799c51ca7 (patch)
tree4509cf075403965528f380f2f825c46908fb7d4e /arch/arm/plat-mxc
parent47061eda2584b9e4516d1e3a9713406a3a559ac8 (diff)
parent9cf1c871526cf6bfec2a653e1e068ee72592542c (diff)
Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM soc general cleanups from Olof Johansson: "This is a large branch that contains a handful of different cleanups: - Fixing up the I/O space remapping on PCI on ARM. This is a series from Rob Herring that restructures how all pci devices allocate I/O space, and it's part of the work to allow multiplatform kernels. - A number of cleanup series for OMAP, moving and removing some headers, sparse irq rework and in general preparation for multiplatform. - Final removal of all non-DT boards for Tegra, it is now device-tree-only! - Removal of a stale platform, nxp4008. It's an old mobile chipset that is no longer in use, and was very likely never really used with a mainline kernel. We have not been able to find anyone interested in keeping it around in the kernel. - Removal of the legacy dmaengine driver on tegra + A handful of other things that I haven't described above." Fix up some conflicts with the staging tree (and because nxp4008 was removed) * tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (184 commits) ARM: OMAP2+: serial: Change MAX_HSUART_PORTS to 6 ARM: OMAP4: twl-common: Support for additional devices on i2c1 bus ARM: mmp: using for_each_set_bit to simplify the code ARM: tegra: harmony: fix ldo7 regulator-name ARM: OMAP2+: Make omap4-keypad.h local ARM: OMAP2+: Make l4_3xxx.h local ARM: OMAP2+: Make l4_2xxx.h local ARM: OMAP2+: Make l3_3xxx.h local ARM: OMAP2+: Make l3_2xxx.h local ARM: OMAP1: Move irda.h from plat to mach ARM: OMAP2+: Make hdq1w.h local ARM: OMAP2+: Make gpmc-smsc911x.h local ARM: OMAP2+: Make gpmc-smc91x.h local ARM: OMAP1: Move flash.h from plat to mach ARM: OMAP2+: Make debug-devices.h local ARM: OMAP1: Move board-voiceblue.h from plat to mach ARM: OMAP1: Move board-sx1.h from plat to mach ARM: OMAP2+: Make omap-wakeupgen.h local ARM: OMAP2+: Make omap-secure.h local ARM: OMAP2+: Make ctrl_module_wkup_44xx.h local ...
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r--arch/arm/plat-mxc/Makefile2
-rw-r--r--arch/arm/plat-mxc/clock.c257
-rw-r--r--arch/arm/plat-mxc/cpufreq.c1
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c2
-rw-r--r--arch/arm/plat-mxc/include/mach/clock.h70
-rw-r--r--arch/arm/plat-mxc/include/mach/mx2_cam.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h6
-rw-r--r--arch/arm/plat-mxc/system.c4
8 files changed, 5 insertions, 339 deletions
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 6ac72003115..149237e2485 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o time.o devices.o cpu.o system.o irq-common.o 6obj-y := time.o devices.o cpu.o system.o irq-common.o
7 7
8obj-$(CONFIG_MXC_TZIC) += tzic.o 8obj-$(CONFIG_MXC_TZIC) += tzic.o
9obj-$(CONFIG_MXC_AVIC) += avic.o 9obj-$(CONFIG_MXC_AVIC) += avic.o
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
deleted file mode 100644
index 5079787273d..00000000000
--- a/arch/arm/plat-mxc/clock.c
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 * Based on arch/arm/plat-omap/clock.c
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
7 * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
8 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301, USA.
23 */
24
25/* #define DEBUG */
26
27#include <linux/clk.h>
28#include <linux/err.h>
29#include <linux/errno.h>
30#include <linux/init.h>
31#include <linux/io.h>
32#include <linux/kernel.h>
33#include <linux/list.h>
34#include <linux/module.h>
35#include <linux/mutex.h>
36#include <linux/platform_device.h>
37#include <linux/proc_fs.h>
38#include <linux/semaphore.h>
39#include <linux/string.h>
40
41#include <mach/clock.h>
42#include <mach/hardware.h>
43
44#ifndef CONFIG_COMMON_CLK
45static LIST_HEAD(clocks);
46static DEFINE_MUTEX(clocks_mutex);
47
48/*-------------------------------------------------------------------------
49 * Standard clock functions defined in include/linux/clk.h
50 *-------------------------------------------------------------------------*/
51
52static void __clk_disable(struct clk *clk)
53{
54 if (clk == NULL || IS_ERR(clk))
55 return;
56 WARN_ON(!clk->usecount);
57
58 if (!(--clk->usecount)) {
59 if (clk->disable)
60 clk->disable(clk);
61 __clk_disable(clk->parent);
62 __clk_disable(clk->secondary);
63 }
64}
65
66static int __clk_enable(struct clk *clk)
67{
68 if (clk == NULL || IS_ERR(clk))
69 return -EINVAL;
70
71 if (clk->usecount++ == 0) {
72 __clk_enable(clk->parent);
73 __clk_enable(clk->secondary);
74
75 if (clk->enable)
76 clk->enable(clk);
77 }
78 return 0;
79}
80
81/* This function increments the reference count on the clock and enables the
82 * clock if not already enabled. The parent clock tree is recursively enabled
83 */
84int clk_enable(struct clk *clk)
85{
86 int ret = 0;
87
88 if (clk == NULL || IS_ERR(clk))
89 return -EINVAL;
90
91 mutex_lock(&clocks_mutex);
92 ret = __clk_enable(clk);
93 mutex_unlock(&clocks_mutex);
94
95 return ret;
96}
97EXPORT_SYMBOL(clk_enable);
98
99/* This function decrements the reference count on the clock and disables
100 * the clock when reference count is 0. The parent clock tree is
101 * recursively disabled
102 */
103void clk_disable(struct clk *clk)
104{
105 if (clk == NULL || IS_ERR(clk))
106 return;
107
108 mutex_lock(&clocks_mutex);
109 __clk_disable(clk);
110 mutex_unlock(&clocks_mutex);
111}
112EXPORT_SYMBOL(clk_disable);
113
114/* Retrieve the *current* clock rate. If the clock itself
115 * does not provide a special calculation routine, ask
116 * its parent and so on, until one is able to return
117 * a valid clock rate
118 */
119unsigned long clk_get_rate(struct clk *clk)
120{
121 if (clk == NULL || IS_ERR(clk))
122 return 0UL;
123
124 if (clk->get_rate)
125 return clk->get_rate(clk);
126
127 return clk_get_rate(clk->parent);
128}
129EXPORT_SYMBOL(clk_get_rate);
130
131/* Round the requested clock rate to the nearest supported
132 * rate that is less than or equal to the requested rate.
133 * This is dependent on the clock's current parent.
134 */
135long clk_round_rate(struct clk *clk, unsigned long rate)
136{
137 if (clk == NULL || IS_ERR(clk) || !clk->round_rate)
138 return 0;
139
140 return clk->round_rate(clk, rate);
141}
142EXPORT_SYMBOL(clk_round_rate);
143
144/* Set the clock to the requested clock rate. The rate must
145 * match a supported rate exactly based on what clk_round_rate returns
146 */
147int clk_set_rate(struct clk *clk, unsigned long rate)
148{
149 int ret = -EINVAL;
150
151 if (clk == NULL || IS_ERR(clk) || clk->set_rate == NULL || rate == 0)
152 return ret;
153
154 mutex_lock(&clocks_mutex);
155 ret = clk->set_rate(clk, rate);
156 mutex_unlock(&clocks_mutex);
157
158 return ret;
159}
160EXPORT_SYMBOL(clk_set_rate);
161
162/* Set the clock's parent to another clock source */
163int clk_set_parent(struct clk *clk, struct clk *parent)
164{
165 int ret = -EINVAL;
166 struct clk *old;
167
168 if (clk == NULL || IS_ERR(clk) || parent == NULL ||
169 IS_ERR(parent) || clk->set_parent == NULL)
170 return ret;
171
172 if (clk->usecount)
173 clk_enable(parent);
174
175 mutex_lock(&clocks_mutex);
176 ret = clk->set_parent(clk, parent);
177 if (ret == 0) {
178 old = clk->parent;
179 clk->parent = parent;
180 } else {
181 old = parent;
182 }
183 mutex_unlock(&clocks_mutex);
184
185 if (clk->usecount)
186 clk_disable(old);
187
188 return ret;
189}
190EXPORT_SYMBOL(clk_set_parent);
191
192/* Retrieve the clock's parent clock source */
193struct clk *clk_get_parent(struct clk *clk)
194{
195 struct clk *ret = NULL;
196
197 if (clk == NULL || IS_ERR(clk))
198 return ret;
199
200 return clk->parent;
201}
202EXPORT_SYMBOL(clk_get_parent);
203
204#else
205
206/*
207 * Lock to protect the clock module (ccm) registers. Used
208 * on all i.MXs
209 */
210DEFINE_SPINLOCK(imx_ccm_lock);
211
212#endif /* CONFIG_COMMON_CLK */
213
214/*
215 * Get the resulting clock rate from a PLL register value and the input
216 * frequency. PLLs with this register layout can at least be found on
217 * MX1, MX21, MX27 and MX31
218 *
219 * mfi + mfn / (mfd + 1)
220 * f = 2 * f_ref * --------------------
221 * pd + 1
222 */
223unsigned long mxc_decode_pll(unsigned int reg_val, u32 freq)
224{
225 long long ll;
226 int mfn_abs;
227 unsigned int mfi, mfn, mfd, pd;
228
229 mfi = (reg_val >> 10) & 0xf;
230 mfn = reg_val & 0x3ff;
231 mfd = (reg_val >> 16) & 0x3ff;
232 pd = (reg_val >> 26) & 0xf;
233
234 mfi = mfi <= 5 ? 5 : mfi;
235
236 mfn_abs = mfn;
237
238 /* On all i.MXs except i.MX1 and i.MX21 mfn is a 10bit
239 * 2's complements number
240 */
241 if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200)
242 mfn_abs = 0x400 - mfn;
243
244 freq *= 2;
245 freq /= pd + 1;
246
247 ll = (unsigned long long)freq * mfn_abs;
248
249 do_div(ll, mfd + 1);
250
251 if (!cpu_is_mx1() && !cpu_is_mx21() && mfn >= 0x200)
252 ll = -ll;
253
254 ll = (freq * mfi) + ll;
255
256 return ll;
257}
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c
index 73db34bf588..b5b6f808313 100644
--- a/arch/arm/plat-mxc/cpufreq.c
+++ b/arch/arm/plat-mxc/cpufreq.c
@@ -23,7 +23,6 @@
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/clock.h>
27 26
28#define CLK32_FREQ 32768 27#define CLK32_FREQ 32768
29#define NANOSECOND (1000 * 1000 * 1000) 28#define NANOSECOND (1000 * 1000 * 1000)
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
index 2020d84956c..d390f00bd29 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -87,7 +87,7 @@ const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
87#ifdef CONFIG_SOC_IMX35 87#ifdef CONFIG_SOC_IMX35
88const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = { 88const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
89#define imx35_imx_uart_data_entry(_id, _hwid) \ 89#define imx35_imx_uart_data_entry(_id, _hwid) \
90 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_16K) 90 imx_imx_uart_1irq_data_entry(MX35, _id, _hwid, SZ_16K)
91 imx35_imx_uart_data_entry(0, 1), 91 imx35_imx_uart_data_entry(0, 1),
92 imx35_imx_uart_data_entry(1, 2), 92 imx35_imx_uart_data_entry(1, 2),
93 imx35_imx_uart_data_entry(2, 3), 93 imx35_imx_uart_data_entry(2, 3),
diff --git a/arch/arm/plat-mxc/include/mach/clock.h b/arch/arm/plat-mxc/include/mach/clock.h
deleted file mode 100644
index bd940c795cb..00000000000
--- a/arch/arm/plat-mxc/include/mach/clock.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#ifndef __ASM_ARCH_MXC_CLOCK_H__
21#define __ASM_ARCH_MXC_CLOCK_H__
22
23#ifndef __ASSEMBLY__
24#include <linux/list.h>
25
26#ifndef CONFIG_COMMON_CLK
27struct module;
28
29struct clk {
30 int id;
31 /* Source clock this clk depends on */
32 struct clk *parent;
33 /* Secondary clock to enable/disable with this clock */
34 struct clk *secondary;
35 /* Reference count of clock enable/disable */
36 __s8 usecount;
37 /* Register bit position for clock's enable/disable control. */
38 u8 enable_shift;
39 /* Register address for clock's enable/disable control. */
40 void __iomem *enable_reg;
41 u32 flags;
42 /* get the current clock rate (always a fresh value) */
43 unsigned long (*get_rate) (struct clk *);
44 /* Function ptr to set the clock to a new rate. The rate must match a
45 supported rate returned from round_rate. Leave blank if clock is not
46 programmable */
47 int (*set_rate) (struct clk *, unsigned long);
48 /* Function ptr to round the requested clock rate to the nearest
49 supported rate that is less than or equal to the requested rate. */
50 unsigned long (*round_rate) (struct clk *, unsigned long);
51 /* Function ptr to enable the clock. Leave blank if clock can not
52 be gated. */
53 int (*enable) (struct clk *);
54 /* Function ptr to disable the clock. Leave blank if clock can not
55 be gated. */
56 void (*disable) (struct clk *);
57 /* Function ptr to set the parent clock of the clock. */
58 int (*set_parent) (struct clk *, struct clk *);
59};
60
61int clk_register(struct clk *clk);
62void clk_unregister(struct clk *clk);
63#endif /* CONFIG_COMMON_CLK */
64
65extern spinlock_t imx_ccm_lock;
66
67unsigned long mxc_decode_pll(unsigned int pll, u32 f_ref);
68
69#endif /* __ASSEMBLY__ */
70#endif /* __ASM_ARCH_MXC_CLOCK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx2_cam.h b/arch/arm/plat-mxc/include/mach/mx2_cam.h
index 3c080a32dbf..7ded6f1f74b 100644
--- a/arch/arm/plat-mxc/include/mach/mx2_cam.h
+++ b/arch/arm/plat-mxc/include/mach/mx2_cam.h
@@ -23,7 +23,6 @@
23#ifndef __MACH_MX2_CAM_H_ 23#ifndef __MACH_MX2_CAM_H_
24#define __MACH_MX2_CAM_H_ 24#define __MACH_MX2_CAM_H_
25 25
26#define MX2_CAMERA_SWAP16 (1 << 0)
27#define MX2_CAMERA_EXT_VSYNC (1 << 1) 26#define MX2_CAMERA_EXT_VSYNC (1 << 1)
28#define MX2_CAMERA_CCIR (1 << 2) 27#define MX2_CAMERA_CCIR (1 << 2)
29#define MX2_CAMERA_CCIR_INTERLACE (1 << 3) 28#define MX2_CAMERA_CCIR_INTERLACE (1 << 3)
@@ -31,7 +30,6 @@
31#define MX2_CAMERA_GATED_CLOCK (1 << 5) 30#define MX2_CAMERA_GATED_CLOCK (1 << 5)
32#define MX2_CAMERA_INV_DATA (1 << 6) 31#define MX2_CAMERA_INV_DATA (1 << 6)
33#define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7) 32#define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7)
34#define MX2_CAMERA_PACK_DIR_MSB (1 << 8)
35 33
36/** 34/**
37 * struct mx2_camera_platform_data - optional platform data for mx2_camera 35 * struct mx2_camera_platform_data - optional platform data for mx2_camera
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index dbced61d9fd..ee9b1f9215d 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -76,7 +76,7 @@
76#define MX31_RTIC_BASE_ADDR (MX31_AIPS2_BASE_ADDR + 0xec000) 76#define MX31_RTIC_BASE_ADDR (MX31_AIPS2_BASE_ADDR + 0xec000)
77 77
78#define MX31_ROMP_BASE_ADDR 0x60000000 78#define MX31_ROMP_BASE_ADDR 0x60000000
79#define MX31_ROMP_BASE_ADDR_VIRT 0xfc500000 79#define MX31_ROMP_BASE_ADDR_VIRT IOMEM(0xfc500000)
80#define MX31_ROMP_SIZE SZ_1M 80#define MX31_ROMP_SIZE SZ_1M
81 81
82#define MX31_AVIC_BASE_ADDR 0x68000000 82#define MX31_AVIC_BASE_ADDR 0x68000000
@@ -92,11 +92,11 @@
92#define MX31_CS3_BASE_ADDR 0xb2000000 92#define MX31_CS3_BASE_ADDR 0xb2000000
93 93
94#define MX31_CS4_BASE_ADDR 0xb4000000 94#define MX31_CS4_BASE_ADDR 0xb4000000
95#define MX31_CS4_BASE_ADDR_VIRT 0xf6000000 95#define MX31_CS4_BASE_ADDR_VIRT IOMEM(0xf6000000)
96#define MX31_CS4_SIZE SZ_32M 96#define MX31_CS4_SIZE SZ_32M
97 97
98#define MX31_CS5_BASE_ADDR 0xb6000000 98#define MX31_CS5_BASE_ADDR 0xb6000000
99#define MX31_CS5_BASE_ADDR_VIRT 0xf8000000 99#define MX31_CS5_BASE_ADDR_VIRT IOMEM(0xf8000000)
100#define MX31_CS5_SIZE SZ_32M 100#define MX31_CS5_SIZE SZ_32M
101 101
102#define MX31_X_MEMC_BASE_ADDR 0xb8000000 102#define MX31_X_MEMC_BASE_ADDR 0xb8000000
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 1996c3e3b8f..3da78cfc5a9 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -21,7 +21,6 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/module.h>
25 24
26#include <mach/hardware.h> 25#include <mach/hardware.h>
27#include <mach/common.h> 26#include <mach/common.h>
@@ -29,9 +28,6 @@
29#include <asm/proc-fns.h> 28#include <asm/proc-fns.h>
30#include <asm/mach-types.h> 29#include <asm/mach-types.h>
31 30
32void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int) = NULL;
33EXPORT_SYMBOL_GPL(imx_ioremap);
34
35static void __iomem *wdog_base; 31static void __iomem *wdog_base;
36 32
37/* 33/*