Root/target/linux/omap24xx/patches-3.1/210-omap2-kexec-rewrite.patch

1--- a/arch/arm/Kconfig
2+++ b/arch/arm/Kconfig
3@@ -1888,7 +1888,7 @@ config XIP_PHYS_ADDR
4 
5 config KEXEC
6     bool "Kexec system call (EXPERIMENTAL)"
7- depends on EXPERIMENTAL
8+ depends on EXPERIMENTAL && (!SMP || HOTPLUG_CPU)
9     help
10       kexec is a system call that implements the ability to shutdown your
11       current kernel, and to start another kernel. It is like a reboot
12--- /dev/null
13+++ b/arch/arm/include/asm/idmap.h
14@@ -0,0 +1,11 @@
15+#ifndef __ASM_IDMAP_H
16+#define __ASM_IDMAP_H
17+
18+#include <linux/compiler.h>
19+
20+/* Tag a function as requiring to be executed via an identity mapping. */
21+#define __idmap __section(.idmap.text) noinline notrace
22+
23+void setup_mm_for_reboot(void);
24+
25+#endif /* __ASM_IDMAP_H */
26--- a/arch/arm/include/asm/mach/arch.h
27+++ b/arch/arm/include/asm/mach/arch.h
28@@ -30,10 +30,10 @@ struct machine_desc {
29     unsigned int video_start; /* start of video RAM */
30     unsigned int video_end; /* end of video RAM */
31 
32- unsigned int reserve_lp0 :1; /* never has lp0 */
33- unsigned int reserve_lp1 :1; /* never has lp1 */
34- unsigned int reserve_lp2 :1; /* never has lp2 */
35- unsigned int soft_reboot :1; /* soft reboot */
36+ unsigned char reserve_lp0 :1; /* never has lp0 */
37+ unsigned char reserve_lp1 :1; /* never has lp1 */
38+ unsigned char reserve_lp2 :1; /* never has lp2 */
39+ char restart_mode; /* default restart mode */
40     void (*fixup)(struct machine_desc *,
41                      struct tag *, char **,
42                      struct meminfo *);
43@@ -46,6 +46,7 @@ struct machine_desc {
44 #ifdef CONFIG_MULTI_IRQ_HANDLER
45     void (*handle_irq)(struct pt_regs *);
46 #endif
47+ void (*restart)(char, const char *);
48 };
49 
50 /*
51--- a/arch/arm/include/asm/system.h
52+++ b/arch/arm/include/asm/system.h
53@@ -107,7 +107,7 @@ extern void __show_regs(struct pt_regs *
54 extern int cpu_architecture(void);
55 extern void cpu_init(void);
56 
57-void arm_machine_restart(char mode, const char *cmd);
58+void soft_restart(unsigned long);
59 extern void (*arm_pm_restart)(char str, const char *cmd);
60 
61 #define UDBG_UNDEFINED (1 << 0)
62--- a/arch/arm/kernel/machine_kexec.c
63+++ b/arch/arm/kernel/machine_kexec.c
64@@ -12,12 +12,11 @@
65 #include <asm/mmu_context.h>
66 #include <asm/cacheflush.h>
67 #include <asm/mach-types.h>
68+#include <asm/system.h>
69 
70 extern const unsigned char relocate_new_kernel[];
71 extern const unsigned int relocate_new_kernel_size;
72 
73-extern void setup_mm_for_reboot(char mode);
74-
75 extern unsigned long kexec_start_address;
76 extern unsigned long kexec_indirection_page;
77 extern unsigned long kexec_mach_type;
78@@ -111,14 +110,6 @@ void machine_kexec(struct kimage *image)
79 
80     if (kexec_reinit)
81         kexec_reinit();
82- local_irq_disable();
83- local_fiq_disable();
84- setup_mm_for_reboot(0); /* mode is not used, so just pass 0*/
85- flush_cache_all();
86- outer_flush_all();
87- outer_disable();
88- cpu_proc_fin();
89- outer_inv_all();
90- flush_cache_all();
91- cpu_reset(reboot_code_buffer_phys);
92+
93+ soft_restart(reboot_code_buffer_phys);
94 }
95--- a/arch/arm/kernel/process.c
96+++ b/arch/arm/kernel/process.c
97@@ -57,7 +57,7 @@ static const char *isa_modes[] = {
98   "ARM" , "Thumb" , "Jazelle", "ThumbEE"
99 };
100 
101-extern void setup_mm_for_reboot(char mode);
102+extern void setup_mm_for_reboot(void);
103 
104 static volatile int hlt_counter;
105 
106@@ -92,40 +92,64 @@ static int __init hlt_setup(char *__unus
107 __setup("nohlt", nohlt_setup);
108 __setup("hlt", hlt_setup);
109 
110-void arm_machine_restart(char mode, const char *cmd)
111+extern void call_with_stack(void (*fn)(void *), void *arg, void *sp);
112+typedef void (*phys_reset_t)(unsigned long);
113+
114+/*
115+ * A temporary stack to use for CPU reset. This is static so that we
116+ * don't clobber it with the identity mapping. When running with this
117+ * stack, any references to the current task *will not work* so you
118+ * should really do as little as possible before jumping to your reset
119+ * code.
120+ */
121+#define SOFT_RESTART_STACK_WORDS 32
122+static u32 soft_restart_stack[SOFT_RESTART_STACK_WORDS];
123+
124+static void __soft_restart(void *addr)
125 {
126- /* Disable interrupts first */
127- local_irq_disable();
128- local_fiq_disable();
129+ phys_reset_t phys_reset;
130 
131- /*
132- * Tell the mm system that we are going to reboot -
133- * we may need it to insert some 1:1 mappings so that
134- * soft boot works.
135- */
136- setup_mm_for_reboot(mode);
137+ /* Take out a flat memory mapping. */
138+ setup_mm_for_reboot();
139 
140- /* Clean and invalidate caches */
141+ /* Clean and invalidate caches. */
142     flush_cache_all();
143 
144- /* Turn off caching */
145+ /* Turn off caching. */
146     cpu_proc_fin();
147 
148     /* Push out any further dirty data, and ensure cache is empty */
149     flush_cache_all();
150 
151- /*
152- * Now call the architecture specific reboot code.
153- */
154- arch_reset(mode, cmd);
155-
156- /*
157- * Whoops - the architecture was unable to reboot.
158- * Tell the user!
159- */
160- mdelay(1000);
161- printk("Reboot failed -- System halted\n");
162- while (1);
163+ /* Switch to the identity mapping. */
164+ phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
165+ phys_reset((unsigned long)addr);
166+
167+ /* Should never get here. */
168+ BUG();
169+}
170+
171+void soft_restart(unsigned long addr)
172+{
173+ u32 *stack = soft_restart_stack + SOFT_RESTART_STACK_WORDS;
174+
175+ /* Disable interrupts first */
176+ local_irq_disable();
177+ local_fiq_disable();
178+
179+ /* Disable the L2 if we're the last man standing. */
180+ if (num_online_cpus() == 1)
181+ outer_disable();
182+
183+ /* Change to the new stack and continue with the reset. */
184+ call_with_stack(__soft_restart, (void *)addr, (void *)stack);
185+
186+ /* Should never get here. */
187+ BUG();
188+}
189+
190+static void null_restart(char mode, const char *cmd)
191+{
192 }
193 
194 /*
195@@ -134,7 +158,7 @@ void arm_machine_restart(char mode, cons
196 void (*pm_power_off)(void);
197 EXPORT_SYMBOL(pm_power_off);
198 
199-void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
200+void (*arm_pm_restart)(char str, const char *cmd) = null_restart;
201 EXPORT_SYMBOL_GPL(arm_pm_restart);
202 
203 static void do_nothing(void *unused)
204@@ -253,7 +277,15 @@ void machine_power_off(void)
205 void machine_restart(char *cmd)
206 {
207     machine_shutdown();
208+
209     arm_pm_restart(reboot_mode, cmd);
210+
211+ /* Give a grace period for failure to restart of 1s */
212+ mdelay(1000);
213+
214+ /* Whoops - the platform was unable to reboot. Tell the user! */
215+ printk("Reboot failed -- System halted\n");
216+ while (1);
217 }
218 
219 void __show_regs(struct pt_regs *regs)
220--- a/arch/arm/kernel/setup.c
221+++ b/arch/arm/kernel/setup.c
222@@ -896,8 +896,8 @@ void __init setup_arch(char **cmdline_p)
223         arm_dma_zone_size = mdesc->dma_zone_size;
224     }
225 #endif
226- if (mdesc->soft_reboot)
227- reboot_setup("s");
228+ if (mdesc->restart_mode)
229+ reboot_setup(&mdesc->restart_mode);
230 
231     init_mm.start_code = (unsigned long) _text;
232     init_mm.end_code = (unsigned long) _etext;
233@@ -916,6 +916,9 @@ void __init setup_arch(char **cmdline_p)
234     paging_init(mdesc);
235     request_standard_resources(mdesc);
236 
237+ if (mdesc->restart)
238+ arm_pm_restart = mdesc->restart;
239+
240     unflatten_device_tree();
241 
242 #ifdef CONFIG_SMP
243--- a/arch/arm/kernel/smp.c
244+++ b/arch/arm/kernel/smp.c
245@@ -558,6 +558,10 @@ static void ipi_cpu_stop(unsigned int cp
246     local_fiq_disable();
247     local_irq_disable();
248 
249+#ifdef CONFIG_HOTPLUG_CPU
250+ platform_cpu_kill(cpu);
251+#endif
252+
253     while (1)
254         cpu_relax();
255 }
256--- a/arch/arm/kernel/vmlinux.lds.S
257+++ b/arch/arm/kernel/vmlinux.lds.S
258@@ -91,6 +91,7 @@ SECTIONS
259             SCHED_TEXT
260             LOCK_TEXT
261             KPROBES_TEXT
262+ IDMAP_TEXT
263 #ifdef CONFIG_MMU
264             *(.fixup)
265 #endif
266--- a/arch/arm/lib/Makefile
267+++ b/arch/arm/lib/Makefile
268@@ -13,7 +13,8 @@ lib-y := backtrace.o changebit.o csumip
269            testchangebit.o testclearbit.o testsetbit.o \
270            ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
271            ucmpdi2.o lib1funcs.o div64.o \
272- io-readsb.o io-writesb.o io-readsl.o io-writesl.o
273+ io-readsb.o io-writesb.o io-readsl.o io-writesl.o \
274+ call_with_stack.o
275 
276 mmu-y := clear_user.o copy_page.o getuser.o putuser.o
277 
278--- /dev/null
279+++ b/arch/arm/lib/call_with_stack.S
280@@ -0,0 +1,44 @@
281+/*
282+ * arch/arm/lib/call_with_stack.S
283+ *
284+ * Copyright (C) 2011 ARM Ltd.
285+ * Written by Will Deacon <will.deacon@arm.com>
286+ *
287+ * This program is free software; you can redistribute it and/or modify
288+ * it under the terms of the GNU General Public License version 2 as
289+ * published by the Free Software Foundation.
290+ *
291+ * This program is distributed in the hope that it will be useful,
292+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
293+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
294+ * GNU General Public License for more details.
295+ *
296+ * You should have received a copy of the GNU General Public License
297+ * along with this program; if not, write to the Free Software
298+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
299+ */
300+
301+#include <linux/linkage.h>
302+#include <asm/assembler.h>
303+
304+/*
305+ * void call_with_stack(void (*fn)(void *), void *arg, void *sp)
306+ *
307+ * Change the stack to that pointed at by sp, then invoke fn(arg) with
308+ * the new stack.
309+ */
310+ENTRY(call_with_stack)
311+ str sp, [r2, #-4]!
312+ str lr, [r2, #-4]!
313+
314+ mov sp, r2
315+ mov r2, r0
316+ mov r0, r1
317+
318+ adr lr, BSYM(1f)
319+ mov pc, r2
320+
321+1: ldr lr, [sp]
322+ ldr sp, [sp, #4]
323+ mov pc, lr
324+ENDPROC(call_with_stack)
325--- a/arch/arm/mach-omap2/board-2430sdp.c
326+++ b/arch/arm/mach-omap2/board-2430sdp.c
327@@ -34,7 +34,7 @@
328 #include <asm/mach/map.h>
329 
330 #include <plat/board.h>
331-#include <plat/common.h>
332+#include "common.h"
333 #include <plat/gpmc.h>
334 #include <plat/usb.h>
335 #include <plat/gpmc-smc91x.h>
336@@ -264,4 +264,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sd
337     .init_irq = omap2_init_irq,
338     .init_machine = omap_2430sdp_init,
339     .timer = &omap2_timer,
340+ .restart = omap_prcm_restart,
341 MACHINE_END
342--- a/arch/arm/mach-omap2/board-3430sdp.c
343+++ b/arch/arm/mach-omap2/board-3430sdp.c
344@@ -33,7 +33,7 @@
345 #include <plat/mcspi.h>
346 #include <plat/board.h>
347 #include <plat/usb.h>
348-#include <plat/common.h>
349+#include "common.h"
350 #include <plat/dma.h>
351 #include <plat/gpmc.h>
352 #include <video/omapdss.h>
353@@ -736,4 +736,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 34
354     .init_irq = omap3_init_irq,
355     .init_machine = omap_3430sdp_init,
356     .timer = &omap3_timer,
357+ .restart = omap_prcm_restart,
358 MACHINE_END
359--- a/arch/arm/mach-omap2/board-3630sdp.c
360+++ b/arch/arm/mach-omap2/board-3630sdp.c
361@@ -16,7 +16,7 @@
362 #include <asm/mach-types.h>
363 #include <asm/mach/arch.h>
364 
365-#include <plat/common.h>
366+#include "common.h"
367 #include <plat/board.h>
368 #include <plat/gpmc-smc91x.h>
369 #include <plat/usb.h>
370@@ -222,4 +222,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SD
371     .init_irq = omap3_init_irq,
372     .init_machine = omap_sdp_init,
373     .timer = &omap3_timer,
374+ .restart = omap_prcm_restart,
375 MACHINE_END
376--- a/arch/arm/mach-omap2/board-4430sdp.c
377+++ b/arch/arm/mach-omap2/board-4430sdp.c
378@@ -27,13 +27,12 @@
379 #include <linux/leds_pwm.h>
380 
381 #include <mach/hardware.h>
382-#include <mach/omap4-common.h>
383 #include <asm/mach-types.h>
384 #include <asm/mach/arch.h>
385 #include <asm/mach/map.h>
386 
387 #include <plat/board.h>
388-#include <plat/common.h>
389+#include "common.h"
390 #include <plat/usb.h>
391 #include <plat/mmc.h>
392 #include <plat/omap4-keypad.h>
393@@ -845,4 +844,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 44
394     .init_irq = gic_init_irq,
395     .init_machine = omap_4430sdp_init,
396     .timer = &omap4_timer,
397+ .restart = omap_prcm_restart,
398 MACHINE_END
399--- a/arch/arm/mach-omap2/board-am3517crane.c
400+++ b/arch/arm/mach-omap2/board-am3517crane.c
401@@ -27,7 +27,7 @@
402 #include <asm/mach/map.h>
403 
404 #include <plat/board.h>
405-#include <plat/common.h>
406+#include "common.h"
407 #include <plat/usb.h>
408 
409 #include "mux.h"
410@@ -105,4 +105,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRA
411     .init_irq = omap3_init_irq,
412     .init_machine = am3517_crane_init,
413     .timer = &omap3_timer,
414+ .restart = omap_prcm_restart,
415 MACHINE_END
416--- a/arch/arm/mach-omap2/board-am3517evm.c
417+++ b/arch/arm/mach-omap2/board-am3517evm.c
418@@ -32,7 +32,7 @@
419 #include <asm/mach/map.h>
420 
421 #include <plat/board.h>
422-#include <plat/common.h>
423+#include "common.h"
424 #include <plat/usb.h>
425 #include <video/omapdss.h>
426 #include <video/omap-panel-generic-dpi.h>
427@@ -497,4 +497,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3
428     .init_irq = omap3_init_irq,
429     .init_machine = am3517_evm_init,
430     .timer = &omap3_timer,
431+ .restart = omap_prcm_restart,
432 MACHINE_END
433--- a/arch/arm/mach-omap2/board-apollon.c
434+++ b/arch/arm/mach-omap2/board-apollon.c
435@@ -37,7 +37,7 @@
436 #include <plat/led.h>
437 #include <plat/usb.h>
438 #include <plat/board.h>
439-#include <plat/common.h>
440+#include "common.h"
441 #include <plat/gpmc.h>
442 
443 #include "mux.h"
444@@ -357,4 +357,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Ap
445     .init_irq = omap2_init_irq,
446     .init_machine = omap_apollon_init,
447     .timer = &omap2_timer,
448+ .restart = omap_prcm_restart,
449 MACHINE_END
450--- a/arch/arm/mach-omap2/board-cm-t35.c
451+++ b/arch/arm/mach-omap2/board-cm-t35.c
452@@ -37,7 +37,7 @@
453 #include <asm/mach/map.h>
454 
455 #include <plat/board.h>
456-#include <plat/common.h>
457+#include "common.h"
458 #include <plat/nand.h>
459 #include <plat/gpmc.h>
460 #include <plat/usb.h>
461@@ -641,6 +641,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
462     .init_irq = omap3_init_irq,
463     .init_machine = cm_t35_init,
464     .timer = &omap3_timer,
465+ .restart = omap_prcm_restart,
466 MACHINE_END
467 
468 MACHINE_START(CM_T3730, "Compulab CM-T3730")
469@@ -651,4 +652,5 @@ MACHINE_START(CM_T3730, "Compulab CM-T37
470     .init_irq = omap3_init_irq,
471     .init_machine = cm_t3730_init,
472     .timer = &omap3_timer,
473+ .restart = omap_prcm_restart,
474 MACHINE_END
475--- a/arch/arm/mach-omap2/board-cm-t3517.c
476+++ b/arch/arm/mach-omap2/board-cm-t3517.c
477@@ -39,7 +39,7 @@
478 #include <asm/mach/map.h>
479 
480 #include <plat/board.h>
481-#include <plat/common.h>
482+#include "common.h"
483 #include <plat/usb.h>
484 #include <plat/nand.h>
485 #include <plat/gpmc.h>
486@@ -306,4 +306,5 @@ MACHINE_START(CM_T3517, "Compulab CM-T35
487     .init_irq = omap3_init_irq,
488     .init_machine = cm_t3517_init,
489     .timer = &omap3_timer,
490+ .restart = omap_prcm_restart,
491 MACHINE_END
492--- a/arch/arm/mach-omap2/board-devkit8000.c
493+++ b/arch/arm/mach-omap2/board-devkit8000.c
494@@ -41,7 +41,7 @@
495 #include <asm/mach/flash.h>
496 
497 #include <plat/board.h>
498-#include <plat/common.h>
499+#include "common.h"
500 #include <plat/gpmc.h>
501 #include <plat/nand.h>
502 #include <plat/usb.h>
503@@ -674,4 +674,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8
504     .init_irq = devkit8000_init_irq,
505     .init_machine = devkit8000_init,
506     .timer = &omap3_secure_timer,
507+ .restart = omap_prcm_restart,
508 MACHINE_END
509--- a/arch/arm/mach-omap2/board-h4.c
510+++ b/arch/arm/mach-omap2/board-h4.c
511@@ -34,7 +34,7 @@
512 #include <mach/gpio.h>
513 #include <plat/usb.h>
514 #include <plat/board.h>
515-#include <plat/common.h>
516+#include "common.h"
517 #include <plat/keypad.h>
518 #include <plat/menelaus.h>
519 #include <plat/dma.h>
520@@ -389,4 +389,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 boar
521     .init_irq = omap_h4_init_irq,
522     .init_machine = omap_h4_init,
523     .timer = &omap2_timer,
524+ .restart = omap_prcm_restart,
525 MACHINE_END
526--- a/arch/arm/mach-omap2/board-igep0020.c
527+++ b/arch/arm/mach-omap2/board-igep0020.c
528@@ -28,7 +28,7 @@
529 #include <asm/mach/arch.h>
530 
531 #include <plat/board.h>
532-#include <plat/common.h>
533+#include "common.h"
534 #include <plat/gpmc.h>
535 #include <plat/usb.h>
536 #include <video/omapdss.h>
537@@ -679,6 +679,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
538     .init_irq = omap3_init_irq,
539     .init_machine = igep_init,
540     .timer = &omap3_timer,
541+ .restart = omap_prcm_restart,
542 MACHINE_END
543 
544 MACHINE_START(IGEP0030, "IGEP OMAP3 module")
545@@ -689,4 +690,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 modu
546     .init_irq = omap3_init_irq,
547     .init_machine = igep_init,
548     .timer = &omap3_timer,
549+ .restart = omap_prcm_restart,
550 MACHINE_END
551--- a/arch/arm/mach-omap2/board-ldp.c
552+++ b/arch/arm/mach-omap2/board-ldp.c
553@@ -36,7 +36,7 @@
554 #include <plat/mcspi.h>
555 #include <mach/gpio.h>
556 #include <plat/board.h>
557-#include <plat/common.h>
558+#include "common.h"
559 #include <plat/gpmc.h>
560 #include <mach/board-zoom.h>
561 
562@@ -340,4 +340,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board"
563     .init_irq = omap3_init_irq,
564     .init_machine = omap_ldp_init,
565     .timer = &omap3_timer,
566+ .restart = omap_prcm_restart,
567 MACHINE_END
568--- a/arch/arm/mach-omap2/board-n8x0.c
569+++ b/arch/arm/mach-omap2/board-n8x0.c
570@@ -26,7 +26,7 @@
571 #include <asm/mach-types.h>
572 
573 #include <plat/board.h>
574-#include <plat/common.h>
575+#include "common.h"
576 #include <plat/menelaus.h>
577 #include <mach/irqs.h>
578 #include <plat/mcspi.h>
579@@ -702,6 +702,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
580     .init_irq = omap2_init_irq,
581     .init_machine = n8x0_init_machine,
582     .timer = &omap2_timer,
583+ .restart = omap_prcm_restart,
584 MACHINE_END
585 
586 MACHINE_START(NOKIA_N810, "Nokia N810")
587@@ -712,6 +713,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
588     .init_irq = omap2_init_irq,
589     .init_machine = n8x0_init_machine,
590     .timer = &omap2_timer,
591+ .restart = omap_prcm_restart,
592 MACHINE_END
593 
594 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
595@@ -722,4 +724,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N
596     .init_irq = omap2_init_irq,
597     .init_machine = n8x0_init_machine,
598     .timer = &omap2_timer,
599+ .restart = omap_prcm_restart,
600 MACHINE_END
601--- a/arch/arm/mach-omap2/board-omap3beagle.c
602+++ b/arch/arm/mach-omap2/board-omap3beagle.c
603@@ -40,7 +40,7 @@
604 #include <asm/mach/flash.h>
605 
606 #include <plat/board.h>
607-#include <plat/common.h>
608+#include "common.h"
609 #include <video/omapdss.h>
610 #include <video/omap-panel-generic-dpi.h>
611 #include <plat/gpmc.h>
612@@ -564,4 +564,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagl
613     .init_irq = omap3_beagle_init_irq,
614     .init_machine = omap3_beagle_init,
615     .timer = &omap3_secure_timer,
616+ .restart = omap_prcm_restart,
617 MACHINE_END
618--- a/arch/arm/mach-omap2/board-omap3evm.c
619+++ b/arch/arm/mach-omap2/board-omap3evm.c
620@@ -42,7 +42,7 @@
621 
622 #include <plat/board.h>
623 #include <plat/usb.h>
624-#include <plat/common.h>
625+#include "common.h"
626 #include <plat/mcspi.h>
627 #include <video/omapdss.h>
628 #include <video/omap-panel-generic-dpi.h>
629@@ -688,4 +688,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
630     .init_irq = omap3_init_irq,
631     .init_machine = omap3_evm_init,
632     .timer = &omap3_timer,
633+ .restart = omap_prcm_restart,
634 MACHINE_END
635--- a/arch/arm/mach-omap2/board-omap3logic.c
636+++ b/arch/arm/mach-omap2/board-omap3logic.c
637@@ -40,7 +40,7 @@
638 
639 #include <plat/mux.h>
640 #include <plat/board.h>
641-#include <plat/common.h>
642+#include "common.h"
643 #include <plat/gpmc-smsc911x.h>
644 #include <plat/gpmc.h>
645 #include <plat/sdrc.h>
646@@ -215,6 +215,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP
647     .init_irq = omap3_init_irq,
648     .init_machine = omap3logic_init,
649     .timer = &omap3_timer,
650+ .restart = omap_prcm_restart,
651 MACHINE_END
652 
653 MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
654@@ -224,4 +225,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Log
655     .init_irq = omap3_init_irq,
656     .init_machine = omap3logic_init,
657     .timer = &omap3_timer,
658+ .restart = omap_prcm_restart,
659 MACHINE_END
660--- a/arch/arm/mach-omap2/board-omap3pandora.c
661+++ b/arch/arm/mach-omap2/board-omap3pandora.c
662@@ -41,7 +41,7 @@
663 #include <asm/mach/map.h>
664 
665 #include <plat/board.h>
666-#include <plat/common.h>
667+#include "common.h"
668 #include <mach/hardware.h>
669 #include <plat/mcspi.h>
670 #include <plat/usb.h>
671@@ -613,4 +613,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Ha
672     .init_irq = omap3_init_irq,
673     .init_machine = omap3pandora_init,
674     .timer = &omap3_timer,
675+ .restart = omap_prcm_restart,
676 MACHINE_END
677--- a/arch/arm/mach-omap2/board-omap3stalker.c
678+++ b/arch/arm/mach-omap2/board-omap3stalker.c
679@@ -35,7 +35,7 @@
680 #include <asm/mach/flash.h>
681 
682 #include <plat/board.h>
683-#include <plat/common.h>
684+#include "common.h"
685 #include <plat/gpmc.h>
686 #include <plat/nand.h>
687 #include <plat/usb.h>
688@@ -500,4 +500,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
689     .init_irq = omap3_stalker_init_irq,
690     .init_machine = omap3_stalker_init,
691     .timer = &omap3_secure_timer,
692+ .restart = omap_prcm_restart,
693 MACHINE_END
694--- a/arch/arm/mach-omap2/board-omap3touchbook.c
695+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
696@@ -44,7 +44,7 @@
697 #include <asm/mach/flash.h>
698 
699 #include <plat/board.h>
700-#include <plat/common.h>
701+#include "common.h"
702 #include <plat/gpmc.h>
703 #include <plat/nand.h>
704 #include <plat/usb.h>
705@@ -411,4 +411,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchboo
706     .init_irq = omap3_touchbook_init_irq,
707     .init_machine = omap3_touchbook_init,
708     .timer = &omap3_secure_timer,
709+ .restart = omap_prcm_restart,
710 MACHINE_END
711--- a/arch/arm/mach-omap2/board-omap4panda.c
712+++ b/arch/arm/mach-omap2/board-omap4panda.c
713@@ -30,14 +30,13 @@
714 #include <linux/wl12xx.h>
715 
716 #include <mach/hardware.h>
717-#include <mach/omap4-common.h>
718 #include <asm/mach-types.h>
719 #include <asm/mach/arch.h>
720 #include <asm/mach/map.h>
721 #include <video/omapdss.h>
722 
723 #include <plat/board.h>
724-#include <plat/common.h>
725+#include "common.h"
726 #include <plat/usb.h>
727 #include <plat/mmc.h>
728 #include <video/omap-panel-generic-dpi.h>
729@@ -590,4 +589,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda
730     .init_irq = gic_init_irq,
731     .init_machine = omap4_panda_init,
732     .timer = &omap4_timer,
733+ .restart = omap_prcm_restart,
734 MACHINE_END
735--- a/arch/arm/mach-omap2/board-overo.c
736+++ b/arch/arm/mach-omap2/board-overo.c
737@@ -43,7 +43,7 @@
738 #include <asm/mach/map.h>
739 
740 #include <plat/board.h>
741-#include <plat/common.h>
742+#include "common.h"
743 #include <video/omapdss.h>
744 #include <video/omap-panel-generic-dpi.h>
745 #include <plat/gpmc.h>
746@@ -568,4 +568,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
747     .init_irq = omap3_init_irq,
748     .init_machine = overo_init,
749     .timer = &omap3_timer,
750+ .restart = omap_prcm_restart,
751 MACHINE_END
752--- a/arch/arm/mach-omap2/board-rm680.c
753+++ b/arch/arm/mach-omap2/board-rm680.c
754@@ -25,7 +25,7 @@
755 #include <plat/mmc.h>
756 #include <plat/usb.h>
757 #include <plat/gpmc.h>
758-#include <plat/common.h>
759+#include "common.h"
760 #include <plat/onenand.h>
761 
762 #include "mux.h"
763@@ -160,4 +160,5 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680
764     .init_irq = omap3_init_irq,
765     .init_machine = rm680_init,
766     .timer = &omap3_timer,
767+ .restart = omap_prcm_restart,
768 MACHINE_END
769--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
770+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
771@@ -27,7 +27,7 @@
772 
773 #include <plat/mcspi.h>
774 #include <plat/board.h>
775-#include <plat/common.h>
776+#include "common.h"
777 #include <plat/dma.h>
778 #include <plat/gpmc.h>
779 #include <plat/onenand.h>
780--- a/arch/arm/mach-omap2/board-rx51.c
781+++ b/arch/arm/mach-omap2/board-rx51.c
782@@ -25,7 +25,7 @@
783 
784 #include <plat/mcspi.h>
785 #include <plat/board.h>
786-#include <plat/common.h>
787+#include "common.h"
788 #include <plat/dma.h>
789 #include <plat/gpmc.h>
790 #include <plat/usb.h>
791@@ -163,4 +163,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 b
792     .init_irq = omap3_init_irq,
793     .init_machine = rx51_init,
794     .timer = &omap3_timer,
795+ .restart = omap_prcm_restart,
796 MACHINE_END
797--- a/arch/arm/mach-omap2/board-ti8168evm.c
798+++ b/arch/arm/mach-omap2/board-ti8168evm.c
799@@ -22,7 +22,7 @@
800 
801 #include <plat/irqs.h>
802 #include <plat/board.h>
803-#include <plat/common.h>
804+#include "common.h"
805 
806 static struct omap_board_config_kernel ti8168_evm_config[] __initdata = {
807 };
808@@ -54,4 +54,5 @@ MACHINE_START(TI8168EVM, "ti8168evm")
809     .init_irq = ti816x_init_irq,
810     .timer = &omap3_timer,
811     .init_machine = ti8168_evm_init,
812+ .restart = omap_prcm_restart,
813 MACHINE_END
814--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
815+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
816@@ -24,7 +24,7 @@
817 #include <asm/mach/arch.h>
818 #include <asm/mach/map.h>
819 
820-#include <plat/common.h>
821+#include "common.h"
822 #include <plat/usb.h>
823 
824 #include <mach/board-zoom.h>
825--- a/arch/arm/mach-omap2/board-zoom.c
826+++ b/arch/arm/mach-omap2/board-zoom.c
827@@ -21,7 +21,7 @@
828 #include <asm/mach-types.h>
829 #include <asm/mach/arch.h>
830 
831-#include <plat/common.h>
832+#include "common.h"
833 #include <plat/board.h>
834 #include <plat/usb.h>
835 
836@@ -140,6 +140,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 bo
837     .init_irq = omap3_init_irq,
838     .init_machine = omap_zoom_init,
839     .timer = &omap3_timer,
840+ .restart = omap_prcm_restart,
841 MACHINE_END
842 
843 MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
844@@ -150,4 +151,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 bo
845     .init_irq = omap3_init_irq,
846     .init_machine = omap_zoom_init,
847     .timer = &omap3_timer,
848+ .restart = omap_prcm_restart,
849 MACHINE_END
850--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
851+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c
852@@ -18,7 +18,7 @@
853 #include <linux/err.h>
854 #include <linux/io.h>
855 
856-#include <plat/common.h>
857+#include "common.h"
858 
859 #include "cm.h"
860 #include "cm2xxx_3xxx.h"
861--- a/arch/arm/mach-omap2/cm44xx.c
862+++ b/arch/arm/mach-omap2/cm44xx.c
863@@ -18,7 +18,7 @@
864 #include <linux/err.h>
865 #include <linux/io.h>
866 
867-#include <plat/common.h>
868+#include "common.h"
869 
870 #include "cm.h"
871 #include "cm1_44xx.h"
872--- a/arch/arm/mach-omap2/cminst44xx.c
873+++ b/arch/arm/mach-omap2/cminst44xx.c
874@@ -20,7 +20,7 @@
875 #include <linux/err.h>
876 #include <linux/io.h>
877 
878-#include <plat/common.h>
879+#include "common.h"
880 
881 #include "cm.h"
882 #include "cm1_44xx.h"
883--- a/arch/arm/mach-omap2/common.c
884+++ b/arch/arm/mach-omap2/common.c
885@@ -17,7 +17,7 @@
886 #include <linux/clk.h>
887 #include <linux/io.h>
888 
889-#include <plat/common.h>
890+#include "common.h"
891 #include <plat/board.h>
892 #include <plat/mux.h>
893 
894--- /dev/null
895+++ b/arch/arm/mach-omap2/common.h
896@@ -0,0 +1,186 @@
897+/*
898+ * Header for code common to all OMAP2+ machines.
899+ *
900+ * This program is free software; you can redistribute it and/or modify it
901+ * under the terms of the GNU General Public License as published by the
902+ * Free Software Foundation; either version 2 of the License, or (at your
903+ * option) any later version.
904+ *
905+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
906+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
907+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
908+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
909+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
910+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
911+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
912+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
913+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
914+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
915+ *
916+ * You should have received a copy of the GNU General Public License along
917+ * with this program; if not, write to the Free Software Foundation, Inc.,
918+ * 675 Mass Ave, Cambridge, MA 02139, USA.
919+ */
920+
921+#ifndef __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H
922+#define __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H
923+
924+#include <linux/delay.h>
925+#include <plat/common.h>
926+
927+#ifdef CONFIG_SOC_OMAP2420
928+extern void omap242x_map_common_io(void);
929+#else
930+static inline void omap242x_map_common_io(void)
931+{
932+}
933+#endif
934+
935+#ifdef CONFIG_SOC_OMAP2430
936+extern void omap243x_map_common_io(void);
937+#else
938+static inline void omap243x_map_common_io(void)
939+{
940+}
941+#endif
942+
943+#ifdef CONFIG_ARCH_OMAP3
944+extern void omap34xx_map_common_io(void);
945+#else
946+static inline void omap34xx_map_common_io(void)
947+{
948+}
949+#endif
950+
951+#ifdef CONFIG_SOC_OMAPTI816X
952+extern void omapti816x_map_common_io(void);
953+#else
954+static inline void omapti816x_map_common_io(void)
955+{
956+}
957+#endif
958+
959+#ifdef CONFIG_ARCH_OMAP4
960+extern void omap44xx_map_common_io(void);
961+#else
962+static inline void omap44xx_map_common_io(void)
963+{
964+}
965+#endif
966+
967+extern void omap2_init_common_infrastructure(void);
968+
969+extern struct sys_timer omap2_timer;
970+extern struct sys_timer omap3_timer;
971+extern struct sys_timer omap3_secure_timer;
972+extern struct sys_timer omap4_timer;
973+
974+void omap2420_init_early(void);
975+void omap2430_init_early(void);
976+void omap3430_init_early(void);
977+void omap35xx_init_early(void);
978+void omap3630_init_early(void);
979+void omap3_init_early(void); /* Do not use this one */
980+void am35xx_init_early(void);
981+void ti816x_init_early(void);
982+void omap4430_init_early(void);
983+void omap_prcm_restart(char, const char *);
984+
985+/*
986+ * IO bases for various OMAP processors
987+ * Except the tap base, rest all the io bases
988+ * listed are physical addresses.
989+ */
990+struct omap_globals {
991+ u32 class; /* OMAP class to detect */
992+ void __iomem *tap; /* Control module ID code */
993+ void __iomem *sdrc; /* SDRAM Controller */
994+ void __iomem *sms; /* SDRAM Memory Scheduler */
995+ void __iomem *ctrl; /* System Control Module */
996+ void __iomem *ctrl_pad; /* PAD Control Module */
997+ void __iomem *prm; /* Power and Reset Management */
998+ void __iomem *cm; /* Clock Management */
999+ void __iomem *cm2;
1000+};
1001+
1002+void omap2_set_globals_242x(void);
1003+void omap2_set_globals_243x(void);
1004+void omap2_set_globals_3xxx(void);
1005+void omap2_set_globals_443x(void);
1006+void omap2_set_globals_ti816x(void);
1007+
1008+/* These get called from omap2_set_globals_xxxx(), do not call these */
1009+void omap2_set_globals_tap(struct omap_globals *);
1010+void omap2_set_globals_sdrc(struct omap_globals *);
1011+void omap2_set_globals_control(struct omap_globals *);
1012+void omap2_set_globals_prcm(struct omap_globals *);
1013+
1014+void omap242x_map_io(void);
1015+void omap243x_map_io(void);
1016+void omap3_map_io(void);
1017+void omap4_map_io(void);
1018+
1019+/**
1020+ * omap_test_timeout - busy-loop, testing a condition
1021+ * @cond: condition to test until it evaluates to true
1022+ * @timeout: maximum number of microseconds in the timeout
1023+ * @index: loop index (integer)
1024+ *
1025+ * Loop waiting for @cond to become true or until at least @timeout
1026+ * microseconds have passed. To use, define some integer @index in the
1027+ * calling code. After running, if @index == @timeout, then the loop has
1028+ * timed out.
1029+ */
1030+#define omap_test_timeout(cond, timeout, index) \
1031+({ \
1032+ for (index = 0; index < timeout; index++) { \
1033+ if (cond) \
1034+ break; \
1035+ udelay(1); \
1036+ } \
1037+})
1038+
1039+extern struct device *omap2_get_mpuss_device(void);
1040+extern struct device *omap2_get_iva_device(void);
1041+extern struct device *omap2_get_l3_device(void);
1042+extern struct device *omap4_get_dsp_device(void);
1043+
1044+void omap2_init_irq(void);
1045+void omap3_init_irq(void);
1046+void ti816x_init_irq(void);
1047+extern int omap_irq_pending(void);
1048+void omap_intc_save_context(void);
1049+void omap_intc_restore_context(void);
1050+void omap3_intc_suspend(void);
1051+void omap3_intc_prepare_idle(void);
1052+void omap3_intc_resume_idle(void);
1053+
1054+/*
1055+ * wfi used in low power code. Directly opcode is used instead
1056+ * of instruction to avoid mulit-omap build break
1057+ */
1058+#ifdef CONFIG_THUMB2_KERNEL
1059+#define do_wfi() __asm__ __volatile__ ("wfi" : : : "memory")
1060+#else
1061+#define do_wfi() \
1062+ __asm__ __volatile__ (".word 0xe320f003" : : : "memory")
1063+#endif
1064+
1065+#ifdef CONFIG_CACHE_L2X0
1066+extern void __iomem *l2cache_base;
1067+#endif
1068+
1069+extern void __iomem *gic_dist_base_addr;
1070+
1071+extern void __init gic_init_irq(void);
1072+extern void omap_smc1(u32 fn, u32 arg);
1073+
1074+#ifdef CONFIG_SMP
1075+/* Needed for secondary core boot */
1076+extern void omap_secondary_startup(void);
1077+extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
1078+extern void omap_auxcoreboot_addr(u32 cpu_addr);
1079+extern u32 omap_read_auxcoreboot0(void);
1080+#endif
1081+
1082+#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
1083--- a/arch/arm/mach-omap2/control.c
1084+++ b/arch/arm/mach-omap2/control.c
1085@@ -15,7 +15,7 @@
1086 #include <linux/kernel.h>
1087 #include <linux/io.h>
1088 
1089-#include <plat/common.h>
1090+#include "common.h"
1091 #include <plat/sdrc.h>
1092 
1093 #include "cm-regbits-34xx.h"
1094--- a/arch/arm/mach-omap2/i2c.c
1095+++ b/arch/arm/mach-omap2/i2c.c
1096@@ -21,7 +21,7 @@
1097 
1098 #include <plat/cpu.h>
1099 #include <plat/i2c.h>
1100-#include <plat/common.h>
1101+#include "common.h"
1102 #include <plat/omap_hwmod.h>
1103 
1104 #include "mux.h"
1105--- a/arch/arm/mach-omap2/id.c
1106+++ b/arch/arm/mach-omap2/id.c
1107@@ -21,7 +21,7 @@
1108 
1109 #include <asm/cputype.h>
1110 
1111-#include <plat/common.h>
1112+#include "common.h"
1113 #include <plat/cpu.h>
1114 
1115 #include <mach/id.h>
1116--- a/arch/arm/mach-omap2/include/mach/omap4-common.h
1117+++ /dev/null
1118@@ -1,43 +0,0 @@
1119-/*
1120- * omap4-common.h: OMAP4 specific common header file
1121- *
1122- * Copyright (C) 2010 Texas Instruments, Inc.
1123- *
1124- * Author:
1125- * Santosh Shilimkar <santosh.shilimkar@ti.com>
1126- *
1127- * This program is free software; you can redistribute it and/or modify
1128- * it under the terms of the GNU General Public License version 2 as
1129- * published by the Free Software Foundation.
1130- */
1131-#ifndef OMAP_ARCH_OMAP4_COMMON_H
1132-#define OMAP_ARCH_OMAP4_COMMON_H
1133-
1134-/*
1135- * wfi used in low power code. Directly opcode is used instead
1136- * of instruction to avoid mulit-omap build break
1137- */
1138-#ifdef CONFIG_THUMB2_KERNEL
1139-#define do_wfi() __asm__ __volatile__ ("wfi" : : : "memory")
1140-#else
1141-#define do_wfi() \
1142- __asm__ __volatile__ (".word 0xe320f003" : : : "memory")
1143-#endif
1144-
1145-#ifdef CONFIG_CACHE_L2X0
1146-extern void __iomem *l2cache_base;
1147-#endif
1148-
1149-extern void __iomem *gic_dist_base_addr;
1150-
1151-extern void __init gic_init_irq(void);
1152-extern void omap_smc1(u32 fn, u32 arg);
1153-
1154-#ifdef CONFIG_SMP
1155-/* Needed for secondary core boot */
1156-extern void omap_secondary_startup(void);
1157-extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
1158-extern void omap_auxcoreboot_addr(u32 cpu_addr);
1159-extern u32 omap_read_auxcoreboot0(void);
1160-#endif
1161-#endif
1162--- a/arch/arm/mach-omap2/omap-hotplug.c
1163+++ b/arch/arm/mach-omap2/omap-hotplug.c
1164@@ -19,7 +19,8 @@
1165 #include <linux/smp.h>
1166 
1167 #include <asm/cacheflush.h>
1168-#include <mach/omap4-common.h>
1169+
1170+#include "common.h"
1171 
1172 int platform_cpu_kill(unsigned int cpu)
1173 {
1174--- a/arch/arm/mach-omap2/omap-smp.c
1175+++ b/arch/arm/mach-omap2/omap-smp.c
1176@@ -24,7 +24,8 @@
1177 #include <asm/hardware/gic.h>
1178 #include <asm/smp_scu.h>
1179 #include <mach/hardware.h>
1180-#include <mach/omap4-common.h>
1181+
1182+#include "common.h"
1183 
1184 /* SCU base address */
1185 static void __iomem *scu_base;
1186--- a/arch/arm/mach-omap2/omap4-common.c
1187+++ b/arch/arm/mach-omap2/omap4-common.c
1188@@ -22,7 +22,8 @@
1189 #include <plat/irqs.h>
1190 
1191 #include <mach/hardware.h>
1192-#include <mach/omap4-common.h>
1193+
1194+#include "common.h"
1195 
1196 #ifdef CONFIG_CACHE_L2X0
1197 void __iomem *l2cache_base;
1198--- a/arch/arm/mach-omap2/omap_hwmod.c
1199+++ b/arch/arm/mach-omap2/omap_hwmod.c
1200@@ -137,7 +137,7 @@
1201 #include <linux/mutex.h>
1202 #include <linux/spinlock.h>
1203 
1204-#include <plat/common.h>
1205+#include "common.h"
1206 #include <plat/cpu.h>
1207 #include "clockdomain.h"
1208 #include "powerdomain.h"
1209--- a/arch/arm/mach-omap2/pm.c
1210+++ b/arch/arm/mach-omap2/pm.c
1211@@ -17,7 +17,7 @@
1212 
1213 #include <plat/omap-pm.h>
1214 #include <plat/omap_device.h>
1215-#include <plat/common.h>
1216+#include "common.h"
1217 
1218 #include "voltage.h"
1219 #include "powerdomain.h"
1220--- a/arch/arm/mach-omap2/pm24xx.c
1221+++ b/arch/arm/mach-omap2/pm24xx.c
1222@@ -42,6 +42,7 @@
1223 #include <plat/dma.h>
1224 #include <plat/board.h>
1225 
1226+#include "common.h"
1227 #include "prm2xxx_3xxx.h"
1228 #include "prm-regbits-24xx.h"
1229 #include "cm2xxx_3xxx.h"
1230--- a/arch/arm/mach-omap2/pm34xx.c
1231+++ b/arch/arm/mach-omap2/pm34xx.c
1232@@ -42,6 +42,7 @@
1233 #include <plat/gpmc.h>
1234 #include <plat/dma.h>
1235 
1236+#include "common.h"
1237 #include "cm2xxx_3xxx.h"
1238 #include "cm-regbits-34xx.h"
1239 #include "prm-regbits-34xx.h"
1240--- a/arch/arm/mach-omap2/pm44xx.c
1241+++ b/arch/arm/mach-omap2/pm44xx.c
1242@@ -16,8 +16,8 @@
1243 #include <linux/err.h>
1244 #include <linux/slab.h>
1245 
1246+#include "common.h"
1247 #include "powerdomain.h"
1248-#include <mach/omap4-common.h>
1249 
1250 struct power_state {
1251     struct powerdomain *pwrdm;
1252--- a/arch/arm/mach-omap2/prcm.c
1253+++ b/arch/arm/mach-omap2/prcm.c
1254@@ -24,8 +24,7 @@
1255 #include <linux/io.h>
1256 #include <linux/delay.h>
1257 
1258-#include <mach/system.h>
1259-#include <plat/common.h>
1260+#include "common.h"
1261 #include <plat/prcm.h>
1262 #include <plat/irqs.h>
1263 
1264@@ -58,7 +57,7 @@ u32 omap_prcm_get_reset_sources(void)
1265 EXPORT_SYMBOL(omap_prcm_get_reset_sources);
1266 
1267 /* Resets clock rates and reboots the system. Only called from system.h */
1268-static void omap_prcm_arch_reset(char mode, const char *cmd)
1269+void omap_prcm_restart(char mode, const char *cmd)
1270 {
1271     s16 prcm_offs = 0;
1272 
1273@@ -109,8 +108,6 @@ static void omap_prcm_arch_reset(char mo
1274     omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
1275 }
1276 
1277-void (*arch_reset)(char, const char *) = omap_prcm_arch_reset;
1278-
1279 /**
1280  * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
1281  * @reg: physical address of module IDLEST register
1282--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
1283+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
1284@@ -15,7 +15,7 @@
1285 #include <linux/err.h>
1286 #include <linux/io.h>
1287 
1288-#include <plat/common.h>
1289+#include "common.h"
1290 
1291 #include "prcm_mpu44xx.h"
1292 #include "cm-regbits-44xx.h"
1293--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
1294+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
1295@@ -16,7 +16,7 @@
1296 #include <linux/err.h>
1297 #include <linux/io.h>
1298 
1299-#include <plat/common.h>
1300+#include "common.h"
1301 #include <plat/cpu.h>
1302 #include <plat/prcm.h>
1303 
1304--- a/arch/arm/mach-omap2/prm44xx.c
1305+++ b/arch/arm/mach-omap2/prm44xx.c
1306@@ -17,7 +17,7 @@
1307 #include <linux/err.h>
1308 #include <linux/io.h>
1309 
1310-#include <plat/common.h>
1311+#include "common.h"
1312 #include <plat/cpu.h>
1313 #include <plat/prcm.h>
1314 
1315--- a/arch/arm/mach-omap2/prminst44xx.c
1316+++ b/arch/arm/mach-omap2/prminst44xx.c
1317@@ -16,7 +16,7 @@
1318 #include <linux/err.h>
1319 #include <linux/io.h>
1320 
1321-#include <plat/common.h>
1322+#include "common.h"
1323 
1324 #include "prm44xx.h"
1325 #include "prminst44xx.h"
1326--- a/arch/arm/mach-omap2/sdram-nokia.c
1327+++ b/arch/arm/mach-omap2/sdram-nokia.c
1328@@ -18,7 +18,7 @@
1329 #include <linux/io.h>
1330 
1331 #include <plat/io.h>
1332-#include <plat/common.h>
1333+#include "common.h"
1334 #include <plat/clock.h>
1335 #include <plat/sdrc.h>
1336 
1337--- a/arch/arm/mach-omap2/sdrc.c
1338+++ b/arch/arm/mach-omap2/sdrc.c
1339@@ -23,7 +23,7 @@
1340 #include <linux/clk.h>
1341 #include <linux/io.h>
1342 
1343-#include <plat/common.h>
1344+#include "common.h"
1345 #include <plat/clock.h>
1346 #include <plat/sram.h>
1347 
1348--- a/arch/arm/mach-omap2/sdrc2xxx.c
1349+++ b/arch/arm/mach-omap2/sdrc2xxx.c
1350@@ -24,7 +24,7 @@
1351 #include <linux/clk.h>
1352 #include <linux/io.h>
1353 
1354-#include <plat/common.h>
1355+#include "common.h"
1356 #include <plat/clock.h>
1357 #include <plat/sram.h>
1358 
1359--- a/arch/arm/mach-omap2/serial.c
1360+++ b/arch/arm/mach-omap2/serial.c
1361@@ -33,7 +33,7 @@
1362 #include <plat/omap-serial.h>
1363 #endif
1364 
1365-#include <plat/common.h>
1366+#include "common.h"
1367 #include <plat/board.h>
1368 #include <plat/clock.h>
1369 #include <plat/dma.h>
1370--- a/arch/arm/mach-omap2/smartreflex.c
1371+++ b/arch/arm/mach-omap2/smartreflex.c
1372@@ -25,7 +25,7 @@
1373 #include <linux/slab.h>
1374 #include <linux/pm_runtime.h>
1375 
1376-#include <plat/common.h>
1377+#include "common.h"
1378 
1379 #include "pm.h"
1380 #include "smartreflex.h"
1381--- a/arch/arm/mach-omap2/timer.c
1382+++ b/arch/arm/mach-omap2/timer.c
1383@@ -40,7 +40,7 @@
1384 #include <plat/dmtimer.h>
1385 #include <asm/localtimer.h>
1386 #include <asm/sched_clock.h>
1387-#include <plat/common.h>
1388+#include "common.h"
1389 #include <plat/omap_hwmod.h>
1390 
1391 /* Parent clocks, eventually these will come from the clock framework */
1392--- a/arch/arm/mach-omap2/vc3xxx_data.c
1393+++ b/arch/arm/mach-omap2/vc3xxx_data.c
1394@@ -18,7 +18,7 @@
1395 #include <linux/err.h>
1396 #include <linux/init.h>
1397 
1398-#include <plat/common.h>
1399+#include "common.h"
1400 
1401 #include "prm-regbits-34xx.h"
1402 #include "voltage.h"
1403--- a/arch/arm/mach-omap2/vc44xx_data.c
1404+++ b/arch/arm/mach-omap2/vc44xx_data.c
1405@@ -18,7 +18,7 @@
1406 #include <linux/err.h>
1407 #include <linux/init.h>
1408 
1409-#include <plat/common.h>
1410+#include "common.h"
1411 
1412 #include "prm44xx.h"
1413 #include "prm-regbits-44xx.h"
1414--- a/arch/arm/mach-omap2/voltage.c
1415+++ b/arch/arm/mach-omap2/voltage.c
1416@@ -26,7 +26,7 @@
1417 #include <linux/debugfs.h>
1418 #include <linux/slab.h>
1419 
1420-#include <plat/common.h>
1421+#include "common.h"
1422 
1423 #include "prm-regbits-34xx.h"
1424 #include "prm-regbits-44xx.h"
1425--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
1426+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
1427@@ -18,7 +18,7 @@
1428 #include <linux/err.h>
1429 #include <linux/init.h>
1430 
1431-#include <plat/common.h>
1432+#include "common.h"
1433 #include <plat/cpu.h>
1434 
1435 #include "prm-regbits-34xx.h"
1436--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
1437+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
1438@@ -21,7 +21,7 @@
1439 #include <linux/err.h>
1440 #include <linux/init.h>
1441 
1442-#include <plat/common.h>
1443+#include "common.h"
1444 
1445 #include "prm-regbits-44xx.h"
1446 #include "prm44xx.h"
1447--- a/arch/arm/mach-omap2/vp3xxx_data.c
1448+++ b/arch/arm/mach-omap2/vp3xxx_data.c
1449@@ -19,7 +19,7 @@
1450 #include <linux/err.h>
1451 #include <linux/init.h>
1452 
1453-#include <plat/common.h>
1454+#include "common.h"
1455 
1456 #include "prm-regbits-34xx.h"
1457 #include "voltage.h"
1458--- a/arch/arm/mach-omap2/vp44xx_data.c
1459+++ b/arch/arm/mach-omap2/vp44xx_data.c
1460@@ -19,7 +19,7 @@
1461 #include <linux/err.h>
1462 #include <linux/init.h>
1463 
1464-#include <plat/common.h>
1465+#include "common.h"
1466 
1467 #include "prm44xx.h"
1468 #include "prm-regbits-44xx.h"
1469--- a/arch/arm/mm/idmap.c
1470+++ b/arch/arm/mm/idmap.c
1471@@ -1,8 +1,12 @@
1472 #include <linux/kernel.h>
1473 
1474 #include <asm/cputype.h>
1475+#include <asm/idmap.h>
1476 #include <asm/pgalloc.h>
1477 #include <asm/pgtable.h>
1478+#include <asm/sections.h>
1479+
1480+pgd_t *idmap_pgd;
1481 
1482 static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
1483     unsigned long prot)
1484@@ -73,18 +77,45 @@ void identity_mapping_del(pgd_t *pgd, un
1485 }
1486 #endif
1487 
1488+extern char __idmap_text_start[], __idmap_text_end[];
1489+
1490+static int __init init_static_idmap(void)
1491+{
1492+ phys_addr_t idmap_start, idmap_end;
1493+
1494+ idmap_pgd = pgd_alloc(&init_mm);
1495+ if (!idmap_pgd)
1496+ return -ENOMEM;
1497+
1498+ /* Align the idmap.text section pointers to PMD_SIZE. */
1499+ idmap_start = (phys_addr_t)__idmap_text_start & PMD_MASK;
1500+ idmap_end = PTR_ALIGN((phys_addr_t)__idmap_text_end, PMD_SIZE);
1501+
1502+ /* Add an identity mapping for the physical address of the section. */
1503+ idmap_start = virt_to_phys((void *)idmap_start);
1504+ idmap_end = virt_to_phys((void *)idmap_end);
1505+
1506+ pr_info("Setting up static identity map for 0x%llx - 0x%llx\n",
1507+ (long long)idmap_start, (long long)idmap_end);
1508+ identity_mapping_add(idmap_pgd, idmap_start, idmap_end);
1509+
1510+ return 0;
1511+}
1512+arch_initcall(init_static_idmap);
1513+
1514 /*
1515- * In order to soft-boot, we need to insert a 1:1 mapping in place of
1516- * the user-mode pages. This will then ensure that we have predictable
1517- * results when turning the mmu off
1518+ * In order to soft-boot, we need to switch to a 1:1 mapping for the
1519+ * cpu_reset functions. This will then ensure that we have predictable
1520+ * results when turning off the mmu.
1521  */
1522-void setup_mm_for_reboot(char mode)
1523+void setup_mm_for_reboot(void)
1524 {
1525- /*
1526- * We need to access to user-mode page tables here. For kernel threads
1527- * we don't have any user-mode mappings so we use the context that we
1528- * "borrowed".
1529- */
1530- identity_mapping_add(current->active_mm->pgd, 0, TASK_SIZE);
1531+ /* Clean and invalidate L1. */
1532+ flush_cache_all();
1533+
1534+ /* Switch exclusively to kernel mappings. */
1535+ cpu_switch_mm(idmap_pgd, &init_mm);
1536+
1537+ /* Flush the TLB. */
1538     local_flush_tlb_all();
1539 }
1540--- a/arch/arm/mm/nommu.c
1541+++ b/arch/arm/mm/nommu.c
1542@@ -43,7 +43,7 @@ void __init paging_init(struct machine_d
1543 /*
1544  * We don't need to do anything here for nommu machines.
1545  */
1546-void setup_mm_for_reboot(char mode)
1547+void setup_mm_for_reboot(void)
1548 {
1549 }
1550 
1551--- a/arch/arm/mm/proc-arm1020.S
1552+++ b/arch/arm/mm/proc-arm1020.S
1553@@ -95,6 +95,7 @@ ENTRY(cpu_arm1020_proc_fin)
1554  * loc: location to jump to for soft reset
1555  */
1556     .align 5
1557+ .pushsection .idmap.text, "ax"
1558 ENTRY(cpu_arm1020_reset)
1559     mov ip, #0
1560     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1561@@ -107,6 +108,8 @@ ENTRY(cpu_arm1020_reset)
1562     bic ip, ip, #0x1100 @ ...i...s........
1563     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1564     mov pc, r0
1565+ENDPROC(cpu_arm1020_reset)
1566+ .popsection
1567 
1568 /*
1569  * cpu_arm1020_do_idle()
1570--- a/arch/arm/mm/proc-arm1020e.S
1571+++ b/arch/arm/mm/proc-arm1020e.S
1572@@ -95,6 +95,7 @@ ENTRY(cpu_arm1020e_proc_fin)
1573  * loc: location to jump to for soft reset
1574  */
1575     .align 5
1576+ .pushsection .idmap.text, "ax"
1577 ENTRY(cpu_arm1020e_reset)
1578     mov ip, #0
1579     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1580@@ -107,6 +108,8 @@ ENTRY(cpu_arm1020e_reset)
1581     bic ip, ip, #0x1100 @ ...i...s........
1582     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1583     mov pc, r0
1584+ENDPROC(cpu_arm1020e_reset)
1585+ .popsection
1586 
1587 /*
1588  * cpu_arm1020e_do_idle()
1589--- a/arch/arm/mm/proc-arm1022.S
1590+++ b/arch/arm/mm/proc-arm1022.S
1591@@ -84,6 +84,7 @@ ENTRY(cpu_arm1022_proc_fin)
1592  * loc: location to jump to for soft reset
1593  */
1594     .align 5
1595+ .pushsection .idmap.text, "ax"
1596 ENTRY(cpu_arm1022_reset)
1597     mov ip, #0
1598     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1599@@ -96,6 +97,8 @@ ENTRY(cpu_arm1022_reset)
1600     bic ip, ip, #0x1100 @ ...i...s........
1601     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1602     mov pc, r0
1603+ENDPROC(cpu_arm1022_reset)
1604+ .popsection
1605 
1606 /*
1607  * cpu_arm1022_do_idle()
1608--- a/arch/arm/mm/proc-arm1026.S
1609+++ b/arch/arm/mm/proc-arm1026.S
1610@@ -84,6 +84,7 @@ ENTRY(cpu_arm1026_proc_fin)
1611  * loc: location to jump to for soft reset
1612  */
1613     .align 5
1614+ .pushsection .idmap.text, "ax"
1615 ENTRY(cpu_arm1026_reset)
1616     mov ip, #0
1617     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1618@@ -96,6 +97,8 @@ ENTRY(cpu_arm1026_reset)
1619     bic ip, ip, #0x1100 @ ...i...s........
1620     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1621     mov pc, r0
1622+ENDPROC(cpu_arm1026_reset)
1623+ .popsection
1624 
1625 /*
1626  * cpu_arm1026_do_idle()
1627--- a/arch/arm/mm/proc-arm6_7.S
1628+++ b/arch/arm/mm/proc-arm6_7.S
1629@@ -225,6 +225,7 @@ ENTRY(cpu_arm7_set_pte_ext)
1630  * Params : r0 = address to jump to
1631  * Notes : This sets up everything for a reset
1632  */
1633+ .pushsection .idmap.text, "ax"
1634 ENTRY(cpu_arm6_reset)
1635 ENTRY(cpu_arm7_reset)
1636         mov r1, #0
1637@@ -235,6 +236,9 @@ ENTRY(cpu_arm7_reset)
1638         mov r1, #0x30
1639         mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc
1640         mov pc, r0
1641+ENDPROC(cpu_arm6_reset)
1642+ENDPROC(cpu_arm7_reset)
1643+ .popsection
1644 
1645         __CPUINIT
1646 
1647--- a/arch/arm/mm/proc-arm720.S
1648+++ b/arch/arm/mm/proc-arm720.S
1649@@ -101,6 +101,7 @@ ENTRY(cpu_arm720_set_pte_ext)
1650  * Params : r0 = address to jump to
1651  * Notes : This sets up everything for a reset
1652  */
1653+ .pushsection .idmap.text, "ax"
1654 ENTRY(cpu_arm720_reset)
1655         mov ip, #0
1656         mcr p15, 0, ip, c7, c7, 0 @ invalidate cache
1657@@ -112,6 +113,8 @@ ENTRY(cpu_arm720_reset)
1658         bic ip, ip, #0x2100 @ ..v....s........
1659         mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1660         mov pc, r0
1661+ENDPROC(cpu_arm720_reset)
1662+ .popsection
1663 
1664     __CPUINIT
1665 
1666--- a/arch/arm/mm/proc-arm740.S
1667+++ b/arch/arm/mm/proc-arm740.S
1668@@ -49,6 +49,7 @@ ENTRY(cpu_arm740_proc_fin)
1669  * Params : r0 = address to jump to
1670  * Notes : This sets up everything for a reset
1671  */
1672+ .pushsection .idmap.text, "ax"
1673 ENTRY(cpu_arm740_reset)
1674     mov ip, #0
1675     mcr p15, 0, ip, c7, c0, 0 @ invalidate cache
1676@@ -56,6 +57,8 @@ ENTRY(cpu_arm740_reset)
1677     bic ip, ip, #0x0000000c @ ............wc..
1678     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1679     mov pc, r0
1680+ENDPROC(cpu_arm740_reset)
1681+ .popsection
1682 
1683     __CPUINIT
1684 
1685--- a/arch/arm/mm/proc-arm7tdmi.S
1686+++ b/arch/arm/mm/proc-arm7tdmi.S
1687@@ -45,8 +45,11 @@ ENTRY(cpu_arm7tdmi_proc_fin)
1688  * Params : loc(r0) address to jump to
1689  * Purpose : Sets up everything for a reset and jump to the location for soft reset.
1690  */
1691+ .pushsection .idmap.text, "ax"
1692 ENTRY(cpu_arm7tdmi_reset)
1693         mov pc, r0
1694+ENDPROC(cpu_arm7tdmi_reset)
1695+ .popsection
1696 
1697         __CPUINIT
1698 
1699--- a/arch/arm/mm/proc-arm920.S
1700+++ b/arch/arm/mm/proc-arm920.S
1701@@ -85,6 +85,7 @@ ENTRY(cpu_arm920_proc_fin)
1702  * loc: location to jump to for soft reset
1703  */
1704     .align 5
1705+ .pushsection .idmap.text, "ax"
1706 ENTRY(cpu_arm920_reset)
1707     mov ip, #0
1708     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1709@@ -97,6 +98,8 @@ ENTRY(cpu_arm920_reset)
1710     bic ip, ip, #0x1100 @ ...i...s........
1711     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1712     mov pc, r0
1713+ENDPROC(cpu_arm920_reset)
1714+ .popsection
1715 
1716 /*
1717  * cpu_arm920_do_idle()
1718--- a/arch/arm/mm/proc-arm922.S
1719+++ b/arch/arm/mm/proc-arm922.S
1720@@ -87,6 +87,7 @@ ENTRY(cpu_arm922_proc_fin)
1721  * loc: location to jump to for soft reset
1722  */
1723     .align 5
1724+ .pushsection .idmap.text, "ax"
1725 ENTRY(cpu_arm922_reset)
1726     mov ip, #0
1727     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1728@@ -99,6 +100,8 @@ ENTRY(cpu_arm922_reset)
1729     bic ip, ip, #0x1100 @ ...i...s........
1730     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1731     mov pc, r0
1732+ENDPROC(cpu_arm922_reset)
1733+ .popsection
1734 
1735 /*
1736  * cpu_arm922_do_idle()
1737--- a/arch/arm/mm/proc-arm925.S
1738+++ b/arch/arm/mm/proc-arm925.S
1739@@ -108,6 +108,7 @@ ENTRY(cpu_arm925_proc_fin)
1740  * loc: location to jump to for soft reset
1741  */
1742     .align 5
1743+ .pushsection .idmap.text, "ax"
1744 ENTRY(cpu_arm925_reset)
1745     /* Send software reset to MPU and DSP */
1746     mov ip, #0xff000000
1747@@ -115,6 +116,8 @@ ENTRY(cpu_arm925_reset)
1748     orr ip, ip, #0x0000ce00
1749     mov r4, #1
1750     strh r4, [ip, #0x10]
1751+ENDPROC(cpu_arm925_reset)
1752+ .popsection
1753 
1754     mov ip, #0
1755     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1756--- a/arch/arm/mm/proc-arm926.S
1757+++ b/arch/arm/mm/proc-arm926.S
1758@@ -77,6 +77,7 @@ ENTRY(cpu_arm926_proc_fin)
1759  * loc: location to jump to for soft reset
1760  */
1761     .align 5
1762+ .pushsection .idmap.text, "ax"
1763 ENTRY(cpu_arm926_reset)
1764     mov ip, #0
1765     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1766@@ -89,6 +90,8 @@ ENTRY(cpu_arm926_reset)
1767     bic ip, ip, #0x1100 @ ...i...s........
1768     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1769     mov pc, r0
1770+ENDPROC(cpu_arm926_reset)
1771+ .popsection
1772 
1773 /*
1774  * cpu_arm926_do_idle()
1775--- a/arch/arm/mm/proc-arm940.S
1776+++ b/arch/arm/mm/proc-arm940.S
1777@@ -48,6 +48,7 @@ ENTRY(cpu_arm940_proc_fin)
1778  * Params : r0 = address to jump to
1779  * Notes : This sets up everything for a reset
1780  */
1781+ .pushsection .idmap.text, "ax"
1782 ENTRY(cpu_arm940_reset)
1783     mov ip, #0
1784     mcr p15, 0, ip, c7, c5, 0 @ flush I cache
1785@@ -58,6 +59,8 @@ ENTRY(cpu_arm940_reset)
1786     bic ip, ip, #0x00001000 @ i-cache
1787     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1788     mov pc, r0
1789+ENDPROC(cpu_arm940_reset)
1790+ .popsection
1791 
1792 /*
1793  * cpu_arm940_do_idle()
1794--- a/arch/arm/mm/proc-arm946.S
1795+++ b/arch/arm/mm/proc-arm946.S
1796@@ -55,6 +55,7 @@ ENTRY(cpu_arm946_proc_fin)
1797  * Params : r0 = address to jump to
1798  * Notes : This sets up everything for a reset
1799  */
1800+ .pushsection .idmap.text, "ax"
1801 ENTRY(cpu_arm946_reset)
1802     mov ip, #0
1803     mcr p15, 0, ip, c7, c5, 0 @ flush I cache
1804@@ -65,6 +66,8 @@ ENTRY(cpu_arm946_reset)
1805     bic ip, ip, #0x00001000 @ i-cache
1806     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1807     mov pc, r0
1808+ENDPROC(cpu_arm946_reset)
1809+ .popsection
1810 
1811 /*
1812  * cpu_arm946_do_idle()
1813--- a/arch/arm/mm/proc-arm9tdmi.S
1814+++ b/arch/arm/mm/proc-arm9tdmi.S
1815@@ -45,8 +45,11 @@ ENTRY(cpu_arm9tdmi_proc_fin)
1816  * Params : loc(r0) address to jump to
1817  * Purpose : Sets up everything for a reset and jump to the location for soft reset.
1818  */
1819+ .pushsection .idmap.text, "ax"
1820 ENTRY(cpu_arm9tdmi_reset)
1821         mov pc, r0
1822+ENDPROC(cpu_arm9tdmi_reset)
1823+ .popsection
1824 
1825         __CPUINIT
1826 
1827--- a/arch/arm/mm/proc-fa526.S
1828+++ b/arch/arm/mm/proc-fa526.S
1829@@ -57,6 +57,7 @@ ENTRY(cpu_fa526_proc_fin)
1830  * loc: location to jump to for soft reset
1831  */
1832     .align 4
1833+ .pushsection .idmap.text, "ax"
1834 ENTRY(cpu_fa526_reset)
1835 /* TODO: Use CP8 if possible... */
1836     mov ip, #0
1837@@ -73,6 +74,8 @@ ENTRY(cpu_fa526_reset)
1838     nop
1839     nop
1840     mov pc, r0
1841+ENDPROC(cpu_fa526_reset)
1842+ .popsection
1843 
1844 /*
1845  * cpu_fa526_do_idle()
1846--- a/arch/arm/mm/proc-feroceon.S
1847+++ b/arch/arm/mm/proc-feroceon.S
1848@@ -98,6 +98,7 @@ ENTRY(cpu_feroceon_proc_fin)
1849  * loc: location to jump to for soft reset
1850  */
1851     .align 5
1852+ .pushsection .idmap.text, "ax"
1853 ENTRY(cpu_feroceon_reset)
1854     mov ip, #0
1855     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1856@@ -110,6 +111,8 @@ ENTRY(cpu_feroceon_reset)
1857     bic ip, ip, #0x1100 @ ...i...s........
1858     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1859     mov pc, r0
1860+ENDPROC(cpu_feroceon_reset)
1861+ .popsection
1862 
1863 /*
1864  * cpu_feroceon_do_idle()
1865--- a/arch/arm/mm/proc-mohawk.S
1866+++ b/arch/arm/mm/proc-mohawk.S
1867@@ -69,6 +69,7 @@ ENTRY(cpu_mohawk_proc_fin)
1868  * (same as arm926)
1869  */
1870     .align 5
1871+ .pushsection .idmap.text, "ax"
1872 ENTRY(cpu_mohawk_reset)
1873     mov ip, #0
1874     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1875@@ -79,6 +80,8 @@ ENTRY(cpu_mohawk_reset)
1876     bic ip, ip, #0x1100 @ ...i...s........
1877     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1878     mov pc, r0
1879+ENDPROC(cpu_mohawk_reset)
1880+ .popsection
1881 
1882 /*
1883  * cpu_mohawk_do_idle()
1884--- a/arch/arm/mm/proc-sa110.S
1885+++ b/arch/arm/mm/proc-sa110.S
1886@@ -62,6 +62,7 @@ ENTRY(cpu_sa110_proc_fin)
1887  * loc: location to jump to for soft reset
1888  */
1889     .align 5
1890+ .pushsection .idmap.text, "ax"
1891 ENTRY(cpu_sa110_reset)
1892     mov ip, #0
1893     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1894@@ -74,6 +75,8 @@ ENTRY(cpu_sa110_reset)
1895     bic ip, ip, #0x1100 @ ...i...s........
1896     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1897     mov pc, r0
1898+ENDPROC(cpu_sa110_reset)
1899+ .popsection
1900 
1901 /*
1902  * cpu_sa110_do_idle(type)
1903--- a/arch/arm/mm/proc-sa1100.S
1904+++ b/arch/arm/mm/proc-sa1100.S
1905@@ -70,6 +70,7 @@ ENTRY(cpu_sa1100_proc_fin)
1906  * loc: location to jump to for soft reset
1907  */
1908     .align 5
1909+ .pushsection .idmap.text, "ax"
1910 ENTRY(cpu_sa1100_reset)
1911     mov ip, #0
1912     mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
1913@@ -82,6 +83,8 @@ ENTRY(cpu_sa1100_reset)
1914     bic ip, ip, #0x1100 @ ...i...s........
1915     mcr p15, 0, ip, c1, c0, 0 @ ctrl register
1916     mov pc, r0
1917+ENDPROC(cpu_sa1100_reset)
1918+ .popsection
1919 
1920 /*
1921  * cpu_sa1100_do_idle(type)
1922--- a/arch/arm/mm/proc-v6.S
1923+++ b/arch/arm/mm/proc-v6.S
1924@@ -55,6 +55,7 @@ ENTRY(cpu_v6_proc_fin)
1925  * - loc - location to jump to for soft reset
1926  */
1927     .align 5
1928+ .pushsection .idmap.text, "ax"
1929 ENTRY(cpu_v6_reset)
1930     mrc p15, 0, r1, c1, c0, 0 @ ctrl register
1931     bic r1, r1, #0x1 @ ...............m
1932@@ -62,6 +63,8 @@ ENTRY(cpu_v6_reset)
1933     mov r1, #0
1934     mcr p15, 0, r1, c7, c5, 4 @ ISB
1935     mov pc, r0
1936+ENDPROC(cpu_v6_reset)
1937+ .popsection
1938 
1939 /*
1940  * cpu_v6_do_idle()
1941--- a/arch/arm/mm/proc-v7.S
1942+++ b/arch/arm/mm/proc-v7.S
1943@@ -63,6 +63,7 @@ ENDPROC(cpu_v7_proc_fin)
1944  * caches disabled.
1945  */
1946     .align 5
1947+ .pushsection .idmap.text, "ax"
1948 ENTRY(cpu_v7_reset)
1949     mrc p15, 0, r1, c1, c0, 0 @ ctrl register
1950     bic r1, r1, #0x1 @ ...............m
1951@@ -71,6 +72,7 @@ ENTRY(cpu_v7_reset)
1952     isb
1953     mov pc, r0
1954 ENDPROC(cpu_v7_reset)
1955+ .popsection
1956 
1957 /*
1958  * cpu_v7_do_idle()
1959--- a/arch/arm/mm/proc-xsc3.S
1960+++ b/arch/arm/mm/proc-xsc3.S
1961@@ -105,6 +105,7 @@ ENTRY(cpu_xsc3_proc_fin)
1962  * loc: location to jump to for soft reset
1963  */
1964     .align 5
1965+ .pushsection .idmap.text, "ax"
1966 ENTRY(cpu_xsc3_reset)
1967     mov r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
1968     msr cpsr_c, r1 @ reset CPSR
1969@@ -119,6 +120,8 @@ ENTRY(cpu_xsc3_reset)
1970     @ already containing those two last instructions to survive.
1971     mcr p15, 0, ip, c8, c7, 0 @ invalidate I and D TLBs
1972     mov pc, r0
1973+ENDPROC(cpu_xsc3_reset)
1974+ .popsection
1975 
1976 /*
1977  * cpu_xsc3_do_idle()
1978--- a/arch/arm/mm/proc-xscale.S
1979+++ b/arch/arm/mm/proc-xscale.S
1980@@ -142,6 +142,7 @@ ENTRY(cpu_xscale_proc_fin)
1981  * Beware PXA270 erratum E7.
1982  */
1983     .align 5
1984+ .pushsection .idmap.text, "ax"
1985 ENTRY(cpu_xscale_reset)
1986     mov r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
1987     msr cpsr_c, r1 @ reset CPSR
1988@@ -160,6 +161,8 @@ ENTRY(cpu_xscale_reset)
1989     @ already containing those two last instructions to survive.
1990     mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
1991     mov pc, r0
1992+ENDPROC(cpu_xscale_reset)
1993+ .popsection
1994 
1995 /*
1996  * cpu_xscale_do_idle()
1997--- a/arch/arm/plat-omap/include/plat/irqs.h
1998+++ b/arch/arm/plat-omap/include/plat/irqs.h
1999@@ -438,16 +438,6 @@
2000 
2001 #ifndef __ASSEMBLY__
2002 extern void __iomem *omap_irq_base;
2003-void omap1_init_irq(void);
2004-void omap2_init_irq(void);
2005-void omap3_init_irq(void);
2006-void ti816x_init_irq(void);
2007-extern int omap_irq_pending(void);
2008-void omap_intc_save_context(void);
2009-void omap_intc_restore_context(void);
2010-void omap3_intc_suspend(void);
2011-void omap3_intc_prepare_idle(void);
2012-void omap3_intc_resume_idle(void);
2013 #endif
2014 
2015 #include <mach/hardware.h>
2016--- a/arch/arm/plat-omap/include/plat/system.h
2017+++ b/arch/arm/plat-omap/include/plat/system.h
2018@@ -12,6 +12,4 @@ static inline void arch_idle(void)
2019     cpu_do_idle();
2020 }
2021 
2022-extern void (*arch_reset)(char, const char *);
2023-
2024 #endif
2025--- a/include/asm-generic/vmlinux.lds.h
2026+++ b/include/asm-generic/vmlinux.lds.h
2027@@ -447,6 +447,12 @@
2028         *(.kprobes.text) \
2029         VMLINUX_SYMBOL(__kprobes_text_end) = .;
2030 
2031+#define IDMAP_TEXT \
2032+ ALIGN_FUNCTION(); \
2033+ VMLINUX_SYMBOL(__idmap_text_start) = .; \
2034+ *(.idmap.text) \
2035+ VMLINUX_SYMBOL(__idmap_text_end) = .;
2036+
2037 #define ENTRY_TEXT \
2038         ALIGN_FUNCTION(); \
2039         VMLINUX_SYMBOL(__entry_text_start) = .; \
2040--- a/arch/arm/kernel/sleep.S
2041+++ b/arch/arm/kernel/sleep.S
2042@@ -85,11 +85,13 @@ ENDPROC(cpu_resume_mmu)
2043     .ltorg
2044     .align 5
2045 cpu_resume_turn_mmu_on:
2046+ .pushsection .idmap.text,"ax"
2047     mcr p15, 0, r1, c1, c0, 0 @ turn on MMU, I-cache, etc
2048     mrc p15, 0, r1, c0, c0, 0 @ read id reg
2049     mov r1, r1
2050     mov r1, r1
2051     mov pc, r3 @ jump to virtual address
2052+ .popsection
2053 ENDPROC(cpu_resume_turn_mmu_on)
2054 cpu_resume_after_mmu:
2055     str r5, [r2, r4, lsl #2] @ restore old mapping
2056--- a/arch/arm/mach-omap2/io.c
2057+++ b/arch/arm/mach-omap2/io.c
2058@@ -36,7 +36,7 @@
2059 #include "clock3xxx.h"
2060 #include "clock44xx.h"
2061 #include "io.h"
2062-
2063+#include "common.h"
2064 #include <plat/omap-pm.h>
2065 #include "powerdomain.h"
2066 
2067--- a/arch/arm/plat-omap/include/plat/common.h
2068+++ b/arch/arm/plat-omap/include/plat/common.h
2069@@ -27,78 +27,11 @@
2070 #ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
2071 #define __ARCH_ARM_MACH_OMAP_COMMON_H
2072 
2073-#include <linux/delay.h>
2074-
2075 #include <plat/i2c.h>
2076 
2077-struct sys_timer;
2078-
2079-extern void omap_map_common_io(void);
2080-extern struct sys_timer omap1_timer;
2081-extern struct sys_timer omap2_timer;
2082-extern struct sys_timer omap3_timer;
2083-extern struct sys_timer omap3_secure_timer;
2084-extern struct sys_timer omap4_timer;
2085-extern bool omap_32k_timer_init(void);
2086 extern int __init omap_init_clocksource_32k(void);
2087 extern unsigned long long notrace omap_32k_sched_clock(void);
2088 
2089 extern void omap_reserve(void);
2090 
2091-/*
2092- * IO bases for various OMAP processors
2093- * Except the tap base, rest all the io bases
2094- * listed are physical addresses.
2095- */
2096-struct omap_globals {
2097- u32 class; /* OMAP class to detect */
2098- void __iomem *tap; /* Control module ID code */
2099- unsigned long sdrc; /* SDRAM Controller */
2100- unsigned long sms; /* SDRAM Memory Scheduler */
2101- unsigned long ctrl; /* System Control Module */
2102- unsigned long ctrl_pad; /* PAD Control Module */
2103- unsigned long prm; /* Power and Reset Management */
2104- unsigned long cm; /* Clock Management */
2105- unsigned long cm2;
2106-};
2107-
2108-void omap2_set_globals_242x(void);
2109-void omap2_set_globals_243x(void);
2110-void omap2_set_globals_3xxx(void);
2111-void omap2_set_globals_443x(void);
2112-void omap2_set_globals_ti816x(void);
2113-
2114-/* These get called from omap2_set_globals_xxxx(), do not call these */
2115-void omap2_set_globals_tap(struct omap_globals *);
2116-void omap2_set_globals_sdrc(struct omap_globals *);
2117-void omap2_set_globals_control(struct omap_globals *);
2118-void omap2_set_globals_prcm(struct omap_globals *);
2119-
2120-void omap3_map_io(void);
2121-
2122-/**
2123- * omap_test_timeout - busy-loop, testing a condition
2124- * @cond: condition to test until it evaluates to true
2125- * @timeout: maximum number of microseconds in the timeout
2126- * @index: loop index (integer)
2127- *
2128- * Loop waiting for @cond to become true or until at least @timeout
2129- * microseconds have passed. To use, define some integer @index in the
2130- * calling code. After running, if @index == @timeout, then the loop has
2131- * timed out.
2132- */
2133-#define omap_test_timeout(cond, timeout, index) \
2134-({ \
2135- for (index = 0; index < timeout; index++) { \
2136- if (cond) \
2137- break; \
2138- udelay(1); \
2139- } \
2140-})
2141-
2142-extern struct device *omap2_get_mpuss_device(void);
2143-extern struct device *omap2_get_iva_device(void);
2144-extern struct device *omap2_get_l3_device(void);
2145-extern struct device *omap4_get_dsp_device(void);
2146-
2147 #endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
2148--- a/arch/arm/plat-omap/include/plat/io.h
2149+++ b/arch/arm/plat-omap/include/plat/io.h
2150@@ -258,48 +258,9 @@ struct omap_sdrc_params;
2151 
2152 extern void omap1_map_common_io(void);
2153 extern void omap1_init_common_hw(void);
2154+extern void omap_writel(u32 v, u32 pa);
2155 
2156-#ifdef CONFIG_SOC_OMAP2420
2157-extern void omap242x_map_common_io(void);
2158-#else
2159-static inline void omap242x_map_common_io(void)
2160-{
2161-}
2162-#endif
2163-
2164-#ifdef CONFIG_SOC_OMAP2430
2165-extern void omap243x_map_common_io(void);
2166-#else
2167-static inline void omap243x_map_common_io(void)
2168-{
2169-}
2170-#endif
2171-
2172-#ifdef CONFIG_ARCH_OMAP3
2173-extern void omap34xx_map_common_io(void);
2174-#else
2175-static inline void omap34xx_map_common_io(void)
2176-{
2177-}
2178-#endif
2179-
2180-#ifdef CONFIG_SOC_OMAPTI816X
2181-extern void omapti816x_map_common_io(void);
2182-#else
2183-static inline void omapti816x_map_common_io(void)
2184-{
2185-}
2186-#endif
2187-
2188-#ifdef CONFIG_ARCH_OMAP4
2189-extern void omap44xx_map_common_io(void);
2190-#else
2191-static inline void omap44xx_map_common_io(void)
2192-{
2193-}
2194-#endif
2195-
2196-extern void omap2_init_common_infrastructure(void);
2197+struct omap_sdrc_params;
2198 extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
2199                       struct omap_sdrc_params *sdrc_cs1);
2200 
2201

Archive Download this file



interactive