Merge branch 'devel-stable' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Oct 2011 19:02:27 +0000 (12:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Oct 2011 19:02:27 +0000 (12:02 -0700)
* 'devel-stable' of http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-2.6-arm: (178 commits)
  ARM: 7139/1: fix compilation with CONFIG_ARM_ATAG_DTB_COMPAT and large TEXT_OFFSET
  ARM: gic, local timers: use the request_percpu_irq() interface
  ARM: gic: consolidate PPI handling
  ARM: switch from NO_MACH_MEMORY_H to NEED_MACH_MEMORY_H
  ARM: mach-s5p64x0: remove mach/memory.h
  ARM: mach-s3c64xx: remove mach/memory.h
  ARM: plat-mxc: remove mach/memory.h
  ARM: mach-prima2: remove mach/memory.h
  ARM: mach-zynq: remove mach/memory.h
  ARM: mach-bcmring: remove mach/memory.h
  ARM: mach-davinci: remove mach/memory.h
  ARM: mach-pxa: remove mach/memory.h
  ARM: mach-ixp4xx: remove mach/memory.h
  ARM: mach-h720x: remove mach/memory.h
  ARM: mach-vt8500: remove mach/memory.h
  ARM: mach-s5pc100: remove mach/memory.h
  ARM: mach-tegra: remove mach/memory.h
  ARM: plat-tcc: remove mach/memory.h
  ARM: mach-mmp: remove mach/memory.h
  ARM: mach-cns3xxx: remove mach/memory.h
  ...

Fix up mostly pretty trivial conflicts in:
 - arch/arm/Kconfig
 - arch/arm/include/asm/localtimer.h
 - arch/arm/kernel/Makefile
 - arch/arm/mach-shmobile/board-ap4evb.c
 - arch/arm/mach-u300/core.c
 - arch/arm/mm/dma-mapping.c
 - arch/arm/mm/proc-v7.S
 - arch/arm/plat-omap/Kconfig
largely due to some CONFIG option renaming (ie CONFIG_PM_SLEEP ->
CONFIG_ARM_CPU_SUSPEND for the arm-specific suspend code etc) and
addition of NEED_MACH_MEMORY_H next to HAVE_IDE.

104 files changed:
1  2 
arch/arm/Kconfig
arch/arm/Kconfig.debug
arch/arm/boot/compressed/Makefile
arch/arm/common/gic.c
arch/arm/include/asm/dma-mapping.h
arch/arm/include/asm/localtimer.h
arch/arm/include/asm/mach/arch.h
arch/arm/include/asm/pgtable.h
arch/arm/kernel/Makefile
arch/arm/kernel/debug.S
arch/arm/kernel/head.S
arch/arm/kernel/perf_event_v7.c
arch/arm/kernel/setup.c
arch/arm/kernel/smp.c
arch/arm/mach-clps711x/clep7312.c
arch/arm/mach-clps711x/edb7211-arch.c
arch/arm/mach-clps711x/fortunet.c
arch/arm/mach-clps711x/p720t.c
arch/arm/mach-ep93xx/edb93xx.c
arch/arm/mach-ep93xx/simone.c
arch/arm/mach-ep93xx/snappercl15.c
arch/arm/mach-exynos4/mct.c
arch/arm/mach-footbridge/cats-hw.c
arch/arm/mach-footbridge/netwinder-hw.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-integrator/integrator_ap.c
arch/arm/mach-ixp4xx/dsmg600-setup.c
arch/arm/mach-ixp4xx/fsg-setup.c
arch/arm/mach-ixp4xx/nas100d-setup.c
arch/arm/mach-ixp4xx/nslu2-setup.c
arch/arm/mach-ks8695/board-acs5k.c
arch/arm/mach-ks8695/board-dsm320.c
arch/arm/mach-ks8695/board-micrel.c
arch/arm/mach-lpc32xx/phy3250.c
arch/arm/mach-msm/board-halibut.c
arch/arm/mach-msm/board-mahimahi.c
arch/arm/mach-msm/board-msm7x27.c
arch/arm/mach-msm/board-msm7x30.c
arch/arm/mach-msm/board-qsd8x50.c
arch/arm/mach-msm/board-sapphire.c
arch/arm/mach-msm/board-trout.c
arch/arm/mach-nomadik/board-nhk8815.c
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-fsample.c
arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-htcherald.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmtt.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-orion5x/db88f5281-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/kurobox_pro-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/rd88f5182-setup.c
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
arch/arm/mach-orion5x/terastation_pro2-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-pxa/cm-x300.c
arch/arm/mach-pxa/eseries.c
arch/arm/mach-pxa/lpd270.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/saar.c
arch/arm/mach-pxa/saarb.c
arch/arm/mach-pxa/xcep.c
arch/arm/mach-realview/realview_pb1176.c
arch/arm/mach-realview/realview_pbx.c
arch/arm/mach-rpc/riscpc.c
arch/arm/mach-s3c2412/mach-smdk2413.c
arch/arm/mach-s3c2412/mach-vstms.c
arch/arm/mach-s3c64xx/mach-smdk6410.c
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/simpad.c
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-mackerel.c
arch/arm/mach-tegra/board-harmony.c
arch/arm/mach-tegra/board-paz00.c
arch/arm/mach-tegra/board-trimslice.c
arch/arm/mach-u300/core.c
arch/arm/mach-ux500/board-mop500.c
arch/arm/mach-ux500/board-u5500.c
arch/arm/mm/dma-mapping.c
arch/arm/mm/init.c
arch/arm/mm/mmu.c
arch/arm/mm/proc-v7.S
arch/arm/plat-omap/Kconfig
kernel/Makefile
kernel/power/Kconfig

diff --combined arch/arm/Kconfig
@@@ -3,7 -3,7 +3,7 @@@ config AR
        default y
        select HAVE_AOUT
        select HAVE_DMA_API_DEBUG
 -      select HAVE_IDE
 +      select HAVE_IDE if PCI || ISA || PCMCIA
        select HAVE_MEMBLOCK
        select RTC_LIB
        select SYS_SUPPORTS_APM_EMULATION
@@@ -29,6 -29,7 +29,7 @@@
        select HAVE_GENERIC_HARDIRQS
        select HAVE_SPARSE_IRQ
        select GENERIC_IRQ_SHOW
+       select CPU_PM if (SUSPEND || CPU_IDLE)
        help
          The ARM series is a line of low-power-consumption RISC chip designs
          licensed by ARM Ltd and targeted at embedded applications and
@@@ -211,11 -212,20 +212,24 @@@ config ARM_PATCH_PHYS_VIR
          this feature (eg, building a kernel for a single machine) and
          you need to shrink the kernel to the minimal size.
  
+ config NEED_MACH_MEMORY_H
+       bool
+       help
+         Select this when mach/memory.h is required to provide special
+         definitions for this platform.  The need for mach/memory.h should
+         be avoided when possible.
+ config PHYS_OFFSET
+       hex "Physical address of main memory"
+       depends on !ARM_PATCH_PHYS_VIRT && !NEED_MACH_MEMORY_H
+       help
+         Please provide the physical address corresponding to the
+         location of main memory in your system.
  
 +config GENERIC_BUG
 +      def_bool y
 +      depends on BUG
 +
  source "init/Kconfig"
  
  source "kernel/Kconfig.freezer"
@@@ -247,6 -257,7 +261,7 @@@ config ARCH_INTEGRATO
        select GENERIC_CLOCKEVENTS
        select PLAT_VERSATILE
        select PLAT_VERSATILE_FPGA_IRQ
+       select NEED_MACH_MEMORY_H
        help
          Support for ARM's Integrator platform.
  
@@@ -262,6 -273,7 +277,7 @@@ config ARCH_REALVIE
        select PLAT_VERSATILE_CLCD
        select ARM_TIMER_SP804
        select GPIO_PL061 if GPIOLIB
+       select NEED_MACH_MEMORY_H
        help
          This enables support for ARM Ltd RealView boards.
  
@@@ -322,6 -334,7 +338,7 @@@ config ARCH_CLPS711
        bool "Cirrus Logic CLPS711x/EP721x-based"
        select CPU_ARM720T
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MACH_MEMORY_H
        help
          Support for Cirrus Logic 711x/721x based boards.
  
@@@ -346,6 -359,7 +363,6 @@@ config ARCH_GEMIN
  config ARCH_PRIMA2
        bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform"
        select CPU_V7
 -      select GENERIC_TIME
        select NO_IOPORT
        select GENERIC_CLOCKEVENTS
        select CLKDEV_LOOKUP
@@@ -361,6 -375,7 +378,7 @@@ config ARCH_EBSA11
        select ISA
        select NO_IOPORT
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MACH_MEMORY_H
        help
          This is an evaluation board for the StrongARM processor available
          from Digital. It has limited hardware on-board, including an
@@@ -376,6 -391,7 +394,7 @@@ config ARCH_EP93X
        select ARCH_REQUIRE_GPIOLIB
        select ARCH_HAS_HOLES_MEMORYMODEL
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MEMORY_H
        help
          This enables support for the Cirrus EP93xx series of CPUs.
  
@@@ -384,7 -400,7 +403,8 @@@ config ARCH_FOOTBRIDG
        select CPU_SA110
        select FOOTBRIDGE
        select GENERIC_CLOCKEVENTS
 +      select HAVE_IDE
+       select NEED_MACH_MEMORY_H
        help
          Support for systems based on the DC21285 companion chip
          ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
@@@ -434,6 -450,7 +454,7 @@@ config ARCH_IOP13X
        select PCI
        select ARCH_SUPPORTS_MSI
        select VMSPLIT_1G
+       select NEED_MACH_MEMORY_H
        help
          Support for Intel's IOP13XX (XScale) family of processors.
  
@@@ -464,6 -481,7 +485,7 @@@ config ARCH_IXP23X
        select CPU_XSC3
        select PCI
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MACH_MEMORY_H
        help
          Support for Intel's IXP23xx (XScale) family of processors.
  
@@@ -473,6 -491,7 +495,7 @@@ config ARCH_IXP200
        select CPU_XSCALE
        select PCI
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MACH_MEMORY_H
        help
          Support for Intel's IXP2400/2800 (XScale) family of processors.
  
@@@ -519,6 -538,7 +542,6 @@@ config ARCH_LPC32X
        select ARM_AMBA
        select USB_ARCH_HAS_OHCI
        select CLKDEV_LOOKUP
 -      select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        help
          Support for the NXP LPC32XX family of processors
@@@ -565,6 -585,7 +588,7 @@@ config ARCH_KS869
        select CPU_ARM922T
        select ARCH_REQUIRE_GPIOLIB
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MACH_MEMORY_H
        help
          Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based
          System-on-Chip devices.
@@@ -597,6 -618,7 +621,6 @@@ config ARCH_TEGR
        bool "NVIDIA Tegra"
        select CLKDEV_LOOKUP
        select CLKSRC_MMIO
 -      select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        select GENERIC_GPIO
        select HAVE_CLK
@@@ -629,8 -651,6 +653,8 @@@ config ARCH_PX
        select SPARSE_IRQ
        select AUTO_ZRELADDR
        select MULTI_IRQ_HANDLER
 +      select ARM_CPU_SUSPEND if PM
 +      select HAVE_IDE
        help
          Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
  
@@@ -657,6 -677,7 +681,7 @@@ config ARCH_SHMOBIL
        select SPARSE_IRQ
        select MULTI_IRQ_HANDLER
        select PM_GENERIC_DOMAINS if PM
+       select NEED_MACH_MEMORY_H
        help
          Support for Renesas's SH-Mobile and R-Mobile ARM platforms.
  
@@@ -671,7 -692,7 +696,8 @@@ config ARCH_RP
        select NO_IOPORT
        select ARCH_SPARSEMEM_ENABLE
        select ARCH_USES_GETTIMEOFFSET
 +      select HAVE_IDE
+       select NEED_MACH_MEMORY_H
        help
          On the Acorn Risc-PC, Linux can support the internal IDE disk and
          CD-ROM interface, serial and parallel port, and the floppy drive.
@@@ -690,7 -711,7 +716,8 @@@ config ARCH_SA110
        select HAVE_SCHED_CLOCK
        select TICK_ONESHOT
        select ARCH_REQUIRE_GPIOLIB
 +      select HAVE_IDE
+       select NEED_MACH_MEMORY_H
        help
          Support for StrongARM 11x0 based boards.
  
@@@ -724,6 -745,7 +751,6 @@@ config ARCH_S3C64X
        select ARCH_REQUIRE_GPIOLIB
        select SAMSUNG_CLKSRC
        select SAMSUNG_IRQ_VIC_TIMER
 -      select SAMSUNG_IRQ_UART
        select S3C_GPIO_TRACK
        select S3C_GPIO_PULL_UPDOWN
        select S3C_GPIO_CFG_S3C24XX
@@@ -782,6 -804,7 +809,7 @@@ config ARCH_S5PV21
        select HAVE_S3C2410_I2C if I2C
        select HAVE_S3C_RTC if RTC_CLASS
        select HAVE_S3C2410_WATCHDOG if WATCHDOG
+       select NEED_MACH_MEMORY_H
        help
          Samsung S5PV210/S5PC110 series based systems
  
@@@ -798,6 -821,7 +826,7 @@@ config ARCH_EXYNOS
        select HAVE_S3C_RTC if RTC_CLASS
        select HAVE_S3C2410_I2C if I2C
        select HAVE_S3C2410_WATCHDOG if WATCHDOG
+       select NEED_MACH_MEMORY_H
        help
          Samsung EXYNOS4 series based systems
  
@@@ -809,6 -833,7 +838,7 @@@ config ARCH_SHAR
        select ZONE_DMA
        select PCI
        select ARCH_USES_GETTIMEOFFSET
+       select NEED_MACH_MEMORY_H
        help
          Support for the StrongARM based Digital DNARD machine, also known
          as "Shark" (<http://www.shark-linux.de/shark.html>).
@@@ -836,7 -861,7 +866,8 @@@ config ARCH_U30
        select CLKDEV_LOOKUP
        select HAVE_MACH_CLKDEV
        select GENERIC_GPIO
 +      select ARCH_REQUIRE_GPIOLIB
+       select NEED_MACH_MEMORY_H
        help
          Support for ST-Ericsson U300 series mobile platforms.
  
@@@ -912,6 -937,7 +943,6 @@@ config ARCH_VT850
  config ARCH_ZYNQ
        bool "Xilinx Zynq ARM Cortex A9 Platform"
        select CPU_V7
 -      select GENERIC_TIME
        select GENERIC_CLOCKEVENTS
        select CLKDEV_LOOKUP
        select ARM_GIC
@@@ -1284,20 -1310,6 +1315,20 @@@ config ARM_ERRATA_36429
          processor into full low interrupt latency mode. ARM11MPCore
          is not affected.
  
 +config ARM_ERRATA_764369
 +      bool "ARM errata: Data cache line maintenance operation by MVA may not succeed"
 +      depends on CPU_V7 && SMP
 +      help
 +        This option enables the workaround for erratum 764369
 +        affecting Cortex-A9 MPCore with two or more processors (all
 +        current revisions). Under certain timing circumstances, a data
 +        cache line maintenance operation by MVA targeting an Inner
 +        Shareable memory region may fail to proceed up to either the
 +        Point of Coherency or to the Point of Unification of the
 +        system. This workaround adds a DSB instruction before the
 +        relevant cache maintenance functions and sets a specific bit
 +        in the diagnostic control register of the SCU.
 +
  endmenu
  
  source "arch/arm/common/Kconfig"
@@@ -1376,7 -1388,6 +1407,7 @@@ config SM
                 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
                 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
                 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE
 +      depends on MMU
        select USE_GENERIC_SMP_HELPERS
        select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
        help
          processor machines. On a single processor machine, the kernel will
          run faster if you say N here.
  
 -        See also <file:Documentation/i386/IO-APIC.txt>,
 +        See also <file:Documentation/x86/i386/IO-APIC.txt>,
          <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
          <http://tldp.org/HOWTO/SMP-HOWTO.html>.
  
@@@ -1509,7 -1520,6 +1540,7 @@@ config THUMB2_KERNE
        depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL
        select AEABI
        select ARM_ASM_UNIFIED
 +      select ARM_UNWIND
        help
          By enabling this option, the kernel will be compiled in
          Thumb-2 mode. A compiler/assembler that understand the unified
@@@ -1835,6 -1845,38 +1866,38 @@@ config ZBOOT_ROM_SH_MOBILE_SDH
  
  endchoice
  
+ config ARM_APPENDED_DTB
+       bool "Use appended device tree blob to zImage (EXPERIMENTAL)"
+       depends on OF && !ZBOOT_ROM && EXPERIMENTAL
+       help
+         With this option, the boot code will look for a device tree binary
+         (DTB) appended to zImage
+         (e.g. cat zImage <filename>.dtb > zImage_w_dtb).
+         This is meant as a backward compatibility convenience for those
+         systems with a bootloader that can't be upgraded to accommodate
+         the documented boot protocol using a device tree.
+         Beware that there is very little in terms of protection against
+         this option being confused by leftover garbage in memory that might
+         look like a DTB header after a reboot if no actual DTB is appended
+         to zImage.  Do not leave this option active in a production kernel
+         if you don't intend to always append a DTB.  Proper passing of the
+         location into r2 of a bootloader provided DTB is always preferable
+         to this option.
+ config ARM_ATAG_DTB_COMPAT
+       bool "Supplement the appended DTB with traditional ATAG information"
+       depends on ARM_APPENDED_DTB
+       help
+         Some old bootloaders can't be updated to a DTB capable one, yet
+         they provide ATAGs with memory configuration, the ramdisk address,
+         the kernel cmdline string, etc.  Such information is dynamically
+         provided by the bootloader and can't always be stored in a static
+         DTB.  To allow a device tree enabled kernel to be used with such
+         bootloaders, this option allows zImage to extract the information
+         from the ATAG list and store it at run time into the appended DTB.
  config CMDLINE
        string "Default kernel command string"
        default ""
@@@ -2129,9 -2171,6 +2192,9 @@@ config ARCH_SUSPEND_POSSIBL
                CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE
        def_bool y
  
 +config ARM_CPU_SUSPEND
 +      def_bool PM_SLEEP
 +
  endmenu
  
  source "net/Kconfig"
diff --combined arch/arm/Kconfig.debug
@@@ -65,71 -65,13 +65,71 @@@ config DEBUG_USE
  
  # These options are only for real kernel hackers who want to get their hands dirty.
  config DEBUG_LL
 -      bool "Kernel low-level debugging functions"
 +      bool "Kernel low-level debugging functions (read help!)"
        depends on DEBUG_KERNEL
        help
          Say Y here to include definitions of printascii, printch, printhex
          in the kernel.  This is helpful if you are debugging code that
          executes before the console is initialized.
  
 +        Note that selecting this option will limit the kernel to a single
 +        UART definition, as specified below. Attempting to boot the kernel
 +        image on a different platform *will not work*, so this option should
 +        not be enabled for kernels that are intended to be portable.
 +
 +choice
 +      prompt "Kernel low-level debugging port"
 +      depends on DEBUG_LL
 +
 +      config DEBUG_LL_UART_NONE
 +              bool "No low-level debugging UART"
 +              help
 +                Say Y here if your platform doesn't provide a UART option
 +                below. This relies on your platform choosing the right UART
 +                definition internally in order for low-level debugging to
 +                work.
 +
 +      config DEBUG_ICEDCC
 +              bool "Kernel low-level debugging via EmbeddedICE DCC channel"
 +              help
 +                Say Y here if you want the debug print routines to direct
 +                their output to the EmbeddedICE macrocell's DCC channel using
 +                co-processor 14. This is known to work on the ARM9 style ICE
 +                channel and on the XScale with the PEEDI.
 +
 +                Note that the system will appear to hang during boot if there
 +                is nothing connected to read from the DCC.
 +
 +      config DEBUG_FOOTBRIDGE_COM1
 +              bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1"
 +              depends on FOOTBRIDGE
 +              help
 +                Say Y here if you want the debug print routines to direct
 +                their output to the 8250 at PCI COM1.
 +
 +      config DEBUG_DC21285_PORT
 +              bool "Kernel low-level debugging messages via footbridge serial port"
 +              depends on FOOTBRIDGE
 +              help
 +                Say Y here if you want the debug print routines to direct
 +                their output to the serial port in the DC21285 (Footbridge).
 +
 +      config DEBUG_CLPS711X_UART1
 +              bool "Kernel low-level debugging messages via UART1"
 +              depends on ARCH_CLPS711X
 +              help
 +                Say Y here if you want the debug print routines to direct
 +                their output to the first serial port on these devices.
 +
 +      config DEBUG_CLPS711X_UART2
 +              bool "Kernel low-level debugging messages via UART2"
 +              depends on ARCH_CLPS711X
 +              help
 +                Say Y here if you want the debug print routines to direct
 +                their output to the second serial port on these devices.
 +
 +endchoice
 +
  config EARLY_PRINTK
        bool "Early printk"
        depends on DEBUG_LL
          kernel low-level debugging functions. Add earlyprintk to your
          kernel parameters to enable this console.
  
 -config DEBUG_ICEDCC
 -      bool "Kernel low-level debugging via EmbeddedICE DCC channel"
 -      depends on DEBUG_LL
 -      help
 -        Say Y here if you want the debug print routines to direct their
 -        output to the EmbeddedICE macrocell's DCC channel using
 -        co-processor 14. This is known to work on the ARM9 style ICE
 -        channel and on the XScale with the PEEDI.
 -
 -        It does include a timeout to ensure that the system does not
 -        totally freeze when there is nothing connected to read.
 -
  config OC_ETM
        bool "On-chip ETM and ETB"
 -      select ARM_AMBA
 +      depends on ARM_AMBA
        help
          Enables the on-chip embedded trace macrocell and embedded trace
          buffer driver that will allow you to collect traces of the
          kernel code.
  
 -config DEBUG_DC21285_PORT
 -      bool "Kernel low-level debugging messages via footbridge serial port"
 -      depends on DEBUG_LL && FOOTBRIDGE
 -      help
 -        Say Y here if you want the debug print routines to direct their
 -        output to the serial port in the DC21285 (Footbridge). Saying N
 -        will cause the debug messages to appear on the first 16550
 -        serial port.
 -
 -config DEBUG_CLPS711X_UART2
 -      bool "Kernel low-level debugging messages via UART2"
 -      depends on DEBUG_LL && ARCH_CLPS711X
 -      help
 -        Say Y here if you want the debug print routines to direct their
 -        output to the second serial port on these devices.  Saying N will
 -        cause the debug messages to appear on the first serial port.
 -
  config DEBUG_S3C_UART
        depends on PLAT_SAMSUNG
        int "S3C UART to use for low-level debug"
          The uncompressor code port configuration is now handled
          by CONFIG_S3C_LOWLEVEL_UART_PORT.
  
+ config ARM_KPROBES_TEST
+       tristate "Kprobes test module"
+       depends on KPROBES && MODULES
+       help
+         Perform tests of kprobes API and instruction set simulation.
  endmenu
@@@ -26,6 -26,10 +26,10 @@@ HEAD        = head.
  OBJS  += misc.o decompress.o
  FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
  
+ # string library code (-Os is enforced to keep it much smaller)
+ OBJS          += string.o
+ CFLAGS_string.o       := -Os
  #
  # Architecture dependencies
  #
@@@ -89,21 -93,41 +93,41 @@@ suffix_$(CONFIG_KERNEL_GZIP) = gzi
  suffix_$(CONFIG_KERNEL_LZO)  = lzo
  suffix_$(CONFIG_KERNEL_LZMA) = lzma
  
+ # Borrowed libfdt files for the ATAG compatibility mode
+ libfdt                := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
+ libfdt_hdrs   := fdt.h libfdt.h libfdt_internal.h
+ libfdt_objs   := $(addsuffix .o, $(basename $(libfdt)))
+ $(addprefix $(obj)/,$(libfdt) $(libfdt_hdrs)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
+       $(call cmd,shipped)
+ $(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \
+       $(addprefix $(obj)/,$(libfdt_hdrs))
+ ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
+ OBJS  += $(libfdt_objs) atags_to_fdt.o
+ endif
  targets       := vmlinux vmlinux.lds \
                 piggy.$(suffix_y) piggy.$(suffix_y).o \
-                font.o font.c head.o misc.o $(OBJS)
+                lib1funcs.o lib1funcs.S font.o font.c head.o misc.o $(OBJS)
  
  # Make sure files are removed during clean
- extra-y       += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S
+ extra-y       += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S $(libfdt) $(libfdt_hdrs)
  
  ifeq ($(CONFIG_FUNCTION_TRACER),y)
  ORIG_CFLAGS := $(KBUILD_CFLAGS)
  KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
  endif
  
- ccflags-y := -fpic -fno-builtin
+ ccflags-y := -fpic -fno-builtin -I$(obj)
  asflags-y := -Wa,-march=all
  
+ # Supply kernel BSS size to the decompressor via a linker symbol.
+ KBSS_SZ = $(shell size $(obj)/../../../../vmlinux | awk 'END{print $$3}')
+ LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ)
  # Supply ZRELADDR to the decompressor via a linker symbol.
  ifneq ($(CONFIG_AUTO_ZRELADDR),y)
  LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
@@@ -123,7 -147,7 +147,7 @@@ LDFLAGS_vmlinux += -
  # For __aeabi_uidivmod
  lib1funcs = $(obj)/lib1funcs.o
  
- $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
+ $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S
        $(call cmd,shipped)
  
  # We need to prevent any GOTOFF relocs being used with references
@@@ -139,16 -163,8 +163,16 @@@ bad_syms=$$($(CROSS_COMPILE)nm $@ | se
    ( echo "following symbols must have non local/private scope:" >&2; \
      echo "$$bad_syms" >&2; rm -f $@; false )
  
 +check_for_multiple_zreladdr = \
 +if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
 +      echo 'multiple zreladdrs: $(ZRELADDR)'; \
 +      echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \
 +      false; \
 +fi
 +
  $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
                $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
 +      @$(check_for_multiple_zreladdr)
        $(call if_changed,ld)
        @$(check_for_bad_syms)
  
diff --combined arch/arm/common/gic.c
  #include <linux/kernel.h>
  #include <linux/list.h>
  #include <linux/smp.h>
+ #include <linux/cpu_pm.h>
  #include <linux/cpumask.h>
  #include <linux/io.h>
+ #include <linux/interrupt.h>
+ #include <linux/percpu.h>
+ #include <linux/slab.h>
  
  #include <asm/irq.h>
  #include <asm/mach/irq.h>
  #include <asm/hardware/gic.h>
  
 -static DEFINE_SPINLOCK(irq_controller_lock);
 +static DEFINE_RAW_SPINLOCK(irq_controller_lock);
  
  /* Address of GIC 0 CPU interface */
  void __iomem *gic_cpu_base_addr __read_mostly;
@@@ -82,30 -86,30 +86,30 @@@ static void gic_mask_irq(struct irq_dat
  {
        u32 mask = 1 << (d->irq % 32);
  
 -      spin_lock(&irq_controller_lock);
 +      raw_spin_lock(&irq_controller_lock);
        writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
        if (gic_arch_extn.irq_mask)
                gic_arch_extn.irq_mask(d);
 -      spin_unlock(&irq_controller_lock);
 +      raw_spin_unlock(&irq_controller_lock);
  }
  
  static void gic_unmask_irq(struct irq_data *d)
  {
        u32 mask = 1 << (d->irq % 32);
  
 -      spin_lock(&irq_controller_lock);
 +      raw_spin_lock(&irq_controller_lock);
        if (gic_arch_extn.irq_unmask)
                gic_arch_extn.irq_unmask(d);
        writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
 -      spin_unlock(&irq_controller_lock);
 +      raw_spin_unlock(&irq_controller_lock);
  }
  
  static void gic_eoi_irq(struct irq_data *d)
  {
        if (gic_arch_extn.irq_eoi) {
 -              spin_lock(&irq_controller_lock);
 +              raw_spin_lock(&irq_controller_lock);
                gic_arch_extn.irq_eoi(d);
 -              spin_unlock(&irq_controller_lock);
 +              raw_spin_unlock(&irq_controller_lock);
        }
  
        writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
@@@ -129,7 -133,7 +133,7 @@@ static int gic_set_type(struct irq_dat
        if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
                return -EINVAL;
  
 -      spin_lock(&irq_controller_lock);
 +      raw_spin_lock(&irq_controller_lock);
  
        if (gic_arch_extn.irq_set_type)
                gic_arch_extn.irq_set_type(d, type);
        if (enabled)
                writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
  
 -      spin_unlock(&irq_controller_lock);
 +      raw_spin_unlock(&irq_controller_lock);
  
        return 0;
  }
@@@ -182,10 -186,10 +186,10 @@@ static int gic_set_affinity(struct irq_
        mask = 0xff << shift;
        bit = 1 << (cpu_logical_map(cpu) + shift);
  
 -      spin_lock(&irq_controller_lock);
 +      raw_spin_lock(&irq_controller_lock);
        val = readl_relaxed(reg) & ~mask;
        writel_relaxed(val | bit, reg);
 -      spin_unlock(&irq_controller_lock);
 +      raw_spin_unlock(&irq_controller_lock);
  
        return IRQ_SET_MASK_OK;
  }
@@@ -215,9 -219,9 +219,9 @@@ static void gic_handle_cascade_irq(unsi
  
        chained_irq_enter(chip, desc);
  
 -      spin_lock(&irq_controller_lock);
 +      raw_spin_lock(&irq_controller_lock);
        status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
 -      spin_unlock(&irq_controller_lock);
 +      raw_spin_unlock(&irq_controller_lock);
  
        gic_irq = (status & 0x3ff);
        if (gic_irq == 1023)
@@@ -262,6 -266,7 +266,7 @@@ static void __init gic_dist_init(struc
        u32 cpumask;
        void __iomem *base = gic->dist_base;
        u32 cpu = 0;
+       u32 nrppis = 0, ppi_base = 0;
  
  #ifdef CONFIG_SMP
        cpu = cpu_logical_map(smp_processor_id());
        if (gic_irqs > 1020)
                gic_irqs = 1020;
  
+       gic->gic_irqs = gic_irqs;
+       /*
+        * Nobody would be insane enough to use PPIs on a secondary
+        * GIC, right?
+        */
+       if (gic == &gic_data[0]) {
+               nrppis = (32 - irq_start) & 31;
+               /* The GIC only supports up to 16 PPIs. */
+               if (nrppis > 16)
+                       BUG();
+               ppi_base = gic->irq_offset + 32 - nrppis;
+       }
+       pr_info("Configuring GIC with %d sources (%d PPIs)\n",
+               gic_irqs, (gic == &gic_data[0]) ? nrppis : 0);
        /*
         * Set all global interrupts to be level triggered, active low.
         */
        /*
         * Setup the Linux IRQ subsystem.
         */
-       for (i = irq_start; i < irq_limit; i++) {
+       for (i = 0; i < nrppis; i++) {
+               int ppi = i + ppi_base;
+               irq_set_percpu_devid(ppi);
+               irq_set_chip_and_handler(ppi, &gic_chip,
+                                        handle_percpu_devid_irq);
+               irq_set_chip_data(ppi, gic);
+               set_irq_flags(ppi, IRQF_VALID | IRQF_NOAUTOEN);
+       }
+       for (i = irq_start + nrppis; i < irq_limit; i++) {
                irq_set_chip_and_handler(i, &gic_chip, handle_fasteoi_irq);
                irq_set_chip_data(i, gic);
                set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
@@@ -349,6 -383,189 +383,189 @@@ static void __cpuinit gic_cpu_init(stru
        writel_relaxed(1, base + GIC_CPU_CTRL);
  }
  
+ #ifdef CONFIG_CPU_PM
+ /*
+  * Saves the GIC distributor registers during suspend or idle.  Must be called
+  * with interrupts disabled but before powering down the GIC.  After calling
+  * this function, no interrupts will be delivered by the GIC, and another
+  * platform-specific wakeup source must be enabled.
+  */
+ static void gic_dist_save(unsigned int gic_nr)
+ {
+       unsigned int gic_irqs;
+       void __iomem *dist_base;
+       int i;
+       if (gic_nr >= MAX_GIC_NR)
+               BUG();
+       gic_irqs = gic_data[gic_nr].gic_irqs;
+       dist_base = gic_data[gic_nr].dist_base;
+       if (!dist_base)
+               return;
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 16); i++)
+               gic_data[gic_nr].saved_spi_conf[i] =
+                       readl_relaxed(dist_base + GIC_DIST_CONFIG + i * 4);
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 4); i++)
+               gic_data[gic_nr].saved_spi_target[i] =
+                       readl_relaxed(dist_base + GIC_DIST_TARGET + i * 4);
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)
+               gic_data[gic_nr].saved_spi_enable[i] =
+                       readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
+ }
+ /*
+  * Restores the GIC distributor registers during resume or when coming out of
+  * idle.  Must be called before enabling interrupts.  If a level interrupt
+  * that occured while the GIC was suspended is still present, it will be
+  * handled normally, but any edge interrupts that occured will not be seen by
+  * the GIC and need to be handled by the platform-specific wakeup source.
+  */
+ static void gic_dist_restore(unsigned int gic_nr)
+ {
+       unsigned int gic_irqs;
+       unsigned int i;
+       void __iomem *dist_base;
+       if (gic_nr >= MAX_GIC_NR)
+               BUG();
+       gic_irqs = gic_data[gic_nr].gic_irqs;
+       dist_base = gic_data[gic_nr].dist_base;
+       if (!dist_base)
+               return;
+       writel_relaxed(0, dist_base + GIC_DIST_CTRL);
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 16); i++)
+               writel_relaxed(gic_data[gic_nr].saved_spi_conf[i],
+                       dist_base + GIC_DIST_CONFIG + i * 4);
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 4); i++)
+               writel_relaxed(0xa0a0a0a0,
+                       dist_base + GIC_DIST_PRI + i * 4);
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 4); i++)
+               writel_relaxed(gic_data[gic_nr].saved_spi_target[i],
+                       dist_base + GIC_DIST_TARGET + i * 4);
+       for (i = 0; i < DIV_ROUND_UP(gic_irqs, 32); i++)
+               writel_relaxed(gic_data[gic_nr].saved_spi_enable[i],
+                       dist_base + GIC_DIST_ENABLE_SET + i * 4);
+       writel_relaxed(1, dist_base + GIC_DIST_CTRL);
+ }
+ static void gic_cpu_save(unsigned int gic_nr)
+ {
+       int i;
+       u32 *ptr;
+       void __iomem *dist_base;
+       void __iomem *cpu_base;
+       if (gic_nr >= MAX_GIC_NR)
+               BUG();
+       dist_base = gic_data[gic_nr].dist_base;
+       cpu_base = gic_data[gic_nr].cpu_base;
+       if (!dist_base || !cpu_base)
+               return;
+       ptr = __this_cpu_ptr(gic_data[gic_nr].saved_ppi_enable);
+       for (i = 0; i < DIV_ROUND_UP(32, 32); i++)
+               ptr[i] = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
+       ptr = __this_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);
+       for (i = 0; i < DIV_ROUND_UP(32, 16); i++)
+               ptr[i] = readl_relaxed(dist_base + GIC_DIST_CONFIG + i * 4);
+ }
+ static void gic_cpu_restore(unsigned int gic_nr)
+ {
+       int i;
+       u32 *ptr;
+       void __iomem *dist_base;
+       void __iomem *cpu_base;
+       if (gic_nr >= MAX_GIC_NR)
+               BUG();
+       dist_base = gic_data[gic_nr].dist_base;
+       cpu_base = gic_data[gic_nr].cpu_base;
+       if (!dist_base || !cpu_base)
+               return;
+       ptr = __this_cpu_ptr(gic_data[gic_nr].saved_ppi_enable);
+       for (i = 0; i < DIV_ROUND_UP(32, 32); i++)
+               writel_relaxed(ptr[i], dist_base + GIC_DIST_ENABLE_SET + i * 4);
+       ptr = __this_cpu_ptr(gic_data[gic_nr].saved_ppi_conf);
+       for (i = 0; i < DIV_ROUND_UP(32, 16); i++)
+               writel_relaxed(ptr[i], dist_base + GIC_DIST_CONFIG + i * 4);
+       for (i = 0; i < DIV_ROUND_UP(32, 4); i++)
+               writel_relaxed(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4);
+       writel_relaxed(0xf0, cpu_base + GIC_CPU_PRIMASK);
+       writel_relaxed(1, cpu_base + GIC_CPU_CTRL);
+ }
+ static int gic_notifier(struct notifier_block *self, unsigned long cmd,       void *v)
+ {
+       int i;
+       for (i = 0; i < MAX_GIC_NR; i++) {
+               switch (cmd) {
+               case CPU_PM_ENTER:
+                       gic_cpu_save(i);
+                       break;
+               case CPU_PM_ENTER_FAILED:
+               case CPU_PM_EXIT:
+                       gic_cpu_restore(i);
+                       break;
+               case CPU_CLUSTER_PM_ENTER:
+                       gic_dist_save(i);
+                       break;
+               case CPU_CLUSTER_PM_ENTER_FAILED:
+               case CPU_CLUSTER_PM_EXIT:
+                       gic_dist_restore(i);
+                       break;
+               }
+       }
+       return NOTIFY_OK;
+ }
+ static struct notifier_block gic_notifier_block = {
+       .notifier_call = gic_notifier,
+ };
+ static void __init gic_pm_init(struct gic_chip_data *gic)
+ {
+       gic->saved_ppi_enable = __alloc_percpu(DIV_ROUND_UP(32, 32) * 4,
+               sizeof(u32));
+       BUG_ON(!gic->saved_ppi_enable);
+       gic->saved_ppi_conf = __alloc_percpu(DIV_ROUND_UP(32, 16) * 4,
+               sizeof(u32));
+       BUG_ON(!gic->saved_ppi_conf);
+       cpu_pm_register_notifier(&gic_notifier_block);
+ }
+ #else
+ static void __init gic_pm_init(struct gic_chip_data *gic)
+ {
+ }
+ #endif
  void __init gic_init(unsigned int gic_nr, unsigned int irq_start,
        void __iomem *dist_base, void __iomem *cpu_base)
  {
        if (gic_nr == 0)
                gic_cpu_base_addr = cpu_base;
  
+       gic_chip.flags |= gic_arch_extn.flags;
        gic_dist_init(gic, irq_start);
        gic_cpu_init(gic);
+       gic_pm_init(gic);
  }
  
  void __cpuinit gic_secondary_init(unsigned int gic_nr)
        gic_cpu_init(&gic_data[gic_nr]);
  }
  
- void __cpuinit gic_enable_ppi(unsigned int irq)
- {
-       unsigned long flags;
-       local_irq_save(flags);
-       irq_set_status_flags(irq, IRQ_NOPROBE);
-       gic_unmask_irq(irq_get_irq_data(irq));
-       local_irq_restore(flags);
- }
  #ifdef CONFIG_SMP
  void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
  {
@@@ -32,7 -32,7 +32,7 @@@ static inline unsigned long dma_to_pfn(
  
  static inline void *dma_to_virt(struct device *dev, dma_addr_t addr)
  {
 -      return (void *)__bus_to_virt(addr);
 +      return (void *)__bus_to_virt((unsigned long)addr);
  }
  
  static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
@@@ -205,6 -205,13 +205,13 @@@ extern void *dma_alloc_writecombine(str
  int dma_mmap_writecombine(struct device *, struct vm_area_struct *,
                void *, dma_addr_t, size_t);
  
+ /*
+  * This can be called during boot to increase the size of the consistent
+  * DMA region above it's default value of 2MB. It must be called before the
+  * memory allocator is initialised, i.e. before any core_initcall.
+  */
+ extern void __init init_consistent_dma_size(unsigned long size);
  
  #ifdef CONFIG_DMABOUNCE
  /*
@@@ -10,7 -10,7 +10,8 @@@
  #ifndef __ASM_ARM_LOCALTIMER_H
  #define __ASM_ARM_LOCALTIMER_H
  
 +#include <linux/errno.h>
+ #include <linux/interrupt.h>
  
  struct clock_event_device;
  
   */
  void percpu_timer_setup(void);
  
- /*
-  * Called from assembly, this is the local timer IRQ handler
-  */
- asmlinkage void do_local_timer(struct pt_regs *);
- /*
-  * Called from C code
-  */
- void handle_local_timer(struct pt_regs *);
  #ifdef CONFIG_LOCAL_TIMERS
  
  #ifdef CONFIG_HAVE_ARM_TWD
  
  #include "smp_twd.h"
  
- #define local_timer_ack()     twd_timer_ack()
+ #define local_timer_stop(c)   twd_timer_stop((c))
  
  #else
  
  /*
-  * Platform provides this to acknowledge a local timer IRQ.
-  * Returns true if the local timer IRQ is to be processed.
+  * Stop the local timer
   */
int local_timer_ack(void);
void local_timer_stop(struct clock_event_device *);
  
  #endif
  
@@@ -58,6 -47,10 +48,10 @@@ static inline int local_timer_setup(str
  {
        return -ENXIO;
  }
+ static inline void local_timer_stop(struct clock_event_device *evt)
+ {
+ }
  #endif
  
  #endif
@@@ -17,7 -17,7 +17,7 @@@ struct sys_timer
  struct machine_desc {
        unsigned int            nr;             /* architecture number  */
        const char              *name;          /* architecture name    */
-       unsigned long           boot_params;    /* tagged list          */
+       unsigned long           atag_offset;    /* tagged list (relative) */
        const char              **dt_compat;    /* array of device tree
                                                 * 'compatible' strings */
  
@@@ -34,7 -34,8 +34,7 @@@
        unsigned int            reserve_lp1 :1; /* never has lp1        */
        unsigned int            reserve_lp2 :1; /* never has lp2        */
        unsigned int            soft_reboot :1; /* soft reboot          */
 -      void                    (*fixup)(struct machine_desc *,
 -                                       struct tag *, char **,
 +      void                    (*fixup)(struct tag *, char **,
                                         struct meminfo *);
        void                    (*reserve)(void);/* reserve mem blocks  */
        void                    (*map_io)(void);/* IO mapping function  */
@@@ -24,8 -24,6 +24,8 @@@
  #include <mach/vmalloc.h>
  #include <asm/pgtable-hwdef.h>
  
 +#include <asm/pgtable-2level.h>
 +
  /*
   * Just any arbitrary offset to the start of the vmalloc VM area: the
   * current 8MB value just means that there will be a 8MB "hole" after the
  #define VMALLOC_START         (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
  #endif
  
 -/*
 - * Hardware-wise, we have a two level page table structure, where the first
 - * level has 4096 entries, and the second level has 256 entries.  Each entry
 - * is one 32-bit word.  Most of the bits in the second level entry are used
 - * by hardware, and there aren't any "accessed" and "dirty" bits.
 - *
 - * Linux on the other hand has a three level page table structure, which can
 - * be wrapped to fit a two level page table structure easily - using the PGD
 - * and PTE only.  However, Linux also expects one "PTE" table per page, and
 - * at least a "dirty" bit.
 - *
 - * Therefore, we tweak the implementation slightly - we tell Linux that we
 - * have 2048 entries in the first level, each of which is 8 bytes (iow, two
 - * hardware pointers to the second level.)  The second level contains two
 - * hardware PTE tables arranged contiguously, preceded by Linux versions
 - * which contain the state information Linux needs.  We, therefore, end up
 - * with 512 entries in the "PTE" level.
 - *
 - * This leads to the page tables having the following layout:
 - *
 - *    pgd             pte
 - * |        |
 - * +--------+
 - * |        |       +------------+ +0
 - * +- - - - +       | Linux pt 0 |
 - * |        |       +------------+ +1024
 - * +--------+ +0    | Linux pt 1 |
 - * |        |-----> +------------+ +2048
 - * +- - - - + +4    |  h/w pt 0  |
 - * |        |-----> +------------+ +3072
 - * +--------+ +8    |  h/w pt 1  |
 - * |        |       +------------+ +4096
 - *
 - * See L_PTE_xxx below for definitions of bits in the "Linux pt", and
 - * PTE_xxx for definitions of bits appearing in the "h/w pt".
 - *
 - * PMD_xxx definitions refer to bits in the first level page table.
 - *
 - * The "dirty" bit is emulated by only granting hardware write permission
 - * iff the page is marked "writable" and "dirty" in the Linux PTE.  This
 - * means that a write to a clean page will cause a permission fault, and
 - * the Linux MM layer will mark the page dirty via handle_pte_fault().
 - * For the hardware to notice the permission change, the TLB entry must
 - * be flushed, and ptep_set_access_flags() does that for us.
 - *
 - * The "accessed" or "young" bit is emulated by a similar method; we only
 - * allow accesses to the page if the "young" bit is set.  Accesses to the
 - * page will cause a fault, and handle_pte_fault() will set the young bit
 - * for us as long as the page is marked present in the corresponding Linux
 - * PTE entry.  Again, ptep_set_access_flags() will ensure that the TLB is
 - * up to date.
 - *
 - * However, when the "young" bit is cleared, we deny access to the page
 - * by clearing the hardware PTE.  Currently Linux does not flush the TLB
 - * for us in this case, which means the TLB will retain the transation
 - * until either the TLB entry is evicted under pressure, or a context
 - * switch which changes the user space mapping occurs.
 - */
 -#define PTRS_PER_PTE          512
 -#define PTRS_PER_PMD          1
 -#define PTRS_PER_PGD          2048
 -
 -#define PTE_HWTABLE_PTRS      (PTRS_PER_PTE)
 -#define PTE_HWTABLE_OFF               (PTE_HWTABLE_PTRS * sizeof(pte_t))
 -#define PTE_HWTABLE_SIZE      (PTRS_PER_PTE * sizeof(u32))
 -
 -/*
 - * PMD_SHIFT determines the size of the area a second-level page table can map
 - * PGDIR_SHIFT determines what a third-level page table entry can map
 - */
 -#define PMD_SHIFT             21
 -#define PGDIR_SHIFT           21
 -
  #define LIBRARY_TEXT_START    0x0c000000
  
  #ifndef __ASSEMBLY__
@@@ -53,6 -124,12 +53,6 @@@ extern void __pgd_error(const char *fil
  #define pte_ERROR(pte)                __pte_error(__FILE__, __LINE__, pte)
  #define pmd_ERROR(pmd)                __pmd_error(__FILE__, __LINE__, pmd)
  #define pgd_ERROR(pgd)                __pgd_error(__FILE__, __LINE__, pgd)
 -#endif /* !__ASSEMBLY__ */
 -
 -#define PMD_SIZE              (1UL << PMD_SHIFT)
 -#define PMD_MASK              (~(PMD_SIZE-1))
 -#define PGDIR_SIZE            (1UL << PGDIR_SHIFT)
 -#define PGDIR_MASK            (~(PGDIR_SIZE-1))
  
  /*
   * This is the lowest virtual address we can permit any user space
   */
  #define FIRST_USER_ADDRESS    PAGE_SIZE
  
 -#define USER_PTRS_PER_PGD     (TASK_SIZE / PGDIR_SIZE)
 -
 -/*
 - * section address mask and size definitions.
 - */
 -#define SECTION_SHIFT         20
 -#define SECTION_SIZE          (1UL << SECTION_SHIFT)
 -#define SECTION_MASK          (~(SECTION_SIZE-1))
 -
 -/*
 - * ARMv6 supersection address mask and size definitions.
 - */
 -#define SUPERSECTION_SHIFT    24
 -#define SUPERSECTION_SIZE     (1UL << SUPERSECTION_SHIFT)
 -#define SUPERSECTION_MASK     (~(SUPERSECTION_SIZE-1))
 -
 -/*
 - * "Linux" PTE definitions.
 - *
 - * We keep two sets of PTEs - the hardware and the linux version.
 - * This allows greater flexibility in the way we map the Linux bits
 - * onto the hardware tables, and allows us to have YOUNG and DIRTY
 - * bits.
 - *
 - * The PTE table pointer refers to the hardware entries; the "Linux"
 - * entries are stored 1024 bytes below.
 - */
 -#define L_PTE_PRESENT         (_AT(pteval_t, 1) << 0)
 -#define L_PTE_YOUNG           (_AT(pteval_t, 1) << 1)
 -#define L_PTE_FILE            (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
 -#define L_PTE_DIRTY           (_AT(pteval_t, 1) << 6)
 -#define L_PTE_RDONLY          (_AT(pteval_t, 1) << 7)
 -#define L_PTE_USER            (_AT(pteval_t, 1) << 8)
 -#define L_PTE_XN              (_AT(pteval_t, 1) << 9)
 -#define L_PTE_SHARED          (_AT(pteval_t, 1) << 10)        /* shared(v6), coherent(xsc3) */
 -
 -/*
 - * These are the memory types, defined to be compatible with
 - * pre-ARMv6 CPUs cacheable and bufferable bits:   XXCB
 - */
 -#define L_PTE_MT_UNCACHED     (_AT(pteval_t, 0x00) << 2)      /* 0000 */
 -#define L_PTE_MT_BUFFERABLE   (_AT(pteval_t, 0x01) << 2)      /* 0001 */
 -#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2)      /* 0010 */
 -#define L_PTE_MT_WRITEBACK    (_AT(pteval_t, 0x03) << 2)      /* 0011 */
 -#define L_PTE_MT_MINICACHE    (_AT(pteval_t, 0x06) << 2)      /* 0110 (sa1100, xscale) */
 -#define L_PTE_MT_WRITEALLOC   (_AT(pteval_t, 0x07) << 2)      /* 0111 */
 -#define L_PTE_MT_DEV_SHARED   (_AT(pteval_t, 0x04) << 2)      /* 0100 */
 -#define L_PTE_MT_DEV_NONSHARED        (_AT(pteval_t, 0x0c) << 2)      /* 1100 */
 -#define L_PTE_MT_DEV_WC               (_AT(pteval_t, 0x09) << 2)      /* 1001 */
 -#define L_PTE_MT_DEV_CACHED   (_AT(pteval_t, 0x0b) << 2)      /* 1011 */
 -#define L_PTE_MT_MASK         (_AT(pteval_t, 0x0f) << 2)
 -
 -#ifndef __ASSEMBLY__
 -
  /*
   * The pgprot_* and protection_map entries will be fixed up in runtime
   * to include the cachable and bufferable bits based on memory policy,
@@@ -101,6 -232,9 +101,9 @@@ extern pgprot_t            pgprot_kernel
  #define pgprot_writecombine(prot) \
        __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE)
  
+ #define pgprot_stronglyordered(prot) \
+       __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED)
  #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
  #define pgprot_dmacoherent(prot) \
        __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE | L_PTE_XN)
@@@ -196,10 -330,10 +199,10 @@@ extern pgd_t swapper_pg_dir[PTRS_PER_PG
  
  static inline pte_t *pmd_page_vaddr(pmd_t pmd)
  {
 -      return __va(pmd_val(pmd) & PAGE_MASK);
 +      return __va(pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK);
  }
  
 -#define pmd_page(pmd)         pfn_to_page(__phys_to_pfn(pmd_val(pmd)))
 +#define pmd_page(pmd)         pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
  
  /* we don't need complex calculations here as the pmd is folded into the pgd */
  #define pmd_addr_end(addr,end)        (end)
  #define pte_offset_map(pmd,addr)      (__pte_map(pmd) + pte_index(addr))
  #define pte_unmap(pte)                        __pte_unmap(pte)
  
 -#define pte_pfn(pte)          (pte_val(pte) >> PAGE_SHIFT)
 +#define pte_pfn(pte)          ((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
  #define pfn_pte(pfn,prot)     __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
  
  #define pte_page(pte)         pfn_to_page(pte_pfn(pte))
diff --combined arch/arm/kernel/Makefile
@@@ -29,7 -29,7 +29,7 @@@ obj-$(CONFIG_MODULES)         += armksyms.o mo
  obj-$(CONFIG_ARTHUR)          += arthur.o
  obj-$(CONFIG_ISA_DMA)         += dma-isa.o
  obj-$(CONFIG_PCI)             += bios32.o isa.o
- obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o
 -obj-$(CONFIG_PM_SLEEP)                += sleep.o suspend.o
++obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
  obj-$(CONFIG_HAVE_SCHED_CLOCK)        += sched_clock.o
  obj-$(CONFIG_SMP)             += smp.o smp_tlb.o
  obj-$(CONFIG_HAVE_ARM_SCU)    += smp_scu.o
@@@ -43,6 -43,13 +43,13 @@@ obj-$(CONFIG_KPROBES)               += kprobes-thumb
  else
  obj-$(CONFIG_KPROBES)         += kprobes-arm.o
  endif
+ obj-$(CONFIG_ARM_KPROBES_TEST)        += test-kprobes.o
+ test-kprobes-objs             := kprobes-test.o
+ ifdef CONFIG_THUMB2_KERNEL
+ test-kprobes-objs             += kprobes-test-thumb.o
+ else
+ test-kprobes-objs             += kprobes-test-arm.o
+ endif
  obj-$(CONFIG_ATAGS_PROC)      += atags.o
  obj-$(CONFIG_OABI_COMPAT)     += sys_oabi-compat.o
  obj-$(CONFIG_ARM_THUMBEE)     += thumbee.o
diff --combined arch/arm/kernel/debug.S
@@@ -22,7 -22,7 +22,7 @@@
  #if defined(CONFIG_DEBUG_ICEDCC)
                @@ debug using ARM EmbeddedICE DCC channel
  
-               .macro  addruart, rp, rv
+               .macro  addruart, rp, rv, tmp
                .endm
  
  #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
  
  #ifdef CONFIG_MMU
                .macro  addruart_current, rx, tmp1, tmp2
-               addruart        \tmp1, \tmp2
+               addruart        \tmp1, \tmp2, \rx
                mrc             p15, 0, \rx, c1, c0
                tst             \rx, #1
                moveq           \rx, \tmp1
@@@ -151,8 -151,6 +151,8 @@@ printhex:  adr     r2, hexbu
                b       printascii
  ENDPROC(printhex2)
  
 +hexbuf:               .space 16
 +
                .ltorg
  
  ENTRY(printascii)
@@@ -177,3 -175,5 +177,3 @@@ ENTRY(printch
                mov     r0, #0
                b       1b
  ENDPROC(printch)
 -
 -hexbuf:               .space 16
diff --combined arch/arm/kernel/head.S
@@@ -21,7 -21,6 +21,7 @@@
  #include <asm/memory.h>
  #include <asm/thread_info.h>
  #include <asm/system.h>
 +#include <asm/pgtable.h>
  
  #ifdef CONFIG_DEBUG_LL
  #include <mach/debug-macro.S>
  #error KERNEL_RAM_VADDR must start at 0xXXXX8000
  #endif
  
 +#define PG_DIR_SIZE   0x4000
 +#define PMD_ORDER     2
 +
        .globl  swapper_pg_dir
 -      .equ    swapper_pg_dir, KERNEL_RAM_VADDR - 0x4000
 +      .equ    swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE
  
        .macro  pgtbl, rd, phys
 -      add     \rd, \phys, #TEXT_OFFSET - 0x4000
 +      add     \rd, \phys, #TEXT_OFFSET - PG_DIR_SIZE
        .endm
  
  #ifdef CONFIG_XIP_KERNEL
@@@ -99,7 -95,7 +99,7 @@@ ENTRY(stext
        sub     r4, r3, r4                      @ (PHYS_OFFSET - PAGE_OFFSET)
        add     r8, r8, r4                      @ PHYS_OFFSET
  #else
-       ldr     r8, =PLAT_PHYS_OFFSET
+       ldr     r8, =PHYS_OFFSET                @ always constant in this case
  #endif
  
        /*
@@@ -152,11 -148,11 +152,11 @@@ __create_page_tables
        pgtbl   r4, r8                          @ page table address
  
        /*
 -       * Clear the 16K level 1 swapper page table
 +       * Clear the swapper page table
         */
        mov     r0, r4
        mov     r3, #0
 -      add     r6, r0, #0x4000
 +      add     r6, r0, #PG_DIR_SIZE
  1:    str     r3, [r0], #4
        str     r3, [r0], #4
        str     r3, [r0], #4
        sub     r0, r0, r3                      @ virt->phys offset
        add     r5, r5, r0                      @ phys __enable_mmu
        add     r6, r6, r0                      @ phys __enable_mmu_end
 -      mov     r5, r5, lsr #20
 -      mov     r6, r6, lsr #20
 +      mov     r5, r5, lsr #SECTION_SHIFT
 +      mov     r6, r6, lsr #SECTION_SHIFT
  
 -1:    orr     r3, r7, r5, lsl #20             @ flags + kernel base
 -      str     r3, [r4, r5, lsl #2]            @ identity mapping
 -      teq     r5, r6
 -      addne   r5, r5, #1                      @ next section
 -      bne     1b
 +1:    orr     r3, r7, r5, lsl #SECTION_SHIFT  @ flags + kernel base
 +      str     r3, [r4, r5, lsl #PMD_ORDER]    @ identity mapping
 +      cmp     r5, r6
 +      addlo   r5, r5, #1                      @ next section
 +      blo     1b
  
        /*
         * Now setup the pagetables for our kernel direct
         * mapped region.
         */
        mov     r3, pc
 -      mov     r3, r3, lsr #20
 -      orr     r3, r7, r3, lsl #20
 -      add     r0, r4,  #(KERNEL_START & 0xff000000) >> 18
 -      str     r3, [r0, #(KERNEL_START & 0x00f00000) >> 18]!
 +      mov     r3, r3, lsr #SECTION_SHIFT
 +      orr     r3, r7, r3, lsl #SECTION_SHIFT
 +      add     r0, r4,  #(KERNEL_START & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
 +      str     r3, [r0, #((KERNEL_START & 0x00f00000) >> SECTION_SHIFT) << PMD_ORDER]!
        ldr     r6, =(KERNEL_END - 1)
 -      add     r0, r0, #4
 -      add     r6, r4, r6, lsr #18
 +      add     r0, r0, #1 << PMD_ORDER
 +      add     r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
  1:    cmp     r0, r6
 -      add     r3, r3, #1 << 20
 -      strls   r3, [r0], #4
 +      add     r3, r3, #1 << SECTION_SHIFT
 +      strls   r3, [r0], #1 << PMD_ORDER
        bls     1b
  
  #ifdef CONFIG_XIP_KERNEL
         */
        add     r3, r8, #TEXT_OFFSET
        orr     r3, r3, r7
 -      add     r0, r4,  #(KERNEL_RAM_VADDR & 0xff000000) >> 18
 -      str     r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> 18]!
 +      add     r0, r4,  #(KERNEL_RAM_VADDR & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
 +      str     r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> (SECTION_SHIFT - PMD_ORDER)]!
        ldr     r6, =(_end - 1)
        add     r0, r0, #4
 -      add     r6, r4, r6, lsr #18
 +      add     r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
  1:    cmp     r0, r6
        add     r3, r3, #1 << 20
        strls   r3, [r0], #4
         * Then map boot params address in r2 or
         * the first 1MB of ram if boot params address is not specified.
         */
 -      mov     r0, r2, lsr #20
 -      movs    r0, r0, lsl #20
 +      mov     r0, r2, lsr #SECTION_SHIFT
 +      movs    r0, r0, lsl #SECTION_SHIFT
        moveq   r0, r8
        sub     r3, r0, r8
        add     r3, r3, #PAGE_OFFSET
 -      add     r3, r4, r3, lsr #18
 +      add     r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER)
        orr     r6, r7, r0
        str     r6, [r3]
  
         * This allows debug messages to be output
         * via a serial console before paging_init.
         */
-       addruart r7, r3
+       addruart r7, r3, r0
  
 -      mov     r3, r3, lsr #20
 -      mov     r3, r3, lsl #2
 +      mov     r3, r3, lsr #SECTION_SHIFT
 +      mov     r3, r3, lsl #PMD_ORDER
  
        add     r0, r4, r3
        rsb     r3, r3, #0x4000                 @ PTRS_PER_PGD*sizeof(long)
        cmp     r3, #0x0800                     @ limit to 512MB
        movhi   r3, #0x0800
        add     r6, r0, r3
 -      mov     r3, r7, lsr #20
 +      mov     r3, r7, lsr #SECTION_SHIFT
        ldr     r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
 -      orr     r3, r7, r3, lsl #20
 +      orr     r3, r7, r3, lsl #SECTION_SHIFT
  1:    str     r3, [r0], #4
 -      add     r3, r3, #1 << 20
 -      teq     r0, r6
 -      bne     1b
 +      add     r3, r3, #1 << SECTION_SHIFT
 +      cmp     r0, r6
 +      blo     1b
  
  #else /* CONFIG_DEBUG_ICEDCC */
        /* we don't need any serial debugging mappings for ICEDCC */
         * If we're using the NetWinder or CATS, we also need to map
         * in the 16550-type serial port for the debug messages
         */
 -      add     r0, r4, #0xff000000 >> 18
 +      add     r0, r4, #0xff000000 >> (SECTION_SHIFT - PMD_ORDER)
        orr     r3, r7, #0x7c000000
        str     r3, [r0]
  #endif
         * Similar reasons here - for debug.  This is
         * only for Acorn RiscPC architectures.
         */
 -      add     r0, r4, #0x02000000 >> 18
 +      add     r0, r4, #0x02000000 >> (SECTION_SHIFT - PMD_ORDER)
        orr     r3, r7, #0x02000000
        str     r3, [r0]
 -      add     r0, r4, #0xd8000000 >> 18
 +      add     r0, r4, #0xd8000000 >> (SECTION_SHIFT - PMD_ORDER)
        str     r3, [r0]
  #endif
  #endif
@@@ -17,6 -17,9 +17,9 @@@
   */
  
  #ifdef CONFIG_CPU_V7
+ static struct arm_pmu armv7pmu;
  /*
   * Common ARMv7 event types
   *
@@@ -321,8 -324,8 +324,8 @@@ static const unsigned armv7_a9_perf_map
        [PERF_COUNT_HW_CPU_CYCLES]          = ARMV7_PERFCTR_CPU_CYCLES,
        [PERF_COUNT_HW_INSTRUCTIONS]        =
                                        ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE,
 -      [PERF_COUNT_HW_CACHE_REFERENCES]    = ARMV7_PERFCTR_COHERENT_LINE_HIT,
 -      [PERF_COUNT_HW_CACHE_MISSES]        = ARMV7_PERFCTR_COHERENT_LINE_MISS,
 +      [PERF_COUNT_HW_CACHE_REFERENCES]    = ARMV7_PERFCTR_DCACHE_ACCESS,
 +      [PERF_COUNT_HW_CACHE_MISSES]        = ARMV7_PERFCTR_DCACHE_REFILL,
        [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
        [PERF_COUNT_HW_BRANCH_MISSES]       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
        [PERF_COUNT_HW_BUS_CYCLES]          = ARMV7_PERFCTR_CLOCK_CYCLES,
@@@ -676,23 -679,24 +679,24 @@@ static const unsigned armv7_a15_perf_ca
  };
  
  /*
-  * Perf Events counters
+  * Perf Events' indices
   */
- enum armv7_counters {
-       ARMV7_CYCLE_COUNTER             = 1,    /* Cycle counter */
-       ARMV7_COUNTER0                  = 2,    /* First event counter */
- };
+ #define       ARMV7_IDX_CYCLE_COUNTER 0
+ #define       ARMV7_IDX_COUNTER0      1
+ #define       ARMV7_IDX_COUNTER_LAST  (ARMV7_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1)
+ #define       ARMV7_MAX_COUNTERS      32
+ #define       ARMV7_COUNTER_MASK      (ARMV7_MAX_COUNTERS - 1)
  
  /*
-  * The cycle counter is ARMV7_CYCLE_COUNTER.
-  * The first event counter is ARMV7_COUNTER0.
-  * The last event counter is (ARMV7_COUNTER0 + armpmu->num_events - 1).
+  * ARMv7 low level PMNC access
   */
- #define       ARMV7_COUNTER_LAST      (ARMV7_COUNTER0 + armpmu->num_events - 1)
  
  /*
-  * ARMv7 low level PMNC access
+  * Perf Event to low level counters mapping
   */
+ #define       ARMV7_IDX_TO_COUNTER(x) \
+       (((x) - ARMV7_IDX_COUNTER0) & ARMV7_COUNTER_MASK)
  
  /*
   * Per-CPU PMNC: config reg
  #define       ARMV7_PMNC_MASK         0x3f     /* Mask for writable bits */
  
  /*
-  * Available counters
-  */
- #define ARMV7_CNT0            0       /* First event counter */
- #define ARMV7_CCNT            31      /* Cycle counter */
- /* Perf Event to low level counters mapping */
- #define ARMV7_EVENT_CNT_TO_CNTx       (ARMV7_COUNTER0 - ARMV7_CNT0)
- /*
-  * CNTENS: counters enable reg
-  */
- #define ARMV7_CNTENS_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_CNTENS_C                (1 << ARMV7_CCNT)
- /*
-  * CNTENC: counters disable reg
-  */
- #define ARMV7_CNTENC_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_CNTENC_C                (1 << ARMV7_CCNT)
- /*
-  * INTENS: counters overflow interrupt enable reg
-  */
- #define ARMV7_INTENS_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_INTENS_C                (1 << ARMV7_CCNT)
- /*
-  * INTENC: counters overflow interrupt disable reg
-  */
- #define ARMV7_INTENC_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_INTENC_C                (1 << ARMV7_CCNT)
- /*
-  * EVTSEL: Event selection reg
+  * FLAG: counters overflow flag status reg
   */
- #define       ARMV7_EVTSEL_MASK       0xff            /* Mask for writable bits */
+ #define       ARMV7_FLAG_MASK         0xffffffff      /* Mask for writable bits */
+ #define       ARMV7_OVERFLOWED_MASK   ARMV7_FLAG_MASK
  
  /*
-  * SELECT: Counter selection reg
+  * PMXEVTYPER: Event selection reg
   */
- #define       ARMV7_SELECT_MASK       0x1f            /* Mask for writable bits */
+ #define       ARMV7_EVTYPE_MASK       0xc00000ff      /* Mask for writable bits */
+ #define       ARMV7_EVTYPE_EVENT      0xff            /* Mask for EVENT bits */
  
  /*
-  * FLAG: counters overflow flag status reg
+  * Event filters for PMUv2
   */
- #define ARMV7_FLAG_P(idx)     (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_FLAG_C          (1 << ARMV7_CCNT)
- #define       ARMV7_FLAG_MASK         0xffffffff      /* Mask for writable bits */
- #define       ARMV7_OVERFLOWED_MASK   ARMV7_FLAG_MASK
+ #define       ARMV7_EXCLUDE_PL1       (1 << 31)
+ #define       ARMV7_EXCLUDE_USER      (1 << 30)
+ #define       ARMV7_INCLUDE_HYP       (1 << 27)
  
- static inline unsigned long armv7_pmnc_read(void)
+ static inline u32 armv7_pmnc_read(void)
  {
        u32 val;
        asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r"(val));
        return val;
  }
  
- static inline void armv7_pmnc_write(unsigned long val)
+ static inline void armv7_pmnc_write(u32 val)
  {
        val &= ARMV7_PMNC_MASK;
        isb();
        asm volatile("mcr p15, 0, %0, c9, c12, 0" : : "r"(val));
  }
  
- static inline int armv7_pmnc_has_overflowed(unsigned long pmnc)
+ static inline int armv7_pmnc_has_overflowed(u32 pmnc)
  {
        return pmnc & ARMV7_OVERFLOWED_MASK;
  }
  
- static inline int armv7_pmnc_counter_has_overflowed(unsigned long pmnc,
-                                       enum armv7_counters counter)
+ static inline int armv7_pmnc_counter_valid(int idx)
+ {
+       return idx >= ARMV7_IDX_CYCLE_COUNTER && idx <= ARMV7_IDX_COUNTER_LAST;
+ }
+ static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx)
  {
        int ret = 0;
+       u32 counter;
  
-       if (counter == ARMV7_CYCLE_COUNTER)
-               ret = pmnc & ARMV7_FLAG_C;
-       else if ((counter >= ARMV7_COUNTER0) && (counter <= ARMV7_COUNTER_LAST))
-               ret = pmnc & ARMV7_FLAG_P(counter);
-       else
+       if (!armv7_pmnc_counter_valid(idx)) {
                pr_err("CPU%u checking wrong counter %d overflow status\n",
-                       smp_processor_id(), counter);
+                       smp_processor_id(), idx);
+       } else {
+               counter = ARMV7_IDX_TO_COUNTER(idx);
+               ret = pmnc & BIT(counter);
+       }
  
        return ret;
  }
  
- static inline int armv7_pmnc_select_counter(unsigned int idx)
+ static inline int armv7_pmnc_select_counter(int idx)
  {
-       u32 val;
+       u32 counter;
  
-       if ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST)) {
-               pr_err("CPU%u selecting wrong PMNC counter"
-                       " %d\n", smp_processor_id(), idx);
-               return -1;
+       if (!armv7_pmnc_counter_valid(idx)) {
+               pr_err("CPU%u selecting wrong PMNC counter %d\n",
+                       smp_processor_id(), idx);
+               return -EINVAL;
        }
  
-       val = (idx - ARMV7_EVENT_CNT_TO_CNTx) & ARMV7_SELECT_MASK;
-       asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (val));
+       counter = ARMV7_IDX_TO_COUNTER(idx);
+       asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter));
        isb();
  
        return idx;
  
  static inline u32 armv7pmu_read_counter(int idx)
  {
-       unsigned long value = 0;
+       u32 value = 0;
  
-       if (idx == ARMV7_CYCLE_COUNTER)
-               asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value));
-       else if ((idx >= ARMV7_COUNTER0) && (idx <= ARMV7_COUNTER_LAST)) {
-               if (armv7_pmnc_select_counter(idx) == idx)
-                       asm volatile("mrc p15, 0, %0, c9, c13, 2"
-                                    : "=r" (value));
-       } else
+       if (!armv7_pmnc_counter_valid(idx))
                pr_err("CPU%u reading wrong counter %d\n",
                        smp_processor_id(), idx);
+       else if (idx == ARMV7_IDX_CYCLE_COUNTER)
+               asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value));
+       else if (armv7_pmnc_select_counter(idx) == idx)
+               asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (value));
  
        return value;
  }
  
  static inline void armv7pmu_write_counter(int idx, u32 value)
  {
-       if (idx == ARMV7_CYCLE_COUNTER)
-               asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (value));
-       else if ((idx >= ARMV7_COUNTER0) && (idx <= ARMV7_COUNTER_LAST)) {
-               if (armv7_pmnc_select_counter(idx) == idx)
-                       asm volatile("mcr p15, 0, %0, c9, c13, 2"
-                                    : : "r" (value));
-       } else
+       if (!armv7_pmnc_counter_valid(idx))
                pr_err("CPU%u writing wrong counter %d\n",
                        smp_processor_id(), idx);
+       else if (idx == ARMV7_IDX_CYCLE_COUNTER)
+               asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (value));
+       else if (armv7_pmnc_select_counter(idx) == idx)
+               asm volatile("mcr p15, 0, %0, c9, c13, 2" : : "r" (value));
  }
  
- static inline void armv7_pmnc_write_evtsel(unsigned int idx, u32 val)
+ static inline void armv7_pmnc_write_evtsel(int idx, u32 val)
  {
        if (armv7_pmnc_select_counter(idx) == idx) {
-               val &= ARMV7_EVTSEL_MASK;
+               val &= ARMV7_EVTYPE_MASK;
                asm volatile("mcr p15, 0, %0, c9, c13, 1" : : "r" (val));
        }
  }
  
- static inline u32 armv7_pmnc_enable_counter(unsigned int idx)
+ static inline int armv7_pmnc_enable_counter(int idx)
  {
-       u32 val;
+       u32 counter;
  
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u enabling wrong PMNC counter"
-                       " %d\n", smp_processor_id(), idx);
-               return -1;
+       if (!armv7_pmnc_counter_valid(idx)) {
+               pr_err("CPU%u enabling wrong PMNC counter %d\n",
+                       smp_processor_id(), idx);
+               return -EINVAL;
        }
  
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_CNTENS_C;
-       else
-               val = ARMV7_CNTENS_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (val));
+       counter = ARMV7_IDX_TO_COUNTER(idx);
+       asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter)));
        return idx;
  }
  
- static inline u32 armv7_pmnc_disable_counter(unsigned int idx)
+ static inline int armv7_pmnc_disable_counter(int idx)
  {
-       u32 val;
+       u32 counter;
  
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u disabling wrong PMNC counter"
-                       " %d\n", smp_processor_id(), idx);
-               return -1;
+       if (!armv7_pmnc_counter_valid(idx)) {
+               pr_err("CPU%u disabling wrong PMNC counter %d\n",
+                       smp_processor_id(), idx);
+               return -EINVAL;
        }
  
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_CNTENC_C;
-       else
-               val = ARMV7_CNTENC_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (val));
+       counter = ARMV7_IDX_TO_COUNTER(idx);
+       asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter)));
        return idx;
  }
  
- static inline u32 armv7_pmnc_enable_intens(unsigned int idx)
+ static inline int armv7_pmnc_enable_intens(int idx)
  {
-       u32 val;
+       u32 counter;
  
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u enabling wrong PMNC counter"
-                       " interrupt enable %d\n", smp_processor_id(), idx);
-               return -1;
+       if (!armv7_pmnc_counter_valid(idx)) {
+               pr_err("CPU%u enabling wrong PMNC counter IRQ enable %d\n",
+                       smp_processor_id(), idx);
+               return -EINVAL;
        }
  
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_INTENS_C;
-       else
-               val = ARMV7_INTENS_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (val));
+       counter = ARMV7_IDX_TO_COUNTER(idx);
+       asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter)));
        return idx;
  }
  
- static inline u32 armv7_pmnc_disable_intens(unsigned int idx)
+ static inline int armv7_pmnc_disable_intens(int idx)
  {
-       u32 val;
+       u32 counter;
  
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u disabling wrong PMNC counter"
-                       " interrupt enable %d\n", smp_processor_id(), idx);
-               return -1;
+       if (!armv7_pmnc_counter_valid(idx)) {
+               pr_err("CPU%u disabling wrong PMNC counter IRQ enable %d\n",
+                       smp_processor_id(), idx);
+               return -EINVAL;
        }
  
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_INTENC_C;
-       else
-               val = ARMV7_INTENC_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (val));
+       counter = ARMV7_IDX_TO_COUNTER(idx);
+       asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter)));
        return idx;
  }
  
@@@ -973,14 -921,14 +921,14 @@@ static void armv7_pmnc_dump_regs(void
        asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
        printk(KERN_INFO "CCNT  =0x%08x\n", val);
  
-       for (cnt = ARMV7_COUNTER0; cnt < ARMV7_COUNTER_LAST; cnt++) {
+       for (cnt = ARMV7_IDX_COUNTER0; cnt <= ARMV7_IDX_COUNTER_LAST; cnt++) {
                armv7_pmnc_select_counter(cnt);
                asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val));
                printk(KERN_INFO "CNT[%d] count =0x%08x\n",
-                       cnt-ARMV7_EVENT_CNT_TO_CNTx, val);
+                       ARMV7_IDX_TO_COUNTER(cnt), val);
                asm volatile("mrc p15, 0, %0, c9, c13, 1" : "=r" (val));
                printk(KERN_INFO "CNT[%d] evtsel=0x%08x\n",
-                       cnt-ARMV7_EVENT_CNT_TO_CNTx, val);
+                       ARMV7_IDX_TO_COUNTER(cnt), val);
        }
  }
  #endif
  static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
  {
        unsigned long flags;
+       struct pmu_hw_events *events = cpu_pmu->get_hw_events();
  
        /*
         * Enable counter and interrupt, and set the counter to count
         * the event that we're interested in.
         */
-       raw_spin_lock_irqsave(&pmu_lock, flags);
+       raw_spin_lock_irqsave(&events->pmu_lock, flags);
  
        /*
         * Disable counter
  
        /*
         * Set event (if destined for PMNx counters)
-        * We don't need to set the event if it's a cycle count
+        * We only need to set the event for the cycle counter if we
+        * have the ability to perform event filtering.
         */
-       if (idx != ARMV7_CYCLE_COUNTER)
+       if (armv7pmu.set_event_filter || idx != ARMV7_IDX_CYCLE_COUNTER)
                armv7_pmnc_write_evtsel(idx, hwc->config_base);
  
        /*
         */
        armv7_pmnc_enable_counter(idx);
  
-       raw_spin_unlock_irqrestore(&pmu_lock, flags);
+       raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
  }
  
  static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx)
  {
        unsigned long flags;
+       struct pmu_hw_events *events = cpu_pmu->get_hw_events();
  
        /*
         * Disable counter and interrupt
         */
-       raw_spin_lock_irqsave(&pmu_lock, flags);
+       raw_spin_lock_irqsave(&events->pmu_lock, flags);
  
        /*
         * Disable counter
         */
        armv7_pmnc_disable_intens(idx);
  
-       raw_spin_unlock_irqrestore(&pmu_lock, flags);
+       raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
  }
  
  static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
  {
-       unsigned long pmnc;
+       u32 pmnc;
        struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
+       struct pmu_hw_events *cpuc;
        struct pt_regs *regs;
        int idx;
  
        perf_sample_data_init(&data, 0);
  
        cpuc = &__get_cpu_var(cpu_hw_events);
-       for (idx = 0; idx <= armpmu->num_events; ++idx) {
+       for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
                struct perf_event *event = cpuc->events[idx];
                struct hw_perf_event *hwc;
  
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
                /*
                 * We have a single interrupt for all counters. Check that
                 * each counter has overflowed before we process it.
                        continue;
  
                if (perf_event_overflow(event, &data, regs))
-                       armpmu->disable(hwc, idx);
+                       cpu_pmu->disable(hwc, idx);
        }
  
        /*
  static void armv7pmu_start(void)
  {
        unsigned long flags;
+       struct pmu_hw_events *events = cpu_pmu->get_hw_events();
  
-       raw_spin_lock_irqsave(&pmu_lock, flags);
+       raw_spin_lock_irqsave(&events->pmu_lock, flags);
        /* Enable all counters */
        armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E);
-       raw_spin_unlock_irqrestore(&pmu_lock, flags);
+       raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
  }
  
  static void armv7pmu_stop(void)
  {
        unsigned long flags;
+       struct pmu_hw_events *events = cpu_pmu->get_hw_events();
  
-       raw_spin_lock_irqsave(&pmu_lock, flags);
+       raw_spin_lock_irqsave(&events->pmu_lock, flags);
        /* Disable all counters */
        armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E);
-       raw_spin_unlock_irqrestore(&pmu_lock, flags);
+       raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
  }
  
- static int armv7pmu_get_event_idx(struct cpu_hw_events *cpuc,
+ static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc,
                                  struct hw_perf_event *event)
  {
        int idx;
+       unsigned long evtype = event->config_base & ARMV7_EVTYPE_EVENT;
  
        /* Always place a cycle counter into the cycle counter. */
-       if (event->config_base == ARMV7_PERFCTR_CPU_CYCLES) {
-               if (test_and_set_bit(ARMV7_CYCLE_COUNTER, cpuc->used_mask))
+       if (evtype == ARMV7_PERFCTR_CPU_CYCLES) {
+               if (test_and_set_bit(ARMV7_IDX_CYCLE_COUNTER, cpuc->used_mask))
                        return -EAGAIN;
  
-               return ARMV7_CYCLE_COUNTER;
-       } else {
-               /*
-                * For anything other than a cycle counter, try and use
-                * the events counters
-                */
-               for (idx = ARMV7_COUNTER0; idx <= armpmu->num_events; ++idx) {
-                       if (!test_and_set_bit(idx, cpuc->used_mask))
-                               return idx;
-               }
+               return ARMV7_IDX_CYCLE_COUNTER;
+       }
  
-               /* The counters are all in use. */
-               return -EAGAIN;
+       /*
+        * For anything other than a cycle counter, try and use
+        * the events counters
+        */
+       for (idx = ARMV7_IDX_COUNTER0; idx < cpu_pmu->num_events; ++idx) {
+               if (!test_and_set_bit(idx, cpuc->used_mask))
+                       return idx;
        }
+       /* The counters are all in use. */
+       return -EAGAIN;
+ }
+ /*
+  * Add an event filter to a given event. This will only work for PMUv2 PMUs.
+  */
+ static int armv7pmu_set_event_filter(struct hw_perf_event *event,
+                                    struct perf_event_attr *attr)
+ {
+       unsigned long config_base = 0;
+       if (attr->exclude_idle)
+               return -EPERM;
+       if (attr->exclude_user)
+               config_base |= ARMV7_EXCLUDE_USER;
+       if (attr->exclude_kernel)
+               config_base |= ARMV7_EXCLUDE_PL1;
+       if (!attr->exclude_hv)
+               config_base |= ARMV7_INCLUDE_HYP;
+       /*
+        * Install the filter into config_base as this is used to
+        * construct the event type.
+        */
+       event->config_base = config_base;
+       return 0;
  }
  
  static void armv7pmu_reset(void *info)
  {
-       u32 idx, nb_cnt = armpmu->num_events;
+       u32 idx, nb_cnt = cpu_pmu->num_events;
  
        /* The counter and interrupt enable registers are unknown at reset. */
-       for (idx = 1; idx < nb_cnt; ++idx)
+       for (idx = ARMV7_IDX_CYCLE_COUNTER; idx < nb_cnt; ++idx)
                armv7pmu_disable_event(NULL, idx);
  
        /* Initialize & Reset PMNC: C and P bits */
        armv7_pmnc_write(ARMV7_PMNC_P | ARMV7_PMNC_C);
  }
  
+ static int armv7_a8_map_event(struct perf_event *event)
+ {
+       return map_cpu_event(event, &armv7_a8_perf_map,
+                               &armv7_a8_perf_cache_map, 0xFF);
+ }
+ static int armv7_a9_map_event(struct perf_event *event)
+ {
+       return map_cpu_event(event, &armv7_a9_perf_map,
+                               &armv7_a9_perf_cache_map, 0xFF);
+ }
+ static int armv7_a5_map_event(struct perf_event *event)
+ {
+       return map_cpu_event(event, &armv7_a5_perf_map,
+                               &armv7_a5_perf_cache_map, 0xFF);
+ }
+ static int armv7_a15_map_event(struct perf_event *event)
+ {
+       return map_cpu_event(event, &armv7_a15_perf_map,
+                               &armv7_a15_perf_cache_map, 0xFF);
+ }
  static struct arm_pmu armv7pmu = {
        .handle_irq             = armv7pmu_handle_irq,
        .enable                 = armv7pmu_enable_event,
        .start                  = armv7pmu_start,
        .stop                   = armv7pmu_stop,
        .reset                  = armv7pmu_reset,
-       .raw_event_mask         = 0xFF,
        .max_period             = (1LLU << 32) - 1,
  };
  
@@@ -1188,62 -1188,59 +1188,59 @@@ static u32 __init armv7_read_num_pmnc_e
        return nb_cnt + 1;
  }
  
- static const struct arm_pmu *__init armv7_a8_pmu_init(void)
+ static struct arm_pmu *__init armv7_a8_pmu_init(void)
  {
        armv7pmu.id             = ARM_PERF_PMU_ID_CA8;
        armv7pmu.name           = "ARMv7 Cortex-A8";
-       armv7pmu.cache_map      = &armv7_a8_perf_cache_map;
-       armv7pmu.event_map      = &armv7_a8_perf_map;
+       armv7pmu.map_event      = armv7_a8_map_event;
        armv7pmu.num_events     = armv7_read_num_pmnc_events();
        return &armv7pmu;
  }
  
- static const struct arm_pmu *__init armv7_a9_pmu_init(void)
+ static struct arm_pmu *__init armv7_a9_pmu_init(void)
  {
        armv7pmu.id             = ARM_PERF_PMU_ID_CA9;
        armv7pmu.name           = "ARMv7 Cortex-A9";
-       armv7pmu.cache_map      = &armv7_a9_perf_cache_map;
-       armv7pmu.event_map      = &armv7_a9_perf_map;
+       armv7pmu.map_event      = armv7_a9_map_event;
        armv7pmu.num_events     = armv7_read_num_pmnc_events();
        return &armv7pmu;
  }
  
- static const struct arm_pmu *__init armv7_a5_pmu_init(void)
+ static struct arm_pmu *__init armv7_a5_pmu_init(void)
  {
        armv7pmu.id             = ARM_PERF_PMU_ID_CA5;
        armv7pmu.name           = "ARMv7 Cortex-A5";
-       armv7pmu.cache_map      = &armv7_a5_perf_cache_map;
-       armv7pmu.event_map      = &armv7_a5_perf_map;
+       armv7pmu.map_event      = armv7_a5_map_event;
        armv7pmu.num_events     = armv7_read_num_pmnc_events();
        return &armv7pmu;
  }
  
- static const struct arm_pmu *__init armv7_a15_pmu_init(void)
+ static struct arm_pmu *__init armv7_a15_pmu_init(void)
  {
        armv7pmu.id             = ARM_PERF_PMU_ID_CA15;
        armv7pmu.name           = "ARMv7 Cortex-A15";
-       armv7pmu.cache_map      = &armv7_a15_perf_cache_map;
-       armv7pmu.event_map      = &armv7_a15_perf_map;
+       armv7pmu.map_event      = armv7_a15_map_event;
        armv7pmu.num_events     = armv7_read_num_pmnc_events();
+       armv7pmu.set_event_filter = armv7pmu_set_event_filter;
        return &armv7pmu;
  }
  #else
- static const struct arm_pmu *__init armv7_a8_pmu_init(void)
+ static struct arm_pmu *__init armv7_a8_pmu_init(void)
  {
        return NULL;
  }
  
- static const struct arm_pmu *__init armv7_a9_pmu_init(void)
+ static struct arm_pmu *__init armv7_a9_pmu_init(void)
  {
        return NULL;
  }
  
- static const struct arm_pmu *__init armv7_a5_pmu_init(void)
+ static struct arm_pmu *__init armv7_a5_pmu_init(void)
  {
        return NULL;
  }
  
- static const struct arm_pmu *__init armv7_a15_pmu_init(void)
+ static struct arm_pmu *__init armv7_a15_pmu_init(void)
  {
        return NULL;
  }
diff --combined arch/arm/kernel/setup.c
@@@ -29,8 -29,6 +29,8 @@@
  #include <linux/fs.h>
  #include <linux/proc_fs.h>
  #include <linux/memblock.h>
 +#include <linux/bug.h>
 +#include <linux/compiler.h>
  
  #include <asm/unified.h>
  #include <asm/cpu.h>
@@@ -44,7 -42,6 +44,7 @@@
  #include <asm/cacheflush.h>
  #include <asm/cachetype.h>
  #include <asm/tlbflush.h>
 +#include <asm/system.h>
  
  #include <asm/prom.h>
  #include <asm/mach/arch.h>
@@@ -118,13 -115,6 +118,13 @@@ struct outer_cache_fns outer_cache __re
  EXPORT_SYMBOL(outer_cache);
  #endif
  
 +/*
 + * Cached cpu_architecture() result for use by assembler code.
 + * C code should use the cpu_architecture() function instead of accessing this
 + * variable directly.
 + */
 +int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN;
 +
  struct stack {
        u32 irq[3];
        u32 abt[3];
@@@ -220,7 -210,7 +220,7 @@@ static const char *proc_arch[] = 
        "?(17)",
  };
  
 -int cpu_architecture(void)
 +static int __get_cpu_architecture(void)
  {
        int cpu_arch;
  
        return cpu_arch;
  }
  
 +int __pure cpu_architecture(void)
 +{
 +      BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN);
 +
 +      return __cpu_architecture;
 +}
 +
  static int cpu_has_aliasing_icache(unsigned int arch)
  {
        int aliasing_icache;
        unsigned int id_reg, num_sets, line_size;
  
 +      /* PIPT caches never alias. */
 +      if (icache_is_pipt())
 +              return 0;
 +
        /* arch specifies the register format */
        switch (arch) {
        case CPU_ARCH_ARMv7:
@@@ -303,14 -282,8 +303,14 @@@ static void __init cacheid_init(void
                        /* ARMv7 register format */
                        arch = CPU_ARCH_ARMv7;
                        cacheid = CACHEID_VIPT_NONALIASING;
 -                      if ((cachetype & (3 << 14)) == 1 << 14)
 +                      switch (cachetype & (3 << 14)) {
 +                      case (1 << 14):
                                cacheid |= CACHEID_ASID_TAGGED;
 +                              break;
 +                      case (3 << 14):
 +                              cacheid |= CACHEID_PIPT;
 +                              break;
 +                      }
                } else {
                        arch = CPU_ARCH_ARMv6;
                        if (cachetype & (1 << 23))
        printk("CPU: %s data cache, %s instruction cache\n",
                cache_is_vivt() ? "VIVT" :
                cache_is_vipt_aliasing() ? "VIPT aliasing" :
 -              cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown",
 +              cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown",
                cache_is_vivt() ? "VIVT" :
                icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" :
                icache_is_vipt_aliasing() ? "VIPT aliasing" :
 +              icache_is_pipt() ? "PIPT" :
                cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown");
  }
  
@@@ -442,7 -414,6 +442,7 @@@ static void __init setup_processor(void
        }
  
        cpu_name = list->cpu_name;
 +      __cpu_architecture = __get_cpu_architecture();
  
  #ifdef MULTI_CPU
        processor = *list->proc;
@@@ -849,25 -820,8 +849,8 @@@ static struct machine_desc * __init set
  
        if (__atags_pointer)
                tags = phys_to_virt(__atags_pointer);
-       else if (mdesc->boot_params) {
- #ifdef CONFIG_MMU
-               /*
-                * We still are executing with a minimal MMU mapping created
-                * with the presumption that the machine default for this
-                * is located in the first MB of RAM.  Anything else will
-                * fault and silently hang the kernel at this point.
-                */
-               if (mdesc->boot_params < PHYS_OFFSET ||
-                   mdesc->boot_params >= PHYS_OFFSET + SZ_1M) {
-                       printk(KERN_WARNING
-                              "Default boot params at physical 0x%08lx out of reach\n",
-                              mdesc->boot_params);
-               } else
- #endif
-               {
-                       tags = phys_to_virt(mdesc->boot_params);
-               }
-       }
+       else if (mdesc->atag_offset)
+               tags = (void *)(PAGE_OFFSET + mdesc->atag_offset);
  
  #if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
        /*
        }
  
        if (mdesc->fixup)
 -              mdesc->fixup(mdesc, tags, &from, &meminfo);
 +              mdesc->fixup(tags, &from, &meminfo);
  
        if (tags->hdr.tag == ATAG_CORE) {
                if (meminfo.nr_banks != 0)
diff --combined arch/arm/kernel/smp.c
@@@ -319,7 -319,17 +319,7 @@@ asmlinkage void __cpuinit secondary_sta
         */
        platform_secondary_init(cpu);
  
 -      /*
 -       * Enable local interrupts.
 -       */
        notify_cpu_starting(cpu);
 -      local_irq_enable();
 -      local_fiq_enable();
 -
 -      /*
 -       * Setup the percpu timer for this CPU.
 -       */
 -      percpu_timer_setup();
  
        calibrate_delay();
  
         * before we continue.
         */
        set_cpu_online(cpu, true);
 +
 +      /*
 +       * Setup the percpu timer for this CPU.
 +       */
 +      percpu_timer_setup();
 +
        while (!cpu_active(cpu))
                cpu_relax();
  
 +      /*
 +       * cpu_active bit is set, so it's safe to enalbe interrupts
 +       * now.
 +       */
 +      local_irq_enable();
 +      local_fiq_enable();
 +
        /*
         * OK, it's off to the idle thread for us
         */
@@@ -460,10 -457,6 +460,6 @@@ u64 smp_irq_stat_cpu(unsigned int cpu
        for (i = 0; i < NR_IPI; i++)
                sum += __get_irq_stat(cpu, ipi_irqs[i]);
  
- #ifdef CONFIG_LOCAL_TIMERS
-       sum += __get_irq_stat(cpu, local_timer_irqs);
- #endif
        return sum;
  }
  
@@@ -480,38 -473,6 +476,6 @@@ static void ipi_timer(void
        irq_exit();
  }
  
- #ifdef CONFIG_LOCAL_TIMERS
- asmlinkage void __exception_irq_entry do_local_timer(struct pt_regs *regs)
- {
-       handle_local_timer(regs);
- }
- void handle_local_timer(struct pt_regs *regs)
- {
-       struct pt_regs *old_regs = set_irq_regs(regs);
-       int cpu = smp_processor_id();
-       if (local_timer_ack()) {
-               __inc_irq_stat(cpu, local_timer_irqs);
-               ipi_timer();
-       }
-       set_irq_regs(old_regs);
- }
- void show_local_irqs(struct seq_file *p, int prec)
- {
-       unsigned int cpu;
-       seq_printf(p, "%*s: ", prec, "LOC");
-       for_each_present_cpu(cpu)
-               seq_printf(p, "%10u ", __get_irq_stat(cpu, local_timer_irqs));
-       seq_printf(p, " Local timer interrupts\n");
- }
- #endif
  #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
  static void smp_timer_broadcast(const struct cpumask *mask)
  {
@@@ -562,11 -523,11 +526,11 @@@ static void percpu_timer_stop(void
        unsigned int cpu = smp_processor_id();
        struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
  
-       evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
+       local_timer_stop(evt);
  }
  #endif
  
 -static DEFINE_SPINLOCK(stop_lock);
 +static DEFINE_RAW_SPINLOCK(stop_lock);
  
  /*
   * ipi_cpu_stop - handle IPI from smp_send_stop()
@@@ -575,10 -536,10 +539,10 @@@ static void ipi_cpu_stop(unsigned int c
  {
        if (system_state == SYSTEM_BOOTING ||
            system_state == SYSTEM_RUNNING) {
 -              spin_lock(&stop_lock);
 +              raw_spin_lock(&stop_lock);
                printk(KERN_CRIT "CPU%u: stopping\n", cpu);
                dump_stack();
 -              spin_unlock(&stop_lock);
 +              raw_spin_unlock(&stop_lock);
        }
  
        set_cpu_online(cpu, false);
@@@ -26,7 -26,8 +26,7 @@@
  #include "common.h"
  
  static void __init
 -fixup_clep7312(struct machine_desc *desc, struct tag *tags,
 -          char **cmdline, struct meminfo *mi)
 +fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
        mi->nr_banks=1;
        mi->bank[0].start = 0xc0000000;
@@@ -36,7 -37,7 +36,7 @@@
  
  MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
        /* Maintainer: Nobody */
-       .boot_params    = 0xc0000100,
+       .atag_offset    = 0x0100,
        .fixup          = fixup_clep7312,
        .map_io         = clps711x_map_io,
        .init_irq       = clps711x_init_irq,
@@@ -37,7 -37,8 +37,7 @@@ static void __init edb7211_reserve(void
  }
  
  static void __init
 -fixup_edb7211(struct machine_desc *desc, struct tag *tags,
 -            char **cmdline, struct meminfo *mi)
 +fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
        /*
         * Bank start addresses are not present in the information
@@@ -56,7 -57,7 +56,7 @@@
  
  MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
        /* Maintainer: Jon McClintock */
-       .boot_params    = 0xc0020100,   /* 0xc0000000 - 0xc001ffff can be video RAM */
+       .atag_offset    = 0x20100,      /* 0xc0000000 - 0xc001ffff can be video RAM */
        .fixup          = fixup_edb7211,
        .map_io         = edb7211_map_io,
        .reserve        = edb7211_reserve,
@@@ -57,7 -57,8 +57,7 @@@ typedef struct tag_IMAGE_PARAM
  #define IMAGE_PARAMS_PHYS     0xC01F0000
  
  static void __init
 -fortunet_fixup(struct machine_desc *desc, struct tag *tags,
 -               char **cmdline, struct meminfo *mi)
 +fortunet_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
        IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS);
        *cmdline = phys_to_virt(ip->command_line);
@@@ -74,7 -75,6 +74,6 @@@
  
  MACHINE_START(FORTUNET, "ARM-FortuNet")
        /* Maintainer: FortuNet Inc. */
-       .boot_params    = 0x00000000,
        .fixup          = fortunet_fixup,
        .map_io         = clps711x_map_io,
        .init_irq       = clps711x_init_irq,
@@@ -56,7 -56,8 +56,7 @@@ static struct map_desc p720t_io_desc[] 
  };
  
  static void __init
 -fixup_p720t(struct machine_desc *desc, struct tag *tag,
 -          char **cmdline, struct meminfo *mi)
 +fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
  {
        /*
         * Our bootloader doesn't setup any tags (yet).
@@@ -88,7 -89,7 +88,7 @@@ static void __init p720t_map_io(void
  
  MACHINE_START(P720T, "ARM-Prospector720T")
        /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
-       .boot_params    = 0xc0000100,
+       .atag_offset    = 0x100,
        .fixup          = fixup_p720t,
        .map_io         = p720t_map_io,
        .init_irq       = clps711x_init_irq,
@@@ -37,7 -37,6 +37,7 @@@
  #include <mach/hardware.h>
  #include <mach/fb.h>
  #include <mach/ep93xx_spi.h>
 +#include <mach/gpio-ep93xx.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -241,7 -240,7 +241,7 @@@ static void __init edb93xx_init_machine
  #ifdef CONFIG_MACH_EDB9301
  MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
        /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
-       .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -252,7 -251,7 +252,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9302
  MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
        /* Maintainer: George Kashperko <george@chas.com.ua> */
-       .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -263,7 -262,7 +263,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9302A
  MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
        /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
-       .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -274,7 -273,7 +274,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9307
  MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
        /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
-       .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -285,7 -284,7 +285,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9307A
  MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
        /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
-       .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -296,7 -295,7 +296,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9312
  MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
        /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
-       .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -307,7 -306,7 +307,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9315
  MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
        /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
-       .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -318,7 -317,7 +318,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_EDB9315A
  MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
        /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
-       .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
 -#include <linux/gpio.h>
  #include <linux/i2c.h>
  #include <linux/i2c-gpio.h>
  
  #include <mach/hardware.h>
  #include <mach/fb.h>
 +#include <mach/gpio-ep93xx.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -65,8 -65,8 +65,8 @@@ static void __init simone_init_machine(
  }
  
  MACHINE_START(SIM_ONE, "Simplemachines Sim.One Board")
- /* Maintainer: Ryan Mallon */
-       .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
      /* Maintainer: Ryan Mallon */
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/io.h>
 -#include <linux/gpio.h>
  #include <linux/i2c.h>
  #include <linux/i2c-gpio.h>
  #include <linux/fb.h>
@@@ -29,7 -30,6 +29,7 @@@
  
  #include <mach/hardware.h>
  #include <mach/fb.h>
 +#include <mach/gpio-ep93xx.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -163,7 -163,7 +163,7 @@@ static void __init snappercl15_init_mac
  
  MACHINE_START(SNAPPER_CL15, "Bluewater Systems Snapper CL15")
        /* Maintainer: Ryan Mallon */
-       .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ep93xx_map_io,
        .init_irq       = ep93xx_init_irq,
        .timer          = &ep93xx_timer,
@@@ -132,18 -132,12 +132,18 @@@ static cycle_t exynos4_frc_read(struct 
        return ((cycle_t)hi << 32) | lo;
  }
  
 +static void exynos4_frc_resume(struct clocksource *cs)
 +{
 +      exynos4_mct_frc_start(0, 0);
 +}
 +
  struct clocksource mct_frc = {
        .name           = "mct-frc",
        .rating         = 400,
        .read           = exynos4_frc_read,
        .mask           = CLOCKSOURCE_MASK(64),
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 +      .resume         = exynos4_frc_resume,
  };
  
  static void __init exynos4_clocksource_init(void)
@@@ -386,25 -380,26 +386,28 @@@ static void exynos4_mct_tick_init(struc
  
        if (cpu == 0) {
                mct_tick0_event_irq.dev_id = &mct_tick[cpu];
+               evt->irq = IRQ_MCT_L0;
                setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq);
        } else {
                mct_tick1_event_irq.dev_id = &mct_tick[cpu];
+               evt->irq = IRQ_MCT_L1;
                setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq);
                irq_set_affinity(IRQ_MCT_L1, cpumask_of(1));
        }
  }
  
  /* Setup the local clock events for a CPU */
 -void __cpuinit local_timer_setup(struct clock_event_device *evt)
 +int __cpuinit local_timer_setup(struct clock_event_device *evt)
  {
        exynos4_mct_tick_init(evt);
 +
 +      return 0;
  }
  
int local_timer_ack(void)
void local_timer_stop(struct clock_event_device *evt)
  {
-       return 0;
+       evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt);
+       disable_irq(evt->irq);
  }
  
  #endif /* CONFIG_LOCAL_TIMERS */
@@@ -76,7 -76,8 +76,7 @@@ __initcall(cats_hw_init)
   * hard reboots fail on early boards.
   */
  static void __init
 -fixup_cats(struct machine_desc *desc, struct tag *tags,
 -         char **cmdline, struct meminfo *mi)
 +fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
        screen_info.orig_video_lines  = 25;
        screen_info.orig_video_points = 16;
@@@ -85,7 -86,7 +85,7 @@@
  
  MACHINE_START(CATS, "Chalice-CATS")
        /* Maintainer: Philip Blundell */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .soft_reboot    = 1,
        .fixup          = fixup_cats,
        .map_io         = footbridge_map_io,
@@@ -68,7 -68,7 +68,7 @@@ static inline void wb977_ww(int reg, in
  /*
   * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
   */
 -DEFINE_SPINLOCK(nw_gpio_lock);
 +DEFINE_RAW_SPINLOCK(nw_gpio_lock);
  EXPORT_SYMBOL(nw_gpio_lock);
  
  static unsigned int current_gpio_op;
@@@ -327,9 -327,9 +327,9 @@@ static inline void wb977_init_gpio(void
        /*
         * Set Group1/Group2 outputs
         */
 -      spin_lock_irqsave(&nw_gpio_lock, flags);
 +      raw_spin_lock_irqsave(&nw_gpio_lock, flags);
        nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
 -      spin_unlock_irqrestore(&nw_gpio_lock, flags);
 +      raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
  }
  
  /*
@@@ -390,9 -390,9 +390,9 @@@ static void __init cpld_init(void
  {
        unsigned long flags;
  
 -      spin_lock_irqsave(&nw_gpio_lock, flags);
 +      raw_spin_lock_irqsave(&nw_gpio_lock, flags);
        nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
 -      spin_unlock_irqrestore(&nw_gpio_lock, flags);
 +      raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
  }
  
  static unsigned char rwa_unlock[] __initdata =
@@@ -616,9 -616,9 +616,9 @@@ static int __init nw_hw_init(void
                cpld_init();
                rwa010_init();
  
 -              spin_lock_irqsave(&nw_gpio_lock, flags);
 +              raw_spin_lock_irqsave(&nw_gpio_lock, flags);
                nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
 -              spin_unlock_irqrestore(&nw_gpio_lock, flags);
 +              raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
        }
        return 0;
  }
@@@ -631,7 -631,8 +631,7 @@@ __initcall(nw_hw_init)
   * the parameter page.
   */
  static void __init
 -fixup_netwinder(struct machine_desc *desc, struct tag *tags,
 -              char **cmdline, struct meminfo *mi)
 +fixup_netwinder(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
  #ifdef CONFIG_ISAPNP
        extern int isapnp_disable;
  
  MACHINE_START(NETWINDER, "Rebel-NetWinder")
        /* Maintainer: Russell King/Rebel.com */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .video_start    = 0x000a0000,
        .video_end      = 0x000bffff,
        .reserve_lp0    = 1,
@@@ -13,7 -13,7 +13,7 @@@
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/platform_device.h>
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/map.h>
@@@ -27,6 -27,7 +27,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/time.h>
  #include <asm/mach/map.h>
 -#include <mach/gpio.h>
  #include <mach/iomux-mx27.h>
  
  #include "devices-imx27.h"
@@@ -344,7 -345,7 +344,7 @@@ static void __init mx27ads_map_io(void
  
  MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
        /* maintainer: Freescale Semiconductor, Inc. */
-       .boot_params = MX27_PHYS_OFFSET + 0x100,
+       .atag_offset = 0x100,
        .map_io = mx27ads_map_io,
        .init_early = imx27_init_early,
        .init_irq = mx27_init_irq,
@@@ -32,8 -32,6 +32,8 @@@
  #include <linux/interrupt.h>
  #include <linux/io.h>
  #include <linux/mtd/physmap.h>
 +#include <linux/clk.h>
 +#include <video/vga.h>
  
  #include <mach/hardware.h>
  #include <mach/platform.h>
@@@ -156,7 -154,6 +156,7 @@@ static struct map_desc ap_io_desc[] __i
  static void __init ap_map_io(void)
  {
        iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc));
 +      vga_base = PCI_MEMORY_VADDR;
  }
  
  #define INTEGRATOR_SC_VALID_INT       0x003fffff
@@@ -323,16 -320,27 +323,16 @@@ static void __init ap_init(void
  #define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE)
  #define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE)
  
 -/*
 - * How long is the timer interval?
 - */
 -#define TIMER_INTERVAL        (TICKS_PER_uSEC * mSEC_10)
 -#if TIMER_INTERVAL >= 0x100000
 -#define TICKS2USECS(x)        (256 * (x) / TICKS_PER_uSEC)
 -#elif TIMER_INTERVAL >= 0x10000
 -#define TICKS2USECS(x)        (16 * (x) / TICKS_PER_uSEC)
 -#else
 -#define TICKS2USECS(x)        ((x) / TICKS_PER_uSEC)
 -#endif
 -
  static unsigned long timer_reload;
  
 -static void integrator_clocksource_init(u32 khz)
 +static void integrator_clocksource_init(unsigned long inrate)
  {
        void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
        u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
 +      unsigned long rate = inrate;
  
 -      if (khz >= 1500) {
 -              khz /= 16;
 +      if (rate >= 1500000) {
 +              rate /= 16;
                ctrl |= TIMER_CTRL_DIV16;
        }
  
        writel(ctrl, base + TIMER_CTRL);
  
        clocksource_mmio_init(base + TIMER_VALUE, "timer2",
 -              khz * 1000, 200, 16, clocksource_mmio_readl_down);
 +                      rate, 200, 16, clocksource_mmio_readl_down);
  }
  
  static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE;
@@@ -364,29 -372,15 +364,29 @@@ static void clkevt_set_mode(enum clock_
  {
        u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
  
 -      BUG_ON(mode == CLOCK_EVT_MODE_ONESHOT);
 +      /* Disable timer */
 +      writel(ctrl, clkevt_base + TIMER_CTRL);
  
 -      if (mode == CLOCK_EVT_MODE_PERIODIC) {
 -              writel(ctrl, clkevt_base + TIMER_CTRL);
 +      switch (mode) {
 +      case CLOCK_EVT_MODE_PERIODIC:
 +              /* Enable the timer and start the periodic tick */
                writel(timer_reload, clkevt_base + TIMER_LOAD);
                ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
 +              writel(ctrl, clkevt_base + TIMER_CTRL);
 +              break;
 +      case CLOCK_EVT_MODE_ONESHOT:
 +              /* Leave the timer disabled, .set_next_event will enable it */
 +              ctrl &= ~TIMER_CTRL_PERIODIC;
 +              writel(ctrl, clkevt_base + TIMER_CTRL);
 +              break;
 +      case CLOCK_EVT_MODE_UNUSED:
 +      case CLOCK_EVT_MODE_SHUTDOWN:
 +      case CLOCK_EVT_MODE_RESUME:
 +      default:
 +              /* Just leave in disabled state */
 +              break;
        }
  
 -      writel(ctrl, clkevt_base + TIMER_CTRL);
  }
  
  static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt)
  
  static struct clock_event_device integrator_clockevent = {
        .name           = "timer1",
 -      .shift          = 34,
 -      .features       = CLOCK_EVT_FEAT_PERIODIC,
 +      .features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
        .set_mode       = clkevt_set_mode,
        .set_next_event = clkevt_set_next_event,
        .rating         = 300,
 -      .cpumask        = cpu_all_mask,
  };
  
  static struct irqaction integrator_timer_irq = {
        .dev_id         = &integrator_clockevent,
  };
  
 -static void integrator_clockevent_init(u32 khz)
 +static void integrator_clockevent_init(unsigned long inrate)
  {
 -      struct clock_event_device *evt = &integrator_clockevent;
 +      unsigned long rate = inrate;
        unsigned int ctrl = 0;
  
 -      if (khz * 1000 > 0x100000 * HZ) {
 -              khz /= 256;
 +      /* Calculate and program a divisor */
 +      if (rate > 0x100000 * HZ) {
 +              rate /= 256;
                ctrl |= TIMER_CTRL_DIV256;
 -      } else if (khz * 1000 > 0x10000 * HZ) {
 -              khz /= 16;
 +      } else if (rate > 0x10000 * HZ) {
 +              rate /= 16;
                ctrl |= TIMER_CTRL_DIV16;
        }
 -
 -      timer_reload = khz * 1000 / HZ;
 +      timer_reload = rate / HZ;
        writel(ctrl, clkevt_base + TIMER_CTRL);
  
 -      evt->irq = IRQ_TIMERINT1;
 -      evt->mult = div_sc(khz, NSEC_PER_MSEC, evt->shift);
 -      evt->max_delta_ns = clockevent_delta2ns(0xffff, evt);
 -      evt->min_delta_ns = clockevent_delta2ns(0xf, evt);
 -
        setup_irq(IRQ_TIMERINT1, &integrator_timer_irq);
 -      clockevents_register_device(evt);
 +      clockevents_config_and_register(&integrator_clockevent,
 +                                      rate,
 +                                      1,
 +                                      0xffffU);
  }
  
  /*
   */
  static void __init ap_init_timer(void)
  {
 -      u32 khz = TICKS_PER_uSEC * 1000;
 +      struct clk *clk;
 +      unsigned long rate;
 +
 +      clk = clk_get_sys("ap_timer", NULL);
 +      BUG_ON(IS_ERR(clk));
 +      clk_enable(clk);
 +      rate = clk_get_rate(clk);
  
        writel(0, TIMER0_VA_BASE + TIMER_CTRL);
        writel(0, TIMER1_VA_BASE + TIMER_CTRL);
        writel(0, TIMER2_VA_BASE + TIMER_CTRL);
  
 -      integrator_clocksource_init(khz);
 -      integrator_clockevent_init(khz);
 +      integrator_clocksource_init(rate);
 +      integrator_clockevent_init(rate);
  }
  
  static struct sys_timer ap_timer = {
  
  MACHINE_START(INTEGRATOR, "ARM-Integrator")
        /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .reserve        = integrator_reserve,
        .map_io         = ap_map_io,
        .init_early     = integrator_init_early,
@@@ -16,7 -16,7 +16,7 @@@
   * Author: Rod Whitby <rod@whitby.id.au>
   * Maintainers: http://www.nslu2-linux.org/
   */
 -
 +#include <linux/gpio.h>
  #include <linux/irq.h>
  #include <linux/jiffies.h>
  #include <linux/timer.h>
@@@ -31,6 -31,7 +31,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/flash.h>
  #include <asm/mach/time.h>
 -#include <asm/gpio.h>
  
  #define DSMG600_SDA_PIN               5
  #define DSMG600_SCL_PIN               4
@@@ -278,7 -279,7 +278,7 @@@ static void __init dsmg600_init(void
  
  MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
        /* Maintainer: www.nslu2-linux.org */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &dsmg600_timer,
@@@ -14,7 -14,7 +14,7 @@@
   * Maintainers: http://www.nslu2-linux.org/
   *
   */
 -
 +#include <linux/gpio.h>
  #include <linux/if_ether.h>
  #include <linux/irq.h>
  #include <linux/serial.h>
@@@ -27,6 -27,7 +27,6 @@@
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/flash.h>
 -#include <asm/gpio.h>
  
  #define FSG_SDA_PIN           12
  #define FSG_SCL_PIN           13
@@@ -272,7 -273,7 +272,7 @@@ MACHINE_START(FSG, "Freecom FSG-3"
        .map_io         = ixp4xx_map_io,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
-       .boot_params    = 0x0100,
+       .atag_offset    = 0x100,
        .init_machine   = fsg_init,
  #if defined(CONFIG_PCI)
        .dma_zone_size  = SZ_64M,
@@@ -17,7 -17,7 +17,7 @@@
   * Maintainers: http://www.nslu2-linux.org/
   *
   */
 -
 +#include <linux/gpio.h>
  #include <linux/if_ether.h>
  #include <linux/irq.h>
  #include <linux/jiffies.h>
@@@ -32,6 -32,7 +32,6 @@@
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/flash.h>
 -#include <asm/gpio.h>
  
  #define NAS100D_SDA_PIN               5
  #define NAS100D_SCL_PIN               6
@@@ -313,7 -314,7 +313,7 @@@ static void __init nas100d_init(void
  
  MACHINE_START(NAS100D, "Iomega NAS 100d")
        /* Maintainer: www.nslu2-linux.org */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &ixp4xx_timer,
@@@ -16,7 -16,7 +16,7 @@@
   * Maintainers: http://www.nslu2-linux.org/
   *
   */
 -
 +#include <linux/gpio.h>
  #include <linux/if_ether.h>
  #include <linux/irq.h>
  #include <linux/serial.h>
@@@ -30,6 -30,7 +30,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/flash.h>
  #include <asm/mach/time.h>
 -#include <asm/gpio.h>
  
  #define NSLU2_SDA_PIN         7
  #define NSLU2_SCL_PIN         6
@@@ -299,7 -300,7 +299,7 @@@ static void __init nslu2_init(void
  
  MACHINE_START(NSLU2, "Linksys NSLU2")
        /* Maintainer: www.nslu2-linux.org */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .map_io         = ixp4xx_map_io,
        .init_irq       = ixp4xx_init_irq,
        .timer          = &nslu2_timer,
@@@ -10,7 -10,7 +10,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/types.h>
  #include <linux/interrupt.h>
@@@ -34,7 -34,7 +34,7 @@@
  #include <asm/mach/irq.h>
  
  #include <mach/devices.h>
 -#include <mach/gpio.h>
 +#include <mach/gpio-ks8695.h>
  
  #include "generic.h"
  
@@@ -223,7 -223,7 +223,7 @@@ static void __init acs5k_init(void
  
  MACHINE_START(ACS5K, "Brivo Systems LLC ACS-5000 Master board")
        /* Maintainer: Simtec Electronics. */
-       .boot_params    = KS8695_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ks8695_map_io,
        .init_irq       = ks8695_init_irq,
        .init_machine   = acs5k_init,
@@@ -10,7 -10,7 +10,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/types.h>
  #include <linux/interrupt.h>
@@@ -29,7 -29,7 +29,7 @@@
  #include <asm/mach/irq.h>
  
  #include <mach/devices.h>
 -#include <mach/gpio.h>
 +#include <mach/gpio-ks8695.h>
  
  #include "generic.h"
  
@@@ -121,7 -121,7 +121,7 @@@ static void __init dsm320_init(void
  
  MACHINE_START(DSM320, "D-Link DSM-320 Wireless Media Player")
        /* Maintainer: Simtec Electronics. */
-       .boot_params    = KS8695_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ks8695_map_io,
        .init_irq       = ks8695_init_irq,
        .init_machine   = dsm320_init,
@@@ -5,7 -5,7 +5,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/types.h>
  #include <linux/interrupt.h>
@@@ -18,7 -18,7 +18,7 @@@
  #include <asm/mach/map.h>
  #include <asm/mach/irq.h>
  
 -#include <mach/gpio.h>
 +#include <mach/gpio-ks8695.h>
  #include <mach/devices.h>
  
  #include "generic.h"
@@@ -53,7 -53,7 +53,7 @@@ static void __init micrel_init(void
  
  MACHINE_START(KS8695, "KS8695 Centaur Development Board")
        /* Maintainer: Micrel Semiconductor Inc. */
-       .boot_params    = KS8695_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = ks8695_map_io,
        .init_irq       = ks8695_init_irq,
        .init_machine   = micrel_init,
@@@ -37,7 -37,6 +37,7 @@@
  
  #include <mach/hardware.h>
  #include <mach/platform.h>
 +#include <mach/gpio-lpc32xx.h>
  #include "common.h"
  
  /*
@@@ -383,7 -382,7 +383,7 @@@ arch_initcall(lpc32xx_display_uid)
  
  MACHINE_START(PHY3250, "Phytec 3250 board with the LPC3250 Microcontroller")
        /* Maintainer: Kevin Wells, NXP Semiconductors */
-       .boot_params    = 0x80000100,
+       .atag_offset    = 0x100,
        .map_io         = lpc32xx_map_io,
        .init_irq       = lpc32xx_init_irq,
        .timer          = &lpc32xx_timer,
@@@ -78,8 -78,8 +78,8 @@@ static void __init halibut_init(void
        platform_add_devices(devices, ARRAY_SIZE(devices));
  }
  
 -static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags,
 -                               char **cmdline, struct meminfo *mi)
 +static void __init halibut_fixup(struct tag *tags, char **cmdline,
 +                               struct meminfo *mi)
  {
        mi->nr_banks=1;
        mi->bank[0].start = PHYS_OFFSET;
@@@ -93,7 -93,7 +93,7 @@@ static void __init halibut_map_io(void
  }
  
  MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .fixup          = halibut_fixup,
        .map_io         = halibut_map_io,
        .init_irq       = halibut_init_irq,
@@@ -53,8 -53,8 +53,8 @@@ static void __init mahimahi_init(void
        platform_add_devices(devices, ARRAY_SIZE(devices));
  }
  
 -static void __init mahimahi_fixup(struct machine_desc *desc, struct tag *tags,
 -                               char **cmdline, struct meminfo *mi)
 +static void __init mahimahi_fixup(struct tag *tags, char **cmdline,
 +                                struct meminfo *mi)
  {
        mi->nr_banks = 2;
        mi->bank[0].start = PHYS_OFFSET;
@@@ -74,7 -74,7 +74,7 @@@ static void __init mahimahi_map_io(void
  extern struct sys_timer msm_timer;
  
  MACHINE_START(MAHIMAHI, "mahimahi")
-       .boot_params    = 0x20000100,
+       .atag_offset    = 0x100,
        .fixup          = mahimahi_fixup,
        .map_io         = mahimahi_map_io,
        .init_irq       = msm_init_irq,
@@@ -13,7 -13,7 +13,7 @@@
   * GNU General Public License for more details.
   *
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -34,6 -34,7 +34,6 @@@
  
  #include <mach/vreg.h>
  #include <mach/mpp.h>
 -#include <mach/gpio.h>
  #include <mach/board.h>
  #include <mach/msm_iomap.h>
  
@@@ -129,7 -130,7 +129,7 @@@ static void __init msm7x2x_map_io(void
  }
  
  MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
-       .boot_params    = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = msm7x2x_map_io,
        .init_irq       = msm7x2x_init_irq,
        .init_machine   = msm7x2x_init,
  MACHINE_END
  
  MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
-       .boot_params    = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = msm7x2x_map_io,
        .init_irq       = msm7x2x_init_irq,
        .init_machine   = msm7x2x_init,
  MACHINE_END
  
  MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
-       .boot_params    = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = msm7x2x_map_io,
        .init_irq       = msm7x2x_init_irq,
        .init_machine   = msm7x2x_init,
  MACHINE_END
  
  MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA")
-       .boot_params    = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset    = 0x100,
        .map_io         = msm7x2x_map_io,
        .init_irq       = msm7x2x_init_irq,
        .init_machine   = msm7x2x_init,
@@@ -14,7 -14,7 +14,7 @@@
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   * 02110-1301, USA.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/irq.h>
  #include <linux/gpio.h>
@@@ -31,6 -31,7 +31,6 @@@
  #include <asm/memory.h>
  #include <asm/setup.h>
  
 -#include <mach/gpio.h>
  #include <mach/board.h>
  #include <mach/msm_iomap.h>
  #include <mach/dma.h>
@@@ -121,7 -122,7 +121,7 @@@ static void __init msm7x30_map_io(void
  }
  
  MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
-       .boot_params = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset = 0x100,
        .fixup = msm7x30_fixup,
        .reserve = msm7x30_reserve,
        .map_io = msm7x30_map_io,
  MACHINE_END
  
  MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
-       .boot_params = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset = 0x100,
        .fixup = msm7x30_fixup,
        .reserve = msm7x30_reserve,
        .map_io = msm7x30_map_io,
  MACHINE_END
  
  MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
-       .boot_params = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset = 0x100,
        .fixup = msm7x30_fixup,
        .reserve = msm7x30_reserve,
        .map_io = msm7x30_map_io,
@@@ -14,7 -14,7 +14,7 @@@
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   * 02110-1301, USA.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/irq.h>
  #include <linux/gpio.h>
@@@ -32,6 -32,7 +32,6 @@@
  #include <mach/board.h>
  #include <mach/irqs.h>
  #include <mach/sirc.h>
 -#include <mach/gpio.h>
  #include <mach/vreg.h>
  #include <mach/mmc.h>
  
@@@ -192,7 -193,7 +192,7 @@@ static void __init qsd8x50_init(void
  }
  
  MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
-       .boot_params = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset = 0x100,
        .map_io = qsd8x50_map_io,
        .init_irq = qsd8x50_init_irq,
        .init_machine = qsd8x50_init,
  MACHINE_END
  
  MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
-       .boot_params = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset = 0x100,
        .map_io = qsd8x50_map_io,
        .init_irq = qsd8x50_init_irq,
        .init_machine = qsd8x50_init,
@@@ -11,7 -11,7 +11,7 @@@
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
  */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -22,6 -22,7 +22,6 @@@
  
  #include <linux/delay.h>
  
 -#include <asm/gpio.h>
  #include <mach/hardware.h>
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -76,8 -77,8 +76,8 @@@ static struct map_desc sapphire_io_desc
        }
  };
  
 -static void __init sapphire_fixup(struct machine_desc *desc, struct tag *tags,
 -                                char **cmdline, struct meminfo *mi)
 +static void __init sapphire_fixup(struct tag *tags, char **cmdline,
 +                                struct meminfo *mi)
  {
        int smi_sz = parse_tag_smi((const struct tag *)tags);
  
@@@ -104,7 -105,7 +104,7 @@@ static void __init sapphire_map_io(void
  
  MACHINE_START(SAPPHIRE, "sapphire")
  /* Maintainer: Brian Swetland <swetland@google.com> */
-       .boot_params    = PLAT_PHYS_OFFSET + 0x100,
+       .atag_offset    = 0x100,
        .fixup          = sapphire_fixup,
        .map_io         = sapphire_map_io,
        .init_irq       = sapphire_init_irq,
@@@ -48,8 -48,8 +48,8 @@@ static void __init trout_init_irq(void
        msm_init_irq();
  }
  
 -static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
 -                              char **cmdline, struct meminfo *mi)
 +static void __init trout_fixup(struct tag *tags, char **cmdline,
 +                             struct meminfo *mi)
  {
        mi->nr_banks = 1;
        mi->bank[0].start = PHYS_OFFSET;
@@@ -93,7 -93,7 +93,7 @@@ static void __init trout_map_io(void
  }
  
  MACHINE_START(TROUT, "HTC Dream")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .fixup          = trout_fixup,
        .map_io         = trout_map_io,
        .init_irq       = trout_init_irq,
@@@ -27,7 -27,6 +27,7 @@@
  #include <asm/mach/irq.h>
  #include <asm/mach/flash.h>
  
 +#include <plat/gpio-nomadik.h>
  #include <plat/mtu.h>
  
  #include <mach/setup.h>
@@@ -277,7 -276,7 +277,7 @@@ static void __init nhk8815_platform_ini
  
  MACHINE_START(NOMADIK, "NHK8815")
        /* Maintainer: ST MicroElectronics */
-       .boot_params    = 0x100,
+       .atag_offset    = 0x100,
        .map_io         = cpu8815_map_io,
        .init_irq       = cpu8815_init_irq,
        .timer          = &nomadik_timer,
@@@ -11,7 -11,7 +11,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/input.h>
@@@ -30,6 -30,7 +30,6 @@@
  
  #include <plat/io.h>
  #include <plat/board-ams-delta.h>
 -#include <mach/gpio.h>
  #include <plat/keypad.h>
  #include <plat/mux.h>
  #include <plat/usb.h>
@@@ -385,7 -386,7 +385,7 @@@ static void __init ams_delta_map_io(voi
  
  MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
        /* Maintainer: Jonathan McDowell <noodles@earth.li> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = ams_delta_map_io,
        .reserve        = omap_reserve,
        .init_irq       = ams_delta_init_irq,
@@@ -10,7 -10,7 +10,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -28,6 -28,7 +28,6 @@@
  #include <asm/mach/map.h>
  
  #include <plat/tc.h>
 -#include <mach/gpio.h>
  #include <plat/mux.h>
  #include <plat/flash.h>
  #include <plat/fpga.h>
@@@ -388,7 -389,7 +388,7 @@@ static void __init omap_fsample_map_io(
  
  MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
  /* Maintainer: Brian Swetland <swetland@google.com> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_fsample_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_fsample_init_irq,
@@@ -12,7 -12,7 +12,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -22,6 -22,7 +22,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/mux.h>
  #include <plat/usb.h>
  #include <plat/board.h>
@@@ -93,7 -94,7 +93,7 @@@ static void __init omap_generic_map_io(
  
  MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
        /* Maintainer: Tony Lindgren <tony@atomide.com> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_generic_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_generic_init_irq,
@@@ -18,7 -18,7 +18,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/platform_device.h>
  #include <linux/delay.h>
@@@ -32,6 -32,7 +32,6 @@@
  #include <linux/smc91x.h>
  
  #include <mach/hardware.h>
 -#include <asm/gpio.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -460,7 -461,7 +460,7 @@@ static void __init h2_map_io(void
  
  MACHINE_START(OMAP_H2, "TI-H2")
        /* Maintainer: Imre Deak <imre.deak@nokia.com> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = h2_map_io,
        .reserve        = omap_reserve,
        .init_irq       = h2_init_irq,
@@@ -13,7 -13,7 +13,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/types.h>
  #include <linux/init.h>
  #include <linux/major.h>
@@@ -34,6 -34,7 +34,6 @@@
  #include <asm/setup.h>
  #include <asm/page.h>
  #include <mach/hardware.h>
 -#include <asm/gpio.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -448,7 -449,7 +448,7 @@@ static void __init h3_map_io(void
  
  MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
        /* Maintainer: Texas Instruments, Inc. */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = h3_map_io,
        .reserve        = omap_reserve,
        .init_irq       = h3_init_irq,
@@@ -23,6 -23,7 +23,6 @@@
   * 02110-1301, USA.
   *
   */
 -
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -610,7 -611,7 +610,7 @@@ static void __init htcherald_init_irq(v
  MACHINE_START(HERALD, "HTC Herald")
        /* Maintainer: Cory Maccarrone <darkstar6262@gmail.com> */
        /* Maintainer: wing-linux.sourceforge.net */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = htcherald_map_io,
        .reserve        = omap_reserve,
        .init_irq       = htcherald_init_irq,
@@@ -15,7 -15,7 +15,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -34,6 -34,7 +34,6 @@@
  #include <plat/mux.h>
  #include <plat/flash.h>
  #include <plat/fpga.h>
 -#include <mach/gpio.h>
  #include <plat/tc.h>
  #include <plat/usb.h>
  #include <plat/keypad.h>
@@@ -458,7 -459,7 +458,7 @@@ static void __init innovator_map_io(voi
  
  MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
        /* Maintainer: MontaVista Software, Inc. */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = innovator_map_io,
        .reserve        = omap_reserve,
        .init_irq       = innovator_init_irq,
@@@ -7,7 -7,7 +7,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/mutex.h>
@@@ -26,6 -26,7 +26,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/mux.h>
  #include <plat/usb.h>
  #include <plat/board.h>
@@@ -263,7 -264,7 +263,7 @@@ static void __init omap_nokia770_map_io
  }
  
  MACHINE_START(NOKIA770, "Nokia 770")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_nokia770_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_nokia770_init_irq,
@@@ -25,7 -25,7 +25,7 @@@
   * with this program; if not, write  to the Free Software Foundation, Inc.,
   * 675 Mass Ave, Cambridge, MA 02139, USA.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -42,6 -42,7 +42,6 @@@
  #include <linux/i2c/tps65010.h>
  
  #include <mach/hardware.h>
 -#include <asm/gpio.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -582,7 -583,7 +582,7 @@@ static void __init osk_map_io(void
  
  MACHINE_START(OMAP_OSK, "TI-OSK")
        /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = osk_map_io,
        .reserve        = omap_reserve,
        .init_irq       = osk_init_irq,
@@@ -16,7 -16,7 +16,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/input.h>
@@@ -33,6 -33,7 +33,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/flash.h>
  #include <plat/mux.h>
  #include <plat/usb.h>
@@@ -274,7 -275,7 +274,7 @@@ static void __init omap_palmte_map_io(v
  }
  
  MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_palmte_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_palmte_init_irq,
@@@ -12,7 -12,6 +12,7 @@@
   */
  
  #include <linux/delay.h>
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -31,6 -30,7 +31,6 @@@
  #include <asm/mach/map.h>
  
  #include <plat/led.h>
 -#include <mach/gpio.h>
  #include <plat/flash.h>
  #include <plat/mux.h>
  #include <plat/usb.h>
@@@ -321,7 -321,7 +321,7 @@@ static void __init omap_palmtt_map_io(v
  }
  
  MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_palmtt_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_palmtt_init_irq,
@@@ -15,7 -15,6 +15,7 @@@
   */
  
  #include <linux/delay.h>
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -33,6 -32,7 +33,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/flash.h>
  #include <plat/mux.h>
  #include <plat/usb.h>
@@@ -341,7 -341,7 +341,7 @@@ omap_palmz71_map_io(void
  }
  
  MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_palmz71_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_palmz71_init_irq,
@@@ -10,7 -10,7 +10,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -28,6 -28,7 +28,6 @@@
  #include <asm/mach/map.h>
  
  #include <plat/tc.h>
 -#include <mach/gpio.h>
  #include <plat/mux.h>
  #include <plat/fpga.h>
  #include <plat/flash.h>
@@@ -349,7 -350,7 +349,7 @@@ static void __init omap_perseus2_map_io
  
  MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
        /* Maintainer: Kevin Hilman <kjh@hilman.org> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_perseus2_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_perseus2_init_irq,
@@@ -14,7 -14,7 +14,7 @@@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/input.h>
@@@ -32,6 -32,7 +32,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/flash.h>
  #include <plat/mux.h>
  #include <plat/dma.h>
@@@ -420,7 -421,7 +420,7 @@@ static void __init omap_sx1_map_io(void
  }
  
  MACHINE_START(SX1, "OMAP310 based Siemens SX1")
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = omap_sx1_map_io,
        .reserve        = omap_reserve,
        .init_irq       = omap_sx1_init_irq,
@@@ -13,7 -13,6 +13,7 @@@
   */
  
  #include <linux/delay.h>
 +#include <linux/gpio.h>
  #include <linux/platform_device.h>
  #include <linux/interrupt.h>
  #include <linux/irq.h>
@@@ -34,6 -33,7 +34,6 @@@
  
  #include <plat/board-voiceblue.h>
  #include <plat/common.h>
 -#include <mach/gpio.h>
  #include <plat/flash.h>
  #include <plat/mux.h>
  #include <plat/tc.h>
@@@ -301,7 -301,7 +301,7 @@@ static void __init voiceblue_init(void
  
  MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
        /* Maintainer: Ladislav Michl <michl@2n.cz> */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .map_io         = voiceblue_map_io,
        .reserve        = omap_reserve,
        .init_irq       = voiceblue_init_irq,
@@@ -193,8 -193,7 +193,8 @@@ static int __init omap2430_i2c_init(voi
  {
        omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
                        ARRAY_SIZE(sdp2430_i2c1_boardinfo));
 -      omap2_pmic_init("twl4030", &sdp2430_twldata);
 +      omap_pmic_init(2, 100, "twl4030", INT_24XX_SYS_NIRQ,
 +                      &sdp2430_twldata);
        return 0;
  }
  
@@@ -257,7 -256,7 +257,7 @@@ static void __init omap_2430sdp_map_io(
  
  MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
        /* Maintainer: Syed Khasim - Texas Instruments Inc */
-       .boot_params    = 0x80000100,
+       .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap_2430sdp_map_io,
        .init_early     = omap_2430sdp_init_early,
@@@ -15,7 -15,7 +15,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/device.h>
@@@ -25,6 -25,7 +25,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/usb.h>
  #include <plat/board.h>
  #include <plat/common.h>
@@@ -65,7 -66,7 +65,7 @@@ static void __init omap_generic_map_io(
  /* XXX This machine entry name should be updated */
  MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
        /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
-       .boot_params    = 0x80000100,
+       .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap_generic_map_io,
        .init_early     = omap_generic_init_early,
@@@ -10,7 -10,7 +10,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -31,6 -31,7 +31,6 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  
 -#include <mach/gpio.h>
  #include <plat/usb.h>
  #include <plat/board.h>
  #include <plat/common.h>
@@@ -381,7 -382,7 +381,7 @@@ static void __init omap_h4_map_io(void
  
  MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
        /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
-       .boot_params    = 0x80000100,
+       .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap_h4_map_io,
        .init_early     = omap_h4_init_early,
@@@ -10,7 -10,7 +10,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -34,6 -34,7 +34,6 @@@
  #include <asm/mach/map.h>
  
  #include <plat/mcspi.h>
 -#include <mach/gpio.h>
  #include <plat/board.h>
  #include <plat/common.h>
  #include <plat/gpmc.h>
@@@ -332,7 -333,7 +332,7 @@@ static void __init omap_ldp_init(void
  }
  
  MACHINE_START(OMAP_LDP, "OMAP LDP board")
-       .boot_params    = 0x80000100,
+       .atag_offset    = 0x100,
        .reserve        = omap_reserve,
        .map_io         = omap3_map_io,
        .init_early     = omap_ldp_init_early,
@@@ -9,7 -9,7 +9,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -21,6 -21,7 +21,6 @@@
  #include <linux/mv643xx_eth.h>
  #include <linux/i2c.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -358,7 -359,7 +358,7 @@@ static void __init db88f5281_init(void
  
  MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
        /* Maintainer: Tzachi Perelstein <tzachi@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = db88f5281_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -13,7 -13,7 +13,7 @@@
   * License, or (at your option) any later version.
   *
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/delay.h>
@@@ -30,6 -30,7 +30,6 @@@
  #include <linux/phy.h>
  #include <linux/marvell_phy.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -729,7 -730,7 +729,7 @@@ static void __init dns323_init(void
  /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
  MACHINE_START(DNS323, "D-Link DNS-323")
        /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = dns323_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -7,7 -7,7 +7,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -21,6 -21,7 +21,6 @@@
  #include <linux/serial_reg.h>
  #include <linux/ata_platform.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -379,7 -380,7 +379,7 @@@ static void __init kurobox_pro_init(voi
  #ifdef CONFIG_MACH_KUROBOX_PRO
  MACHINE_START(KUROBOX_PRO, "Buffalo/Revogear Kurobox Pro")
        /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = kurobox_pro_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -392,7 -393,7 +392,7 @@@ MACHINE_EN
  #ifdef CONFIG_MACH_LINKSTATION_PRO
  MACHINE_START(LINKSTATION_PRO, "Buffalo Linkstation Pro/Live")
        /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = kurobox_pro_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -7,7 -7,7 +7,7 @@@
   * published by the Free Software Foundation; either version 2 of the
   * License, or (at your option) any later version.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/i2c.h>
  #include <linux/ata_platform.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <mach/orion5x.h>
  #include "common.h"
@@@ -228,7 -229,7 +228,7 @@@ static void __init mv2120_init(void
  /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
  MACHINE_START(MV2120, "HP Media Vault mv2120")
        /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = mv2120_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -7,7 -7,7 +7,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -18,6 -18,7 +18,6 @@@
  #include <linux/ethtool.h>
  #include <net/dsa.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/leds.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
@@@ -168,7 -169,7 +168,7 @@@ subsys_initcall(rd88f5181l_fxo_pci_init
  
  MACHINE_START(RD88F5181L_FXO, "Marvell Orion-VoIP FXO Reference Design")
        /* Maintainer: Nicolas Pitre <nico@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = rd88f5181l_fxo_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -7,7 -7,7 +7,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -19,6 -19,7 +19,6 @@@
  #include <linux/i2c.h>
  #include <net/dsa.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/leds.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
@@@ -180,7 -181,7 +180,7 @@@ subsys_initcall(rd88f5181l_ge_pci_init)
  
  MACHINE_START(RD88F5181L_GE, "Marvell Orion-VoIP GE Reference Design")
        /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = rd88f5181l_ge_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -9,7 -9,7 +9,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/ata_platform.h>
  #include <linux/i2c.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/leds.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
@@@ -305,7 -306,7 +305,7 @@@ static void __init rd88f5182_init(void
  
  MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
        /* Maintainer: Ronen Shitrit <rshitrit@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = rd88f5182_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -7,7 -7,7 +7,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -21,6 -21,7 +21,6 @@@
  #include <linux/ethtool.h>
  #include <net/dsa.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/leds.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
@@@ -121,7 -122,7 +121,7 @@@ subsys_initcall(rd88f6183ap_ge_pci_init
  
  MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
        /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = rd88f6183ap_ge_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -8,7 -8,7 +8,7 @@@
   * as published by the Free Software Foundation; either version
   * 2 of the License, or (at your option) any later version.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/i2c.h>
  #include <linux/serial_reg.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -357,7 -358,7 +357,7 @@@ static void __init tsp2_init(void
  
  MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
        /* Maintainer:  Sylver Bruneau <sylver.bruneau@googlemail.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = tsp2_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -8,7 -8,7 +8,7 @@@
   * as published by the Free Software Foundation; either version
   * 2 of the License, or (at your option) any later version.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -23,6 -23,7 +23,6 @@@
  #include <linux/serial_reg.h>
  #include <linux/ata_platform.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -322,7 -323,7 +322,7 @@@ static void __init qnap_ts209_init(void
  
  MACHINE_START(TS209, "QNAP TS-109/TS-209")
        /* Maintainer: Byron Bradley <byron.bbradley@gmail.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = qnap_ts209_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -11,7 -11,7 +11,7 @@@
   * as published by the Free Software Foundation; either version
   * 2 of the License, or (at your option) any later version.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -25,6 -25,7 +25,6 @@@
  #include <linux/i2c.h>
  #include <linux/serial_reg.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -311,7 -312,7 +311,7 @@@ static void __init qnap_ts409_init(void
  
  MACHINE_START(TS409, "QNAP TS-409")
        /* Maintainer:  Sylver Bruneau <sylver.bruneau@gmail.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = qnap_ts409_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -5,7 -5,7 +5,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -17,6 -17,7 +17,6 @@@
  #include <linux/ethtool.h>
  #include <net/dsa.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -172,7 -173,7 +172,7 @@@ subsys_initcall(wnr854t_pci_init)
  
  MACHINE_START(WNR854T, "Netgear WNR854T")
        /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = wnr854t_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -5,7 -5,7 +5,7 @@@
   * License version 2.  This program is licensed "as is" without any
   * warranty of any kind, whether express or implied.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/input.h>
  #include <net/dsa.h>
  #include <asm/mach-types.h>
 -#include <asm/gpio.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/pci.h>
  #include <mach/orion5x.h>
@@@ -260,7 -261,7 +260,7 @@@ subsys_initcall(wrt350n_v2_pci_init)
  
  MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
        /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .init_machine   = wrt350n_v2_init,
        .map_io         = orion5x_map_io,
        .init_early     = orion5x_init_early,
@@@ -839,8 -839,8 +839,8 @@@ static void __init cm_x300_init(void
        cm_x300_init_bl();
  }
  
 -static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags,
 -                               char **cmdline, struct meminfo *mi)
 +static void __init cm_x300_fixup(struct tag *tags, char **cmdline,
 +                               struct meminfo *mi)
  {
        /* Make sure that mi->bank[0].start = PHYS_ADDR */
        for (; tags->hdr.size; tags = tag_next(tags))
  }
  
  MACHINE_START(CM_X300, "CM-X300 module")
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa3xx_map_io,
        .init_irq       = pxa3xx_init_irq,
        .handle_irq     = pxa3xx_handle_irq,
@@@ -41,7 -41,8 +41,7 @@@
  #include "clock.h"
  
  /* Only e800 has 128MB RAM */
 -void __init eseries_fixup(struct machine_desc *desc,
 -      struct tag *tags, char **cmdline, struct meminfo *mi)
 +void __init eseries_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
        mi->nr_banks=1;
        mi->bank[0].start = 0xa0000000;
@@@ -188,7 -189,7 +188,7 @@@ static void __init e330_init(void
  
  MACHINE_START(E330, "Toshiba e330")
        /* Maintainer: Ian Molton (spyro@f2s.com) */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa25x_map_io,
        .nr_irqs        = ESERIES_NR_IRQS,
        .init_irq       = pxa25x_init_irq,
@@@ -238,7 -239,7 +238,7 @@@ static void __init e350_init(void
  
  MACHINE_START(E350, "Toshiba e350")
        /* Maintainer: Ian Molton (spyro@f2s.com) */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa25x_map_io,
        .nr_irqs        = ESERIES_NR_IRQS,
        .init_irq       = pxa25x_init_irq,
@@@ -361,7 -362,7 +361,7 @@@ static void __init e400_init(void
  
  MACHINE_START(E400, "Toshiba e400")
        /* Maintainer: Ian Molton (spyro@f2s.com) */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa25x_map_io,
        .nr_irqs        = ESERIES_NR_IRQS,
        .init_irq       = pxa25x_init_irq,
@@@ -550,7 -551,7 +550,7 @@@ static void __init e740_init(void
  
  MACHINE_START(E740, "Toshiba e740")
        /* Maintainer: Ian Molton (spyro@f2s.com) */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa25x_map_io,
        .nr_irqs        = ESERIES_NR_IRQS,
        .init_irq       = pxa25x_init_irq,
@@@ -742,7 -743,7 +742,7 @@@ static void __init e750_init(void
  
  MACHINE_START(E750, "Toshiba e750")
        /* Maintainer: Ian Molton (spyro@f2s.com) */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa25x_map_io,
        .nr_irqs        = ESERIES_NR_IRQS,
        .init_irq       = pxa25x_init_irq,
@@@ -947,7 -948,7 +947,7 @@@ static void __init e800_init(void
  
  MACHINE_START(E800, "Toshiba e800")
        /* Maintainer: Ian Molton (spyro@f2s.com) */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa25x_map_io,
        .nr_irqs        = ESERIES_NR_IRQS,
        .init_irq       = pxa25x_init_irq,
@@@ -12,7 -12,7 +12,7 @@@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/syscore_ops.h>
@@@ -39,6 -39,7 +39,6 @@@
  #include <asm/mach/flash.h>
  
  #include <mach/pxa27x.h>
 -#include <mach/gpio.h>
  #include <mach/lpd270.h>
  #include <mach/audio.h>
  #include <mach/pxafb.h>
@@@ -498,7 -499,7 +498,7 @@@ static void __init lpd270_map_io(void
  
  MACHINE_START(LOGICPD_PXA270, "LogicPD PXA270 Card Engine")
        /* Maintainer: Peter Barada */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = lpd270_map_io,
        .nr_irqs        = LPD270_NR_IRQS,
        .init_irq       = lpd270_init_irq,
@@@ -12,7 -12,7 +12,7 @@@
   *  it under the terms of the GNU General Public License version 2 as
   *  published by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/syscore_ops.h>
@@@ -43,6 -43,7 +43,6 @@@
  #include <asm/mach/flash.h>
  
  #include <mach/pxa27x.h>
 -#include <mach/gpio.h>
  #include <mach/mainstone.h>
  #include <mach/audio.h>
  #include <mach/pxafb.h>
@@@ -615,7 -616,7 +615,7 @@@ static void __init mainstone_map_io(voi
  
  MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
        /* Maintainer: MontaVista Software Inc. */
-       .boot_params    = 0xa0000100,   /* BLOB boot parameter setting */
+       .atag_offset    = 0x100,        /* BLOB boot parameter setting */
        .map_io         = mainstone_map_io,
        .nr_irqs        = MAINSTONE_NR_IRQS,
        .init_irq       = mainstone_init_irq,
diff --combined arch/arm/mach-pxa/saar.c
@@@ -540,7 -540,7 +540,7 @@@ static struct mtd_partition saar_onenan
        }, {
                .name           = "filesystem",
                .offset         = MTDPART_OFS_APPEND,
 -              .size           = SZ_48M,
 +              .size           = SZ_32M + SZ_16M,
                .mask_flags     = 0,
        }
  };
@@@ -596,7 -596,7 +596,7 @@@ static void __init saar_init(void
  
  MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)")
        /* Maintainer: Eric Miao <eric.miao@marvell.com> */
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa3xx_map_io,
        .init_irq       = pxa3xx_init_irq,
        .handle_irq       = pxa3xx_handle_irq,
@@@ -9,13 -9,12 +9,13 @@@
   *  it under the terms of the GNU General Public License version 2 as
   *  publishhed by the Free Software Foundation.
   */
 -
 +#include <linux/gpio.h>
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include <linux/i2c.h>
  #include <linux/i2c/pxa-i2c.h>
  #include <linux/mfd/88pm860x.h>
 +#include <linux/gpio.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -24,6 -23,7 +24,6 @@@
  #include <mach/hardware.h>
  #include <mach/mfp.h>
  #include <mach/mfp-pxa930.h>
 -#include <mach/gpio.h>
  
  #include "generic.h"
  
@@@ -103,7 -103,7 +103,7 @@@ static void __init saarb_init(void
  }
  
  MACHINE_START(SAARB, "PXA955 Handheld Platform (aka SAARB)")
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .map_io         = pxa3xx_map_io,
        .nr_irqs        = SAARB_NR_IRQS,
        .init_irq       = pxa95x_init_irq,
diff --combined arch/arm/mach-pxa/xcep.c
@@@ -142,7 -142,8 +142,7 @@@ static struct platform_device *devices[
  
  /* We have to state that there are HWMON devices on the I2C bus on XCEP.
   * Drivers for HWMON verify capabilities of the adapter when loading and
 - * refuse to attach if the adapter doesn't support HWMON class of devices.
 - * See also Documentation/i2c/porting-clients. */
 + * refuse to attach if the adapter doesn't support HWMON class of devices. */
  static struct i2c_pxa_platform_data xcep_i2c_platform_data  = {
        .class = I2C_CLASS_HWMON
  };
@@@ -179,7 -180,7 +179,7 @@@ static void __init xcep_init(void
  }
  
  MACHINE_START(XCEP, "Iskratel XCEP")
-       .boot_params    = 0xa0000100,
+       .atag_offset    = 0x100,
        .init_machine   = xcep_init,
        .map_io         = pxa25x_map_io,
        .init_irq       = pxa25x_init_irq,
@@@ -26,8 -26,6 +26,8 @@@
  #include <linux/amba/pl061.h>
  #include <linux/amba/mmci.h>
  #include <linux/amba/pl022.h>
 +#include <linux/mtd/physmap.h>
 +#include <linux/mtd/partitions.h>
  #include <linux/io.h>
  
  #include <mach/hardware.h>
@@@ -206,48 -204,22 +206,48 @@@ static struct amba_device *amba_devs[] 
   * RealView PB1176 platform devices
   */
  static struct resource realview_pb1176_flash_resources[] = {
 -      [0] = {
 +      {
                .start          = REALVIEW_PB1176_FLASH_BASE,
                .end            = REALVIEW_PB1176_FLASH_BASE + REALVIEW_PB1176_FLASH_SIZE - 1,
                .flags          = IORESOURCE_MEM,
        },
 -      [1] = {
 +#ifdef CONFIG_REALVIEW_PB1176_SECURE_FLASH
 +      {
                .start          = REALVIEW_PB1176_SEC_FLASH_BASE,
                .end            = REALVIEW_PB1176_SEC_FLASH_BASE + REALVIEW_PB1176_SEC_FLASH_SIZE - 1,
                .flags          = IORESOURCE_MEM,
        },
 -};
 -#ifdef CONFIG_REALVIEW_PB1176_SECURE_FLASH
 -#define PB1176_FLASH_BLOCKS   2
 -#else
 -#define PB1176_FLASH_BLOCKS   1
  #endif
 +};
 +
 +static struct physmap_flash_data pb1176_rom_pdata = {
 +      .probe_type     = "map_rom",
 +      .width          = 4,
 +      .nr_parts       = 0,
 +};
 +
 +static struct resource pb1176_rom_resources[] = {
 +      /*
 +       * This exposes the PB1176 DevChip ROM as an MTD ROM mapping.
 +       * The reference manual states that this is actually a pseudo-ROM
 +       * programmed in NVRAM.
 +       */
 +      {
 +              .start          = REALVIEW_DC1176_ROM_BASE,
 +              .end            = REALVIEW_DC1176_ROM_BASE + SZ_16K - 1,
 +              .flags          = IORESOURCE_MEM,
 +      }
 +};
 +
 +static struct platform_device pb1176_rom_device = {
 +      .name           = "physmap-flash",
 +      .id             = -1,
 +      .num_resources  = ARRAY_SIZE(pb1176_rom_resources),
 +      .resource       = pb1176_rom_resources,
 +      .dev = {
 +              .platform_data = &pb1176_rom_pdata,
 +      },
 +};
  
  static struct resource realview_pb1176_smsc911x_resources[] = {
        [0] = {
@@@ -344,7 -316,8 +344,7 @@@ static void realview_pb1176_reset(char 
        __raw_writel(REALVIEW_PB1176_SYS_SOFT_RESET, reset_ctrl);
  }
  
 -static void realview_pb1176_fixup(struct machine_desc *mdesc,
 -                                struct tag *tags, char **from,
 +static void realview_pb1176_fixup(struct tag *tags, char **from,
                                  struct meminfo *meminfo)
  {
        /*
@@@ -365,8 -338,7 +365,8 @@@ static void __init realview_pb1176_init
  #endif
  
        realview_flash_register(realview_pb1176_flash_resources,
 -                              PB1176_FLASH_BLOCKS);
 +                              ARRAY_SIZE(realview_pb1176_flash_resources));
 +      platform_device_register(&pb1176_rom_device);
        realview_eth_register(NULL, realview_pb1176_smsc911x_resources);
        platform_device_register(&realview_i2c_device);
        realview_usb_register(realview_pb1176_isp1761_resources);
  
  MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
        /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
-       .boot_params    = PLAT_PHYS_OFFSET + 0x00000100,
+       .atag_offset    = 0x100,
        .fixup          = realview_pb1176_fixup,
        .map_io         = realview_pb1176_map_io,
        .init_early     = realview_init_early,
@@@ -319,8 -319,8 +319,8 @@@ static struct sys_timer realview_pbx_ti
        .init           = realview_pbx_timer_init,
  };
  
 -static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags,
 -                             char **from, struct meminfo *meminfo)
 +static void realview_pbx_fixup(struct tag *tags, char **from,
 +                             struct meminfo *meminfo)
  {
  #ifdef CONFIG_SPARSEMEM
        /*
        meminfo->bank[2].size = SZ_256M;
        meminfo->nr_banks = 3;
  #else
 -      realview_fixup(mdesc, tags, from, meminfo);
 +      realview_fixup(tags, from, meminfo);
  #endif
  }
  
@@@ -393,7 -393,7 +393,7 @@@ static void __init realview_pbx_init(vo
  
  MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
        /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
-       .boot_params    = PLAT_PHYS_OFFSET + 0x00000100,
+       .atag_offset    = 0x100,
        .fixup          = realview_pbx_fixup,
        .map_io         = realview_pbx_map_io,
        .init_early     = realview_init_early,
@@@ -74,7 -74,7 +74,7 @@@ static struct map_desc rpc_io_desc[] __
                .length         =       IO_SIZE  ,
                .type           = MT_DEVICE
        }, {    /* EASI space   */
 -              .virtual        = EASI_BASE,
 +              .virtual        = (unsigned long)EASI_BASE,
                .pfn            = __phys_to_pfn(EASI_START),
                .length         = EASI_SIZE,
                .type           = MT_DEVICE
@@@ -218,7 -218,7 +218,7 @@@ extern struct sys_timer ioc_timer
  
  MACHINE_START(RISCPC, "Acorn-RiscPC")
        /* Maintainer: Russell King */
-       .boot_params    = 0x10000100,
+       .atag_offset    = 0x100,
        .reserve_lp0    = 1,
        .reserve_lp1    = 1,
        .map_io         = rpc_map_io,
@@@ -92,7 -92,8 +92,7 @@@ static struct platform_device *smdk2413
        &s3c_device_usbgadget,
  };
  
 -static void __init smdk2413_fixup(struct machine_desc *desc,
 -                                struct tag *tags, char **cmdline,
 +static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
                                  struct meminfo *mi)
  {
        if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
@@@ -127,7 -128,7 +127,7 @@@ static void __init smdk2413_machine_ini
  
  MACHINE_START(S3C2413, "S3C2413")
        /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .boot_params    = S3C2410_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
  
        .fixup          = smdk2413_fixup,
        .init_irq       = s3c24xx_init_irq,
@@@ -138,7 -139,7 +138,7 @@@ MACHINE_EN
  
  MACHINE_START(SMDK2412, "SMDK2412")
        /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .boot_params    = S3C2410_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
  
        .fixup          = smdk2413_fixup,
        .init_irq       = s3c24xx_init_irq,
@@@ -149,7 -150,7 +149,7 @@@ MACHINE_EN
  
  MACHINE_START(SMDK2413, "SMDK2413")
        /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .boot_params    = S3C2410_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
  
        .fixup          = smdk2413_fixup,
        .init_irq       = s3c24xx_init_irq,
@@@ -129,8 -129,9 +129,8 @@@ static struct platform_device *vstms_de
        &s3c_device_nand,
  };
  
 -static void __init vstms_fixup(struct machine_desc *desc,
 -                                struct tag *tags, char **cmdline,
 -                                struct meminfo *mi)
 +static void __init vstms_fixup(struct tag *tags, char **cmdline,
 +                             struct meminfo *mi)
  {
        if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
                mi->nr_banks=1;
@@@ -155,7 -156,7 +155,7 @@@ static void __init vstms_init(void
  }
  
  MACHINE_START(VSTMS, "VSTMS")
-       .boot_params    = S3C2410_SDRAM_PA + 0x100,
+       .atag_offset    = 0x100,
  
        .fixup          = vstms_fixup,
        .init_irq       = s3c24xx_init_irq,
@@@ -262,6 -262,45 +262,6 @@@ static struct samsung_keypad_platdata s
        .cols           = 8,
  };
  
 -static int smdk6410_backlight_init(struct device *dev)
 -{
 -      int ret;
 -
 -      ret = gpio_request(S3C64XX_GPF(15), "Backlight");
 -      if (ret) {
 -              printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
 -              return ret;
 -      }
 -
 -      /* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */
 -      s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
 -
 -      return 0;
 -}
 -
 -static void smdk6410_backlight_exit(struct device *dev)
 -{
 -      s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT);
 -      gpio_free(S3C64XX_GPF(15));
 -}
 -
 -static struct platform_pwm_backlight_data smdk6410_backlight_data = {
 -      .pwm_id         = 1,
 -      .max_brightness = 255,
 -      .dft_brightness = 255,
 -      .pwm_period_ns  = 78770,
 -      .init           = smdk6410_backlight_init,
 -      .exit           = smdk6410_backlight_exit,
 -};
 -
 -static struct platform_device smdk6410_backlight_device = {
 -      .name           = "pwm-backlight",
 -      .dev            = {
 -              .parent         = &s3c_device_timer[1].dev,
 -              .platform_data  = &smdk6410_backlight_data,
 -      },
 -};
 -
  static struct map_desc smdk6410_iodesc[] = {};
  
  static struct platform_device *smdk6410_devices[] __initdata = {
@@@ -703,7 -742,7 +703,7 @@@ static void __init smdk6410_machine_ini
  
  MACHINE_START(SMDK6410, "SMDK6410")
        /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
-       .boot_params    = S3C64XX_PA_SDRAM + 0x100,
+       .atag_offset    = 0x100,
  
        .init_irq       = s3c6410_init_irq,
        .map_io         = smdk6410_map_io,
@@@ -301,7 -301,8 +301,7 @@@ static void __init get_assabet_scr(void
  }
  
  static void __init
 -fixup_assabet(struct machine_desc *desc, struct tag *tags,
 -            char **cmdline, struct meminfo *mi)
 +fixup_assabet(struct tag *tags, char **cmdline, struct meminfo *mi)
  {
        /* This must be done before any call to machine_has_neponset() */
        map_sa1100_gpio_regs();
@@@ -446,7 -447,7 +446,7 @@@ static void __init assabet_map_io(void
  
  
  MACHINE_START(ASSABET, "Intel-Assabet")
-       .boot_params    = 0xc0000100,
+       .atag_offset    = 0x100,
        .fixup          = fixup_assabet,
        .map_io         = assabet_map_io,
        .init_irq       = sa1100_init_irq,
@@@ -13,7 -13,6 +13,7 @@@
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
  #include <linux/io.h>
 +#include <linux/gpio.h>
  
  #include <asm/irq.h>
  #include <mach/hardware.h>
  
  #include <linux/serial_core.h>
  #include <linux/ioport.h>
 +#include <linux/input.h>
 +#include <linux/gpio_keys.h>
 +#include <linux/leds.h>
 +#include <linux/i2c-gpio.h>
  
  #include "generic.h"
  
 -long cs3_shadow;
 +/*
 + * CS3 support
 + */
  
 -long get_cs3_shadow(void)
 +static long cs3_shadow;
 +static spinlock_t cs3_lock;
 +static struct gpio_chip cs3_gpio;
 +
 +long simpad_get_cs3_ro(void)
 +{
 +      return readl(CS3_BASE);
 +}
 +EXPORT_SYMBOL(simpad_get_cs3_ro);
 +
 +long simpad_get_cs3_shadow(void)
  {
        return cs3_shadow;
  }
 +EXPORT_SYMBOL(simpad_get_cs3_shadow);
  
 -void set_cs3(long value)
 +static void __simpad_write_cs3(void)
  {
 -      *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow = value;
 +      writel(cs3_shadow, CS3_BASE);
  }
  
 -void set_cs3_bit(int value)
 +void simpad_set_cs3_bit(int value)
  {
 +      unsigned long flags;
 +
 +      spin_lock_irqsave(&cs3_lock, flags);
        cs3_shadow |= value;
 -      *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;
 +      __simpad_write_cs3();
 +      spin_unlock_irqrestore(&cs3_lock, flags);
  }
 +EXPORT_SYMBOL(simpad_set_cs3_bit);
  
 -void clear_cs3_bit(int value)
 +void simpad_clear_cs3_bit(int value)
  {
 +      unsigned long flags;
 +
 +      spin_lock_irqsave(&cs3_lock, flags);
        cs3_shadow &= ~value;
 -      *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow;
 +      __simpad_write_cs3();
 +      spin_unlock_irqrestore(&cs3_lock, flags);
  }
 +EXPORT_SYMBOL(simpad_clear_cs3_bit);
 +
 +static void cs3_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 +{
 +      if (offset > 15)
 +              return;
 +      if (value)
 +              simpad_set_cs3_bit(1 << offset);
 +      else
 +              simpad_clear_cs3_bit(1 << offset);
 +};
 +
 +static int cs3_gpio_get(struct gpio_chip *chip, unsigned offset)
 +{
 +      if (offset > 15)
 +              return simpad_get_cs3_ro() & (1 << (offset - 16));
 +      return simpad_get_cs3_shadow() & (1 << offset);
 +};
  
 -EXPORT_SYMBOL(set_cs3_bit);
 -EXPORT_SYMBOL(clear_cs3_bit);
 +static int cs3_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 +{
 +      if (offset > 15)
 +              return 0;
 +      return -EINVAL;
 +};
 +
 +static int cs3_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
 +      int value)
 +{
 +      if (offset > 15)
 +              return -EINVAL;
 +      cs3_gpio_set(chip, offset, value);
 +      return 0;
 +};
  
  static struct map_desc simpad_io_desc[] __initdata = {
        {       /* MQ200 */
                .pfn            = __phys_to_pfn(0x4b800000),
                .length         = 0x00800000,
                .type           = MT_DEVICE
 -      }, {    /* Paules CS3, write only */
 -              .virtual        =  0xf1000000,
 -              .pfn            = __phys_to_pfn(0x18000000),
 +      }, {    /* Simpad CS3 */
 +              .virtual        = CS3_BASE,
 +              .pfn            = __phys_to_pfn(SA1100_CS3_PHYS),
                .length         = 0x00100000,
                .type           = MT_DEVICE
        },
@@@ -136,12 -78,12 +136,12 @@@ static void simpad_uart_pm(struct uart_
        if (port->mapbase == (u_int)&Ser1UTCR0) {
                if (state)
                {
 -                      clear_cs3_bit(RS232_ON);
 -                      clear_cs3_bit(DECT_POWER_ON);
 +                      simpad_clear_cs3_bit(RS232_ON);
 +                      simpad_clear_cs3_bit(DECT_POWER_ON);
                }else
                {
 -                      set_cs3_bit(RS232_ON);
 -                      set_cs3_bit(DECT_POWER_ON);
 +                      simpad_set_cs3_bit(RS232_ON);
 +                      simpad_set_cs3_bit(DECT_POWER_ON);
                }
        }
  }
@@@ -190,7 -132,6 +190,7 @@@ static struct resource simpad_flash_res
  static struct mcp_plat_data simpad_mcp_data = {
        .mccr0          = MCCR0_ADM,
        .sclk_rate      = 11981000,
 +      .gpio_base      = SIMPAD_UCB1X00_GPIO_BASE,
  };
  
  
@@@ -201,10 -142,9 +201,10 @@@ static void __init simpad_map_io(void
  
        iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc));
  
 -      set_cs3_bit (EN1 | EN0 | LED2_ON | DISPLAY_ON | RS232_ON |
 -                    ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
 -
 +      /* Initialize CS3 */
 +      cs3_shadow = (EN1 | EN0 | LED2_ON | DISPLAY_ON |
 +              RS232_ON | ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
 +      __simpad_write_cs3(); /* Spinlocks not yet initialized */
  
          sa1100_register_uart_fns(&simpad_port_fns);
        sa1100_register_uart(0, 3);  /* serial interface */
  
  static void simpad_power_off(void)
  {
 -      local_irq_disable(); // was cli
 -      set_cs3(0x800);        /* only SD_MEDIAQ */
 +      local_irq_disable();
 +      cs3_shadow = SD_MEDIAQ;
 +      __simpad_write_cs3(); /* Bypass spinlock here */
  
        /* disable internal oscillator, float CS lines */
        PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS);
 -      /* enable wake-up on GPIO0 (Assabet...) */
 -      PWER = GFER = GRER = 1;
 +      /* enable wake-up on GPIO0 */
 +      PWER = GFER = GRER = PWER_GPIO0;
        /*
         * set scratchpad to zero, just in case it is used as a
         * restart address by the bootloader.
  
  }
  
 +/*
 + * gpio_keys
 +*/
 +
 +static struct gpio_keys_button simpad_button_table[] = {
 +      { KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" },
 +};
 +
 +static struct gpio_keys_platform_data simpad_keys_data = {
 +      .buttons = simpad_button_table,
 +      .nbuttons = ARRAY_SIZE(simpad_button_table),
 +};
 +
 +static struct platform_device simpad_keys = {
 +      .name = "gpio-keys",
 +      .dev = {
 +              .platform_data = &simpad_keys_data,
 +      },
 +};
 +
 +static struct gpio_keys_button simpad_polled_button_table[] = {
 +      { KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" },
 +      { KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" },
 +      { KEY_UP,    SIMPAD_UCB1X00_GPIO_UP,    1, "up button" },
 +      { KEY_DOWN,  SIMPAD_UCB1X00_GPIO_DOWN,  1, "down button" },
 +      { KEY_LEFT,  SIMPAD_UCB1X00_GPIO_LEFT,  1, "left button" },
 +      { KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" },
 +};
 +
 +static struct gpio_keys_platform_data simpad_polled_keys_data = {
 +      .buttons = simpad_polled_button_table,
 +      .nbuttons = ARRAY_SIZE(simpad_polled_button_table),
 +      .poll_interval = 50,
 +};
 +
 +static struct platform_device simpad_polled_keys = {
 +      .name = "gpio-keys-polled",
 +      .dev = {
 +              .platform_data = &simpad_polled_keys_data,
 +      },
 +};
 +
 +/*
 + * GPIO LEDs
 + */
 +
 +static struct gpio_led simpad_leds[] = {
 +      {
 +              .name = "simpad:power",
 +              .gpio = SIMPAD_CS3_LED2_ON,
 +              .active_low = 0,
 +              .default_trigger = "default-on",
 +      },
 +};
 +
 +static struct gpio_led_platform_data simpad_led_data = {
 +      .num_leds = ARRAY_SIZE(simpad_leds),
 +      .leds = simpad_leds,
 +};
 +
 +static struct platform_device simpad_gpio_leds = {
 +      .name = "leds-gpio",
 +      .id = 0,
 +      .dev = {
 +              .platform_data = &simpad_led_data,
 +      },
 +};
 +
 +/*
 + * i2c
 + */
 +static struct i2c_gpio_platform_data simpad_i2c_data = {
 +      .sda_pin = GPIO_GPIO21,
 +      .scl_pin = GPIO_GPIO25,
 +      .udelay = 10,
 +      .timeout = HZ,
 +};
 +
 +static struct platform_device simpad_i2c = {
 +      .name = "i2c-gpio",
 +      .id = 0,
 +      .dev = {
 +              .platform_data = &simpad_i2c_data,
 +      },
 +};
  
  /*
   * MediaQ Video Device
@@@ -348,11 -202,7 +348,11 @@@ static struct platform_device simpad_mq
  };
  
  static struct platform_device *devices[] __initdata = {
 -      &simpad_mq200fb
 +      &simpad_keys,
 +      &simpad_polled_keys,
 +      &simpad_mq200fb,
 +      &simpad_gpio_leds,
 +      &simpad_i2c,
  };
  
  
@@@ -361,19 -211,6 +361,19 @@@ static int __init simpad_init(void
  {
        int ret;
  
 +      spin_lock_init(&cs3_lock);
 +
 +      cs3_gpio.label = "simpad_cs3";
 +      cs3_gpio.base = SIMPAD_CS3_GPIO_BASE;
 +      cs3_gpio.ngpio = 24;
 +      cs3_gpio.set = cs3_gpio_set;
 +      cs3_gpio.get = cs3_gpio_get;
 +      cs3_gpio.direction_input = cs3_gpio_direction_input;
 +      cs3_gpio.direction_output = cs3_gpio_direction_output;
 +      ret = gpiochip_add(&cs3_gpio);
 +      if (ret)
 +              printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 +
        pm_power_off = simpad_power_off;
  
        sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
@@@ -392,7 -229,7 +392,7 @@@ arch_initcall(simpad_init)
  
  MACHINE_START(SIMPAD, "Simpad")
        /* Maintainer: Holger Freyther */
-       .boot_params    = 0xc0000100,
+       .atag_offset    = 0x100,
        .map_io         = simpad_map_io,
        .init_irq       = sa1100_init_irq,
        .timer          = &sa1100_timer,
@@@ -42,7 -42,7 +42,8 @@@
  #include <linux/leds.h>
  #include <linux/input/sh_keysc.h>
  #include <linux/usb/r8a66597.h>
 +#include <linux/pm_clock.h>
+ #include <linux/dma-mapping.h>
  
  #include <media/sh_mobile_ceu.h>
  #include <media/sh_mobile_csi2.h>
@@@ -1171,6 -1171,8 +1172,8 @@@ static struct map_desc ap4evb_io_desc[
  static void __init ap4evb_map_io(void)
  {
        iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
+       /* DMA memory at 0xf6000000 - 0xffdfffff */
+       init_consistent_dma_size(158 << 20);
  
        /* setup early devices and console here as well */
        sh7372_add_early_devices();
@@@ -1409,11 -1411,6 +1412,11 @@@ static void __init ap4evb_init(void
        sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
        sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
  
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
 +      sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
 +
        hdmi_init_pm_clock();
        fsi_init_pm_clock();
        sh7372_pm_init();
  #include <linux/mtd/mtd.h>
  #include <linux/mtd/partitions.h>
  #include <linux/mtd/physmap.h>
 -#include <linux/pm_runtime.h>
 +#include <linux/pm_clock.h>
  #include <linux/smsc911x.h>
  #include <linux/sh_intc.h>
  #include <linux/tca6416_keypad.h>
  #include <linux/usb/r8a66597.h>
  #include <linux/usb/renesas_usbhs.h>
+ #include <linux/dma-mapping.h>
  
  #include <video/sh_mobile_hdmi.h>
  #include <video/sh_mobile_lcdc.h>
@@@ -810,7 -811,6 +811,7 @@@ static struct usbhs_private usbhs1_priv
                },
                .driver_param = {
                        .buswait_bwait  = 4,
 +                      .has_otg        = 1,
                        .pipe_type      = usbhs1_pipe_cfg,
                        .pipe_size      = ARRAY_SIZE(usbhs1_pipe_cfg),
                        .d0_tx_id       = SHDMA_SLAVE_USB1_TX,
@@@ -1382,6 -1382,8 +1383,8 @@@ static struct map_desc mackerel_io_desc
  static void __init mackerel_map_io(void)
  {
        iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
+       /* DMA memory at 0xf6000000 - 0xffdfffff */
+       init_consistent_dma_size(158 << 20);
  
        /* setup early devices and console here as well */
        sh7372_add_early_devices();
@@@ -1589,15 -1591,6 +1592,15 @@@ static void __init mackerel_init(void
        sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
        sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_lcdc_device);
        sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs0_device);
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs1_device);
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
 +#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
 +#endif
 +      sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi2_device);
 +      sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
  
        hdmi_init_pm_clock();
        sh7372_pm_init();
@@@ -123,8 -123,8 +123,8 @@@ static struct platform_device *harmony_
        &harmony_audio_device,
  };
  
 -static void __init tegra_harmony_fixup(struct machine_desc *desc,
 -      struct tag *tags, char **cmdline, struct meminfo *mi)
 +static void __init tegra_harmony_fixup(struct tag *tags, char **cmdline,
 +      struct meminfo *mi)
  {
        mi->nr_banks = 2;
        mi->bank[0].start = PHYS_OFFSET;
@@@ -179,7 -179,7 +179,7 @@@ static void __init tegra_harmony_init(v
  }
  
  MACHINE_START(HARMONY, "harmony")
-       .boot_params  = 0x00000100,
+       .atag_offset    = 0x100,
        .fixup          = tegra_harmony_fixup,
        .map_io         = tegra_map_common_io,
        .init_early     = tegra_init_early,
@@@ -84,8 -84,8 +84,8 @@@ static void paz00_usb_init(void
        platform_device_register(&tegra_ehci3_device);
  }
  
 -static void __init tegra_paz00_fixup(struct machine_desc *desc,
 -      struct tag *tags, char **cmdline, struct meminfo *mi)
 +static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
 +      struct meminfo *mi)
  {
        mi->nr_banks = 1;
        mi->bank[0].start = PHYS_OFFSET;
@@@ -127,7 -127,7 +127,7 @@@ static void __init tegra_paz00_init(voi
  }
  
  MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .fixup          = tegra_paz00_fixup,
        .map_io         = tegra_map_common_io,
        .init_early     = tegra_init_early,
@@@ -126,8 -126,8 +126,8 @@@ static void trimslice_usb_init(void
        platform_device_register(&tegra_ehci1_device);
  }
  
 -static void __init tegra_trimslice_fixup(struct machine_desc *desc,
 -      struct tag *tags, char **cmdline, struct meminfo *mi)
 +static void __init tegra_trimslice_fixup(struct tag *tags, char **cmdline,
 +      struct meminfo *mi)
  {
        mi->nr_banks = 2;
        mi->bank[0].start = PHYS_OFFSET;
@@@ -171,7 -171,7 +171,7 @@@ static void __init tegra_trimslice_init
  }
  
  MACHINE_START(TRIMSLICE, "trimslice")
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .fixup          = tegra_trimslice_fixup,
        .map_io         = tegra_map_common_io,
        .init_early     = tegra_init_early,
@@@ -25,8 -25,7 +25,9 @@@
  #include <linux/err.h>
  #include <linux/mtd/nand.h>
  #include <linux/mtd/fsmc.h>
 +#include <linux/pinctrl/machine.h>
 +#include <linux/pinctrl/pinmux.h>
+ #include <linux/dma-mapping.h>
  
  #include <asm/types.h>
  #include <asm/setup.h>
@@@ -39,7 -38,6 +40,7 @@@
  #include <mach/hardware.h>
  #include <mach/syscon.h>
  #include <mach/dma_channels.h>
 +#include <mach/gpio-u300.h>
  
  #include "clock.h"
  #include "mmc.h"
@@@ -95,6 -93,8 +96,8 @@@ static struct map_desc u300_io_desc[] _
  void __init u300_map_io(void)
  {
        iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc));
+       /* We enable a real big DMA buffer if need be. */
+       init_consistent_dma_size(SZ_4M);
  }
  
  /*
@@@ -242,7 -242,7 +245,7 @@@ static struct resource gpio_resources[
                .end   = IRQ_U300_GPIO_PORT2,
                .flags = IORESOURCE_IRQ,
        },
 -#ifdef U300_COH901571_3
 +#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
        {
                .name  = "gpio3",
                .start = IRQ_U300_GPIO_PORT3,
                .end   = IRQ_U300_GPIO_PORT4,
                .flags = IORESOURCE_IRQ,
        },
 +#endif
  #ifdef CONFIG_MACH_U300_BS335
        {
                .name  = "gpio5",
                .flags = IORESOURCE_IRQ,
        },
  #endif /* CONFIG_MACH_U300_BS335 */
 -#endif /* U300_COH901571_3 */
  };
  
  static struct resource keypad_resources[] = {
@@@ -1538,14 -1538,6 +1541,14 @@@ static struct coh901318_platform coh901
        .max_channels = U300_DMA_CHANNELS,
  };
  
 +static struct resource pinmux_resources[] = {
 +      {
 +              .start = U300_SYSCON_BASE,
 +              .end   = U300_SYSCON_BASE + SZ_4K - 1,
 +              .flags = IORESOURCE_MEM,
 +      },
 +};
 +
  static struct platform_device wdog_device = {
        .name = "coh901327_wdog",
        .id = -1,
@@@ -1567,35 -1559,11 +1570,35 @@@ static struct platform_device i2c1_devi
        .resource = i2c1_resources,
  };
  
 +/*
 + * The different variants have a few different versions of the
 + * GPIO block, with different number of ports.
 + */
 +static struct u300_gpio_platform u300_gpio_plat = {
 +#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
 +      .variant = U300_GPIO_COH901335,
 +      .ports = 3,
 +#endif
 +#ifdef CONFIG_MACH_U300_BS335
 +      .variant = U300_GPIO_COH901571_3_BS335,
 +      .ports = 7,
 +#endif
 +#ifdef CONFIG_MACH_U300_BS365
 +      .variant = U300_GPIO_COH901571_3_BS365,
 +      .ports = 5,
 +#endif
 +      .gpio_base = 0,
 +      .gpio_irq_base = IRQ_U300_GPIO_BASE,
 +};
 +
  static struct platform_device gpio_device = {
        .name = "u300-gpio",
        .id = -1,
        .num_resources = ARRAY_SIZE(gpio_resources),
        .resource = gpio_resources,
 +      .dev = {
 +              .platform_data = &u300_gpio_plat,
 +      },
  };
  
  static struct platform_device keypad_device = {
@@@ -1665,72 -1633,6 +1668,72 @@@ static struct platform_device dma_devic
        },
  };
  
 +static struct platform_device pinmux_device = {
 +      .name = "pinmux-u300",
 +      .id = -1,
 +      .num_resources = ARRAY_SIZE(pinmux_resources),
 +      .resource = pinmux_resources,
 +};
 +
 +/* Pinmux settings */
 +static struct pinmux_map u300_pinmux_map[] = {
 +      /* anonymous maps for chip power and EMIFs */
 +      PINMUX_MAP_PRIMARY_SYS_HOG("POWER", "power"),
 +      PINMUX_MAP_PRIMARY_SYS_HOG("EMIF0", "emif0"),
 +      PINMUX_MAP_PRIMARY_SYS_HOG("EMIF1", "emif1"),
 +      /* per-device maps for MMC/SD, SPI and UART */
 +      PINMUX_MAP_PRIMARY("MMCSD", "mmc0", "mmci"),
 +      PINMUX_MAP_PRIMARY("SPI", "spi0", "pl022"),
 +      PINMUX_MAP_PRIMARY("UART0", "uart0", "uart0"),
 +};
 +
 +struct u300_mux_hog {
 +      const char *name;
 +      struct device *dev;
 +      struct pinmux *pmx;
 +};
 +
 +static struct u300_mux_hog u300_mux_hogs[] = {
 +      {
 +              .name = "uart0",
 +              .dev = &uart0_device.dev,
 +      },
 +      {
 +              .name = "spi0",
 +              .dev = &pl022_device.dev,
 +      },
 +      {
 +              .name = "mmc0",
 +              .dev = &mmcsd_device.dev,
 +      },
 +};
 +
 +static int __init u300_pinmux_fetch(void)
 +{
 +      int i;
 +
 +      for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
 +              struct pinmux *pmx;
 +              int ret;
 +
 +              pmx = pinmux_get(u300_mux_hogs[i].dev, NULL);
 +              if (IS_ERR(pmx)) {
 +                      pr_err("u300: could not get pinmux hog %s\n",
 +                             u300_mux_hogs[i].name);
 +                      continue;
 +              }
 +              ret = pinmux_enable(pmx);
 +              if (ret) {
 +                      pr_err("u300: could enable pinmux hog %s\n",
 +                             u300_mux_hogs[i].name);
 +                      continue;
 +              }
 +              u300_mux_hogs[i].pmx = pmx;
 +      }
 +      return 0;
 +}
 +subsys_initcall(u300_pinmux_fetch);
 +
  /*
   * Notice that AMBA devices are initialized before platform devices.
   *
@@@ -1744,10 -1646,10 +1747,10 @@@ static struct platform_device *platform
        &gpio_device,
        &nand_device,
        &wdog_device,
 -      &ave_device
 +      &ave_device,
 +      &pinmux_device,
  };
  
 -
  /*
   * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected
   * together so some interrupts are connected to the first one and some
@@@ -1767,7 -1669,7 +1770,7 @@@ void __init u300_init_irq(void
        BUG_ON(IS_ERR(clk));
        clk_enable(clk);
  
 -      for (i = 0; i < NR_IRQS; i++)
 +      for (i = 0; i < U300_VIC_IRQS_END; i++)
                set_bit(i, (unsigned long *) &mask[0]);
        vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
        vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
@@@ -1929,10 -1831,6 +1932,10 @@@ void __init u300_init_devices(void
  
        u300_assign_physmem();
  
 +      /* Initialize pinmuxing */
 +      pinmux_register_mappings(u300_pinmux_map,
 +                               ARRAY_SIZE(u300_pinmux_map));
 +
        /* Register subdevices on the I2C buses */
        u300_i2c_register_board_devices();
  
@@@ -37,7 -37,6 +37,7 @@@
  #include <plat/i2c.h>
  #include <plat/ste_dma40.h>
  #include <plat/pincfg.h>
 +#include <plat/gpio-nomadik.h>
  
  #include <mach/hardware.h>
  #include <mach/setup.h>
@@@ -646,7 -645,7 +646,7 @@@ static void __init mop500_init_machine(
  
  MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
        /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
-       .boot_params    = 0x100,
+       .atag_offset    = 0x100,
        .map_io         = u8500_map_io,
        .init_irq       = ux500_init_irq,
        /* we re-use nomadik timer here */
  MACHINE_END
  
  MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
-       .boot_params    = 0x100,
+       .atag_offset    = 0x100,
        .map_io         = u8500_map_io,
        .init_irq       = ux500_init_irq,
        .timer          = &ux500_timer,
  MACHINE_END
  
  MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
-       .boot_params    = 0x100,
+       .atag_offset    = 0x100,
        .map_io         = u8500_map_io,
        .init_irq       = ux500_init_irq,
        /* we re-use nomadik timer here */
@@@ -8,6 -8,7 +8,6 @@@
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/amba/bus.h>
 -#include <linux/gpio.h>
  #include <linux/irq.h>
  #include <linux/i2c.h>
  
@@@ -16,7 -17,6 +16,7 @@@
  
  #include <plat/pincfg.h>
  #include <plat/i2c.h>
 +#include <plat/gpio-nomadik.h>
  
  #include <mach/hardware.h>
  #include <mach/devices.h>
@@@ -118,7 -118,7 +118,7 @@@ static void __init u5500_init_machine(v
  }
  
  MACHINE_START(U5500, "ST-Ericsson U5500 Platform")
-       .boot_params    = 0x00000100,
+       .atag_offset    = 0x100,
        .map_io         = u5500_map_io,
        .init_irq       = ux500_init_irq,
        .timer          = &ux500_timer,
  #include <linux/device.h>
  #include <linux/dma-mapping.h>
  #include <linux/highmem.h>
+ #include <linux/slab.h>
  
  #include <asm/memory.h>
  #include <asm/highmem.h>
  #include <asm/cacheflush.h>
  #include <asm/tlbflush.h>
  #include <asm/sizes.h>
+ #include <asm/mach/arch.h>
  
  #include "mm.h"
  
@@@ -117,26 -119,37 +119,36 @@@ static void __dma_free_buffer(struct pa
  }
  
  #ifdef CONFIG_MMU
- /* Sanity check size */
- #if (CONSISTENT_DMA_SIZE % SZ_2M)
- #error "CONSISTENT_DMA_SIZE must be multiple of 2MiB"
- #endif
  
- #define CONSISTENT_OFFSET(x)  (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
- #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PMD_SHIFT)
- #define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PMD_SHIFT)
 -
+ #define CONSISTENT_OFFSET(x)  (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT)
 -#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT)
++#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PMD_SHIFT)
  
  /*
   * These are the page tables (2MB each) covering uncached, DMA consistent allocations
   */
- static pte_t *consistent_pte[NUM_CONSISTENT_PTES];
+ static pte_t **consistent_pte;
+ #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M
+ unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE;
+ void __init init_consistent_dma_size(unsigned long size)
+ {
+       unsigned long base = CONSISTENT_END - ALIGN(size, SZ_2M);
+       BUG_ON(consistent_pte); /* Check we're called before DMA region init */
+       BUG_ON(base < VMALLOC_END);
+       /* Grow region to accommodate specified size  */
+       if (base < consistent_base)
+               consistent_base = base;
+ }
  
  #include "vmregion.h"
  
  static struct arm_vmregion_head consistent_head = {
        .vm_lock        = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock),
        .vm_list        = LIST_HEAD_INIT(consistent_head.vm_list),
-       .vm_start       = CONSISTENT_BASE,
        .vm_end         = CONSISTENT_END,
  };
  
@@@ -155,7 -168,17 +167,17 @@@ static int __init consistent_init(void
        pmd_t *pmd;
        pte_t *pte;
        int i = 0;
-       u32 base = CONSISTENT_BASE;
+       unsigned long base = consistent_base;
+       unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT;
+       consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL);
+       if (!consistent_pte) {
+               pr_err("%s: no memory\n", __func__);
+               return -ENOMEM;
+       }
+       pr_debug("DMA memory: 0x%08lx - 0x%08lx:\n", base, CONSISTENT_END);
+       consistent_head.vm_start = base;
  
        do {
                pgd = pgd_offset(&init_mm, base);
                }
  
                consistent_pte[i++] = pte;
 -              base += (1 << PGDIR_SHIFT);
 +              base += PMD_SIZE;
        } while (base < CONSISTENT_END);
  
        return ret;
@@@ -198,7 -221,7 +220,7 @@@ __dma_alloc_remap(struct page *page, si
        size_t align;
        int bit;
  
-       if (!consistent_pte[0]) {
+       if (!consistent_pte) {
                printk(KERN_ERR "%s: not initialised\n", __func__);
                dump_stack();
                return NULL;
@@@ -324,8 -347,6 +346,8 @@@ __dma_alloc(struct device *dev, size_t 
  
        if (addr)
                *handle = pfn_to_dma(dev, page_to_pfn(page));
 +      else
 +              __dma_free_buffer(page, size);
  
        return addr;
  }
diff --combined arch/arm/mm/init.c
@@@ -496,13 -496,6 +496,13 @@@ static void __init free_unused_memmap(s
                 */
                bank_start = min(bank_start,
                                 ALIGN(prev_bank_end, PAGES_PER_SECTION));
 +#else
 +              /*
 +               * Align down here since the VM subsystem insists that the
 +               * memmap entries are valid from the bank start aligned to
 +               * MAX_ORDER_NR_PAGES.
 +               */
 +              bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
  #endif
                /*
                 * If we had a previous bank, and there is a space
@@@ -660,9 -653,6 +660,6 @@@ void __init mem_init(void
                        "    ITCM    : 0x%08lx - 0x%08lx   (%4ld kB)\n"
  #endif
                        "    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
- #ifdef CONFIG_MMU
-                       "    DMA     : 0x%08lx - 0x%08lx   (%4ld MB)\n"
- #endif
                        "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
                        "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
  #ifdef CONFIG_HIGHMEM
                        MLK(ITCM_OFFSET, (unsigned long) itcm_end),
  #endif
                        MLK(FIXADDR_START, FIXADDR_TOP),
- #ifdef CONFIG_MMU
-                       MLM(CONSISTENT_BASE, CONSISTENT_END),
- #endif
                        MLM(VMALLOC_START, VMALLOC_END),
                        MLM(PAGE_OFFSET, (unsigned long)high_memory),
  #ifdef CONFIG_HIGHMEM
         * be detected at build time already.
         */
  #ifdef CONFIG_MMU
-       BUILD_BUG_ON(VMALLOC_END                        > CONSISTENT_BASE);
-       BUG_ON(VMALLOC_END                              > CONSISTENT_BASE);
        BUILD_BUG_ON(TASK_SIZE                          > MODULES_VADDR);
        BUG_ON(TASK_SIZE                                > MODULES_VADDR);
  #endif
diff --combined arch/arm/mm/mmu.c
@@@ -60,7 -60,7 +60,7 @@@ EXPORT_SYMBOL(pgprot_kernel)
  struct cachepolicy {
        const char      policy[16];
        unsigned int    cr_mask;
 -      unsigned int    pmd;
 +      pmdval_t        pmd;
        pteval_t        pte;
  };
  
@@@ -273,6 -273,14 +273,14 @@@ static struct mem_type mem_types[] = 
                .prot_l1   = PMD_TYPE_TABLE,
                .domain    = DOMAIN_KERNEL,
        },
+       [MT_MEMORY_SO] = {
+               .prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
+                               L_PTE_MT_UNCACHED,
+               .prot_l1   = PMD_TYPE_TABLE,
+               .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_S |
+                               PMD_SECT_UNCACHED | PMD_SECT_XN,
+               .domain    = DOMAIN_KERNEL,
+       },
  };
  
  const struct mem_type *get_mem_type(unsigned int type)
@@@ -288,7 -296,7 +296,7 @@@ static void __init build_mem_type_table
  {
        struct cachepolicy *cp;
        unsigned int cr = get_cr();
 -      unsigned int user_pgprot, kern_pgprot, vecs_pgprot;
 +      pteval_t user_pgprot, kern_pgprot, vecs_pgprot;
        int cpu_arch = cpu_architecture();
        int i;
  
@@@ -863,14 -871,14 +871,14 @@@ static inline void prepare_page_table(v
        /*
         * Clear out all the mappings below the kernel image.
         */
 -      for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE)
 +      for (addr = 0; addr < MODULES_VADDR; addr += PMD_SIZE)
                pmd_clear(pmd_off_k(addr));
  
  #ifdef CONFIG_XIP_KERNEL
        /* The XIP kernel is mapped in the module area -- skip over it */
 -      addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
 +      addr = ((unsigned long)_etext + PMD_SIZE - 1) & PMD_MASK;
  #endif
 -      for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
 +      for ( ; addr < PAGE_OFFSET; addr += PMD_SIZE)
                pmd_clear(pmd_off_k(addr));
  
        /*
         * memory bank, up to the end of the vmalloc region.
         */
        for (addr = __phys_to_virt(end);
 -           addr < VMALLOC_END; addr += PGDIR_SIZE)
 +           addr < VMALLOC_END; addr += PMD_SIZE)
                pmd_clear(pmd_off_k(addr));
  }
  
 +#define SWAPPER_PG_DIR_SIZE   (PTRS_PER_PGD * sizeof(pgd_t))
 +
  /*
   * Reserve the special regions of memory
   */
@@@ -900,7 -906,7 +908,7 @@@ void __init arm_mm_memblock_reserve(voi
         * Reserve the page tables.  These are already in use,
         * and can only be in node 0.
         */
 -      memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
 +      memblock_reserve(__pa(swapper_pg_dir), SWAPPER_PG_DIR_SIZE);
  
  #ifdef CONFIG_SA1111
        /*
@@@ -928,7 -934,7 +936,7 @@@ static void __init devicemaps_init(stru
         */
        vectors_page = early_alloc(PAGE_SIZE);
  
 -      for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
 +      for (addr = VMALLOC_END; addr; addr += PMD_SIZE)
                pmd_clear(pmd_off_k(addr));
  
        /*
diff --combined arch/arm/mm/proc-v7.S
@@@ -217,56 -217,50 +217,50 @@@ ENDPROC(cpu_v7_set_pte_ext
  
  /* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
  .globl        cpu_v7_suspend_size
- .equ  cpu_v7_suspend_size, 4 * 9
+ .equ  cpu_v7_suspend_size, 4 * 7
 -#ifdef CONFIG_PM_SLEEP
 +#ifdef CONFIG_ARM_CPU_SUSPEND
  ENTRY(cpu_v7_do_suspend)
-       stmfd   sp!, {r4 - r11, lr}
+       stmfd   sp!, {r4 - r10, lr}
        mrc     p15, 0, r4, c13, c0, 0  @ FCSE/PID
-       mrc     p15, 0, r5, c13, c0, 1  @ Context ID
-       mrc     p15, 0, r6, c13, c0, 3  @ User r/o thread ID
-       stmia   r0!, {r4 - r6}
+       mrc     p15, 0, r5, c13, c0, 3  @ User r/o thread ID
+       stmia   r0!, {r4 - r5}
        mrc     p15, 0, r6, c3, c0, 0   @ Domain ID
-       mrc     p15, 0, r7, c2, c0, 0   @ TTB 0
-       mrc     p15, 0, r8, c2, c0, 1   @ TTB 1
-       mrc     p15, 0, r9, c1, c0, 0   @ Control register
-       mrc     p15, 0, r10, c1, c0, 1  @ Auxiliary control register
-       mrc     p15, 0, r11, c1, c0, 2  @ Co-processor access control
-       stmia   r0, {r6 - r11}
-       ldmfd   sp!, {r4 - r11, pc}
+       mrc     p15, 0, r7, c2, c0, 1   @ TTB 1
+       mrc     p15, 0, r8, c1, c0, 0   @ Control register
+       mrc     p15, 0, r9, c1, c0, 1   @ Auxiliary control register
+       mrc     p15, 0, r10, c1, c0, 2  @ Co-processor access control
+       stmia   r0, {r6 - r10}
+       ldmfd   sp!, {r4 - r10, pc}
  ENDPROC(cpu_v7_do_suspend)
  
  ENTRY(cpu_v7_do_resume)
        mov     ip, #0
        mcr     p15, 0, ip, c8, c7, 0   @ invalidate TLBs
        mcr     p15, 0, ip, c7, c5, 0   @ invalidate I cache
-       ldmia   r0!, {r4 - r6}
+       mcr     p15, 0, ip, c13, c0, 1  @ set reserved context ID
+       ldmia   r0!, {r4 - r5}
        mcr     p15, 0, r4, c13, c0, 0  @ FCSE/PID
-       mcr     p15, 0, r5, c13, c0, 1  @ Context ID
-       mcr     p15, 0, r6, c13, c0, 3  @ User r/o thread ID
-       ldmia   r0, {r6 - r11}
+       mcr     p15, 0, r5, c13, c0, 3  @ User r/o thread ID
+       ldmia   r0, {r6 - r10}
        mcr     p15, 0, r6, c3, c0, 0   @ Domain ID
-       mcr     p15, 0, r7, c2, c0, 0   @ TTB 0
-       mcr     p15, 0, r8, c2, c0, 1   @ TTB 1
+       ALT_SMP(orr     r1, r1, #TTB_FLAGS_SMP)
+       ALT_UP(orr      r1, r1, #TTB_FLAGS_UP)
+       mcr     p15, 0, r1, c2, c0, 0   @ TTB 0
+       mcr     p15, 0, r7, c2, c0, 1   @ TTB 1
        mcr     p15, 0, ip, c2, c0, 2   @ TTB control register
        mrc     p15, 0, r4, c1, c0, 1   @ Read Auxiliary control register
-       teq     r4, r10                 @ Is it already set?
-       mcrne   p15, 0, r10, c1, c0, 1  @ No, so write it
-       mcr     p15, 0, r11, c1, c0, 2  @ Co-processor access control
+       teq     r4, r                 @ Is it already set?
+       mcrne   p15, 0, r9, c1, c0, 1   @ No, so write it
+       mcr     p15, 0, r10, c1, c0, 2  @ Co-processor access control
        ldr     r4, =PRRR               @ PRRR
        ldr     r5, =NMRR               @ NMRR
        mcr     p15, 0, r4, c10, c2, 0  @ write PRRR
        mcr     p15, 0, r5, c10, c2, 1  @ write NMRR
        isb
        dsb
-       mov     r0, r9                  @ control register
-       mov     r2, r7, lsr #14         @ get TTB0 base
-       mov     r2, r2, lsl #14
-       ldr     r3, cpu_resume_l1_flags
+       mov     r0, r8                  @ control register
        b       cpu_resume_mmu
  ENDPROC(cpu_v7_do_resume)
- cpu_resume_l1_flags:
-       ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_SMP)
-       ALT_UP(.long  PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_UP)
  #endif
  
        __CPUINIT
@@@ -14,7 -14,7 +14,8 @@@ config ARCH_OMAP
        select CLKDEV_LOOKUP
        select CLKSRC_MMIO
        select GENERIC_IRQ_CHIP
 +      select HAVE_IDE
+       select NEED_MACH_MEMORY_H
        help
          "Systems based on omap7xx, omap15xx or omap16xx"
  
diff --combined kernel/Makefile
@@@ -9,7 -9,7 +9,7 @@@ obj-y     = sched.o fork.o exec_domain.
            rcupdate.o extable.o params.o posix-timers.o \
            kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
            hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
 -          notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \
 +          notifier.o ksysfs.o sched_clock.o cred.o \
            async.o range.o
  obj-y += groups.o
  
@@@ -101,6 -101,7 +101,7 @@@ obj-$(CONFIG_RING_BUFFER) += trace
  obj-$(CONFIG_TRACEPOINTS) += trace/
  obj-$(CONFIG_SMP) += sched_cpupri.o
  obj-$(CONFIG_IRQ_WORK) += irq_work.o
+ obj-$(CONFIG_CPU_PM) += cpu_pm.o
  
  obj-$(CONFIG_PERF_EVENTS) += events/
  
diff --combined kernel/power/Kconfig
@@@ -27,7 -27,6 +27,7 @@@ config HIBERNATIO
        select HIBERNATE_CALLBACKS
        select LZO_COMPRESS
        select LZO_DECOMPRESS
 +      select CRC32
        ---help---
          Enable the suspend to disk (STD) functionality, which is usually
          called "hibernation" in user interfaces.  STD checkpoints the
@@@ -66,9 -65,6 +66,9 @@@
  
          For more information take a look at <file:Documentation/power/swsusp.txt>.
  
 +config ARCH_SAVE_PAGE_KEYS
 +      bool
 +
  config PM_STD_PARTITION
        string "Default resume partition"
        depends on HIBERNATION
@@@ -239,3 -235,7 +239,7 @@@ config PM_GENERIC_DOMAIN
  config PM_GENERIC_DOMAINS_RUNTIME
        def_bool y
        depends on PM_RUNTIME && PM_GENERIC_DOMAINS
+ config CPU_PM
+       bool
+       depends on SUSPEND || CPU_IDLE