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