aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/Kconfig58
-rw-r--r--arch/arm/plat-omap/clock.c72
-rw-r--r--arch/arm/plat-omap/common.c95
-rw-r--r--arch/arm/plat-omap/cpu-omap.c1
-rw-r--r--arch/arm/plat-omap/devices.c39
-rw-r--r--arch/arm/plat-omap/dma.c12
-rw-r--r--arch/arm/plat-omap/dmtimer.c135
-rw-r--r--arch/arm/plat-omap/gpio.c365
-rw-r--r--arch/arm/plat-omap/i2c.c18
-rw-r--r--arch/arm/plat-omap/include/plat/board.h1
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev_omap.h26
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h102
-rw-r--r--arch/arm/plat-omap/include/plat/clockdomain.h98
-rw-r--r--arch/arm/plat-omap/include/plat/common.h24
-rw-r--r--arch/arm/plat-omap/include/plat/control.h42
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h93
-rw-r--r--arch/arm/plat-omap/include/plat/dma-44xx.h147
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h86
-rw-r--r--arch/arm/plat-omap/include/plat/flash.h16
-rw-r--r--arch/arm/plat-omap/include/plat/gpmc.h4
-rw-r--r--arch/arm/plat-omap/include/plat/i2c.h5
-rw-r--r--arch/arm/plat-omap/include/plat/io.h78
-rw-r--r--arch/arm/plat-omap/include/plat/irqs-44xx.h144
-rw-r--r--arch/arm/plat-omap/include/plat/irqs.h105
-rw-r--r--arch/arm/plat-omap/include/plat/mcbsp.h72
-rw-r--r--arch/arm/plat-omap/include/plat/memory.h3
-rw-r--r--arch/arm/plat-omap/include/plat/menelaus.h2
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h35
-rw-r--r--arch/arm/plat-omap/include/plat/multi.h94
-rw-r--r--arch/arm/plat-omap/include/plat/mux.h10
-rw-r--r--arch/arm/plat-omap/include/plat/nand.h10
-rw-r--r--arch/arm/plat-omap/include/plat/omap16xx.h74
-rw-r--r--arch/arm/plat-omap/include/plat/omap24xx.h6
-rw-r--r--arch/arm/plat-omap/include/plat/omap34xx.h6
-rw-r--r--arch/arm/plat-omap/include/plat/omap44xx.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap7xx.h3
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h11
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h139
-rw-r--r--arch/arm/plat-omap/include/plat/powerdomain.h95
-rw-r--r--arch/arm/plat-omap/include/plat/prcm.h11
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h70
-rw-r--r--arch/arm/plat-omap/include/plat/uncompress.h181
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h11
-rw-r--r--arch/arm/plat-omap/io.c18
-rw-r--r--arch/arm/plat-omap/iommu.c8
-rw-r--r--arch/arm/plat-omap/iopgtable.h50
-rw-r--r--arch/arm/plat-omap/mailbox.c8
-rw-r--r--arch/arm/plat-omap/mcbsp.c784
-rw-r--r--arch/arm/plat-omap/omap_device.c112
-rw-r--r--arch/arm/plat-omap/sram.c2
50 files changed, 2471 insertions, 1114 deletions
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index e2ea04a4c8a1..6da796ef82bd 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -7,27 +7,37 @@ config ARCH_OMAP_OTG
7 7
8choice 8choice
9 prompt "OMAP System Type" 9 prompt "OMAP System Type"
10 default ARCH_OMAP1 10 default ARCH_OMAP2PLUS
11 11
12config ARCH_OMAP1 12config ARCH_OMAP1
13 bool "TI OMAP1" 13 bool "TI OMAP1"
14 select COMMON_CLKDEV 14 select COMMON_CLKDEV
15 help
16 "Systems based on omap7xx, omap15xx or omap16xx"
17
18config ARCH_OMAP2PLUS
19 bool "TI OMAP2/3/4"
20 select COMMON_CLKDEV
21 help
22 "Systems based on omap24xx, omap34xx or omap44xx"
15 23
16config ARCH_OMAP2 24config ARCH_OMAP2
17 bool "TI OMAP2" 25 bool "TI OMAP2"
26 depends on ARCH_OMAP2PLUS
18 select CPU_V6 27 select CPU_V6
19 select COMMON_CLKDEV
20 28
21config ARCH_OMAP3 29config ARCH_OMAP3
22 bool "TI OMAP3" 30 bool "TI OMAP3"
31 depends on ARCH_OMAP2PLUS
23 select CPU_V7 32 select CPU_V7
24 select COMMON_CLKDEV 33 select USB_ARCH_HAS_EHCI
34 select ARM_L1_CACHE_SHIFT_6
25 35
26config ARCH_OMAP4 36config ARCH_OMAP4
27 bool "TI OMAP4" 37 bool "TI OMAP4"
38 depends on ARCH_OMAP2PLUS
28 select CPU_V7 39 select CPU_V7
29 select ARM_GIC 40 select ARM_GIC
30 select COMMON_CLKDEV
31 41
32endchoice 42endchoice
33 43
@@ -116,7 +126,7 @@ config OMAP_MPU_TIMER
116 126
117config OMAP_32K_TIMER 127config OMAP_32K_TIMER
118 bool "Use 32KHz timer" 128 bool "Use 32KHz timer"
119 depends on ARCH_OMAP16XX || ARCH_OMAP24XX || ARCH_OMAP34XX || ARCH_OMAP4 129 depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS
120 help 130 help
121 Select this option if you want to enable the OMAP 32KHz timer. 131 Select this option if you want to enable the OMAP 32KHz timer.
122 This timer saves power compared to the OMAP_MPU_TIMER, and has 132 This timer saves power compared to the OMAP_MPU_TIMER, and has
@@ -126,6 +136,23 @@ config OMAP_32K_TIMER
126 136
127endchoice 137endchoice
128 138
139config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
140 bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
141 depends on ARCH_OMAP3 && PM
142 default n
143 help
144 Without this option, L2 Auxiliary control register contents are
145 lost during off-mode entry on HS/EMU devices. This feature
146 requires support from PPA / boot-loader in HS/EMU devices, which
147 currently does not exist by default.
148
149config OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
150 int "Service ID for the support routine to set L2 AUX control"
151 depends on OMAP3_L2_AUX_SECURE_SAVE_RESTORE
152 default 43
153 help
154 PPA routine service ID for setting L2 auxiliary control register.
155
129config OMAP_32K_TIMER_HZ 156config OMAP_32K_TIMER_HZ
130 int "Kernel internal timer frequency for 32KHz timer" 157 int "Kernel internal timer frequency for 32KHz timer"
131 range 32 1024 158 range 32 1024
@@ -137,29 +164,10 @@ config OMAP_32K_TIMER_HZ
137 164
138config OMAP_DM_TIMER 165config OMAP_DM_TIMER
139 bool "Use dual-mode timer" 166 bool "Use dual-mode timer"
140 depends on ARCH_OMAP16XX || ARCH_OMAP24XX || ARCH_OMAP34XX || ARCH_OMAP4 167 depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS
141 help 168 help
142 Select this option if you want to use OMAP Dual-Mode timers. 169 Select this option if you want to use OMAP Dual-Mode timers.
143 170
144choice
145 prompt "Low-level debug console UART"
146 depends on ARCH_OMAP
147 default OMAP_LL_DEBUG_NONE
148
149config OMAP_LL_DEBUG_UART1
150 bool "UART1"
151
152config OMAP_LL_DEBUG_UART2
153 bool "UART2"
154
155config OMAP_LL_DEBUG_UART3
156 bool "UART3"
157
158config OMAP_LL_DEBUG_NONE
159 bool "None"
160
161endchoice
162
163config OMAP_SERIAL_WAKE 171config OMAP_SERIAL_WAKE
164 bool "Enable wake-up events for serial ports" 172 bool "Enable wake-up events for serial ports"
165 depends on ARCH_OMAP1 && OMAP_MUX 173 depends on ARCH_OMAP1 && OMAP_MUX
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 89cafc937249..5261a0923691 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -36,10 +36,6 @@ static struct clk_functions *arch_clock;
36 * Standard clock functions defined in include/linux/clk.h 36 * Standard clock functions defined in include/linux/clk.h
37 *-------------------------------------------------------------------------*/ 37 *-------------------------------------------------------------------------*/
38 38
39/* This functions is moved to arch/arm/common/clkdev.c. For OMAP4 since
40 * clock framework is not up , it is defined here to avoid rework in
41 * every driver. Also dummy prcm reset function is added */
42
43int clk_enable(struct clk *clk) 39int clk_enable(struct clk *clk)
44{ 40{
45 unsigned long flags; 41 unsigned long flags;
@@ -177,7 +173,7 @@ EXPORT_SYMBOL(clk_get_parent);
177 * OMAP specific clock functions shared between omap1 and omap2 173 * OMAP specific clock functions shared between omap1 and omap2
178 *-------------------------------------------------------------------------*/ 174 *-------------------------------------------------------------------------*/
179 175
180unsigned int __initdata mpurate; 176int __initdata mpurate;
181 177
182/* 178/*
183 * By default we use the rate set by the bootloader. 179 * By default we use the rate set by the bootloader.
@@ -203,6 +199,17 @@ unsigned long followparent_recalc(struct clk *clk)
203 return clk->parent->rate; 199 return clk->parent->rate;
204} 200}
205 201
202/*
203 * Used for clocks that have the same value as the parent clock,
204 * divided by some factor
205 */
206unsigned long omap_fixed_divisor_recalc(struct clk *clk)
207{
208 WARN_ON(!clk->fixed_div);
209
210 return clk->parent->rate / clk->fixed_div;
211}
212
206void clk_reparent(struct clk *child, struct clk *parent) 213void clk_reparent(struct clk *child, struct clk *parent)
207{ 214{
208 list_del_init(&child->sibling); 215 list_del_init(&child->sibling);
@@ -305,7 +312,33 @@ void clk_enable_init_clocks(void)
305 clk_enable(clkp); 312 clk_enable(clkp);
306 } 313 }
307} 314}
308EXPORT_SYMBOL(clk_enable_init_clocks); 315
316/**
317 * omap_clk_get_by_name - locate OMAP struct clk by its name
318 * @name: name of the struct clk to locate
319 *
320 * Locate an OMAP struct clk by its name. Assumes that struct clk
321 * names are unique. Returns NULL if not found or a pointer to the
322 * struct clk if found.
323 */
324struct clk *omap_clk_get_by_name(const char *name)
325{
326 struct clk *c;
327 struct clk *ret = NULL;
328
329 mutex_lock(&clocks_mutex);
330
331 list_for_each_entry(c, &clocks, node) {
332 if (!strcmp(c->name, name)) {
333 ret = c;
334 break;
335 }
336 }
337
338 mutex_unlock(&clocks_mutex);
339
340 return ret;
341}
309 342
310/* 343/*
311 * Low level helpers 344 * Low level helpers
@@ -324,6 +357,16 @@ const struct clkops clkops_null = {
324 .disable = clkll_disable_null, 357 .disable = clkll_disable_null,
325}; 358};
326 359
360/*
361 * Dummy clock
362 *
363 * Used for clock aliases that are needed on some OMAPs, but not others
364 */
365struct clk dummy_ck = {
366 .name = "dummy",
367 .ops = &clkops_null,
368};
369
327#ifdef CONFIG_CPU_FREQ 370#ifdef CONFIG_CPU_FREQ
328void clk_init_cpufreq_table(struct cpufreq_frequency_table **table) 371void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
329{ 372{
@@ -334,7 +377,16 @@ void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
334 arch_clock->clk_init_cpufreq_table(table); 377 arch_clock->clk_init_cpufreq_table(table);
335 spin_unlock_irqrestore(&clockfw_lock, flags); 378 spin_unlock_irqrestore(&clockfw_lock, flags);
336} 379}
337EXPORT_SYMBOL(clk_init_cpufreq_table); 380
381void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
382{
383 unsigned long flags;
384
385 spin_lock_irqsave(&clockfw_lock, flags);
386 if (arch_clock->clk_exit_cpufreq_table)
387 arch_clock->clk_exit_cpufreq_table(table);
388 spin_unlock_irqrestore(&clockfw_lock, flags);
389}
338#endif 390#endif
339 391
340/*-------------------------------------------------------------------------*/ 392/*-------------------------------------------------------------------------*/
@@ -387,14 +439,12 @@ static struct dentry *clk_debugfs_root;
387static int clk_debugfs_register_one(struct clk *c) 439static int clk_debugfs_register_one(struct clk *c)
388{ 440{
389 int err; 441 int err;
390 struct dentry *d, *child; 442 struct dentry *d, *child, *child_tmp;
391 struct clk *pa = c->parent; 443 struct clk *pa = c->parent;
392 char s[255]; 444 char s[255];
393 char *p = s; 445 char *p = s;
394 446
395 p += sprintf(p, "%s", c->name); 447 p += sprintf(p, "%s", c->name);
396 if (c->id != 0)
397 sprintf(p, ":%d", c->id);
398 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root); 448 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
399 if (!d) 449 if (!d)
400 return -ENOMEM; 450 return -ENOMEM;
@@ -419,7 +469,7 @@ static int clk_debugfs_register_one(struct clk *c)
419 469
420err_out: 470err_out:
421 d = c->dent; 471 d = c->dent;
422 list_for_each_entry(child, &d->d_subdirs, d_u.d_child) 472 list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
423 debugfs_remove(child); 473 debugfs_remove(child);
424 debugfs_remove(c->dent); 474 debugfs_remove(c->dent);
425 return err; 475 return err;
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index bf1eaf3a27d4..088c1a03b946 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -34,6 +34,7 @@
34#include <plat/control.h> 34#include <plat/control.h>
35#include <plat/mux.h> 35#include <plat/mux.h>
36#include <plat/fpga.h> 36#include <plat/fpga.h>
37#include <plat/serial.h>
37 38
38#include <plat/clock.h> 39#include <plat/clock.h>
39 40
@@ -126,7 +127,7 @@ static cycle_t omap2430_32k_read(struct clocksource *cs)
126#define omap2430_32k_read NULL 127#define omap2430_32k_read NULL
127#endif 128#endif
128 129
129#ifdef CONFIG_ARCH_OMAP34XX 130#ifdef CONFIG_ARCH_OMAP3
130static cycle_t omap34xx_32k_read(struct clocksource *cs) 131static cycle_t omap34xx_32k_read(struct clocksource *cs)
131{ 132{
132 return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10); 133 return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10);
@@ -172,6 +173,32 @@ unsigned long long sched_clock(void)
172 clocksource_32k.mult, clocksource_32k.shift); 173 clocksource_32k.mult, clocksource_32k.shift);
173} 174}
174 175
176/**
177 * read_persistent_clock - Return time from a persistent clock.
178 *
179 * Reads the time from a source which isn't disabled during PM, the
180 * 32k sync timer. Convert the cycles elapsed since last read into
181 * nsecs and adds to a monotonically increasing timespec.
182 */
183static struct timespec persistent_ts;
184static cycles_t cycles, last_cycles;
185void read_persistent_clock(struct timespec *ts)
186{
187 unsigned long long nsecs;
188 cycles_t delta;
189 struct timespec *tsp = &persistent_ts;
190
191 last_cycles = cycles;
192 cycles = clocksource_32k.read(&clocksource_32k);
193 delta = cycles - last_cycles;
194
195 nsecs = clocksource_cyc2ns(delta,
196 clocksource_32k.mult, clocksource_32k.shift);
197
198 timespec_add_ns(tsp, nsecs);
199 *ts = *tsp;
200}
201
175static int __init omap_init_clocksource_32k(void) 202static int __init omap_init_clocksource_32k(void)
176{ 203{
177 static char err[] __initdata = KERN_ERR 204 static char err[] __initdata = KERN_ERR
@@ -219,6 +246,7 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
219 omap2_set_globals_sdrc(omap2_globals); 246 omap2_set_globals_sdrc(omap2_globals);
220 omap2_set_globals_control(omap2_globals); 247 omap2_set_globals_control(omap2_globals);
221 omap2_set_globals_prcm(omap2_globals); 248 omap2_set_globals_prcm(omap2_globals);
249 omap2_set_globals_uart(omap2_globals);
222} 250}
223 251
224#endif 252#endif
@@ -228,11 +256,14 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
228static struct omap_globals omap242x_globals = { 256static struct omap_globals omap242x_globals = {
229 .class = OMAP242X_CLASS, 257 .class = OMAP242X_CLASS,
230 .tap = OMAP2_L4_IO_ADDRESS(0x48014000), 258 .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
231 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), 259 .sdrc = OMAP2420_SDRC_BASE,
232 .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE), 260 .sms = OMAP2420_SMS_BASE,
233 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE), 261 .ctrl = OMAP2420_CTRL_BASE,
234 .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE), 262 .prm = OMAP2420_PRM_BASE,
235 .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), 263 .cm = OMAP2420_CM_BASE,
264 .uart1_phys = OMAP2_UART1_BASE,
265 .uart2_phys = OMAP2_UART2_BASE,
266 .uart3_phys = OMAP2_UART3_BASE,
236}; 267};
237 268
238void __init omap2_set_globals_242x(void) 269void __init omap2_set_globals_242x(void)
@@ -246,11 +277,14 @@ void __init omap2_set_globals_242x(void)
246static struct omap_globals omap243x_globals = { 277static struct omap_globals omap243x_globals = {
247 .class = OMAP243X_CLASS, 278 .class = OMAP243X_CLASS,
248 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000), 279 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
249 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), 280 .sdrc = OMAP243X_SDRC_BASE,
250 .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE), 281 .sms = OMAP243X_SMS_BASE,
251 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE), 282 .ctrl = OMAP243X_CTRL_BASE,
252 .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE), 283 .prm = OMAP2430_PRM_BASE,
253 .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), 284 .cm = OMAP2430_CM_BASE,
285 .uart1_phys = OMAP2_UART1_BASE,
286 .uart2_phys = OMAP2_UART2_BASE,
287 .uart3_phys = OMAP2_UART3_BASE,
254}; 288};
255 289
256void __init omap2_set_globals_243x(void) 290void __init omap2_set_globals_243x(void)
@@ -259,21 +293,31 @@ void __init omap2_set_globals_243x(void)
259} 293}
260#endif 294#endif
261 295
262#if defined(CONFIG_ARCH_OMAP3430) 296#if defined(CONFIG_ARCH_OMAP3)
263 297
264static struct omap_globals omap343x_globals = { 298static struct omap_globals omap3_globals = {
265 .class = OMAP343X_CLASS, 299 .class = OMAP343X_CLASS,
266 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000), 300 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
267 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), 301 .sdrc = OMAP343X_SDRC_BASE,
268 .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE), 302 .sms = OMAP343X_SMS_BASE,
269 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), 303 .ctrl = OMAP343X_CTRL_BASE,
270 .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE), 304 .prm = OMAP3430_PRM_BASE,
271 .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), 305 .cm = OMAP3430_CM_BASE,
306 .uart1_phys = OMAP3_UART1_BASE,
307 .uart2_phys = OMAP3_UART2_BASE,
308 .uart3_phys = OMAP3_UART3_BASE,
272}; 309};
273 310
274void __init omap2_set_globals_343x(void) 311void __init omap2_set_globals_343x(void)
275{ 312{
276 __omap2_set_globals(&omap343x_globals); 313 __omap2_set_globals(&omap3_globals);
314}
315
316void __init omap2_set_globals_36xx(void)
317{
318 omap3_globals.uart4_phys = OMAP3_UART4_BASE;
319
320 __omap2_set_globals(&omap3_globals);
277} 321}
278#endif 322#endif
279 323
@@ -281,10 +325,14 @@ void __init omap2_set_globals_343x(void)
281static struct omap_globals omap4_globals = { 325static struct omap_globals omap4_globals = {
282 .class = OMAP443X_CLASS, 326 .class = OMAP443X_CLASS,
283 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), 327 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
284 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE), 328 .ctrl = OMAP443X_CTRL_BASE,
285 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE), 329 .prm = OMAP4430_PRM_BASE,
286 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE), 330 .cm = OMAP4430_CM_BASE,
287 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE), 331 .cm2 = OMAP4430_CM2_BASE,
332 .uart1_phys = OMAP4_UART1_BASE,
333 .uart2_phys = OMAP4_UART2_BASE,
334 .uart3_phys = OMAP4_UART3_BASE,
335 .uart4_phys = OMAP4_UART4_BASE,
288}; 336};
289 337
290void __init omap2_set_globals_443x(void) 338void __init omap2_set_globals_443x(void)
@@ -292,6 +340,7 @@ void __init omap2_set_globals_443x(void)
292 omap2_set_globals_tap(&omap4_globals); 340 omap2_set_globals_tap(&omap4_globals);
293 omap2_set_globals_control(&omap4_globals); 341 omap2_set_globals_control(&omap4_globals);
294 omap2_set_globals_prcm(&omap4_globals); 342 omap2_set_globals_prcm(&omap4_globals);
343 omap2_set_globals_uart(&omap4_globals);
295} 344}
296#endif 345#endif
297 346
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index f8ddbdd8b076..6d3d33360056 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -134,6 +134,7 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy)
134 134
135static int omap_cpu_exit(struct cpufreq_policy *policy) 135static int omap_cpu_exit(struct cpufreq_policy *policy)
136{ 136{
137 clk_exit_cpufreq_table(&freq_table);
137 clk_put(mpu_clk); 138 clk_put(mpu_clk);
138 return 0; 139 return 0;
139} 140}
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 30b5db73017a..4a4cd8774aaa 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -28,6 +28,7 @@
28#include <plat/menelaus.h> 28#include <plat/menelaus.h>
29#include <plat/mcbsp.h> 29#include <plat/mcbsp.h>
30#include <plat/dsp_common.h> 30#include <plat/dsp_common.h>
31#include <plat/omap44xx.h>
31 32
32#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE) 33#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
33 34
@@ -192,6 +193,41 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
192 193
193/*-------------------------------------------------------------------------*/ 194/*-------------------------------------------------------------------------*/
194 195
196#if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
197 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
198
199static struct resource mcpdm_resources[] = {
200 {
201 .name = "mcpdm_mem",
202 .start = OMAP44XX_MCPDM_BASE,
203 .end = OMAP44XX_MCPDM_BASE + SZ_4K,
204 .flags = IORESOURCE_MEM,
205 },
206 {
207 .name = "mcpdm_irq",
208 .start = OMAP44XX_IRQ_MCPDM,
209 .end = OMAP44XX_IRQ_MCPDM,
210 .flags = IORESOURCE_IRQ,
211 },
212};
213
214static struct platform_device omap_mcpdm_device = {
215 .name = "omap-mcpdm",
216 .id = -1,
217 .num_resources = ARRAY_SIZE(mcpdm_resources),
218 .resource = mcpdm_resources,
219};
220
221static void omap_init_mcpdm(void)
222{
223 (void) platform_device_register(&omap_mcpdm_device);
224}
225#else
226static inline void omap_init_mcpdm(void) {}
227#endif
228
229/*-------------------------------------------------------------------------*/
230
195#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ 231#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
196 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 232 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
197 233
@@ -244,7 +280,7 @@ fail:
244 280
245#if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE) 281#if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
246 282
247#ifdef CONFIG_ARCH_OMAP24XX 283#ifdef CONFIG_ARCH_OMAP2
248#define OMAP_RNG_BASE 0x480A0000 284#define OMAP_RNG_BASE 0x480A0000
249#else 285#else
250#define OMAP_RNG_BASE 0xfffe5000 286#define OMAP_RNG_BASE 0xfffe5000
@@ -385,6 +421,7 @@ static int __init omap_init_devices(void)
385 omap_init_dsp(); 421 omap_init_dsp();
386 omap_init_kp(); 422 omap_init_kp();
387 omap_init_rng(); 423 omap_init_rng();
424 omap_init_mcpdm();
388 omap_init_uwire(); 425 omap_init_uwire();
389 omap_init_wdt(); 426 omap_init_wdt();
390 return 0; 427 return 0;
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 09d82b3c66ce..2ab224c8e16c 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1183,7 +1183,7 @@ void omap_dma_unlink_lch(int lch_head, int lch_queue)
1183 } 1183 }
1184 1184
1185 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) || 1185 if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
1186 (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) { 1186 (dma_chan[lch_queue].flags & OMAP_DMA_ACTIVE)) {
1187 printk(KERN_ERR "omap_dma: You need to stop the DMA channels " 1187 printk(KERN_ERR "omap_dma: You need to stop the DMA channels "
1188 "before unlinking\n"); 1188 "before unlinking\n");
1189 dump_stack(); 1189 dump_stack();
@@ -1870,8 +1870,7 @@ static irqreturn_t omap1_dma_irq_handler(int irq, void *dev_id)
1870#define omap1_dma_irq_handler NULL 1870#define omap1_dma_irq_handler NULL
1871#endif 1871#endif
1872 1872
1873#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 1873#ifdef CONFIG_ARCH_OMAP2PLUS
1874 defined(CONFIG_ARCH_OMAP4)
1875 1874
1876static int omap2_dma_handle_ch(int ch) 1875static int omap2_dma_handle_ch(int ch)
1877{ 1876{
@@ -2133,13 +2132,13 @@ static int __init omap_init_dma(void)
2133 if (cpu_class_is_omap2()) { 2132 if (cpu_class_is_omap2()) {
2134 int irq; 2133 int irq;
2135 if (cpu_is_omap44xx()) 2134 if (cpu_is_omap44xx())
2136 irq = INT_44XX_SDMA_IRQ0; 2135 irq = OMAP44XX_IRQ_SDMA_0;
2137 else 2136 else
2138 irq = INT_24XX_SDMA_IRQ0; 2137 irq = INT_24XX_SDMA_IRQ0;
2139 setup_irq(irq, &omap24xx_dma_irq); 2138 setup_irq(irq, &omap24xx_dma_irq);
2140 } 2139 }
2141 2140
2142 if (cpu_is_omap34xx()) { 2141 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
2143 /* Enable smartidle idlemodes and autoidle */ 2142 /* Enable smartidle idlemodes and autoidle */
2144 u32 v = dma_read(OCP_SYSCONFIG); 2143 u32 v = dma_read(OCP_SYSCONFIG);
2145 v &= ~(DMA_SYSCONFIG_MIDLEMODE_MASK | 2144 v &= ~(DMA_SYSCONFIG_MIDLEMODE_MASK |
@@ -2150,7 +2149,8 @@ static int __init omap_init_dma(void)
2150 DMA_SYSCONFIG_AUTOIDLE); 2149 DMA_SYSCONFIG_AUTOIDLE);
2151 dma_write(v , OCP_SYSCONFIG); 2150 dma_write(v , OCP_SYSCONFIG);
2152 /* reserve dma channels 0 and 1 in high security devices */ 2151 /* reserve dma channels 0 and 1 in high security devices */
2153 if (omap_type() != OMAP2_DEVICE_TYPE_GP) { 2152 if (cpu_is_omap34xx() &&
2153 (omap_type() != OMAP2_DEVICE_TYPE_GP)) {
2154 printk(KERN_INFO "Reserving DMA channels 0 and 1 for " 2154 printk(KERN_INFO "Reserving DMA channels 0 and 1 for "
2155 "HS ROM code\n"); 2155 "HS ROM code\n");
2156 dma_chan[0].dev_id = 0; 2156 dma_chan[0].dev_id = 0;
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 64f407ee0f4e..4d99dfbc8bef 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -153,8 +153,7 @@
153struct omap_dm_timer { 153struct omap_dm_timer {
154 unsigned long phys_base; 154 unsigned long phys_base;
155 int irq; 155 int irq;
156#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 156#ifdef CONFIG_ARCH_OMAP2PLUS
157 defined(CONFIG_ARCH_OMAP4)
158 struct clk *iclk, *fclk; 157 struct clk *iclk, *fclk;
159#endif 158#endif
160 void __iomem *io_base; 159 void __iomem *io_base;
@@ -163,20 +162,9 @@ struct omap_dm_timer {
163 unsigned posted:1; 162 unsigned posted:1;
164}; 163};
165 164
166#ifdef CONFIG_ARCH_OMAP1 165static int dm_timer_count;
167
168#define omap_dm_clk_enable(x)
169#define omap_dm_clk_disable(x)
170#define omap2_dm_timers NULL
171#define omap2_dm_source_names NULL
172#define omap2_dm_source_clocks NULL
173#define omap3_dm_timers NULL
174#define omap3_dm_source_names NULL
175#define omap3_dm_source_clocks NULL
176#define omap4_dm_timers NULL
177#define omap4_dm_source_names NULL
178#define omap4_dm_source_clocks NULL
179 166
167#ifdef CONFIG_ARCH_OMAP1
180static struct omap_dm_timer omap1_dm_timers[] = { 168static struct omap_dm_timer omap1_dm_timers[] = {
181 { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, 169 { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 },
182 { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 }, 170 { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 },
@@ -188,20 +176,14 @@ static struct omap_dm_timer omap1_dm_timers[] = {
188 { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 }, 176 { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 },
189}; 177};
190 178
191static const int dm_timer_count = ARRAY_SIZE(omap1_dm_timers); 179static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers);
192
193#elif defined(CONFIG_ARCH_OMAP2)
194 180
195#define omap_dm_clk_enable(x) clk_enable(x) 181#else
196#define omap_dm_clk_disable(x) clk_disable(x)
197#define omap1_dm_timers NULL 182#define omap1_dm_timers NULL
198#define omap3_dm_timers NULL 183#define omap1_dm_timer_count 0
199#define omap3_dm_source_names NULL 184#endif /* CONFIG_ARCH_OMAP1 */
200#define omap3_dm_source_clocks NULL
201#define omap4_dm_timers NULL
202#define omap4_dm_source_names NULL
203#define omap4_dm_source_clocks NULL
204 185
186#ifdef CONFIG_ARCH_OMAP2
205static struct omap_dm_timer omap2_dm_timers[] = { 187static struct omap_dm_timer omap2_dm_timers[] = {
206 { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, 188 { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 },
207 { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 }, 189 { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 },
@@ -225,20 +207,16 @@ static const char *omap2_dm_source_names[] __initdata = {
225}; 207};
226 208
227static struct clk *omap2_dm_source_clocks[3]; 209static struct clk *omap2_dm_source_clocks[3];
228static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers); 210static const int omap2_dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
229 211
230#elif defined(CONFIG_ARCH_OMAP3) 212#else
231
232#define omap_dm_clk_enable(x) clk_enable(x)
233#define omap_dm_clk_disable(x) clk_disable(x)
234#define omap1_dm_timers NULL
235#define omap2_dm_timers NULL 213#define omap2_dm_timers NULL
214#define omap2_dm_timer_count 0
236#define omap2_dm_source_names NULL 215#define omap2_dm_source_names NULL
237#define omap2_dm_source_clocks NULL 216#define omap2_dm_source_clocks NULL
238#define omap4_dm_timers NULL 217#endif /* CONFIG_ARCH_OMAP2 */
239#define omap4_dm_source_names NULL
240#define omap4_dm_source_clocks NULL
241 218
219#ifdef CONFIG_ARCH_OMAP3
242static struct omap_dm_timer omap3_dm_timers[] = { 220static struct omap_dm_timer omap3_dm_timers[] = {
243 { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 }, 221 { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 },
244 { .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 }, 222 { .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 },
@@ -261,33 +239,29 @@ static const char *omap3_dm_source_names[] __initdata = {
261}; 239};
262 240
263static struct clk *omap3_dm_source_clocks[2]; 241static struct clk *omap3_dm_source_clocks[2];
264static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers); 242static const int omap3_dm_timer_count = ARRAY_SIZE(omap3_dm_timers);
265
266#elif defined(CONFIG_ARCH_OMAP4)
267 243
268#define omap_dm_clk_enable(x) clk_enable(x) 244#else
269#define omap_dm_clk_disable(x) clk_disable(x)
270#define omap1_dm_timers NULL
271#define omap2_dm_timers NULL
272#define omap2_dm_source_names NULL
273#define omap2_dm_source_clocks NULL
274#define omap3_dm_timers NULL 245#define omap3_dm_timers NULL
246#define omap3_dm_timer_count 0
275#define omap3_dm_source_names NULL 247#define omap3_dm_source_names NULL
276#define omap3_dm_source_clocks NULL 248#define omap3_dm_source_clocks NULL
249#endif /* CONFIG_ARCH_OMAP3 */
277 250
251#ifdef CONFIG_ARCH_OMAP4
278static struct omap_dm_timer omap4_dm_timers[] = { 252static struct omap_dm_timer omap4_dm_timers[] = {
279 { .phys_base = 0x4a318000, .irq = INT_44XX_GPTIMER1 }, 253 { .phys_base = 0x4a318000, .irq = OMAP44XX_IRQ_GPT1 },
280 { .phys_base = 0x48032000, .irq = INT_44XX_GPTIMER2 }, 254 { .phys_base = 0x48032000, .irq = OMAP44XX_IRQ_GPT2 },
281 { .phys_base = 0x48034000, .irq = INT_44XX_GPTIMER3 }, 255 { .phys_base = 0x48034000, .irq = OMAP44XX_IRQ_GPT3 },
282 { .phys_base = 0x48036000, .irq = INT_44XX_GPTIMER4 }, 256 { .phys_base = 0x48036000, .irq = OMAP44XX_IRQ_GPT4 },
283 { .phys_base = 0x40138000, .irq = INT_44XX_GPTIMER5 }, 257 { .phys_base = 0x40138000, .irq = OMAP44XX_IRQ_GPT5 },
284 { .phys_base = 0x4013a000, .irq = INT_44XX_GPTIMER6 }, 258 { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT6 },
285 { .phys_base = 0x4013a000, .irq = INT_44XX_GPTIMER7 }, 259 { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT7 },
286 { .phys_base = 0x4013e000, .irq = INT_44XX_GPTIMER8 }, 260 { .phys_base = 0x4013e000, .irq = OMAP44XX_IRQ_GPT8 },
287 { .phys_base = 0x4803e000, .irq = INT_44XX_GPTIMER9 }, 261 { .phys_base = 0x4803e000, .irq = OMAP44XX_IRQ_GPT9 },
288 { .phys_base = 0x48086000, .irq = INT_44XX_GPTIMER10 }, 262 { .phys_base = 0x48086000, .irq = OMAP44XX_IRQ_GPT10 },
289 { .phys_base = 0x48088000, .irq = INT_44XX_GPTIMER11 }, 263 { .phys_base = 0x48088000, .irq = OMAP44XX_IRQ_GPT11 },
290 { .phys_base = 0x4a320000, .irq = INT_44XX_GPTIMER12 }, 264 { .phys_base = 0x4a320000, .irq = OMAP44XX_IRQ_GPT12 },
291}; 265};
292static const char *omap4_dm_source_names[] __initdata = { 266static const char *omap4_dm_source_names[] __initdata = {
293 "sys_ck", 267 "sys_ck",
@@ -295,13 +269,14 @@ static const char *omap4_dm_source_names[] __initdata = {
295 NULL 269 NULL
296}; 270};
297static struct clk *omap4_dm_source_clocks[2]; 271static struct clk *omap4_dm_source_clocks[2];
298static const int dm_timer_count = ARRAY_SIZE(omap4_dm_timers); 272static const int omap4_dm_timer_count = ARRAY_SIZE(omap4_dm_timers);
299 273
300#else 274#else
301 275#define omap4_dm_timers NULL
302#error OMAP architecture not supported! 276#define omap4_dm_timer_count 0
303 277#define omap4_dm_source_names NULL
304#endif 278#define omap4_dm_source_clocks NULL
279#endif /* CONFIG_ARCH_OMAP4 */
305 280
306static struct omap_dm_timer *dm_timers; 281static struct omap_dm_timer *dm_timers;
307static const char **dm_source_names; 282static const char **dm_source_names;
@@ -450,8 +425,12 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer)
450 if (timer->enabled) 425 if (timer->enabled)
451 return; 426 return;
452 427
453 omap_dm_clk_enable(timer->fclk); 428#ifdef CONFIG_ARCH_OMAP2PLUS
454 omap_dm_clk_enable(timer->iclk); 429 if (cpu_class_is_omap2()) {
430 clk_enable(timer->fclk);
431 clk_enable(timer->iclk);
432 }
433#endif
455 434
456 timer->enabled = 1; 435 timer->enabled = 1;
457} 436}
@@ -462,8 +441,12 @@ void omap_dm_timer_disable(struct omap_dm_timer *timer)
462 if (!timer->enabled) 441 if (!timer->enabled)
463 return; 442 return;
464 443
465 omap_dm_clk_disable(timer->iclk); 444#ifdef CONFIG_ARCH_OMAP2PLUS
466 omap_dm_clk_disable(timer->fclk); 445 if (cpu_class_is_omap2()) {
446 clk_disable(timer->iclk);
447 clk_disable(timer->fclk);
448 }
449#endif
467 450
468 timer->enabled = 0; 451 timer->enabled = 0;
469} 452}
@@ -506,8 +489,7 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask)
506} 489}
507EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask); 490EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask);
508 491
509#elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 492#else
510 defined(CONFIG_ARCH_OMAP4)
511 493
512struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) 494struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
513{ 495{
@@ -551,6 +533,18 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
551 if (l & OMAP_TIMER_CTRL_ST) { 533 if (l & OMAP_TIMER_CTRL_ST) {
552 l &= ~0x1; 534 l &= ~0x1;
553 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); 535 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
536#ifdef CONFIG_ARCH_OMAP2PLUS
537 /* Readback to make sure write has completed */
538 omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
539 /*
540 * Wait for functional clock period x 3.5 to make sure that
541 * timer is stopped
542 */
543 udelay(3500000 / clk_get_rate(timer->fclk) + 1);
544 /* Ack possibly pending interrupt */
545 omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
546 OMAP_TIMER_INT_OVERFLOW);
547#endif
554 } 548 }
555} 549}
556EXPORT_SYMBOL_GPL(omap_dm_timer_stop); 550EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
@@ -751,17 +745,21 @@ int __init omap_dm_timer_init(void)
751 745
752 if (cpu_class_is_omap1()) { 746 if (cpu_class_is_omap1()) {
753 dm_timers = omap1_dm_timers; 747 dm_timers = omap1_dm_timers;
748 dm_timer_count = omap1_dm_timer_count;
754 map_size = SZ_2K; 749 map_size = SZ_2K;
755 } else if (cpu_is_omap24xx()) { 750 } else if (cpu_is_omap24xx()) {
756 dm_timers = omap2_dm_timers; 751 dm_timers = omap2_dm_timers;
752 dm_timer_count = omap2_dm_timer_count;
757 dm_source_names = omap2_dm_source_names; 753 dm_source_names = omap2_dm_source_names;
758 dm_source_clocks = omap2_dm_source_clocks; 754 dm_source_clocks = omap2_dm_source_clocks;
759 } else if (cpu_is_omap34xx()) { 755 } else if (cpu_is_omap34xx()) {
760 dm_timers = omap3_dm_timers; 756 dm_timers = omap3_dm_timers;
757 dm_timer_count = omap3_dm_timer_count;
761 dm_source_names = omap3_dm_source_names; 758 dm_source_names = omap3_dm_source_names;
762 dm_source_clocks = omap3_dm_source_clocks; 759 dm_source_clocks = omap3_dm_source_clocks;
763 } else if (cpu_is_omap44xx()) { 760 } else if (cpu_is_omap44xx()) {
764 dm_timers = omap4_dm_timers; 761 dm_timers = omap4_dm_timers;
762 dm_timer_count = omap4_dm_timer_count;
765 dm_source_names = omap4_dm_source_names; 763 dm_source_names = omap4_dm_source_names;
766 dm_source_clocks = omap4_dm_source_clocks; 764 dm_source_clocks = omap4_dm_source_clocks;
767 } 765 }
@@ -780,8 +778,7 @@ int __init omap_dm_timer_init(void)
780 timer->io_base = ioremap(timer->phys_base, map_size); 778 timer->io_base = ioremap(timer->phys_base, map_size);
781 BUG_ON(!timer->io_base); 779 BUG_ON(!timer->io_base);
782 780
783#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 781#ifdef CONFIG_ARCH_OMAP2PLUS
784 defined(CONFIG_ARCH_OMAP4)
785 if (cpu_class_is_omap2()) { 782 if (cpu_class_is_omap2()) {
786 char clk_name[16]; 783 char clk_name[16];
787 sprintf(clk_name, "gpt%d_ick", i + 1); 784 sprintf(clk_name, "gpt%d_ick", i + 1);
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 04846811d0aa..337199ed3479 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -177,13 +177,11 @@ struct gpio_bank {
177 u16 irq; 177 u16 irq;
178 u16 virtual_irq_start; 178 u16 virtual_irq_start;
179 int method; 179 int method;
180#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 180#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
181 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
182 u32 suspend_wakeup; 181 u32 suspend_wakeup;
183 u32 saved_wakeup; 182 u32 saved_wakeup;
184#endif 183#endif
185#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 184#ifdef CONFIG_ARCH_OMAP2PLUS
186 defined(CONFIG_ARCH_OMAP4)
187 u32 non_wakeup_gpios; 185 u32 non_wakeup_gpios;
188 u32 enabled_non_wakeup_gpios; 186 u32 enabled_non_wakeup_gpios;
189 187
@@ -192,6 +190,7 @@ struct gpio_bank {
192 u32 saved_risingdetect; 190 u32 saved_risingdetect;
193#endif 191#endif
194 u32 level_mask; 192 u32 level_mask;
193 u32 toggle_mask;
195 spinlock_t lock; 194 spinlock_t lock;
196 struct gpio_chip chip; 195 struct gpio_chip chip;
197 struct clk *dbck; 196 struct clk *dbck;
@@ -203,6 +202,7 @@ struct gpio_bank {
203#define METHOD_GPIO_1610 2 202#define METHOD_GPIO_1610 2
204#define METHOD_GPIO_7XX 3 203#define METHOD_GPIO_7XX 3
205#define METHOD_GPIO_24XX 5 204#define METHOD_GPIO_24XX 5
205#define METHOD_GPIO_44XX 6
206 206
207#ifdef CONFIG_ARCH_OMAP16XX 207#ifdef CONFIG_ARCH_OMAP16XX
208static struct gpio_bank gpio_bank_1610[5] = { 208static struct gpio_bank gpio_bank_1610[5] = {
@@ -247,7 +247,7 @@ static struct gpio_bank gpio_bank_7xx[7] = {
247}; 247};
248#endif 248#endif
249 249
250#ifdef CONFIG_ARCH_OMAP24XX 250#ifdef CONFIG_ARCH_OMAP2
251 251
252static struct gpio_bank gpio_bank_242x[4] = { 252static struct gpio_bank gpio_bank_242x[4] = {
253 { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, 253 { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
@@ -275,7 +275,7 @@ static struct gpio_bank gpio_bank_243x[5] = {
275 275
276#endif 276#endif
277 277
278#ifdef CONFIG_ARCH_OMAP34XX 278#ifdef CONFIG_ARCH_OMAP3
279static struct gpio_bank gpio_bank_34xx[6] = { 279static struct gpio_bank gpio_bank_34xx[6] = {
280 { OMAP34XX_GPIO1_BASE, NULL, INT_34XX_GPIO_BANK1, IH_GPIO_BASE, 280 { OMAP34XX_GPIO1_BASE, NULL, INT_34XX_GPIO_BANK1, IH_GPIO_BASE,
281 METHOD_GPIO_24XX }, 281 METHOD_GPIO_24XX },
@@ -312,18 +312,18 @@ static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
312 312
313#ifdef CONFIG_ARCH_OMAP4 313#ifdef CONFIG_ARCH_OMAP4
314static struct gpio_bank gpio_bank_44xx[6] = { 314static struct gpio_bank gpio_bank_44xx[6] = {
315 { OMAP44XX_GPIO1_BASE, NULL, INT_44XX_GPIO_BANK1, IH_GPIO_BASE, 315 { OMAP44XX_GPIO1_BASE, NULL, OMAP44XX_IRQ_GPIO1, IH_GPIO_BASE,
316 METHOD_GPIO_24XX }, 316 METHOD_GPIO_44XX },
317 { OMAP44XX_GPIO2_BASE, NULL, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32, 317 { OMAP44XX_GPIO2_BASE, NULL, OMAP44XX_IRQ_GPIO2, IH_GPIO_BASE + 32,
318 METHOD_GPIO_24XX }, 318 METHOD_GPIO_44XX },
319 { OMAP44XX_GPIO3_BASE, NULL, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64, 319 { OMAP44XX_GPIO3_BASE, NULL, OMAP44XX_IRQ_GPIO3, IH_GPIO_BASE + 64,
320 METHOD_GPIO_24XX }, 320 METHOD_GPIO_44XX },
321 { OMAP44XX_GPIO4_BASE, NULL, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96, 321 { OMAP44XX_GPIO4_BASE, NULL, OMAP44XX_IRQ_GPIO4, IH_GPIO_BASE + 96,
322 METHOD_GPIO_24XX }, 322 METHOD_GPIO_44XX },
323 { OMAP44XX_GPIO5_BASE, NULL, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128, 323 { OMAP44XX_GPIO5_BASE, NULL, OMAP44XX_IRQ_GPIO5, IH_GPIO_BASE + 128,
324 METHOD_GPIO_24XX }, 324 METHOD_GPIO_44XX },
325 { OMAP44XX_GPIO6_BASE, NULL, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160, 325 { OMAP44XX_GPIO6_BASE, NULL, OMAP44XX_IRQ_GPIO6, IH_GPIO_BASE + 160,
326 METHOD_GPIO_24XX }, 326 METHOD_GPIO_44XX },
327}; 327};
328 328
329#endif 329#endif
@@ -425,13 +425,13 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
425 reg += OMAP7XX_GPIO_DIR_CONTROL; 425 reg += OMAP7XX_GPIO_DIR_CONTROL;
426 break; 426 break;
427#endif 427#endif
428#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 428#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
429 case METHOD_GPIO_24XX: 429 case METHOD_GPIO_24XX:
430 reg += OMAP24XX_GPIO_OE; 430 reg += OMAP24XX_GPIO_OE;
431 break; 431 break;
432#endif 432#endif
433#if defined(CONFIG_ARCH_OMAP4) 433#if defined(CONFIG_ARCH_OMAP4)
434 case METHOD_GPIO_24XX: 434 case METHOD_GPIO_44XX:
435 reg += OMAP4_GPIO_OE; 435 reg += OMAP4_GPIO_OE;
436 break; 436 break;
437#endif 437#endif
@@ -492,7 +492,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
492 l &= ~(1 << gpio); 492 l &= ~(1 << gpio);
493 break; 493 break;
494#endif 494#endif
495#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 495#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
496 case METHOD_GPIO_24XX: 496 case METHOD_GPIO_24XX:
497 if (enable) 497 if (enable)
498 reg += OMAP24XX_GPIO_SETDATAOUT; 498 reg += OMAP24XX_GPIO_SETDATAOUT;
@@ -502,7 +502,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
502 break; 502 break;
503#endif 503#endif
504#ifdef CONFIG_ARCH_OMAP4 504#ifdef CONFIG_ARCH_OMAP4
505 case METHOD_GPIO_24XX: 505 case METHOD_GPIO_44XX:
506 if (enable) 506 if (enable)
507 reg += OMAP4_GPIO_SETDATAOUT; 507 reg += OMAP4_GPIO_SETDATAOUT;
508 else 508 else
@@ -545,13 +545,13 @@ static int _get_gpio_datain(struct gpio_bank *bank, int gpio)
545 reg += OMAP7XX_GPIO_DATA_INPUT; 545 reg += OMAP7XX_GPIO_DATA_INPUT;
546 break; 546 break;
547#endif 547#endif
548#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 548#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
549 case METHOD_GPIO_24XX: 549 case METHOD_GPIO_24XX:
550 reg += OMAP24XX_GPIO_DATAIN; 550 reg += OMAP24XX_GPIO_DATAIN;
551 break; 551 break;
552#endif 552#endif
553#ifdef CONFIG_ARCH_OMAP4 553#ifdef CONFIG_ARCH_OMAP4
554 case METHOD_GPIO_24XX: 554 case METHOD_GPIO_44XX:
555 reg += OMAP4_GPIO_DATAIN; 555 reg += OMAP4_GPIO_DATAIN;
556 break; 556 break;
557#endif 557#endif
@@ -591,9 +591,9 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio)
591 reg += OMAP7XX_GPIO_DATA_OUTPUT; 591 reg += OMAP7XX_GPIO_DATA_OUTPUT;
592 break; 592 break;
593#endif 593#endif
594#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 594#ifdef CONFIG_ARCH_OMAP2PLUS
595 defined(CONFIG_ARCH_OMAP4)
596 case METHOD_GPIO_24XX: 595 case METHOD_GPIO_24XX:
596 case METHOD_GPIO_44XX:
597 reg += OMAP24XX_GPIO_DATAOUT; 597 reg += OMAP24XX_GPIO_DATAOUT;
598 break; 598 break;
599#endif 599#endif
@@ -624,11 +624,12 @@ void omap_set_gpio_debounce(int gpio, int enable)
624 624
625 bank = get_gpio_bank(gpio); 625 bank = get_gpio_bank(gpio);
626 reg = bank->base; 626 reg = bank->base;
627#ifdef CONFIG_ARCH_OMAP4 627
628 reg += OMAP4_GPIO_DEBOUNCENABLE; 628 if (cpu_is_omap44xx())
629#else 629 reg += OMAP4_GPIO_DEBOUNCENABLE;
630 reg += OMAP24XX_GPIO_DEBOUNCE_EN; 630 else
631#endif 631 reg += OMAP24XX_GPIO_DEBOUNCE_EN;
632
632 if (!(bank->mod_usage & l)) { 633 if (!(bank->mod_usage & l)) {
633 printk(KERN_ERR "GPIO %d not requested\n", gpio); 634 printk(KERN_ERR "GPIO %d not requested\n", gpio);
634 return; 635 return;
@@ -674,17 +675,17 @@ void omap_set_gpio_debounce_time(int gpio, int enc_time)
674 } 675 }
675 676
676 enc_time &= 0xff; 677 enc_time &= 0xff;
677#ifdef CONFIG_ARCH_OMAP4 678
678 reg += OMAP4_GPIO_DEBOUNCINGTIME; 679 if (cpu_is_omap44xx())
679#else 680 reg += OMAP4_GPIO_DEBOUNCINGTIME;
680 reg += OMAP24XX_GPIO_DEBOUNCE_VAL; 681 else
681#endif 682 reg += OMAP24XX_GPIO_DEBOUNCE_VAL;
683
682 __raw_writel(enc_time, reg); 684 __raw_writel(enc_time, reg);
683} 685}
684EXPORT_SYMBOL(omap_set_gpio_debounce_time); 686EXPORT_SYMBOL(omap_set_gpio_debounce_time);
685 687
686#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 688#ifdef CONFIG_ARCH_OMAP2PLUS
687 defined(CONFIG_ARCH_OMAP4)
688static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, 689static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
689 int trigger) 690 int trigger)
690{ 691{
@@ -749,6 +750,44 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
749} 750}
750#endif 751#endif
751 752
753#ifdef CONFIG_ARCH_OMAP1
754/*
755 * This only applies to chips that can't do both rising and falling edge
756 * detection at once. For all other chips, this function is a noop.
757 */
758static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio)
759{
760 void __iomem *reg = bank->base;
761 u32 l = 0;
762
763 switch (bank->method) {
764 case METHOD_MPUIO:
765 reg += OMAP_MPUIO_GPIO_INT_EDGE;
766 break;
767#ifdef CONFIG_ARCH_OMAP15XX
768 case METHOD_GPIO_1510:
769 reg += OMAP1510_GPIO_INT_CONTROL;
770 break;
771#endif
772#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
773 case METHOD_GPIO_7XX:
774 reg += OMAP7XX_GPIO_INT_CONTROL;
775 break;
776#endif
777 default:
778 return;
779 }
780
781 l = __raw_readl(reg);
782 if ((l >> gpio) & 1)
783 l &= ~(1 << gpio);
784 else
785 l |= 1 << gpio;
786
787 __raw_writel(l, reg);
788}
789#endif
790
752static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger) 791static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
753{ 792{
754 void __iomem *reg = bank->base; 793 void __iomem *reg = bank->base;
@@ -759,6 +798,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
759 case METHOD_MPUIO: 798 case METHOD_MPUIO:
760 reg += OMAP_MPUIO_GPIO_INT_EDGE; 799 reg += OMAP_MPUIO_GPIO_INT_EDGE;
761 l = __raw_readl(reg); 800 l = __raw_readl(reg);
801 if (trigger & IRQ_TYPE_EDGE_BOTH)
802 bank->toggle_mask |= 1 << gpio;
762 if (trigger & IRQ_TYPE_EDGE_RISING) 803 if (trigger & IRQ_TYPE_EDGE_RISING)
763 l |= 1 << gpio; 804 l |= 1 << gpio;
764 else if (trigger & IRQ_TYPE_EDGE_FALLING) 805 else if (trigger & IRQ_TYPE_EDGE_FALLING)
@@ -771,6 +812,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
771 case METHOD_GPIO_1510: 812 case METHOD_GPIO_1510:
772 reg += OMAP1510_GPIO_INT_CONTROL; 813 reg += OMAP1510_GPIO_INT_CONTROL;
773 l = __raw_readl(reg); 814 l = __raw_readl(reg);
815 if (trigger & IRQ_TYPE_EDGE_BOTH)
816 bank->toggle_mask |= 1 << gpio;
774 if (trigger & IRQ_TYPE_EDGE_RISING) 817 if (trigger & IRQ_TYPE_EDGE_RISING)
775 l |= 1 << gpio; 818 l |= 1 << gpio;
776 else if (trigger & IRQ_TYPE_EDGE_FALLING) 819 else if (trigger & IRQ_TYPE_EDGE_FALLING)
@@ -803,6 +846,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
803 case METHOD_GPIO_7XX: 846 case METHOD_GPIO_7XX:
804 reg += OMAP7XX_GPIO_INT_CONTROL; 847 reg += OMAP7XX_GPIO_INT_CONTROL;
805 l = __raw_readl(reg); 848 l = __raw_readl(reg);
849 if (trigger & IRQ_TYPE_EDGE_BOTH)
850 bank->toggle_mask |= 1 << gpio;
806 if (trigger & IRQ_TYPE_EDGE_RISING) 851 if (trigger & IRQ_TYPE_EDGE_RISING)
807 l |= 1 << gpio; 852 l |= 1 << gpio;
808 else if (trigger & IRQ_TYPE_EDGE_FALLING) 853 else if (trigger & IRQ_TYPE_EDGE_FALLING)
@@ -811,9 +856,9 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
811 goto bad; 856 goto bad;
812 break; 857 break;
813#endif 858#endif
814#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 859#ifdef CONFIG_ARCH_OMAP2PLUS
815 defined(CONFIG_ARCH_OMAP4)
816 case METHOD_GPIO_24XX: 860 case METHOD_GPIO_24XX:
861 case METHOD_GPIO_44XX:
817 set_24xx_gpio_triggering(bank, gpio, trigger); 862 set_24xx_gpio_triggering(bank, gpio, trigger);
818 break; 863 break;
819#endif 864#endif
@@ -892,13 +937,13 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
892 reg += OMAP7XX_GPIO_INT_STATUS; 937 reg += OMAP7XX_GPIO_INT_STATUS;
893 break; 938 break;
894#endif 939#endif
895#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 940#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
896 case METHOD_GPIO_24XX: 941 case METHOD_GPIO_24XX:
897 reg += OMAP24XX_GPIO_IRQSTATUS1; 942 reg += OMAP24XX_GPIO_IRQSTATUS1;
898 break; 943 break;
899#endif 944#endif
900#if defined(CONFIG_ARCH_OMAP4) 945#if defined(CONFIG_ARCH_OMAP4)
901 case METHOD_GPIO_24XX: 946 case METHOD_GPIO_44XX:
902 reg += OMAP4_GPIO_IRQSTATUS0; 947 reg += OMAP4_GPIO_IRQSTATUS0;
903 break; 948 break;
904#endif 949#endif
@@ -909,12 +954,11 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
909 __raw_writel(gpio_mask, reg); 954 __raw_writel(gpio_mask, reg);
910 955
911 /* Workaround for clearing DSP GPIO interrupts to allow retention */ 956 /* Workaround for clearing DSP GPIO interrupts to allow retention */
912#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 957 if (cpu_is_omap24xx() || cpu_is_omap34xx())
913 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2; 958 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2;
914#endif 959 else if (cpu_is_omap44xx())
915#if defined(CONFIG_ARCH_OMAP4) 960 reg = bank->base + OMAP4_GPIO_IRQSTATUS1;
916 reg = bank->base + OMAP4_GPIO_IRQSTATUS1; 961
917#endif
918 if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) { 962 if (cpu_is_omap24xx() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
919 __raw_writel(gpio_mask, reg); 963 __raw_writel(gpio_mask, reg);
920 964
@@ -963,14 +1007,14 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
963 inv = 1; 1007 inv = 1;
964 break; 1008 break;
965#endif 1009#endif
966#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1010#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
967 case METHOD_GPIO_24XX: 1011 case METHOD_GPIO_24XX:
968 reg += OMAP24XX_GPIO_IRQENABLE1; 1012 reg += OMAP24XX_GPIO_IRQENABLE1;
969 mask = 0xffffffff; 1013 mask = 0xffffffff;
970 break; 1014 break;
971#endif 1015#endif
972#if defined(CONFIG_ARCH_OMAP4) 1016#if defined(CONFIG_ARCH_OMAP4)
973 case METHOD_GPIO_24XX: 1017 case METHOD_GPIO_44XX:
974 reg += OMAP4_GPIO_IRQSTATUSSET0; 1018 reg += OMAP4_GPIO_IRQSTATUSSET0;
975 mask = 0xffffffff; 1019 mask = 0xffffffff;
976 break; 1020 break;
@@ -1032,7 +1076,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
1032 l |= gpio_mask; 1076 l |= gpio_mask;
1033 break; 1077 break;
1034#endif 1078#endif
1035#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1079#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
1036 case METHOD_GPIO_24XX: 1080 case METHOD_GPIO_24XX:
1037 if (enable) 1081 if (enable)
1038 reg += OMAP24XX_GPIO_SETIRQENABLE1; 1082 reg += OMAP24XX_GPIO_SETIRQENABLE1;
@@ -1042,7 +1086,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
1042 break; 1086 break;
1043#endif 1087#endif
1044#ifdef CONFIG_ARCH_OMAP4 1088#ifdef CONFIG_ARCH_OMAP4
1045 case METHOD_GPIO_24XX: 1089 case METHOD_GPIO_44XX:
1046 if (enable) 1090 if (enable)
1047 reg += OMAP4_GPIO_IRQSTATUSSET0; 1091 reg += OMAP4_GPIO_IRQSTATUSSET0;
1048 else 1092 else
@@ -1072,7 +1116,7 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena
1072 */ 1116 */
1073static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) 1117static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
1074{ 1118{
1075 unsigned long flags; 1119 unsigned long uninitialized_var(flags);
1076 1120
1077 switch (bank->method) { 1121 switch (bank->method) {
1078#ifdef CONFIG_ARCH_OMAP16XX 1122#ifdef CONFIG_ARCH_OMAP16XX
@@ -1086,9 +1130,9 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
1086 spin_unlock_irqrestore(&bank->lock, flags); 1130 spin_unlock_irqrestore(&bank->lock, flags);
1087 return 0; 1131 return 0;
1088#endif 1132#endif
1089#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1133#ifdef CONFIG_ARCH_OMAP2PLUS
1090 defined(CONFIG_ARCH_OMAP4)
1091 case METHOD_GPIO_24XX: 1134 case METHOD_GPIO_24XX:
1135 case METHOD_GPIO_44XX:
1092 if (bank->non_wakeup_gpios & (1 << gpio)) { 1136 if (bank->non_wakeup_gpios & (1 << gpio)) {
1093 printk(KERN_ERR "Unable to modify wakeup on " 1137 printk(KERN_ERR "Unable to modify wakeup on "
1094 "non-wakeup GPIO%d\n", 1138 "non-wakeup GPIO%d\n",
@@ -1182,9 +1226,9 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
1182 __raw_writel(1 << offset, reg); 1226 __raw_writel(1 << offset, reg);
1183 } 1227 }
1184#endif 1228#endif
1185#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1229#ifdef CONFIG_ARCH_OMAP2PLUS
1186 defined(CONFIG_ARCH_OMAP4) 1230 if ((bank->method == METHOD_GPIO_24XX) ||
1187 if (bank->method == METHOD_GPIO_24XX) { 1231 (bank->method == METHOD_GPIO_44XX)) {
1188 /* Disable wake-up during idle for dynamic tick */ 1232 /* Disable wake-up during idle for dynamic tick */
1189 void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1233 void __iomem *reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
1190 __raw_writel(1 << offset, reg); 1234 __raw_writel(1 << offset, reg);
@@ -1217,7 +1261,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1217{ 1261{
1218 void __iomem *isr_reg = NULL; 1262 void __iomem *isr_reg = NULL;
1219 u32 isr; 1263 u32 isr;
1220 unsigned int gpio_irq; 1264 unsigned int gpio_irq, gpio_index;
1221 struct gpio_bank *bank; 1265 struct gpio_bank *bank;
1222 u32 retrigger = 0; 1266 u32 retrigger = 0;
1223 int unmasked = 0; 1267 int unmasked = 0;
@@ -1241,12 +1285,12 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1241 if (bank->method == METHOD_GPIO_7XX) 1285 if (bank->method == METHOD_GPIO_7XX)
1242 isr_reg = bank->base + OMAP7XX_GPIO_INT_STATUS; 1286 isr_reg = bank->base + OMAP7XX_GPIO_INT_STATUS;
1243#endif 1287#endif
1244#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1288#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
1245 if (bank->method == METHOD_GPIO_24XX) 1289 if (bank->method == METHOD_GPIO_24XX)
1246 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1; 1290 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1;
1247#endif 1291#endif
1248#if defined(CONFIG_ARCH_OMAP4) 1292#if defined(CONFIG_ARCH_OMAP4)
1249 if (bank->method == METHOD_GPIO_24XX) 1293 if (bank->method == METHOD_GPIO_44XX)
1250 isr_reg = bank->base + OMAP4_GPIO_IRQSTATUS0; 1294 isr_reg = bank->base + OMAP4_GPIO_IRQSTATUS0;
1251#endif 1295#endif
1252 while(1) { 1296 while(1) {
@@ -1284,9 +1328,23 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1284 1328
1285 gpio_irq = bank->virtual_irq_start; 1329 gpio_irq = bank->virtual_irq_start;
1286 for (; isr != 0; isr >>= 1, gpio_irq++) { 1330 for (; isr != 0; isr >>= 1, gpio_irq++) {
1331 gpio_index = get_gpio_index(irq_to_gpio(gpio_irq));
1332
1287 if (!(isr & 1)) 1333 if (!(isr & 1))
1288 continue; 1334 continue;
1289 1335
1336#ifdef CONFIG_ARCH_OMAP1
1337 /*
1338 * Some chips can't respond to both rising and falling
1339 * at the same time. If this irq was requested with
1340 * both flags, we need to flip the ICR data for the IRQ
1341 * to respond to the IRQ for the opposite direction.
1342 * This will be indicated in the bank toggle_mask.
1343 */
1344 if (bank->toggle_mask & (1 << gpio_index))
1345 _toggle_gpio_edge_triggering(bank, gpio_index);
1346#endif
1347
1290 generic_handle_irq(gpio_irq); 1348 generic_handle_irq(gpio_irq);
1291 } 1349 }
1292 } 1350 }
@@ -1512,6 +1570,7 @@ static int gpio_is_input(struct gpio_bank *bank, int mask)
1512 reg += OMAP7XX_GPIO_DIR_CONTROL; 1570 reg += OMAP7XX_GPIO_DIR_CONTROL;
1513 break; 1571 break;
1514 case METHOD_GPIO_24XX: 1572 case METHOD_GPIO_24XX:
1573 case METHOD_GPIO_44XX:
1515 reg += OMAP24XX_GPIO_OE; 1574 reg += OMAP24XX_GPIO_OE;
1516 break; 1575 break;
1517 } 1576 }
@@ -1571,7 +1630,7 @@ static int gpio_2irq(struct gpio_chip *chip, unsigned offset)
1571/*---------------------------------------------------------------------*/ 1630/*---------------------------------------------------------------------*/
1572 1631
1573static int initialized; 1632static int initialized;
1574#if !(defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)) 1633#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2)
1575static struct clk * gpio_ick; 1634static struct clk * gpio_ick;
1576#endif 1635#endif
1577 1636
@@ -1697,7 +1756,7 @@ static int __init _omap_gpio_init(void)
1697 bank_size = SZ_2K; 1756 bank_size = SZ_2K;
1698 } 1757 }
1699#endif 1758#endif
1700#ifdef CONFIG_ARCH_OMAP24XX 1759#ifdef CONFIG_ARCH_OMAP2
1701 if (cpu_is_omap242x()) { 1760 if (cpu_is_omap242x()) {
1702 gpio_bank_count = 4; 1761 gpio_bank_count = 4;
1703 gpio_bank = gpio_bank_242x; 1762 gpio_bank = gpio_bank_242x;
@@ -1707,7 +1766,7 @@ static int __init _omap_gpio_init(void)
1707 gpio_bank = gpio_bank_243x; 1766 gpio_bank = gpio_bank_243x;
1708 } 1767 }
1709#endif 1768#endif
1710#ifdef CONFIG_ARCH_OMAP34XX 1769#ifdef CONFIG_ARCH_OMAP3
1711 if (cpu_is_omap34xx()) { 1770 if (cpu_is_omap34xx()) {
1712 gpio_bank_count = OMAP34XX_NR_GPIOS; 1771 gpio_bank_count = OMAP34XX_NR_GPIOS;
1713 gpio_bank = gpio_bank_34xx; 1772 gpio_bank = gpio_bank_34xx;
@@ -1750,30 +1809,42 @@ static int __init _omap_gpio_init(void)
1750 gpio_count = 32; /* 7xx has 32-bit GPIOs */ 1809 gpio_count = 32; /* 7xx has 32-bit GPIOs */
1751 } 1810 }
1752 1811
1753#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1812#ifdef CONFIG_ARCH_OMAP2PLUS
1754 defined(CONFIG_ARCH_OMAP4) 1813 if ((bank->method == METHOD_GPIO_24XX) ||
1755 if (bank->method == METHOD_GPIO_24XX) { 1814 (bank->method == METHOD_GPIO_44XX)) {
1756 static const u32 non_wakeup_gpios[] = { 1815 static const u32 non_wakeup_gpios[] = {
1757 0xe203ffc0, 0x08700040 1816 0xe203ffc0, 0x08700040
1758 }; 1817 };
1759 if (cpu_is_omap44xx()) { 1818
1760 __raw_writel(0xffffffff, bank->base + 1819 if (cpu_is_omap44xx()) {
1820 __raw_writel(0xffffffff, bank->base +
1761 OMAP4_GPIO_IRQSTATUSCLR0); 1821 OMAP4_GPIO_IRQSTATUSCLR0);
1762 __raw_writew(0x0015, bank->base + 1822 __raw_writew(0x0015, bank->base +
1763 OMAP4_GPIO_SYSCONFIG); 1823 OMAP4_GPIO_SYSCONFIG);
1764 __raw_writel(0x00000000, bank->base + 1824 __raw_writel(0x00000000, bank->base +
1765 OMAP4_GPIO_DEBOUNCENABLE); 1825 OMAP4_GPIO_DEBOUNCENABLE);
1766 /* Initialize interface clock ungated, module enabled */ 1826 /*
1767 __raw_writel(0, bank->base + OMAP4_GPIO_CTRL); 1827 * Initialize interface clock ungated,
1768 } else { 1828 * module enabled
1769 __raw_writel(0x00000000, bank->base + OMAP24XX_GPIO_IRQENABLE1); 1829 */
1770 __raw_writel(0xffffffff, bank->base + OMAP24XX_GPIO_IRQSTATUS1); 1830 __raw_writel(0, bank->base + OMAP4_GPIO_CTRL);
1771 __raw_writew(0x0015, bank->base + OMAP24XX_GPIO_SYSCONFIG); 1831 } else {
1772 __raw_writel(0x00000000, bank->base + OMAP24XX_GPIO_DEBOUNCE_EN); 1832 __raw_writel(0x00000000, bank->base +
1773 1833 OMAP24XX_GPIO_IRQENABLE1);
1774 /* Initialize interface clock ungated, module enabled */ 1834 __raw_writel(0xffffffff, bank->base +
1775 __raw_writel(0, bank->base + OMAP24XX_GPIO_CTRL); 1835 OMAP24XX_GPIO_IRQSTATUS1);
1776 } 1836 __raw_writew(0x0015, bank->base +
1837 OMAP24XX_GPIO_SYSCONFIG);
1838 __raw_writel(0x00000000, bank->base +
1839 OMAP24XX_GPIO_DEBOUNCE_EN);
1840
1841 /*
1842 * Initialize interface clock ungated,
1843 * module enabled
1844 */
1845 __raw_writel(0, bank->base +
1846 OMAP24XX_GPIO_CTRL);
1847 }
1777 if (i < ARRAY_SIZE(non_wakeup_gpios)) 1848 if (i < ARRAY_SIZE(non_wakeup_gpios))
1778 bank->non_wakeup_gpios = non_wakeup_gpios[i]; 1849 bank->non_wakeup_gpios = non_wakeup_gpios[i];
1779 gpio_count = 32; 1850 gpio_count = 32;
@@ -1844,8 +1915,7 @@ static int __init _omap_gpio_init(void)
1844 return 0; 1915 return 0;
1845} 1916}
1846 1917
1847#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 1918#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
1848 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
1849static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg) 1919static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
1850{ 1920{
1851 int i; 1921 int i;
@@ -1868,7 +1938,7 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
1868 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; 1938 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1869 break; 1939 break;
1870#endif 1940#endif
1871#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1941#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
1872 case METHOD_GPIO_24XX: 1942 case METHOD_GPIO_24XX:
1873 wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN; 1943 wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN;
1874 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1944 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
@@ -1876,7 +1946,7 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
1876 break; 1946 break;
1877#endif 1947#endif
1878#ifdef CONFIG_ARCH_OMAP4 1948#ifdef CONFIG_ARCH_OMAP4
1879 case METHOD_GPIO_24XX: 1949 case METHOD_GPIO_44XX:
1880 wake_status = bank->base + OMAP4_GPIO_IRQWAKEN0; 1950 wake_status = bank->base + OMAP4_GPIO_IRQWAKEN0;
1881 wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0; 1951 wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0;
1882 wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0; 1952 wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0;
@@ -1916,14 +1986,14 @@ static int omap_gpio_resume(struct sys_device *dev)
1916 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; 1986 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1917 break; 1987 break;
1918#endif 1988#endif
1919#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1989#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
1920 case METHOD_GPIO_24XX: 1990 case METHOD_GPIO_24XX:
1921 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1991 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
1922 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; 1992 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
1923 break; 1993 break;
1924#endif 1994#endif
1925#ifdef CONFIG_ARCH_OMAP4 1995#ifdef CONFIG_ARCH_OMAP4
1926 case METHOD_GPIO_24XX: 1996 case METHOD_GPIO_44XX:
1927 wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0; 1997 wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0;
1928 wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0; 1998 wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0;
1929 break; 1999 break;
@@ -1954,8 +2024,7 @@ static struct sys_device omap_gpio_device = {
1954 2024
1955#endif 2025#endif
1956 2026
1957#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 2027#ifdef CONFIG_ARCH_OMAP2PLUS
1958 defined(CONFIG_ARCH_OMAP4)
1959 2028
1960static int workaround_enabled; 2029static int workaround_enabled;
1961 2030
@@ -1971,29 +2040,42 @@ void omap2_gpio_prepare_for_retention(void)
1971 2040
1972 if (!(bank->enabled_non_wakeup_gpios)) 2041 if (!(bank->enabled_non_wakeup_gpios))
1973 continue; 2042 continue;
1974#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2043
1975 bank->saved_datain = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN); 2044 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1976 l1 = __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT); 2045 bank->saved_datain = __raw_readl(bank->base +
1977 l2 = __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT); 2046 OMAP24XX_GPIO_DATAIN);
1978#endif 2047 l1 = __raw_readl(bank->base +
1979#ifdef CONFIG_ARCH_OMAP4 2048 OMAP24XX_GPIO_FALLINGDETECT);
1980 bank->saved_datain = __raw_readl(bank->base + 2049 l2 = __raw_readl(bank->base +
1981 OMAP4_GPIO_DATAIN); 2050 OMAP24XX_GPIO_RISINGDETECT);
1982 l1 = __raw_readl(bank->base + OMAP4_GPIO_FALLINGDETECT); 2051 }
1983 l2 = __raw_readl(bank->base + OMAP4_GPIO_RISINGDETECT); 2052
1984#endif 2053 if (cpu_is_omap44xx()) {
2054 bank->saved_datain = __raw_readl(bank->base +
2055 OMAP4_GPIO_DATAIN);
2056 l1 = __raw_readl(bank->base +
2057 OMAP4_GPIO_FALLINGDETECT);
2058 l2 = __raw_readl(bank->base +
2059 OMAP4_GPIO_RISINGDETECT);
2060 }
2061
1985 bank->saved_fallingdetect = l1; 2062 bank->saved_fallingdetect = l1;
1986 bank->saved_risingdetect = l2; 2063 bank->saved_risingdetect = l2;
1987 l1 &= ~bank->enabled_non_wakeup_gpios; 2064 l1 &= ~bank->enabled_non_wakeup_gpios;
1988 l2 &= ~bank->enabled_non_wakeup_gpios; 2065 l2 &= ~bank->enabled_non_wakeup_gpios;
1989#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2066
1990 __raw_writel(l1, bank->base + OMAP24XX_GPIO_FALLINGDETECT); 2067 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1991 __raw_writel(l2, bank->base + OMAP24XX_GPIO_RISINGDETECT); 2068 __raw_writel(l1, bank->base +
1992#endif 2069 OMAP24XX_GPIO_FALLINGDETECT);
1993#ifdef CONFIG_ARCH_OMAP4 2070 __raw_writel(l2, bank->base +
1994 __raw_writel(l1, bank->base + OMAP4_GPIO_FALLINGDETECT); 2071 OMAP24XX_GPIO_RISINGDETECT);
1995 __raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT); 2072 }
1996#endif 2073
2074 if (cpu_is_omap44xx()) {
2075 __raw_writel(l1, bank->base + OMAP4_GPIO_FALLINGDETECT);
2076 __raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT);
2077 }
2078
1997 c++; 2079 c++;
1998 } 2080 }
1999 if (!c) { 2081 if (!c) {
@@ -2015,20 +2097,23 @@ void omap2_gpio_resume_after_retention(void)
2015 2097
2016 if (!(bank->enabled_non_wakeup_gpios)) 2098 if (!(bank->enabled_non_wakeup_gpios))
2017 continue; 2099 continue;
2018#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2100
2019 __raw_writel(bank->saved_fallingdetect, 2101 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
2102 __raw_writel(bank->saved_fallingdetect,
2020 bank->base + OMAP24XX_GPIO_FALLINGDETECT); 2103 bank->base + OMAP24XX_GPIO_FALLINGDETECT);
2021 __raw_writel(bank->saved_risingdetect, 2104 __raw_writel(bank->saved_risingdetect,
2022 bank->base + OMAP24XX_GPIO_RISINGDETECT); 2105 bank->base + OMAP24XX_GPIO_RISINGDETECT);
2023 l = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN); 2106 l = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
2024#endif 2107 }
2025#ifdef CONFIG_ARCH_OMAP4 2108
2026 __raw_writel(bank->saved_fallingdetect, 2109 if (cpu_is_omap44xx()) {
2110 __raw_writel(bank->saved_fallingdetect,
2027 bank->base + OMAP4_GPIO_FALLINGDETECT); 2111 bank->base + OMAP4_GPIO_FALLINGDETECT);
2028 __raw_writel(bank->saved_risingdetect, 2112 __raw_writel(bank->saved_risingdetect,
2029 bank->base + OMAP4_GPIO_RISINGDETECT); 2113 bank->base + OMAP4_GPIO_RISINGDETECT);
2030 l = __raw_readl(bank->base + OMAP4_GPIO_DATAIN); 2114 l = __raw_readl(bank->base + OMAP4_GPIO_DATAIN);
2031#endif 2115 }
2116
2032 /* Check if any of the non-wakeup interrupt GPIOs have changed 2117 /* Check if any of the non-wakeup interrupt GPIOs have changed
2033 * state. If so, generate an IRQ by software. This is 2118 * state. If so, generate an IRQ by software. This is
2034 * horribly racy, but it's the best we can do to work around 2119 * horribly racy, but it's the best we can do to work around
@@ -2054,30 +2139,36 @@ void omap2_gpio_resume_after_retention(void)
2054 2139
2055 if (gen) { 2140 if (gen) {
2056 u32 old0, old1; 2141 u32 old0, old1;
2057#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2142
2058 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0); 2143 if (cpu_is_omap24xx() || cpu_is_omap44xx()) {
2059 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); 2144 old0 = __raw_readl(bank->base +
2145 OMAP24XX_GPIO_LEVELDETECT0);
2146 old1 = __raw_readl(bank->base +
2147 OMAP24XX_GPIO_LEVELDETECT1);
2060 __raw_writel(old0 | gen, bank->base + 2148 __raw_writel(old0 | gen, bank->base +
2061 OMAP24XX_GPIO_LEVELDETECT0); 2149 OMAP24XX_GPIO_LEVELDETECT0);
2062 __raw_writel(old1 | gen, bank->base + 2150 __raw_writel(old1 | gen, bank->base +
2063 OMAP24XX_GPIO_LEVELDETECT1); 2151 OMAP24XX_GPIO_LEVELDETECT1);
2064 __raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0); 2152 __raw_writel(old0, bank->base +
2065 __raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1); 2153 OMAP24XX_GPIO_LEVELDETECT0);
2066#endif 2154 __raw_writel(old1, bank->base +
2067#ifdef CONFIG_ARCH_OMAP4 2155 OMAP24XX_GPIO_LEVELDETECT1);
2068 old0 = __raw_readl(bank->base + 2156 }
2157
2158 if (cpu_is_omap44xx()) {
2159 old0 = __raw_readl(bank->base +
2069 OMAP4_GPIO_LEVELDETECT0); 2160 OMAP4_GPIO_LEVELDETECT0);
2070 old1 = __raw_readl(bank->base + 2161 old1 = __raw_readl(bank->base +
2071 OMAP4_GPIO_LEVELDETECT1); 2162 OMAP4_GPIO_LEVELDETECT1);
2072 __raw_writel(old0 | l, bank->base + 2163 __raw_writel(old0 | l, bank->base +
2073 OMAP4_GPIO_LEVELDETECT0); 2164 OMAP4_GPIO_LEVELDETECT0);
2074 __raw_writel(old1 | l, bank->base + 2165 __raw_writel(old1 | l, bank->base +
2075 OMAP4_GPIO_LEVELDETECT1); 2166 OMAP4_GPIO_LEVELDETECT1);
2076 __raw_writel(old0, bank->base + 2167 __raw_writel(old0, bank->base +
2077 OMAP4_GPIO_LEVELDETECT0); 2168 OMAP4_GPIO_LEVELDETECT0);
2078 __raw_writel(old1, bank->base + 2169 __raw_writel(old1, bank->base +
2079 OMAP4_GPIO_LEVELDETECT1); 2170 OMAP4_GPIO_LEVELDETECT1);
2080#endif 2171 }
2081 } 2172 }
2082 } 2173 }
2083 2174
@@ -2085,7 +2176,7 @@ void omap2_gpio_resume_after_retention(void)
2085 2176
2086#endif 2177#endif
2087 2178
2088#ifdef CONFIG_ARCH_OMAP34XX 2179#ifdef CONFIG_ARCH_OMAP3
2089/* save the registers of bank 2-6 */ 2180/* save the registers of bank 2-6 */
2090void omap_gpio_save_context(void) 2181void omap_gpio_save_context(void)
2091{ 2182{
@@ -2181,8 +2272,7 @@ static int __init omap_gpio_sysinit(void)
2181 2272
2182 mpuio_init(); 2273 mpuio_init();
2183 2274
2184#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 2275#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
2185 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
2186 if (cpu_is_omap16xx() || cpu_class_is_omap2()) { 2276 if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
2187 if (ret == 0) { 2277 if (ret == 0) {
2188 ret = sysdev_class_register(&omap_gpio_sysclass); 2278 ret = sysdev_class_register(&omap_gpio_sysclass);
@@ -2241,8 +2331,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
2241/* FIXME for at least omap2, show pullup/pulldown state */ 2331/* FIXME for at least omap2, show pullup/pulldown state */
2242 2332
2243 irqstat = irq_desc[irq].status; 2333 irqstat = irq_desc[irq].status;
2244#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 2334#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
2245 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
2246 if (is_in && ((bank->suspend_wakeup & mask) 2335 if (is_in && ((bank->suspend_wakeup & mask)
2247 || irqstat & IRQ_TYPE_SENSE_MASK)) { 2336 || irqstat & IRQ_TYPE_SENSE_MASK)) {
2248 char *trigger = NULL; 2337 char *trigger = NULL;
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index 33fff4ef382d..624e26298faa 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -28,6 +28,7 @@
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <mach/irqs.h> 29#include <mach/irqs.h>
30#include <plat/mux.h> 30#include <plat/mux.h>
31#include <plat/i2c.h>
31 32
32#define OMAP_I2C_SIZE 0x3f 33#define OMAP_I2C_SIZE 0x3f
33#define OMAP1_I2C_BASE 0xfffb3800 34#define OMAP1_I2C_BASE 0xfffb3800
@@ -50,10 +51,10 @@ static const char name[] = "i2c_omap";
50 51
51static struct resource i2c_resources[][2] = { 52static struct resource i2c_resources[][2] = {
52 { I2C_RESOURCE_BUILDER(0, 0) }, 53 { I2C_RESOURCE_BUILDER(0, 0) },
53#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 54#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
54 { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, INT_24XX_I2C2_IRQ) }, 55 { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, INT_24XX_I2C2_IRQ) },
55#endif 56#endif
56#if defined(CONFIG_ARCH_OMAP34XX) 57#if defined(CONFIG_ARCH_OMAP3)
57 { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, INT_34XX_I2C3_IRQ) }, 58 { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, INT_34XX_I2C3_IRQ) },
58#endif 59#endif
59}; 60};
@@ -72,10 +73,10 @@ static struct resource i2c_resources[][2] = {
72static u32 i2c_rate[ARRAY_SIZE(i2c_resources)]; 73static u32 i2c_rate[ARRAY_SIZE(i2c_resources)];
73static struct platform_device omap_i2c_devices[] = { 74static struct platform_device omap_i2c_devices[] = {
74 I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_rate[0]), 75 I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_rate[0]),
75#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 76#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
76 I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_rate[1]), 77 I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_rate[1]),
77#endif 78#endif
78#if defined(CONFIG_ARCH_OMAP34XX) 79#if defined(CONFIG_ARCH_OMAP3)
79 I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_rate[2]), 80 I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_rate[2]),
80#endif 81#endif
81}; 82};
@@ -117,6 +118,11 @@ static int __init omap_i2c_add_bus(int bus_id)
117 res[1].start = irq; 118 res[1].start = irq;
118 } 119 }
119 120
121 if (cpu_class_is_omap1())
122 omap1_i2c_mux_pins(bus_id);
123 if (cpu_class_is_omap2())
124 omap2_i2c_mux_pins(bus_id);
125
120 return platform_device_register(pdev); 126 return platform_device_register(pdev);
121} 127}
122 128
@@ -169,7 +175,7 @@ out:
169subsys_initcall(omap_register_i2c_bus_cmdline); 175subsys_initcall(omap_register_i2c_bus_cmdline);
170 176
171/** 177/**
172 * omap_plat_register_i2c_bus - register I2C bus with device descriptors 178 * omap_register_i2c_bus - register I2C bus with device descriptors
173 * @bus_id: bus id counting from number 1 179 * @bus_id: bus id counting from number 1
174 * @clkrate: clock rate of the bus in kHz 180 * @clkrate: clock rate of the bus in kHz
175 * @info: pointer into I2C device descriptor table or NULL 181 * @info: pointer into I2C device descriptor table or NULL
@@ -177,7 +183,7 @@ subsys_initcall(omap_register_i2c_bus_cmdline);
177 * 183 *
178 * Returns 0 on success or an error code. 184 * Returns 0 on success or an error code.
179 */ 185 */
180int __init omap_plat_register_i2c_bus(int bus_id, u32 clkrate, 186int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
181 struct i2c_board_info const *info, 187 struct i2c_board_info const *info,
182 unsigned len) 188 unsigned len)
183{ 189{
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
index 376ce18216ff..5cd622039da0 100644
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -99,7 +99,6 @@ struct fb_info;
99struct omap_backlight_config { 99struct omap_backlight_config {
100 int default_intensity; 100 int default_intensity;
101 int (*set_power)(struct device *dev, int state); 101 int (*set_power)(struct device *dev, int state);
102 int (*check_fb)(struct fb_info *fb);
103}; 102};
104 103
105struct omap_fbmem_config { 104struct omap_fbmem_config {
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
index 35b36caf5f91..bb937f3fabed 100644
--- a/arch/arm/plat-omap/include/plat/clkdev_omap.h
+++ b/arch/arm/plat-omap/include/plat/clkdev_omap.h
@@ -25,17 +25,25 @@ struct omap_clk {
25 }, \ 25 }, \
26 } 26 }
27 27
28 28/* Platform flags for the clkdev-OMAP integration code */
29#define CK_310 (1 << 0) 29#define CK_310 (1 << 0)
30#define CK_7XX (1 << 1) 30#define CK_7XX (1 << 1) /* 7xx, 850 */
31#define CK_1510 (1 << 2) 31#define CK_1510 (1 << 2)
32#define CK_16XX (1 << 3) 32#define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */
33#define CK_243X (1 << 4) 33#define CK_242X (1 << 4)
34#define CK_242X (1 << 5) 34#define CK_243X (1 << 5)
35#define CK_343X (1 << 6) 35#define CK_3XXX (1 << 6) /* OMAP3 + AM3 common clocks*/
36#define CK_3430ES1 (1 << 7) 36#define CK_343X (1 << 7) /* OMAP34xx common clocks */
37#define CK_3430ES2 (1 << 8) 37#define CK_3430ES1 (1 << 8) /* 34xxES1 only */
38#define CK_443X (1 << 9) 38#define CK_3430ES2 (1 << 9) /* 34xxES2, ES3, non-Sitara 35xx only */
39#define CK_3505 (1 << 10)
40#define CK_3517 (1 << 11)
41#define CK_36XX (1 << 12) /* OMAP36xx/37xx-specific clocks */
42#define CK_443X (1 << 13)
43
44#define CK_AM35XX (CK_3505 | CK_3517) /* all Sitara AM35xx */
45
46
39 47
40#endif 48#endif
41 49
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 309b6d1dccdb..34f7fa9ad4c0 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/clock.h 2 * OMAP clock: data structure definitions, function prototypes, shared macros
3 * 3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation 4 * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc 6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -22,12 +22,13 @@ struct clockdomain;
22struct clkops { 22struct clkops {
23 int (*enable)(struct clk *); 23 int (*enable)(struct clk *);
24 void (*disable)(struct clk *); 24 void (*disable)(struct clk *);
25 void (*find_idlest)(struct clk *, void __iomem **, u8 *); 25 void (*find_idlest)(struct clk *, void __iomem **,
26 void (*find_companion)(struct clk *, void __iomem **, u8 *); 26 u8 *, u8 *);
27 void (*find_companion)(struct clk *, void __iomem **,
28 u8 *);
27}; 29};
28 30
29#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 31#ifdef CONFIG_ARCH_OMAP2PLUS
30 defined(CONFIG_ARCH_OMAP4)
31 32
32struct clksel_rate { 33struct clksel_rate {
33 u32 val; 34 u32 val;
@@ -40,6 +41,50 @@ struct clksel {
40 const struct clksel_rate *rates; 41 const struct clksel_rate *rates;
41}; 42};
42 43
44/**
45 * struct dpll_data - DPLL registers and integration data
46 * @mult_div1_reg: register containing the DPLL M and N bitfields
47 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
48 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
49 * @clk_bypass: struct clk pointer to the clock's bypass clock input
50 * @clk_ref: struct clk pointer to the clock's reference clock input
51 * @control_reg: register containing the DPLL mode bitfield
52 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
53 * @rate_tolerance: maximum variance allowed from target rate (in Hz)
54 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
55 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
56 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
57 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
58 * @min_divider: minimum valid non-bypass divider value (actual)
59 * @max_divider: maximum valid non-bypass divider value (actual)
60 * @modes: possible values of @enable_mask
61 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
62 * @idlest_reg: register containing the DPLL idle status bitfield
63 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
64 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
65 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
66 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
67 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
68 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
69 * @flags: DPLL type/features (see below)
70 *
71 * Possible values for @flags:
72 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
73 * NO_DCO_SEL: don't program DCO (only for some J-type DPLLs)
74
75 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
76 *
77 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
78 * correct to only have one @clk_bypass pointer.
79 *
80 * XXX @rate_tolerance should probably be deprecated - currently there
81 * don't seem to be any usecases for DPLL rounding that is not exact.
82 *
83 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
84 * @last_rounded_n) should be separated from the runtime-fixed fields
85 * and placed into a differenct structure, so that the runtime-fixed data
86 * can be placed into read-only space.
87 */
43struct dpll_data { 88struct dpll_data {
44 void __iomem *mult_div1_reg; 89 void __iomem *mult_div1_reg;
45 u32 mult_mask; 90 u32 mult_mask;
@@ -51,13 +96,12 @@ struct dpll_data {
51 unsigned int rate_tolerance; 96 unsigned int rate_tolerance;
52 unsigned long last_rounded_rate; 97 unsigned long last_rounded_rate;
53 u16 last_rounded_m; 98 u16 last_rounded_m;
99 u16 max_multiplier;
54 u8 last_rounded_n; 100 u8 last_rounded_n;
55 u8 min_divider; 101 u8 min_divider;
56 u8 max_divider; 102 u8 max_divider;
57 u32 max_tolerance;
58 u16 max_multiplier;
59#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
60 u8 modes; 103 u8 modes;
104#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
61 void __iomem *autoidle_reg; 105 void __iomem *autoidle_reg;
62 void __iomem *idlest_reg; 106 void __iomem *idlest_reg;
63 u32 autoidle_mask; 107 u32 autoidle_mask;
@@ -66,6 +110,7 @@ struct dpll_data {
66 u8 auto_recal_bit; 110 u8 auto_recal_bit;
67 u8 recal_en_bit; 111 u8 recal_en_bit;
68 u8 recal_st_bit; 112 u8 recal_st_bit;
113 u8 flags;
69# endif 114# endif
70}; 115};
71 116
@@ -75,12 +120,10 @@ struct clk {
75 struct list_head node; 120 struct list_head node;
76 const struct clkops *ops; 121 const struct clkops *ops;
77 const char *name; 122 const char *name;
78 int id;
79 struct clk *parent; 123 struct clk *parent;
80 struct list_head children; 124 struct list_head children;
81 struct list_head sibling; /* node for children */ 125 struct list_head sibling; /* node for children */
82 unsigned long rate; 126 unsigned long rate;
83 __u32 flags;
84 void __iomem *enable_reg; 127 void __iomem *enable_reg;
85 unsigned long (*recalc)(struct clk *); 128 unsigned long (*recalc)(struct clk *);
86 int (*set_rate)(struct clk *, unsigned long); 129 int (*set_rate)(struct clk *, unsigned long);
@@ -88,9 +131,9 @@ struct clk {
88 void (*init)(struct clk *); 131 void (*init)(struct clk *);
89 __u8 enable_bit; 132 __u8 enable_bit;
90 __s8 usecount; 133 __s8 usecount;
91#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
92 defined(CONFIG_ARCH_OMAP4)
93 u8 fixed_div; 134 u8 fixed_div;
135 u8 flags;
136#ifdef CONFIG_ARCH_OMAP2PLUS
94 void __iomem *clksel_reg; 137 void __iomem *clksel_reg;
95 u32 clksel_mask; 138 u32 clksel_mask;
96 const struct clksel *clksel; 139 const struct clksel *clksel;
@@ -119,10 +162,11 @@ struct clk_functions {
119 void (*clk_disable_unused)(struct clk *clk); 162 void (*clk_disable_unused)(struct clk *clk);
120#ifdef CONFIG_CPU_FREQ 163#ifdef CONFIG_CPU_FREQ
121 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **); 164 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **);
165 void (*clk_exit_cpufreq_table)(struct cpufreq_frequency_table **);
122#endif 166#endif
123}; 167};
124 168
125extern unsigned int mpurate; 169extern int mpurate;
126 170
127extern int clk_init(struct clk_functions *custom_clocks); 171extern int clk_init(struct clk_functions *custom_clocks);
128extern void clk_preinit(struct clk *clk); 172extern void clk_preinit(struct clk *clk);
@@ -133,26 +177,23 @@ extern void propagate_rate(struct clk *clk);
133extern void recalculate_root_clocks(void); 177extern void recalculate_root_clocks(void);
134extern unsigned long followparent_recalc(struct clk *clk); 178extern unsigned long followparent_recalc(struct clk *clk);
135extern void clk_enable_init_clocks(void); 179extern void clk_enable_init_clocks(void);
180unsigned long omap_fixed_divisor_recalc(struct clk *clk);
136#ifdef CONFIG_CPU_FREQ 181#ifdef CONFIG_CPU_FREQ
137extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table); 182extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
183extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
138#endif 184#endif
185extern struct clk *omap_clk_get_by_name(const char *name);
139 186
140extern const struct clkops clkops_null; 187extern const struct clkops clkops_null;
141 188
189extern struct clk dummy_ck;
190
142/* Clock flags */ 191/* Clock flags */
143/* bit 0 is free */ 192#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
144#define RATE_FIXED (1 << 1) /* Fixed clock rate */ 193#define CLOCK_IDLE_CONTROL (1 << 1)
145/* bits 2-4 are free */ 194#define CLOCK_NO_IDLE_PARENT (1 << 2)
146#define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */ 195#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
147#define CLOCK_IDLE_CONTROL (1 << 7) 196#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
148#define CLOCK_NO_IDLE_PARENT (1 << 8)
149#define DELAYED_APP (1 << 9) /* Delay application of clock */
150#define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
151#define ENABLE_ON_INIT (1 << 11) /* Enable upon framework init */
152#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */
153#define CLOCK_IN_OMAP4430 (1 << 13)
154#define ALWAYS_ENABLED (1 << 14)
155/* bits 13-31 are currently free */
156 197
157/* Clksel_rate flags */ 198/* Clksel_rate flags */
158#define DEFAULT_RATE (1 << 0) 199#define DEFAULT_RATE (1 << 0)
@@ -160,7 +201,8 @@ extern const struct clkops clkops_null;
160#define RATE_IN_243X (1 << 2) 201#define RATE_IN_243X (1 << 2)
161#define RATE_IN_343X (1 << 3) /* rates common to all 343X */ 202#define RATE_IN_343X (1 << 3) /* rates common to all 343X */
162#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */ 203#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */
163#define RATE_IN_4430 (1 << 5) 204#define RATE_IN_36XX (1 << 5)
205#define RATE_IN_4430 (1 << 6)
164 206
165#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) 207#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
166 208
diff --git a/arch/arm/plat-omap/include/plat/clockdomain.h b/arch/arm/plat-omap/include/plat/clockdomain.h
index eb734826e64e..ba0a6c07c0fe 100644
--- a/arch/arm/plat-omap/include/plat/clockdomain.h
+++ b/arch/arm/plat-omap/include/plat/clockdomain.h
@@ -4,7 +4,7 @@
4 * OMAP2/3 clockdomain framework functions 4 * OMAP2/3 clockdomain framework functions
5 * 5 *
6 * Copyright (C) 2008 Texas Instruments, Inc. 6 * Copyright (C) 2008 Texas Instruments, Inc.
7 * Copyright (C) 2008 Nokia Corporation 7 * Copyright (C) 2008-2009 Nokia Corporation
8 * 8 *
9 * Written by Paul Walmsley 9 * Written by Paul Walmsley
10 * 10 *
@@ -40,65 +40,95 @@
40#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2 40#define OMAP34XX_CLKSTCTRL_FORCE_WAKEUP 0x2
41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3 41#define OMAP34XX_CLKSTCTRL_ENABLE_AUTO 0x3
42 42
43/* 43/**
44 * struct clkdm_pwrdm_autodep - a powerdomain that should have wkdeps 44 * struct clkdm_autodep - clkdm deps to add when entering/exiting hwsup mode
45 * and sleepdeps added when a powerdomain should stay active in hwsup mode; 45 * @clkdm: clockdomain to add wkdep+sleepdep on - set name member only
46 * and conversely, removed when the powerdomain should be allowed to go 46 * @omap_chip: OMAP chip types that this autodep is valid on
47 * inactive in hwsup mode. 47 *
48 * A clockdomain that should have wkdeps and sleepdeps added when a
49 * clockdomain should stay active in hwsup mode; and conversely,
50 * removed when the clockdomain should be allowed to go inactive in
51 * hwsup mode.
52 *
53 * Autodeps are deprecated and should be removed after
54 * omap_hwmod-based fine-grained module idle control is added.
48 */ 55 */
49struct clkdm_pwrdm_autodep { 56struct clkdm_autodep {
50
51 union { 57 union {
52 /* Name of the powerdomain to add a wkdep/sleepdep on */
53 const char *name; 58 const char *name;
54 59 struct clockdomain *ptr;
55 /* Powerdomain pointer (looked up at clkdm_init() time) */ 60 } clkdm;
56 struct powerdomain *ptr;
57 } pwrdm;
58
59 /* OMAP chip types that this clockdomain dep is valid on */
60 const struct omap_chip_id omap_chip; 61 const struct omap_chip_id omap_chip;
62};
61 63
64/**
65 * struct clkdm_dep - encode dependencies between clockdomains
66 * @clkdm_name: clockdomain name
67 * @clkdm: pointer to the struct clockdomain of @clkdm_name
68 * @omap_chip: OMAP chip types that this dependency is valid on
69 * @wkdep_usecount: Number of wakeup dependencies causing this clkdm to wake
70 * @sleepdep_usecount: Number of sleep deps that could prevent clkdm from idle
71 *
72 * Statically defined. @clkdm is resolved from @clkdm_name at runtime and
73 * should not be pre-initialized.
74 *
75 * XXX Should also include hardware (fixed) dependencies.
76 */
77struct clkdm_dep {
78 const char *clkdm_name;
79 struct clockdomain *clkdm;
80 atomic_t wkdep_usecount;
81 atomic_t sleepdep_usecount;
82 const struct omap_chip_id omap_chip;
62}; 83};
63 84
85/**
86 * struct clockdomain - OMAP clockdomain
87 * @name: clockdomain name
88 * @pwrdm: powerdomain containing this clockdomain
89 * @clktrctrl_reg: CLKSTCTRL reg for the given clock domain
90 * @clktrctrl_mask: CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg
91 * @flags: Clockdomain capability flags
92 * @dep_bit: Bit shift of this clockdomain's PM_WKDEP/CM_SLEEPDEP bit
93 * @wkdep_srcs: Clockdomains that can be told to wake this powerdomain up
94 * @sleepdep_srcs: Clockdomains that can be told to keep this clkdm from inact
95 * @omap_chip: OMAP chip types that this clockdomain is valid on
96 * @usecount: Usecount tracking
97 * @node: list_head to link all clockdomains together
98 */
64struct clockdomain { 99struct clockdomain {
65
66 /* Clockdomain name */
67 const char *name; 100 const char *name;
68
69 union { 101 union {
70 /* Powerdomain enclosing this clockdomain */
71 const char *name; 102 const char *name;
72
73 /* Powerdomain pointer assigned at clkdm_register() */
74 struct powerdomain *ptr; 103 struct powerdomain *ptr;
75 } pwrdm; 104 } pwrdm;
76 105 void __iomem *clkstctrl_reg;
77 /* CLKTRCTRL/AUTOSTATE field mask in CM_CLKSTCTRL reg */
78 const u16 clktrctrl_mask; 106 const u16 clktrctrl_mask;
79
80 /* Clockdomain capability flags */
81 const u8 flags; 107 const u8 flags;
82 108 const u8 dep_bit;
83 /* OMAP chip types that this clockdomain is valid on */ 109 struct clkdm_dep *wkdep_srcs;
110 struct clkdm_dep *sleepdep_srcs;
84 const struct omap_chip_id omap_chip; 111 const struct omap_chip_id omap_chip;
85
86 /* Usecount tracking */
87 atomic_t usecount; 112 atomic_t usecount;
88
89 struct list_head node; 113 struct list_head node;
90
91}; 114};
92 115
93void clkdm_init(struct clockdomain **clkdms, struct clkdm_pwrdm_autodep *autodeps); 116void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps);
94int clkdm_register(struct clockdomain *clkdm);
95int clkdm_unregister(struct clockdomain *clkdm);
96struct clockdomain *clkdm_lookup(const char *name); 117struct clockdomain *clkdm_lookup(const char *name);
97 118
98int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user), 119int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
99 void *user); 120 void *user);
100struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm); 121struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm);
101 122
123int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
124int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
125int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
126int clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
127int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
128int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
129int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
130int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
131
102void omap2_clkdm_allow_idle(struct clockdomain *clkdm); 132void omap2_clkdm_allow_idle(struct clockdomain *clkdm);
103void omap2_clkdm_deny_idle(struct clockdomain *clkdm); 133void omap2_clkdm_deny_idle(struct clockdomain *clkdm);
104 134
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 32c22272425d..7556e271942e 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -37,21 +37,30 @@ extern void __iomem *gic_cpu_base_addr;
37extern void omap_map_common_io(void); 37extern void omap_map_common_io(void);
38extern struct sys_timer omap_timer; 38extern struct sys_timer omap_timer;
39 39
40/* IO bases for various OMAP processors */ 40/*
41 * IO bases for various OMAP processors
42 * Except the tap base, rest all the io bases
43 * listed are physical addresses.
44 */
41struct omap_globals { 45struct omap_globals {
42 u32 class; /* OMAP class to detect */ 46 u32 class; /* OMAP class to detect */
43 void __iomem *tap; /* Control module ID code */ 47 void __iomem *tap; /* Control module ID code */
44 void __iomem *sdrc; /* SDRAM Controller */ 48 unsigned long sdrc; /* SDRAM Controller */
45 void __iomem *sms; /* SDRAM Memory Scheduler */ 49 unsigned long sms; /* SDRAM Memory Scheduler */
46 void __iomem *ctrl; /* System Control Module */ 50 unsigned long ctrl; /* System Control Module */
47 void __iomem *prm; /* Power and Reset Management */ 51 unsigned long prm; /* Power and Reset Management */
48 void __iomem *cm; /* Clock Management */ 52 unsigned long cm; /* Clock Management */
49 void __iomem *cm2; 53 unsigned long cm2;
54 unsigned long uart1_phys;
55 unsigned long uart2_phys;
56 unsigned long uart3_phys;
57 unsigned long uart4_phys;
50}; 58};
51 59
52void omap2_set_globals_242x(void); 60void omap2_set_globals_242x(void);
53void omap2_set_globals_243x(void); 61void omap2_set_globals_243x(void);
54void omap2_set_globals_343x(void); 62void omap2_set_globals_343x(void);
63void omap2_set_globals_36xx(void);
55void omap2_set_globals_443x(void); 64void omap2_set_globals_443x(void);
56 65
57/* These get called from omap2_set_globals_xxxx(), do not call these */ 66/* These get called from omap2_set_globals_xxxx(), do not call these */
@@ -59,6 +68,7 @@ void omap2_set_globals_tap(struct omap_globals *);
59void omap2_set_globals_sdrc(struct omap_globals *); 68void omap2_set_globals_sdrc(struct omap_globals *);
60void omap2_set_globals_control(struct omap_globals *); 69void omap2_set_globals_control(struct omap_globals *);
61void omap2_set_globals_prcm(struct omap_globals *); 70void omap2_set_globals_prcm(struct omap_globals *);
71void omap2_set_globals_uart(struct omap_globals *);
62 72
63/** 73/**
64 * omap_test_timeout - busy-loop, testing a condition 74 * omap_test_timeout - busy-loop, testing a condition
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h
index 2ae884378638..a56deee97676 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -147,7 +147,7 @@
147#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) 147#define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190)
148#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) 148#define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194)
149#define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ 149#define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \
150 + ((i) >> 1) * 4 + (!(i) & 1) * 2) 150 + ((i) >> 1) * 4 + (!((i) & 1)) * 2)
151#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) 151#define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4)
152#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) 152#define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8)
153#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) 153#define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0)
@@ -160,6 +160,14 @@
160#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0) 160#define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0)
161#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4) 161#define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4)
162 162
163/* AM35XX only CONTROL_GENERAL register offsets */
164#define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038)
165#define AM35XX_CONTROL_DEVCONF2 (OMAP2_CONTROL_GENERAL + 0x0310)
166#define AM35XX_CONTROL_DEVCONF3 (OMAP2_CONTROL_GENERAL + 0x0314)
167#define AM35XX_CONTROL_CBA_PRIORITY (OMAP2_CONTROL_GENERAL + 0x0320)
168#define AM35XX_CONTROL_LVL_INTR_CLEAR (OMAP2_CONTROL_GENERAL + 0x0324)
169#define AM35XX_CONTROL_IP_SW_RESET (OMAP2_CONTROL_GENERAL + 0x0328)
170#define AM35XX_CONTROL_IPSS_CLK_CTRL (OMAP2_CONTROL_GENERAL + 0x032C)
163 171
164/* 34xx PADCONF register offsets */ 172/* 34xx PADCONF register offsets */
165#define OMAP343X_PADCONF_ETK(i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \ 173#define OMAP343X_PADCONF_ETK(i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \
@@ -196,6 +204,9 @@
196#define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250 204#define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250
197#define OMAP3_PADCONF_SAD2D_IDLEACK 0x254 205#define OMAP3_PADCONF_SAD2D_IDLEACK 0x254
198 206
207/* 44xx control status register offset */
208#define OMAP44XX_CONTROL_STATUS 0x2c4
209
199/* 210/*
200 * REVISIT: This list of registers is not comprehensive - there are more 211 * REVISIT: This list of registers is not comprehensive - there are more
201 * that should be added. 212 * that should be added.
@@ -257,6 +268,32 @@
257#define OMAP343X_SCRATCHPAD (OMAP343X_CTRL_BASE + 0x910) 268#define OMAP343X_SCRATCHPAD (OMAP343X_CTRL_BASE + 0x910)
258#define OMAP343X_SCRATCHPAD_ROM_OFFSET 0x19C 269#define OMAP343X_SCRATCHPAD_ROM_OFFSET 0x19C
259 270
271/* AM35XX_CONTROL_IPSS_CLK_CTRL bits */
272#define AM35XX_USBOTG_VBUSP_CLK_SHIFT 0
273#define AM35XX_CPGMAC_VBUSP_CLK_SHIFT 1
274#define AM35XX_VPFE_VBUSP_CLK_SHIFT 2
275#define AM35XX_HECC_VBUSP_CLK_SHIFT 3
276#define AM35XX_USBOTG_FCLK_SHIFT 8
277#define AM35XX_CPGMAC_FCLK_SHIFT 9
278#define AM35XX_VPFE_FCLK_SHIFT 10
279
280/*AM35XX CONTROL_LVL_INTR_CLEAR bits*/
281#define AM35XX_CPGMAC_C0_MISC_PULSE_CLR BIT(0)
282#define AM35XX_CPGMAC_C0_RX_PULSE_CLR BIT(1)
283#define AM35XX_CPGMAC_C0_RX_THRESH_CLR BIT(2)
284#define AM35XX_CPGMAC_C0_TX_PULSE_CLR BIT(3)
285#define AM35XX_USBOTGSS_INT_CLR BIT(4)
286#define AM35XX_VPFE_CCDC_VD0_INT_CLR BIT(5)
287#define AM35XX_VPFE_CCDC_VD1_INT_CLR BIT(6)
288#define AM35XX_VPFE_CCDC_VD2_INT_CLR BIT(7)
289
290/*AM35XX CONTROL_IP_SW_RESET bits*/
291#define AM35XX_USBOTGSS_SW_RST BIT(0)
292#define AM35XX_CPGMACSS_SW_RST BIT(1)
293#define AM35XX_VPFE_VBUSP_SW_RST BIT(2)
294#define AM35XX_HECC_SW_RST BIT(3)
295#define AM35XX_VPFE_PCLK_SW_RST BIT(4)
296
260/* 297/*
261 * CONTROL OMAP STATUS register to identify OMAP3 features 298 * CONTROL OMAP STATUS register to identify OMAP3 features
262 */ 299 */
@@ -292,8 +329,7 @@
292 329
293 330
294#ifndef __ASSEMBLY__ 331#ifndef __ASSEMBLY__
295#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 332#ifdef CONFIG_ARCH_OMAP2PLUS
296 defined(CONFIG_ARCH_OMAP4)
297extern void __iomem *omap_ctrl_base_get(void); 333extern void __iomem *omap_ctrl_base_get(void);
298extern u8 omap_ctrl_readb(u16 offset); 334extern u8 omap_ctrl_readb(u16 offset);
299extern u16 omap_ctrl_readw(u16 offset); 335extern u16 omap_ctrl_readw(u16 offset);
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 9a028bdebb06..ed8786c41df2 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -31,6 +31,7 @@
31#define __ASM_ARCH_OMAP_CPU_H 31#define __ASM_ARCH_OMAP_CPU_H
32 32
33#include <linux/bitops.h> 33#include <linux/bitops.h>
34#include <plat/multi.h>
34 35
35/* 36/*
36 * Omap device type i.e. EMU/HS/TST/GP/BAD 37 * Omap device type i.e. EMU/HS/TST/GP/BAD
@@ -44,7 +45,7 @@
44int omap_type(void); 45int omap_type(void);
45 46
46struct omap_chip_id { 47struct omap_chip_id {
47 u8 oc; 48 u16 oc;
48 u8 type; 49 u8 type;
49}; 50};
50 51
@@ -76,75 +77,6 @@ unsigned int omap_rev(void);
76#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff) 77#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
77 78
78/* 79/*
79 * Test if multicore OMAP support is needed
80 */
81#undef MULTI_OMAP1
82#undef MULTI_OMAP2
83#undef OMAP_NAME
84
85#ifdef CONFIG_ARCH_OMAP730
86# ifdef OMAP_NAME
87# undef MULTI_OMAP1
88# define MULTI_OMAP1
89# else
90# define OMAP_NAME omap730
91# endif
92#endif
93#ifdef CONFIG_ARCH_OMAP850
94# ifdef OMAP_NAME
95# undef MULTI_OMAP1
96# define MULTI_OMAP1
97# else
98# define OMAP_NAME omap850
99# endif
100#endif
101#ifdef CONFIG_ARCH_OMAP15XX
102# ifdef OMAP_NAME
103# undef MULTI_OMAP1
104# define MULTI_OMAP1
105# else
106# define OMAP_NAME omap1510
107# endif
108#endif
109#ifdef CONFIG_ARCH_OMAP16XX
110# ifdef OMAP_NAME
111# undef MULTI_OMAP1
112# define MULTI_OMAP1
113# else
114# define OMAP_NAME omap16xx
115# endif
116#endif
117#if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
118# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
119# error "OMAP1 and OMAP2 can't be selected at the same time"
120# endif
121#endif
122#ifdef CONFIG_ARCH_OMAP2420
123# ifdef OMAP_NAME
124# undef MULTI_OMAP2
125# define MULTI_OMAP2
126# else
127# define OMAP_NAME omap2420
128# endif
129#endif
130#ifdef CONFIG_ARCH_OMAP2430
131# ifdef OMAP_NAME
132# undef MULTI_OMAP2
133# define MULTI_OMAP2
134# else
135# define OMAP_NAME omap2430
136# endif
137#endif
138#ifdef CONFIG_ARCH_OMAP3430
139# ifdef OMAP_NAME
140# undef MULTI_OMAP2
141# define MULTI_OMAP2
142# else
143# define OMAP_NAME omap3430
144# endif
145#endif
146
147/*
148 * Macros to group OMAP into cpu classes. 80 * Macros to group OMAP into cpu classes.
149 * These can be used in most places. 81 * These can be used in most places.
150 * cpu_is_omap7xx(): True for OMAP730, OMAP850 82 * cpu_is_omap7xx(): True for OMAP730, OMAP850
@@ -154,6 +86,7 @@ unsigned int omap_rev(void);
154 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 86 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
155 * cpu_is_omap243x(): True for OMAP2430 87 * cpu_is_omap243x(): True for OMAP2430
156 * cpu_is_omap343x(): True for OMAP3430 88 * cpu_is_omap343x(): True for OMAP3430
89 * cpu_is_omap443x(): True for OMAP4430
157 */ 90 */
158#define GET_OMAP_CLASS (omap_rev() & 0xff) 91#define GET_OMAP_CLASS (omap_rev() & 0xff)
159 92
@@ -232,7 +165,7 @@ IS_OMAP_SUBCLASS(443x, 0x443)
232#endif 165#endif
233 166
234#if defined(MULTI_OMAP2) 167#if defined(MULTI_OMAP2)
235# if defined(CONFIG_ARCH_OMAP24XX) 168# if defined(CONFIG_ARCH_OMAP2)
236# undef cpu_is_omap24xx 169# undef cpu_is_omap24xx
237# undef cpu_is_omap242x 170# undef cpu_is_omap242x
238# undef cpu_is_omap243x 171# undef cpu_is_omap243x
@@ -240,14 +173,14 @@ IS_OMAP_SUBCLASS(443x, 0x443)
240# define cpu_is_omap242x() is_omap242x() 173# define cpu_is_omap242x() is_omap242x()
241# define cpu_is_omap243x() is_omap243x() 174# define cpu_is_omap243x() is_omap243x()
242# endif 175# endif
243# if defined(CONFIG_ARCH_OMAP34XX) 176# if defined(CONFIG_ARCH_OMAP3)
244# undef cpu_is_omap34xx 177# undef cpu_is_omap34xx
245# undef cpu_is_omap343x 178# undef cpu_is_omap343x
246# define cpu_is_omap34xx() is_omap34xx() 179# define cpu_is_omap34xx() is_omap34xx()
247# define cpu_is_omap343x() is_omap343x() 180# define cpu_is_omap343x() is_omap343x()
248# endif 181# endif
249#else 182#else
250# if defined(CONFIG_ARCH_OMAP24XX) 183# if defined(CONFIG_ARCH_OMAP2)
251# undef cpu_is_omap24xx 184# undef cpu_is_omap24xx
252# define cpu_is_omap24xx() 1 185# define cpu_is_omap24xx() 1
253# endif 186# endif
@@ -259,7 +192,7 @@ IS_OMAP_SUBCLASS(443x, 0x443)
259# undef cpu_is_omap243x 192# undef cpu_is_omap243x
260# define cpu_is_omap243x() 1 193# define cpu_is_omap243x() 1
261# endif 194# endif
262# if defined(CONFIG_ARCH_OMAP34XX) 195# if defined(CONFIG_ARCH_OMAP3)
263# undef cpu_is_omap34xx 196# undef cpu_is_omap34xx
264# define cpu_is_omap34xx() 1 197# define cpu_is_omap34xx() 1
265# endif 198# endif
@@ -286,6 +219,7 @@ IS_OMAP_SUBCLASS(443x, 0x443)
286 * cpu_is_omap2423(): True for OMAP2423 219 * cpu_is_omap2423(): True for OMAP2423
287 * cpu_is_omap2430(): True for OMAP2430 220 * cpu_is_omap2430(): True for OMAP2430
288 * cpu_is_omap3430(): True for OMAP3430 221 * cpu_is_omap3430(): True for OMAP3430
222 * cpu_is_omap4430(): True for OMAP4430
289 * cpu_is_omap3505(): True for OMAP3505 223 * cpu_is_omap3505(): True for OMAP3505
290 * cpu_is_omap3517(): True for OMAP3517 224 * cpu_is_omap3517(): True for OMAP3517
291 */ 225 */
@@ -334,6 +268,7 @@ IS_OMAP_TYPE(3517, 0x3517)
334#define cpu_is_omap3505() 0 268#define cpu_is_omap3505() 0
335#define cpu_is_omap3517() 0 269#define cpu_is_omap3517() 0
336#define cpu_is_omap3430() 0 270#define cpu_is_omap3430() 0
271#define cpu_is_omap4430() 0
337#define cpu_is_omap3630() 0 272#define cpu_is_omap3630() 0
338 273
339/* 274/*
@@ -371,7 +306,7 @@ IS_OMAP_TYPE(3517, 0x3517)
371# define cpu_is_omap1710() is_omap1710() 306# define cpu_is_omap1710() is_omap1710()
372#endif 307#endif
373 308
374#if defined(CONFIG_ARCH_OMAP24XX) 309#if defined(CONFIG_ARCH_OMAP2)
375# undef cpu_is_omap2420 310# undef cpu_is_omap2420
376# undef cpu_is_omap2422 311# undef cpu_is_omap2422
377# undef cpu_is_omap2423 312# undef cpu_is_omap2423
@@ -382,7 +317,7 @@ IS_OMAP_TYPE(3517, 0x3517)
382# define cpu_is_omap2430() is_omap2430() 317# define cpu_is_omap2430() is_omap2430()
383#endif 318#endif
384 319
385#if defined(CONFIG_ARCH_OMAP34XX) 320#if defined(CONFIG_ARCH_OMAP3)
386# undef cpu_is_omap3430 321# undef cpu_is_omap3430
387# undef cpu_is_omap3503 322# undef cpu_is_omap3503
388# undef cpu_is_omap3515 323# undef cpu_is_omap3515
@@ -434,6 +369,7 @@ IS_OMAP_TYPE(3517, 0x3517)
434#define OMAP3430_REV_ES2_1 0x34302034 369#define OMAP3430_REV_ES2_1 0x34302034
435#define OMAP3430_REV_ES3_0 0x34303034 370#define OMAP3430_REV_ES3_0 0x34303034
436#define OMAP3430_REV_ES3_1 0x34304034 371#define OMAP3430_REV_ES3_1 0x34304034
372#define OMAP3430_REV_ES3_1_2 0x34305034
437 373
438#define OMAP3630_REV_ES1_0 0x36300034 374#define OMAP3630_REV_ES1_0 0x36300034
439 375
@@ -470,9 +406,12 @@ IS_OMAP_TYPE(3517, 0x3517)
470#define CHIP_IS_OMAP3430ES3_0 (1 << 5) 406#define CHIP_IS_OMAP3430ES3_0 (1 << 5)
471#define CHIP_IS_OMAP3430ES3_1 (1 << 6) 407#define CHIP_IS_OMAP3430ES3_1 (1 << 6)
472#define CHIP_IS_OMAP3630ES1 (1 << 7) 408#define CHIP_IS_OMAP3630ES1 (1 << 7)
409#define CHIP_IS_OMAP4430ES1 (1 << 8)
473 410
474#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) 411#define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
475 412
413#define CHIP_IS_OMAP4430 (CHIP_IS_OMAP4430ES1)
414
476/* 415/*
477 * "GE" here represents "greater than or equal to" in terms of ES 416 * "GE" here represents "greater than or equal to" in terms of ES
478 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430 417 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
@@ -500,6 +439,7 @@ extern u32 omap3_features;
500#define OMAP3_HAS_SGX BIT(2) 439#define OMAP3_HAS_SGX BIT(2)
501#define OMAP3_HAS_NEON BIT(3) 440#define OMAP3_HAS_NEON BIT(3)
502#define OMAP3_HAS_ISP BIT(4) 441#define OMAP3_HAS_ISP BIT(4)
442#define OMAP3_HAS_192MHZ_CLK BIT(5)
503 443
504#define OMAP3_HAS_FEATURE(feat,flag) \ 444#define OMAP3_HAS_FEATURE(feat,flag) \
505static inline unsigned int omap3_has_ ##feat(void) \ 445static inline unsigned int omap3_has_ ##feat(void) \
@@ -512,5 +452,6 @@ OMAP3_HAS_FEATURE(sgx, SGX)
512OMAP3_HAS_FEATURE(iva, IVA) 452OMAP3_HAS_FEATURE(iva, IVA)
513OMAP3_HAS_FEATURE(neon, NEON) 453OMAP3_HAS_FEATURE(neon, NEON)
514OMAP3_HAS_FEATURE(isp, ISP) 454OMAP3_HAS_FEATURE(isp, ISP)
455OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
515 456
516#endif 457#endif
diff --git a/arch/arm/plat-omap/include/plat/dma-44xx.h b/arch/arm/plat-omap/include/plat/dma-44xx.h
new file mode 100644
index 000000000000..1f767cb2f38a
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/dma-44xx.h
@@ -0,0 +1,147 @@
1/*
2 * OMAP4 SDMA channel definitions
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 * Paul Walmsley (paul@pwsan.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
23#define __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
24
25#define OMAP44XX_DMA_SYS_REQ0 2
26#define OMAP44XX_DMA_SYS_REQ1 3
27#define OMAP44XX_DMA_GPMC 4
28#define OMAP44XX_DMA_DSS_DISPC_REQ 6
29#define OMAP44XX_DMA_SYS_REQ2 7
30#define OMAP44XX_DMA_MCASP1_AXEVT 8
31#define OMAP44XX_DMA_ISS_REQ1 9
32#define OMAP44XX_DMA_ISS_REQ2 10
33#define OMAP44XX_DMA_MCASP1_AREVT 11
34#define OMAP44XX_DMA_ISS_REQ3 12
35#define OMAP44XX_DMA_ISS_REQ4 13
36#define OMAP44XX_DMA_DSS_RFBI_REQ 14
37#define OMAP44XX_DMA_SPI3_TX0 15
38#define OMAP44XX_DMA_SPI3_RX0 16
39#define OMAP44XX_DMA_MCBSP2_TX 17
40#define OMAP44XX_DMA_MCBSP2_RX 18
41#define OMAP44XX_DMA_MCBSP3_TX 19
42#define OMAP44XX_DMA_MCBSP3_RX 20
43#define OMAP44XX_DMA_C2C_SSCM_GPO0 21
44#define OMAP44XX_DMA_C2C_SSCM_GPO1 22
45#define OMAP44XX_DMA_SPI3_TX1 23
46#define OMAP44XX_DMA_SPI3_RX1 24
47#define OMAP44XX_DMA_I2C3_TX 25
48#define OMAP44XX_DMA_I2C3_RX 26
49#define OMAP44XX_DMA_I2C1_TX 27
50#define OMAP44XX_DMA_I2C1_RX 28
51#define OMAP44XX_DMA_I2C2_TX 29
52#define OMAP44XX_DMA_I2C2_RX 30
53#define OMAP44XX_DMA_MCBSP4_TX 31
54#define OMAP44XX_DMA_MCBSP4_RX 32
55#define OMAP44XX_DMA_MCBSP1_TX 33
56#define OMAP44XX_DMA_MCBSP1_RX 34
57#define OMAP44XX_DMA_SPI1_TX0 35
58#define OMAP44XX_DMA_SPI1_RX0 36
59#define OMAP44XX_DMA_SPI1_TX1 37
60#define OMAP44XX_DMA_SPI1_RX1 38
61#define OMAP44XX_DMA_SPI1_TX2 39
62#define OMAP44XX_DMA_SPI1_RX2 40
63#define OMAP44XX_DMA_SPI1_TX3 41
64#define OMAP44XX_DMA_SPI1_RX3 42
65#define OMAP44XX_DMA_SPI2_TX0 43
66#define OMAP44XX_DMA_SPI2_RX0 44
67#define OMAP44XX_DMA_SPI2_TX1 45
68#define OMAP44XX_DMA_SPI2_RX1 46
69#define OMAP44XX_DMA_MMC2_TX 47
70#define OMAP44XX_DMA_MMC2_RX 48
71#define OMAP44XX_DMA_UART1_TX 49
72#define OMAP44XX_DMA_UART1_RX 50
73#define OMAP44XX_DMA_UART2_TX 51
74#define OMAP44XX_DMA_UART2_RX 52
75#define OMAP44XX_DMA_UART3_TX 53
76#define OMAP44XX_DMA_UART3_RX 54
77#define OMAP44XX_DMA_UART4_TX 55
78#define OMAP44XX_DMA_UART4_RX 56
79#define OMAP44XX_DMA_MMC4_TX 57
80#define OMAP44XX_DMA_MMC4_RX 58
81#define OMAP44XX_DMA_MMC5_TX 59
82#define OMAP44XX_DMA_MMC5_RX 60
83#define OMAP44XX_DMA_MMC1_TX 61
84#define OMAP44XX_DMA_MMC1_RX 62
85#define OMAP44XX_DMA_SYS_REQ3 64
86#define OMAP44XX_DMA_MCPDM_UP 65
87#define OMAP44XX_DMA_MCPDM_DL 66
88#define OMAP44XX_DMA_DMIC_REQ 67
89#define OMAP44XX_DMA_C2C_SSCM_GPO2 68
90#define OMAP44XX_DMA_C2C_SSCM_GPO3 69
91#define OMAP44XX_DMA_SPI4_TX0 70
92#define OMAP44XX_DMA_SPI4_RX0 71
93#define OMAP44XX_DMA_DSS_DSI1_REQ0 72
94#define OMAP44XX_DMA_DSS_DSI1_REQ1 73
95#define OMAP44XX_DMA_DSS_DSI1_REQ2 74
96#define OMAP44XX_DMA_DSS_DSI1_REQ3 75
97#define OMAP44XX_DMA_DSS_HDMI_REQ 76
98#define OMAP44XX_DMA_MMC3_TX 77
99#define OMAP44XX_DMA_MMC3_RX 78
100#define OMAP44XX_DMA_USIM_TX 79
101#define OMAP44XX_DMA_USIM_RX 80
102#define OMAP44XX_DMA_DSS_DSI2_REQ0 81
103#define OMAP44XX_DMA_DSS_DSI2_REQ1 82
104#define OMAP44XX_DMA_DSS_DSI2_REQ2 83
105#define OMAP44XX_DMA_DSS_DSI2_REQ3 84
106#define OMAP44XX_DMA_SLIMBUS1_TX0 85
107#define OMAP44XX_DMA_SLIMBUS1_TX1 86
108#define OMAP44XX_DMA_SLIMBUS1_TX2 87
109#define OMAP44XX_DMA_SLIMBUS1_TX3 88
110#define OMAP44XX_DMA_SLIMBUS1_RX0 89
111#define OMAP44XX_DMA_SLIMBUS1_RX1 90
112#define OMAP44XX_DMA_SLIMBUS1_RX2 91
113#define OMAP44XX_DMA_SLIMBUS1_RX3 92
114#define OMAP44XX_DMA_SLIMBUS2_TX0 93
115#define OMAP44XX_DMA_SLIMBUS2_TX1 94
116#define OMAP44XX_DMA_SLIMBUS2_TX2 95
117#define OMAP44XX_DMA_SLIMBUS2_TX3 96
118#define OMAP44XX_DMA_SLIMBUS2_RX0 97
119#define OMAP44XX_DMA_SLIMBUS2_RX1 98
120#define OMAP44XX_DMA_SLIMBUS2_RX2 99
121#define OMAP44XX_DMA_SLIMBUS2_RX3 100
122#define OMAP44XX_DMA_ABE_REQ_0 101
123#define OMAP44XX_DMA_ABE_REQ_1 102
124#define OMAP44XX_DMA_ABE_REQ_2 103
125#define OMAP44XX_DMA_ABE_REQ_3 104
126#define OMAP44XX_DMA_ABE_REQ_4 105
127#define OMAP44XX_DMA_ABE_REQ_5 106
128#define OMAP44XX_DMA_ABE_REQ_6 107
129#define OMAP44XX_DMA_ABE_REQ_7 108
130#define OMAP44XX_DMA_AES1_P_CTX_IN_REQ 109
131#define OMAP44XX_DMA_AES1_P_DATA_IN_REQ 110
132#define OMAP44XX_DMA_AES1_P_DATA_OUT_REQ 111
133#define OMAP44XX_DMA_AES2_P_CTX_IN_REQ 112
134#define OMAP44XX_DMA_AES2_P_DATA_IN_REQ 113
135#define OMAP44XX_DMA_AES2_P_DATA_OUT_REQ 114
136#define OMAP44XX_DMA_DES_P_CTX_IN_REQ 115
137#define OMAP44XX_DMA_DES_P_DATA_IN_REQ 116
138#define OMAP44XX_DMA_DES_P_DATA_OUT_REQ 117
139#define OMAP44XX_DMA_SHA2_CTXIN_P 118
140#define OMAP44XX_DMA_SHA2_DIN_P 119
141#define OMAP44XX_DMA_SHA2_CTXOUT_P 120
142#define OMAP44XX_DMA_AES1_P_CONTEXT_OUT_REQ 121
143#define OMAP44XX_DMA_AES2_P_CONTEXT_OUT_REQ 122
144#define OMAP44XX_DMA_I2C4_TX 124
145#define OMAP44XX_DMA_I2C4_RX 125
146
147#endif
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
index 4ede9e17a0be..02232ca2c37f 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat/dma.h
@@ -21,6 +21,9 @@
21#ifndef __ASM_ARCH_DMA_H 21#ifndef __ASM_ARCH_DMA_H
22#define __ASM_ARCH_DMA_H 22#define __ASM_ARCH_DMA_H
23 23
24/* Move omap4 specific defines to dma-44xx.h */
25#include "dma-44xx.h"
26
24/* Hardware registers for omap1 */ 27/* Hardware registers for omap1 */
25#define OMAP1_DMA_BASE (0xfffed800) 28#define OMAP1_DMA_BASE (0xfffed800)
26 29
@@ -316,89 +319,6 @@
316#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */ 319#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
317#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */ 320#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
318 321
319/* DMA request lines for 44xx */
320#define OMAP44XX_DMA_DSS_DISPC_REQ 6 /* S_DMA_5 */
321#define OMAP44XX_DMA_SYS_REQ2 7 /* S_DMA_6 */
322#define OMAP44XX_DMA_ISS_REQ1 9 /* S_DMA_8 */
323#define OMAP44XX_DMA_ISS_REQ2 10 /* S_DMA_9 */
324#define OMAP44XX_DMA_ISS_REQ3 12 /* S_DMA_11 */
325#define OMAP44XX_DMA_ISS_REQ4 13 /* S_DMA_12 */
326#define OMAP44XX_DMA_DSS_RFBI_REQ 14 /* S_DMA_13 */
327#define OMAP44XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
328#define OMAP44XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
329#define OMAP44XX_DMA_MCBSP2_TX 17 /* S_DMA_16 */
330#define OMAP44XX_DMA_MCBSP2_RX 18 /* S_DMA_17 */
331#define OMAP44XX_DMA_MCBSP3_TX 19 /* S_DMA_18 */
332#define OMAP44XX_DMA_MCBSP3_RX 20 /* S_DMA_19 */
333#define OMAP44XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
334#define OMAP44XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
335#define OMAP44XX_DMA_I2C3_TX 25 /* S_DMA_24 */
336#define OMAP44XX_DMA_I2C3_RX 26 /* S_DMA_25 */
337#define OMAP44XX_DMA_I2C1_TX 27 /* S_DMA_26 */
338#define OMAP44XX_DMA_I2C1_RX 28 /* S_DMA_27 */
339#define OMAP44XX_DMA_I2C2_TX 29 /* S_DMA_28 */
340#define OMAP44XX_DMA_I2C2_RX 30 /* S_DMA_29 */
341#define OMAP44XX_DMA_MCBSP4_TX 31 /* S_DMA_30 */
342#define OMAP44XX_DMA_MCBSP4_RX 32 /* S_DMA_31 */
343#define OMAP44XX_DMA_MCBSP1_TX 33 /* S_DMA_32 */
344#define OMAP44XX_DMA_MCBSP1_RX 34 /* S_DMA_33 */
345#define OMAP44XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
346#define OMAP44XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
347#define OMAP44XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
348#define OMAP44XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
349#define OMAP44XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
350#define OMAP44XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
351#define OMAP44XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
352#define OMAP44XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
353#define OMAP44XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
354#define OMAP44XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
355#define OMAP44XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
356#define OMAP44XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
357#define OMAP44XX_DMA_MMC2_TX 47 /* S_DMA_46 */
358#define OMAP44XX_DMA_MMC2_RX 48 /* S_DMA_47 */
359#define OMAP44XX_DMA_UART1_TX 49 /* S_DMA_48 */
360#define OMAP44XX_DMA_UART1_RX 50 /* S_DMA_49 */
361#define OMAP44XX_DMA_UART2_TX 51 /* S_DMA_50 */
362#define OMAP44XX_DMA_UART2_RX 52 /* S_DMA_51 */
363#define OMAP44XX_DMA_UART3_TX 53 /* S_DMA_52 */
364#define OMAP44XX_DMA_UART3_RX 54 /* S_DMA_53 */
365#define OMAP44XX_DMA_UART4_TX 55 /* S_DMA_54 */
366#define OMAP44XX_DMA_UART4_RX 56 /* S_DMA_55 */
367#define OMAP44XX_DMA_MMC4_TX 57 /* S_DMA_56 */
368#define OMAP44XX_DMA_MMC4_RX 58 /* S_DMA_57 */
369#define OMAP44XX_DMA_MMC5_TX 59 /* S_DMA_58 */
370#define OMAP44XX_DMA_MMC5_RX 60 /* S_DMA_59 */
371#define OMAP44XX_DMA_MMC1_TX 61 /* S_DMA_60 */
372#define OMAP44XX_DMA_MMC1_RX 62 /* S_DMA_61 */
373#define OMAP44XX_DMA_SYS_REQ3 64 /* S_DMA_63 */
374#define OMAP44XX_DMA_MCPDM_UP 65 /* S_DMA_64 */
375#define OMAP44XX_DMA_MCPDM_DL 66 /* S_DMA_65 */
376#define OMAP44XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
377#define OMAP44XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
378#define OMAP44XX_DMA_DSS_DSI1_REQ0 72 /* S_DMA_71 */
379#define OMAP44XX_DMA_DSS_DSI1_REQ1 73 /* S_DMA_72 */
380#define OMAP44XX_DMA_DSS_DSI1_REQ2 74 /* S_DMA_73 */
381#define OMAP44XX_DMA_DSS_DSI1_REQ3 75 /* S_DMA_74 */
382#define OMAP44XX_DMA_DSS_HDMI_REQ 76 /* S_DMA_75 */
383#define OMAP44XX_DMA_MMC3_TX 77 /* S_DMA_76 */
384#define OMAP44XX_DMA_MMC3_RX 78 /* S_DMA_77 */
385#define OMAP44XX_DMA_USIM_TX 79 /* S_DMA_78 */
386#define OMAP44XX_DMA_USIM_RX 80 /* S_DMA_79 */
387#define OMAP44XX_DMA_DSS_DSI2_REQ0 81 /* S_DMA_80 */
388#define OMAP44XX_DMA_DSS_DSI2_REQ1 82 /* S_DMA_81 */
389#define OMAP44XX_DMA_DSS_DSI2_REQ2 83 /* S_DMA_82 */
390#define OMAP44XX_DMA_DSS_DSI2_REQ3 84 /* S_DMA_83 */
391#define OMAP44XX_DMA_ABE_REQ0 101 /* S_DMA_100 */
392#define OMAP44XX_DMA_ABE_REQ1 102 /* S_DMA_101 */
393#define OMAP44XX_DMA_ABE_REQ2 103 /* S_DMA_102 */
394#define OMAP44XX_DMA_ABE_REQ3 104 /* S_DMA_103 */
395#define OMAP44XX_DMA_ABE_REQ4 105 /* S_DMA_104 */
396#define OMAP44XX_DMA_ABE_REQ5 106 /* S_DMA_105 */
397#define OMAP44XX_DMA_ABE_REQ6 107 /* S_DMA_106 */
398#define OMAP44XX_DMA_ABE_REQ7 108 /* S_DMA_107 */
399#define OMAP44XX_DMA_I2C4_TX 124 /* S_DMA_123 */
400#define OMAP44XX_DMA_I2C4_RX 125 /* S_DMA_124 */
401
402/*----------------------------------------------------------------------------*/ 322/*----------------------------------------------------------------------------*/
403 323
404#define OMAP1_DMA_TOUT_IRQ (1 << 0) 324#define OMAP1_DMA_TOUT_IRQ (1 << 0)
diff --git a/arch/arm/plat-omap/include/plat/flash.h b/arch/arm/plat-omap/include/plat/flash.h
new file mode 100644
index 000000000000..3e6327016b40
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/flash.h
@@ -0,0 +1,16 @@
1/*
2 * Flash support for OMAP1
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __OMAP_FLASH_H
10#define __OMAP_FLASH_H
11
12#include <linux/mtd/map.h>
13
14extern void omap1_set_vpp(struct map_info *map, int enable);
15
16#endif
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/plat-omap/include/plat/gpmc.h
index e081338e0b23..145838a81ef6 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/plat-omap/include/plat/gpmc.h
@@ -27,6 +27,8 @@
27 27
28#define GPMC_CONFIG 0x50 28#define GPMC_CONFIG 0x50
29#define GPMC_STATUS 0x54 29#define GPMC_STATUS 0x54
30#define GPMC_CS0_BASE 0x60
31#define GPMC_CS_SIZE 0x30
30 32
31#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31) 33#define GPMC_CONFIG1_WRAPBURST_SUPP (1 << 31)
32#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30) 34#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
@@ -110,6 +112,6 @@ extern void gpmc_prefetch_reset(void);
110extern int gpmc_prefetch_status(void); 112extern int gpmc_prefetch_status(void);
111extern void omap3_gpmc_save_context(void); 113extern void omap3_gpmc_save_context(void);
112extern void omap3_gpmc_restore_context(void); 114extern void omap3_gpmc_restore_context(void);
113extern void __init gpmc_init(void); 115extern void gpmc_init(void);
114 116
115#endif 117#endif
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
index 585d9ca68b97..87f6bf2ea4fa 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -34,6 +34,5 @@ static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
34} 34}
35#endif 35#endif
36 36
37int omap_plat_register_i2c_bus(int bus_id, u32 clkrate, 37void __init omap1_i2c_mux_pins(int bus_id);
38 struct i2c_board_info const *info, 38void __init omap2_i2c_mux_pins(int bus_id);
39 unsigned len);
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index 7e5319f907d1..128b549c2796 100644
--- a/arch/arm/plat-omap/include/plat/io.h
+++ b/arch/arm/plat-omap/include/plat/io.h
@@ -122,16 +122,21 @@
122#define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET) 122#define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET)
123#define OMAP243X_SMS_SIZE SZ_1M 123#define OMAP243X_SMS_SIZE SZ_1M
124 124
125/* DSP */ 125/* 2420 IVA */
126#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE /* 0x58000000 */ 126#define DSP_MEM_2420_PHYS OMAP2420_DSP_MEM_BASE
127#define DSP_MEM_24XX_VIRT 0xe0000000 127 /* 0x58000000 --> 0xfc100000 */
128#define DSP_MEM_24XX_SIZE 0x28000 128#define DSP_MEM_2420_VIRT 0xfc100000
129#define DSP_IPI_24XX_PHYS OMAP2420_DSP_IPI_BASE /* 0x59000000 */ 129#define DSP_MEM_2420_SIZE 0x28000
130#define DSP_IPI_24XX_VIRT 0xe1000000 130#define DSP_IPI_2420_PHYS OMAP2420_DSP_IPI_BASE
131#define DSP_IPI_24XX_SIZE SZ_4K 131 /* 0x59000000 --> 0xfc128000 */
132#define DSP_MMU_24XX_PHYS OMAP2420_DSP_MMU_BASE /* 0x5a000000 */ 132#define DSP_IPI_2420_VIRT 0xfc128000
133#define DSP_MMU_24XX_VIRT 0xe2000000 133#define DSP_IPI_2420_SIZE SZ_4K
134#define DSP_MMU_24XX_SIZE SZ_4K 134#define DSP_MMU_2420_PHYS OMAP2420_DSP_MMU_BASE
135 /* 0x5a000000 --> 0xfc129000 */
136#define DSP_MMU_2420_VIRT 0xfc129000
137#define DSP_MMU_2420_SIZE SZ_4K
138
139/* 2430 IVA2.1 - currently unmapped */
135 140
136/* 141/*
137 * ---------------------------------------------------------------------------- 142 * ----------------------------------------------------------------------------
@@ -153,10 +158,6 @@
153 * VPOM3430 was not working for Int controller 158 * VPOM3430 was not working for Int controller
154 */ 159 */
155 160
156#define L4_WK_34XX_PHYS L4_WK_34XX_BASE /* 0x48300000 --> 0xfa300000 */
157#define L4_WK_34XX_VIRT (L4_WK_34XX_PHYS + OMAP2_L4_IO_OFFSET)
158#define L4_WK_34XX_SIZE SZ_1M
159
160#define L4_PER_34XX_PHYS L4_PER_34XX_BASE 161#define L4_PER_34XX_PHYS L4_PER_34XX_BASE
161 /* 0x49000000 --> 0xfb000000 */ 162 /* 0x49000000 --> 0xfb000000 */
162#define L4_PER_34XX_VIRT (L4_PER_34XX_PHYS + OMAP2_L4_IO_OFFSET) 163#define L4_PER_34XX_VIRT (L4_PER_34XX_PHYS + OMAP2_L4_IO_OFFSET)
@@ -182,16 +183,7 @@
182#define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET) 183#define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET)
183#define OMAP343X_SDRC_SIZE SZ_1M 184#define OMAP343X_SDRC_SIZE SZ_1M
184 185
185/* DSP */ 186/* 3430 IVA - currently unmapped */
186#define DSP_MEM_34XX_PHYS OMAP34XX_DSP_MEM_BASE /* 0x58000000 */
187#define DSP_MEM_34XX_VIRT 0xe0000000
188#define DSP_MEM_34XX_SIZE 0x28000
189#define DSP_IPI_34XX_PHYS OMAP34XX_DSP_IPI_BASE /* 0x59000000 */
190#define DSP_IPI_34XX_VIRT 0xe1000000
191#define DSP_IPI_34XX_SIZE SZ_4K
192#define DSP_MMU_34XX_PHYS OMAP34XX_DSP_MMU_BASE /* 0x5a000000 */
193#define DSP_MMU_34XX_VIRT 0xe2000000
194#define DSP_MMU_34XX_SIZE SZ_4K
195 187
196/* 188/*
197 * ---------------------------------------------------------------------------- 189 * ----------------------------------------------------------------------------
@@ -208,11 +200,6 @@
208#define L4_44XX_VIRT (L4_44XX_PHYS + OMAP2_L4_IO_OFFSET) 200#define L4_44XX_VIRT (L4_44XX_PHYS + OMAP2_L4_IO_OFFSET)
209#define L4_44XX_SIZE SZ_4M 201#define L4_44XX_SIZE SZ_4M
210 202
211
212#define L4_WK_44XX_PHYS L4_WK_44XX_BASE /* 0x4a300000 --> 0xfc300000 */
213#define L4_WK_44XX_VIRT (L4_WK_44XX_PHYS + OMAP2_L4_IO_OFFSET)
214#define L4_WK_44XX_SIZE SZ_1M
215
216#define L4_PER_44XX_PHYS L4_PER_44XX_BASE 203#define L4_PER_44XX_PHYS L4_PER_44XX_BASE
217 /* 0x48000000 --> 0xfa000000 */ 204 /* 0x48000000 --> 0xfa000000 */
218#define L4_PER_44XX_VIRT (L4_PER_44XX_PHYS + OMAP2_L4_IO_OFFSET) 205#define L4_PER_44XX_VIRT (L4_PER_44XX_PHYS + OMAP2_L4_IO_OFFSET)
@@ -272,7 +259,38 @@ struct omap_sdrc_params;
272extern void omap1_map_common_io(void); 259extern void omap1_map_common_io(void);
273extern void omap1_init_common_hw(void); 260extern void omap1_init_common_hw(void);
274 261
275extern void omap2_map_common_io(void); 262#ifdef CONFIG_ARCH_OMAP2420
263extern void omap242x_map_common_io(void);
264#else
265static inline void omap242x_map_common_io(void)
266{
267}
268#endif
269
270#ifdef CONFIG_ARCH_OMAP2430
271extern void omap243x_map_common_io(void);
272#else
273static inline void omap243x_map_common_io(void)
274{
275}
276#endif
277
278#ifdef CONFIG_ARCH_OMAP3
279extern void omap34xx_map_common_io(void);
280#else
281static inline void omap34xx_map_common_io(void)
282{
283}
284#endif
285
286#ifdef CONFIG_ARCH_OMAP4
287extern void omap44xx_map_common_io(void);
288#else
289static inline void omap44xx_map_common_io(void)
290{
291}
292#endif
293
276extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0, 294extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
277 struct omap_sdrc_params *sdrc_cs1); 295 struct omap_sdrc_params *sdrc_cs1);
278 296
diff --git a/arch/arm/plat-omap/include/plat/irqs-44xx.h b/arch/arm/plat-omap/include/plat/irqs-44xx.h
new file mode 100644
index 000000000000..518322c80116
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/irqs-44xx.h
@@ -0,0 +1,144 @@
1/*
2 * OMAP4 Interrupt lines definitions
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 *
6 * Santosh Shilimkar (santosh.shilimkar@ti.com)
7 * Benoit Cousson (b-cousson@ti.com)
8 *
9 * This file is automatically generated from the OMAP hardware databases.
10 * We respectfully ask that any modifications to this file be coordinated
11 * with the public linux-omap@vger.kernel.org mailing list and the
12 * authors above to ensure that the autogeneration scripts are kept
13 * up-to-date with the file contents.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_IRQS_H
21#define __ARCH_ARM_MACH_OMAP2_OMAP44XX_IRQS_H
22
23/* OMAP44XX IRQs numbers definitions */
24#define OMAP44XX_IRQ_LOCALTIMER 29
25#define OMAP44XX_IRQ_LOCALWDT 30
26
27#define OMAP44XX_IRQ_GIC_START 32
28
29#define OMAP44XX_IRQ_PL310 (0 + OMAP44XX_IRQ_GIC_START)
30#define OMAP44XX_IRQ_CTI0 (1 + OMAP44XX_IRQ_GIC_START)
31#define OMAP44XX_IRQ_CTI1 (2 + OMAP44XX_IRQ_GIC_START)
32#define OMAP44XX_IRQ_ELM (4 + OMAP44XX_IRQ_GIC_START)
33#define OMAP44XX_IRQ_SYS_1N (7 + OMAP44XX_IRQ_GIC_START)
34#define OMAP44XX_IRQ_SECURITY_EVENTS (8 + OMAP44XX_IRQ_GIC_START)
35#define OMAP44XX_IRQ_L3_DBG (9 + OMAP44XX_IRQ_GIC_START)
36#define OMAP44XX_IRQ_L3_APP (10 + OMAP44XX_IRQ_GIC_START)
37#define OMAP44XX_IRQ_PRCM (11 + OMAP44XX_IRQ_GIC_START)
38#define OMAP44XX_IRQ_SDMA_0 (12 + OMAP44XX_IRQ_GIC_START)
39#define OMAP44XX_IRQ_SDMA_1 (13 + OMAP44XX_IRQ_GIC_START)
40#define OMAP44XX_IRQ_SDMA_2 (14 + OMAP44XX_IRQ_GIC_START)
41#define OMAP44XX_IRQ_SDMA_3 (15 + OMAP44XX_IRQ_GIC_START)
42#define OMAP44XX_IRQ_MCBSP4 (16 + OMAP44XX_IRQ_GIC_START)
43#define OMAP44XX_IRQ_MCBSP1 (17 + OMAP44XX_IRQ_GIC_START)
44#define OMAP44XX_IRQ_SR_MCU (18 + OMAP44XX_IRQ_GIC_START)
45#define OMAP44XX_IRQ_SR_CORE (19 + OMAP44XX_IRQ_GIC_START)
46#define OMAP44XX_IRQ_GPMC (20 + OMAP44XX_IRQ_GIC_START)
47#define OMAP44XX_IRQ_GFX (21 + OMAP44XX_IRQ_GIC_START)
48#define OMAP44XX_IRQ_MCBSP2 (22 + OMAP44XX_IRQ_GIC_START)
49#define OMAP44XX_IRQ_MCBSP3 (23 + OMAP44XX_IRQ_GIC_START)
50#define OMAP44XX_IRQ_ISS_5 (24 + OMAP44XX_IRQ_GIC_START)
51#define OMAP44XX_IRQ_DSS_DISPC (25 + OMAP44XX_IRQ_GIC_START)
52#define OMAP44XX_IRQ_MAIL_U0 (26 + OMAP44XX_IRQ_GIC_START)
53#define OMAP44XX_IRQ_C2C_SSCM_0 (27 + OMAP44XX_IRQ_GIC_START)
54#define OMAP44XX_IRQ_TESLA_MMU (28 + OMAP44XX_IRQ_GIC_START)
55#define OMAP44XX_IRQ_GPIO1 (29 + OMAP44XX_IRQ_GIC_START)
56#define OMAP44XX_IRQ_GPIO2 (30 + OMAP44XX_IRQ_GIC_START)
57#define OMAP44XX_IRQ_GPIO3 (31 + OMAP44XX_IRQ_GIC_START)
58#define OMAP44XX_IRQ_GPIO4 (32 + OMAP44XX_IRQ_GIC_START)
59#define OMAP44XX_IRQ_GPIO5 (33 + OMAP44XX_IRQ_GIC_START)
60#define OMAP44XX_IRQ_GPIO6 (34 + OMAP44XX_IRQ_GIC_START)
61#define OMAP44XX_IRQ_USIM (35 + OMAP44XX_IRQ_GIC_START)
62#define OMAP44XX_IRQ_WDT3 (36 + OMAP44XX_IRQ_GIC_START)
63#define OMAP44XX_IRQ_GPT1 (37 + OMAP44XX_IRQ_GIC_START)
64#define OMAP44XX_IRQ_GPT2 (38 + OMAP44XX_IRQ_GIC_START)
65#define OMAP44XX_IRQ_GPT3 (39 + OMAP44XX_IRQ_GIC_START)
66#define OMAP44XX_IRQ_GPT4 (40 + OMAP44XX_IRQ_GIC_START)
67#define OMAP44XX_IRQ_GPT5 (41 + OMAP44XX_IRQ_GIC_START)
68#define OMAP44XX_IRQ_GPT6 (42 + OMAP44XX_IRQ_GIC_START)
69#define OMAP44XX_IRQ_GPT7 (43 + OMAP44XX_IRQ_GIC_START)
70#define OMAP44XX_IRQ_GPT8 (44 + OMAP44XX_IRQ_GIC_START)
71#define OMAP44XX_IRQ_GPT9 (45 + OMAP44XX_IRQ_GIC_START)
72#define OMAP44XX_IRQ_GPT10 (46 + OMAP44XX_IRQ_GIC_START)
73#define OMAP44XX_IRQ_GPT11 (47 + OMAP44XX_IRQ_GIC_START)
74#define OMAP44XX_IRQ_SPI4 (48 + OMAP44XX_IRQ_GIC_START)
75#define OMAP44XX_IRQ_SHA1_S (49 + OMAP44XX_IRQ_GIC_START)
76#define OMAP44XX_IRQ_FPKA_SINTREQUEST_S (50 + OMAP44XX_IRQ_GIC_START)
77#define OMAP44XX_IRQ_SHA1_P (51 + OMAP44XX_IRQ_GIC_START)
78#define OMAP44XX_IRQ_RNG (52 + OMAP44XX_IRQ_GIC_START)
79#define OMAP44XX_IRQ_DSS_DSI1 (53 + OMAP44XX_IRQ_GIC_START)
80#define OMAP44XX_IRQ_I2C1 (56 + OMAP44XX_IRQ_GIC_START)
81#define OMAP44XX_IRQ_I2C2 (57 + OMAP44XX_IRQ_GIC_START)
82#define OMAP44XX_IRQ_HDQ (58 + OMAP44XX_IRQ_GIC_START)
83#define OMAP44XX_IRQ_MMC5 (59 + OMAP44XX_IRQ_GIC_START)
84#define OMAP44XX_IRQ_I2C3 (61 + OMAP44XX_IRQ_GIC_START)
85#define OMAP44XX_IRQ_I2C4 (62 + OMAP44XX_IRQ_GIC_START)
86#define OMAP44XX_IRQ_AES2_S (63 + OMAP44XX_IRQ_GIC_START)
87#define OMAP44XX_IRQ_AES2_P (64 + OMAP44XX_IRQ_GIC_START)
88#define OMAP44XX_IRQ_SPI1 (65 + OMAP44XX_IRQ_GIC_START)
89#define OMAP44XX_IRQ_SPI2 (66 + OMAP44XX_IRQ_GIC_START)
90#define OMAP44XX_IRQ_HSI_P1 (67 + OMAP44XX_IRQ_GIC_START)
91#define OMAP44XX_IRQ_HSI_P2 (68 + OMAP44XX_IRQ_GIC_START)
92#define OMAP44XX_IRQ_FDIF_3 (69 + OMAP44XX_IRQ_GIC_START)
93#define OMAP44XX_IRQ_UART4 (70 + OMAP44XX_IRQ_GIC_START)
94#define OMAP44XX_IRQ_HSI_DMA (71 + OMAP44XX_IRQ_GIC_START)
95#define OMAP44XX_IRQ_UART1 (72 + OMAP44XX_IRQ_GIC_START)
96#define OMAP44XX_IRQ_UART2 (73 + OMAP44XX_IRQ_GIC_START)
97#define OMAP44XX_IRQ_UART3 (74 + OMAP44XX_IRQ_GIC_START)
98#define OMAP44XX_IRQ_PBIAS (75 + OMAP44XX_IRQ_GIC_START)
99#define OMAP44XX_IRQ_OHCI (76 + OMAP44XX_IRQ_GIC_START)
100#define OMAP44XX_IRQ_EHCI (77 + OMAP44XX_IRQ_GIC_START)
101#define OMAP44XX_IRQ_TLL (78 + OMAP44XX_IRQ_GIC_START)
102#define OMAP44XX_IRQ_AES1_S (79 + OMAP44XX_IRQ_GIC_START)
103#define OMAP44XX_IRQ_WDT2 (80 + OMAP44XX_IRQ_GIC_START)
104#define OMAP44XX_IRQ_DES_S (81 + OMAP44XX_IRQ_GIC_START)
105#define OMAP44XX_IRQ_DES_P (82 + OMAP44XX_IRQ_GIC_START)
106#define OMAP44XX_IRQ_MMC1 (83 + OMAP44XX_IRQ_GIC_START)
107#define OMAP44XX_IRQ_DSS_DSI2 (84 + OMAP44XX_IRQ_GIC_START)
108#define OMAP44XX_IRQ_AES1_P (85 + OMAP44XX_IRQ_GIC_START)
109#define OMAP44XX_IRQ_MMC2 (86 + OMAP44XX_IRQ_GIC_START)
110#define OMAP44XX_IRQ_MPU_ICR (87 + OMAP44XX_IRQ_GIC_START)
111#define OMAP44XX_IRQ_C2C_SSCM_1 (88 + OMAP44XX_IRQ_GIC_START)
112#define OMAP44XX_IRQ_FSUSB (89 + OMAP44XX_IRQ_GIC_START)
113#define OMAP44XX_IRQ_FSUSB_SMI (90 + OMAP44XX_IRQ_GIC_START)
114#define OMAP44XX_IRQ_SPI3 (91 + OMAP44XX_IRQ_GIC_START)
115#define OMAP44XX_IRQ_HS_USB_MC_N (92 + OMAP44XX_IRQ_GIC_START)
116#define OMAP44XX_IRQ_HS_USB_DMA_N (93 + OMAP44XX_IRQ_GIC_START)
117#define OMAP44XX_IRQ_MMC3 (94 + OMAP44XX_IRQ_GIC_START)
118#define OMAP44XX_IRQ_GPT12 (95 + OMAP44XX_IRQ_GIC_START)
119#define OMAP44XX_IRQ_MMC4 (96 + OMAP44XX_IRQ_GIC_START)
120#define OMAP44XX_IRQ_SLIMBUS1 (97 + OMAP44XX_IRQ_GIC_START)
121#define OMAP44XX_IRQ_SLIMBUS2 (98 + OMAP44XX_IRQ_GIC_START)
122#define OMAP44XX_IRQ_ABE (99 + OMAP44XX_IRQ_GIC_START)
123#define OMAP44XX_IRQ_DUCATI_MMU (100 + OMAP44XX_IRQ_GIC_START)
124#define OMAP44XX_IRQ_DSS_HDMI (101 + OMAP44XX_IRQ_GIC_START)
125#define OMAP44XX_IRQ_SR_IVA (102 + OMAP44XX_IRQ_GIC_START)
126#define OMAP44XX_IRQ_IVA_HD_POSYNCITRPEND_1 (103 + OMAP44XX_IRQ_GIC_START)
127#define OMAP44XX_IRQ_IVA_HD_POSYNCITRPEND_0 (104 + OMAP44XX_IRQ_GIC_START)
128#define OMAP44XX_IRQ_IVA_HD_POMBINTRPEND_0 (107 + OMAP44XX_IRQ_GIC_START)
129#define OMAP44XX_IRQ_MCASP1_AR (108 + OMAP44XX_IRQ_GIC_START)
130#define OMAP44XX_IRQ_MCASP1_AX (109 + OMAP44XX_IRQ_GIC_START)
131#define OMAP44XX_IRQ_EMIF4_1 (110 + OMAP44XX_IRQ_GIC_START)
132#define OMAP44XX_IRQ_EMIF4_2 (111 + OMAP44XX_IRQ_GIC_START)
133#define OMAP44XX_IRQ_MCPDM (112 + OMAP44XX_IRQ_GIC_START)
134#define OMAP44XX_IRQ_DMM (113 + OMAP44XX_IRQ_GIC_START)
135#define OMAP44XX_IRQ_DMIC (114 + OMAP44XX_IRQ_GIC_START)
136#define OMAP44XX_IRQ_CDMA_0 (115 + OMAP44XX_IRQ_GIC_START)
137#define OMAP44XX_IRQ_CDMA_1 (116 + OMAP44XX_IRQ_GIC_START)
138#define OMAP44XX_IRQ_CDMA_2 (117 + OMAP44XX_IRQ_GIC_START)
139#define OMAP44XX_IRQ_CDMA_3 (118 + OMAP44XX_IRQ_GIC_START)
140#define OMAP44XX_IRQ_SYS_2N (119 + OMAP44XX_IRQ_GIC_START)
141#define OMAP44XX_IRQ_KBD_CTL (120 + OMAP44XX_IRQ_GIC_START)
142#define OMAP44XX_IRQ_UNIPRO1 (124 + OMAP44XX_IRQ_GIC_START)
143
144#endif
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 97d6c50c3dcb..b65088a869e9 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -28,6 +28,9 @@
28#ifndef __ASM_ARCH_OMAP15XX_IRQS_H 28#ifndef __ASM_ARCH_OMAP15XX_IRQS_H
29#define __ASM_ARCH_OMAP15XX_IRQS_H 29#define __ASM_ARCH_OMAP15XX_IRQS_H
30 30
31/* All OMAP4 specific defines are moved to irqs-44xx.h */
32#include "irqs-44xx.h"
33
31/* 34/*
32 * IRQ numbers for interrupt handler 1 35 * IRQ numbers for interrupt handler 1
33 * 36 *
@@ -344,95 +347,16 @@
344 347
345#define INT_34XX_BENCH_MPU_EMUL 3 348#define INT_34XX_BENCH_MPU_EMUL 3
346 349
347 350#define INT_35XX_HECC0_IRQ 24
348#define IRQ_GIC_START 32 351#define INT_35XX_HECC1_IRQ 28
349#define INT_44XX_LOCALTIMER_IRQ 29 352#define INT_35XX_EMAC_C0_RXTHRESH_IRQ 67
350#define INT_44XX_LOCALWDT_IRQ 30 353#define INT_35XX_EMAC_C0_RX_PULSE_IRQ 68
351 354#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69
352#define INT_44XX_BENCH_MPU_EMUL (3 + IRQ_GIC_START) 355#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70
353#define INT_44XX_SSM_ABORT_IRQ (6 + IRQ_GIC_START) 356#define INT_35XX_USBOTG_IRQ 71
354#define INT_44XX_SYS_NIRQ (7 + IRQ_GIC_START) 357#define INT_35XX_CCDC_VD0_IRQ 88
355#define INT_44XX_D2D_FW_IRQ (8 + IRQ_GIC_START) 358#define INT_35XX_CCDC_VD1_IRQ 92
356#define INT_44XX_PRCM_MPU_IRQ (11 + IRQ_GIC_START) 359#define INT_35XX_CCDC_VD2_IRQ 93
357#define INT_44XX_SDMA_IRQ0 (12 + IRQ_GIC_START)
358#define INT_44XX_SDMA_IRQ1 (13 + IRQ_GIC_START)
359#define INT_44XX_SDMA_IRQ2 (14 + IRQ_GIC_START)
360#define INT_44XX_SDMA_IRQ3 (15 + IRQ_GIC_START)
361#define INT_44XX_ISS_IRQ (24 + IRQ_GIC_START)
362#define INT_44XX_DSS_IRQ (25 + IRQ_GIC_START)
363#define INT_44XX_MAIL_U0_MPU (26 + IRQ_GIC_START)
364#define INT_44XX_DSP_MMU (28 + IRQ_GIC_START)
365#define INT_44XX_GPTIMER1 (37 + IRQ_GIC_START)
366#define INT_44XX_GPTIMER2 (38 + IRQ_GIC_START)
367#define INT_44XX_GPTIMER3 (39 + IRQ_GIC_START)
368#define INT_44XX_GPTIMER4 (40 + IRQ_GIC_START)
369#define INT_44XX_GPTIMER5 (41 + IRQ_GIC_START)
370#define INT_44XX_GPTIMER6 (42 + IRQ_GIC_START)
371#define INT_44XX_GPTIMER7 (43 + IRQ_GIC_START)
372#define INT_44XX_GPTIMER8 (44 + IRQ_GIC_START)
373#define INT_44XX_GPTIMER9 (45 + IRQ_GIC_START)
374#define INT_44XX_GPTIMER10 (46 + IRQ_GIC_START)
375#define INT_44XX_GPTIMER11 (47 + IRQ_GIC_START)
376#define INT_44XX_GPTIMER12 (95 + IRQ_GIC_START)
377#define INT_44XX_SHA1MD5 (51 + IRQ_GIC_START)
378#define INT_44XX_I2C1_IRQ (56 + IRQ_GIC_START)
379#define INT_44XX_I2C2_IRQ (57 + IRQ_GIC_START)
380#define INT_44XX_HDQ_IRQ (58 + IRQ_GIC_START)
381#define INT_44XX_SPI1_IRQ (65 + IRQ_GIC_START)
382#define INT_44XX_SPI2_IRQ (66 + IRQ_GIC_START)
383#define INT_44XX_HSI_1_IRQ0 (67 + IRQ_GIC_START)
384#define INT_44XX_HSI_2_IRQ1 (68 + IRQ_GIC_START)
385#define INT_44XX_HSI_1_DMAIRQ (71 + IRQ_GIC_START)
386#define INT_44XX_UART1_IRQ (72 + IRQ_GIC_START)
387#define INT_44XX_UART2_IRQ (73 + IRQ_GIC_START)
388#define INT_44XX_UART3_IRQ (74 + IRQ_GIC_START)
389#define INT_44XX_UART4_IRQ (70 + IRQ_GIC_START)
390#define INT_44XX_USB_IRQ_NISO (76 + IRQ_GIC_START)
391#define INT_44XX_USB_IRQ_ISO (77 + IRQ_GIC_START)
392#define INT_44XX_USB_IRQ_HGEN (78 + IRQ_GIC_START)
393#define INT_44XX_USB_IRQ_HSOF (79 + IRQ_GIC_START)
394#define INT_44XX_USB_IRQ_OTG (80 + IRQ_GIC_START)
395#define INT_44XX_MCBSP4_IRQ_TX (81 + IRQ_GIC_START)
396#define INT_44XX_MCBSP4_IRQ_RX (82 + IRQ_GIC_START)
397#define INT_44XX_MMC_IRQ (83 + IRQ_GIC_START)
398#define INT_44XX_MMC2_IRQ (86 + IRQ_GIC_START)
399#define INT_44XX_MCBSP2_IRQ_TX (89 + IRQ_GIC_START)
400#define INT_44XX_MCBSP2_IRQ_RX (90 + IRQ_GIC_START)
401#define INT_44XX_SPI3_IRQ (91 + IRQ_GIC_START)
402#define INT_44XX_SPI5_IRQ (69 + IRQ_GIC_START)
403
404#define INT_44XX_MCBSP5_IRQ (16 + IRQ_GIC_START)
405#define INT_44xX_MCBSP1_IRQ (17 + IRQ_GIC_START)
406#define INT_44XX_MCBSP2_IRQ (22 + IRQ_GIC_START)
407#define INT_44XX_MCBSP3_IRQ (23 + IRQ_GIC_START)
408#define INT_44XX_MCBSP4_IRQ (27 + IRQ_GIC_START)
409#define INT_44XX_HS_USB_MC (92 + IRQ_GIC_START)
410#define INT_44XX_HS_USB_DMA (93 + IRQ_GIC_START)
411
412#define INT_44XX_GPIO_BANK1 (29 + IRQ_GIC_START)
413#define INT_44XX_GPIO_BANK2 (30 + IRQ_GIC_START)
414#define INT_44XX_GPIO_BANK3 (31 + IRQ_GIC_START)
415#define INT_44XX_GPIO_BANK4 (32 + IRQ_GIC_START)
416#define INT_44XX_GPIO_BANK5 (33 + IRQ_GIC_START)
417#define INT_44XX_GPIO_BANK6 (34 + IRQ_GIC_START)
418#define INT_44XX_USIM_IRQ (35 + IRQ_GIC_START)
419#define INT_44XX_WDT3_IRQ (36 + IRQ_GIC_START)
420#define INT_44XX_SPI4_IRQ (48 + IRQ_GIC_START)
421#define INT_44XX_SHA1MD52_IRQ (49 + IRQ_GIC_START)
422#define INT_44XX_FPKA_READY_IRQ (50 + IRQ_GIC_START)
423#define INT_44XX_SHA1MD51_IRQ (51 + IRQ_GIC_START)
424#define INT_44XX_RNG_IRQ (52 + IRQ_GIC_START)
425#define INT_44XX_MMC5_IRQ (59 + IRQ_GIC_START)
426#define INT_44XX_I2C3_IRQ (61 + IRQ_GIC_START)
427#define INT_44XX_FPKA_ERROR_IRQ (64 + IRQ_GIC_START)
428#define INT_44XX_PBIAS_IRQ (75 + IRQ_GIC_START)
429#define INT_44XX_OHCI_IRQ (76 + IRQ_GIC_START)
430#define INT_44XX_EHCI_IRQ (77 + IRQ_GIC_START)
431#define INT_44XX_TLL_IRQ (78 + IRQ_GIC_START)
432#define INT_44XX_PARTHASH_IRQ (79 + IRQ_GIC_START)
433#define INT_44XX_MMC3_IRQ (94 + IRQ_GIC_START)
434#define INT_44XX_MMC4_IRQ (96 + IRQ_GIC_START)
435
436 360
437/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730/850) and 361/* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730/850) and
438 * 16 MPUIO lines */ 362 * 16 MPUIO lines */
@@ -499,6 +423,9 @@ extern void omap_init_irq(void);
499extern int omap_irq_pending(void); 423extern int omap_irq_pending(void);
500void omap_intc_save_context(void); 424void omap_intc_save_context(void);
501void omap_intc_restore_context(void); 425void omap_intc_restore_context(void);
426void omap3_intc_suspend(void);
427void omap3_intc_prepare_idle(void);
428void omap3_intc_resume_idle(void);
502#endif 429#endif
503 430
504#include <mach/hardware.h> 431#include <mach/hardware.h>
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 4f22e5bb7ff7..39748354ce45 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -49,6 +49,9 @@
49 49
50#define OMAP34XX_MCBSP1_BASE 0x48074000 50#define OMAP34XX_MCBSP1_BASE 0x48074000
51#define OMAP34XX_MCBSP2_BASE 0x49022000 51#define OMAP34XX_MCBSP2_BASE 0x49022000
52#define OMAP34XX_MCBSP2_ST_BASE 0x49028000
53#define OMAP34XX_MCBSP3_BASE 0x49024000
54#define OMAP34XX_MCBSP3_ST_BASE 0x4902A000
52#define OMAP34XX_MCBSP3_BASE 0x49024000 55#define OMAP34XX_MCBSP3_BASE 0x49024000
53#define OMAP34XX_MCBSP4_BASE 0x49026000 56#define OMAP34XX_MCBSP4_BASE 0x49026000
54#define OMAP34XX_MCBSP5_BASE 0x48096000 57#define OMAP34XX_MCBSP5_BASE 0x48096000
@@ -103,8 +106,7 @@
103#define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX 106#define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX
104#define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX 107#define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX
105 108
106#elif defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 109#else
107 defined(CONFIG_ARCH_OMAP4)
108 110
109#define OMAP_MCBSP_REG_DRR2 0x00 111#define OMAP_MCBSP_REG_DRR2 0x00
110#define OMAP_MCBSP_REG_DRR1 0x04 112#define OMAP_MCBSP_REG_DRR1 0x04
@@ -147,6 +149,15 @@
147#define OMAP_MCBSP_REG_WAKEUPEN 0xA8 149#define OMAP_MCBSP_REG_WAKEUPEN 0xA8
148#define OMAP_MCBSP_REG_XCCR 0xAC 150#define OMAP_MCBSP_REG_XCCR 0xAC
149#define OMAP_MCBSP_REG_RCCR 0xB0 151#define OMAP_MCBSP_REG_RCCR 0xB0
152#define OMAP_MCBSP_REG_SSELCR 0xBC
153
154#define OMAP_ST_REG_REV 0x00
155#define OMAP_ST_REG_SYSCONFIG 0x10
156#define OMAP_ST_REG_IRQSTATUS 0x18
157#define OMAP_ST_REG_IRQENABLE 0x1C
158#define OMAP_ST_REG_SGAINCR 0x24
159#define OMAP_ST_REG_SFIRCR 0x28
160#define OMAP_ST_REG_SSELCR 0x2C
150 161
151#define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) 162#define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1)
152#define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) 163#define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1)
@@ -265,6 +276,24 @@
265#define ENAWAKEUP 0x0004 276#define ENAWAKEUP 0x0004
266#define SOFTRST 0x0002 277#define SOFTRST 0x0002
267 278
279/********************** McBSP SSELCR bit definitions ***********************/
280#define SIDETONEEN 0x0400
281
282/********************** McBSP Sidetone SYSCONFIG bit definitions ***********/
283#define ST_AUTOIDLE 0x0001
284
285/********************** McBSP Sidetone SGAINCR bit definitions *************/
286#define ST_CH1GAIN(value) ((value<<16)) /* Bits 16:31 */
287#define ST_CH0GAIN(value) (value) /* Bits 0:15 */
288
289/********************** McBSP Sidetone SFIRCR bit definitions **************/
290#define ST_FIRCOEFF(value) (value) /* Bits 0:15 */
291
292/********************** McBSP Sidetone SSELCR bit definitions **************/
293#define ST_COEFFWRDONE 0x0004
294#define ST_COEFFWREN 0x0002
295#define ST_SIDETONEEN 0x0001
296
268/********************** McBSP DMA operating modes **************************/ 297/********************** McBSP DMA operating modes **************************/
269#define MCBSP_DMA_MODE_ELEMENT 0 298#define MCBSP_DMA_MODE_ELEMENT 0
270#define MCBSP_DMA_MODE_THRESHOLD 1 299#define MCBSP_DMA_MODE_THRESHOLD 1
@@ -374,11 +403,23 @@ struct omap_mcbsp_platform_data {
374 u8 dma_rx_sync, dma_tx_sync; 403 u8 dma_rx_sync, dma_tx_sync;
375 u16 rx_irq, tx_irq; 404 u16 rx_irq, tx_irq;
376 struct omap_mcbsp_ops *ops; 405 struct omap_mcbsp_ops *ops;
377#ifdef CONFIG_ARCH_OMAP34XX 406#ifdef CONFIG_ARCH_OMAP3
407 /* Sidetone block for McBSP 2 and 3 */
408 unsigned long phys_base_st;
378 u16 buffer_size; 409 u16 buffer_size;
379#endif 410#endif
380}; 411};
381 412
413struct omap_mcbsp_st_data {
414 void __iomem *io_base_st;
415 bool running;
416 bool enabled;
417 s16 taps[128]; /* Sidetone filter coefficients */
418 int nr_taps; /* Number of filter coefficients in use */
419 s16 ch0gain;
420 s16 ch1gain;
421};
422
382struct omap_mcbsp { 423struct omap_mcbsp {
383 struct device *dev; 424 struct device *dev;
384 unsigned long phys_base; 425 unsigned long phys_base;
@@ -410,20 +451,22 @@ struct omap_mcbsp {
410 struct omap_mcbsp_platform_data *pdata; 451 struct omap_mcbsp_platform_data *pdata;
411 struct clk *iclk; 452 struct clk *iclk;
412 struct clk *fclk; 453 struct clk *fclk;
413#ifdef CONFIG_ARCH_OMAP34XX 454#ifdef CONFIG_ARCH_OMAP3
455 struct omap_mcbsp_st_data *st_data;
414 int dma_op_mode; 456 int dma_op_mode;
415 u16 max_tx_thres; 457 u16 max_tx_thres;
416 u16 max_rx_thres; 458 u16 max_rx_thres;
417#endif 459#endif
460 void *reg_cache;
418}; 461};
419extern struct omap_mcbsp **mcbsp_ptr; 462extern struct omap_mcbsp **mcbsp_ptr;
420extern int omap_mcbsp_count; 463extern int omap_mcbsp_count, omap_mcbsp_cache_size;
421 464
422int omap_mcbsp_init(void); 465int omap_mcbsp_init(void);
423void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, 466void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
424 int size); 467 int size);
425void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); 468void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
426#ifdef CONFIG_ARCH_OMAP34XX 469#ifdef CONFIG_ARCH_OMAP3
427void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); 470void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
428void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); 471void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
429u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); 472u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
@@ -459,4 +502,21 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf);
459int omap_mcbsp_pollwrite(unsigned int id, u16 buf); 502int omap_mcbsp_pollwrite(unsigned int id, u16 buf);
460int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); 503int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type);
461 504
505#ifdef CONFIG_ARCH_OMAP3
506/* Sidetone specific API */
507int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
508int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain);
509int omap_st_enable(unsigned int id);
510int omap_st_disable(unsigned int id);
511int omap_st_is_enabled(unsigned int id);
512#else
513static inline int omap_st_set_chgain(unsigned int id, int channel,
514 s16 chgain) { return 0; }
515static inline int omap_st_get_chgain(unsigned int id, int channel,
516 s16 *chgain) { return 0; }
517static inline int omap_st_enable(unsigned int id) { return 0; }
518static inline int omap_st_disable(unsigned int id) { return 0; }
519static inline int omap_st_is_enabled(unsigned int id) { return 0; }
520#endif
521
462#endif 522#endif
diff --git a/arch/arm/plat-omap/include/plat/memory.h b/arch/arm/plat-omap/include/plat/memory.h
index 3325f7b49eaa..d5306bee44b2 100644
--- a/arch/arm/plat-omap/include/plat/memory.h
+++ b/arch/arm/plat-omap/include/plat/memory.h
@@ -38,8 +38,7 @@
38 */ 38 */
39#if defined(CONFIG_ARCH_OMAP1) 39#if defined(CONFIG_ARCH_OMAP1)
40#define PHYS_OFFSET UL(0x10000000) 40#define PHYS_OFFSET UL(0x10000000)
41#elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ 41#else
42 defined(CONFIG_ARCH_OMAP4)
43#define PHYS_OFFSET UL(0x80000000) 42#define PHYS_OFFSET UL(0x80000000)
44#endif 43#endif
45 44
diff --git a/arch/arm/plat-omap/include/plat/menelaus.h b/arch/arm/plat-omap/include/plat/menelaus.h
index 3122bf68c7ce..4a970ec62dd1 100644
--- a/arch/arm/plat-omap/include/plat/menelaus.h
+++ b/arch/arm/plat-omap/include/plat/menelaus.h
@@ -40,7 +40,7 @@ extern int menelaus_set_vcore_hw(unsigned int roof_mV, unsigned int floor_mV);
40 40
41extern int menelaus_set_regulator_sleep(int enable, u32 val); 41extern int menelaus_set_regulator_sleep(int enable, u32 val);
42 42
43#if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_MENELAUS) 43#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_MENELAUS)
44#define omap_has_menelaus() 1 44#define omap_has_menelaus() 1
45#else 45#else
46#define omap_has_menelaus() 0 46#define omap_has_menelaus() 0
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index 29937137bf3e..a1bac07c89eb 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -55,12 +55,12 @@ struct omap_mmc_platform_data {
55 unsigned int max_freq; 55 unsigned int max_freq;
56 56
57 /* switch the bus to a new slot */ 57 /* switch the bus to a new slot */
58 int (* switch_slot)(struct device *dev, int slot); 58 int (*switch_slot)(struct device *dev, int slot);
59 /* initialize board-specific MMC functionality, can be NULL if 59 /* initialize board-specific MMC functionality, can be NULL if
60 * not supported */ 60 * not supported */
61 int (* init)(struct device *dev); 61 int (*init)(struct device *dev);
62 void (* cleanup)(struct device *dev); 62 void (*cleanup)(struct device *dev);
63 void (* shutdown)(struct device *dev); 63 void (*shutdown)(struct device *dev);
64 64
65 /* To handle board related suspend/resume functionality for MMC */ 65 /* To handle board related suspend/resume functionality for MMC */
66 int (*suspend)(struct device *dev, int slot); 66 int (*suspend)(struct device *dev, int slot);
@@ -96,14 +96,28 @@ struct omap_mmc_platform_data {
96 /* Try to sleep or power off when possible */ 96 /* Try to sleep or power off when possible */
97 unsigned power_saving:1; 97 unsigned power_saving:1;
98 98
99 /* If using power_saving and the MMC power is not to go off */
100 unsigned no_off:1;
101
102 /* Regulator off remapped to sleep */
103 unsigned vcc_aux_disable_is_sleep:1;
104
99 int switch_pin; /* gpio (card detect) */ 105 int switch_pin; /* gpio (card detect) */
100 int gpio_wp; /* gpio (write protect) */ 106 int gpio_wp; /* gpio (write protect) */
101 107
102 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode); 108 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
103 int (* set_power)(struct device *dev, int slot, int power_on, int vdd); 109 int (*set_power)(struct device *dev, int slot,
104 int (* get_ro)(struct device *dev, int slot); 110 int power_on, int vdd);
111 int (*get_ro)(struct device *dev, int slot);
105 int (*set_sleep)(struct device *dev, int slot, int sleep, 112 int (*set_sleep)(struct device *dev, int slot, int sleep,
106 int vdd, int cardsleep); 113 int vdd, int cardsleep);
114 void (*remux)(struct device *dev, int slot, int power_on);
115 /* Call back before enabling / disabling regulators */
116 void (*before_set_reg)(struct device *dev, int slot,
117 int power_on, int vdd);
118 /* Call back after enabling / disabling regulators */
119 void (*after_set_reg)(struct device *dev, int slot,
120 int power_on, int vdd);
107 121
108 /* return MMC cover switch state, can be NULL if not supported. 122 /* return MMC cover switch state, can be NULL if not supported.
109 * 123 *
@@ -111,14 +125,14 @@ struct omap_mmc_platform_data {
111 * 0 - closed 125 * 0 - closed
112 * 1 - open 126 * 1 - open
113 */ 127 */
114 int (* get_cover_state)(struct device *dev, int slot); 128 int (*get_cover_state)(struct device *dev, int slot);
115 129
116 const char *name; 130 const char *name;
117 u32 ocr_mask; 131 u32 ocr_mask;
118 132
119 /* Card detection IRQs */ 133 /* Card detection IRQs */
120 int card_detect_irq; 134 int card_detect_irq;
121 int (* card_detect)(int irq); 135 int (*card_detect)(struct device *dev, int slot);
122 136
123 unsigned int ban_openended:1; 137 unsigned int ban_openended:1;
124 138
@@ -126,7 +140,8 @@ struct omap_mmc_platform_data {
126}; 140};
127 141
128/* called from board-specific card detection service routine */ 142/* called from board-specific card detection service routine */
129extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed); 143extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
144 int is_closed);
130 145
131#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ 146#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
132 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) 147 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
diff --git a/arch/arm/plat-omap/include/plat/multi.h b/arch/arm/plat-omap/include/plat/multi.h
new file mode 100644
index 000000000000..f235d32cd942
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/multi.h
@@ -0,0 +1,94 @@
1/*
2 * Support for compiling in multiple OMAP processors
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef __PLAT_OMAP_MULTI_H
23#define __PLAT_OMAP_MULTI_H
24
25/*
26 * Test if multicore OMAP support is needed
27 */
28#undef MULTI_OMAP1
29#undef MULTI_OMAP2
30#undef OMAP_NAME
31
32#ifdef CONFIG_ARCH_OMAP730
33# ifdef OMAP_NAME
34# undef MULTI_OMAP1
35# define MULTI_OMAP1
36# else
37# define OMAP_NAME omap730
38# endif
39#endif
40#ifdef CONFIG_ARCH_OMAP850
41# ifdef OMAP_NAME
42# undef MULTI_OMAP1
43# define MULTI_OMAP1
44# else
45# define OMAP_NAME omap850
46# endif
47#endif
48#ifdef CONFIG_ARCH_OMAP15XX
49# ifdef OMAP_NAME
50# undef MULTI_OMAP1
51# define MULTI_OMAP1
52# else
53# define OMAP_NAME omap1510
54# endif
55#endif
56#ifdef CONFIG_ARCH_OMAP16XX
57# ifdef OMAP_NAME
58# undef MULTI_OMAP1
59# define MULTI_OMAP1
60# else
61# define OMAP_NAME omap16xx
62# endif
63#endif
64#if (defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3))
65# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
66# error "OMAP1 and OMAP2 can't be selected at the same time"
67# endif
68#endif
69#ifdef CONFIG_ARCH_OMAP2420
70# ifdef OMAP_NAME
71# undef MULTI_OMAP2
72# define MULTI_OMAP2
73# else
74# define OMAP_NAME omap2420
75# endif
76#endif
77#ifdef CONFIG_ARCH_OMAP2430
78# ifdef OMAP_NAME
79# undef MULTI_OMAP2
80# define MULTI_OMAP2
81# else
82# define OMAP_NAME omap2430
83# endif
84#endif
85#ifdef CONFIG_ARCH_OMAP3430
86# ifdef OMAP_NAME
87# undef MULTI_OMAP2
88# define MULTI_OMAP2
89# else
90# define OMAP_NAME omap3430
91# endif
92#endif
93
94#endif /* __PLAT_OMAP_MULTI_H */
diff --git a/arch/arm/plat-omap/include/plat/mux.h b/arch/arm/plat-omap/include/plat/mux.h
index 8f069cc80350..c7472a28ce24 100644
--- a/arch/arm/plat-omap/include/plat/mux.h
+++ b/arch/arm/plat-omap/include/plat/mux.h
@@ -135,7 +135,7 @@ struct pin_config {
135 const unsigned int mux_reg; 135 const unsigned int mux_reg;
136 unsigned char debug; 136 unsigned char debug;
137 137
138#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP24XX) 138#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2)
139 const unsigned char mask_offset; 139 const unsigned char mask_offset;
140 const unsigned char mask; 140 const unsigned char mask;
141 141
@@ -183,6 +183,14 @@ enum omap7xx_index {
183 /* I2C */ 183 /* I2C */
184 I2C_7XX_SCL, 184 I2C_7XX_SCL,
185 I2C_7XX_SDA, 185 I2C_7XX_SDA,
186
187 /* SPI */
188 SPI_7XX_1,
189 SPI_7XX_2,
190 SPI_7XX_3,
191 SPI_7XX_4,
192 SPI_7XX_5,
193 SPI_7XX_6,
186}; 194};
187 195
188enum omap1xxx_index { 196enum omap1xxx_index {
diff --git a/arch/arm/plat-omap/include/plat/nand.h b/arch/arm/plat-omap/include/plat/nand.h
index 631a7bed1eef..6ba88d2630d9 100644
--- a/arch/arm/plat-omap/include/plat/nand.h
+++ b/arch/arm/plat-omap/include/plat/nand.h
@@ -15,10 +15,18 @@ struct omap_nand_platform_data {
15 int cs; 15 int cs;
16 int gpio_irq; 16 int gpio_irq;
17 struct mtd_partition *parts; 17 struct mtd_partition *parts;
18 struct gpmc_timings *gpmc_t;
18 int nr_parts; 19 int nr_parts;
19 int (*nand_setup)(void __iomem *); 20 int (*nand_setup)(void);
20 int (*dev_ready)(struct omap_nand_platform_data *); 21 int (*dev_ready)(struct omap_nand_platform_data *);
21 int dma_channel; 22 int dma_channel;
23 unsigned long phys_base;
22 void __iomem *gpmc_cs_baseaddr; 24 void __iomem *gpmc_cs_baseaddr;
23 void __iomem *gpmc_baseaddr; 25 void __iomem *gpmc_baseaddr;
26 int devsize;
24}; 27};
28
29/* size (4 KiB) for IO mapping */
30#define NAND_IO_SIZE SZ_4K
31
32extern int gpmc_nand_init(struct omap_nand_platform_data *d);
diff --git a/arch/arm/plat-omap/include/plat/omap16xx.h b/arch/arm/plat-omap/include/plat/omap16xx.h
index 7560b4d583a3..e69e1d857b45 100644
--- a/arch/arm/plat-omap/include/plat/omap16xx.h
+++ b/arch/arm/plat-omap/include/plat/omap16xx.h
@@ -125,43 +125,43 @@
125#define OMAP16XX_MMCSD2_SSW_MPU_CONF (TIPB_SWITCH_BASE + 0x160) 125#define OMAP16XX_MMCSD2_SSW_MPU_CONF (TIPB_SWITCH_BASE + 0x160)
126 126
127/* UART3 Registers Mapping through MPU bus */ 127/* UART3 Registers Mapping through MPU bus */
128#define UART3_RHR (OMAP_UART3_BASE + 0) 128#define UART3_RHR (OMAP1_UART3_BASE + 0)
129#define UART3_THR (OMAP_UART3_BASE + 0) 129#define UART3_THR (OMAP1_UART3_BASE + 0)
130#define UART3_DLL (OMAP_UART3_BASE + 0) 130#define UART3_DLL (OMAP1_UART3_BASE + 0)
131#define UART3_IER (OMAP_UART3_BASE + 4) 131#define UART3_IER (OMAP1_UART3_BASE + 4)
132#define UART3_DLH (OMAP_UART3_BASE + 4) 132#define UART3_DLH (OMAP1_UART3_BASE + 4)
133#define UART3_IIR (OMAP_UART3_BASE + 8) 133#define UART3_IIR (OMAP1_UART3_BASE + 8)
134#define UART3_FCR (OMAP_UART3_BASE + 8) 134#define UART3_FCR (OMAP1_UART3_BASE + 8)
135#define UART3_EFR (OMAP_UART3_BASE + 8) 135#define UART3_EFR (OMAP1_UART3_BASE + 8)
136#define UART3_LCR (OMAP_UART3_BASE + 0x0C) 136#define UART3_LCR (OMAP1_UART3_BASE + 0x0C)
137#define UART3_MCR (OMAP_UART3_BASE + 0x10) 137#define UART3_MCR (OMAP1_UART3_BASE + 0x10)
138#define UART3_XON1_ADDR1 (OMAP_UART3_BASE + 0x10) 138#define UART3_XON1_ADDR1 (OMAP1_UART3_BASE + 0x10)
139#define UART3_XON2_ADDR2 (OMAP_UART3_BASE + 0x14) 139#define UART3_XON2_ADDR2 (OMAP1_UART3_BASE + 0x14)
140#define UART3_LSR (OMAP_UART3_BASE + 0x14) 140#define UART3_LSR (OMAP1_UART3_BASE + 0x14)
141#define UART3_TCR (OMAP_UART3_BASE + 0x18) 141#define UART3_TCR (OMAP1_UART3_BASE + 0x18)
142#define UART3_MSR (OMAP_UART3_BASE + 0x18) 142#define UART3_MSR (OMAP1_UART3_BASE + 0x18)
143#define UART3_XOFF1 (OMAP_UART3_BASE + 0x18) 143#define UART3_XOFF1 (OMAP1_UART3_BASE + 0x18)
144#define UART3_XOFF2 (OMAP_UART3_BASE + 0x1C) 144#define UART3_XOFF2 (OMAP1_UART3_BASE + 0x1C)
145#define UART3_SPR (OMAP_UART3_BASE + 0x1C) 145#define UART3_SPR (OMAP1_UART3_BASE + 0x1C)
146#define UART3_TLR (OMAP_UART3_BASE + 0x1C) 146#define UART3_TLR (OMAP1_UART3_BASE + 0x1C)
147#define UART3_MDR1 (OMAP_UART3_BASE + 0x20) 147#define UART3_MDR1 (OMAP1_UART3_BASE + 0x20)
148#define UART3_MDR2 (OMAP_UART3_BASE + 0x24) 148#define UART3_MDR2 (OMAP1_UART3_BASE + 0x24)
149#define UART3_SFLSR (OMAP_UART3_BASE + 0x28) 149#define UART3_SFLSR (OMAP1_UART3_BASE + 0x28)
150#define UART3_TXFLL (OMAP_UART3_BASE + 0x28) 150#define UART3_TXFLL (OMAP1_UART3_BASE + 0x28)
151#define UART3_RESUME (OMAP_UART3_BASE + 0x2C) 151#define UART3_RESUME (OMAP1_UART3_BASE + 0x2C)
152#define UART3_TXFLH (OMAP_UART3_BASE + 0x2C) 152#define UART3_TXFLH (OMAP1_UART3_BASE + 0x2C)
153#define UART3_SFREGL (OMAP_UART3_BASE + 0x30) 153#define UART3_SFREGL (OMAP1_UART3_BASE + 0x30)
154#define UART3_RXFLL (OMAP_UART3_BASE + 0x30) 154#define UART3_RXFLL (OMAP1_UART3_BASE + 0x30)
155#define UART3_SFREGH (OMAP_UART3_BASE + 0x34) 155#define UART3_SFREGH (OMAP1_UART3_BASE + 0x34)
156#define UART3_RXFLH (OMAP_UART3_BASE + 0x34) 156#define UART3_RXFLH (OMAP1_UART3_BASE + 0x34)
157#define UART3_BLR (OMAP_UART3_BASE + 0x38) 157#define UART3_BLR (OMAP1_UART3_BASE + 0x38)
158#define UART3_ACREG (OMAP_UART3_BASE + 0x3C) 158#define UART3_ACREG (OMAP1_UART3_BASE + 0x3C)
159#define UART3_DIV16 (OMAP_UART3_BASE + 0x3C) 159#define UART3_DIV16 (OMAP1_UART3_BASE + 0x3C)
160#define UART3_SCR (OMAP_UART3_BASE + 0x40) 160#define UART3_SCR (OMAP1_UART3_BASE + 0x40)
161#define UART3_SSR (OMAP_UART3_BASE + 0x44) 161#define UART3_SSR (OMAP1_UART3_BASE + 0x44)
162#define UART3_EBLR (OMAP_UART3_BASE + 0x48) 162#define UART3_EBLR (OMAP1_UART3_BASE + 0x48)
163#define UART3_OSC_12M_SEL (OMAP_UART3_BASE + 0x4C) 163#define UART3_OSC_12M_SEL (OMAP1_UART3_BASE + 0x4C)
164#define UART3_MVR (OMAP_UART3_BASE + 0x50) 164#define UART3_MVR (OMAP1_UART3_BASE + 0x50)
165 165
166/* 166/*
167 * --------------------------------------------------------------------------- 167 * ---------------------------------------------------------------------------
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h
index 696edfc145a6..7055672a8c68 100644
--- a/arch/arm/plat-omap/include/plat/omap24xx.h
+++ b/arch/arm/plat-omap/include/plat/omap24xx.h
@@ -23,8 +23,8 @@
23 * 23 *
24 */ 24 */
25 25
26#ifndef __ASM_ARCH_OMAP24XX_H 26#ifndef __ASM_ARCH_OMAP2_H
27#define __ASM_ARCH_OMAP24XX_H 27#define __ASM_ARCH_OMAP2_H
28 28
29/* 29/*
30 * Please place only base defines here and put the rest in device 30 * Please place only base defines here and put the rest in device
@@ -85,5 +85,5 @@
85#define OMAP24XX_SEC_AES_BASE (OMAP24XX_SEC_BASE + 0x6000) 85#define OMAP24XX_SEC_AES_BASE (OMAP24XX_SEC_BASE + 0x6000)
86#define OMAP24XX_SEC_PKA_BASE (OMAP24XX_SEC_BASE + 0x8000) 86#define OMAP24XX_SEC_PKA_BASE (OMAP24XX_SEC_BASE + 0x8000)
87 87
88#endif /* __ASM_ARCH_OMAP24XX_H */ 88#endif /* __ASM_ARCH_OMAP2_H */
89 89
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h
index 077f05979f86..2845fdc658b0 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -21,8 +21,8 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#ifndef __ASM_ARCH_OMAP34XX_H 24#ifndef __ASM_ARCH_OMAP3_H
25#define __ASM_ARCH_OMAP34XX_H 25#define __ASM_ARCH_OMAP3_H
26 26
27/* 27/*
28 * Please place only base defines here and put the rest in device 28 * Please place only base defines here and put the rest in device
@@ -82,5 +82,5 @@
82 82
83#define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000) 83#define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000)
84 84
85#endif /* __ASM_ARCH_OMAP34XX_H */ 85#endif /* __ASM_ARCH_OMAP3_H */
86 86
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h
index ef870de43c29..2302474a3748 100644
--- a/arch/arm/plat-omap/include/plat/omap44xx.h
+++ b/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -40,9 +40,13 @@
40#define OMAP44XX_GIC_CPU_BASE 0x48240100 40#define OMAP44XX_GIC_CPU_BASE 0x48240100
41#define OMAP44XX_SCU_BASE 0x48240000 41#define OMAP44XX_SCU_BASE 0x48240000
42#define OMAP44XX_LOCAL_TWD_BASE 0x48240600 42#define OMAP44XX_LOCAL_TWD_BASE 0x48240600
43#define OMAP44XX_L2CACHE_BASE 0x48242000
43#define OMAP44XX_WKUPGEN_BASE 0x48281000 44#define OMAP44XX_WKUPGEN_BASE 0x48281000
45#define OMAP44XX_MCPDM_BASE 0x40132000
46#define OMAP44XX_MCPDM_L3_BASE 0x49032000
44 47
45#define OMAP44XX_MAILBOX_BASE (L4_44XX_BASE + 0xF4000) 48#define OMAP44XX_MAILBOX_BASE (L4_44XX_BASE + 0xF4000)
49#define OMAP44XX_HSUSB_OTG_BASE (L4_44XX_BASE + 0xAB000)
46 50
47#endif /* __ASM_ARCH_OMAP44XX_H */ 51#endif /* __ASM_ARCH_OMAP44XX_H */
48 52
diff --git a/arch/arm/plat-omap/include/plat/omap7xx.h b/arch/arm/plat-omap/include/plat/omap7xx.h
index 53f52414b0e9..48e4757e1e30 100644
--- a/arch/arm/plat-omap/include/plat/omap7xx.h
+++ b/arch/arm/plat-omap/include/plat/omap7xx.h
@@ -46,6 +46,9 @@
46#define OMAP7XX_DSPREG_SIZE SZ_128K 46#define OMAP7XX_DSPREG_SIZE SZ_128K
47#define OMAP7XX_DSPREG_START 0xE1000000 47#define OMAP7XX_DSPREG_START 0xE1000000
48 48
49#define OMAP7XX_SPI1_BASE 0xfffc0800
50#define OMAP7XX_SPI2_BASE 0xfffc1000
51
49/* 52/*
50 * ---------------------------------------------------------------------------- 53 * ----------------------------------------------------------------------------
51 * OMAP7XX specific configuration registers 54 * OMAP7XX specific configuration registers
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index dc1fac1d805c..3694b622c4ac 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -62,6 +62,7 @@
62 * 62 *
63 */ 63 */
64struct omap_device { 64struct omap_device {
65 u32 magic;
65 struct platform_device pdev; 66 struct platform_device pdev;
66 struct omap_hwmod **hwmods; 67 struct omap_hwmod **hwmods;
67 struct omap_device_pm_latency *pm_lats; 68 struct omap_device_pm_latency *pm_lats;
@@ -81,6 +82,7 @@ int omap_device_shutdown(struct platform_device *pdev);
81 82
82/* Core code interface */ 83/* Core code interface */
83 84
85bool omap_device_is_valid(struct omap_device *od);
84int omap_device_count_resources(struct omap_device *od); 86int omap_device_count_resources(struct omap_device *od);
85int omap_device_fill_resources(struct omap_device *od, struct resource *res); 87int omap_device_fill_resources(struct omap_device *od, struct resource *res);
86 88
@@ -88,15 +90,16 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
88 struct omap_hwmod *oh, void *pdata, 90 struct omap_hwmod *oh, void *pdata,
89 int pdata_len, 91 int pdata_len,
90 struct omap_device_pm_latency *pm_lats, 92 struct omap_device_pm_latency *pm_lats,
91 int pm_lats_cnt); 93 int pm_lats_cnt, int is_early_device);
92 94
93struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, 95struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
94 struct omap_hwmod **oh, int oh_cnt, 96 struct omap_hwmod **oh, int oh_cnt,
95 void *pdata, int pdata_len, 97 void *pdata, int pdata_len,
96 struct omap_device_pm_latency *pm_lats, 98 struct omap_device_pm_latency *pm_lats,
97 int pm_lats_cnt); 99 int pm_lats_cnt, int is_early_device);
98 100
99int omap_device_register(struct omap_device *od); 101int omap_device_register(struct omap_device *od);
102int omap_early_device_register(struct omap_device *od);
100 103
101/* OMAP PM interface */ 104/* OMAP PM interface */
102int omap_device_align_pm_lat(struct platform_device *pdev, 105int omap_device_align_pm_lat(struct platform_device *pdev,
@@ -131,11 +134,15 @@ int omap_device_enable_clocks(struct omap_device *od);
131 */ 134 */
132struct omap_device_pm_latency { 135struct omap_device_pm_latency {
133 u32 deactivate_lat; 136 u32 deactivate_lat;
137 u32 deactivate_lat_worst;
134 int (*deactivate_func)(struct omap_device *od); 138 int (*deactivate_func)(struct omap_device *od);
135 u32 activate_lat; 139 u32 activate_lat;
140 u32 activate_lat_worst;
136 int (*activate_func)(struct omap_device *od); 141 int (*activate_func)(struct omap_device *od);
142 u32 flags;
137}; 143};
138 144
145#define OMAP_DEVICE_LATENCY_AUTO_ADJUST BIT(1)
139 146
140/* Get omap_device pointer from platform_device pointer */ 147/* Get omap_device pointer from platform_device pointer */
141#define to_omap_device(x) container_of((x), struct omap_device, pdev) 148#define to_omap_device(x) container_of((x), struct omap_device, pdev)
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 007935a921ea..440b4164f2f6 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Paul Walmsley 5 * Paul Walmsley
6 * 6 *
7 * Created in collaboration with (alphabetical order): Benoit Cousson, 7 * Created in collaboration with (alphabetical order): Benoît Cousson,
8 * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari 8 * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari
9 * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff 9 * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff
10 * 10 *
@@ -33,25 +33,42 @@
33#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H 33#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H
34 34
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/list.h>
36#include <linux/ioport.h> 37#include <linux/ioport.h>
37
38#include <plat/cpu.h> 38#include <plat/cpu.h>
39 39
40struct omap_device; 40struct omap_device;
41 41
42/* OCP SYSCONFIG bit shifts/masks */ 42extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type1;
43#define SYSC_MIDLEMODE_SHIFT 12 43extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2;
44#define SYSC_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT) 44
45#define SYSC_CLOCKACTIVITY_SHIFT 8 45/*
46#define SYSC_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT) 46 * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant
47#define SYSC_SIDLEMODE_SHIFT 3 47 * with the original PRCM protocol defined for OMAP2420
48#define SYSC_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT) 48 */
49#define SYSC_ENAWAKEUP_SHIFT 2 49#define SYSC_TYPE1_MIDLEMODE_SHIFT 12
50#define SYSC_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT) 50#define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT)
51#define SYSC_SOFTRESET_SHIFT 1 51#define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8
52#define SYSC_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT) 52#define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT)
53#define SYSC_AUTOIDLE_SHIFT 0 53#define SYSC_TYPE1_SIDLEMODE_SHIFT 3
54#define SYSC_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT) 54#define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT)
55#define SYSC_TYPE1_ENAWAKEUP_SHIFT 2
56#define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT)
57#define SYSC_TYPE1_SOFTRESET_SHIFT 1
58#define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT)
59#define SYSC_TYPE1_AUTOIDLE_SHIFT 0
60#define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT)
61
62/*
63 * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant
64 * with the new PRCM protocol defined for new OMAP4 IPs.
65 */
66#define SYSC_TYPE2_SOFTRESET_SHIFT 0
67#define SYSC_TYPE2_SOFTRESET_MASK (1 << SYSC_TYPE2_SOFTRESET_SHIFT)
68#define SYSC_TYPE2_SIDLEMODE_SHIFT 2
69#define SYSC_TYPE2_SIDLEMODE_MASK (0x3 << SYSC_TYPE2_SIDLEMODE_SHIFT)
70#define SYSC_TYPE2_MIDLEMODE_SHIFT 4
71#define SYSC_TYPE2_MIDLEMODE_MASK (0x3 << SYSC_TYPE2_MIDLEMODE_SHIFT)
55 72
56/* OCP SYSSTATUS bit shifts/masks */ 73/* OCP SYSSTATUS bit shifts/masks */
57#define SYSS_RESETDONE_SHIFT 0 74#define SYSS_RESETDONE_SHIFT 0
@@ -62,7 +79,6 @@ struct omap_device;
62#define HWMOD_IDLEMODE_NO (1 << 1) 79#define HWMOD_IDLEMODE_NO (1 << 1)
63#define HWMOD_IDLEMODE_SMART (1 << 2) 80#define HWMOD_IDLEMODE_SMART (1 << 2)
64 81
65
66/** 82/**
67 * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod 83 * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod
68 * @name: name of the IRQ channel (module local name) 84 * @name: name of the IRQ channel (module local name)
@@ -94,8 +110,7 @@ struct omap_hwmod_dma_info {
94/** 110/**
95 * struct omap_hwmod_opt_clk - optional clocks used by this hwmod 111 * struct omap_hwmod_opt_clk - optional clocks used by this hwmod
96 * @role: "sys", "32k", "tv", etc -- for use in clk_get() 112 * @role: "sys", "32k", "tv", etc -- for use in clk_get()
97 * @clkdev_dev_id: opt clock: clkdev dev_id string 113 * @clk: opt clock: OMAP clock name
98 * @clkdev_con_id: opt clock: clkdev con_id string
99 * @_clk: pointer to the struct clk (filled in at runtime) 114 * @_clk: pointer to the struct clk (filled in at runtime)
100 * 115 *
101 * The module's interface clock and main functional clock should not 116 * The module's interface clock and main functional clock should not
@@ -103,8 +118,7 @@ struct omap_hwmod_dma_info {
103 */ 118 */
104struct omap_hwmod_opt_clk { 119struct omap_hwmod_opt_clk {
105 const char *role; 120 const char *role;
106 const char *clkdev_dev_id; 121 const char *clk;
107 const char *clkdev_con_id;
108 struct clk *_clk; 122 struct clk *_clk;
109}; 123};
110 124
@@ -171,8 +185,7 @@ struct omap_hwmod_addr_space {
171 * @master: struct omap_hwmod that initiates OCP transactions on this link 185 * @master: struct omap_hwmod that initiates OCP transactions on this link
172 * @slave: struct omap_hwmod that responds to OCP transactions on this link 186 * @slave: struct omap_hwmod that responds to OCP transactions on this link
173 * @addr: address space associated with this link 187 * @addr: address space associated with this link
174 * @clkdev_dev_id: interface clock: clkdev dev_id string 188 * @clk: interface clock: OMAP clock name
175 * @clkdev_con_id: interface clock: clkdev con_id string
176 * @_clk: pointer to the interface struct clk (filled in at runtime) 189 * @_clk: pointer to the interface struct clk (filled in at runtime)
177 * @fw: interface firewall data 190 * @fw: interface firewall data
178 * @addr_cnt: ARRAY_SIZE(@addr) 191 * @addr_cnt: ARRAY_SIZE(@addr)
@@ -191,8 +204,7 @@ struct omap_hwmod_ocp_if {
191 struct omap_hwmod *master; 204 struct omap_hwmod *master;
192 struct omap_hwmod *slave; 205 struct omap_hwmod *slave;
193 struct omap_hwmod_addr_space *addr; 206 struct omap_hwmod_addr_space *addr;
194 const char *clkdev_dev_id; 207 const char *clk;
195 const char *clkdev_con_id;
196 struct clk *_clk; 208 struct clk *_clk;
197 union { 209 union {
198 struct omap_hwmod_omap2_firewall omap2; 210 struct omap_hwmod_omap2_firewall omap2;
@@ -227,6 +239,7 @@ struct omap_hwmod_ocp_if {
227#define SYSC_HAS_SIDLEMODE (1 << 5) 239#define SYSC_HAS_SIDLEMODE (1 << 5)
228#define SYSC_HAS_MIDLEMODE (1 << 6) 240#define SYSC_HAS_MIDLEMODE (1 << 6)
229#define SYSS_MISSING (1 << 7) 241#define SYSS_MISSING (1 << 7)
242#define SYSC_NO_CACHE (1 << 8) /* XXX SW flag, belongs elsewhere */
230 243
231/* omap_hwmod_sysconfig.clockact flags */ 244/* omap_hwmod_sysconfig.clockact flags */
232#define CLOCKACT_TEST_BOTH 0x0 245#define CLOCKACT_TEST_BOTH 0x0
@@ -235,7 +248,25 @@ struct omap_hwmod_ocp_if {
235#define CLOCKACT_TEST_NONE 0x3 248#define CLOCKACT_TEST_NONE 0x3
236 249
237/** 250/**
238 * struct omap_hwmod_sysconfig - hwmod OCP_SYSCONFIG/OCP_SYSSTATUS data 251 * struct omap_hwmod_sysc_fields - hwmod OCP_SYSCONFIG register field offsets.
252 * @midle_shift: Offset of the midle bit
253 * @clkact_shift: Offset of the clockactivity bit
254 * @sidle_shift: Offset of the sidle bit
255 * @enwkup_shift: Offset of the enawakeup bit
256 * @srst_shift: Offset of the softreset bit
257 * @autoidle_shift: Offset of the autoidle bit
258 */
259struct omap_hwmod_sysc_fields {
260 u8 midle_shift;
261 u8 clkact_shift;
262 u8 sidle_shift;
263 u8 enwkup_shift;
264 u8 srst_shift;
265 u8 autoidle_shift;
266};
267
268/**
269 * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data
239 * @rev_offs: IP block revision register offset (from module base addr) 270 * @rev_offs: IP block revision register offset (from module base addr)
240 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 271 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
241 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) 272 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr)
@@ -251,14 +282,22 @@ struct omap_hwmod_ocp_if {
251 * been associated with the clocks marked in @clockact. This field is 282 * been associated with the clocks marked in @clockact. This field is
252 * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) 283 * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below)
253 * 284 *
285 * @sysc_fields: structure containing the offset positions of various bits in
286 * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or
287 * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on
288 * whether the device ip is compliant with the original PRCM protocol
289 * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs.
290 * If the device follows a different scheme for the sysconfig register ,
291 * then this field has to be populated with the correct offset structure.
254 */ 292 */
255struct omap_hwmod_sysconfig { 293struct omap_hwmod_class_sysconfig {
256 u16 rev_offs; 294 u16 rev_offs;
257 u16 sysc_offs; 295 u16 sysc_offs;
258 u16 syss_offs; 296 u16 syss_offs;
259 u8 idlemodes; 297 u8 idlemodes;
260 u8 sysc_flags; 298 u8 sysc_flags;
261 u8 clockact; 299 u8 clockact;
300 struct omap_hwmod_sysc_fields *sysc_fields;
262}; 301};
263 302
264/** 303/**
@@ -351,19 +390,33 @@ struct omap_hwmod_omap4_prcm {
351#define _HWMOD_STATE_DISABLED 6 390#define _HWMOD_STATE_DISABLED 6
352 391
353/** 392/**
393 * struct omap_hwmod_class - the type of an IP block
394 * @name: name of the hwmod_class
395 * @sysc: device SYSCONFIG/SYSSTATUS register data
396 * @rev: revision of the IP class
397 *
398 * Represent the class of a OMAP hardware "modules" (e.g. timer,
399 * smartreflex, gpio, uart...)
400 */
401struct omap_hwmod_class {
402 const char *name;
403 struct omap_hwmod_class_sysconfig *sysc;
404 u32 rev;
405};
406
407/**
354 * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) 408 * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks)
355 * @name: name of the hwmod 409 * @name: name of the hwmod
410 * @class: struct omap_hwmod_class * to the class of this hwmod
356 * @od: struct omap_device currently associated with this hwmod (internal use) 411 * @od: struct omap_device currently associated with this hwmod (internal use)
357 * @mpu_irqs: ptr to an array of MPU IRQs (see also mpu_irqs_cnt) 412 * @mpu_irqs: ptr to an array of MPU IRQs (see also mpu_irqs_cnt)
358 * @sdma_chs: ptr to an array of SDMA channel IDs (see also sdma_chs_cnt) 413 * @sdma_chs: ptr to an array of SDMA channel IDs (see also sdma_chs_cnt)
359 * @prcm: PRCM data pertaining to this hwmod 414 * @prcm: PRCM data pertaining to this hwmod
360 * @clkdev_dev_id: main clock: clkdev dev_id string 415 * @main_clk: main clock: OMAP clock name
361 * @clkdev_con_id: main clock: clkdev con_id string
362 * @_clk: pointer to the main struct clk (filled in at runtime) 416 * @_clk: pointer to the main struct clk (filled in at runtime)
363 * @opt_clks: other device clocks that drivers can request (0..*) 417 * @opt_clks: other device clocks that drivers can request (0..*)
364 * @masters: ptr to array of OCP ifs that this hwmod can initiate on 418 * @masters: ptr to array of OCP ifs that this hwmod can initiate on
365 * @slaves: ptr to array of OCP ifs that this hwmod can respond on 419 * @slaves: ptr to array of OCP ifs that this hwmod can respond on
366 * @sysconfig: device SYSCONFIG/SYSSTATUS register data
367 * @dev_attr: arbitrary device attributes that can be passed to the driver 420 * @dev_attr: arbitrary device attributes that can be passed to the driver
368 * @_sysc_cache: internal-use hwmod flags 421 * @_sysc_cache: internal-use hwmod flags
369 * @_rt_va: cached register target start address (internal use) 422 * @_rt_va: cached register target start address (internal use)
@@ -382,16 +435,17 @@ struct omap_hwmod_omap4_prcm {
382 * @omap_chip: OMAP chips this hwmod is present on 435 * @omap_chip: OMAP chips this hwmod is present on
383 * @node: list node for hwmod list (internal use) 436 * @node: list node for hwmod list (internal use)
384 * 437 *
385 * @clkdev_dev_id, @clkdev_con_id, and @clk all refer to this module's "main 438 * @main_clk refers to this module's "main clock," which for our
386 * clock," which for our purposes is defined as "the functional clock needed 439 * purposes is defined as "the functional clock needed for register
387 * for register accesses to complete." Modules may not have a main clock if 440 * accesses to complete." Modules may not have a main clock if the
388 * the interface clock also serves as a main clock. 441 * interface clock also serves as a main clock.
389 * 442 *
390 * Parameter names beginning with an underscore are managed internally by 443 * Parameter names beginning with an underscore are managed internally by
391 * the omap_hwmod code and should not be set during initialization. 444 * the omap_hwmod code and should not be set during initialization.
392 */ 445 */
393struct omap_hwmod { 446struct omap_hwmod {
394 const char *name; 447 const char *name;
448 struct omap_hwmod_class *class;
395 struct omap_device *od; 449 struct omap_device *od;
396 struct omap_hwmod_irq_info *mpu_irqs; 450 struct omap_hwmod_irq_info *mpu_irqs;
397 struct omap_hwmod_dma_info *sdma_chs; 451 struct omap_hwmod_dma_info *sdma_chs;
@@ -399,13 +453,11 @@ struct omap_hwmod {
399 struct omap_hwmod_omap2_prcm omap2; 453 struct omap_hwmod_omap2_prcm omap2;
400 struct omap_hwmod_omap4_prcm omap4; 454 struct omap_hwmod_omap4_prcm omap4;
401 } prcm; 455 } prcm;
402 const char *clkdev_dev_id; 456 const char *main_clk;
403 const char *clkdev_con_id;
404 struct clk *_clk; 457 struct clk *_clk;
405 struct omap_hwmod_opt_clk *opt_clks; 458 struct omap_hwmod_opt_clk *opt_clks;
406 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 459 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */
407 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 460 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */
408 struct omap_hwmod_sysconfig *sysconfig;
409 void *dev_attr; 461 void *dev_attr;
410 u32 _sysc_cache; 462 u32 _sysc_cache;
411 void __iomem *_rt_va; 463 void __iomem *_rt_va;
@@ -440,6 +492,8 @@ int omap_hwmod_shutdown(struct omap_hwmod *oh);
440int omap_hwmod_enable_clocks(struct omap_hwmod *oh); 492int omap_hwmod_enable_clocks(struct omap_hwmod *oh);
441int omap_hwmod_disable_clocks(struct omap_hwmod *oh); 493int omap_hwmod_disable_clocks(struct omap_hwmod *oh);
442 494
495int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode);
496
443int omap_hwmod_reset(struct omap_hwmod *oh); 497int omap_hwmod_reset(struct omap_hwmod *oh);
444void omap_hwmod_ocp_barrier(struct omap_hwmod *oh); 498void omap_hwmod_ocp_barrier(struct omap_hwmod *oh);
445 499
@@ -464,4 +518,17 @@ int omap_hwmod_set_clockact_none(struct omap_hwmod *oh);
464int omap_hwmod_enable_wakeup(struct omap_hwmod *oh); 518int omap_hwmod_enable_wakeup(struct omap_hwmod *oh);
465int omap_hwmod_disable_wakeup(struct omap_hwmod *oh); 519int omap_hwmod_disable_wakeup(struct omap_hwmod *oh);
466 520
521int omap_hwmod_for_each_by_class(const char *classname,
522 int (*fn)(struct omap_hwmod *oh,
523 void *user),
524 void *user);
525
526/*
527 * Chip variant-specific hwmod init routines - XXX should be converted
528 * to use initcalls once the initial boot ordering is straightened out
529 */
530extern int omap2420_hwmod_init(void);
531extern int omap2430_hwmod_init(void);
532extern int omap3xxx_hwmod_init(void);
533
467#endif 534#endif
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index 0b960051eaed..d82b2c00d4f1 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * OMAP2/3 powerdomain control 2 * OMAP2/3 powerdomain control
3 * 3 *
4 * Copyright (C) 2007-8 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-8 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * 8 *
@@ -37,6 +37,9 @@
37#define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \ 37#define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \
38 (1 << PWRDM_POWER_RET)) 38 (1 << PWRDM_POWER_RET))
39 39
40#define PWRSTS_RET_ON ((1 << PWRDM_POWER_RET) | \
41 (1 << PWRDM_POWER_ON))
42
40#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON)) 43#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON))
41 44
42 45
@@ -48,16 +51,16 @@
48 */ 51 */
49 52
50/* 53/*
51 * Number of memory banks that are power-controllable. On OMAP3430, the 54 * Number of memory banks that are power-controllable. On OMAP4430, the
52 * maximum is 4. 55 * maximum is 5.
53 */ 56 */
54#define PWRDM_MAX_MEM_BANKS 4 57#define PWRDM_MAX_MEM_BANKS 5
55 58
56/* 59/*
57 * Maximum number of clockdomains that can be associated with a powerdomain. 60 * Maximum number of clockdomains that can be associated with a powerdomain.
58 * CORE powerdomain on OMAP3 is the worst case 61 * CORE powerdomain on OMAP4 is the worst case
59 */ 62 */
60#define PWRDM_MAX_CLKDMS 4 63#define PWRDM_MAX_CLKDMS 9
61 64
62/* XXX A completely arbitrary number. What is reasonable here? */ 65/* XXX A completely arbitrary number. What is reasonable here? */
63#define PWRDM_TRANSITION_BAILOUT 100000 66#define PWRDM_TRANSITION_BAILOUT 100000
@@ -65,65 +68,40 @@
65struct clockdomain; 68struct clockdomain;
66struct powerdomain; 69struct powerdomain;
67 70
68/* Encodes dependencies between powerdomains - statically defined */ 71/**
69struct pwrdm_dep { 72 * struct powerdomain - OMAP powerdomain
70 73 * @name: Powerdomain name
71 /* Powerdomain name */ 74 * @omap_chip: represents the OMAP chip types containing this pwrdm
72 const char *pwrdm_name; 75 * @prcm_offs: the address offset from CM_BASE/PRM_BASE
73 76 * @pwrsts: Possible powerdomain power states
74 /* Powerdomain pointer - resolved by the powerdomain code */ 77 * @pwrsts_logic_ret: Possible logic power states when pwrdm in RETENTION
75 struct powerdomain *pwrdm; 78 * @flags: Powerdomain flags
76 79 * @banks: Number of software-controllable memory banks in this powerdomain
77 /* Flags to mark OMAP chip restrictions, etc. */ 80 * @pwrsts_mem_ret: Possible memory bank pwrstates when pwrdm in RETENTION
78 const struct omap_chip_id omap_chip; 81 * @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
79 82 * @pwrdm_clkdms: Clockdomains in this powerdomain
80}; 83 * @node: list_head linking all powerdomains
81 84 * @state:
85 * @state_counter:
86 * @timer:
87 * @state_timer:
88 */
82struct powerdomain { 89struct powerdomain {
83
84 /* Powerdomain name */
85 const char *name; 90 const char *name;
86
87 /* the address offset from CM_BASE/PRM_BASE */
88 const s16 prcm_offs;
89
90 /* Used to represent the OMAP chip types containing this pwrdm */
91 const struct omap_chip_id omap_chip; 91 const struct omap_chip_id omap_chip;
92 92 const s16 prcm_offs;
93 /* Powerdomains that can be told to wake this powerdomain up */
94 struct pwrdm_dep *wkdep_srcs;
95
96 /* Powerdomains that can be told to keep this pwrdm from inactivity */
97 struct pwrdm_dep *sleepdep_srcs;
98
99 /* Bit shift of this powerdomain's PM_WKDEP/CM_SLEEPDEP bit */
100 const u8 dep_bit;
101
102 /* Possible powerdomain power states */
103 const u8 pwrsts; 93 const u8 pwrsts;
104
105 /* Possible logic power states when pwrdm in RETENTION */
106 const u8 pwrsts_logic_ret; 94 const u8 pwrsts_logic_ret;
107
108 /* Powerdomain flags */
109 const u8 flags; 95 const u8 flags;
110
111 /* Number of software-controllable memory banks in this powerdomain */
112 const u8 banks; 96 const u8 banks;
113
114 /* Possible memory bank pwrstates when pwrdm in RETENTION */
115 const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS]; 97 const u8 pwrsts_mem_ret[PWRDM_MAX_MEM_BANKS];
116
117 /* Possible memory bank pwrstates when pwrdm is ON */
118 const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS]; 98 const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS];
119
120 /* Clockdomains in this powerdomain */
121 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS]; 99 struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS];
122
123 struct list_head node; 100 struct list_head node;
124
125 int state; 101 int state;
126 unsigned state_counter[PWRDM_MAX_PWRSTS]; 102 unsigned state_counter[PWRDM_MAX_PWRSTS];
103 unsigned ret_logic_off_counter;
104 unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS];
127 105
128#ifdef CONFIG_PM_DEBUG 106#ifdef CONFIG_PM_DEBUG
129 s64 timer; 107 s64 timer;
@@ -134,8 +112,6 @@ struct powerdomain {
134 112
135void pwrdm_init(struct powerdomain **pwrdm_list); 113void pwrdm_init(struct powerdomain **pwrdm_list);
136 114
137int pwrdm_register(struct powerdomain *pwrdm);
138int pwrdm_unregister(struct powerdomain *pwrdm);
139struct powerdomain *pwrdm_lookup(const char *name); 115struct powerdomain *pwrdm_lookup(const char *name);
140 116
141int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), 117int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
@@ -149,13 +125,6 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
149 int (*fn)(struct powerdomain *pwrdm, 125 int (*fn)(struct powerdomain *pwrdm,
150 struct clockdomain *clkdm)); 126 struct clockdomain *clkdm));
151 127
152int pwrdm_add_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
153int pwrdm_del_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
154int pwrdm_read_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
155int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
156int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
157int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);
158
159int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); 128int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
160 129
161int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); 130int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
@@ -170,8 +139,10 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
170 139
171int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm); 140int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm);
172int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm); 141int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm);
142int pwrdm_read_logic_retst(struct powerdomain *pwrdm);
173int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank); 143int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
174int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank); 144int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
145int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
175 146
176int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm); 147int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm);
177int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm); 148int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm);
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
index e63e94e18975..d6a0e27d5a7f 100644
--- a/arch/arm/plat-omap/include/plat/prcm.h
+++ b/arch/arm/plat-omap/include/plat/prcm.h
@@ -25,7 +25,8 @@
25 25
26u32 omap_prcm_get_reset_sources(void); 26u32 omap_prcm_get_reset_sources(void);
27void omap_prcm_arch_reset(char mode); 27void omap_prcm_arch_reset(char mode);
28int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name); 28int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
29 const char *name);
29 30
30#define START_PADCONF_SAVE 0x2 31#define START_PADCONF_SAVE 0x2
31#define PADCONF_SAVE_DONE 0x1 32#define PADCONF_SAVE_DONE 0x1
@@ -33,6 +34,14 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name);
33void omap3_prcm_save_context(void); 34void omap3_prcm_save_context(void);
34void omap3_prcm_restore_context(void); 35void omap3_prcm_restore_context(void);
35 36
37u32 prm_read_mod_reg(s16 module, u16 idx);
38void prm_write_mod_reg(u32 val, s16 module, u16 idx);
39u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
40u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask);
41u32 cm_read_mod_reg(s16 module, u16 idx);
42void cm_write_mod_reg(u32 val, s16 module, u16 idx);
43u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
44
36#endif 45#endif
37 46
38 47
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index f5a4a92393ef..83dce4c4f7e6 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -15,37 +15,65 @@
15 15
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#if defined(CONFIG_ARCH_OMAP1)
19/* OMAP1 serial ports */ 18/* OMAP1 serial ports */
20#define OMAP_UART1_BASE 0xfffb0000 19#define OMAP1_UART1_BASE 0xfffb0000
21#define OMAP_UART2_BASE 0xfffb0800 20#define OMAP1_UART2_BASE 0xfffb0800
22#define OMAP_UART3_BASE 0xfffb9800 21#define OMAP1_UART3_BASE 0xfffb9800
23#elif defined(CONFIG_ARCH_OMAP2) 22
24/* OMAP2 serial ports */ 23/* OMAP2 serial ports */
25#define OMAP_UART1_BASE 0x4806a000 24#define OMAP2_UART1_BASE 0x4806a000
26#define OMAP_UART2_BASE 0x4806c000 25#define OMAP2_UART2_BASE 0x4806c000
27#define OMAP_UART3_BASE 0x4806e000 26#define OMAP2_UART3_BASE 0x4806e000
28#elif defined(CONFIG_ARCH_OMAP3) 27
29/* OMAP3 serial ports */ 28/* OMAP3 serial ports */
30#define OMAP_UART1_BASE 0x4806a000 29#define OMAP3_UART1_BASE OMAP2_UART1_BASE
31#define OMAP_UART2_BASE 0x4806c000 30#define OMAP3_UART2_BASE OMAP2_UART2_BASE
32#define OMAP_UART3_BASE 0x49020000 31#define OMAP3_UART3_BASE 0x49020000
33#elif defined(CONFIG_ARCH_OMAP4) 32#define OMAP3_UART4_BASE 0x49042000 /* Only on 36xx */
33
34/* OMAP4 serial ports */ 34/* OMAP4 serial ports */
35#define OMAP_UART1_BASE 0x4806a000 35#define OMAP4_UART1_BASE OMAP2_UART1_BASE
36#define OMAP_UART2_BASE 0x4806c000 36#define OMAP4_UART2_BASE OMAP2_UART2_BASE
37#define OMAP_UART3_BASE 0x48020000 37#define OMAP4_UART3_BASE 0x48020000
38#define OMAP_UART4_BASE 0x4806e000 38#define OMAP4_UART4_BASE 0x4806e000
39#endif 39
40/* External port on Zoom2/3 */
41#define ZOOM_UART_BASE 0x10000000
42#define ZOOM_UART_VIRT 0xfb000000
43
44#define OMAP_PORT_SHIFT 2
45#define OMAP7XX_PORT_SHIFT 0
46#define ZOOM_PORT_SHIFT 1
40 47
41#define OMAP1510_BASE_BAUD (12000000/16) 48#define OMAP1510_BASE_BAUD (12000000/16)
42#define OMAP16XX_BASE_BAUD (48000000/16) 49#define OMAP16XX_BASE_BAUD (48000000/16)
43#define OMAP24XX_BASE_BAUD (48000000/16) 50#define OMAP24XX_BASE_BAUD (48000000/16)
44 51
52/*
53 * DEBUG_LL port encoding stored into the UART1 scratchpad register by
54 * decomp_setup in uncompress.h
55 */
56#define OMAP1UART1 11
57#define OMAP1UART2 12
58#define OMAP1UART3 13
59#define OMAP2UART1 21
60#define OMAP2UART2 22
61#define OMAP2UART3 23
62#define OMAP3UART1 OMAP2UART1
63#define OMAP3UART2 OMAP2UART2
64#define OMAP3UART3 33
65#define OMAP3UART4 34 /* Only on 36xx */
66#define OMAP4UART1 OMAP2UART1
67#define OMAP4UART2 OMAP2UART2
68#define OMAP4UART3 43
69#define OMAP4UART4 44
70#define ZOOM_UART 95 /* Only on zoom2/3 */
71
72/* This is only used by 8250.c for omap1510 */
45#define is_omap_port(pt) ({int __ret = 0; \ 73#define is_omap_port(pt) ({int __ret = 0; \
46 if ((pt)->port.mapbase == OMAP_UART1_BASE || \ 74 if ((pt)->port.mapbase == OMAP1_UART1_BASE || \
47 (pt)->port.mapbase == OMAP_UART2_BASE || \ 75 (pt)->port.mapbase == OMAP1_UART2_BASE || \
48 (pt)->port.mapbase == OMAP_UART3_BASE) \ 76 (pt)->port.mapbase == OMAP1_UART3_BASE) \
49 __ret = 1; \ 77 __ret = 1; \
50 __ret; \ 78 __ret; \
51 }) 79 })
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 13c305d62127..81d9ec540fcf 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -19,62 +19,38 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
22
23#include <asm/mach-types.h>
24
22#include <plat/serial.h> 25#include <plat/serial.h>
23 26
24unsigned int system_rev; 27static volatile u8 *uart1_base;
28static int uart1_shift;
25 29
26#define UART_OMAP_MDR1 0x08 /* mode definition register */ 30static volatile u8 *uart_base;
27#define OMAP_ID_730 0x355F 31static int uart_shift;
28#define OMAP_ID_850 0x362C
29#define ID_MASK 0x7fff
30#define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
31#define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
32 32
33static void putc(int c) 33/*
34 * Store the DEBUG_LL uart number into UART1 scratchpad register.
35 * See also debug-macro.S, and serial.c for related code.
36 *
37 * Please note that we currently assume that:
38 * - UART1 clocks are enabled for register access
39 * - UART1 scratchpad register can be used
40 */
41static void set_uart1_scratchpad(unsigned char port)
34{ 42{
35 volatile u8 * uart = 0; 43 uart1_base[UART_SCR << uart1_shift] = port;
36 int shift = 2; 44}
37
38#ifdef CONFIG_MACH_OMAP_PALMTE
39 return;
40#endif
41
42#ifdef CONFIG_ARCH_OMAP
43#ifdef CONFIG_OMAP_LL_DEBUG_UART3
44 uart = (volatile u8 *)(OMAP_UART3_BASE);
45#elif defined(CONFIG_OMAP_LL_DEBUG_UART2)
46 uart = (volatile u8 *)(OMAP_UART2_BASE);
47#elif defined(CONFIG_OMAP_LL_DEBUG_UART1)
48 uart = (volatile u8 *)(OMAP_UART1_BASE);
49#elif defined(CONFIG_OMAP_LL_DEBUG_NONE)
50 return;
51#else
52 return;
53#endif
54
55#ifdef CONFIG_ARCH_OMAP1
56 /* Determine which serial port to use */
57 do {
58 /* MMU is not on, so cpu_is_omapXXXX() won't work here */
59 unsigned int omap_id = omap_get_id();
60
61 if (omap_id == OMAP_ID_730 || omap_id == OMAP_ID_850)
62 shift = 0;
63 45
64 if (check_port(uart, shift)) 46static void putc(int c)
65 break; 47{
66 /* Silent boot if no serial ports are enabled. */ 48 if (!uart_base)
67 return; 49 return;
68 } while (0);
69#endif /* CONFIG_ARCH_OMAP1 */
70#endif
71 50
72 /* 51 while (!(uart_base[UART_LSR << uart_shift] & UART_LSR_THRE))
73 * Now, xmit each character
74 */
75 while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
76 barrier(); 52 barrier();
77 uart[UART_TX << shift] = c; 53 uart_base[UART_TX << uart_shift] = c;
78} 54}
79 55
80static inline void flush(void) 56static inline void flush(void)
@@ -82,7 +58,116 @@ static inline void flush(void)
82} 58}
83 59
84/* 60/*
61 * Macros to configure UART1 and debug UART
62 */
63#define _DEBUG_LL_ENTRY(mach, uart1_phys, uart1_shft, \
64 dbg_uart, dbg_shft, dbg_id) \
65 if (machine_is_##mach()) { \
66 uart1_base = (volatile u8 *)(uart1_phys); \
67 uart1_shift = (uart1_shft); \
68 uart_base = (volatile u8 *)(dbg_uart); \
69 uart_shift = (dbg_shft); \
70 port = (dbg_id); \
71 set_uart1_scratchpad(port); \
72 break; \
73 }
74
75#define DEBUG_LL_OMAP7XX(p, mach) \
76 _DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP7XX_PORT_SHIFT, \
77 OMAP1_UART##p##_BASE, OMAP7XX_PORT_SHIFT, OMAP1UART##p)
78
79#define DEBUG_LL_OMAP1(p, mach) \
80 _DEBUG_LL_ENTRY(mach, OMAP1_UART1_BASE, OMAP_PORT_SHIFT, \
81 OMAP1_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP1UART##p)
82
83#define DEBUG_LL_OMAP2(p, mach) \
84 _DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP_PORT_SHIFT, \
85 OMAP2_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP2UART##p)
86
87#define DEBUG_LL_OMAP3(p, mach) \
88 _DEBUG_LL_ENTRY(mach, OMAP3_UART1_BASE, OMAP_PORT_SHIFT, \
89 OMAP3_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP3UART##p)
90
91#define DEBUG_LL_OMAP4(p, mach) \
92 _DEBUG_LL_ENTRY(mach, OMAP4_UART1_BASE, OMAP_PORT_SHIFT, \
93 OMAP4_UART##p##_BASE, OMAP_PORT_SHIFT, OMAP4UART##p)
94
95/* Zoom2/3 shift is different for UART1 and external port */
96#define DEBUG_LL_ZOOM(mach) \
97 _DEBUG_LL_ENTRY(mach, OMAP2_UART1_BASE, OMAP_PORT_SHIFT, \
98 ZOOM_UART_BASE, ZOOM_PORT_SHIFT, ZOOM_UART)
99
100static inline void __arch_decomp_setup(unsigned long arch_id)
101{
102 int port = 0;
103
104 /*
105 * Initialize the port based on the machine ID from the bootloader.
106 * Note that we're using macros here instead of switch statement
107 * as machine_is functions are optimized out for the boards that
108 * are not selected.
109 */
110 do {
111 /* omap7xx/8xx based boards using UART1 with shift 0 */
112 DEBUG_LL_OMAP7XX(1, herald);
113 DEBUG_LL_OMAP7XX(1, omap_perseus2);
114
115 /* omap15xx/16xx based boards using UART1 */
116 DEBUG_LL_OMAP1(1, ams_delta);
117 DEBUG_LL_OMAP1(1, nokia770);
118 DEBUG_LL_OMAP1(1, omap_h2);
119 DEBUG_LL_OMAP1(1, omap_h3);
120 DEBUG_LL_OMAP1(1, omap_innovator);
121 DEBUG_LL_OMAP1(1, omap_osk);
122 DEBUG_LL_OMAP1(1, omap_palmte);
123 DEBUG_LL_OMAP1(1, omap_palmz71);
124
125 /* omap15xx/16xx based boards using UART2 */
126 DEBUG_LL_OMAP1(2, omap_palmtt);
127
128 /* omap15xx/16xx based boards using UART3 */
129 DEBUG_LL_OMAP1(3, sx1);
130
131 /* omap2 based boards using UART1 */
132 DEBUG_LL_OMAP2(1, omap2evm);
133 DEBUG_LL_OMAP2(1, omap_2430sdp);
134 DEBUG_LL_OMAP2(1, omap_apollon);
135 DEBUG_LL_OMAP2(1, omap_h4);
136
137 /* omap2 based boards using UART3 */
138 DEBUG_LL_OMAP2(3, nokia_n800);
139 DEBUG_LL_OMAP2(3, nokia_n810);
140 DEBUG_LL_OMAP2(3, nokia_n810_wimax);
141
142 /* omap3 based boards using UART1 */
143 DEBUG_LL_OMAP2(1, omap3evm);
144 DEBUG_LL_OMAP3(1, omap_3430sdp);
145 DEBUG_LL_OMAP3(1, omap_3630sdp);
146
147 /* omap3 based boards using UART3 */
148 DEBUG_LL_OMAP3(3, cm_t35);
149 DEBUG_LL_OMAP3(3, igep0020);
150 DEBUG_LL_OMAP3(3, nokia_rx51);
151 DEBUG_LL_OMAP3(3, omap3517evm);
152 DEBUG_LL_OMAP3(3, omap3_beagle);
153 DEBUG_LL_OMAP3(3, omap3_pandora);
154 DEBUG_LL_OMAP3(3, omap_ldp);
155 DEBUG_LL_OMAP3(3, overo);
156 DEBUG_LL_OMAP3(3, touchbook);
157
158 /* omap4 based boards using UART3 */
159 DEBUG_LL_OMAP4(3, omap_4430sdp);
160
161 /* zoom2/3 external uart */
162 DEBUG_LL_ZOOM(omap_zoom2);
163 DEBUG_LL_ZOOM(omap_zoom3);
164
165 } while (0);
166}
167
168#define arch_decomp_setup() __arch_decomp_setup(arch_id)
169
170/*
85 * nothing to do 171 * nothing to do
86 */ 172 */
87#define arch_decomp_setup()
88#define arch_decomp_wdog() 173#define arch_decomp_wdog()
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 33a500eb2f93..288e29e1c06f 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -3,6 +3,7 @@
3#ifndef __ASM_ARCH_OMAP_USB_H 3#ifndef __ASM_ARCH_OMAP_USB_H
4#define __ASM_ARCH_OMAP_USB_H 4#define __ASM_ARCH_OMAP_USB_H
5 5
6#include <linux/usb/musb.h>
6#include <plat/board.h> 7#include <plat/board.h>
7 8
8#define OMAP3_HS_USB_PORTS 3 9#define OMAP3_HS_USB_PORTS 3
@@ -42,7 +43,15 @@ struct ehci_hcd_omap_platform_data {
42#define UDC_BASE OMAP2_UDC_BASE 43#define UDC_BASE OMAP2_UDC_BASE
43#define OMAP_OHCI_BASE OMAP2_OHCI_BASE 44#define OMAP_OHCI_BASE OMAP2_OHCI_BASE
44 45
45extern void usb_musb_init(void); 46struct omap_musb_board_data {
47 u8 interface_type;
48 u8 mode;
49 u8 power;
50};
51
52enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
53
54extern void usb_musb_init(struct omap_musb_board_data *board_data);
46 55
47extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata); 56extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata);
48 57
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c
index 11f5d7961c73..b0078cf96281 100644
--- a/arch/arm/plat-omap/io.c
+++ b/arch/arm/plat-omap/io.c
@@ -66,12 +66,12 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
66 return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT); 66 return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT);
67 } 67 }
68 if (cpu_is_omap2420()) { 68 if (cpu_is_omap2420()) {
69 if (BETWEEN(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_SIZE)) 69 if (BETWEEN(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_SIZE))
70 return XLATE(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_VIRT); 70 return XLATE(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_VIRT);
71 if (BETWEEN(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE)) 71 if (BETWEEN(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE))
72 return XLATE(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE); 72 return XLATE(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE);
73 if (BETWEEN(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_SIZE)) 73 if (BETWEEN(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_SIZE))
74 return XLATE(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_VIRT); 74 return XLATE(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_VIRT);
75 } 75 }
76 if (cpu_is_omap2430()) { 76 if (cpu_is_omap2430()) {
77 if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE)) 77 if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE))
@@ -90,8 +90,6 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
90 return XLATE(p, L3_34XX_PHYS, L3_34XX_VIRT); 90 return XLATE(p, L3_34XX_PHYS, L3_34XX_VIRT);
91 if (BETWEEN(p, L4_34XX_PHYS, L4_34XX_SIZE)) 91 if (BETWEEN(p, L4_34XX_PHYS, L4_34XX_SIZE))
92 return XLATE(p, L4_34XX_PHYS, L4_34XX_VIRT); 92 return XLATE(p, L4_34XX_PHYS, L4_34XX_VIRT);
93 if (BETWEEN(p, L4_WK_34XX_PHYS, L4_WK_34XX_SIZE))
94 return XLATE(p, L4_WK_34XX_PHYS, L4_WK_34XX_VIRT);
95 if (BETWEEN(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_SIZE)) 93 if (BETWEEN(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_SIZE))
96 return XLATE(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_VIRT); 94 return XLATE(p, OMAP34XX_GPMC_PHYS, OMAP34XX_GPMC_VIRT);
97 if (BETWEEN(p, OMAP343X_SMS_PHYS, OMAP343X_SMS_SIZE)) 95 if (BETWEEN(p, OMAP343X_SMS_PHYS, OMAP343X_SMS_SIZE))
@@ -110,8 +108,6 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
110 return XLATE(p, L3_44XX_PHYS, L3_44XX_VIRT); 108 return XLATE(p, L3_44XX_PHYS, L3_44XX_VIRT);
111 if (BETWEEN(p, L4_44XX_PHYS, L4_44XX_SIZE)) 109 if (BETWEEN(p, L4_44XX_PHYS, L4_44XX_SIZE))
112 return XLATE(p, L4_44XX_PHYS, L4_44XX_VIRT); 110 return XLATE(p, L4_44XX_PHYS, L4_44XX_VIRT);
113 if (BETWEEN(p, L4_WK_44XX_PHYS, L4_WK_44XX_SIZE))
114 return XLATE(p, L4_WK_44XX_PHYS, L4_WK_44XX_VIRT);
115 if (BETWEEN(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_SIZE)) 111 if (BETWEEN(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_SIZE))
116 return XLATE(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_VIRT); 112 return XLATE(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_VIRT);
117 if (BETWEEN(p, OMAP44XX_EMIF1_PHYS, OMAP44XX_EMIF1_SIZE)) 113 if (BETWEEN(p, OMAP44XX_EMIF1_PHYS, OMAP44XX_EMIF1_SIZE))
@@ -128,7 +124,7 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
128 return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT); 124 return XLATE(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_VIRT);
129 } 125 }
130#endif 126#endif
131 return __arm_ioremap(p, size, type); 127 return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
132} 128}
133EXPORT_SYMBOL(omap_ioremap); 129EXPORT_SYMBOL(omap_ioremap);
134 130
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index c0ff1e39d893..905ed832df56 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * omap iommu: tlb and pagetable primitives 2 * omap iommu: tlb and pagetable primitives
3 * 3 *
4 * Copyright (C) 2008-2009 Nokia Corporation 4 * Copyright (C) 2008-2010 Nokia Corporation
5 * 5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, 6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
7 * Paul Mundt and Toshihiro Kobayashi 7 * Paul Mundt and Toshihiro Kobayashi
@@ -646,7 +646,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da)
646 if (*iopte & IOPTE_LARGE) { 646 if (*iopte & IOPTE_LARGE) {
647 nent *= 16; 647 nent *= 16;
648 /* rewind to the 1st entry */ 648 /* rewind to the 1st entry */
649 iopte = (u32 *)((u32)iopte & IOLARGE_MASK); 649 iopte = iopte_offset(iopgd, (da & IOLARGE_MASK));
650 } 650 }
651 bytes *= nent; 651 bytes *= nent;
652 memset(iopte, 0, nent * sizeof(*iopte)); 652 memset(iopte, 0, nent * sizeof(*iopte));
@@ -667,7 +667,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da)
667 if ((*iopgd & IOPGD_SUPER) == IOPGD_SUPER) { 667 if ((*iopgd & IOPGD_SUPER) == IOPGD_SUPER) {
668 nent *= 16; 668 nent *= 16;
669 /* rewind to the 1st entry */ 669 /* rewind to the 1st entry */
670 iopgd = (u32 *)((u32)iopgd & IOSUPER_MASK); 670 iopgd = iopgd_offset(obj, (da & IOSUPER_MASK));
671 } 671 }
672 bytes *= nent; 672 bytes *= nent;
673 } 673 }
@@ -827,7 +827,7 @@ EXPORT_SYMBOL_GPL(iommu_get);
827 **/ 827 **/
828void iommu_put(struct iommu *obj) 828void iommu_put(struct iommu *obj)
829{ 829{
830 if (!obj && IS_ERR(obj)) 830 if (!obj || IS_ERR(obj))
831 return; 831 return;
832 832
833 mutex_lock(&obj->iommu_lock); 833 mutex_lock(&obj->iommu_lock);
diff --git a/arch/arm/plat-omap/iopgtable.h b/arch/arm/plat-omap/iopgtable.h
index 37dac434c7a1..ab23b6a140fd 100644
--- a/arch/arm/plat-omap/iopgtable.h
+++ b/arch/arm/plat-omap/iopgtable.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * omap iommu: pagetable definitions 2 * omap iommu: pagetable definitions
3 * 3 *
4 * Copyright (C) 2008-2009 Nokia Corporation 4 * Copyright (C) 2008-2010 Nokia Corporation
5 * 5 *
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> 6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
7 * 7 *
@@ -13,26 +13,52 @@
13#ifndef __PLAT_OMAP_IOMMU_H 13#ifndef __PLAT_OMAP_IOMMU_H
14#define __PLAT_OMAP_IOMMU_H 14#define __PLAT_OMAP_IOMMU_H
15 15
16/*
17 * "L2 table" address mask and size definitions.
18 */
16#define IOPGD_SHIFT 20 19#define IOPGD_SHIFT 20
17#define IOPGD_SIZE (1 << IOPGD_SHIFT) 20#define IOPGD_SIZE (1UL << IOPGD_SHIFT)
18#define IOPGD_MASK (~(IOPGD_SIZE - 1)) 21#define IOPGD_MASK (~(IOPGD_SIZE - 1))
19#define IOSECTION_MASK IOPGD_MASK
20#define PTRS_PER_IOPGD (1 << (32 - IOPGD_SHIFT))
21#define IOPGD_TABLE_SIZE (PTRS_PER_IOPGD * sizeof(u32))
22 22
23#define IOSUPER_SIZE (IOPGD_SIZE << 4) 23/*
24 * "section" address mask and size definitions.
25 */
26#define IOSECTION_SHIFT 20
27#define IOSECTION_SIZE (1UL << IOSECTION_SHIFT)
28#define IOSECTION_MASK (~(IOSECTION_SIZE - 1))
29
30/*
31 * "supersection" address mask and size definitions.
32 */
33#define IOSUPER_SHIFT 24
34#define IOSUPER_SIZE (1UL << IOSUPER_SHIFT)
24#define IOSUPER_MASK (~(IOSUPER_SIZE - 1)) 35#define IOSUPER_MASK (~(IOSUPER_SIZE - 1))
25 36
37#define PTRS_PER_IOPGD (1UL << (32 - IOPGD_SHIFT))
38#define IOPGD_TABLE_SIZE (PTRS_PER_IOPGD * sizeof(u32))
39
40/*
41 * "small page" address mask and size definitions.
42 */
26#define IOPTE_SHIFT 12 43#define IOPTE_SHIFT 12
27#define IOPTE_SIZE (1 << IOPTE_SHIFT) 44#define IOPTE_SIZE (1UL << IOPTE_SHIFT)
28#define IOPTE_MASK (~(IOPTE_SIZE - 1)) 45#define IOPTE_MASK (~(IOPTE_SIZE - 1))
29#define IOPAGE_MASK IOPTE_MASK
30#define PTRS_PER_IOPTE (1 << (IOPGD_SHIFT - IOPTE_SHIFT))
31#define IOPTE_TABLE_SIZE (PTRS_PER_IOPTE * sizeof(u32))
32 46
33#define IOLARGE_SIZE (IOPTE_SIZE << 4) 47/*
48 * "large page" address mask and size definitions.
49 */
50#define IOLARGE_SHIFT 16
51#define IOLARGE_SIZE (1UL << IOLARGE_SHIFT)
34#define IOLARGE_MASK (~(IOLARGE_SIZE - 1)) 52#define IOLARGE_MASK (~(IOLARGE_SIZE - 1))
35 53
54#define PTRS_PER_IOPTE (1UL << (IOPGD_SHIFT - IOPTE_SHIFT))
55#define IOPTE_TABLE_SIZE (PTRS_PER_IOPTE * sizeof(u32))
56
57#define IOPAGE_MASK IOPTE_MASK
58
59/*
60 * some descriptor attributes.
61 */
36#define IOPGD_TABLE (1 << 0) 62#define IOPGD_TABLE (1 << 0)
37#define IOPGD_SECTION (2 << 0) 63#define IOPGD_SECTION (2 << 0)
38#define IOPGD_SUPER (1 << 18 | 2 << 0) 64#define IOPGD_SUPER (1 << 18 | 2 << 0)
@@ -40,12 +66,14 @@
40#define IOPTE_SMALL (2 << 0) 66#define IOPTE_SMALL (2 << 0)
41#define IOPTE_LARGE (1 << 0) 67#define IOPTE_LARGE (1 << 0)
42 68
69/* to find an entry in a page-table-directory */
43#define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1)) 70#define iopgd_index(da) (((da) >> IOPGD_SHIFT) & (PTRS_PER_IOPGD - 1))
44#define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da)) 71#define iopgd_offset(obj, da) ((obj)->iopgd + iopgd_index(da))
45 72
46#define iopte_paddr(iopgd) (*iopgd & ~((1 << 10) - 1)) 73#define iopte_paddr(iopgd) (*iopgd & ~((1 << 10) - 1))
47#define iopte_vaddr(iopgd) ((u32 *)phys_to_virt(iopte_paddr(iopgd))) 74#define iopte_vaddr(iopgd) ((u32 *)phys_to_virt(iopte_paddr(iopgd)))
48 75
76/* to find an entry in the second-level page table. */
49#define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1)) 77#define iopte_index(da) (((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1))
50#define iopte_offset(iopgd, da) (iopte_vaddr(iopgd) + iopte_index(da)) 78#define iopte_offset(iopgd, da) (iopte_vaddr(iopgd) + iopte_index(da))
51 79
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 8e90633e4cb9..4229cec53140 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -28,6 +28,7 @@
28 28
29#include <plat/mailbox.h> 29#include <plat/mailbox.h>
30 30
31static struct workqueue_struct *mboxd;
31static struct omap_mbox *mboxes; 32static struct omap_mbox *mboxes;
32static DEFINE_RWLOCK(mboxes_lock); 33static DEFINE_RWLOCK(mboxes_lock);
33 34
@@ -188,7 +189,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
188 /* no more messages in the fifo. clear IRQ source. */ 189 /* no more messages in the fifo. clear IRQ source. */
189 ack_mbox_irq(mbox, IRQ_RX); 190 ack_mbox_irq(mbox, IRQ_RX);
190nomem: 191nomem:
191 schedule_work(&mbox->rxq->work); 192 queue_work(mboxd, &mbox->rxq->work);
192} 193}
193 194
194static irqreturn_t mbox_interrupt(int irq, void *p) 195static irqreturn_t mbox_interrupt(int irq, void *p)
@@ -401,12 +402,17 @@ EXPORT_SYMBOL(omap_mbox_unregister);
401 402
402static int __init omap_mbox_init(void) 403static int __init omap_mbox_init(void)
403{ 404{
405 mboxd = create_workqueue("mboxd");
406 if (!mboxd)
407 return -ENOMEM;
408
404 return 0; 409 return 0;
405} 410}
406module_init(omap_mbox_init); 411module_init(omap_mbox_init);
407 412
408static void __exit omap_mbox_exit(void) 413static void __exit omap_mbox_exit(void)
409{ 414{
415 destroy_workqueue(mboxd);
410} 416}
411module_exit(omap_mbox_exit); 417module_exit(omap_mbox_exit);
412 418
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 2cc1cc328bac..e47686e0a633 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -27,64 +27,97 @@
27#include <plat/dma.h> 27#include <plat/dma.h>
28#include <plat/mcbsp.h> 28#include <plat/mcbsp.h>
29 29
30#include "../mach-omap2/cm-regbits-34xx.h"
31
30struct omap_mcbsp **mcbsp_ptr; 32struct omap_mcbsp **mcbsp_ptr;
31int omap_mcbsp_count; 33int omap_mcbsp_count, omap_mcbsp_cache_size;
32 34
33void omap_mcbsp_write(void __iomem *io_base, u16 reg, u32 val) 35void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
34{ 36{
35 if (cpu_class_is_omap1() || cpu_is_omap2420()) 37 if (cpu_class_is_omap1()) {
36 __raw_writew((u16)val, io_base + reg); 38 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)] = (u16)val;
37 else 39 __raw_writew((u16)val, mcbsp->io_base + reg);
38 __raw_writel(val, io_base + reg); 40 } else if (cpu_is_omap2420()) {
41 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)] = (u16)val;
42 __raw_writew((u16)val, mcbsp->io_base + reg);
43 } else {
44 ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)] = val;
45 __raw_writel(val, mcbsp->io_base + reg);
46 }
39} 47}
40 48
41int omap_mcbsp_read(void __iomem *io_base, u16 reg) 49int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg, bool from_cache)
42{ 50{
43 if (cpu_class_is_omap1() || cpu_is_omap2420()) 51 if (cpu_class_is_omap1()) {
44 return __raw_readw(io_base + reg); 52 return !from_cache ? __raw_readw(mcbsp->io_base + reg) :
45 else 53 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u16)];
46 return __raw_readl(io_base + reg); 54 } else if (cpu_is_omap2420()) {
55 return !from_cache ? __raw_readw(mcbsp->io_base + reg) :
56 ((u16 *)mcbsp->reg_cache)[reg / sizeof(u32)];
57 } else {
58 return !from_cache ? __raw_readl(mcbsp->io_base + reg) :
59 ((u32 *)mcbsp->reg_cache)[reg / sizeof(u32)];
60 }
61}
62
63#ifdef CONFIG_ARCH_OMAP3
64void omap_mcbsp_st_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
65{
66 __raw_writel(val, mcbsp->st_data->io_base_st + reg);
47} 67}
48 68
49#define OMAP_MCBSP_READ(base, reg) \ 69int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
50 omap_mcbsp_read(base, OMAP_MCBSP_REG_##reg) 70{
51#define OMAP_MCBSP_WRITE(base, reg, val) \ 71 return __raw_readl(mcbsp->st_data->io_base_st + reg);
52 omap_mcbsp_write(base, OMAP_MCBSP_REG_##reg, val) 72}
73#endif
74
75#define MCBSP_READ(mcbsp, reg) \
76 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 0)
77#define MCBSP_WRITE(mcbsp, reg, val) \
78 omap_mcbsp_write(mcbsp, OMAP_MCBSP_REG_##reg, val)
79#define MCBSP_READ_CACHE(mcbsp, reg) \
80 omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1)
53 81
54#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) 82#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
55#define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; 83#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
56 84
85#define MCBSP_ST_READ(mcbsp, reg) \
86 omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg)
87#define MCBSP_ST_WRITE(mcbsp, reg, val) \
88 omap_mcbsp_st_write(mcbsp, OMAP_ST_REG_##reg, val)
89
57static void omap_mcbsp_dump_reg(u8 id) 90static void omap_mcbsp_dump_reg(u8 id)
58{ 91{
59 struct omap_mcbsp *mcbsp = id_to_mcbsp_ptr(id); 92 struct omap_mcbsp *mcbsp = id_to_mcbsp_ptr(id);
60 93
61 dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id); 94 dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id);
62 dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n", 95 dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n",
63 OMAP_MCBSP_READ(mcbsp->io_base, DRR2)); 96 MCBSP_READ(mcbsp, DRR2));
64 dev_dbg(mcbsp->dev, "DRR1: 0x%04x\n", 97 dev_dbg(mcbsp->dev, "DRR1: 0x%04x\n",
65 OMAP_MCBSP_READ(mcbsp->io_base, DRR1)); 98 MCBSP_READ(mcbsp, DRR1));
66 dev_dbg(mcbsp->dev, "DXR2: 0x%04x\n", 99 dev_dbg(mcbsp->dev, "DXR2: 0x%04x\n",
67 OMAP_MCBSP_READ(mcbsp->io_base, DXR2)); 100 MCBSP_READ(mcbsp, DXR2));
68 dev_dbg(mcbsp->dev, "DXR1: 0x%04x\n", 101 dev_dbg(mcbsp->dev, "DXR1: 0x%04x\n",
69 OMAP_MCBSP_READ(mcbsp->io_base, DXR1)); 102 MCBSP_READ(mcbsp, DXR1));
70 dev_dbg(mcbsp->dev, "SPCR2: 0x%04x\n", 103 dev_dbg(mcbsp->dev, "SPCR2: 0x%04x\n",
71 OMAP_MCBSP_READ(mcbsp->io_base, SPCR2)); 104 MCBSP_READ(mcbsp, SPCR2));
72 dev_dbg(mcbsp->dev, "SPCR1: 0x%04x\n", 105 dev_dbg(mcbsp->dev, "SPCR1: 0x%04x\n",
73 OMAP_MCBSP_READ(mcbsp->io_base, SPCR1)); 106 MCBSP_READ(mcbsp, SPCR1));
74 dev_dbg(mcbsp->dev, "RCR2: 0x%04x\n", 107 dev_dbg(mcbsp->dev, "RCR2: 0x%04x\n",
75 OMAP_MCBSP_READ(mcbsp->io_base, RCR2)); 108 MCBSP_READ(mcbsp, RCR2));
76 dev_dbg(mcbsp->dev, "RCR1: 0x%04x\n", 109 dev_dbg(mcbsp->dev, "RCR1: 0x%04x\n",
77 OMAP_MCBSP_READ(mcbsp->io_base, RCR1)); 110 MCBSP_READ(mcbsp, RCR1));
78 dev_dbg(mcbsp->dev, "XCR2: 0x%04x\n", 111 dev_dbg(mcbsp->dev, "XCR2: 0x%04x\n",
79 OMAP_MCBSP_READ(mcbsp->io_base, XCR2)); 112 MCBSP_READ(mcbsp, XCR2));
80 dev_dbg(mcbsp->dev, "XCR1: 0x%04x\n", 113 dev_dbg(mcbsp->dev, "XCR1: 0x%04x\n",
81 OMAP_MCBSP_READ(mcbsp->io_base, XCR1)); 114 MCBSP_READ(mcbsp, XCR1));
82 dev_dbg(mcbsp->dev, "SRGR2: 0x%04x\n", 115 dev_dbg(mcbsp->dev, "SRGR2: 0x%04x\n",
83 OMAP_MCBSP_READ(mcbsp->io_base, SRGR2)); 116 MCBSP_READ(mcbsp, SRGR2));
84 dev_dbg(mcbsp->dev, "SRGR1: 0x%04x\n", 117 dev_dbg(mcbsp->dev, "SRGR1: 0x%04x\n",
85 OMAP_MCBSP_READ(mcbsp->io_base, SRGR1)); 118 MCBSP_READ(mcbsp, SRGR1));
86 dev_dbg(mcbsp->dev, "PCR0: 0x%04x\n", 119 dev_dbg(mcbsp->dev, "PCR0: 0x%04x\n",
87 OMAP_MCBSP_READ(mcbsp->io_base, PCR0)); 120 MCBSP_READ(mcbsp, PCR0));
88 dev_dbg(mcbsp->dev, "***********************\n"); 121 dev_dbg(mcbsp->dev, "***********************\n");
89} 122}
90 123
@@ -93,15 +126,15 @@ static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id)
93 struct omap_mcbsp *mcbsp_tx = dev_id; 126 struct omap_mcbsp *mcbsp_tx = dev_id;
94 u16 irqst_spcr2; 127 u16 irqst_spcr2;
95 128
96 irqst_spcr2 = OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2); 129 irqst_spcr2 = MCBSP_READ(mcbsp_tx, SPCR2);
97 dev_dbg(mcbsp_tx->dev, "TX IRQ callback : 0x%x\n", irqst_spcr2); 130 dev_dbg(mcbsp_tx->dev, "TX IRQ callback : 0x%x\n", irqst_spcr2);
98 131
99 if (irqst_spcr2 & XSYNC_ERR) { 132 if (irqst_spcr2 & XSYNC_ERR) {
100 dev_err(mcbsp_tx->dev, "TX Frame Sync Error! : 0x%x\n", 133 dev_err(mcbsp_tx->dev, "TX Frame Sync Error! : 0x%x\n",
101 irqst_spcr2); 134 irqst_spcr2);
102 /* Writing zero to XSYNC_ERR clears the IRQ */ 135 /* Writing zero to XSYNC_ERR clears the IRQ */
103 OMAP_MCBSP_WRITE(mcbsp_tx->io_base, SPCR2, 136 MCBSP_WRITE(mcbsp_tx, SPCR2,
104 irqst_spcr2 & ~(XSYNC_ERR)); 137 MCBSP_READ_CACHE(mcbsp_tx, SPCR2) & ~(XSYNC_ERR));
105 } else { 138 } else {
106 complete(&mcbsp_tx->tx_irq_completion); 139 complete(&mcbsp_tx->tx_irq_completion);
107 } 140 }
@@ -114,15 +147,15 @@ static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
114 struct omap_mcbsp *mcbsp_rx = dev_id; 147 struct omap_mcbsp *mcbsp_rx = dev_id;
115 u16 irqst_spcr1; 148 u16 irqst_spcr1;
116 149
117 irqst_spcr1 = OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR1); 150 irqst_spcr1 = MCBSP_READ(mcbsp_rx, SPCR1);
118 dev_dbg(mcbsp_rx->dev, "RX IRQ callback : 0x%x\n", irqst_spcr1); 151 dev_dbg(mcbsp_rx->dev, "RX IRQ callback : 0x%x\n", irqst_spcr1);
119 152
120 if (irqst_spcr1 & RSYNC_ERR) { 153 if (irqst_spcr1 & RSYNC_ERR) {
121 dev_err(mcbsp_rx->dev, "RX Frame Sync Error! : 0x%x\n", 154 dev_err(mcbsp_rx->dev, "RX Frame Sync Error! : 0x%x\n",
122 irqst_spcr1); 155 irqst_spcr1);
123 /* Writing zero to RSYNC_ERR clears the IRQ */ 156 /* Writing zero to RSYNC_ERR clears the IRQ */
124 OMAP_MCBSP_WRITE(mcbsp_rx->io_base, SPCR1, 157 MCBSP_WRITE(mcbsp_rx, SPCR1,
125 irqst_spcr1 & ~(RSYNC_ERR)); 158 MCBSP_READ_CACHE(mcbsp_rx, SPCR1) & ~(RSYNC_ERR));
126 } else { 159 } else {
127 complete(&mcbsp_rx->tx_irq_completion); 160 complete(&mcbsp_rx->tx_irq_completion);
128 } 161 }
@@ -135,7 +168,7 @@ static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data)
135 struct omap_mcbsp *mcbsp_dma_tx = data; 168 struct omap_mcbsp *mcbsp_dma_tx = data;
136 169
137 dev_dbg(mcbsp_dma_tx->dev, "TX DMA callback : 0x%x\n", 170 dev_dbg(mcbsp_dma_tx->dev, "TX DMA callback : 0x%x\n",
138 OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2)); 171 MCBSP_READ(mcbsp_dma_tx, SPCR2));
139 172
140 /* We can free the channels */ 173 /* We can free the channels */
141 omap_free_dma(mcbsp_dma_tx->dma_tx_lch); 174 omap_free_dma(mcbsp_dma_tx->dma_tx_lch);
@@ -149,7 +182,7 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
149 struct omap_mcbsp *mcbsp_dma_rx = data; 182 struct omap_mcbsp *mcbsp_dma_rx = data;
150 183
151 dev_dbg(mcbsp_dma_rx->dev, "RX DMA callback : 0x%x\n", 184 dev_dbg(mcbsp_dma_rx->dev, "RX DMA callback : 0x%x\n",
152 OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2)); 185 MCBSP_READ(mcbsp_dma_rx, SPCR2));
153 186
154 /* We can free the channels */ 187 /* We can free the channels */
155 omap_free_dma(mcbsp_dma_rx->dma_rx_lch); 188 omap_free_dma(mcbsp_dma_rx->dma_rx_lch);
@@ -167,7 +200,6 @@ static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
167void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config) 200void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
168{ 201{
169 struct omap_mcbsp *mcbsp; 202 struct omap_mcbsp *mcbsp;
170 void __iomem *io_base;
171 203
172 if (!omap_mcbsp_check_valid_id(id)) { 204 if (!omap_mcbsp_check_valid_id(id)) {
173 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 205 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -175,30 +207,280 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
175 } 207 }
176 mcbsp = id_to_mcbsp_ptr(id); 208 mcbsp = id_to_mcbsp_ptr(id);
177 209
178 io_base = mcbsp->io_base;
179 dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n", 210 dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n",
180 mcbsp->id, mcbsp->phys_base); 211 mcbsp->id, mcbsp->phys_base);
181 212
182 /* We write the given config */ 213 /* We write the given config */
183 OMAP_MCBSP_WRITE(io_base, SPCR2, config->spcr2); 214 MCBSP_WRITE(mcbsp, SPCR2, config->spcr2);
184 OMAP_MCBSP_WRITE(io_base, SPCR1, config->spcr1); 215 MCBSP_WRITE(mcbsp, SPCR1, config->spcr1);
185 OMAP_MCBSP_WRITE(io_base, RCR2, config->rcr2); 216 MCBSP_WRITE(mcbsp, RCR2, config->rcr2);
186 OMAP_MCBSP_WRITE(io_base, RCR1, config->rcr1); 217 MCBSP_WRITE(mcbsp, RCR1, config->rcr1);
187 OMAP_MCBSP_WRITE(io_base, XCR2, config->xcr2); 218 MCBSP_WRITE(mcbsp, XCR2, config->xcr2);
188 OMAP_MCBSP_WRITE(io_base, XCR1, config->xcr1); 219 MCBSP_WRITE(mcbsp, XCR1, config->xcr1);
189 OMAP_MCBSP_WRITE(io_base, SRGR2, config->srgr2); 220 MCBSP_WRITE(mcbsp, SRGR2, config->srgr2);
190 OMAP_MCBSP_WRITE(io_base, SRGR1, config->srgr1); 221 MCBSP_WRITE(mcbsp, SRGR1, config->srgr1);
191 OMAP_MCBSP_WRITE(io_base, MCR2, config->mcr2); 222 MCBSP_WRITE(mcbsp, MCR2, config->mcr2);
192 OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1); 223 MCBSP_WRITE(mcbsp, MCR1, config->mcr1);
193 OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0); 224 MCBSP_WRITE(mcbsp, PCR0, config->pcr0);
194 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) { 225 if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
195 OMAP_MCBSP_WRITE(io_base, XCCR, config->xccr); 226 MCBSP_WRITE(mcbsp, XCCR, config->xccr);
196 OMAP_MCBSP_WRITE(io_base, RCCR, config->rccr); 227 MCBSP_WRITE(mcbsp, RCCR, config->rccr);
197 } 228 }
198} 229}
199EXPORT_SYMBOL(omap_mcbsp_config); 230EXPORT_SYMBOL(omap_mcbsp_config);
200 231
201#ifdef CONFIG_ARCH_OMAP34XX 232#ifdef CONFIG_ARCH_OMAP3
233static void omap_st_on(struct omap_mcbsp *mcbsp)
234{
235 unsigned int w;
236
237 /*
238 * Sidetone uses McBSP ICLK - which must not idle when sidetones
239 * are enabled or sidetones start sounding ugly.
240 */
241 w = cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
242 w &= ~(1 << (mcbsp->id - 2));
243 cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
244
245 /* Enable McBSP Sidetone */
246 w = MCBSP_READ(mcbsp, SSELCR);
247 MCBSP_WRITE(mcbsp, SSELCR, w | SIDETONEEN);
248
249 w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
250 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w & ~(ST_AUTOIDLE));
251
252 /* Enable Sidetone from Sidetone Core */
253 w = MCBSP_ST_READ(mcbsp, SSELCR);
254 MCBSP_ST_WRITE(mcbsp, SSELCR, w | ST_SIDETONEEN);
255}
256
257static void omap_st_off(struct omap_mcbsp *mcbsp)
258{
259 unsigned int w;
260
261 w = MCBSP_ST_READ(mcbsp, SSELCR);
262 MCBSP_ST_WRITE(mcbsp, SSELCR, w & ~(ST_SIDETONEEN));
263
264 w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
265 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w | ST_AUTOIDLE);
266
267 w = MCBSP_READ(mcbsp, SSELCR);
268 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN));
269
270 w = cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
271 w |= 1 << (mcbsp->id - 2);
272 cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
273}
274
275static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)
276{
277 u16 val, i;
278
279 val = MCBSP_ST_READ(mcbsp, SYSCONFIG);
280 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, val & ~(ST_AUTOIDLE));
281
282 val = MCBSP_ST_READ(mcbsp, SSELCR);
283
284 if (val & ST_COEFFWREN)
285 MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN));
286
287 MCBSP_ST_WRITE(mcbsp, SSELCR, val | ST_COEFFWREN);
288
289 for (i = 0; i < 128; i++)
290 MCBSP_ST_WRITE(mcbsp, SFIRCR, fir[i]);
291
292 i = 0;
293
294 val = MCBSP_ST_READ(mcbsp, SSELCR);
295 while (!(val & ST_COEFFWRDONE) && (++i < 1000))
296 val = MCBSP_ST_READ(mcbsp, SSELCR);
297
298 MCBSP_ST_WRITE(mcbsp, SSELCR, val & ~(ST_COEFFWREN));
299
300 if (i == 1000)
301 dev_err(mcbsp->dev, "McBSP FIR load error!\n");
302}
303
304static void omap_st_chgain(struct omap_mcbsp *mcbsp)
305{
306 u16 w;
307 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
308
309 w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
310 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w & ~(ST_AUTOIDLE));
311
312 w = MCBSP_ST_READ(mcbsp, SSELCR);
313
314 MCBSP_ST_WRITE(mcbsp, SGAINCR, ST_CH0GAIN(st_data->ch0gain) | \
315 ST_CH1GAIN(st_data->ch1gain));
316}
317
318int omap_st_set_chgain(unsigned int id, int channel, s16 chgain)
319{
320 struct omap_mcbsp *mcbsp;
321 struct omap_mcbsp_st_data *st_data;
322 int ret = 0;
323
324 if (!omap_mcbsp_check_valid_id(id)) {
325 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
326 return -ENODEV;
327 }
328
329 mcbsp = id_to_mcbsp_ptr(id);
330 st_data = mcbsp->st_data;
331
332 if (!st_data)
333 return -ENOENT;
334
335 spin_lock_irq(&mcbsp->lock);
336 if (channel == 0)
337 st_data->ch0gain = chgain;
338 else if (channel == 1)
339 st_data->ch1gain = chgain;
340 else
341 ret = -EINVAL;
342
343 if (st_data->enabled)
344 omap_st_chgain(mcbsp);
345 spin_unlock_irq(&mcbsp->lock);
346
347 return ret;
348}
349EXPORT_SYMBOL(omap_st_set_chgain);
350
351int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain)
352{
353 struct omap_mcbsp *mcbsp;
354 struct omap_mcbsp_st_data *st_data;
355 int ret = 0;
356
357 if (!omap_mcbsp_check_valid_id(id)) {
358 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
359 return -ENODEV;
360 }
361
362 mcbsp = id_to_mcbsp_ptr(id);
363 st_data = mcbsp->st_data;
364
365 if (!st_data)
366 return -ENOENT;
367
368 spin_lock_irq(&mcbsp->lock);
369 if (channel == 0)
370 *chgain = st_data->ch0gain;
371 else if (channel == 1)
372 *chgain = st_data->ch1gain;
373 else
374 ret = -EINVAL;
375 spin_unlock_irq(&mcbsp->lock);
376
377 return ret;
378}
379EXPORT_SYMBOL(omap_st_get_chgain);
380
381static int omap_st_start(struct omap_mcbsp *mcbsp)
382{
383 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
384
385 if (st_data && st_data->enabled && !st_data->running) {
386 omap_st_fir_write(mcbsp, st_data->taps);
387 omap_st_chgain(mcbsp);
388
389 if (!mcbsp->free) {
390 omap_st_on(mcbsp);
391 st_data->running = 1;
392 }
393 }
394
395 return 0;
396}
397
398int omap_st_enable(unsigned int id)
399{
400 struct omap_mcbsp *mcbsp;
401 struct omap_mcbsp_st_data *st_data;
402
403 if (!omap_mcbsp_check_valid_id(id)) {
404 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
405 return -ENODEV;
406 }
407
408 mcbsp = id_to_mcbsp_ptr(id);
409 st_data = mcbsp->st_data;
410
411 if (!st_data)
412 return -ENODEV;
413
414 spin_lock_irq(&mcbsp->lock);
415 st_data->enabled = 1;
416 omap_st_start(mcbsp);
417 spin_unlock_irq(&mcbsp->lock);
418
419 return 0;
420}
421EXPORT_SYMBOL(omap_st_enable);
422
423static int omap_st_stop(struct omap_mcbsp *mcbsp)
424{
425 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
426
427 if (st_data && st_data->running) {
428 if (!mcbsp->free) {
429 omap_st_off(mcbsp);
430 st_data->running = 0;
431 }
432 }
433
434 return 0;
435}
436
437int omap_st_disable(unsigned int id)
438{
439 struct omap_mcbsp *mcbsp;
440 struct omap_mcbsp_st_data *st_data;
441 int ret = 0;
442
443 if (!omap_mcbsp_check_valid_id(id)) {
444 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
445 return -ENODEV;
446 }
447
448 mcbsp = id_to_mcbsp_ptr(id);
449 st_data = mcbsp->st_data;
450
451 if (!st_data)
452 return -ENODEV;
453
454 spin_lock_irq(&mcbsp->lock);
455 omap_st_stop(mcbsp);
456 st_data->enabled = 0;
457 spin_unlock_irq(&mcbsp->lock);
458
459 return ret;
460}
461EXPORT_SYMBOL(omap_st_disable);
462
463int omap_st_is_enabled(unsigned int id)
464{
465 struct omap_mcbsp *mcbsp;
466 struct omap_mcbsp_st_data *st_data;
467
468 if (!omap_mcbsp_check_valid_id(id)) {
469 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
470 return -ENODEV;
471 }
472
473 mcbsp = id_to_mcbsp_ptr(id);
474 st_data = mcbsp->st_data;
475
476 if (!st_data)
477 return -ENODEV;
478
479
480 return st_data->enabled;
481}
482EXPORT_SYMBOL(omap_st_is_enabled);
483
202/* 484/*
203 * omap_mcbsp_set_tx_threshold configures how to deal 485 * omap_mcbsp_set_tx_threshold configures how to deal
204 * with transmit threshold. the threshold value and handler can be 486 * with transmit threshold. the threshold value and handler can be
@@ -207,7 +489,6 @@ EXPORT_SYMBOL(omap_mcbsp_config);
207void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold) 489void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
208{ 490{
209 struct omap_mcbsp *mcbsp; 491 struct omap_mcbsp *mcbsp;
210 void __iomem *io_base;
211 492
212 if (!cpu_is_omap34xx()) 493 if (!cpu_is_omap34xx())
213 return; 494 return;
@@ -217,9 +498,8 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
217 return; 498 return;
218 } 499 }
219 mcbsp = id_to_mcbsp_ptr(id); 500 mcbsp = id_to_mcbsp_ptr(id);
220 io_base = mcbsp->io_base;
221 501
222 OMAP_MCBSP_WRITE(io_base, THRSH2, threshold); 502 MCBSP_WRITE(mcbsp, THRSH2, threshold);
223} 503}
224EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold); 504EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold);
225 505
@@ -231,7 +511,6 @@ EXPORT_SYMBOL(omap_mcbsp_set_tx_threshold);
231void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold) 511void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
232{ 512{
233 struct omap_mcbsp *mcbsp; 513 struct omap_mcbsp *mcbsp;
234 void __iomem *io_base;
235 514
236 if (!cpu_is_omap34xx()) 515 if (!cpu_is_omap34xx())
237 return; 516 return;
@@ -241,9 +520,8 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
241 return; 520 return;
242 } 521 }
243 mcbsp = id_to_mcbsp_ptr(id); 522 mcbsp = id_to_mcbsp_ptr(id);
244 io_base = mcbsp->io_base;
245 523
246 OMAP_MCBSP_WRITE(io_base, THRSH1, threshold); 524 MCBSP_WRITE(mcbsp, THRSH1, threshold);
247} 525}
248EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold); 526EXPORT_SYMBOL(omap_mcbsp_set_rx_threshold);
249 527
@@ -313,19 +591,18 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
313 if (cpu_is_omap34xx()) { 591 if (cpu_is_omap34xx()) {
314 u16 syscon; 592 u16 syscon;
315 593
316 syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON); 594 syscon = MCBSP_READ(mcbsp, SYSCON);
317 syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03)); 595 syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
318 596
319 if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) { 597 if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) {
320 syscon |= (ENAWAKEUP | SIDLEMODE(0x02) | 598 syscon |= (ENAWAKEUP | SIDLEMODE(0x02) |
321 CLOCKACTIVITY(0x02)); 599 CLOCKACTIVITY(0x02));
322 OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, 600 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
323 XRDYEN | RRDYEN);
324 } else { 601 } else {
325 syscon |= SIDLEMODE(0x01); 602 syscon |= SIDLEMODE(0x01);
326 } 603 }
327 604
328 OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon); 605 MCBSP_WRITE(mcbsp, SYSCON, syscon);
329 } 606 }
330} 607}
331 608
@@ -337,7 +614,7 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
337 if (cpu_is_omap34xx()) { 614 if (cpu_is_omap34xx()) {
338 u16 syscon; 615 u16 syscon;
339 616
340 syscon = OMAP_MCBSP_READ(mcbsp->io_base, SYSCON); 617 syscon = MCBSP_READ(mcbsp, SYSCON);
341 syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03)); 618 syscon &= ~(ENAWAKEUP | SIDLEMODE(0x03) | CLOCKACTIVITY(0x03));
342 /* 619 /*
343 * HW bug workaround - If no_idle mode is taken, we need to 620 * HW bug workaround - If no_idle mode is taken, we need to
@@ -345,17 +622,19 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
345 * device will not hit retention anymore. 622 * device will not hit retention anymore.
346 */ 623 */
347 syscon |= SIDLEMODE(0x02); 624 syscon |= SIDLEMODE(0x02);
348 OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon); 625 MCBSP_WRITE(mcbsp, SYSCON, syscon);
349 626
350 syscon &= ~(SIDLEMODE(0x03)); 627 syscon &= ~(SIDLEMODE(0x03));
351 OMAP_MCBSP_WRITE(mcbsp->io_base, SYSCON, syscon); 628 MCBSP_WRITE(mcbsp, SYSCON, syscon);
352 629
353 OMAP_MCBSP_WRITE(mcbsp->io_base, WAKEUPEN, 0); 630 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
354 } 631 }
355} 632}
356#else 633#else
357static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {} 634static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
358static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {} 635static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
636static inline void omap_st_start(struct omap_mcbsp *mcbsp) {}
637static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {}
359#endif 638#endif
360 639
361/* 640/*
@@ -392,6 +671,7 @@ EXPORT_SYMBOL(omap_mcbsp_set_io_type);
392int omap_mcbsp_request(unsigned int id) 671int omap_mcbsp_request(unsigned int id)
393{ 672{
394 struct omap_mcbsp *mcbsp; 673 struct omap_mcbsp *mcbsp;
674 void *reg_cache;
395 int err; 675 int err;
396 676
397 if (!omap_mcbsp_check_valid_id(id)) { 677 if (!omap_mcbsp_check_valid_id(id)) {
@@ -400,15 +680,21 @@ int omap_mcbsp_request(unsigned int id)
400 } 680 }
401 mcbsp = id_to_mcbsp_ptr(id); 681 mcbsp = id_to_mcbsp_ptr(id);
402 682
683 reg_cache = kzalloc(omap_mcbsp_cache_size, GFP_KERNEL);
684 if (!reg_cache) {
685 return -ENOMEM;
686 }
687
403 spin_lock(&mcbsp->lock); 688 spin_lock(&mcbsp->lock);
404 if (!mcbsp->free) { 689 if (!mcbsp->free) {
405 dev_err(mcbsp->dev, "McBSP%d is currently in use\n", 690 dev_err(mcbsp->dev, "McBSP%d is currently in use\n",
406 mcbsp->id); 691 mcbsp->id);
407 spin_unlock(&mcbsp->lock); 692 err = -EBUSY;
408 return -EBUSY; 693 goto err_kfree;
409 } 694 }
410 695
411 mcbsp->free = 0; 696 mcbsp->free = 0;
697 mcbsp->reg_cache = reg_cache;
412 spin_unlock(&mcbsp->lock); 698 spin_unlock(&mcbsp->lock);
413 699
414 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) 700 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request)
@@ -424,8 +710,8 @@ int omap_mcbsp_request(unsigned int id)
424 * Make sure that transmitter, receiver and sample-rate generator are 710 * Make sure that transmitter, receiver and sample-rate generator are
425 * not running before activating IRQs. 711 * not running before activating IRQs.
426 */ 712 */
427 OMAP_MCBSP_WRITE(mcbsp->io_base, SPCR1, 0); 713 MCBSP_WRITE(mcbsp, SPCR1, 0);
428 OMAP_MCBSP_WRITE(mcbsp->io_base, SPCR2, 0); 714 MCBSP_WRITE(mcbsp, SPCR2, 0);
429 715
430 if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) { 716 if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
431 /* We need to get IRQs here */ 717 /* We need to get IRQs here */
@@ -436,7 +722,7 @@ int omap_mcbsp_request(unsigned int id)
436 dev_err(mcbsp->dev, "Unable to request TX IRQ %d " 722 dev_err(mcbsp->dev, "Unable to request TX IRQ %d "
437 "for McBSP%d\n", mcbsp->tx_irq, 723 "for McBSP%d\n", mcbsp->tx_irq,
438 mcbsp->id); 724 mcbsp->id);
439 return err; 725 goto err_clk_disable;
440 } 726 }
441 727
442 init_completion(&mcbsp->rx_irq_completion); 728 init_completion(&mcbsp->rx_irq_completion);
@@ -446,18 +732,38 @@ int omap_mcbsp_request(unsigned int id)
446 dev_err(mcbsp->dev, "Unable to request RX IRQ %d " 732 dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
447 "for McBSP%d\n", mcbsp->rx_irq, 733 "for McBSP%d\n", mcbsp->rx_irq,
448 mcbsp->id); 734 mcbsp->id);
449 free_irq(mcbsp->tx_irq, (void *)mcbsp); 735 goto err_free_irq;
450 return err;
451 } 736 }
452 } 737 }
453 738
454 return 0; 739 return 0;
740err_free_irq:
741 free_irq(mcbsp->tx_irq, (void *)mcbsp);
742err_clk_disable:
743 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
744 mcbsp->pdata->ops->free(id);
745
746 /* Do procedure specific to omap34xx arch, if applicable */
747 omap34xx_mcbsp_free(mcbsp);
748
749 clk_disable(mcbsp->fclk);
750 clk_disable(mcbsp->iclk);
751
752 spin_lock(&mcbsp->lock);
753 mcbsp->free = 1;
754 mcbsp->reg_cache = NULL;
755err_kfree:
756 spin_unlock(&mcbsp->lock);
757 kfree(reg_cache);
758
759 return err;
455} 760}
456EXPORT_SYMBOL(omap_mcbsp_request); 761EXPORT_SYMBOL(omap_mcbsp_request);
457 762
458void omap_mcbsp_free(unsigned int id) 763void omap_mcbsp_free(unsigned int id)
459{ 764{
460 struct omap_mcbsp *mcbsp; 765 struct omap_mcbsp *mcbsp;
766 void *reg_cache;
461 767
462 if (!omap_mcbsp_check_valid_id(id)) { 768 if (!omap_mcbsp_check_valid_id(id)) {
463 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 769 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -480,16 +786,18 @@ void omap_mcbsp_free(unsigned int id)
480 free_irq(mcbsp->tx_irq, (void *)mcbsp); 786 free_irq(mcbsp->tx_irq, (void *)mcbsp);
481 } 787 }
482 788
483 spin_lock(&mcbsp->lock); 789 reg_cache = mcbsp->reg_cache;
484 if (mcbsp->free) {
485 dev_err(mcbsp->dev, "McBSP%d was not reserved\n",
486 mcbsp->id);
487 spin_unlock(&mcbsp->lock);
488 return;
489 }
490 790
491 mcbsp->free = 1; 791 spin_lock(&mcbsp->lock);
792 if (mcbsp->free)
793 dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id);
794 else
795 mcbsp->free = 1;
796 mcbsp->reg_cache = NULL;
492 spin_unlock(&mcbsp->lock); 797 spin_unlock(&mcbsp->lock);
798
799 if (reg_cache)
800 kfree(reg_cache);
493} 801}
494EXPORT_SYMBOL(omap_mcbsp_free); 802EXPORT_SYMBOL(omap_mcbsp_free);
495 803
@@ -501,7 +809,6 @@ EXPORT_SYMBOL(omap_mcbsp_free);
501void omap_mcbsp_start(unsigned int id, int tx, int rx) 809void omap_mcbsp_start(unsigned int id, int tx, int rx)
502{ 810{
503 struct omap_mcbsp *mcbsp; 811 struct omap_mcbsp *mcbsp;
504 void __iomem *io_base;
505 int idle; 812 int idle;
506 u16 w; 813 u16 w;
507 814
@@ -510,28 +817,30 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
510 return; 817 return;
511 } 818 }
512 mcbsp = id_to_mcbsp_ptr(id); 819 mcbsp = id_to_mcbsp_ptr(id);
513 io_base = mcbsp->io_base;
514 820
515 mcbsp->rx_word_length = (OMAP_MCBSP_READ(io_base, RCR1) >> 5) & 0x7; 821 if (cpu_is_omap34xx())
516 mcbsp->tx_word_length = (OMAP_MCBSP_READ(io_base, XCR1) >> 5) & 0x7; 822 omap_st_start(mcbsp);
823
824 mcbsp->rx_word_length = (MCBSP_READ_CACHE(mcbsp, RCR1) >> 5) & 0x7;
825 mcbsp->tx_word_length = (MCBSP_READ_CACHE(mcbsp, XCR1) >> 5) & 0x7;
517 826
518 idle = !((OMAP_MCBSP_READ(io_base, SPCR2) | 827 idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
519 OMAP_MCBSP_READ(io_base, SPCR1)) & 1); 828 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
520 829
521 if (idle) { 830 if (idle) {
522 /* Start the sample generator */ 831 /* Start the sample generator */
523 w = OMAP_MCBSP_READ(io_base, SPCR2); 832 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
524 OMAP_MCBSP_WRITE(io_base, SPCR2, w | (1 << 6)); 833 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6));
525 } 834 }
526 835
527 /* Enable transmitter and receiver */ 836 /* Enable transmitter and receiver */
528 tx &= 1; 837 tx &= 1;
529 w = OMAP_MCBSP_READ(io_base, SPCR2); 838 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
530 OMAP_MCBSP_WRITE(io_base, SPCR2, w | tx); 839 MCBSP_WRITE(mcbsp, SPCR2, w | tx);
531 840
532 rx &= 1; 841 rx &= 1;
533 w = OMAP_MCBSP_READ(io_base, SPCR1); 842 w = MCBSP_READ_CACHE(mcbsp, SPCR1);
534 OMAP_MCBSP_WRITE(io_base, SPCR1, w | rx); 843 MCBSP_WRITE(mcbsp, SPCR1, w | rx);
535 844
536 /* 845 /*
537 * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec 846 * Worst case: CLKSRG*2 = 8000khz: (1/8000) * 2 * 2 usec
@@ -543,18 +852,18 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
543 852
544 if (idle) { 853 if (idle) {
545 /* Start frame sync */ 854 /* Start frame sync */
546 w = OMAP_MCBSP_READ(io_base, SPCR2); 855 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
547 OMAP_MCBSP_WRITE(io_base, SPCR2, w | (1 << 7)); 856 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
548 } 857 }
549 858
550 if (cpu_is_omap2430() || cpu_is_omap34xx()) { 859 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
551 /* Release the transmitter and receiver */ 860 /* Release the transmitter and receiver */
552 w = OMAP_MCBSP_READ(io_base, XCCR); 861 w = MCBSP_READ_CACHE(mcbsp, XCCR);
553 w &= ~(tx ? XDISABLE : 0); 862 w &= ~(tx ? XDISABLE : 0);
554 OMAP_MCBSP_WRITE(io_base, XCCR, w); 863 MCBSP_WRITE(mcbsp, XCCR, w);
555 w = OMAP_MCBSP_READ(io_base, RCCR); 864 w = MCBSP_READ_CACHE(mcbsp, RCCR);
556 w &= ~(rx ? RDISABLE : 0); 865 w &= ~(rx ? RDISABLE : 0);
557 OMAP_MCBSP_WRITE(io_base, RCCR, w); 866 MCBSP_WRITE(mcbsp, RCCR, w);
558 } 867 }
559 868
560 /* Dump McBSP Regs */ 869 /* Dump McBSP Regs */
@@ -565,7 +874,6 @@ EXPORT_SYMBOL(omap_mcbsp_start);
565void omap_mcbsp_stop(unsigned int id, int tx, int rx) 874void omap_mcbsp_stop(unsigned int id, int tx, int rx)
566{ 875{
567 struct omap_mcbsp *mcbsp; 876 struct omap_mcbsp *mcbsp;
568 void __iomem *io_base;
569 int idle; 877 int idle;
570 u16 w; 878 u16 w;
571 879
@@ -575,36 +883,38 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
575 } 883 }
576 884
577 mcbsp = id_to_mcbsp_ptr(id); 885 mcbsp = id_to_mcbsp_ptr(id);
578 io_base = mcbsp->io_base;
579 886
580 /* Reset transmitter */ 887 /* Reset transmitter */
581 tx &= 1; 888 tx &= 1;
582 if (cpu_is_omap2430() || cpu_is_omap34xx()) { 889 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
583 w = OMAP_MCBSP_READ(io_base, XCCR); 890 w = MCBSP_READ_CACHE(mcbsp, XCCR);
584 w |= (tx ? XDISABLE : 0); 891 w |= (tx ? XDISABLE : 0);
585 OMAP_MCBSP_WRITE(io_base, XCCR, w); 892 MCBSP_WRITE(mcbsp, XCCR, w);
586 } 893 }
587 w = OMAP_MCBSP_READ(io_base, SPCR2); 894 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
588 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~tx); 895 MCBSP_WRITE(mcbsp, SPCR2, w & ~tx);
589 896
590 /* Reset receiver */ 897 /* Reset receiver */
591 rx &= 1; 898 rx &= 1;
592 if (cpu_is_omap2430() || cpu_is_omap34xx()) { 899 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
593 w = OMAP_MCBSP_READ(io_base, RCCR); 900 w = MCBSP_READ_CACHE(mcbsp, RCCR);
594 w |= (rx ? RDISABLE : 0); 901 w |= (rx ? RDISABLE : 0);
595 OMAP_MCBSP_WRITE(io_base, RCCR, w); 902 MCBSP_WRITE(mcbsp, RCCR, w);
596 } 903 }
597 w = OMAP_MCBSP_READ(io_base, SPCR1); 904 w = MCBSP_READ_CACHE(mcbsp, SPCR1);
598 OMAP_MCBSP_WRITE(io_base, SPCR1, w & ~rx); 905 MCBSP_WRITE(mcbsp, SPCR1, w & ~rx);
599 906
600 idle = !((OMAP_MCBSP_READ(io_base, SPCR2) | 907 idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
601 OMAP_MCBSP_READ(io_base, SPCR1)) & 1); 908 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
602 909
603 if (idle) { 910 if (idle) {
604 /* Reset the sample rate generator */ 911 /* Reset the sample rate generator */
605 w = OMAP_MCBSP_READ(io_base, SPCR2); 912 w = MCBSP_READ_CACHE(mcbsp, SPCR2);
606 OMAP_MCBSP_WRITE(io_base, SPCR2, w & ~(1 << 6)); 913 MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6));
607 } 914 }
915
916 if (cpu_is_omap34xx())
917 omap_st_stop(mcbsp);
608} 918}
609EXPORT_SYMBOL(omap_mcbsp_stop); 919EXPORT_SYMBOL(omap_mcbsp_stop);
610 920
@@ -612,7 +922,6 @@ EXPORT_SYMBOL(omap_mcbsp_stop);
612int omap_mcbsp_pollwrite(unsigned int id, u16 buf) 922int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
613{ 923{
614 struct omap_mcbsp *mcbsp; 924 struct omap_mcbsp *mcbsp;
615 void __iomem *base;
616 925
617 if (!omap_mcbsp_check_valid_id(id)) { 926 if (!omap_mcbsp_check_valid_id(id)) {
618 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 927 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -620,28 +929,27 @@ int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
620 } 929 }
621 930
622 mcbsp = id_to_mcbsp_ptr(id); 931 mcbsp = id_to_mcbsp_ptr(id);
623 base = mcbsp->io_base;
624 932
625 writew(buf, base + OMAP_MCBSP_REG_DXR1); 933 MCBSP_WRITE(mcbsp, DXR1, buf);
626 /* if frame sync error - clear the error */ 934 /* if frame sync error - clear the error */
627 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) { 935 if (MCBSP_READ(mcbsp, SPCR2) & XSYNC_ERR) {
628 /* clear error */ 936 /* clear error */
629 writew(readw(base + OMAP_MCBSP_REG_SPCR2) & (~XSYNC_ERR), 937 MCBSP_WRITE(mcbsp, SPCR2,
630 base + OMAP_MCBSP_REG_SPCR2); 938 MCBSP_READ_CACHE(mcbsp, SPCR2) & (~XSYNC_ERR));
631 /* resend */ 939 /* resend */
632 return -1; 940 return -1;
633 } else { 941 } else {
634 /* wait for transmit confirmation */ 942 /* wait for transmit confirmation */
635 int attemps = 0; 943 int attemps = 0;
636 while (!(readw(base + OMAP_MCBSP_REG_SPCR2) & XRDY)) { 944 while (!(MCBSP_READ(mcbsp, SPCR2) & XRDY)) {
637 if (attemps++ > 1000) { 945 if (attemps++ > 1000) {
638 writew(readw(base + OMAP_MCBSP_REG_SPCR2) & 946 MCBSP_WRITE(mcbsp, SPCR2,
639 (~XRST), 947 MCBSP_READ_CACHE(mcbsp, SPCR2) &
640 base + OMAP_MCBSP_REG_SPCR2); 948 (~XRST));
641 udelay(10); 949 udelay(10);
642 writew(readw(base + OMAP_MCBSP_REG_SPCR2) | 950 MCBSP_WRITE(mcbsp, SPCR2,
643 (XRST), 951 MCBSP_READ_CACHE(mcbsp, SPCR2) |
644 base + OMAP_MCBSP_REG_SPCR2); 952 (XRST));
645 udelay(10); 953 udelay(10);
646 dev_err(mcbsp->dev, "Could not write to" 954 dev_err(mcbsp->dev, "Could not write to"
647 " McBSP%d Register\n", mcbsp->id); 955 " McBSP%d Register\n", mcbsp->id);
@@ -657,7 +965,6 @@ EXPORT_SYMBOL(omap_mcbsp_pollwrite);
657int omap_mcbsp_pollread(unsigned int id, u16 *buf) 965int omap_mcbsp_pollread(unsigned int id, u16 *buf)
658{ 966{
659 struct omap_mcbsp *mcbsp; 967 struct omap_mcbsp *mcbsp;
660 void __iomem *base;
661 968
662 if (!omap_mcbsp_check_valid_id(id)) { 969 if (!omap_mcbsp_check_valid_id(id)) {
663 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1); 970 printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -665,26 +972,25 @@ int omap_mcbsp_pollread(unsigned int id, u16 *buf)
665 } 972 }
666 mcbsp = id_to_mcbsp_ptr(id); 973 mcbsp = id_to_mcbsp_ptr(id);
667 974
668 base = mcbsp->io_base;
669 /* if frame sync error - clear the error */ 975 /* if frame sync error - clear the error */
670 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) { 976 if (MCBSP_READ(mcbsp, SPCR1) & RSYNC_ERR) {
671 /* clear error */ 977 /* clear error */
672 writew(readw(base + OMAP_MCBSP_REG_SPCR1) & (~RSYNC_ERR), 978 MCBSP_WRITE(mcbsp, SPCR1,
673 base + OMAP_MCBSP_REG_SPCR1); 979 MCBSP_READ_CACHE(mcbsp, SPCR1) & (~RSYNC_ERR));
674 /* resend */ 980 /* resend */
675 return -1; 981 return -1;
676 } else { 982 } else {
677 /* wait for recieve confirmation */ 983 /* wait for recieve confirmation */
678 int attemps = 0; 984 int attemps = 0;
679 while (!(readw(base + OMAP_MCBSP_REG_SPCR1) & RRDY)) { 985 while (!(MCBSP_READ(mcbsp, SPCR1) & RRDY)) {
680 if (attemps++ > 1000) { 986 if (attemps++ > 1000) {
681 writew(readw(base + OMAP_MCBSP_REG_SPCR1) & 987 MCBSP_WRITE(mcbsp, SPCR1,
682 (~RRST), 988 MCBSP_READ_CACHE(mcbsp, SPCR1) &
683 base + OMAP_MCBSP_REG_SPCR1); 989 (~RRST));
684 udelay(10); 990 udelay(10);
685 writew(readw(base + OMAP_MCBSP_REG_SPCR1) | 991 MCBSP_WRITE(mcbsp, SPCR1,
686 (RRST), 992 MCBSP_READ_CACHE(mcbsp, SPCR1) |
687 base + OMAP_MCBSP_REG_SPCR1); 993 (RRST));
688 udelay(10); 994 udelay(10);
689 dev_err(mcbsp->dev, "Could not read from" 995 dev_err(mcbsp->dev, "Could not read from"
690 " McBSP%d Register\n", mcbsp->id); 996 " McBSP%d Register\n", mcbsp->id);
@@ -692,7 +998,7 @@ int omap_mcbsp_pollread(unsigned int id, u16 *buf)
692 } 998 }
693 } 999 }
694 } 1000 }
695 *buf = readw(base + OMAP_MCBSP_REG_DRR1); 1001 *buf = MCBSP_READ(mcbsp, DRR1);
696 1002
697 return 0; 1003 return 0;
698} 1004}
@@ -704,7 +1010,6 @@ EXPORT_SYMBOL(omap_mcbsp_pollread);
704void omap_mcbsp_xmit_word(unsigned int id, u32 word) 1010void omap_mcbsp_xmit_word(unsigned int id, u32 word)
705{ 1011{
706 struct omap_mcbsp *mcbsp; 1012 struct omap_mcbsp *mcbsp;
707 void __iomem *io_base;
708 omap_mcbsp_word_length word_length; 1013 omap_mcbsp_word_length word_length;
709 1014
710 if (!omap_mcbsp_check_valid_id(id)) { 1015 if (!omap_mcbsp_check_valid_id(id)) {
@@ -713,21 +1018,19 @@ void omap_mcbsp_xmit_word(unsigned int id, u32 word)
713 } 1018 }
714 1019
715 mcbsp = id_to_mcbsp_ptr(id); 1020 mcbsp = id_to_mcbsp_ptr(id);
716 io_base = mcbsp->io_base;
717 word_length = mcbsp->tx_word_length; 1021 word_length = mcbsp->tx_word_length;
718 1022
719 wait_for_completion(&mcbsp->tx_irq_completion); 1023 wait_for_completion(&mcbsp->tx_irq_completion);
720 1024
721 if (word_length > OMAP_MCBSP_WORD_16) 1025 if (word_length > OMAP_MCBSP_WORD_16)
722 OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16); 1026 MCBSP_WRITE(mcbsp, DXR2, word >> 16);
723 OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff); 1027 MCBSP_WRITE(mcbsp, DXR1, word & 0xffff);
724} 1028}
725EXPORT_SYMBOL(omap_mcbsp_xmit_word); 1029EXPORT_SYMBOL(omap_mcbsp_xmit_word);
726 1030
727u32 omap_mcbsp_recv_word(unsigned int id) 1031u32 omap_mcbsp_recv_word(unsigned int id)
728{ 1032{
729 struct omap_mcbsp *mcbsp; 1033 struct omap_mcbsp *mcbsp;
730 void __iomem *io_base;
731 u16 word_lsb, word_msb = 0; 1034 u16 word_lsb, word_msb = 0;
732 omap_mcbsp_word_length word_length; 1035 omap_mcbsp_word_length word_length;
733 1036
@@ -738,13 +1041,12 @@ u32 omap_mcbsp_recv_word(unsigned int id)
738 mcbsp = id_to_mcbsp_ptr(id); 1041 mcbsp = id_to_mcbsp_ptr(id);
739 1042
740 word_length = mcbsp->rx_word_length; 1043 word_length = mcbsp->rx_word_length;
741 io_base = mcbsp->io_base;
742 1044
743 wait_for_completion(&mcbsp->rx_irq_completion); 1045 wait_for_completion(&mcbsp->rx_irq_completion);
744 1046
745 if (word_length > OMAP_MCBSP_WORD_16) 1047 if (word_length > OMAP_MCBSP_WORD_16)
746 word_msb = OMAP_MCBSP_READ(io_base, DRR2); 1048 word_msb = MCBSP_READ(mcbsp, DRR2);
747 word_lsb = OMAP_MCBSP_READ(io_base, DRR1); 1049 word_lsb = MCBSP_READ(mcbsp, DRR1);
748 1050
749 return (word_lsb | (word_msb << 16)); 1051 return (word_lsb | (word_msb << 16));
750} 1052}
@@ -753,7 +1055,6 @@ EXPORT_SYMBOL(omap_mcbsp_recv_word);
753int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word) 1055int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
754{ 1056{
755 struct omap_mcbsp *mcbsp; 1057 struct omap_mcbsp *mcbsp;
756 void __iomem *io_base;
757 omap_mcbsp_word_length tx_word_length; 1058 omap_mcbsp_word_length tx_word_length;
758 omap_mcbsp_word_length rx_word_length; 1059 omap_mcbsp_word_length rx_word_length;
759 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 1060 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
@@ -763,7 +1064,6 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
763 return -ENODEV; 1064 return -ENODEV;
764 } 1065 }
765 mcbsp = id_to_mcbsp_ptr(id); 1066 mcbsp = id_to_mcbsp_ptr(id);
766 io_base = mcbsp->io_base;
767 tx_word_length = mcbsp->tx_word_length; 1067 tx_word_length = mcbsp->tx_word_length;
768 rx_word_length = mcbsp->rx_word_length; 1068 rx_word_length = mcbsp->rx_word_length;
769 1069
@@ -771,14 +1071,16 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
771 return -EINVAL; 1071 return -EINVAL;
772 1072
773 /* First we wait for the transmitter to be ready */ 1073 /* First we wait for the transmitter to be ready */
774 spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 1074 spcr2 = MCBSP_READ(mcbsp, SPCR2);
775 while (!(spcr2 & XRDY)) { 1075 while (!(spcr2 & XRDY)) {
776 spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 1076 spcr2 = MCBSP_READ(mcbsp, SPCR2);
777 if (attempts++ > 1000) { 1077 if (attempts++ > 1000) {
778 /* We must reset the transmitter */ 1078 /* We must reset the transmitter */
779 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 & (~XRST)); 1079 MCBSP_WRITE(mcbsp, SPCR2,
1080 MCBSP_READ_CACHE(mcbsp, SPCR2) & (~XRST));
780 udelay(10); 1081 udelay(10);
781 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 1082 MCBSP_WRITE(mcbsp, SPCR2,
1083 MCBSP_READ_CACHE(mcbsp, SPCR2) | XRST);
782 udelay(10); 1084 udelay(10);
783 dev_err(mcbsp->dev, "McBSP%d transmitter not " 1085 dev_err(mcbsp->dev, "McBSP%d transmitter not "
784 "ready\n", mcbsp->id); 1086 "ready\n", mcbsp->id);
@@ -788,18 +1090,20 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
788 1090
789 /* Now we can push the data */ 1091 /* Now we can push the data */
790 if (tx_word_length > OMAP_MCBSP_WORD_16) 1092 if (tx_word_length > OMAP_MCBSP_WORD_16)
791 OMAP_MCBSP_WRITE(io_base, DXR2, word >> 16); 1093 MCBSP_WRITE(mcbsp, DXR2, word >> 16);
792 OMAP_MCBSP_WRITE(io_base, DXR1, word & 0xffff); 1094 MCBSP_WRITE(mcbsp, DXR1, word & 0xffff);
793 1095
794 /* We wait for the receiver to be ready */ 1096 /* We wait for the receiver to be ready */
795 spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 1097 spcr1 = MCBSP_READ(mcbsp, SPCR1);
796 while (!(spcr1 & RRDY)) { 1098 while (!(spcr1 & RRDY)) {
797 spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 1099 spcr1 = MCBSP_READ(mcbsp, SPCR1);
798 if (attempts++ > 1000) { 1100 if (attempts++ > 1000) {
799 /* We must reset the receiver */ 1101 /* We must reset the receiver */
800 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 & (~RRST)); 1102 MCBSP_WRITE(mcbsp, SPCR1,
1103 MCBSP_READ_CACHE(mcbsp, SPCR1) & (~RRST));
801 udelay(10); 1104 udelay(10);
802 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 1105 MCBSP_WRITE(mcbsp, SPCR1,
1106 MCBSP_READ_CACHE(mcbsp, SPCR1) | RRST);
803 udelay(10); 1107 udelay(10);
804 dev_err(mcbsp->dev, "McBSP%d receiver not " 1108 dev_err(mcbsp->dev, "McBSP%d receiver not "
805 "ready\n", mcbsp->id); 1109 "ready\n", mcbsp->id);
@@ -809,8 +1113,8 @@ int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word)
809 1113
810 /* Receiver is ready, let's read the dummy data */ 1114 /* Receiver is ready, let's read the dummy data */
811 if (rx_word_length > OMAP_MCBSP_WORD_16) 1115 if (rx_word_length > OMAP_MCBSP_WORD_16)
812 word_msb = OMAP_MCBSP_READ(io_base, DRR2); 1116 word_msb = MCBSP_READ(mcbsp, DRR2);
813 word_lsb = OMAP_MCBSP_READ(io_base, DRR1); 1117 word_lsb = MCBSP_READ(mcbsp, DRR1);
814 1118
815 return 0; 1119 return 0;
816} 1120}
@@ -820,7 +1124,6 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
820{ 1124{
821 struct omap_mcbsp *mcbsp; 1125 struct omap_mcbsp *mcbsp;
822 u32 clock_word = 0; 1126 u32 clock_word = 0;
823 void __iomem *io_base;
824 omap_mcbsp_word_length tx_word_length; 1127 omap_mcbsp_word_length tx_word_length;
825 omap_mcbsp_word_length rx_word_length; 1128 omap_mcbsp_word_length rx_word_length;
826 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0; 1129 u16 spcr2, spcr1, attempts = 0, word_lsb, word_msb = 0;
@@ -831,7 +1134,6 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
831 } 1134 }
832 1135
833 mcbsp = id_to_mcbsp_ptr(id); 1136 mcbsp = id_to_mcbsp_ptr(id);
834 io_base = mcbsp->io_base;
835 1137
836 tx_word_length = mcbsp->tx_word_length; 1138 tx_word_length = mcbsp->tx_word_length;
837 rx_word_length = mcbsp->rx_word_length; 1139 rx_word_length = mcbsp->rx_word_length;
@@ -840,14 +1142,16 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
840 return -EINVAL; 1142 return -EINVAL;
841 1143
842 /* First we wait for the transmitter to be ready */ 1144 /* First we wait for the transmitter to be ready */
843 spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 1145 spcr2 = MCBSP_READ(mcbsp, SPCR2);
844 while (!(spcr2 & XRDY)) { 1146 while (!(spcr2 & XRDY)) {
845 spcr2 = OMAP_MCBSP_READ(io_base, SPCR2); 1147 spcr2 = MCBSP_READ(mcbsp, SPCR2);
846 if (attempts++ > 1000) { 1148 if (attempts++ > 1000) {
847 /* We must reset the transmitter */ 1149 /* We must reset the transmitter */
848 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 & (~XRST)); 1150 MCBSP_WRITE(mcbsp, SPCR2,
1151 MCBSP_READ_CACHE(mcbsp, SPCR2) & (~XRST));
849 udelay(10); 1152 udelay(10);
850 OMAP_MCBSP_WRITE(io_base, SPCR2, spcr2 | XRST); 1153 MCBSP_WRITE(mcbsp, SPCR2,
1154 MCBSP_READ_CACHE(mcbsp, SPCR2) | XRST);
851 udelay(10); 1155 udelay(10);
852 dev_err(mcbsp->dev, "McBSP%d transmitter not " 1156 dev_err(mcbsp->dev, "McBSP%d transmitter not "
853 "ready\n", mcbsp->id); 1157 "ready\n", mcbsp->id);
@@ -857,18 +1161,20 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
857 1161
858 /* We first need to enable the bus clock */ 1162 /* We first need to enable the bus clock */
859 if (tx_word_length > OMAP_MCBSP_WORD_16) 1163 if (tx_word_length > OMAP_MCBSP_WORD_16)
860 OMAP_MCBSP_WRITE(io_base, DXR2, clock_word >> 16); 1164 MCBSP_WRITE(mcbsp, DXR2, clock_word >> 16);
861 OMAP_MCBSP_WRITE(io_base, DXR1, clock_word & 0xffff); 1165 MCBSP_WRITE(mcbsp, DXR1, clock_word & 0xffff);
862 1166
863 /* We wait for the receiver to be ready */ 1167 /* We wait for the receiver to be ready */
864 spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 1168 spcr1 = MCBSP_READ(mcbsp, SPCR1);
865 while (!(spcr1 & RRDY)) { 1169 while (!(spcr1 & RRDY)) {
866 spcr1 = OMAP_MCBSP_READ(io_base, SPCR1); 1170 spcr1 = MCBSP_READ(mcbsp, SPCR1);
867 if (attempts++ > 1000) { 1171 if (attempts++ > 1000) {
868 /* We must reset the receiver */ 1172 /* We must reset the receiver */
869 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 & (~RRST)); 1173 MCBSP_WRITE(mcbsp, SPCR1,
1174 MCBSP_READ_CACHE(mcbsp, SPCR1) & (~RRST));
870 udelay(10); 1175 udelay(10);
871 OMAP_MCBSP_WRITE(io_base, SPCR1, spcr1 | RRST); 1176 MCBSP_WRITE(mcbsp, SPCR1,
1177 MCBSP_READ_CACHE(mcbsp, SPCR1) | RRST);
872 udelay(10); 1178 udelay(10);
873 dev_err(mcbsp->dev, "McBSP%d receiver not " 1179 dev_err(mcbsp->dev, "McBSP%d receiver not "
874 "ready\n", mcbsp->id); 1180 "ready\n", mcbsp->id);
@@ -878,8 +1184,8 @@ int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 *word)
878 1184
879 /* Receiver is ready, there is something for us */ 1185 /* Receiver is ready, there is something for us */
880 if (rx_word_length > OMAP_MCBSP_WORD_16) 1186 if (rx_word_length > OMAP_MCBSP_WORD_16)
881 word_msb = OMAP_MCBSP_READ(io_base, DRR2); 1187 word_msb = MCBSP_READ(mcbsp, DRR2);
882 word_lsb = OMAP_MCBSP_READ(io_base, DRR1); 1188 word_lsb = MCBSP_READ(mcbsp, DRR1);
883 1189
884 word[0] = (word_lsb | (word_msb << 16)); 1190 word[0] = (word_lsb | (word_msb << 16));
885 1191
@@ -1093,7 +1399,7 @@ void omap_mcbsp_set_spi_mode(unsigned int id,
1093} 1399}
1094EXPORT_SYMBOL(omap_mcbsp_set_spi_mode); 1400EXPORT_SYMBOL(omap_mcbsp_set_spi_mode);
1095 1401
1096#ifdef CONFIG_ARCH_OMAP34XX 1402#ifdef CONFIG_ARCH_OMAP3
1097#define max_thres(m) (mcbsp->pdata->buffer_size) 1403#define max_thres(m) (mcbsp->pdata->buffer_size)
1098#define valid_threshold(m, val) ((val) <= max_thres(m)) 1404#define valid_threshold(m, val) ((val) <= max_thres(m))
1099#define THRESHOLD_PROP_BUILDER(prop) \ 1405#define THRESHOLD_PROP_BUILDER(prop) \
@@ -1184,6 +1490,64 @@ unlock:
1184 1490
1185static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store); 1491static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
1186 1492
1493static ssize_t st_taps_show(struct device *dev,
1494 struct device_attribute *attr, char *buf)
1495{
1496 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
1497 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1498 ssize_t status = 0;
1499 int i;
1500
1501 spin_lock_irq(&mcbsp->lock);
1502 for (i = 0; i < st_data->nr_taps; i++)
1503 status += sprintf(&buf[status], (i ? ", %d" : "%d"),
1504 st_data->taps[i]);
1505 if (i)
1506 status += sprintf(&buf[status], "\n");
1507 spin_unlock_irq(&mcbsp->lock);
1508
1509 return status;
1510}
1511
1512static ssize_t st_taps_store(struct device *dev,
1513 struct device_attribute *attr,
1514 const char *buf, size_t size)
1515{
1516 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev);
1517 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1518 int val, tmp, status, i = 0;
1519
1520 spin_lock_irq(&mcbsp->lock);
1521 memset(st_data->taps, 0, sizeof(st_data->taps));
1522 st_data->nr_taps = 0;
1523
1524 do {
1525 status = sscanf(buf, "%d%n", &val, &tmp);
1526 if (status < 0 || status == 0) {
1527 size = -EINVAL;
1528 goto out;
1529 }
1530 if (val < -32768 || val > 32767) {
1531 size = -EINVAL;
1532 goto out;
1533 }
1534 st_data->taps[i++] = val;
1535 buf += tmp;
1536 if (*buf != ',')
1537 break;
1538 buf++;
1539 } while (1);
1540
1541 st_data->nr_taps = i;
1542
1543out:
1544 spin_unlock_irq(&mcbsp->lock);
1545
1546 return size;
1547}
1548
1549static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
1550
1187static const struct attribute *additional_attrs[] = { 1551static const struct attribute *additional_attrs[] = {
1188 &dev_attr_max_tx_thres.attr, 1552 &dev_attr_max_tx_thres.attr,
1189 &dev_attr_max_rx_thres.attr, 1553 &dev_attr_max_rx_thres.attr,
@@ -1205,6 +1569,60 @@ static inline void __devexit omap_additional_remove(struct device *dev)
1205 sysfs_remove_group(&dev->kobj, &additional_attr_group); 1569 sysfs_remove_group(&dev->kobj, &additional_attr_group);
1206} 1570}
1207 1571
1572static const struct attribute *sidetone_attrs[] = {
1573 &dev_attr_st_taps.attr,
1574 NULL,
1575};
1576
1577static const struct attribute_group sidetone_attr_group = {
1578 .attrs = (struct attribute **)sidetone_attrs,
1579};
1580
1581int __devinit omap_st_add(struct omap_mcbsp *mcbsp)
1582{
1583 struct omap_mcbsp_platform_data *pdata = mcbsp->pdata;
1584 struct omap_mcbsp_st_data *st_data;
1585 int err;
1586
1587 st_data = kzalloc(sizeof(*mcbsp->st_data), GFP_KERNEL);
1588 if (!st_data) {
1589 err = -ENOMEM;
1590 goto err1;
1591 }
1592
1593 st_data->io_base_st = ioremap(pdata->phys_base_st, SZ_4K);
1594 if (!st_data->io_base_st) {
1595 err = -ENOMEM;
1596 goto err2;
1597 }
1598
1599 err = sysfs_create_group(&mcbsp->dev->kobj, &sidetone_attr_group);
1600 if (err)
1601 goto err3;
1602
1603 mcbsp->st_data = st_data;
1604 return 0;
1605
1606err3:
1607 iounmap(st_data->io_base_st);
1608err2:
1609 kfree(st_data);
1610err1:
1611 return err;
1612
1613}
1614
1615static void __devexit omap_st_remove(struct omap_mcbsp *mcbsp)
1616{
1617 struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
1618
1619 if (st_data) {
1620 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
1621 iounmap(st_data->io_base_st);
1622 kfree(st_data);
1623 }
1624}
1625
1208static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) 1626static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
1209{ 1627{
1210 mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; 1628 mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT;
@@ -1218,6 +1636,12 @@ static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
1218 if (omap_additional_add(mcbsp->dev)) 1636 if (omap_additional_add(mcbsp->dev))
1219 dev_warn(mcbsp->dev, 1637 dev_warn(mcbsp->dev,
1220 "Unable to create additional controls\n"); 1638 "Unable to create additional controls\n");
1639
1640 if (mcbsp->id == 2 || mcbsp->id == 3)
1641 if (omap_st_add(mcbsp))
1642 dev_warn(mcbsp->dev,
1643 "Unable to create sidetone controls\n");
1644
1221 } else { 1645 } else {
1222 mcbsp->max_tx_thres = -EINVAL; 1646 mcbsp->max_tx_thres = -EINVAL;
1223 mcbsp->max_rx_thres = -EINVAL; 1647 mcbsp->max_rx_thres = -EINVAL;
@@ -1226,13 +1650,17 @@ static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp)
1226 1650
1227static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) 1651static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp)
1228{ 1652{
1229 if (cpu_is_omap34xx()) 1653 if (cpu_is_omap34xx()) {
1230 omap_additional_remove(mcbsp->dev); 1654 omap_additional_remove(mcbsp->dev);
1655
1656 if (mcbsp->id == 2 || mcbsp->id == 3)
1657 omap_st_remove(mcbsp);
1658 }
1231} 1659}
1232#else 1660#else
1233static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {} 1661static inline void __devinit omap34xx_device_init(struct omap_mcbsp *mcbsp) {}
1234static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {} 1662static inline void __devexit omap34xx_device_exit(struct omap_mcbsp *mcbsp) {}
1235#endif /* CONFIG_ARCH_OMAP34XX */ 1663#endif /* CONFIG_ARCH_OMAP3 */
1236 1664
1237/* 1665/*
1238 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 1666 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 1e5648d3e3d8..590435894848 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -89,16 +89,8 @@
89#define USE_WAKEUP_LAT 0 89#define USE_WAKEUP_LAT 0
90#define IGNORE_WAKEUP_LAT 1 90#define IGNORE_WAKEUP_LAT 1
91 91
92/* XXX this should be moved into a separate file */ 92
93#if defined(CONFIG_ARCH_OMAP2420) 93#define OMAP_DEVICE_MAGIC 0xf00dcafe
94# define OMAP_32KSYNCT_BASE 0x48004000
95#elif defined(CONFIG_ARCH_OMAP2430)
96# define OMAP_32KSYNCT_BASE 0x49020000
97#elif defined(CONFIG_ARCH_OMAP3430)
98# define OMAP_32KSYNCT_BASE 0x48320000
99#else
100# error Unknown OMAP device
101#endif
102 94
103/* Private functions */ 95/* Private functions */
104 96
@@ -148,10 +140,22 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
148 "%llu nsec\n", od->pdev.name, od->pm_lat_level, 140 "%llu nsec\n", od->pdev.name, od->pm_lat_level,
149 act_lat); 141 act_lat);
150 142
151 WARN(act_lat > odpl->activate_lat, "omap_device: %s.%d: " 143 if (act_lat > odpl->activate_lat) {
152 "activate step %d took longer than expected (%llu > %d)\n", 144 odpl->activate_lat_worst = act_lat;
153 od->pdev.name, od->pdev.id, od->pm_lat_level, 145 if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) {
154 act_lat, odpl->activate_lat); 146 odpl->activate_lat = act_lat;
147 pr_warning("omap_device: %s.%d: new worst case "
148 "activate latency %d: %llu\n",
149 od->pdev.name, od->pdev.id,
150 od->pm_lat_level, act_lat);
151 } else
152 pr_warning("omap_device: %s.%d: activate "
153 "latency %d higher than exptected. "
154 "(%llu > %d)\n",
155 od->pdev.name, od->pdev.id,
156 od->pm_lat_level, act_lat,
157 odpl->activate_lat);
158 }
155 159
156 od->dev_wakeup_lat -= odpl->activate_lat; 160 od->dev_wakeup_lat -= odpl->activate_lat;
157 } 161 }
@@ -204,10 +208,23 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
204 "%llu nsec\n", od->pdev.name, od->pm_lat_level, 208 "%llu nsec\n", od->pdev.name, od->pm_lat_level,
205 deact_lat); 209 deact_lat);
206 210
207 WARN(deact_lat > odpl->deactivate_lat, "omap_device: %s.%d: " 211 if (deact_lat > odpl->deactivate_lat) {
208 "deactivate step %d took longer than expected " 212 odpl->deactivate_lat_worst = deact_lat;
209 "(%llu > %d)\n", od->pdev.name, od->pdev.id, 213 if (odpl->flags & OMAP_DEVICE_LATENCY_AUTO_ADJUST) {
210 od->pm_lat_level, deact_lat, odpl->deactivate_lat); 214 odpl->deactivate_lat = deact_lat;
215 pr_warning("omap_device: %s.%d: new worst case "
216 "deactivate latency %d: %llu\n",
217 od->pdev.name, od->pdev.id,
218 od->pm_lat_level, deact_lat);
219 } else
220 pr_warning("omap_device: %s.%d: deactivate "
221 "latency %d higher than exptected. "
222 "(%llu > %d)\n",
223 od->pdev.name, od->pdev.id,
224 od->pm_lat_level, deact_lat,
225 odpl->deactivate_lat);
226 }
227
211 228
212 od->dev_wakeup_lat += odpl->activate_lat; 229 od->dev_wakeup_lat += odpl->activate_lat;
213 230
@@ -290,6 +307,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)
290 * @pdata_len: amount of memory pointed to by @pdata 307 * @pdata_len: amount of memory pointed to by @pdata
291 * @pm_lats: pointer to a omap_device_pm_latency array for this device 308 * @pm_lats: pointer to a omap_device_pm_latency array for this device
292 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats 309 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
310 * @is_early_device: should the device be registered as an early device or not
293 * 311 *
294 * Convenience function for building and registering a single 312 * Convenience function for building and registering a single
295 * omap_device record, which in turn builds and registers a 313 * omap_device record, which in turn builds and registers a
@@ -301,7 +319,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
301 struct omap_hwmod *oh, void *pdata, 319 struct omap_hwmod *oh, void *pdata,
302 int pdata_len, 320 int pdata_len,
303 struct omap_device_pm_latency *pm_lats, 321 struct omap_device_pm_latency *pm_lats,
304 int pm_lats_cnt) 322 int pm_lats_cnt, int is_early_device)
305{ 323{
306 struct omap_hwmod *ohs[] = { oh }; 324 struct omap_hwmod *ohs[] = { oh };
307 325
@@ -309,7 +327,8 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
309 return ERR_PTR(-EINVAL); 327 return ERR_PTR(-EINVAL);
310 328
311 return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata, 329 return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata,
312 pdata_len, pm_lats, pm_lats_cnt); 330 pdata_len, pm_lats, pm_lats_cnt,
331 is_early_device);
313} 332}
314 333
315/** 334/**
@@ -321,6 +340,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
321 * @pdata_len: amount of memory pointed to by @pdata 340 * @pdata_len: amount of memory pointed to by @pdata
322 * @pm_lats: pointer to a omap_device_pm_latency array for this device 341 * @pm_lats: pointer to a omap_device_pm_latency array for this device
323 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats 342 * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
343 * @is_early_device: should the device be registered as an early device or not
324 * 344 *
325 * Convenience function for building and registering an omap_device 345 * Convenience function for building and registering an omap_device
326 * subsystem record. Subsystem records consist of multiple 346 * subsystem record. Subsystem records consist of multiple
@@ -332,7 +352,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
332 struct omap_hwmod **ohs, int oh_cnt, 352 struct omap_hwmod **ohs, int oh_cnt,
333 void *pdata, int pdata_len, 353 void *pdata, int pdata_len,
334 struct omap_device_pm_latency *pm_lats, 354 struct omap_device_pm_latency *pm_lats,
335 int pm_lats_cnt) 355 int pm_lats_cnt, int is_early_device)
336{ 356{
337 int ret = -ENOMEM; 357 int ret = -ENOMEM;
338 struct omap_device *od; 358 struct omap_device *od;
@@ -388,7 +408,13 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
388 od->pm_lats = pm_lats; 408 od->pm_lats = pm_lats;
389 od->pm_lats_cnt = pm_lats_cnt; 409 od->pm_lats_cnt = pm_lats_cnt;
390 410
391 ret = omap_device_register(od); 411 od->magic = OMAP_DEVICE_MAGIC;
412
413 if (is_early_device)
414 ret = omap_early_device_register(od);
415 else
416 ret = omap_device_register(od);
417
392 if (ret) 418 if (ret)
393 goto odbs_exit4; 419 goto odbs_exit4;
394 420
@@ -409,6 +435,24 @@ odbs_exit1:
409} 435}
410 436
411/** 437/**
438 * omap_early_device_register - register an omap_device as an early platform
439 * device.
440 * @od: struct omap_device * to register
441 *
442 * Register the omap_device structure. This currently just calls
443 * platform_early_add_device() on the underlying platform_device.
444 * Returns 0 by default.
445 */
446int omap_early_device_register(struct omap_device *od)
447{
448 struct platform_device *devices[1];
449
450 devices[0] = &(od->pdev);
451 early_platform_add_devices(devices, 1);
452 return 0;
453}
454
455/**
412 * omap_device_register - register an omap_device with one omap_hwmod 456 * omap_device_register - register an omap_device with one omap_hwmod
413 * @od: struct omap_device * to register 457 * @od: struct omap_device * to register
414 * 458 *
@@ -447,8 +491,8 @@ int omap_device_enable(struct platform_device *pdev)
447 od = _find_by_pdev(pdev); 491 od = _find_by_pdev(pdev);
448 492
449 if (od->_state == OMAP_DEVICE_STATE_ENABLED) { 493 if (od->_state == OMAP_DEVICE_STATE_ENABLED) {
450 WARN(1, "omap_device: %s.%d: omap_device_enable() called from " 494 WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n",
451 "invalid state\n", od->pdev.name, od->pdev.id); 495 od->pdev.name, od->pdev.id, __func__, od->_state);
452 return -EINVAL; 496 return -EINVAL;
453 } 497 }
454 498
@@ -486,8 +530,8 @@ int omap_device_idle(struct platform_device *pdev)
486 od = _find_by_pdev(pdev); 530 od = _find_by_pdev(pdev);
487 531
488 if (od->_state != OMAP_DEVICE_STATE_ENABLED) { 532 if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
489 WARN(1, "omap_device: %s.%d: omap_device_idle() called from " 533 WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n",
490 "invalid state\n", od->pdev.name, od->pdev.id); 534 od->pdev.name, od->pdev.id, __func__, od->_state);
491 return -EINVAL; 535 return -EINVAL;
492 } 536 }
493 537
@@ -519,8 +563,8 @@ int omap_device_shutdown(struct platform_device *pdev)
519 563
520 if (od->_state != OMAP_DEVICE_STATE_ENABLED && 564 if (od->_state != OMAP_DEVICE_STATE_ENABLED &&
521 od->_state != OMAP_DEVICE_STATE_IDLE) { 565 od->_state != OMAP_DEVICE_STATE_IDLE) {
522 WARN(1, "omap_device: %s.%d: omap_device_shutdown() called " 566 WARN(1, "omap_device: %s.%d: %s() called from invalid state %d\n",
523 "from invalid state\n", od->pdev.name, od->pdev.id); 567 od->pdev.name, od->pdev.id, __func__, od->_state);
524 return -EINVAL; 568 return -EINVAL;
525 } 569 }
526 570
@@ -574,6 +618,18 @@ int omap_device_align_pm_lat(struct platform_device *pdev,
574} 618}
575 619
576/** 620/**
621 * omap_device_is_valid - Check if pointer is a valid omap_device
622 * @od: struct omap_device *
623 *
624 * Return whether struct omap_device pointer @od points to a valid
625 * omap_device.
626 */
627bool omap_device_is_valid(struct omap_device *od)
628{
629 return (od && od->magic == OMAP_DEVICE_MAGIC);
630}
631
632/**
577 * omap_device_get_pwrdm - return the powerdomain * associated with @od 633 * omap_device_get_pwrdm - return the powerdomain * associated with @od
578 * @od: struct omap_device * 634 * @od: struct omap_device *
579 * 635 *
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index d8d5094b37ed..51f4dfb82e2b 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -53,7 +53,7 @@
53#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000) 53#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000)
54#define OMAP4_SRAM_PUB_VA (OMAP4_SRAM_VA + 0x4000) 54#define OMAP4_SRAM_PUB_VA (OMAP4_SRAM_VA + 0x4000)
55 55
56#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 56#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
57#define SRAM_BOOTLOADER_SZ 0x00 57#define SRAM_BOOTLOADER_SZ 0x00
58#else 58#else
59#define SRAM_BOOTLOADER_SZ 0x80 59#define SRAM_BOOTLOADER_SZ 0x80