aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig7
-rw-r--r--arch/arm/Kconfig-nommu2
-rw-r--r--arch/arm/Kconfig.debug11
-rw-r--r--arch/arm/boot/compressed/Makefile19
-rw-r--r--arch/arm/boot/compressed/decompress.c4
-rw-r--r--arch/arm/boot/compressed/head.S63
-rw-r--r--arch/arm/boot/compressed/misc.c24
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.in1
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/gic.c84
-rw-r--r--arch/arm/common/pl330.c4
-rw-r--r--arch/arm/configs/at91x40_defconfig48
-rw-r--r--arch/arm/configs/dove_defconfig12
-rw-r--r--arch/arm/include/asm/cputype.h1
-rw-r--r--arch/arm/include/asm/fpstate.h2
-rw-r--r--arch/arm/include/asm/glue-cache.h2
-rw-r--r--arch/arm/include/asm/glue.h4
-rw-r--r--arch/arm/include/asm/hardware/pl080.h2
-rw-r--r--arch/arm/include/asm/kprobes.h3
-rw-r--r--arch/arm/include/asm/system.h2
-rw-r--r--arch/arm/include/asm/thread_notify.h1
-rw-r--r--arch/arm/include/asm/ucontext.h2
-rw-r--r--arch/arm/include/asm/unistd.h4
-rw-r--r--arch/arm/kernel/Makefile2
-rw-r--r--arch/arm/kernel/calls.S4
-rw-r--r--arch/arm/kernel/elf.c17
-rw-r--r--arch/arm/kernel/hw_breakpoint.c7
-rw-r--r--arch/arm/kernel/kprobes-decode.c777
-rw-r--r--arch/arm/kernel/kprobes.c3
-rw-r--r--arch/arm/kernel/perf_event.c5
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/kernel/ptrace.c8
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/kernel/swp_emulate.c2
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c2
-rw-r--r--arch/arm/kernel/traps.c3
-rw-r--r--arch/arm/mach-at91/Kconfig1
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-eb01.c7
-rw-r--r--arch/arm/mach-at91/include/mach/at91_mci.h2
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h28
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c6
-rw-r--r--arch/arm/mach-bcmring/dma.c4
-rw-r--r--arch/arm/mach-bcmring/include/csp/dmacHw.h6
-rw-r--r--arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h2
-rw-r--r--arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h2
-rw-r--r--arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h4
-rw-r--r--arch/arm/mach-bcmring/include/mach/reg_umi.h2
-rw-r--r--arch/arm/mach-davinci/Kconfig6
-rw-r--r--arch/arm/mach-davinci/board-mityomapl138.c4
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c2
-rw-r--r--arch/arm/mach-davinci/cpufreq.c2
-rw-r--r--arch/arm/mach-davinci/da850.c2
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c12
-rw-r--r--arch/arm/mach-davinci/dm355.c2
-rw-r--r--arch/arm/mach-davinci/dm644x.c2
-rw-r--r--arch/arm/mach-davinci/include/mach/cputype.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/debug-macro.S13
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h5
-rw-r--r--arch/arm/mach-davinci/irq.c93
-rw-r--r--arch/arm/mach-dove/common.c616
-rw-r--r--arch/arm/mach-dove/mpp.c134
-rw-r--r--arch/arm/mach-dove/mpp.h362
-rw-r--r--arch/arm/mach-ep93xx/gpio.c2
-rw-r--r--arch/arm/mach-exynos4/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-exynos4/irq-combiner.c6
-rw-r--r--arch/arm/mach-exynos4/mct.c2
-rw-r--r--arch/arm/mach-exynos4/setup-sdhci-gpio.c4
-rw-r--r--arch/arm/mach-exynos4/setup-sdhci.c2
-rw-r--r--arch/arm/mach-gemini/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-iop13xx/pci.c4
-rw-r--r--arch/arm/mach-iop32x/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-iop33x/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-kirkwood/common.c601
-rw-r--r--arch/arm/mach-kirkwood/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-kirkwood/mpp.c58
-rw-r--r--arch/arm/mach-kirkwood/mpp.h6
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.c2
-rw-r--r--arch/arm/mach-loki/common.c190
-rw-r--r--arch/arm/mach-lpc32xx/pm.c2
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa168.h9
-rw-r--r--arch/arm/mach-mmp/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-mmp/time.c2
-rw-r--r--arch/arm/mach-msm/acpuclock-arm11.c2
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c5
-rw-r--r--arch/arm/mach-msm/gpio-v2.c10
-rw-r--r--arch/arm/mach-msm/scm.c2
-rw-r--r--arch/arm/mach-msm/timer.c2
-rw-r--r--arch/arm/mach-mv78xx0/common.c570
-rw-r--r--arch/arm/mach-mv78xx0/mpp.c58
-rw-r--r--arch/arm/mach-mv78xx0/mpp.h6
-rw-r--r--arch/arm/mach-mxs/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-nuc93x/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq-handler.S2
-rw-r--r--arch/arm/mach-omap1/board-sx1.c2
-rw-r--r--arch/arm/mach-omap1/devices.c2
-rw-r--r--arch/arm/mach-omap1/include/mach/ams-delta-fiq.h2
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c2
-rw-r--r--arch/arm/mach-omap2/board-igep0030.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51.c9
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c9
-rw-r--r--arch/arm/mach-omap2/clockdomain.c2
-rw-r--r--arch/arm/mach-omap2/clockdomain.h2
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.c17
-rw-r--r--arch/arm/mach-omap2/control.c8
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c4
-rw-r--r--arch/arm/mach-omap2/devices.c6
-rw-r--r--arch/arm/mach-omap2/dma.c2
-rw-r--r--arch/arm/mach-omap2/gpio.c2
-rw-r--r--arch/arm/mach-omap2/hsmmc.c2
-rw-r--r--arch/arm/mach-omap2/irq.c97
-rw-r--r--arch/arm/mach-omap2/mcbsp.c2
-rw-r--r--arch/arm/mach-omap2/mux.c2
-rw-r--r--arch/arm/mach-omap2/mux2430.h2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_l3_smx.c4
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c4
-rw-r--r--arch/arm/mach-omap2/omap_twl.c2
-rw-r--r--arch/arm/mach-omap2/pm.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.c2
-rw-r--r--arch/arm/mach-omap2/powerdomain.h2
-rw-r--r--arch/arm/mach-omap2/powerdomains3xxx_data.c2
-rw-r--r--arch/arm/mach-omap2/smartreflex.c2
-rw-r--r--arch/arm/mach-omap2/voltage.c5
-rw-r--r--arch/arm/mach-orion5x/addr-map.c2
-rw-r--r--arch/arm/mach-orion5x/common.c478
-rw-r--r--arch/arm/mach-orion5x/d2net-setup.c44
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c44
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c132
-rw-r--r--arch/arm/mach-orion5x/edmini_v2-setup.c44
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c44
-rw-r--r--arch/arm/mach-orion5x/ls-chl-setup.c44
-rw-r--r--arch/arm/mach-orion5x/ls_hgl-setup.c44
-rw-r--r--arch/arm/mach-orion5x/lsmini-setup.c44
-rw-r--r--arch/arm/mach-orion5x/mpp.c150
-rw-r--r--arch/arm/mach-orion5x/mpp.h191
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c44
-rw-r--r--arch/arm/mach-orion5x/mv2120-setup.c44
-rw-r--r--arch/arm/mach-orion5x/net2big-setup.c46
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c44
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c44
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c44
-rw-r--r--arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c1
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c44
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c46
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c46
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c44
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c44
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c44
-rw-r--r--arch/arm/mach-pxa/hx4700.c2
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h17
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/pxa3xx-regs.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/zeus.h2
-rw-r--r--arch/arm/mach-pxa/magician.c2
-rw-r--r--arch/arm/mach-pxa/mioa701.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c2
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-rpc/include/mach/uncompress.h12
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-mem.h2
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-gta02.c5
-rw-r--r--arch/arm/mach-s3c2440/mach-mini2440.c2
-rw-r--r--arch/arm/mach-s3c64xx/dma.c2
-rw-r--r--arch/arm/mach-s3c64xx/irq.c7
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-fb.h2
-rw-r--r--arch/arm/mach-s5pc100/setup-sdhci.c2
-rw-r--r--arch/arm/mach-s5pv210/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-s5pv210/setup-sdhci-gpio.c4
-rw-r--r--arch/arm/mach-s5pv210/setup-sdhci.c2
-rw-r--r--arch/arm/mach-sa1100/Makefile2
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1100.h2
-rw-r--r--arch/arm/mach-sa1100/jornada720_ssp.c4
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c19
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c10
-rw-r--r--arch/arm/mach-shmobile/include/mach/mmc.h2
-rw-r--r--arch/arm/mach-shmobile/include/mach/zboot.h2
-rw-r--r--arch/arm/mach-tegra/Makefile2
-rw-r--r--arch/arm/mach-tegra/dma.c4
-rw-r--r--arch/arm/mach-tegra/gpio.c15
-rw-r--r--arch/arm/mach-tegra/include/mach/dma.h4
-rw-r--r--arch/arm/mach-tegra/include/mach/legacy_irq.h35
-rw-r--r--arch/arm/mach-tegra/irq.c174
-rw-r--r--arch/arm/mach-tegra/legacy_irq.c215
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c9
-rw-r--r--arch/arm/mach-u300/clock.c6
-rw-r--r--arch/arm/mach-ux500/board-mop500.c21
-rw-r--r--arch/arm/mach-ux500/include/mach/db8500-regs.h10
-rw-r--r--arch/arm/mach-ux500/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-w90x900/include/mach/uncompress.h2
-rw-r--r--arch/arm/mm/cache-v4wb.S2
-rw-r--r--arch/arm/mm/cache-v4wt.S2
-rw-r--r--arch/arm/mm/cache-v7.S2
-rw-r--r--arch/arm/mm/mmap.c4
-rw-r--r--arch/arm/mm/proc-arm1020.S2
-rw-r--r--arch/arm/mm/proc-arm1020e.S2
-rw-r--r--arch/arm/mm/proc-arm1022.S2
-rw-r--r--arch/arm/mm/proc-arm1026.S2
-rw-r--r--arch/arm/mm/proc-arm720.S2
-rw-r--r--arch/arm/mm/proc-arm920.S4
-rw-r--r--arch/arm/mm/proc-arm922.S2
-rw-r--r--arch/arm/mm/proc-arm925.S2
-rw-r--r--arch/arm/mm/proc-arm926.S2
-rw-r--r--arch/arm/mm/proc-macros.S2
-rw-r--r--arch/arm/mm/proc-sa1100.S2
-rw-r--r--arch/arm/mm/proc-v6.S40
-rw-r--r--arch/arm/mm/proc-v7.S4
-rw-r--r--arch/arm/mm/proc-xsc3.S2
-rw-r--r--arch/arm/mm/proc-xscale.S4
-rw-r--r--arch/arm/plat-mxc/cpufreq.c2
-rw-r--r--arch/arm/plat-mxc/gpio.c7
-rw-r--r--arch/arm/plat-mxc/include/mach/entry-macro.S4
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_nand.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h2
-rw-r--r--arch/arm/plat-nomadik/gpio.c12
-rw-r--r--arch/arm/plat-omap/devices.c2
-rw-r--r--arch/arm/plat-omap/dma.c4
-rw-r--r--arch/arm/plat-omap/gpio.c7
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h2
-rw-r--r--arch/arm/plat-omap/include/plat/gpmc.h2
-rw-r--r--arch/arm/plat-omap/include/plat/uncompress.h4
-rw-r--r--arch/arm/plat-omap/mcbsp.c2
-rw-r--r--arch/arm/plat-orion/Makefile2
-rw-r--r--arch/arm/plat-orion/common.c957
-rw-r--r--arch/arm/plat-orion/gpio.c112
-rw-r--r--arch/arm/plat-orion/include/plat/common.h117
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h1
-rw-r--r--arch/arm/plat-orion/include/plat/mpp.h34
-rw-r--r--arch/arm/plat-orion/irq.c49
-rw-r--r--arch/arm/plat-orion/mpp.c78
-rw-r--r--arch/arm/plat-pxa/include/plat/mfp.h2
-rw-r--r--arch/arm/plat-s3c24xx/Makefile2
-rw-r--r--arch/arm/plat-s3c24xx/cpu-freq.c2
-rw-r--r--arch/arm/plat-s3c24xx/dma.c2
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c118
-rw-r--r--arch/arm/plat-s5p/irq.c6
-rw-r--r--arch/arm/plat-s5p/pm.c11
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/irq-vic-timer.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/uncompress.h4
-rw-r--r--arch/arm/plat-samsung/irq-uart.c83
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c69
-rw-r--r--arch/arm/plat-samsung/pm-check.c6
-rw-r--r--arch/arm/plat-samsung/pm.c5
-rw-r--r--arch/arm/plat-samsung/s3c-pl330.c2
-rw-r--r--arch/arm/plat-spear/include/plat/clock.h2
-rw-r--r--arch/arm/vfp/vfpmodule.c34
264 files changed, 3521 insertions, 5020 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b9f78b570e..44c16f06173 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -468,7 +468,7 @@ config ARCH_IXP4XX
468 468
469config ARCH_DOVE 469config ARCH_DOVE
470 bool "Marvell Dove" 470 bool "Marvell Dove"
471 select CPU_V6K 471 select CPU_V7
472 select PCI 472 select PCI
473 select ARCH_REQUIRE_GPIOLIB 473 select ARCH_REQUIRE_GPIOLIB
474 select GENERIC_CLOCKEVENTS 474 select GENERIC_CLOCKEVENTS
@@ -694,7 +694,7 @@ config ARCH_S3C2410
694 the Samsung SMDK2410 development board (and derivatives). 694 the Samsung SMDK2410 development board (and derivatives).
695 695
696 Note, the S3C2416 and the S3C2450 are so close that they even share 696 Note, the S3C2416 and the S3C2450 are so close that they even share
697 the same SoC ID code. This means that there is no seperate machine 697 the same SoC ID code. This means that there is no separate machine
698 directory (no arch/arm/mach-s3c2450) as the S3C2416 was first. 698 directory (no arch/arm/mach-s3c2450) as the S3C2416 was first.
699 699
700config ARCH_S3C64XX 700config ARCH_S3C64XX
@@ -1540,7 +1540,6 @@ config HIGHMEM
1540config HIGHPTE 1540config HIGHPTE
1541 bool "Allocate 2nd-level pagetables from highmem" 1541 bool "Allocate 2nd-level pagetables from highmem"
1542 depends on HIGHMEM 1542 depends on HIGHMEM
1543 depends on !OUTER_CACHE
1544 1543
1545config HW_PERF_EVENTS 1544config HW_PERF_EVENTS
1546 bool "Enable hardware performance counter support for perf events" 1545 bool "Enable hardware performance counter support for perf events"
@@ -2012,6 +2011,8 @@ source "kernel/power/Kconfig"
2012 2011
2013config ARCH_SUSPEND_POSSIBLE 2012config ARCH_SUSPEND_POSSIBLE
2014 depends on !ARCH_S5P64X0 && !ARCH_S5P6442 2013 depends on !ARCH_S5P64X0 && !ARCH_S5P6442
2014 depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \
2015 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE
2015 def_bool y 2016 def_bool y
2016 2017
2017endmenu 2018endmenu
diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
index 901e6dff843..2cef8e13f9f 100644
--- a/arch/arm/Kconfig-nommu
+++ b/arch/arm/Kconfig-nommu
@@ -34,7 +34,7 @@ config PROCESSOR_ID
34 used instead of the auto-probing which utilizes the register. 34 used instead of the auto-probing which utilizes the register.
35 35
36config REMAP_VECTORS_TO_RAM 36config REMAP_VECTORS_TO_RAM
37 bool 'Install vectors to the begining of RAM' if DRAM_BASE 37 bool 'Install vectors to the beginning of RAM' if DRAM_BASE
38 depends on DRAM_BASE 38 depends on DRAM_BASE
39 help 39 help
40 The kernel needs to change the hardware exception vectors. 40 The kernel needs to change the hardware exception vectors.
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 494224a9b45..03d01d783e3 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -63,17 +63,6 @@ config DEBUG_USER
63 8 - SIGSEGV faults 63 8 - SIGSEGV faults
64 16 - SIGBUS faults 64 16 - SIGBUS faults
65 65
66config DEBUG_ERRORS
67 bool "Verbose kernel error messages"
68 depends on DEBUG_KERNEL
69 help
70 This option controls verbose debugging information which can be
71 printed when the kernel detects an internal error. This debugging
72 information is useful to kernel hackers when tracking down problems,
73 but mostly meaningless to other people. It's safe to say Y unless
74 you are concerned with the code size or don't want to see these
75 messages.
76
77config DEBUG_STACK_USAGE 66config DEBUG_STACK_USAGE
78 bool "Enable stack utilization instrumentation" 67 bool "Enable stack utilization instrumentation"
79 depends on DEBUG_KERNEL 68 depends on DEBUG_KERNEL
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 8ebbb511c78..23aad072230 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -74,7 +74,7 @@ ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
74ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS) 74ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS)
75else 75else
76ZTEXTADDR := 0 76ZTEXTADDR := 0
77ZBSSADDR := ALIGN(4) 77ZBSSADDR := ALIGN(8)
78endif 78endif
79 79
80SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 80SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
@@ -98,8 +98,6 @@ endif
98ccflags-y := -fpic -fno-builtin 98ccflags-y := -fpic -fno-builtin
99asflags-y := -Wa,-march=all 99asflags-y := -Wa,-march=all
100 100
101# Provide size of uncompressed kernel to the decompressor via a linker symbol.
102LDFLAGS_vmlinux = --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
103# Supply ZRELADDR to the decompressor via a linker symbol. 101# Supply ZRELADDR to the decompressor via a linker symbol.
104ifneq ($(CONFIG_AUTO_ZRELADDR),y) 102ifneq ($(CONFIG_AUTO_ZRELADDR),y)
105LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR) 103LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
@@ -122,10 +120,23 @@ lib1funcs = $(obj)/lib1funcs.o
122$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE 120$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
123 $(call cmd,shipped) 121 $(call cmd,shipped)
124 122
123# We need to prevent any GOTOFF relocs being used with references
124# to symbols in the .bss section since we cannot relocate them
125# independently from the rest at run time. This can be achieved by
126# ensuring that no private .bss symbols exist, as global symbols
127# always have a GOT entry which is what we need.
128# The .data section is already discarded by the linker script so no need
129# to bother about it here.
130check_for_bad_syms = \
131bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
132[ -z "$$bad_syms" ] || \
133 ( echo "following symbols must have non local/private scope:" >&2; \
134 echo "$$bad_syms" >&2; rm -f $@; false )
135
125$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 136$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
126 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE 137 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
127 $(call if_changed,ld) 138 $(call if_changed,ld)
128 @: 139 @$(check_for_bad_syms)
129 140
130$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE 141$(obj)/piggy.$(suffix_y): $(obj)/../Image FORCE
131 $(call if_changed,$(suffix_y)) 142 $(call if_changed,$(suffix_y))
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index 4c72a97bc3e..07be5a2f830 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -44,7 +44,7 @@ extern void error(char *);
44#include "../../../../lib/decompress_unlzma.c" 44#include "../../../../lib/decompress_unlzma.c"
45#endif 45#endif
46 46
47void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) 47int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
48{ 48{
49 decompress(input, len, NULL, NULL, output, NULL, error); 49 return decompress(input, len, NULL, NULL, output, NULL, error);
50} 50}
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index adf583cd0c3..c363458a4e6 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -179,16 +179,29 @@ not_angel:
179 bl cache_on 179 bl cache_on
180 180
181restart: adr r0, LC0 181restart: adr r0, LC0
182 ldmia r0, {r1, r2, r3, r5, r6, r9, r11, r12} 182 ldmia r0, {r1, r2, r3, r6, r10, r11, r12}
183 ldr sp, [r0, #32] 183 ldr sp, [r0, #28]
184 184
185 /* 185 /*
186 * We might be running at a different address. We need 186 * We might be running at a different address. We need
187 * to fix up various pointers. 187 * to fix up various pointers.
188 */ 188 */
189 sub r0, r0, r1 @ calculate the delta offset 189 sub r0, r0, r1 @ calculate the delta offset
190 add r5, r5, r0 @ _start
191 add r6, r6, r0 @ _edata 190 add r6, r6, r0 @ _edata
191 add r10, r10, r0 @ inflated kernel size location
192
193 /*
194 * The kernel build system appends the size of the
195 * decompressed kernel at the end of the compressed data
196 * in little-endian form.
197 */
198 ldrb r9, [r10, #0]
199 ldrb lr, [r10, #1]
200 orr r9, r9, lr, lsl #8
201 ldrb lr, [r10, #2]
202 ldrb r10, [r10, #3]
203 orr r9, r9, lr, lsl #16
204 orr r9, r9, r10, lsl #24
192 205
193#ifndef CONFIG_ZBOOT_ROM 206#ifndef CONFIG_ZBOOT_ROM
194 /* malloc space is above the relocated stack (64k max) */ 207 /* malloc space is above the relocated stack (64k max) */
@@ -206,31 +219,40 @@ restart: adr r0, LC0
206/* 219/*
207 * Check to see if we will overwrite ourselves. 220 * Check to see if we will overwrite ourselves.
208 * r4 = final kernel address 221 * r4 = final kernel address
209 * r5 = start of this image
210 * r9 = size of decompressed image 222 * r9 = size of decompressed image
211 * r10 = end of this image, including bss/stack/malloc space if non XIP 223 * r10 = end of this image, including bss/stack/malloc space if non XIP
212 * We basically want: 224 * We basically want:
213 * r4 >= r10 -> OK 225 * r4 - 16k page directory >= r10 -> OK
214 * r4 + image length <= r5 -> OK 226 * r4 + image length <= current position (pc) -> OK
215 */ 227 */
228 add r10, r10, #16384
216 cmp r4, r10 229 cmp r4, r10
217 bhs wont_overwrite 230 bhs wont_overwrite
218 add r10, r4, r9 231 add r10, r4, r9
219 cmp r10, r5 232 ARM( cmp r10, pc )
233 THUMB( mov lr, pc )
234 THUMB( cmp r10, lr )
220 bls wont_overwrite 235 bls wont_overwrite
221 236
222/* 237/*
223 * Relocate ourselves past the end of the decompressed kernel. 238 * Relocate ourselves past the end of the decompressed kernel.
224 * r5 = start of this image
225 * r6 = _edata 239 * r6 = _edata
226 * r10 = end of the decompressed kernel 240 * r10 = end of the decompressed kernel
227 * Because we always copy ahead, we need to do it from the end and go 241 * Because we always copy ahead, we need to do it from the end and go
228 * backward in case the source and destination overlap. 242 * backward in case the source and destination overlap.
229 */ 243 */
230 /* Round up to next 256-byte boundary. */ 244 /*
231 add r10, r10, #256 245 * Bump to the next 256-byte boundary with the size of
246 * the relocation code added. This avoids overwriting
247 * ourself when the offset is small.
248 */
249 add r10, r10, #((reloc_code_end - restart + 256) & ~255)
232 bic r10, r10, #255 250 bic r10, r10, #255
233 251
252 /* Get start of code we want to copy and align it down. */
253 adr r5, restart
254 bic r5, r5, #31
255
234 sub r9, r6, r5 @ size to copy 256 sub r9, r6, r5 @ size to copy
235 add r9, r9, #31 @ rounded up to a multiple 257 add r9, r9, #31 @ rounded up to a multiple
236 bic r9, r9, #31 @ ... of 32 bytes 258 bic r9, r9, #31 @ ... of 32 bytes
@@ -245,6 +267,11 @@ restart: adr r0, LC0
245 /* Preserve offset to relocated code. */ 267 /* Preserve offset to relocated code. */
246 sub r6, r9, r6 268 sub r6, r9, r6
247 269
270#ifndef CONFIG_ZBOOT_ROM
271 /* cache_clean_flush may use the stack, so relocate it */
272 add sp, sp, r6
273#endif
274
248 bl cache_clean_flush 275 bl cache_clean_flush
249 276
250 adr r0, BSYM(restart) 277 adr r0, BSYM(restart)
@@ -333,12 +360,11 @@ not_relocated: mov r0, #0
333LC0: .word LC0 @ r1 360LC0: .word LC0 @ r1
334 .word __bss_start @ r2 361 .word __bss_start @ r2
335 .word _end @ r3 362 .word _end @ r3
336 .word _start @ r5
337 .word _edata @ r6 363 .word _edata @ r6
338 .word _image_size @ r9 364 .word input_data_end - 4 @ r10 (inflated size location)
339 .word _got_start @ r11 365 .word _got_start @ r11
340 .word _got_end @ ip 366 .word _got_end @ ip
341 .word user_stack_end @ sp 367 .word .L_user_stack_end @ sp
342 .size LC0, . - LC0 368 .size LC0, . - LC0
343 369
344#ifdef CONFIG_ARCH_RPC 370#ifdef CONFIG_ARCH_RPC
@@ -735,12 +761,6 @@ proc_types:
735 W(b) __armv4_mmu_cache_off 761 W(b) __armv4_mmu_cache_off
736 W(b) __armv6_mmu_cache_flush 762 W(b) __armv6_mmu_cache_flush
737 763
738 .word 0x560f5810 @ Marvell PJ4 ARMv6
739 .word 0xff0ffff0
740 W(b) __armv4_mmu_cache_on
741 W(b) __armv4_mmu_cache_off
742 W(b) __armv6_mmu_cache_flush
743
744 .word 0x000f0000 @ new CPU Id 764 .word 0x000f0000 @ new CPU Id
745 .word 0x000f0000 765 .word 0x000f0000
746 W(b) __armv7_mmu_cache_on 766 W(b) __armv7_mmu_cache_on
@@ -1062,8 +1082,9 @@ memdump: mov r12, r0
1062#endif 1082#endif
1063 1083
1064 .ltorg 1084 .ltorg
1085reloc_code_end:
1065 1086
1066 .align 1087 .align
1067 .section ".stack", "aw", %nobits 1088 .section ".stack", "aw", %nobits
1068user_stack: .space 4096 1089.L_user_stack: .space 4096
1069user_stack_end: 1090.L_user_stack_end:
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 2df38263124..832d37236c5 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -26,8 +26,6 @@ unsigned int __machine_arch_type;
26#include <linux/linkage.h> 26#include <linux/linkage.h>
27#include <asm/string.h> 27#include <asm/string.h>
28 28
29#include <asm/unaligned.h>
30
31 29
32static void putstr(const char *ptr); 30static void putstr(const char *ptr);
33extern void error(char *x); 31extern void error(char *x);
@@ -139,13 +137,12 @@ void *memcpy(void *__dest, __const void *__src, size_t __n)
139} 137}
140 138
141/* 139/*
142 * gzip delarations 140 * gzip declarations
143 */ 141 */
144extern char input_data[]; 142extern char input_data[];
145extern char input_data_end[]; 143extern char input_data_end[];
146 144
147unsigned char *output_data; 145unsigned char *output_data;
148unsigned long output_ptr;
149 146
150unsigned long free_mem_ptr; 147unsigned long free_mem_ptr;
151unsigned long free_mem_end_ptr; 148unsigned long free_mem_end_ptr;
@@ -170,15 +167,15 @@ asmlinkage void __div0(void)
170 error("Attempting division by 0!"); 167 error("Attempting division by 0!");
171} 168}
172 169
173extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)); 170extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
174 171
175 172
176unsigned long 173void
177decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, 174decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
178 unsigned long free_mem_ptr_end_p, 175 unsigned long free_mem_ptr_end_p,
179 int arch_id) 176 int arch_id)
180{ 177{
181 unsigned char *tmp; 178 int ret;
182 179
183 output_data = (unsigned char *)output_start; 180 output_data = (unsigned char *)output_start;
184 free_mem_ptr = free_mem_ptr_p; 181 free_mem_ptr = free_mem_ptr_p;
@@ -187,12 +184,11 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
187 184
188 arch_decomp_setup(); 185 arch_decomp_setup();
189 186
190 tmp = (unsigned char *) (((unsigned long)input_data_end) - 4);
191 output_ptr = get_unaligned_le32(tmp);
192
193 putstr("Uncompressing Linux..."); 187 putstr("Uncompressing Linux...");
194 do_decompress(input_data, input_data_end - input_data, 188 ret = do_decompress(input_data, input_data_end - input_data,
195 output_data, error); 189 output_data, error);
196 putstr(" done, booting the kernel.\n"); 190 if (ret)
197 return output_ptr; 191 error("decompressor returned an error");
192 else
193 putstr(" done, booting the kernel.\n");
198} 194}
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index 5309909d728..ea80abe7884 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -54,6 +54,7 @@ SECTIONS
54 .bss : { *(.bss) } 54 .bss : { *(.bss) }
55 _end = .; 55 _end = .;
56 56
57 . = ALIGN(8); /* the stack must be 64-bit aligned */
57 .stack : { *(.stack) } 58 .stack : { *(.stack) }
58 59
59 .stab 0 : { *(.stab) } 60 .stab 0 : { *(.stab) }
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index e7521bca2c3..6ea9b6f3607 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -16,5 +16,4 @@ obj-$(CONFIG_SHARP_SCOOP) += scoop.o
16obj-$(CONFIG_ARCH_IXP2000) += uengine.o 16obj-$(CONFIG_ARCH_IXP2000) += uengine.o
17obj-$(CONFIG_ARCH_IXP23XX) += uengine.o 17obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
18obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o 18obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
19obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
20obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o 19obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index f70ec7dadeb..4ddd0a6ac7f 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -49,7 +49,7 @@ struct gic_chip_data {
49 * Default make them NULL. 49 * Default make them NULL.
50 */ 50 */
51struct irq_chip gic_arch_extn = { 51struct irq_chip gic_arch_extn = {
52 .irq_ack = NULL, 52 .irq_eoi = NULL,
53 .irq_mask = NULL, 53 .irq_mask = NULL,
54 .irq_unmask = NULL, 54 .irq_unmask = NULL,
55 .irq_retrigger = NULL, 55 .irq_retrigger = NULL,
@@ -84,21 +84,12 @@ static inline unsigned int gic_irq(struct irq_data *d)
84/* 84/*
85 * Routines to acknowledge, disable and enable interrupts 85 * Routines to acknowledge, disable and enable interrupts
86 */ 86 */
87static void gic_ack_irq(struct irq_data *d)
88{
89 spin_lock(&irq_controller_lock);
90 if (gic_arch_extn.irq_ack)
91 gic_arch_extn.irq_ack(d);
92 writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
93 spin_unlock(&irq_controller_lock);
94}
95
96static void gic_mask_irq(struct irq_data *d) 87static void gic_mask_irq(struct irq_data *d)
97{ 88{
98 u32 mask = 1 << (d->irq % 32); 89 u32 mask = 1 << (d->irq % 32);
99 90
100 spin_lock(&irq_controller_lock); 91 spin_lock(&irq_controller_lock);
101 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4); 92 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
102 if (gic_arch_extn.irq_mask) 93 if (gic_arch_extn.irq_mask)
103 gic_arch_extn.irq_mask(d); 94 gic_arch_extn.irq_mask(d);
104 spin_unlock(&irq_controller_lock); 95 spin_unlock(&irq_controller_lock);
@@ -111,10 +102,21 @@ static void gic_unmask_irq(struct irq_data *d)
111 spin_lock(&irq_controller_lock); 102 spin_lock(&irq_controller_lock);
112 if (gic_arch_extn.irq_unmask) 103 if (gic_arch_extn.irq_unmask)
113 gic_arch_extn.irq_unmask(d); 104 gic_arch_extn.irq_unmask(d);
114 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4); 105 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
115 spin_unlock(&irq_controller_lock); 106 spin_unlock(&irq_controller_lock);
116} 107}
117 108
109static void gic_eoi_irq(struct irq_data *d)
110{
111 if (gic_arch_extn.irq_eoi) {
112 spin_lock(&irq_controller_lock);
113 gic_arch_extn.irq_eoi(d);
114 spin_unlock(&irq_controller_lock);
115 }
116
117 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
118}
119
118static int gic_set_type(struct irq_data *d, unsigned int type) 120static int gic_set_type(struct irq_data *d, unsigned int type)
119{ 121{
120 void __iomem *base = gic_dist_base(d); 122 void __iomem *base = gic_dist_base(d);
@@ -138,7 +140,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
138 if (gic_arch_extn.irq_set_type) 140 if (gic_arch_extn.irq_set_type)
139 gic_arch_extn.irq_set_type(d, type); 141 gic_arch_extn.irq_set_type(d, type);
140 142
141 val = readl(base + GIC_DIST_CONFIG + confoff); 143 val = readl_relaxed(base + GIC_DIST_CONFIG + confoff);
142 if (type == IRQ_TYPE_LEVEL_HIGH) 144 if (type == IRQ_TYPE_LEVEL_HIGH)
143 val &= ~confmask; 145 val &= ~confmask;
144 else if (type == IRQ_TYPE_EDGE_RISING) 146 else if (type == IRQ_TYPE_EDGE_RISING)
@@ -148,15 +150,15 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
148 * As recommended by the spec, disable the interrupt before changing 150 * As recommended by the spec, disable the interrupt before changing
149 * the configuration 151 * the configuration
150 */ 152 */
151 if (readl(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) { 153 if (readl_relaxed(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) {
152 writel(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff); 154 writel_relaxed(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff);
153 enabled = true; 155 enabled = true;
154 } 156 }
155 157
156 writel(val, base + GIC_DIST_CONFIG + confoff); 158 writel_relaxed(val, base + GIC_DIST_CONFIG + confoff);
157 159
158 if (enabled) 160 if (enabled)
159 writel(enablemask, base + GIC_DIST_ENABLE_SET + enableoff); 161 writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
160 162
161 spin_unlock(&irq_controller_lock); 163 spin_unlock(&irq_controller_lock);
162 164
@@ -188,8 +190,8 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
188 190
189 spin_lock(&irq_controller_lock); 191 spin_lock(&irq_controller_lock);
190 d->node = cpu; 192 d->node = cpu;
191 val = readl(reg) & ~mask; 193 val = readl_relaxed(reg) & ~mask;
192 writel(val | bit, reg); 194 writel_relaxed(val | bit, reg);
193 spin_unlock(&irq_controller_lock); 195 spin_unlock(&irq_controller_lock);
194 196
195 return 0; 197 return 0;
@@ -218,11 +220,10 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
218 unsigned int cascade_irq, gic_irq; 220 unsigned int cascade_irq, gic_irq;
219 unsigned long status; 221 unsigned long status;
220 222
221 /* primary controller ack'ing */ 223 chained_irq_enter(chip, desc);
222 chip->irq_ack(&desc->irq_data);
223 224
224 spin_lock(&irq_controller_lock); 225 spin_lock(&irq_controller_lock);
225 status = readl(chip_data->cpu_base + GIC_CPU_INTACK); 226 status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
226 spin_unlock(&irq_controller_lock); 227 spin_unlock(&irq_controller_lock);
227 228
228 gic_irq = (status & 0x3ff); 229 gic_irq = (status & 0x3ff);
@@ -236,15 +237,14 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
236 generic_handle_irq(cascade_irq); 237 generic_handle_irq(cascade_irq);
237 238
238 out: 239 out:
239 /* primary controller unmasking */ 240 chained_irq_exit(chip, desc);
240 chip->irq_unmask(&desc->irq_data);
241} 241}
242 242
243static struct irq_chip gic_chip = { 243static struct irq_chip gic_chip = {
244 .name = "GIC", 244 .name = "GIC",
245 .irq_ack = gic_ack_irq,
246 .irq_mask = gic_mask_irq, 245 .irq_mask = gic_mask_irq,
247 .irq_unmask = gic_unmask_irq, 246 .irq_unmask = gic_unmask_irq,
247 .irq_eoi = gic_eoi_irq,
248 .irq_set_type = gic_set_type, 248 .irq_set_type = gic_set_type,
249 .irq_retrigger = gic_retrigger, 249 .irq_retrigger = gic_retrigger,
250#ifdef CONFIG_SMP 250#ifdef CONFIG_SMP
@@ -272,13 +272,13 @@ static void __init gic_dist_init(struct gic_chip_data *gic,
272 cpumask |= cpumask << 8; 272 cpumask |= cpumask << 8;
273 cpumask |= cpumask << 16; 273 cpumask |= cpumask << 16;
274 274
275 writel(0, base + GIC_DIST_CTRL); 275 writel_relaxed(0, base + GIC_DIST_CTRL);
276 276
277 /* 277 /*
278 * Find out how many interrupts are supported. 278 * Find out how many interrupts are supported.
279 * The GIC only supports up to 1020 interrupt sources. 279 * The GIC only supports up to 1020 interrupt sources.
280 */ 280 */
281 gic_irqs = readl(base + GIC_DIST_CTR) & 0x1f; 281 gic_irqs = readl_relaxed(base + GIC_DIST_CTR) & 0x1f;
282 gic_irqs = (gic_irqs + 1) * 32; 282 gic_irqs = (gic_irqs + 1) * 32;
283 if (gic_irqs > 1020) 283 if (gic_irqs > 1020)
284 gic_irqs = 1020; 284 gic_irqs = 1020;
@@ -287,26 +287,26 @@ static void __init gic_dist_init(struct gic_chip_data *gic,
287 * Set all global interrupts to be level triggered, active low. 287 * Set all global interrupts to be level triggered, active low.
288 */ 288 */
289 for (i = 32; i < gic_irqs; i += 16) 289 for (i = 32; i < gic_irqs; i += 16)
290 writel(0, base + GIC_DIST_CONFIG + i * 4 / 16); 290 writel_relaxed(0, base + GIC_DIST_CONFIG + i * 4 / 16);
291 291
292 /* 292 /*
293 * Set all global interrupts to this CPU only. 293 * Set all global interrupts to this CPU only.
294 */ 294 */
295 for (i = 32; i < gic_irqs; i += 4) 295 for (i = 32; i < gic_irqs; i += 4)
296 writel(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 296 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
297 297
298 /* 298 /*
299 * Set priority on all global interrupts. 299 * Set priority on all global interrupts.
300 */ 300 */
301 for (i = 32; i < gic_irqs; i += 4) 301 for (i = 32; i < gic_irqs; i += 4)
302 writel(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4); 302 writel_relaxed(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4);
303 303
304 /* 304 /*
305 * Disable all interrupts. Leave the PPI and SGIs alone 305 * Disable all interrupts. Leave the PPI and SGIs alone
306 * as these enables are banked registers. 306 * as these enables are banked registers.
307 */ 307 */
308 for (i = 32; i < gic_irqs; i += 32) 308 for (i = 32; i < gic_irqs; i += 32)
309 writel(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); 309 writel_relaxed(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32);
310 310
311 /* 311 /*
312 * Limit number of interrupts registered to the platform maximum 312 * Limit number of interrupts registered to the platform maximum
@@ -319,12 +319,12 @@ static void __init gic_dist_init(struct gic_chip_data *gic,
319 * Setup the Linux IRQ subsystem. 319 * Setup the Linux IRQ subsystem.
320 */ 320 */
321 for (i = irq_start; i < irq_limit; i++) { 321 for (i = irq_start; i < irq_limit; i++) {
322 irq_set_chip_and_handler(i, &gic_chip, handle_level_irq); 322 irq_set_chip_and_handler(i, &gic_chip, handle_fasteoi_irq);
323 irq_set_chip_data(i, gic); 323 irq_set_chip_data(i, gic);
324 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 324 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
325 } 325 }
326 326
327 writel(1, base + GIC_DIST_CTRL); 327 writel_relaxed(1, base + GIC_DIST_CTRL);
328} 328}
329 329
330static void __cpuinit gic_cpu_init(struct gic_chip_data *gic) 330static void __cpuinit gic_cpu_init(struct gic_chip_data *gic)
@@ -337,17 +337,17 @@ static void __cpuinit gic_cpu_init(struct gic_chip_data *gic)
337 * Deal with the banked PPI and SGI interrupts - disable all 337 * Deal with the banked PPI and SGI interrupts - disable all
338 * PPI interrupts, ensure all SGI interrupts are enabled. 338 * PPI interrupts, ensure all SGI interrupts are enabled.
339 */ 339 */
340 writel(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR); 340 writel_relaxed(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR);
341 writel(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET); 341 writel_relaxed(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET);
342 342
343 /* 343 /*
344 * Set priority on PPI and SGI interrupts 344 * Set priority on PPI and SGI interrupts
345 */ 345 */
346 for (i = 0; i < 32; i += 4) 346 for (i = 0; i < 32; i += 4)
347 writel(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4); 347 writel_relaxed(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4);
348 348
349 writel(0xf0, base + GIC_CPU_PRIMASK); 349 writel_relaxed(0xf0, base + GIC_CPU_PRIMASK);
350 writel(1, base + GIC_CPU_CTRL); 350 writel_relaxed(1, base + GIC_CPU_CTRL);
351} 351}
352 352
353void __init gic_init(unsigned int gic_nr, unsigned int irq_start, 353void __init gic_init(unsigned int gic_nr, unsigned int irq_start,
@@ -391,7 +391,13 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
391{ 391{
392 unsigned long map = *cpus_addr(*mask); 392 unsigned long map = *cpus_addr(*mask);
393 393
394 /*
395 * Ensure that stores to Normal memory are visible to the
396 * other CPUs before issuing the IPI.
397 */
398 dsb();
399
394 /* this always happens on GIC0 */ 400 /* this always happens on GIC0 */
395 writel(map << 16 | irq, gic_data[0].dist_base + GIC_DIST_SOFTINT); 401 writel_relaxed(map << 16 | irq, gic_data[0].dist_base + GIC_DIST_SOFTINT);
396} 402}
397#endif 403#endif
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
index 8f0f86db360..97912fa4878 100644
--- a/arch/arm/common/pl330.c
+++ b/arch/arm/common/pl330.c
@@ -1045,7 +1045,7 @@ static inline int _loop(unsigned dry_run, u8 buf[],
1045 unsigned lcnt0, lcnt1, ljmp0, ljmp1; 1045 unsigned lcnt0, lcnt1, ljmp0, ljmp1;
1046 struct _arg_LPEND lpend; 1046 struct _arg_LPEND lpend;
1047 1047
1048 /* Max iterations possibile in DMALP is 256 */ 1048 /* Max iterations possible in DMALP is 256 */
1049 if (*bursts >= 256*256) { 1049 if (*bursts >= 256*256) {
1050 lcnt1 = 256; 1050 lcnt1 = 256;
1051 lcnt0 = 256; 1051 lcnt0 = 256;
@@ -1446,7 +1446,7 @@ int pl330_update(const struct pl330_info *pi)
1446 } 1446 }
1447 1447
1448 for (ev = 0; ev < pi->pcfg.num_events; ev++) { 1448 for (ev = 0; ev < pi->pcfg.num_events; ev++) {
1449 if (val & (1 << ev)) { /* Event occured */ 1449 if (val & (1 << ev)) { /* Event occurred */
1450 struct pl330_thread *thrd; 1450 struct pl330_thread *thrd;
1451 u32 inten = readl(regs + INTEN); 1451 u32 inten = readl(regs + INTEN);
1452 int active; 1452 int active;
diff --git a/arch/arm/configs/at91x40_defconfig b/arch/arm/configs/at91x40_defconfig
new file mode 100644
index 00000000000..c55e9212fcb
--- /dev/null
+++ b/arch/arm/configs/at91x40_defconfig
@@ -0,0 +1,48 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14
3CONFIG_EMBEDDED=y
4# CONFIG_HOTPLUG is not set
5# CONFIG_ELF_CORE is not set
6# CONFIG_FUTEX is not set
7# CONFIG_TIMERFD is not set
8# CONFIG_VM_EVENT_COUNTERS is not set
9# CONFIG_COMPAT_BRK is not set
10CONFIG_SLAB=y
11# CONFIG_LBDAF is not set
12# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_MMU is not set
16CONFIG_ARCH_AT91=y
17CONFIG_ARCH_AT91X40=y
18CONFIG_MACH_AT91EB01=y
19CONFIG_AT91_EARLY_USART0=y
20CONFIG_CPU_ARM7TDMI=y
21CONFIG_SET_MEM_PARAM=y
22CONFIG_DRAM_BASE=0x01000000
23CONFIG_DRAM_SIZE=0x00400000
24CONFIG_FLASH_MEM_BASE=0x01400000
25CONFIG_PROCESSOR_ID=0x14000040
26CONFIG_ZBOOT_ROM_TEXT=0x0
27CONFIG_ZBOOT_ROM_BSS=0x0
28CONFIG_BINFMT_FLAT=y
29# CONFIG_SUSPEND is not set
30# CONFIG_FW_LOADER is not set
31CONFIG_MTD=y
32CONFIG_MTD_PARTITIONS=y
33CONFIG_MTD_CHAR=y
34CONFIG_MTD_BLOCK=y
35CONFIG_MTD_RAM=y
36CONFIG_MTD_ROM=y
37CONFIG_BLK_DEV_RAM=y
38# CONFIG_INPUT is not set
39# CONFIG_SERIO is not set
40# CONFIG_VT is not set
41# CONFIG_DEVKMEM is not set
42# CONFIG_HW_RANDOM is not set
43# CONFIG_HWMON is not set
44# CONFIG_USB_SUPPORT is not set
45CONFIG_EXT2_FS=y
46# CONFIG_DNOTIFY is not set
47CONFIG_ROMFS_FS=y
48# CONFIG_ENABLE_MUST_CHECK is not set
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index 54bf5eec801..40db34cf277 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -8,8 +8,6 @@ CONFIG_MODULE_UNLOAD=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_ARCH_DOVE=y 9CONFIG_ARCH_DOVE=y
10CONFIG_MACH_DOVE_DB=y 10CONFIG_MACH_DOVE_DB=y
11CONFIG_CPU_V6=y
12CONFIG_CPU_32v6K=y
13CONFIG_NO_HZ=y 11CONFIG_NO_HZ=y
14CONFIG_HIGH_RES_TIMERS=y 12CONFIG_HIGH_RES_TIMERS=y
15CONFIG_AEABI=y 13CONFIG_AEABI=y
@@ -44,7 +42,6 @@ CONFIG_MTD_UBI=y
44CONFIG_BLK_DEV_LOOP=y 42CONFIG_BLK_DEV_LOOP=y
45CONFIG_BLK_DEV_RAM=y 43CONFIG_BLK_DEV_RAM=y
46CONFIG_BLK_DEV_RAM_COUNT=1 44CONFIG_BLK_DEV_RAM_COUNT=1
47# CONFIG_MISC_DEVICES is not set
48# CONFIG_SCSI_PROC_FS is not set 45# CONFIG_SCSI_PROC_FS is not set
49CONFIG_BLK_DEV_SD=y 46CONFIG_BLK_DEV_SD=y
50# CONFIG_SCSI_LOWLEVEL is not set 47# CONFIG_SCSI_LOWLEVEL is not set
@@ -59,12 +56,12 @@ CONFIG_INPUT_EVDEV=y
59# CONFIG_KEYBOARD_ATKBD is not set 56# CONFIG_KEYBOARD_ATKBD is not set
60# CONFIG_MOUSE_PS2 is not set 57# CONFIG_MOUSE_PS2 is not set
61# CONFIG_SERIO is not set 58# CONFIG_SERIO is not set
59CONFIG_LEGACY_PTY_COUNT=16
62# CONFIG_DEVKMEM is not set 60# CONFIG_DEVKMEM is not set
63CONFIG_SERIAL_8250=y 61CONFIG_SERIAL_8250=y
64CONFIG_SERIAL_8250_CONSOLE=y 62CONFIG_SERIAL_8250_CONSOLE=y
65# CONFIG_SERIAL_8250_PCI is not set 63# CONFIG_SERIAL_8250_PCI is not set
66CONFIG_SERIAL_8250_RUNTIME_UARTS=2 64CONFIG_SERIAL_8250_RUNTIME_UARTS=2
67CONFIG_LEGACY_PTY_COUNT=16
68# CONFIG_HW_RANDOM is not set 65# CONFIG_HW_RANDOM is not set
69CONFIG_I2C=y 66CONFIG_I2C=y
70CONFIG_I2C_CHARDEV=y 67CONFIG_I2C_CHARDEV=y
@@ -72,12 +69,10 @@ CONFIG_I2C_MV64XXX=y
72CONFIG_SPI=y 69CONFIG_SPI=y
73CONFIG_SPI_ORION=y 70CONFIG_SPI_ORION=y
74# CONFIG_HWMON is not set 71# CONFIG_HWMON is not set
75# CONFIG_VGA_CONSOLE is not set
76CONFIG_USB=y 72CONFIG_USB=y
77CONFIG_USB_DEVICEFS=y 73CONFIG_USB_DEVICEFS=y
78CONFIG_USB_EHCI_HCD=y 74CONFIG_USB_EHCI_HCD=y
79CONFIG_USB_EHCI_ROOT_HUB_TT=y 75CONFIG_USB_EHCI_ROOT_HUB_TT=y
80CONFIG_USB_EHCI_TT_NEWSCHED=y
81CONFIG_USB_STORAGE=y 76CONFIG_USB_STORAGE=y
82CONFIG_RTC_CLASS=y 77CONFIG_RTC_CLASS=y
83CONFIG_RTC_DRV_MV=y 78CONFIG_RTC_DRV_MV=y
@@ -86,7 +81,6 @@ CONFIG_MV_XOR=y
86CONFIG_EXT2_FS=y 81CONFIG_EXT2_FS=y
87CONFIG_EXT3_FS=y 82CONFIG_EXT3_FS=y
88# CONFIG_EXT3_FS_XATTR is not set 83# CONFIG_EXT3_FS_XATTR is not set
89CONFIG_INOTIFY=y
90CONFIG_ISO9660_FS=y 84CONFIG_ISO9660_FS=y
91CONFIG_JOLIET=y 85CONFIG_JOLIET=y
92CONFIG_UDF_FS=m 86CONFIG_UDF_FS=m
@@ -110,23 +104,19 @@ CONFIG_DEBUG_KERNEL=y
110CONFIG_TIMER_STATS=y 104CONFIG_TIMER_STATS=y
111# CONFIG_DEBUG_BUGVERBOSE is not set 105# CONFIG_DEBUG_BUGVERBOSE is not set
112CONFIG_DEBUG_INFO=y 106CONFIG_DEBUG_INFO=y
113# CONFIG_RCU_CPU_STALL_DETECTOR is not set
114CONFIG_SYSCTL_SYSCALL_CHECK=y 107CONFIG_SYSCTL_SYSCALL_CHECK=y
115CONFIG_DEBUG_USER=y 108CONFIG_DEBUG_USER=y
116CONFIG_DEBUG_ERRORS=y 109CONFIG_DEBUG_ERRORS=y
117CONFIG_CRYPTO_NULL=y 110CONFIG_CRYPTO_NULL=y
118CONFIG_CRYPTO_CBC=y
119CONFIG_CRYPTO_ECB=m 111CONFIG_CRYPTO_ECB=m
120CONFIG_CRYPTO_PCBC=m 112CONFIG_CRYPTO_PCBC=m
121CONFIG_CRYPTO_HMAC=y 113CONFIG_CRYPTO_HMAC=y
122CONFIG_CRYPTO_MD4=y 114CONFIG_CRYPTO_MD4=y
123CONFIG_CRYPTO_MD5=y
124CONFIG_CRYPTO_SHA1=y 115CONFIG_CRYPTO_SHA1=y
125CONFIG_CRYPTO_SHA256=y 116CONFIG_CRYPTO_SHA256=y
126CONFIG_CRYPTO_SHA512=y 117CONFIG_CRYPTO_SHA512=y
127CONFIG_CRYPTO_AES=y 118CONFIG_CRYPTO_AES=y
128CONFIG_CRYPTO_BLOWFISH=y 119CONFIG_CRYPTO_BLOWFISH=y
129CONFIG_CRYPTO_DES=y
130CONFIG_CRYPTO_TEA=y 120CONFIG_CRYPTO_TEA=y
131CONFIG_CRYPTO_TWOFISH=y 121CONFIG_CRYPTO_TWOFISH=y
132CONFIG_CRYPTO_DEFLATE=y 122CONFIG_CRYPTO_DEFLATE=y
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index ed5bc9e05a4..cd4458f6417 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -2,6 +2,7 @@
2#define __ASM_ARM_CPUTYPE_H 2#define __ASM_ARM_CPUTYPE_H
3 3
4#include <linux/stringify.h> 4#include <linux/stringify.h>
5#include <linux/kernel.h>
5 6
6#define CPUID_ID 0 7#define CPUID_ID 0
7#define CPUID_CACHETYPE 1 8#define CPUID_CACHETYPE 1
diff --git a/arch/arm/include/asm/fpstate.h b/arch/arm/include/asm/fpstate.h
index ee5e03efc1b..3ad4c10d0d8 100644
--- a/arch/arm/include/asm/fpstate.h
+++ b/arch/arm/include/asm/fpstate.h
@@ -18,7 +18,7 @@
18 * VFP storage area has: 18 * VFP storage area has:
19 * - FPEXC, FPSCR, FPINST and FPINST2. 19 * - FPEXC, FPSCR, FPINST and FPINST2.
20 * - 16 or 32 double precision data registers 20 * - 16 or 32 double precision data registers
21 * - an implementation-dependant word of state for FLDMX/FSTMX (pre-ARMv6) 21 * - an implementation-dependent word of state for FLDMX/FSTMX (pre-ARMv6)
22 * 22 *
23 * FPEXC will always be non-zero once the VFP has been used in this process. 23 * FPEXC will always be non-zero once the VFP has been used in this process.
24 */ 24 */
diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h
index c7afbc552c7..7e30874377e 100644
--- a/arch/arm/include/asm/glue-cache.h
+++ b/arch/arm/include/asm/glue-cache.h
@@ -126,7 +126,7 @@
126#endif 126#endif
127 127
128#if !defined(_CACHE) && !defined(MULTI_CACHE) 128#if !defined(_CACHE) && !defined(MULTI_CACHE)
129#error Unknown cache maintainence model 129#error Unknown cache maintenance model
130#endif 130#endif
131 131
132#ifndef MULTI_CACHE 132#ifndef MULTI_CACHE
diff --git a/arch/arm/include/asm/glue.h b/arch/arm/include/asm/glue.h
index 0ec35d1698a..fbf71d75ec8 100644
--- a/arch/arm/include/asm/glue.h
+++ b/arch/arm/include/asm/glue.h
@@ -10,8 +10,8 @@
10 * 10 *
11 * This file provides the glue to stick the processor-specific bits 11 * This file provides the glue to stick the processor-specific bits
12 * into the kernel in an efficient manner. The idea is to use branches 12 * into the kernel in an efficient manner. The idea is to use branches
13 * when we're only targetting one class of TLB, or indirect calls 13 * when we're only targeting one class of TLB, or indirect calls
14 * when we're targetting multiple classes of TLBs. 14 * when we're targeting multiple classes of TLBs.
15 */ 15 */
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
diff --git a/arch/arm/include/asm/hardware/pl080.h b/arch/arm/include/asm/hardware/pl080.h
index f35b86e68dd..e4a04e4e562 100644
--- a/arch/arm/include/asm/hardware/pl080.h
+++ b/arch/arm/include/asm/hardware/pl080.h
@@ -16,7 +16,7 @@
16 * make it not entierly compatible with the PL080 specification from 16 * make it not entierly compatible with the PL080 specification from
17 * ARM. When in doubt, check the Samsung documentation first. 17 * ARM. When in doubt, check the Samsung documentation first.
18 * 18 *
19 * The Samsung defines are PL080S, and add an extra controll register, 19 * The Samsung defines are PL080S, and add an extra control register,
20 * the ability to move more than 2^11 counts of data and some extra 20 * the ability to move more than 2^11 counts of data and some extra
21 * OneNAND features. 21 * OneNAND features.
22*/ 22*/
diff --git a/arch/arm/include/asm/kprobes.h b/arch/arm/include/asm/kprobes.h
index bb8a19bd582..e46bdd0097e 100644
--- a/arch/arm/include/asm/kprobes.h
+++ b/arch/arm/include/asm/kprobes.h
@@ -39,10 +39,13 @@ typedef u32 kprobe_opcode_t;
39struct kprobe; 39struct kprobe;
40typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *); 40typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);
41 41
42typedef unsigned long (kprobe_check_cc)(unsigned long);
43
42/* Architecture specific copy of original instruction. */ 44/* Architecture specific copy of original instruction. */
43struct arch_specific_insn { 45struct arch_specific_insn {
44 kprobe_opcode_t *insn; 46 kprobe_opcode_t *insn;
45 kprobe_insn_handler_t *insn_handler; 47 kprobe_insn_handler_t *insn_handler;
48 kprobe_check_cc *insn_check_cc;
46}; 49};
47 50
48struct prev_kprobe { 51struct prev_kprobe {
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 9a87823642d..885be097769 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -249,7 +249,7 @@ do { \
249 * cache totally. This means that the cache becomes inconsistent, and, 249 * cache totally. This means that the cache becomes inconsistent, and,
250 * since we use normal loads/stores as well, this is really bad. 250 * since we use normal loads/stores as well, this is really bad.
251 * Typically, this causes oopsen in filp_close, but could have other, 251 * Typically, this causes oopsen in filp_close, but could have other,
252 * more disasterous effects. There are two work-arounds: 252 * more disastrous effects. There are two work-arounds:
253 * 1. Disable interrupts and emulate the atomic swap 253 * 1. Disable interrupts and emulate the atomic swap
254 * 2. Clean the cache, perform atomic swap, flush the cache 254 * 2. Clean the cache, perform atomic swap, flush the cache
255 * 255 *
diff --git a/arch/arm/include/asm/thread_notify.h b/arch/arm/include/asm/thread_notify.h
index c4391ba2035..1dc98067589 100644
--- a/arch/arm/include/asm/thread_notify.h
+++ b/arch/arm/include/asm/thread_notify.h
@@ -43,6 +43,7 @@ static inline void thread_notify(unsigned long rc, struct thread_info *thread)
43#define THREAD_NOTIFY_FLUSH 0 43#define THREAD_NOTIFY_FLUSH 0
44#define THREAD_NOTIFY_EXIT 1 44#define THREAD_NOTIFY_EXIT 1
45#define THREAD_NOTIFY_SWITCH 2 45#define THREAD_NOTIFY_SWITCH 2
46#define THREAD_NOTIFY_COPY 3
46 47
47#endif 48#endif
48#endif 49#endif
diff --git a/arch/arm/include/asm/ucontext.h b/arch/arm/include/asm/ucontext.h
index 47f023aa849..14749aec94b 100644
--- a/arch/arm/include/asm/ucontext.h
+++ b/arch/arm/include/asm/ucontext.h
@@ -47,7 +47,7 @@ struct crunch_sigframe {
47#endif 47#endif
48 48
49#ifdef CONFIG_IWMMXT 49#ifdef CONFIG_IWMMXT
50/* iwmmxt_area is 0x98 bytes long, preceeded by 8 bytes of signature */ 50/* iwmmxt_area is 0x98 bytes long, preceded by 8 bytes of signature */
51#define IWMMXT_MAGIC 0x12ef842a 51#define IWMMXT_MAGIC 0x12ef842a
52#define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8) 52#define IWMMXT_STORAGE_SIZE (IWMMXT_SIZE + 8)
53 53
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index c891eb76c0e..87dbe3e2197 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -396,6 +396,10 @@
396#define __NR_fanotify_init (__NR_SYSCALL_BASE+367) 396#define __NR_fanotify_init (__NR_SYSCALL_BASE+367)
397#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368) 397#define __NR_fanotify_mark (__NR_SYSCALL_BASE+368)
398#define __NR_prlimit64 (__NR_SYSCALL_BASE+369) 398#define __NR_prlimit64 (__NR_SYSCALL_BASE+369)
399#define __NR_name_to_handle_at (__NR_SYSCALL_BASE+370)
400#define __NR_open_by_handle_at (__NR_SYSCALL_BASE+371)
401#define __NR_clock_adjtime (__NR_SYSCALL_BASE+372)
402#define __NR_syncfs (__NR_SYSCALL_BASE+373)
399 403
400/* 404/*
401 * The following SWIs are ARM private. 405 * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 74554f1742d..8d95446150a 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -29,7 +29,7 @@ obj-$(CONFIG_MODULES) += armksyms.o module.o
29obj-$(CONFIG_ARTHUR) += arthur.o 29obj-$(CONFIG_ARTHUR) += arthur.o
30obj-$(CONFIG_ISA_DMA) += dma-isa.o 30obj-$(CONFIG_ISA_DMA) += dma-isa.o
31obj-$(CONFIG_PCI) += bios32.o isa.o 31obj-$(CONFIG_PCI) += bios32.o isa.o
32obj-$(CONFIG_PM) += sleep.o 32obj-$(CONFIG_PM_SLEEP) += sleep.o
33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o 33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
34obj-$(CONFIG_SMP) += smp.o smp_tlb.o 34obj-$(CONFIG_SMP) += smp.o smp_tlb.o
35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 5c26eccef99..7fbf28c35bb 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -379,6 +379,10 @@
379 CALL(sys_fanotify_init) 379 CALL(sys_fanotify_init)
380 CALL(sys_fanotify_mark) 380 CALL(sys_fanotify_mark)
381 CALL(sys_prlimit64) 381 CALL(sys_prlimit64)
382/* 370 */ CALL(sys_name_to_handle_at)
383 CALL(sys_open_by_handle_at)
384 CALL(sys_clock_adjtime)
385 CALL(sys_syncfs)
382#ifndef syscalls_counted 386#ifndef syscalls_counted
383.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 387.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
384#define syscalls_counted 388#define syscalls_counted
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c
index d4a0da1e48f..9b05c6a0dce 100644
--- a/arch/arm/kernel/elf.c
+++ b/arch/arm/kernel/elf.c
@@ -40,15 +40,22 @@ EXPORT_SYMBOL(elf_check_arch);
40void elf_set_personality(const struct elf32_hdr *x) 40void elf_set_personality(const struct elf32_hdr *x)
41{ 41{
42 unsigned int eflags = x->e_flags; 42 unsigned int eflags = x->e_flags;
43 unsigned int personality = PER_LINUX_32BIT; 43 unsigned int personality = current->personality & ~PER_MASK;
44
45 /*
46 * We only support Linux ELF executables, so always set the
47 * personality to LINUX.
48 */
49 personality |= PER_LINUX;
44 50
45 /* 51 /*
46 * APCS-26 is only valid for OABI executables 52 * APCS-26 is only valid for OABI executables
47 */ 53 */
48 if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN) { 54 if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN &&
49 if (eflags & EF_ARM_APCS_26) 55 (eflags & EF_ARM_APCS_26))
50 personality = PER_LINUX; 56 personality &= ~ADDR_LIMIT_32BIT;
51 } 57 else
58 personality |= ADDR_LIMIT_32BIT;
52 59
53 set_personality(personality); 60 set_personality(personality);
54 61
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 8dbc126f715..87acc25d7a3 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -868,6 +868,13 @@ static void reset_ctrl_regs(void *info)
868 */ 868 */
869 asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0)); 869 asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0));
870 isb(); 870 isb();
871
872 /*
873 * Clear any configured vector-catch events before
874 * enabling monitor mode.
875 */
876 asm volatile("mcr p14, 0, %0, c0, c7, 0" : : "r" (0));
877 isb();
871 } 878 }
872 879
873 if (enable_monitor_mode()) 880 if (enable_monitor_mode())
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 23891317dc4..15eeff6aea0 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -34,9 +34,6 @@
34 * 34 *
35 * *) If the PC is written to by the instruction, the 35 * *) If the PC is written to by the instruction, the
36 * instruction must be fully simulated in software. 36 * instruction must be fully simulated in software.
37 * If it is a conditional instruction, the handler
38 * will use insn[0] to copy its condition code to
39 * set r0 to 1 and insn[1] to "mov pc, lr" to return.
40 * 37 *
41 * *) Otherwise, a modified form of the instruction is 38 * *) Otherwise, a modified form of the instruction is
42 * directly executed. Its handler calls the 39 * directly executed. Its handler calls the
@@ -68,13 +65,17 @@
68 65
69#define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25) 66#define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25)
70 67
68#define is_r15(insn, bitpos) (((insn) & (0xf << bitpos)) == (0xf << bitpos))
69
70/*
71 * Test if load/store instructions writeback the address register.
72 * if P (bit 24) == 0 or W (bit 21) == 1
73 */
74#define is_writeback(insn) ((insn ^ 0x01000000) & 0x01200000)
75
71#define PSR_fs (PSR_f|PSR_s) 76#define PSR_fs (PSR_f|PSR_s)
72 77
73#define KPROBE_RETURN_INSTRUCTION 0xe1a0f00e /* mov pc, lr */ 78#define KPROBE_RETURN_INSTRUCTION 0xe1a0f00e /* mov pc, lr */
74#define SET_R0_TRUE_INSTRUCTION 0xe3a00001 /* mov r0, #1 */
75
76#define truecc_insn(insn) (((insn) & 0xf0000000) | \
77 (SET_R0_TRUE_INSTRUCTION & 0x0fffffff))
78 79
79typedef long (insn_0arg_fn_t)(void); 80typedef long (insn_0arg_fn_t)(void);
80typedef long (insn_1arg_fn_t)(long); 81typedef long (insn_1arg_fn_t)(long);
@@ -419,14 +420,10 @@ insnslot_llret_4arg_rwflags(long r0, long r1, long r2, long r3, long *cpsr,
419 420
420static void __kprobes simulate_bbl(struct kprobe *p, struct pt_regs *regs) 421static void __kprobes simulate_bbl(struct kprobe *p, struct pt_regs *regs)
421{ 422{
422 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
423 kprobe_opcode_t insn = p->opcode; 423 kprobe_opcode_t insn = p->opcode;
424 long iaddr = (long)p->addr; 424 long iaddr = (long)p->addr;
425 int disp = branch_displacement(insn); 425 int disp = branch_displacement(insn);
426 426
427 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
428 return;
429
430 if (insn & (1 << 24)) 427 if (insn & (1 << 24))
431 regs->ARM_lr = iaddr + 4; 428 regs->ARM_lr = iaddr + 4;
432 429
@@ -446,14 +443,10 @@ static void __kprobes simulate_blx1(struct kprobe *p, struct pt_regs *regs)
446 443
447static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs) 444static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs)
448{ 445{
449 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
450 kprobe_opcode_t insn = p->opcode; 446 kprobe_opcode_t insn = p->opcode;
451 int rm = insn & 0xf; 447 int rm = insn & 0xf;
452 long rmv = regs->uregs[rm]; 448 long rmv = regs->uregs[rm];
453 449
454 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
455 return;
456
457 if (insn & (1 << 5)) 450 if (insn & (1 << 5))
458 regs->ARM_lr = (long)p->addr + 4; 451 regs->ARM_lr = (long)p->addr + 4;
459 452
@@ -463,9 +456,16 @@ static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs)
463 regs->ARM_cpsr |= PSR_T_BIT; 456 regs->ARM_cpsr |= PSR_T_BIT;
464} 457}
465 458
459static void __kprobes simulate_mrs(struct kprobe *p, struct pt_regs *regs)
460{
461 kprobe_opcode_t insn = p->opcode;
462 int rd = (insn >> 12) & 0xf;
463 unsigned long mask = 0xf8ff03df; /* Mask out execution state */
464 regs->uregs[rd] = regs->ARM_cpsr & mask;
465}
466
466static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs) 467static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs)
467{ 468{
468 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
469 kprobe_opcode_t insn = p->opcode; 469 kprobe_opcode_t insn = p->opcode;
470 int rn = (insn >> 16) & 0xf; 470 int rn = (insn >> 16) & 0xf;
471 int lbit = insn & (1 << 20); 471 int lbit = insn & (1 << 20);
@@ -476,9 +476,6 @@ static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs)
476 int reg_bit_vector; 476 int reg_bit_vector;
477 int reg_count; 477 int reg_count;
478 478
479 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
480 return;
481
482 reg_count = 0; 479 reg_count = 0;
483 reg_bit_vector = insn & 0xffff; 480 reg_bit_vector = insn & 0xffff;
484 while (reg_bit_vector) { 481 while (reg_bit_vector) {
@@ -510,11 +507,6 @@ static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs)
510 507
511static void __kprobes simulate_stm1_pc(struct kprobe *p, struct pt_regs *regs) 508static void __kprobes simulate_stm1_pc(struct kprobe *p, struct pt_regs *regs)
512{ 509{
513 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
514
515 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
516 return;
517
518 regs->ARM_pc = (long)p->addr + str_pc_offset; 510 regs->ARM_pc = (long)p->addr + str_pc_offset;
519 simulate_ldm1stm1(p, regs); 511 simulate_ldm1stm1(p, regs);
520 regs->ARM_pc = (long)p->addr + 4; 512 regs->ARM_pc = (long)p->addr + 4;
@@ -525,24 +517,16 @@ static void __kprobes simulate_mov_ipsp(struct kprobe *p, struct pt_regs *regs)
525 regs->uregs[12] = regs->uregs[13]; 517 regs->uregs[12] = regs->uregs[13];
526} 518}
527 519
528static void __kprobes emulate_ldcstc(struct kprobe *p, struct pt_regs *regs)
529{
530 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
531 kprobe_opcode_t insn = p->opcode;
532 int rn = (insn >> 16) & 0xf;
533 long rnv = regs->uregs[rn];
534
535 /* Save Rn in case of writeback. */
536 regs->uregs[rn] = insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn);
537}
538
539static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs) 520static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs)
540{ 521{
541 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0]; 522 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
542 kprobe_opcode_t insn = p->opcode; 523 kprobe_opcode_t insn = p->opcode;
524 long ppc = (long)p->addr + 8;
543 int rd = (insn >> 12) & 0xf; 525 int rd = (insn >> 12) & 0xf;
544 int rn = (insn >> 16) & 0xf; 526 int rn = (insn >> 16) & 0xf;
545 int rm = insn & 0xf; /* rm may be invalid, don't care. */ 527 int rm = insn & 0xf; /* rm may be invalid, don't care. */
528 long rmv = (rm == 15) ? ppc : regs->uregs[rm];
529 long rnv = (rn == 15) ? ppc : regs->uregs[rn];
546 530
547 /* Not following the C calling convention here, so need asm(). */ 531 /* Not following the C calling convention here, so need asm(). */
548 __asm__ __volatile__ ( 532 __asm__ __volatile__ (
@@ -554,29 +538,36 @@ static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs)
554 "str r0, %[rn] \n\t" /* in case of writeback */ 538 "str r0, %[rn] \n\t" /* in case of writeback */
555 "str r2, %[rd0] \n\t" 539 "str r2, %[rd0] \n\t"
556 "str r3, %[rd1] \n\t" 540 "str r3, %[rd1] \n\t"
557 : [rn] "+m" (regs->uregs[rn]), 541 : [rn] "+m" (rnv),
558 [rd0] "=m" (regs->uregs[rd]), 542 [rd0] "=m" (regs->uregs[rd]),
559 [rd1] "=m" (regs->uregs[rd+1]) 543 [rd1] "=m" (regs->uregs[rd+1])
560 : [rm] "m" (regs->uregs[rm]), 544 : [rm] "m" (rmv),
561 [cpsr] "r" (regs->ARM_cpsr), 545 [cpsr] "r" (regs->ARM_cpsr),
562 [i_fn] "r" (i_fn) 546 [i_fn] "r" (i_fn)
563 : "r0", "r1", "r2", "r3", "lr", "cc" 547 : "r0", "r1", "r2", "r3", "lr", "cc"
564 ); 548 );
549 if (is_writeback(insn))
550 regs->uregs[rn] = rnv;
565} 551}
566 552
567static void __kprobes emulate_strd(struct kprobe *p, struct pt_regs *regs) 553static void __kprobes emulate_strd(struct kprobe *p, struct pt_regs *regs)
568{ 554{
569 insn_4arg_fn_t *i_fn = (insn_4arg_fn_t *)&p->ainsn.insn[0]; 555 insn_4arg_fn_t *i_fn = (insn_4arg_fn_t *)&p->ainsn.insn[0];
570 kprobe_opcode_t insn = p->opcode; 556 kprobe_opcode_t insn = p->opcode;
557 long ppc = (long)p->addr + 8;
571 int rd = (insn >> 12) & 0xf; 558 int rd = (insn >> 12) & 0xf;
572 int rn = (insn >> 16) & 0xf; 559 int rn = (insn >> 16) & 0xf;
573 int rm = insn & 0xf; 560 int rm = insn & 0xf;
574 long rnv = regs->uregs[rn]; 561 long rnv = (rn == 15) ? ppc : regs->uregs[rn];
575 long rmv = regs->uregs[rm]; /* rm/rmv may be invalid, don't care. */ 562 /* rm/rmv may be invalid, don't care. */
563 long rmv = (rm == 15) ? ppc : regs->uregs[rm];
564 long rnv_wb;
576 565
577 regs->uregs[rn] = insnslot_4arg_rflags(rnv, rmv, regs->uregs[rd], 566 rnv_wb = insnslot_4arg_rflags(rnv, rmv, regs->uregs[rd],
578 regs->uregs[rd+1], 567 regs->uregs[rd+1],
579 regs->ARM_cpsr, i_fn); 568 regs->ARM_cpsr, i_fn);
569 if (is_writeback(insn))
570 regs->uregs[rn] = rnv_wb;
580} 571}
581 572
582static void __kprobes emulate_ldr(struct kprobe *p, struct pt_regs *regs) 573static void __kprobes emulate_ldr(struct kprobe *p, struct pt_regs *regs)
@@ -630,31 +621,6 @@ static void __kprobes emulate_str(struct kprobe *p, struct pt_regs *regs)
630 regs->uregs[rn] = rnv_wb; /* Save Rn in case of writeback. */ 621 regs->uregs[rn] = rnv_wb; /* Save Rn in case of writeback. */
631} 622}
632 623
633static void __kprobes emulate_mrrc(struct kprobe *p, struct pt_regs *regs)
634{
635 insn_llret_0arg_fn_t *i_fn = (insn_llret_0arg_fn_t *)&p->ainsn.insn[0];
636 kprobe_opcode_t insn = p->opcode;
637 union reg_pair fnr;
638 int rd = (insn >> 12) & 0xf;
639 int rn = (insn >> 16) & 0xf;
640
641 fnr.dr = insnslot_llret_0arg_rflags(regs->ARM_cpsr, i_fn);
642 regs->uregs[rn] = fnr.r0;
643 regs->uregs[rd] = fnr.r1;
644}
645
646static void __kprobes emulate_mcrr(struct kprobe *p, struct pt_regs *regs)
647{
648 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
649 kprobe_opcode_t insn = p->opcode;
650 int rd = (insn >> 12) & 0xf;
651 int rn = (insn >> 16) & 0xf;
652 long rnv = regs->uregs[rn];
653 long rdv = regs->uregs[rd];
654
655 insnslot_2arg_rflags(rnv, rdv, regs->ARM_cpsr, i_fn);
656}
657
658static void __kprobes emulate_sat(struct kprobe *p, struct pt_regs *regs) 624static void __kprobes emulate_sat(struct kprobe *p, struct pt_regs *regs)
659{ 625{
660 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; 626 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
@@ -688,32 +654,32 @@ static void __kprobes emulate_none(struct kprobe *p, struct pt_regs *regs)
688 insnslot_0arg_rflags(regs->ARM_cpsr, i_fn); 654 insnslot_0arg_rflags(regs->ARM_cpsr, i_fn);
689} 655}
690 656
691static void __kprobes emulate_rd12(struct kprobe *p, struct pt_regs *regs) 657static void __kprobes emulate_nop(struct kprobe *p, struct pt_regs *regs)
692{ 658{
693 insn_0arg_fn_t *i_fn = (insn_0arg_fn_t *)&p->ainsn.insn[0];
694 kprobe_opcode_t insn = p->opcode;
695 int rd = (insn >> 12) & 0xf;
696
697 regs->uregs[rd] = insnslot_0arg_rflags(regs->ARM_cpsr, i_fn);
698} 659}
699 660
700static void __kprobes emulate_ird12(struct kprobe *p, struct pt_regs *regs) 661static void __kprobes
662emulate_rd12_modify(struct kprobe *p, struct pt_regs *regs)
701{ 663{
702 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; 664 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
703 kprobe_opcode_t insn = p->opcode; 665 kprobe_opcode_t insn = p->opcode;
704 int ird = (insn >> 12) & 0xf; 666 int rd = (insn >> 12) & 0xf;
667 long rdv = regs->uregs[rd];
705 668
706 insnslot_1arg_rflags(regs->uregs[ird], regs->ARM_cpsr, i_fn); 669 regs->uregs[rd] = insnslot_1arg_rflags(rdv, regs->ARM_cpsr, i_fn);
707} 670}
708 671
709static void __kprobes emulate_rn16(struct kprobe *p, struct pt_regs *regs) 672static void __kprobes
673emulate_rd12rn0_modify(struct kprobe *p, struct pt_regs *regs)
710{ 674{
711 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0]; 675 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
712 kprobe_opcode_t insn = p->opcode; 676 kprobe_opcode_t insn = p->opcode;
713 int rn = (insn >> 16) & 0xf; 677 int rd = (insn >> 12) & 0xf;
678 int rn = insn & 0xf;
679 long rdv = regs->uregs[rd];
714 long rnv = regs->uregs[rn]; 680 long rnv = regs->uregs[rn];
715 681
716 insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn); 682 regs->uregs[rd] = insnslot_2arg_rflags(rdv, rnv, regs->ARM_cpsr, i_fn);
717} 683}
718 684
719static void __kprobes emulate_rd12rm0(struct kprobe *p, struct pt_regs *regs) 685static void __kprobes emulate_rd12rm0(struct kprobe *p, struct pt_regs *regs)
@@ -819,6 +785,17 @@ emulate_alu_imm_rwflags(struct kprobe *p, struct pt_regs *regs)
819} 785}
820 786
821static void __kprobes 787static void __kprobes
788emulate_alu_tests_imm(struct kprobe *p, struct pt_regs *regs)
789{
790 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
791 kprobe_opcode_t insn = p->opcode;
792 int rn = (insn >> 16) & 0xf;
793 long rnv = (rn == 15) ? (long)p->addr + 8 : regs->uregs[rn];
794
795 insnslot_1arg_rwflags(rnv, &regs->ARM_cpsr, i_fn);
796}
797
798static void __kprobes
822emulate_alu_rflags(struct kprobe *p, struct pt_regs *regs) 799emulate_alu_rflags(struct kprobe *p, struct pt_regs *regs)
823{ 800{
824 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0]; 801 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0];
@@ -854,14 +831,34 @@ emulate_alu_rwflags(struct kprobe *p, struct pt_regs *regs)
854 insnslot_3arg_rwflags(rnv, rmv, rsv, &regs->ARM_cpsr, i_fn); 831 insnslot_3arg_rwflags(rnv, rmv, rsv, &regs->ARM_cpsr, i_fn);
855} 832}
856 833
834static void __kprobes
835emulate_alu_tests(struct kprobe *p, struct pt_regs *regs)
836{
837 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0];
838 kprobe_opcode_t insn = p->opcode;
839 long ppc = (long)p->addr + 8;
840 int rn = (insn >> 16) & 0xf;
841 int rs = (insn >> 8) & 0xf; /* rs/rsv may be invalid, don't care. */
842 int rm = insn & 0xf;
843 long rnv = (rn == 15) ? ppc : regs->uregs[rn];
844 long rmv = (rm == 15) ? ppc : regs->uregs[rm];
845 long rsv = regs->uregs[rs];
846
847 insnslot_3arg_rwflags(rnv, rmv, rsv, &regs->ARM_cpsr, i_fn);
848}
849
857static enum kprobe_insn __kprobes 850static enum kprobe_insn __kprobes
858prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi) 851prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi)
859{ 852{
860 int ibit = (insn & (1 << 26)) ? 25 : 22; 853 int not_imm = (insn & (1 << 26)) ? (insn & (1 << 25))
854 : (~insn & (1 << 22));
855
856 if (is_writeback(insn) && is_r15(insn, 16))
857 return INSN_REJECTED; /* Writeback to PC */
861 858
862 insn &= 0xfff00fff; 859 insn &= 0xfff00fff;
863 insn |= 0x00001000; /* Rn = r0, Rd = r1 */ 860 insn |= 0x00001000; /* Rn = r0, Rd = r1 */
864 if (insn & (1 << ibit)) { 861 if (not_imm) {
865 insn &= ~0xf; 862 insn &= ~0xf;
866 insn |= 2; /* Rm = r2 */ 863 insn |= 2; /* Rm = r2 */
867 } 864 }
@@ -871,20 +868,40 @@ prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi)
871} 868}
872 869
873static enum kprobe_insn __kprobes 870static enum kprobe_insn __kprobes
874prep_emulate_rd12rm0(kprobe_opcode_t insn, struct arch_specific_insn *asi) 871prep_emulate_rd12_modify(kprobe_opcode_t insn, struct arch_specific_insn *asi)
875{ 872{
876 insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */ 873 if (is_r15(insn, 12))
874 return INSN_REJECTED; /* Rd is PC */
875
876 insn &= 0xffff0fff; /* Rd = r0 */
877 asi->insn[0] = insn; 877 asi->insn[0] = insn;
878 asi->insn_handler = emulate_rd12rm0; 878 asi->insn_handler = emulate_rd12_modify;
879 return INSN_GOOD; 879 return INSN_GOOD;
880} 880}
881 881
882static enum kprobe_insn __kprobes 882static enum kprobe_insn __kprobes
883prep_emulate_rd12(kprobe_opcode_t insn, struct arch_specific_insn *asi) 883prep_emulate_rd12rn0_modify(kprobe_opcode_t insn,
884 struct arch_specific_insn *asi)
884{ 885{
885 insn &= 0xffff0fff; /* Rd = r0 */ 886 if (is_r15(insn, 12))
887 return INSN_REJECTED; /* Rd is PC */
888
889 insn &= 0xffff0ff0; /* Rd = r0 */
890 insn |= 0x00000001; /* Rn = r1 */
891 asi->insn[0] = insn;
892 asi->insn_handler = emulate_rd12rn0_modify;
893 return INSN_GOOD;
894}
895
896static enum kprobe_insn __kprobes
897prep_emulate_rd12rm0(kprobe_opcode_t insn, struct arch_specific_insn *asi)
898{
899 if (is_r15(insn, 12))
900 return INSN_REJECTED; /* Rd is PC */
901
902 insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */
886 asi->insn[0] = insn; 903 asi->insn[0] = insn;
887 asi->insn_handler = emulate_rd12; 904 asi->insn_handler = emulate_rd12rm0;
888 return INSN_GOOD; 905 return INSN_GOOD;
889} 906}
890 907
@@ -892,6 +909,9 @@ static enum kprobe_insn __kprobes
892prep_emulate_rd12rn16rm0_wflags(kprobe_opcode_t insn, 909prep_emulate_rd12rn16rm0_wflags(kprobe_opcode_t insn,
893 struct arch_specific_insn *asi) 910 struct arch_specific_insn *asi)
894{ 911{
912 if (is_r15(insn, 12))
913 return INSN_REJECTED; /* Rd is PC */
914
895 insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */ 915 insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */
896 insn |= 0x00000001; /* Rm = r1 */ 916 insn |= 0x00000001; /* Rm = r1 */
897 asi->insn[0] = insn; 917 asi->insn[0] = insn;
@@ -903,6 +923,9 @@ static enum kprobe_insn __kprobes
903prep_emulate_rd16rs8rm0_wflags(kprobe_opcode_t insn, 923prep_emulate_rd16rs8rm0_wflags(kprobe_opcode_t insn,
904 struct arch_specific_insn *asi) 924 struct arch_specific_insn *asi)
905{ 925{
926 if (is_r15(insn, 16))
927 return INSN_REJECTED; /* Rd is PC */
928
906 insn &= 0xfff0f0f0; /* Rd = r0, Rs = r0 */ 929 insn &= 0xfff0f0f0; /* Rd = r0, Rs = r0 */
907 insn |= 0x00000001; /* Rm = r1 */ 930 insn |= 0x00000001; /* Rm = r1 */
908 asi->insn[0] = insn; 931 asi->insn[0] = insn;
@@ -914,6 +937,9 @@ static enum kprobe_insn __kprobes
914prep_emulate_rd16rn12rs8rm0_wflags(kprobe_opcode_t insn, 937prep_emulate_rd16rn12rs8rm0_wflags(kprobe_opcode_t insn,
915 struct arch_specific_insn *asi) 938 struct arch_specific_insn *asi)
916{ 939{
940 if (is_r15(insn, 16))
941 return INSN_REJECTED; /* Rd is PC */
942
917 insn &= 0xfff000f0; /* Rd = r0, Rn = r0 */ 943 insn &= 0xfff000f0; /* Rd = r0, Rn = r0 */
918 insn |= 0x00000102; /* Rs = r1, Rm = r2 */ 944 insn |= 0x00000102; /* Rs = r1, Rm = r2 */
919 asi->insn[0] = insn; 945 asi->insn[0] = insn;
@@ -925,6 +951,9 @@ static enum kprobe_insn __kprobes
925prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn, 951prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn,
926 struct arch_specific_insn *asi) 952 struct arch_specific_insn *asi)
927{ 953{
954 if (is_r15(insn, 16) || is_r15(insn, 12))
955 return INSN_REJECTED; /* RdHi or RdLo is PC */
956
928 insn &= 0xfff000f0; /* RdHi = r0, RdLo = r1 */ 957 insn &= 0xfff000f0; /* RdHi = r0, RdLo = r1 */
929 insn |= 0x00001203; /* Rs = r2, Rm = r3 */ 958 insn |= 0x00001203; /* Rs = r2, Rm = r3 */
930 asi->insn[0] = insn; 959 asi->insn[0] = insn;
@@ -945,20 +974,13 @@ prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn,
945static enum kprobe_insn __kprobes 974static enum kprobe_insn __kprobes
946space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi) 975space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi)
947{ 976{
948 /* CPS mmod == 1 : 1111 0001 0000 xx10 xxxx xxxx xx0x xxxx */ 977 /* memory hint : 1111 0100 x001 xxxx xxxx xxxx xxxx xxxx : */
949 /* RFE : 1111 100x x0x1 xxxx xxxx 1010 xxxx xxxx */ 978 /* PLDI : 1111 0100 x101 xxxx xxxx xxxx xxxx xxxx : */
950 /* SRS : 1111 100x x1x0 1101 xxxx 0101 xxxx xxxx */ 979 /* PLDW : 1111 0101 x001 xxxx xxxx xxxx xxxx xxxx : */
951 if ((insn & 0xfff30020) == 0xf1020000 || 980 /* PLD : 1111 0101 x101 xxxx xxxx xxxx xxxx xxxx : */
952 (insn & 0xfe500f00) == 0xf8100a00 || 981 if ((insn & 0xfe300000) == 0xf4100000) {
953 (insn & 0xfe5f0f00) == 0xf84d0500) 982 asi->insn_handler = emulate_nop;
954 return INSN_REJECTED; 983 return INSN_GOOD_NO_SLOT;
955
956 /* PLD : 1111 01x1 x101 xxxx xxxx xxxx xxxx xxxx : */
957 if ((insn & 0xfd700000) == 0xf4500000) {
958 insn &= 0xfff0ffff; /* Rn = r0 */
959 asi->insn[0] = insn;
960 asi->insn_handler = emulate_rn16;
961 return INSN_GOOD;
962 } 984 }
963 985
964 /* BLX(1) : 1111 101x xxxx xxxx xxxx xxxx xxxx xxxx : */ 986 /* BLX(1) : 1111 101x xxxx xxxx xxxx xxxx xxxx xxxx : */
@@ -967,41 +989,22 @@ space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi)
967 return INSN_GOOD_NO_SLOT; 989 return INSN_GOOD_NO_SLOT;
968 } 990 }
969 991
970 /* SETEND : 1111 0001 0000 0001 xxxx xxxx 0000 xxxx */ 992 /* CPS : 1111 0001 0000 xxx0 xxxx xxxx xx0x xxxx */
971 /* CDP2 : 1111 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */ 993 /* SETEND: 1111 0001 0000 0001 xxxx xxxx 0000 xxxx */
972 if ((insn & 0xffff00f0) == 0xf1010000 ||
973 (insn & 0xff000010) == 0xfe000000) {
974 asi->insn[0] = insn;
975 asi->insn_handler = emulate_none;
976 return INSN_GOOD;
977 }
978 994
995 /* SRS : 1111 100x x1x0 xxxx xxxx xxxx xxxx xxxx */
996 /* RFE : 1111 100x x0x1 xxxx xxxx xxxx xxxx xxxx */
997
998 /* Coprocessor instructions... */
979 /* MCRR2 : 1111 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */ 999 /* MCRR2 : 1111 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */
980 /* MRRC2 : 1111 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */ 1000 /* MRRC2 : 1111 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */
981 if ((insn & 0xffe00000) == 0xfc400000) { 1001 /* LDC2 : 1111 110x xxx1 xxxx xxxx xxxx xxxx xxxx */
982 insn &= 0xfff00fff; /* Rn = r0 */ 1002 /* STC2 : 1111 110x xxx0 xxxx xxxx xxxx xxxx xxxx */
983 insn |= 0x00001000; /* Rd = r1 */ 1003 /* CDP2 : 1111 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */
984 asi->insn[0] = insn; 1004 /* MCR2 : 1111 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */
985 asi->insn_handler = 1005 /* MRC2 : 1111 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */
986 (insn & (1 << 20)) ? emulate_mrrc : emulate_mcrr;
987 return INSN_GOOD;
988 }
989 1006
990 /* LDC2 : 1111 110x xxx1 xxxx xxxx xxxx xxxx xxxx */ 1007 return INSN_REJECTED;
991 /* STC2 : 1111 110x xxx0 xxxx xxxx xxxx xxxx xxxx */
992 if ((insn & 0xfe000000) == 0xfc000000) {
993 insn &= 0xfff0ffff; /* Rn = r0 */
994 asi->insn[0] = insn;
995 asi->insn_handler = emulate_ldcstc;
996 return INSN_GOOD;
997 }
998
999 /* MCR2 : 1111 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */
1000 /* MRC2 : 1111 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */
1001 insn &= 0xffff0fff; /* Rd = r0 */
1002 asi->insn[0] = insn;
1003 asi->insn_handler = (insn & (1 << 20)) ? emulate_rd12 : emulate_ird12;
1004 return INSN_GOOD;
1005} 1008}
1006 1009
1007static enum kprobe_insn __kprobes 1010static enum kprobe_insn __kprobes
@@ -1010,19 +1013,18 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1010 /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx xxx0 xxxx */ 1013 /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx xxx0 xxxx */
1011 if ((insn & 0x0f900010) == 0x01000000) { 1014 if ((insn & 0x0f900010) == 0x01000000) {
1012 1015
1013 /* BXJ : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */ 1016 /* MRS cpsr : cccc 0001 0000 xxxx xxxx xxxx 0000 xxxx */
1014 /* MSR : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */ 1017 if ((insn & 0x0ff000f0) == 0x01000000) {
1015 if ((insn & 0x0ff000f0) == 0x01200020 || 1018 if (is_r15(insn, 12))
1016 (insn & 0x0fb000f0) == 0x01200000) 1019 return INSN_REJECTED; /* Rd is PC */
1017 return INSN_REJECTED; 1020 asi->insn_handler = simulate_mrs;
1018 1021 return INSN_GOOD_NO_SLOT;
1019 /* MRS : cccc 0001 0x00 xxxx xxxx xxxx 0000 xxxx */ 1022 }
1020 if ((insn & 0x0fb00010) == 0x01000000)
1021 return prep_emulate_rd12(insn, asi);
1022 1023
1023 /* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */ 1024 /* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */
1024 if ((insn & 0x0ff00090) == 0x01400080) 1025 if ((insn & 0x0ff00090) == 0x01400080)
1025 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); 1026 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn,
1027 asi);
1026 1028
1027 /* SMULWy : cccc 0001 0010 xxxx xxxx xxxx 1x10 xxxx */ 1029 /* SMULWy : cccc 0001 0010 xxxx xxxx xxxx 1x10 xxxx */
1028 /* SMULxy : cccc 0001 0110 xxxx xxxx xxxx 1xx0 xxxx */ 1030 /* SMULxy : cccc 0001 0110 xxxx xxxx xxxx 1xx0 xxxx */
@@ -1031,24 +1033,29 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1031 return prep_emulate_rd16rs8rm0_wflags(insn, asi); 1033 return prep_emulate_rd16rs8rm0_wflags(insn, asi);
1032 1034
1033 /* SMLAxy : cccc 0001 0000 xxxx xxxx xxxx 1xx0 xxxx : Q */ 1035 /* SMLAxy : cccc 0001 0000 xxxx xxxx xxxx 1xx0 xxxx : Q */
1034 /* SMLAWy : cccc 0001 0010 xxxx xxxx xxxx 0x00 xxxx : Q */ 1036 /* SMLAWy : cccc 0001 0010 xxxx xxxx xxxx 1x00 xxxx : Q */
1035 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); 1037 if ((insn & 0x0ff00090) == 0x01000080 ||
1038 (insn & 0x0ff000b0) == 0x01200080)
1039 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1040
1041 /* BXJ : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */
1042 /* MSR : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */
1043 /* MRS spsr : cccc 0001 0100 xxxx xxxx xxxx 0000 xxxx */
1036 1044
1045 /* Other instruction encodings aren't yet defined */
1046 return INSN_REJECTED;
1037 } 1047 }
1038 1048
1039 /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx 0xx1 xxxx */ 1049 /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx 0xx1 xxxx */
1040 else if ((insn & 0x0f900090) == 0x01000010) { 1050 else if ((insn & 0x0f900090) == 0x01000010) {
1041 1051
1042 /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */
1043 if ((insn & 0xfff000f0) == 0xe1200070)
1044 return INSN_REJECTED;
1045
1046 /* BLX(2) : cccc 0001 0010 xxxx xxxx xxxx 0011 xxxx */ 1052 /* BLX(2) : cccc 0001 0010 xxxx xxxx xxxx 0011 xxxx */
1047 /* BX : cccc 0001 0010 xxxx xxxx xxxx 0001 xxxx */ 1053 /* BX : cccc 0001 0010 xxxx xxxx xxxx 0001 xxxx */
1048 if ((insn & 0x0ff000d0) == 0x01200010) { 1054 if ((insn & 0x0ff000d0) == 0x01200010) {
1049 asi->insn[0] = truecc_insn(insn); 1055 if ((insn & 0x0ff000ff) == 0x0120003f)
1056 return INSN_REJECTED; /* BLX pc */
1050 asi->insn_handler = simulate_blx2bx; 1057 asi->insn_handler = simulate_blx2bx;
1051 return INSN_GOOD; 1058 return INSN_GOOD_NO_SLOT;
1052 } 1059 }
1053 1060
1054 /* CLZ : cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */ 1061 /* CLZ : cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */
@@ -1059,17 +1066,27 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1059 /* QSUB : cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx :Q */ 1066 /* QSUB : cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx :Q */
1060 /* QDADD : cccc 0001 0100 xxxx xxxx xxxx 0101 xxxx :Q */ 1067 /* QDADD : cccc 0001 0100 xxxx xxxx xxxx 0101 xxxx :Q */
1061 /* QDSUB : cccc 0001 0110 xxxx xxxx xxxx 0101 xxxx :Q */ 1068 /* QDSUB : cccc 0001 0110 xxxx xxxx xxxx 0101 xxxx :Q */
1062 return prep_emulate_rd12rn16rm0_wflags(insn, asi); 1069 if ((insn & 0x0f9000f0) == 0x01000050)
1070 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1071
1072 /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */
1073 /* SMC : cccc 0001 0110 xxxx xxxx xxxx 0111 xxxx */
1074
1075 /* Other instruction encodings aren't yet defined */
1076 return INSN_REJECTED;
1063 } 1077 }
1064 1078
1065 /* cccc 0000 xxxx xxxx xxxx xxxx xxxx 1001 xxxx */ 1079 /* cccc 0000 xxxx xxxx xxxx xxxx xxxx 1001 xxxx */
1066 else if ((insn & 0x0f000090) == 0x00000090) { 1080 else if ((insn & 0x0f0000f0) == 0x00000090) {
1067 1081
1068 /* MUL : cccc 0000 0000 xxxx xxxx xxxx 1001 xxxx : */ 1082 /* MUL : cccc 0000 0000 xxxx xxxx xxxx 1001 xxxx : */
1069 /* MULS : cccc 0000 0001 xxxx xxxx xxxx 1001 xxxx :cc */ 1083 /* MULS : cccc 0000 0001 xxxx xxxx xxxx 1001 xxxx :cc */
1070 /* MLA : cccc 0000 0010 xxxx xxxx xxxx 1001 xxxx : */ 1084 /* MLA : cccc 0000 0010 xxxx xxxx xxxx 1001 xxxx : */
1071 /* MLAS : cccc 0000 0011 xxxx xxxx xxxx 1001 xxxx :cc */ 1085 /* MLAS : cccc 0000 0011 xxxx xxxx xxxx 1001 xxxx :cc */
1072 /* UMAAL : cccc 0000 0100 xxxx xxxx xxxx 1001 xxxx : */ 1086 /* UMAAL : cccc 0000 0100 xxxx xxxx xxxx 1001 xxxx : */
1087 /* undef : cccc 0000 0101 xxxx xxxx xxxx 1001 xxxx : */
1088 /* MLS : cccc 0000 0110 xxxx xxxx xxxx 1001 xxxx : */
1089 /* undef : cccc 0000 0111 xxxx xxxx xxxx 1001 xxxx : */
1073 /* UMULL : cccc 0000 1000 xxxx xxxx xxxx 1001 xxxx : */ 1090 /* UMULL : cccc 0000 1000 xxxx xxxx xxxx 1001 xxxx : */
1074 /* UMULLS : cccc 0000 1001 xxxx xxxx xxxx 1001 xxxx :cc */ 1091 /* UMULLS : cccc 0000 1001 xxxx xxxx xxxx 1001 xxxx :cc */
1075 /* UMLAL : cccc 0000 1010 xxxx xxxx xxxx 1001 xxxx : */ 1092 /* UMLAL : cccc 0000 1010 xxxx xxxx xxxx 1001 xxxx : */
@@ -1078,13 +1095,15 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1078 /* SMULLS : cccc 0000 1101 xxxx xxxx xxxx 1001 xxxx :cc */ 1095 /* SMULLS : cccc 0000 1101 xxxx xxxx xxxx 1001 xxxx :cc */
1079 /* SMLAL : cccc 0000 1110 xxxx xxxx xxxx 1001 xxxx : */ 1096 /* SMLAL : cccc 0000 1110 xxxx xxxx xxxx 1001 xxxx : */
1080 /* SMLALS : cccc 0000 1111 xxxx xxxx xxxx 1001 xxxx :cc */ 1097 /* SMLALS : cccc 0000 1111 xxxx xxxx xxxx 1001 xxxx :cc */
1081 if ((insn & 0x0fe000f0) == 0x00000090) { 1098 if ((insn & 0x00d00000) == 0x00500000)
1082 return prep_emulate_rd16rs8rm0_wflags(insn, asi); 1099 return INSN_REJECTED;
1083 } else if ((insn & 0x0fe000f0) == 0x00200090) { 1100 else if ((insn & 0x00e00000) == 0x00000000)
1084 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); 1101 return prep_emulate_rd16rs8rm0_wflags(insn, asi);
1085 } else { 1102 else if ((insn & 0x00a00000) == 0x00200000)
1086 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); 1103 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1087 } 1104 else
1105 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn,
1106 asi);
1088 } 1107 }
1089 1108
1090 /* cccc 000x xxxx xxxx xxxx xxxx xxxx 1xx1 xxxx */ 1109 /* cccc 000x xxxx xxxx xxxx xxxx xxxx 1xx1 xxxx */
@@ -1092,23 +1111,45 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1092 1111
1093 /* SWP : cccc 0001 0000 xxxx xxxx xxxx 1001 xxxx */ 1112 /* SWP : cccc 0001 0000 xxxx xxxx xxxx 1001 xxxx */
1094 /* SWPB : cccc 0001 0100 xxxx xxxx xxxx 1001 xxxx */ 1113 /* SWPB : cccc 0001 0100 xxxx xxxx xxxx 1001 xxxx */
1095 /* LDRD : cccc 000x xxx0 xxxx xxxx xxxx 1101 xxxx */ 1114 /* ??? : cccc 0001 0x01 xxxx xxxx xxxx 1001 xxxx */
1096 /* STRD : cccc 000x xxx0 xxxx xxxx xxxx 1111 xxxx */ 1115 /* ??? : cccc 0001 0x10 xxxx xxxx xxxx 1001 xxxx */
1116 /* ??? : cccc 0001 0x11 xxxx xxxx xxxx 1001 xxxx */
1097 /* STREX : cccc 0001 1000 xxxx xxxx xxxx 1001 xxxx */ 1117 /* STREX : cccc 0001 1000 xxxx xxxx xxxx 1001 xxxx */
1098 /* LDREX : cccc 0001 1001 xxxx xxxx xxxx 1001 xxxx */ 1118 /* LDREX : cccc 0001 1001 xxxx xxxx xxxx 1001 xxxx */
1119 /* STREXD: cccc 0001 1010 xxxx xxxx xxxx 1001 xxxx */
1120 /* LDREXD: cccc 0001 1011 xxxx xxxx xxxx 1001 xxxx */
1121 /* STREXB: cccc 0001 1100 xxxx xxxx xxxx 1001 xxxx */
1122 /* LDREXB: cccc 0001 1101 xxxx xxxx xxxx 1001 xxxx */
1123 /* STREXH: cccc 0001 1110 xxxx xxxx xxxx 1001 xxxx */
1124 /* LDREXH: cccc 0001 1111 xxxx xxxx xxxx 1001 xxxx */
1125
1126 /* LDRD : cccc 000x xxx0 xxxx xxxx xxxx 1101 xxxx */
1127 /* STRD : cccc 000x xxx0 xxxx xxxx xxxx 1111 xxxx */
1099 /* LDRH : cccc 000x xxx1 xxxx xxxx xxxx 1011 xxxx */ 1128 /* LDRH : cccc 000x xxx1 xxxx xxxx xxxx 1011 xxxx */
1100 /* STRH : cccc 000x xxx0 xxxx xxxx xxxx 1011 xxxx */ 1129 /* STRH : cccc 000x xxx0 xxxx xxxx xxxx 1011 xxxx */
1101 /* LDRSB : cccc 000x xxx1 xxxx xxxx xxxx 1101 xxxx */ 1130 /* LDRSB : cccc 000x xxx1 xxxx xxxx xxxx 1101 xxxx */
1102 /* LDRSH : cccc 000x xxx1 xxxx xxxx xxxx 1111 xxxx */ 1131 /* LDRSH : cccc 000x xxx1 xxxx xxxx xxxx 1111 xxxx */
1103 if ((insn & 0x0fb000f0) == 0x01000090) { 1132 if ((insn & 0x0f0000f0) == 0x01000090) {
1104 /* SWP/SWPB */ 1133 if ((insn & 0x0fb000f0) == 0x01000090) {
1105 return prep_emulate_rd12rn16rm0_wflags(insn, asi); 1134 /* SWP/SWPB */
1135 return prep_emulate_rd12rn16rm0_wflags(insn,
1136 asi);
1137 } else {
1138 /* STREX/LDREX variants and unallocaed space */
1139 return INSN_REJECTED;
1140 }
1141
1106 } else if ((insn & 0x0e1000d0) == 0x00000d0) { 1142 } else if ((insn & 0x0e1000d0) == 0x00000d0) {
1107 /* STRD/LDRD */ 1143 /* STRD/LDRD */
1144 if ((insn & 0x0000e000) == 0x0000e000)
1145 return INSN_REJECTED; /* Rd is LR or PC */
1146 if (is_writeback(insn) && is_r15(insn, 16))
1147 return INSN_REJECTED; /* Writeback to PC */
1148
1108 insn &= 0xfff00fff; 1149 insn &= 0xfff00fff;
1109 insn |= 0x00002000; /* Rn = r0, Rd = r2 */ 1150 insn |= 0x00002000; /* Rn = r0, Rd = r2 */
1110 if (insn & (1 << 22)) { 1151 if (!(insn & (1 << 22))) {
1111 /* I bit */ 1152 /* Register index */
1112 insn &= ~0xf; 1153 insn &= ~0xf;
1113 insn |= 1; /* Rm = r1 */ 1154 insn |= 1; /* Rm = r1 */
1114 } 1155 }
@@ -1118,6 +1159,9 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1118 return INSN_GOOD; 1159 return INSN_GOOD;
1119 } 1160 }
1120 1161
1162 /* LDRH/STRH/LDRSB/LDRSH */
1163 if (is_r15(insn, 12))
1164 return INSN_REJECTED; /* Rd is PC */
1121 return prep_emulate_ldr_str(insn, asi); 1165 return prep_emulate_ldr_str(insn, asi);
1122 } 1166 }
1123 1167
@@ -1125,7 +1169,7 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1125 1169
1126 /* 1170 /*
1127 * ALU op with S bit and Rd == 15 : 1171 * ALU op with S bit and Rd == 15 :
1128 * cccc 000x xxx1 xxxx 1111 xxxx xxxx xxxx 1172 * cccc 000x xxx1 xxxx 1111 xxxx xxxx xxxx
1129 */ 1173 */
1130 if ((insn & 0x0e10f000) == 0x0010f000) 1174 if ((insn & 0x0e10f000) == 0x0010f000)
1131 return INSN_REJECTED; 1175 return INSN_REJECTED;
@@ -1154,22 +1198,61 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1154 insn |= 0x00000200; /* Rs = r2 */ 1198 insn |= 0x00000200; /* Rs = r2 */
1155 } 1199 }
1156 asi->insn[0] = insn; 1200 asi->insn[0] = insn;
1157 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ 1201
1202 if ((insn & 0x0f900000) == 0x01100000) {
1203 /*
1204 * TST : cccc 0001 0001 xxxx xxxx xxxx xxxx xxxx
1205 * TEQ : cccc 0001 0011 xxxx xxxx xxxx xxxx xxxx
1206 * CMP : cccc 0001 0101 xxxx xxxx xxxx xxxx xxxx
1207 * CMN : cccc 0001 0111 xxxx xxxx xxxx xxxx xxxx
1208 */
1209 asi->insn_handler = emulate_alu_tests;
1210 } else {
1211 /* ALU ops which write to Rd */
1212 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */
1158 emulate_alu_rwflags : emulate_alu_rflags; 1213 emulate_alu_rwflags : emulate_alu_rflags;
1214 }
1159 return INSN_GOOD; 1215 return INSN_GOOD;
1160} 1216}
1161 1217
1162static enum kprobe_insn __kprobes 1218static enum kprobe_insn __kprobes
1163space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi) 1219space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1164{ 1220{
1221 /* MOVW : cccc 0011 0000 xxxx xxxx xxxx xxxx xxxx */
1222 /* MOVT : cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx */
1223 if ((insn & 0x0fb00000) == 0x03000000)
1224 return prep_emulate_rd12_modify(insn, asi);
1225
1226 /* hints : cccc 0011 0010 0000 xxxx xxxx xxxx xxxx */
1227 if ((insn & 0x0fff0000) == 0x03200000) {
1228 unsigned op2 = insn & 0x000000ff;
1229 if (op2 == 0x01 || op2 == 0x04) {
1230 /* YIELD : cccc 0011 0010 0000 xxxx xxxx 0000 0001 */
1231 /* SEV : cccc 0011 0010 0000 xxxx xxxx 0000 0100 */
1232 asi->insn[0] = insn;
1233 asi->insn_handler = emulate_none;
1234 return INSN_GOOD;
1235 } else if (op2 <= 0x03) {
1236 /* NOP : cccc 0011 0010 0000 xxxx xxxx 0000 0000 */
1237 /* WFE : cccc 0011 0010 0000 xxxx xxxx 0000 0010 */
1238 /* WFI : cccc 0011 0010 0000 xxxx xxxx 0000 0011 */
1239 /*
1240 * We make WFE and WFI true NOPs to avoid stalls due
1241 * to missing events whilst processing the probe.
1242 */
1243 asi->insn_handler = emulate_nop;
1244 return INSN_GOOD_NO_SLOT;
1245 }
1246 /* For DBG and unallocated hints it's safest to reject them */
1247 return INSN_REJECTED;
1248 }
1249
1165 /* 1250 /*
1166 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx 1251 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx
1167 * Undef : cccc 0011 0100 xxxx xxxx xxxx xxxx xxxx
1168 * ALU op with S bit and Rd == 15 : 1252 * ALU op with S bit and Rd == 15 :
1169 * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx 1253 * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx
1170 */ 1254 */
1171 if ((insn & 0x0fb00000) == 0x03200000 || /* MSR */ 1255 if ((insn & 0x0fb00000) == 0x03200000 || /* MSR */
1172 (insn & 0x0ff00000) == 0x03400000 || /* Undef */
1173 (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */ 1256 (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */
1174 return INSN_REJECTED; 1257 return INSN_REJECTED;
1175 1258
@@ -1180,10 +1263,22 @@ space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1180 * *S (bit 20) updates condition codes 1263 * *S (bit 20) updates condition codes
1181 * ADC/SBC/RSC reads the C flag 1264 * ADC/SBC/RSC reads the C flag
1182 */ 1265 */
1183 insn &= 0xffff0fff; /* Rd = r0 */ 1266 insn &= 0xfff00fff; /* Rn = r0 and Rd = r0 */
1184 asi->insn[0] = insn; 1267 asi->insn[0] = insn;
1185 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */ 1268
1269 if ((insn & 0x0f900000) == 0x03100000) {
1270 /*
1271 * TST : cccc 0011 0001 xxxx xxxx xxxx xxxx xxxx
1272 * TEQ : cccc 0011 0011 xxxx xxxx xxxx xxxx xxxx
1273 * CMP : cccc 0011 0101 xxxx xxxx xxxx xxxx xxxx
1274 * CMN : cccc 0011 0111 xxxx xxxx xxxx xxxx xxxx
1275 */
1276 asi->insn_handler = emulate_alu_tests_imm;
1277 } else {
1278 /* ALU ops which write to Rd */
1279 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */
1186 emulate_alu_imm_rwflags : emulate_alu_imm_rflags; 1280 emulate_alu_imm_rwflags : emulate_alu_imm_rflags;
1281 }
1187 return INSN_GOOD; 1282 return INSN_GOOD;
1188} 1283}
1189 1284
@@ -1192,6 +1287,8 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1192{ 1287{
1193 /* SEL : cccc 0110 1000 xxxx xxxx xxxx 1011 xxxx GE: !!! */ 1288 /* SEL : cccc 0110 1000 xxxx xxxx xxxx 1011 xxxx GE: !!! */
1194 if ((insn & 0x0ff000f0) == 0x068000b0) { 1289 if ((insn & 0x0ff000f0) == 0x068000b0) {
1290 if (is_r15(insn, 12))
1291 return INSN_REJECTED; /* Rd is PC */
1195 insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */ 1292 insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */
1196 insn |= 0x00000001; /* Rm = r1 */ 1293 insn |= 0x00000001; /* Rm = r1 */
1197 asi->insn[0] = insn; 1294 asi->insn[0] = insn;
@@ -1205,6 +1302,8 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1205 /* USAT16 : cccc 0110 1110 xxxx xxxx xxxx 0011 xxxx :Q */ 1302 /* USAT16 : cccc 0110 1110 xxxx xxxx xxxx 0011 xxxx :Q */
1206 if ((insn & 0x0fa00030) == 0x06a00010 || 1303 if ((insn & 0x0fa00030) == 0x06a00010 ||
1207 (insn & 0x0fb000f0) == 0x06a00030) { 1304 (insn & 0x0fb000f0) == 0x06a00030) {
1305 if (is_r15(insn, 12))
1306 return INSN_REJECTED; /* Rd is PC */
1208 insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */ 1307 insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */
1209 asi->insn[0] = insn; 1308 asi->insn[0] = insn;
1210 asi->insn_handler = emulate_sat; 1309 asi->insn_handler = emulate_sat;
@@ -1213,57 +1312,101 @@ space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1213 1312
1214 /* REV : cccc 0110 1011 xxxx xxxx xxxx 0011 xxxx */ 1313 /* REV : cccc 0110 1011 xxxx xxxx xxxx 0011 xxxx */
1215 /* REV16 : cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */ 1314 /* REV16 : cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */
1315 /* RBIT : cccc 0110 1111 xxxx xxxx xxxx 0011 xxxx */
1216 /* REVSH : cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */ 1316 /* REVSH : cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */
1217 if ((insn & 0x0ff00070) == 0x06b00030 || 1317 if ((insn & 0x0ff00070) == 0x06b00030 ||
1218 (insn & 0x0ff000f0) == 0x06f000b0) 1318 (insn & 0x0ff00070) == 0x06f00030)
1219 return prep_emulate_rd12rm0(insn, asi); 1319 return prep_emulate_rd12rm0(insn, asi);
1220 1320
1321 /* ??? : cccc 0110 0000 xxxx xxxx xxxx xxx1 xxxx : */
1221 /* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */ 1322 /* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */
1222 /* SADDSUBX : cccc 0110 0001 xxxx xxxx xxxx 0011 xxxx :GE */ 1323 /* SADDSUBX : cccc 0110 0001 xxxx xxxx xxxx 0011 xxxx :GE */
1223 /* SSUBADDX : cccc 0110 0001 xxxx xxxx xxxx 0101 xxxx :GE */ 1324 /* SSUBADDX : cccc 0110 0001 xxxx xxxx xxxx 0101 xxxx :GE */
1224 /* SSUB16 : cccc 0110 0001 xxxx xxxx xxxx 0111 xxxx :GE */ 1325 /* SSUB16 : cccc 0110 0001 xxxx xxxx xxxx 0111 xxxx :GE */
1225 /* SADD8 : cccc 0110 0001 xxxx xxxx xxxx 1001 xxxx :GE */ 1326 /* SADD8 : cccc 0110 0001 xxxx xxxx xxxx 1001 xxxx :GE */
1327 /* ??? : cccc 0110 0001 xxxx xxxx xxxx 1011 xxxx : */
1328 /* ??? : cccc 0110 0001 xxxx xxxx xxxx 1101 xxxx : */
1226 /* SSUB8 : cccc 0110 0001 xxxx xxxx xxxx 1111 xxxx :GE */ 1329 /* SSUB8 : cccc 0110 0001 xxxx xxxx xxxx 1111 xxxx :GE */
1227 /* QADD16 : cccc 0110 0010 xxxx xxxx xxxx 0001 xxxx : */ 1330 /* QADD16 : cccc 0110 0010 xxxx xxxx xxxx 0001 xxxx : */
1228 /* QADDSUBX : cccc 0110 0010 xxxx xxxx xxxx 0011 xxxx : */ 1331 /* QADDSUBX : cccc 0110 0010 xxxx xxxx xxxx 0011 xxxx : */
1229 /* QSUBADDX : cccc 0110 0010 xxxx xxxx xxxx 0101 xxxx : */ 1332 /* QSUBADDX : cccc 0110 0010 xxxx xxxx xxxx 0101 xxxx : */
1230 /* QSUB16 : cccc 0110 0010 xxxx xxxx xxxx 0111 xxxx : */ 1333 /* QSUB16 : cccc 0110 0010 xxxx xxxx xxxx 0111 xxxx : */
1231 /* QADD8 : cccc 0110 0010 xxxx xxxx xxxx 1001 xxxx : */ 1334 /* QADD8 : cccc 0110 0010 xxxx xxxx xxxx 1001 xxxx : */
1335 /* ??? : cccc 0110 0010 xxxx xxxx xxxx 1011 xxxx : */
1336 /* ??? : cccc 0110 0010 xxxx xxxx xxxx 1101 xxxx : */
1232 /* QSUB8 : cccc 0110 0010 xxxx xxxx xxxx 1111 xxxx : */ 1337 /* QSUB8 : cccc 0110 0010 xxxx xxxx xxxx 1111 xxxx : */
1233 /* SHADD16 : cccc 0110 0011 xxxx xxxx xxxx 0001 xxxx : */ 1338 /* SHADD16 : cccc 0110 0011 xxxx xxxx xxxx 0001 xxxx : */
1234 /* SHADDSUBX : cccc 0110 0011 xxxx xxxx xxxx 0011 xxxx : */ 1339 /* SHADDSUBX : cccc 0110 0011 xxxx xxxx xxxx 0011 xxxx : */
1235 /* SHSUBADDX : cccc 0110 0011 xxxx xxxx xxxx 0101 xxxx : */ 1340 /* SHSUBADDX : cccc 0110 0011 xxxx xxxx xxxx 0101 xxxx : */
1236 /* SHSUB16 : cccc 0110 0011 xxxx xxxx xxxx 0111 xxxx : */ 1341 /* SHSUB16 : cccc 0110 0011 xxxx xxxx xxxx 0111 xxxx : */
1237 /* SHADD8 : cccc 0110 0011 xxxx xxxx xxxx 1001 xxxx : */ 1342 /* SHADD8 : cccc 0110 0011 xxxx xxxx xxxx 1001 xxxx : */
1343 /* ??? : cccc 0110 0011 xxxx xxxx xxxx 1011 xxxx : */
1344 /* ??? : cccc 0110 0011 xxxx xxxx xxxx 1101 xxxx : */
1238 /* SHSUB8 : cccc 0110 0011 xxxx xxxx xxxx 1111 xxxx : */ 1345 /* SHSUB8 : cccc 0110 0011 xxxx xxxx xxxx 1111 xxxx : */
1346 /* ??? : cccc 0110 0100 xxxx xxxx xxxx xxx1 xxxx : */
1239 /* UADD16 : cccc 0110 0101 xxxx xxxx xxxx 0001 xxxx :GE */ 1347 /* UADD16 : cccc 0110 0101 xxxx xxxx xxxx 0001 xxxx :GE */
1240 /* UADDSUBX : cccc 0110 0101 xxxx xxxx xxxx 0011 xxxx :GE */ 1348 /* UADDSUBX : cccc 0110 0101 xxxx xxxx xxxx 0011 xxxx :GE */
1241 /* USUBADDX : cccc 0110 0101 xxxx xxxx xxxx 0101 xxxx :GE */ 1349 /* USUBADDX : cccc 0110 0101 xxxx xxxx xxxx 0101 xxxx :GE */
1242 /* USUB16 : cccc 0110 0101 xxxx xxxx xxxx 0111 xxxx :GE */ 1350 /* USUB16 : cccc 0110 0101 xxxx xxxx xxxx 0111 xxxx :GE */
1243 /* UADD8 : cccc 0110 0101 xxxx xxxx xxxx 1001 xxxx :GE */ 1351 /* UADD8 : cccc 0110 0101 xxxx xxxx xxxx 1001 xxxx :GE */
1352 /* ??? : cccc 0110 0101 xxxx xxxx xxxx 1011 xxxx : */
1353 /* ??? : cccc 0110 0101 xxxx xxxx xxxx 1101 xxxx : */
1244 /* USUB8 : cccc 0110 0101 xxxx xxxx xxxx 1111 xxxx :GE */ 1354 /* USUB8 : cccc 0110 0101 xxxx xxxx xxxx 1111 xxxx :GE */
1245 /* UQADD16 : cccc 0110 0110 xxxx xxxx xxxx 0001 xxxx : */ 1355 /* UQADD16 : cccc 0110 0110 xxxx xxxx xxxx 0001 xxxx : */
1246 /* UQADDSUBX : cccc 0110 0110 xxxx xxxx xxxx 0011 xxxx : */ 1356 /* UQADDSUBX : cccc 0110 0110 xxxx xxxx xxxx 0011 xxxx : */
1247 /* UQSUBADDX : cccc 0110 0110 xxxx xxxx xxxx 0101 xxxx : */ 1357 /* UQSUBADDX : cccc 0110 0110 xxxx xxxx xxxx 0101 xxxx : */
1248 /* UQSUB16 : cccc 0110 0110 xxxx xxxx xxxx 0111 xxxx : */ 1358 /* UQSUB16 : cccc 0110 0110 xxxx xxxx xxxx 0111 xxxx : */
1249 /* UQADD8 : cccc 0110 0110 xxxx xxxx xxxx 1001 xxxx : */ 1359 /* UQADD8 : cccc 0110 0110 xxxx xxxx xxxx 1001 xxxx : */
1360 /* ??? : cccc 0110 0110 xxxx xxxx xxxx 1011 xxxx : */
1361 /* ??? : cccc 0110 0110 xxxx xxxx xxxx 1101 xxxx : */
1250 /* UQSUB8 : cccc 0110 0110 xxxx xxxx xxxx 1111 xxxx : */ 1362 /* UQSUB8 : cccc 0110 0110 xxxx xxxx xxxx 1111 xxxx : */
1251 /* UHADD16 : cccc 0110 0111 xxxx xxxx xxxx 0001 xxxx : */ 1363 /* UHADD16 : cccc 0110 0111 xxxx xxxx xxxx 0001 xxxx : */
1252 /* UHADDSUBX : cccc 0110 0111 xxxx xxxx xxxx 0011 xxxx : */ 1364 /* UHADDSUBX : cccc 0110 0111 xxxx xxxx xxxx 0011 xxxx : */
1253 /* UHSUBADDX : cccc 0110 0111 xxxx xxxx xxxx 0101 xxxx : */ 1365 /* UHSUBADDX : cccc 0110 0111 xxxx xxxx xxxx 0101 xxxx : */
1254 /* UHSUB16 : cccc 0110 0111 xxxx xxxx xxxx 0111 xxxx : */ 1366 /* UHSUB16 : cccc 0110 0111 xxxx xxxx xxxx 0111 xxxx : */
1255 /* UHADD8 : cccc 0110 0111 xxxx xxxx xxxx 1001 xxxx : */ 1367 /* UHADD8 : cccc 0110 0111 xxxx xxxx xxxx 1001 xxxx : */
1368 /* ??? : cccc 0110 0111 xxxx xxxx xxxx 1011 xxxx : */
1369 /* ??? : cccc 0110 0111 xxxx xxxx xxxx 1101 xxxx : */
1256 /* UHSUB8 : cccc 0110 0111 xxxx xxxx xxxx 1111 xxxx : */ 1370 /* UHSUB8 : cccc 0110 0111 xxxx xxxx xxxx 1111 xxxx : */
1371 if ((insn & 0x0f800010) == 0x06000010) {
1372 if ((insn & 0x00300000) == 0x00000000 ||
1373 (insn & 0x000000e0) == 0x000000a0 ||
1374 (insn & 0x000000e0) == 0x000000c0)
1375 return INSN_REJECTED; /* Unallocated space */
1376 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1377 }
1378
1257 /* PKHBT : cccc 0110 1000 xxxx xxxx xxxx x001 xxxx : */ 1379 /* PKHBT : cccc 0110 1000 xxxx xxxx xxxx x001 xxxx : */
1258 /* PKHTB : cccc 0110 1000 xxxx xxxx xxxx x101 xxxx : */ 1380 /* PKHTB : cccc 0110 1000 xxxx xxxx xxxx x101 xxxx : */
1381 if ((insn & 0x0ff00030) == 0x06800010)
1382 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1383
1259 /* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */ 1384 /* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
1260 /* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */ 1385 /* SXTB16 : cccc 0110 1000 1111 xxxx xxxx 0111 xxxx : */
1386 /* ??? : cccc 0110 1001 xxxx xxxx xxxx 0111 xxxx : */
1261 /* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */ 1387 /* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
1388 /* SXTB : cccc 0110 1010 1111 xxxx xxxx 0111 xxxx : */
1262 /* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */ 1389 /* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
1390 /* SXTH : cccc 0110 1011 1111 xxxx xxxx 0111 xxxx : */
1263 /* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */ 1391 /* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
1392 /* UXTB16 : cccc 0110 1100 1111 xxxx xxxx 0111 xxxx : */
1393 /* ??? : cccc 0110 1101 xxxx xxxx xxxx 0111 xxxx : */
1264 /* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */ 1394 /* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
1395 /* UXTB : cccc 0110 1110 1111 xxxx xxxx 0111 xxxx : */
1265 /* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */ 1396 /* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
1266 return prep_emulate_rd12rn16rm0_wflags(insn, asi); 1397 /* UXTH : cccc 0110 1111 1111 xxxx xxxx 0111 xxxx : */
1398 if ((insn & 0x0f8000f0) == 0x06800070) {
1399 if ((insn & 0x00300000) == 0x00100000)
1400 return INSN_REJECTED; /* Unallocated space */
1401
1402 if ((insn & 0x000f0000) == 0x000f0000)
1403 return prep_emulate_rd12rm0(insn, asi);
1404 else
1405 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1406 }
1407
1408 /* Other instruction encodings aren't yet defined */
1409 return INSN_REJECTED;
1267} 1410}
1268 1411
1269static enum kprobe_insn __kprobes 1412static enum kprobe_insn __kprobes
@@ -1273,29 +1416,49 @@ space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1273 if ((insn & 0x0ff000f0) == 0x03f000f0) 1416 if ((insn & 0x0ff000f0) == 0x03f000f0)
1274 return INSN_REJECTED; 1417 return INSN_REJECTED;
1275 1418
1276 /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx */
1277 /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx */
1278 if ((insn & 0x0ff000f0) == 0x07800010)
1279 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1280
1281 /* SMLALD : cccc 0111 0100 xxxx xxxx xxxx 00x1 xxxx */ 1419 /* SMLALD : cccc 0111 0100 xxxx xxxx xxxx 00x1 xxxx */
1282 /* SMLSLD : cccc 0111 0100 xxxx xxxx xxxx 01x1 xxxx */ 1420 /* SMLSLD : cccc 0111 0100 xxxx xxxx xxxx 01x1 xxxx */
1283 if ((insn & 0x0ff00090) == 0x07400010) 1421 if ((insn & 0x0ff00090) == 0x07400010)
1284 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi); 1422 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi);
1285 1423
1286 /* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */ 1424 /* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */
1425 /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */
1287 /* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */ 1426 /* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */
1427 /* SMUSD : cccc 0111 0000 xxxx 1111 xxxx 01x1 xxxx : */
1288 /* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */ 1428 /* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */
1289 /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */ 1429 /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */
1430 /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx : */
1431 /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx : */
1290 if ((insn & 0x0ff00090) == 0x07000010 || 1432 if ((insn & 0x0ff00090) == 0x07000010 ||
1291 (insn & 0x0ff000d0) == 0x07500010 || 1433 (insn & 0x0ff000d0) == 0x07500010 ||
1292 (insn & 0x0ff000d0) == 0x075000d0) 1434 (insn & 0x0ff000f0) == 0x07800010) {
1435
1436 if ((insn & 0x0000f000) == 0x0000f000)
1437 return prep_emulate_rd16rs8rm0_wflags(insn, asi);
1438 else
1439 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1440 }
1441
1442 /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */
1443 if ((insn & 0x0ff000d0) == 0x075000d0)
1293 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi); 1444 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1294 1445
1295 /* SMUSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx : */ 1446 /* SBFX : cccc 0111 101x xxxx xxxx xxxx x101 xxxx : */
1296 /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */ 1447 /* UBFX : cccc 0111 111x xxxx xxxx xxxx x101 xxxx : */
1297 /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */ 1448 if ((insn & 0x0fa00070) == 0x07a00050)
1298 return prep_emulate_rd16rs8rm0_wflags(insn, asi); 1449 return prep_emulate_rd12rm0(insn, asi);
1450
1451 /* BFI : cccc 0111 110x xxxx xxxx xxxx x001 xxxx : */
1452 /* BFC : cccc 0111 110x xxxx xxxx xxxx x001 1111 : */
1453 if ((insn & 0x0fe00070) == 0x07c00010) {
1454
1455 if ((insn & 0x0000000f) == 0x0000000f)
1456 return prep_emulate_rd12_modify(insn, asi);
1457 else
1458 return prep_emulate_rd12rn0_modify(insn, asi);
1459 }
1460
1461 return INSN_REJECTED;
1299} 1462}
1300 1463
1301static enum kprobe_insn __kprobes 1464static enum kprobe_insn __kprobes
@@ -1309,6 +1472,10 @@ space_cccc_01xx(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1309 /* STRB : cccc 01xx x1x0 xxxx xxxx xxxx xxxx xxxx */ 1472 /* STRB : cccc 01xx x1x0 xxxx xxxx xxxx xxxx xxxx */
1310 /* STRBT : cccc 01x0 x110 xxxx xxxx xxxx xxxx xxxx */ 1473 /* STRBT : cccc 01x0 x110 xxxx xxxx xxxx xxxx xxxx */
1311 /* STRT : cccc 01x0 x010 xxxx xxxx xxxx xxxx xxxx */ 1474 /* STRT : cccc 01x0 x010 xxxx xxxx xxxx xxxx xxxx */
1475
1476 if ((insn & 0x00500000) == 0x00500000 && is_r15(insn, 12))
1477 return INSN_REJECTED; /* LDRB into PC */
1478
1312 return prep_emulate_ldr_str(insn, asi); 1479 return prep_emulate_ldr_str(insn, asi);
1313} 1480}
1314 1481
@@ -1323,10 +1490,9 @@ space_cccc_100x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1323 1490
1324 /* LDM(1) : cccc 100x x0x1 xxxx xxxx xxxx xxxx xxxx */ 1491 /* LDM(1) : cccc 100x x0x1 xxxx xxxx xxxx xxxx xxxx */
1325 /* STM(1) : cccc 100x x0x0 xxxx xxxx xxxx xxxx xxxx */ 1492 /* STM(1) : cccc 100x x0x0 xxxx xxxx xxxx xxxx xxxx */
1326 asi->insn[0] = truecc_insn(insn);
1327 asi->insn_handler = ((insn & 0x108000) == 0x008000) ? /* STM & R15 */ 1493 asi->insn_handler = ((insn & 0x108000) == 0x008000) ? /* STM & R15 */
1328 simulate_stm1_pc : simulate_ldm1stm1; 1494 simulate_stm1_pc : simulate_ldm1stm1;
1329 return INSN_GOOD; 1495 return INSN_GOOD_NO_SLOT;
1330} 1496}
1331 1497
1332static enum kprobe_insn __kprobes 1498static enum kprobe_insn __kprobes
@@ -1334,58 +1500,117 @@ space_cccc_101x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1334{ 1500{
1335 /* B : cccc 1010 xxxx xxxx xxxx xxxx xxxx xxxx */ 1501 /* B : cccc 1010 xxxx xxxx xxxx xxxx xxxx xxxx */
1336 /* BL : cccc 1011 xxxx xxxx xxxx xxxx xxxx xxxx */ 1502 /* BL : cccc 1011 xxxx xxxx xxxx xxxx xxxx xxxx */
1337 asi->insn[0] = truecc_insn(insn);
1338 asi->insn_handler = simulate_bbl; 1503 asi->insn_handler = simulate_bbl;
1339 return INSN_GOOD; 1504 return INSN_GOOD_NO_SLOT;
1340} 1505}
1341 1506
1342static enum kprobe_insn __kprobes 1507static enum kprobe_insn __kprobes
1343space_cccc_1100_010x(kprobe_opcode_t insn, struct arch_specific_insn *asi) 1508space_cccc_11xx(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1344{ 1509{
1510 /* Coprocessor instructions... */
1345 /* MCRR : cccc 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */ 1511 /* MCRR : cccc 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */
1346 /* MRRC : cccc 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */ 1512 /* MRRC : cccc 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */
1347 insn &= 0xfff00fff; 1513 /* LDC : cccc 110x xxx1 xxxx xxxx xxxx xxxx xxxx */
1348 insn |= 0x00001000; /* Rn = r0, Rd = r1 */ 1514 /* STC : cccc 110x xxx0 xxxx xxxx xxxx xxxx xxxx */
1349 asi->insn[0] = insn; 1515 /* CDP : cccc 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */
1350 asi->insn_handler = (insn & (1 << 20)) ? emulate_mrrc : emulate_mcrr; 1516 /* MCR : cccc 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */
1351 return INSN_GOOD; 1517 /* MRC : cccc 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */
1518
1519 /* SVC : cccc 1111 xxxx xxxx xxxx xxxx xxxx xxxx */
1520
1521 return INSN_REJECTED;
1352} 1522}
1353 1523
1354static enum kprobe_insn __kprobes 1524static unsigned long __kprobes __check_eq(unsigned long cpsr)
1355space_cccc_110x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1356{ 1525{
1357 /* LDC : cccc 110x xxx1 xxxx xxxx xxxx xxxx xxxx */ 1526 return cpsr & PSR_Z_BIT;
1358 /* STC : cccc 110x xxx0 xxxx xxxx xxxx xxxx xxxx */
1359 insn &= 0xfff0ffff; /* Rn = r0 */
1360 asi->insn[0] = insn;
1361 asi->insn_handler = emulate_ldcstc;
1362 return INSN_GOOD;
1363} 1527}
1364 1528
1365static enum kprobe_insn __kprobes 1529static unsigned long __kprobes __check_ne(unsigned long cpsr)
1366space_cccc_111x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1367{ 1530{
1368 /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */ 1531 return (~cpsr) & PSR_Z_BIT;
1369 /* SWI : cccc 1111 xxxx xxxx xxxx xxxx xxxx xxxx */ 1532}
1370 if ((insn & 0xfff000f0) == 0xe1200070 ||
1371 (insn & 0x0f000000) == 0x0f000000)
1372 return INSN_REJECTED;
1373 1533
1374 /* CDP : cccc 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */ 1534static unsigned long __kprobes __check_cs(unsigned long cpsr)
1375 if ((insn & 0x0f000010) == 0x0e000000) { 1535{
1376 asi->insn[0] = insn; 1536 return cpsr & PSR_C_BIT;
1377 asi->insn_handler = emulate_none; 1537}
1378 return INSN_GOOD;
1379 }
1380 1538
1381 /* MCR : cccc 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */ 1539static unsigned long __kprobes __check_cc(unsigned long cpsr)
1382 /* MRC : cccc 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */ 1540{
1383 insn &= 0xffff0fff; /* Rd = r0 */ 1541 return (~cpsr) & PSR_C_BIT;
1384 asi->insn[0] = insn; 1542}
1385 asi->insn_handler = (insn & (1 << 20)) ? emulate_rd12 : emulate_ird12; 1543
1386 return INSN_GOOD; 1544static unsigned long __kprobes __check_mi(unsigned long cpsr)
1545{
1546 return cpsr & PSR_N_BIT;
1547}
1548
1549static unsigned long __kprobes __check_pl(unsigned long cpsr)
1550{
1551 return (~cpsr) & PSR_N_BIT;
1552}
1553
1554static unsigned long __kprobes __check_vs(unsigned long cpsr)
1555{
1556 return cpsr & PSR_V_BIT;
1557}
1558
1559static unsigned long __kprobes __check_vc(unsigned long cpsr)
1560{
1561 return (~cpsr) & PSR_V_BIT;
1562}
1563
1564static unsigned long __kprobes __check_hi(unsigned long cpsr)
1565{
1566 cpsr &= ~(cpsr >> 1); /* PSR_C_BIT &= ~PSR_Z_BIT */
1567 return cpsr & PSR_C_BIT;
1387} 1568}
1388 1569
1570static unsigned long __kprobes __check_ls(unsigned long cpsr)
1571{
1572 cpsr &= ~(cpsr >> 1); /* PSR_C_BIT &= ~PSR_Z_BIT */
1573 return (~cpsr) & PSR_C_BIT;
1574}
1575
1576static unsigned long __kprobes __check_ge(unsigned long cpsr)
1577{
1578 cpsr ^= (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */
1579 return (~cpsr) & PSR_N_BIT;
1580}
1581
1582static unsigned long __kprobes __check_lt(unsigned long cpsr)
1583{
1584 cpsr ^= (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */
1585 return cpsr & PSR_N_BIT;
1586}
1587
1588static unsigned long __kprobes __check_gt(unsigned long cpsr)
1589{
1590 unsigned long temp = cpsr ^ (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */
1591 temp |= (cpsr << 1); /* PSR_N_BIT |= PSR_Z_BIT */
1592 return (~temp) & PSR_N_BIT;
1593}
1594
1595static unsigned long __kprobes __check_le(unsigned long cpsr)
1596{
1597 unsigned long temp = cpsr ^ (cpsr << 3); /* PSR_N_BIT ^= PSR_V_BIT */
1598 temp |= (cpsr << 1); /* PSR_N_BIT |= PSR_Z_BIT */
1599 return temp & PSR_N_BIT;
1600}
1601
1602static unsigned long __kprobes __check_al(unsigned long cpsr)
1603{
1604 return true;
1605}
1606
1607static kprobe_check_cc * const condition_checks[16] = {
1608 &__check_eq, &__check_ne, &__check_cs, &__check_cc,
1609 &__check_mi, &__check_pl, &__check_vs, &__check_vc,
1610 &__check_hi, &__check_ls, &__check_ge, &__check_lt,
1611 &__check_gt, &__check_le, &__check_al, &__check_al
1612};
1613
1389/* Return: 1614/* Return:
1390 * INSN_REJECTED If instruction is one not allowed to kprobe, 1615 * INSN_REJECTED If instruction is one not allowed to kprobe,
1391 * INSN_GOOD If instruction is supported and uses instruction slot, 1616 * INSN_GOOD If instruction is supported and uses instruction slot,
@@ -1401,133 +1626,45 @@ space_cccc_111x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1401enum kprobe_insn __kprobes 1626enum kprobe_insn __kprobes
1402arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi) 1627arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1403{ 1628{
1629 asi->insn_check_cc = condition_checks[insn>>28];
1404 asi->insn[1] = KPROBE_RETURN_INSTRUCTION; 1630 asi->insn[1] = KPROBE_RETURN_INSTRUCTION;
1405 1631
1406 if ((insn & 0xf0000000) == 0xf0000000) { 1632 if ((insn & 0xf0000000) == 0xf0000000)
1407 1633
1408 return space_1111(insn, asi); 1634 return space_1111(insn, asi);
1409 1635
1410 } else if ((insn & 0x0e000000) == 0x00000000) { 1636 else if ((insn & 0x0e000000) == 0x00000000)
1411 1637
1412 return space_cccc_000x(insn, asi); 1638 return space_cccc_000x(insn, asi);
1413 1639
1414 } else if ((insn & 0x0e000000) == 0x02000000) { 1640 else if ((insn & 0x0e000000) == 0x02000000)
1415 1641
1416 return space_cccc_001x(insn, asi); 1642 return space_cccc_001x(insn, asi);
1417 1643
1418 } else if ((insn & 0x0f000010) == 0x06000010) { 1644 else if ((insn & 0x0f000010) == 0x06000010)
1419 1645
1420 return space_cccc_0110__1(insn, asi); 1646 return space_cccc_0110__1(insn, asi);
1421 1647
1422 } else if ((insn & 0x0f000010) == 0x07000010) { 1648 else if ((insn & 0x0f000010) == 0x07000010)
1423 1649
1424 return space_cccc_0111__1(insn, asi); 1650 return space_cccc_0111__1(insn, asi);
1425 1651
1426 } else if ((insn & 0x0c000000) == 0x04000000) { 1652 else if ((insn & 0x0c000000) == 0x04000000)
1427 1653
1428 return space_cccc_01xx(insn, asi); 1654 return space_cccc_01xx(insn, asi);
1429 1655
1430 } else if ((insn & 0x0e000000) == 0x08000000) { 1656 else if ((insn & 0x0e000000) == 0x08000000)
1431 1657
1432 return space_cccc_100x(insn, asi); 1658 return space_cccc_100x(insn, asi);
1433 1659
1434 } else if ((insn & 0x0e000000) == 0x0a000000) { 1660 else if ((insn & 0x0e000000) == 0x0a000000)
1435 1661
1436 return space_cccc_101x(insn, asi); 1662 return space_cccc_101x(insn, asi);
1437 1663
1438 } else if ((insn & 0x0fe00000) == 0x0c400000) { 1664 return space_cccc_11xx(insn, asi);
1439
1440 return space_cccc_1100_010x(insn, asi);
1441
1442 } else if ((insn & 0x0e000000) == 0x0c000000) {
1443
1444 return space_cccc_110x(insn, asi);
1445
1446 }
1447
1448 return space_cccc_111x(insn, asi);
1449} 1665}
1450 1666
1451void __init arm_kprobe_decode_init(void) 1667void __init arm_kprobe_decode_init(void)
1452{ 1668{
1453 find_str_pc_offset(); 1669 find_str_pc_offset();
1454} 1670}
1455
1456
1457/*
1458 * All ARM instructions listed below.
1459 *
1460 * Instructions and their general purpose registers are given.
1461 * If a particular register may not use R15, it is prefixed with a "!".
1462 * If marked with a "*" means the value returned by reading R15
1463 * is implementation defined.
1464 *
1465 * ADC/ADD/AND/BIC/CMN/CMP/EOR/MOV/MVN/ORR/RSB/RSC/SBC/SUB/TEQ
1466 * TST: Rd, Rn, Rm, !Rs
1467 * BX: Rm
1468 * BLX(2): !Rm
1469 * BX: Rm (R15 legal, but discouraged)
1470 * BXJ: !Rm,
1471 * CLZ: !Rd, !Rm
1472 * CPY: Rd, Rm
1473 * LDC/2,STC/2 immediate offset & unindex: Rn
1474 * LDC/2,STC/2 immediate pre/post-indexed: !Rn
1475 * LDM(1/3): !Rn, register_list
1476 * LDM(2): !Rn, !register_list
1477 * LDR,STR,PLD immediate offset: Rd, Rn
1478 * LDR,STR,PLD register offset: Rd, Rn, !Rm
1479 * LDR,STR,PLD scaled register offset: Rd, !Rn, !Rm
1480 * LDR,STR immediate pre/post-indexed: Rd, !Rn
1481 * LDR,STR register pre/post-indexed: Rd, !Rn, !Rm
1482 * LDR,STR scaled register pre/post-indexed: Rd, !Rn, !Rm
1483 * LDRB,STRB immediate offset: !Rd, Rn
1484 * LDRB,STRB register offset: !Rd, Rn, !Rm
1485 * LDRB,STRB scaled register offset: !Rd, !Rn, !Rm
1486 * LDRB,STRB immediate pre/post-indexed: !Rd, !Rn
1487 * LDRB,STRB register pre/post-indexed: !Rd, !Rn, !Rm
1488 * LDRB,STRB scaled register pre/post-indexed: !Rd, !Rn, !Rm
1489 * LDRT,LDRBT,STRBT immediate pre/post-indexed: !Rd, !Rn
1490 * LDRT,LDRBT,STRBT register pre/post-indexed: !Rd, !Rn, !Rm
1491 * LDRT,LDRBT,STRBT scaled register pre/post-indexed: !Rd, !Rn, !Rm
1492 * LDRH/SH/SB/D,STRH/SH/SB/D immediate offset: !Rd, Rn
1493 * LDRH/SH/SB/D,STRH/SH/SB/D register offset: !Rd, Rn, !Rm
1494 * LDRH/SH/SB/D,STRH/SH/SB/D immediate pre/post-indexed: !Rd, !Rn
1495 * LDRH/SH/SB/D,STRH/SH/SB/D register pre/post-indexed: !Rd, !Rn, !Rm
1496 * LDREX: !Rd, !Rn
1497 * MCR/2: !Rd
1498 * MCRR/2,MRRC/2: !Rd, !Rn
1499 * MLA: !Rd, !Rn, !Rm, !Rs
1500 * MOV: Rd
1501 * MRC/2: !Rd (if Rd==15, only changes cond codes, not the register)
1502 * MRS,MSR: !Rd
1503 * MUL: !Rd, !Rm, !Rs
1504 * PKH{BT,TB}: !Rd, !Rn, !Rm
1505 * QDADD,[U]QADD/16/8/SUBX: !Rd, !Rm, !Rn
1506 * QDSUB,[U]QSUB/16/8/ADDX: !Rd, !Rm, !Rn
1507 * REV/16/SH: !Rd, !Rm
1508 * RFE: !Rn
1509 * {S,U}[H]ADD{16,8,SUBX},{S,U}[H]SUB{16,8,ADDX}: !Rd, !Rn, !Rm
1510 * SEL: !Rd, !Rn, !Rm
1511 * SMLA<x><y>,SMLA{D,W<y>},SMLSD,SMML{A,S}: !Rd, !Rn, !Rm, !Rs
1512 * SMLAL<x><y>,SMLA{D,LD},SMLSLD,SMMULL,SMULW<y>: !RdHi, !RdLo, !Rm, !Rs
1513 * SMMUL,SMUAD,SMUL<x><y>,SMUSD: !Rd, !Rm, !Rs
1514 * SSAT/16: !Rd, !Rm
1515 * STM(1/2): !Rn, register_list* (R15 in reg list not recommended)
1516 * STRT immediate pre/post-indexed: Rd*, !Rn
1517 * STRT register pre/post-indexed: Rd*, !Rn, !Rm
1518 * STRT scaled register pre/post-indexed: Rd*, !Rn, !Rm
1519 * STREX: !Rd, !Rn, !Rm
1520 * SWP/B: !Rd, !Rn, !Rm
1521 * {S,U}XTA{B,B16,H}: !Rd, !Rn, !Rm
1522 * {S,U}XT{B,B16,H}: !Rd, !Rm
1523 * UM{AA,LA,UL}L: !RdHi, !RdLo, !Rm, !Rs
1524 * USA{D8,A8,T,T16}: !Rd, !Rm, !Rs
1525 *
1526 * May transfer control by writing R15 (possible mode changes or alternate
1527 * mode accesses marked by "*"):
1528 * ALU op (* with s-bit), B, BL, BKPT, BLX(1/2), BX, BXJ, CPS*, CPY,
1529 * LDM(1), LDM(2/3)*, LDR, MOV, RFE*, SWI*
1530 *
1531 * Instructions that do not take general registers, nor transfer control:
1532 * CDP/2, SETEND, SRS*
1533 */
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 2ba7deb3072..1656c87501c 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -134,7 +134,8 @@ static void __kprobes singlestep(struct kprobe *p, struct pt_regs *regs,
134 struct kprobe_ctlblk *kcb) 134 struct kprobe_ctlblk *kcb)
135{ 135{
136 regs->ARM_pc += 4; 136 regs->ARM_pc += 4;
137 p->ainsn.insn_handler(p, regs); 137 if (p->ainsn.insn_check_cc(regs->ARM_cpsr))
138 p->ainsn.insn_handler(p, regs);
138} 139}
139 140
140/* 141/*
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 69cfee0fe00..139e3c82736 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -221,7 +221,7 @@ again:
221 prev_raw_count &= armpmu->max_period; 221 prev_raw_count &= armpmu->max_period;
222 222
223 if (overflow) 223 if (overflow)
224 delta = armpmu->max_period - prev_raw_count + new_raw_count; 224 delta = armpmu->max_period - prev_raw_count + new_raw_count + 1;
225 else 225 else
226 delta = new_raw_count - prev_raw_count; 226 delta = new_raw_count - prev_raw_count;
227 227
@@ -746,7 +746,8 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
746 746
747 tail = (struct frame_tail __user *)regs->ARM_fp - 1; 747 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
748 748
749 while (tail && !((unsigned long)tail & 0x3)) 749 while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
750 tail && !((unsigned long)tail & 0x3))
750 tail = user_backtrace(tail, entry); 751 tail = user_backtrace(tail, entry);
751} 752}
752 753
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 94bbedbed63..5e1e5419722 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -372,6 +372,8 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
372 if (clone_flags & CLONE_SETTLS) 372 if (clone_flags & CLONE_SETTLS)
373 thread->tp_value = regs->ARM_r3; 373 thread->tp_value = regs->ARM_r3;
374 374
375 thread_notify(THREAD_NOTIFY_COPY, thread);
376
375 return 0; 377 return 0;
376} 378}
377 379
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 2bf27f364d0..8182f45ca49 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -767,12 +767,20 @@ long arch_ptrace(struct task_struct *child, long request,
767 767
768#ifdef CONFIG_HAVE_HW_BREAKPOINT 768#ifdef CONFIG_HAVE_HW_BREAKPOINT
769 case PTRACE_GETHBPREGS: 769 case PTRACE_GETHBPREGS:
770 if (ptrace_get_breakpoints(child) < 0)
771 return -ESRCH;
772
770 ret = ptrace_gethbpregs(child, addr, 773 ret = ptrace_gethbpregs(child, addr,
771 (unsigned long __user *)data); 774 (unsigned long __user *)data);
775 ptrace_put_breakpoints(child);
772 break; 776 break;
773 case PTRACE_SETHBPREGS: 777 case PTRACE_SETHBPREGS:
778 if (ptrace_get_breakpoints(child) < 0)
779 return -ESRCH;
780
774 ret = ptrace_sethbpregs(child, addr, 781 ret = ptrace_sethbpregs(child, addr,
775 (unsigned long __user *)data); 782 (unsigned long __user *)data);
783 ptrace_put_breakpoints(child);
776 break; 784 break;
777#endif 785#endif
778 786
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 8fe05ad932e..f29b8a29b17 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -479,7 +479,7 @@ static void broadcast_timer_set_mode(enum clock_event_mode mode,
479{ 479{
480} 480}
481 481
482static void broadcast_timer_setup(struct clock_event_device *evt) 482static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
483{ 483{
484 evt->name = "dummy_timer"; 484 evt->name = "dummy_timer";
485 evt->features = CLOCK_EVT_FEAT_ONESHOT | 485 evt->features = CLOCK_EVT_FEAT_ONESHOT |
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index 7a576092291..40ee7e5045e 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -158,7 +158,7 @@ static int emulate_swpX(unsigned int address, unsigned int *data,
158 158
159 if (res == 0) { 159 if (res == 0) {
160 /* 160 /*
161 * Barrier also required between aquiring a lock for a 161 * Barrier also required between acquiring a lock for a
162 * protected resource and accessing the resource. Inserted for 162 * protected resource and accessing the resource. Inserted for
163 * same reason as above. 163 * same reason as above.
164 */ 164 */
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index 4ad8da15ef2..af0aaebf4de 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -311,7 +311,7 @@ asmlinkage long sys_oabi_semtimedop(int semid,
311 long err; 311 long err;
312 int i; 312 int i;
313 313
314 if (nsops < 1) 314 if (nsops < 1 || nsops > SEMOPM)
315 return -EINVAL; 315 return -EINVAL;
316 sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); 316 sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL);
317 if (!sops) 317 if (!sops)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index f0000e188c8..3b54ad19d48 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -410,8 +410,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
410 struct thread_info *thread = current_thread_info(); 410 struct thread_info *thread = current_thread_info();
411 siginfo_t info; 411 siginfo_t info;
412 412
413 if (current->personality != PER_LINUX && 413 if ((current->personality & PER_MASK) != PER_LINUX &&
414 current->personality != PER_LINUX_32BIT &&
415 thread->exec_domain->handler) { 414 thread->exec_domain->handler) {
416 thread->exec_domain->handler(n, regs); 415 thread->exec_domain->handler(n, regs);
417 return regs->ARM_r0; 416 return regs->ARM_r0;
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 19390231a0e..2d299bf5d72 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -83,6 +83,7 @@ config ARCH_AT91CAP9
83 select CPU_ARM926T 83 select CPU_ARM926T
84 select GENERIC_CLOCKEVENTS 84 select GENERIC_CLOCKEVENTS
85 select HAVE_FB_ATMEL 85 select HAVE_FB_ATMEL
86 select HAVE_NET_MACB
86 87
87config ARCH_AT572D940HF 88config ARCH_AT572D940HF
88 bool "AT572D940HF" 89 bool "AT572D940HF"
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 2e74a19874d..295e1e77fa6 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -76,7 +76,7 @@ static struct at91_udc_data __initdata carmeva_udc_data = {
76 .pullup_pin = AT91_PIN_PD9, 76 .pullup_pin = AT91_PIN_PD9,
77}; 77};
78 78
79/* FIXME: user dependant */ 79/* FIXME: user dependent */
80// static struct at91_cf_data __initdata carmeva_cf_data = { 80// static struct at91_cf_data __initdata carmeva_cf_data = {
81// .det_pin = AT91_PIN_PB0, 81// .det_pin = AT91_PIN_PB0,
82// .rst_pin = AT91_PIN_PC5, 82// .rst_pin = AT91_PIN_PC5,
diff --git a/arch/arm/mach-at91/board-eb01.c b/arch/arm/mach-at91/board-eb01.c
index 1f9d3cb64c5..d8df59a3426 100644
--- a/arch/arm/mach-at91/board-eb01.c
+++ b/arch/arm/mach-at91/board-eb01.c
@@ -30,6 +30,11 @@
30#include <mach/board.h> 30#include <mach/board.h>
31#include "generic.h" 31#include "generic.h"
32 32
33static void __init at91eb01_init_irq(void)
34{
35 at91x40_init_interrupts(NULL);
36}
37
33static void __init at91eb01_map_io(void) 38static void __init at91eb01_map_io(void)
34{ 39{
35 at91x40_initialize(40000000); 40 at91x40_initialize(40000000);
@@ -38,7 +43,7 @@ static void __init at91eb01_map_io(void)
38MACHINE_START(AT91EB01, "Atmel AT91 EB01") 43MACHINE_START(AT91EB01, "Atmel AT91 EB01")
39 /* Maintainer: Greg Ungerer <gerg@snapgear.com> */ 44 /* Maintainer: Greg Ungerer <gerg@snapgear.com> */
40 .timer = &at91x40_timer, 45 .timer = &at91x40_timer,
41 .init_irq = at91x40_init_interrupts, 46 .init_irq = at91eb01_init_irq,
42 .map_io = at91eb01_map_io, 47 .map_io = at91eb01_map_io,
43MACHINE_END 48MACHINE_END
44 49
diff --git a/arch/arm/mach-at91/include/mach/at91_mci.h b/arch/arm/mach-at91/include/mach/at91_mci.h
index 27ac6f550fe..02182c16a02 100644
--- a/arch/arm/mach-at91/include/mach/at91_mci.h
+++ b/arch/arm/mach-at91/include/mach/at91_mci.h
@@ -102,7 +102,7 @@
102#define AT91_MCI_RDIRE (1 << 17) /* Response Direction Error */ 102#define AT91_MCI_RDIRE (1 << 17) /* Response Direction Error */
103#define AT91_MCI_RCRCE (1 << 18) /* Response CRC Error */ 103#define AT91_MCI_RCRCE (1 << 18) /* Response CRC Error */
104#define AT91_MCI_RENDE (1 << 19) /* Response End Bit Error */ 104#define AT91_MCI_RENDE (1 << 19) /* Response End Bit Error */
105#define AT91_MCI_RTOE (1 << 20) /* Reponse Time-out Error */ 105#define AT91_MCI_RTOE (1 << 20) /* Response Time-out Error */
106#define AT91_MCI_DCRCE (1 << 21) /* Data CRC Error */ 106#define AT91_MCI_DCRCE (1 << 21) /* Data CRC Error */
107#define AT91_MCI_DTOE (1 << 22) /* Data Time-out Error */ 107#define AT91_MCI_DTOE (1 << 22) /* Data Time-out Error */
108#define AT91_MCI_OVRE (1 << 30) /* Overrun */ 108#define AT91_MCI_OVRE (1 << 30) /* Overrun */
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 3bef931d0b1..0700f212530 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -27,6 +27,7 @@
27#define ARCH_ID_AT91SAM9G45 0x819b05a0 27#define ARCH_ID_AT91SAM9G45 0x819b05a0
28#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ 28#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */
29#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ 29#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */
30#define ARCH_ID_AT91SAM9X5 0x819a05a0
30#define ARCH_ID_AT91CAP9 0x039A03A0 31#define ARCH_ID_AT91CAP9 0x039A03A0
31 32
32#define ARCH_ID_AT91SAM9XE128 0x329973a0 33#define ARCH_ID_AT91SAM9XE128 0x329973a0
@@ -55,6 +56,12 @@ static inline unsigned long at91_cpu_fully_identify(void)
55#define ARCH_EXID_AT91SAM9G46 0x00000003 56#define ARCH_EXID_AT91SAM9G46 0x00000003
56#define ARCH_EXID_AT91SAM9G45 0x00000004 57#define ARCH_EXID_AT91SAM9G45 0x00000004
57 58
59#define ARCH_EXID_AT91SAM9G15 0x00000000
60#define ARCH_EXID_AT91SAM9G35 0x00000001
61#define ARCH_EXID_AT91SAM9X35 0x00000002
62#define ARCH_EXID_AT91SAM9G25 0x00000003
63#define ARCH_EXID_AT91SAM9X25 0x00000004
64
58static inline unsigned long at91_exid_identify(void) 65static inline unsigned long at91_exid_identify(void)
59{ 66{
60 return at91_sys_read(AT91_DBGU_EXID); 67 return at91_sys_read(AT91_DBGU_EXID);
@@ -143,6 +150,27 @@ static inline unsigned long at91cap9_rev_identify(void)
143#define cpu_is_at91sam9m11() (0) 150#define cpu_is_at91sam9m11() (0)
144#endif 151#endif
145 152
153#ifdef CONFIG_ARCH_AT91SAM9X5
154#define cpu_is_at91sam9x5() (at91_cpu_identify() == ARCH_ID_AT91SAM9X5)
155#define cpu_is_at91sam9g15() (cpu_is_at91sam9x5() && \
156 (at91_exid_identify() == ARCH_EXID_AT91SAM9G15))
157#define cpu_is_at91sam9g35() (cpu_is_at91sam9x5() && \
158 (at91_exid_identify() == ARCH_EXID_AT91SAM9G35))
159#define cpu_is_at91sam9x35() (cpu_is_at91sam9x5() && \
160 (at91_exid_identify() == ARCH_EXID_AT91SAM9X35))
161#define cpu_is_at91sam9g25() (cpu_is_at91sam9x5() && \
162 (at91_exid_identify() == ARCH_EXID_AT91SAM9G25))
163#define cpu_is_at91sam9x25() (cpu_is_at91sam9x5() && \
164 (at91_exid_identify() == ARCH_EXID_AT91SAM9X25))
165#else
166#define cpu_is_at91sam9x5() (0)
167#define cpu_is_at91sam9g15() (0)
168#define cpu_is_at91sam9g35() (0)
169#define cpu_is_at91sam9x35() (0)
170#define cpu_is_at91sam9g25() (0)
171#define cpu_is_at91sam9x25() (0)
172#endif
173
146#ifdef CONFIG_ARCH_AT91CAP9 174#ifdef CONFIG_ARCH_AT91CAP9
147#define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9) 175#define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9)
148#define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B) 176#define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B)
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index ddeb6453675..056dc6674b6 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -208,7 +208,7 @@ extern void at91_gpio_resume(void);
208 208
209/*-------------------------------------------------------------------------*/ 209/*-------------------------------------------------------------------------*/
210 210
211/* wrappers for "new style" GPIO calls. the old AT91-specfic ones should 211/* wrappers for "new style" GPIO calls. the old AT91-specific ones should
212 * eventually be removed (along with this errno.h inclusion), and the 212 * eventually be removed (along with this errno.h inclusion), and the
213 * gpio request/free calls should probably be implemented. 213 * gpio request/free calls should probably be implemented.
214 */ 214 */
diff --git a/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c b/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c
index 77f84b40dda..a1f328357aa 100644
--- a/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c
+++ b/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c
@@ -551,7 +551,7 @@ int dmacHw_calculateDescriptorCount(dmacHw_CONFIG_t *pConfig, /* [ IN ] Config
551 551
552/****************************************************************************/ 552/****************************************************************************/
553/** 553/**
554* @brief Check the existance of pending descriptor 554* @brief Check the existence of pending descriptor
555* 555*
556* This function confirmes if there is any pending descriptor in the chain 556* This function confirmes if there is any pending descriptor in the chain
557* to program the channel 557* to program the channel
@@ -775,7 +775,7 @@ int dmacHw_setVariableDataDescriptor(dmacHw_HANDLE_t handle, /* [ IN ] DMA Cha
775/** 775/**
776* @brief Read data DMAed to memory 776* @brief Read data DMAed to memory
777* 777*
778* This function will read data that has been DMAed to memory while transfering from: 778* This function will read data that has been DMAed to memory while transferring from:
779* - Memory to memory 779* - Memory to memory
780* - Peripheral to memory 780* - Peripheral to memory
781* 781*
@@ -941,7 +941,7 @@ int dmacHw_setControlDescriptor(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configurat
941/** 941/**
942* @brief Sets channel specific user data 942* @brief Sets channel specific user data
943* 943*
944* This function associates user data to a specif DMA channel 944* This function associates user data to a specific DMA channel
945* 945*
946*/ 946*/
947/****************************************************************************/ 947/****************************************************************************/
diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c
index 8d1baf3f468..d87ad30dda3 100644
--- a/arch/arm/mach-bcmring/dma.c
+++ b/arch/arm/mach-bcmring/dma.c
@@ -629,7 +629,7 @@ EXPORT_SYMBOL(dma_get_device_descriptor_ring);
629* Configures a DMA channel. 629* Configures a DMA channel.
630* 630*
631* @return 631* @return
632* >= 0 - Initialization was successfull. 632* >= 0 - Initialization was successful.
633* 633*
634* -EBUSY - Device is currently being used. 634* -EBUSY - Device is currently being used.
635* -ENODEV - Device handed in is invalid. 635* -ENODEV - Device handed in is invalid.
@@ -673,7 +673,7 @@ static int ConfigChannel(DMA_Handle_t handle)
673/** 673/**
674* Initializes all of the data structures associated with the DMA. 674* Initializes all of the data structures associated with the DMA.
675* @return 675* @return
676* >= 0 - Initialization was successfull. 676* >= 0 - Initialization was successful.
677* 677*
678* -EBUSY - Device is currently being used. 678* -EBUSY - Device is currently being used.
679* -ENODEV - Device handed in is invalid. 679* -ENODEV - Device handed in is invalid.
diff --git a/arch/arm/mach-bcmring/include/csp/dmacHw.h b/arch/arm/mach-bcmring/include/csp/dmacHw.h
index 6c8da2b9fc1..e6a1dc484ca 100644
--- a/arch/arm/mach-bcmring/include/csp/dmacHw.h
+++ b/arch/arm/mach-bcmring/include/csp/dmacHw.h
@@ -362,7 +362,7 @@ int dmacHw_setControlDescriptor(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configurati
362/** 362/**
363* @brief Read data DMA transferred to memory 363* @brief Read data DMA transferred to memory
364* 364*
365* This function will read data that has been DMAed to memory while transfering from: 365* This function will read data that has been DMAed to memory while transferring from:
366* - Memory to memory 366* - Memory to memory
367* - Peripheral to memory 367* - Peripheral to memory
368* 368*
@@ -446,7 +446,7 @@ void dmacHw_stopTransfer(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle *
446 446
447/****************************************************************************/ 447/****************************************************************************/
448/** 448/**
449* @brief Check the existance of pending descriptor 449* @brief Check the existence of pending descriptor
450* 450*
451* This function confirmes if there is any pending descriptor in the chain 451* This function confirmes if there is any pending descriptor in the chain
452* to program the channel 452* to program the channel
@@ -542,7 +542,7 @@ dmacHw_HANDLE_t dmacHw_getInterruptSource(void);
542/** 542/**
543* @brief Sets channel specific user data 543* @brief Sets channel specific user data
544* 544*
545* This function associates user data to a specif DMA channel 545* This function associates user data to a specific DMA channel
546* 546*
547*/ 547*/
548/****************************************************************************/ 548/****************************************************************************/
diff --git a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h
index 70eaea866cf..161973385fa 100644
--- a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h
+++ b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h
@@ -180,7 +180,7 @@ typedef enum {
180 180
181#define chipcHw_XTAL_FREQ_Hz 25000000 /* Reference clock frequency in Hz */ 181#define chipcHw_XTAL_FREQ_Hz 25000000 /* Reference clock frequency in Hz */
182 182
183/* Programable pin defines */ 183/* Programmable pin defines */
184#define chipcHw_PIN_GPIO(n) ((((n) >= 0) && ((n) < (chipcHw_GPIO_COUNT))) ? (n) : 0xFFFFFFFF) 184#define chipcHw_PIN_GPIO(n) ((((n) >= 0) && ((n) < (chipcHw_GPIO_COUNT))) ? (n) : 0xFFFFFFFF)
185 /* GPIO pin 0 - 60 */ 185 /* GPIO pin 0 - 60 */
186#define chipcHw_PIN_UARTTXD (chipcHw_GPIO_COUNT + 0) /* UART Transmit */ 186#define chipcHw_PIN_UARTTXD (chipcHw_GPIO_COUNT + 0) /* UART Transmit */
diff --git a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h
index c78833acb37..03238c29900 100644
--- a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h
+++ b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h
@@ -832,7 +832,7 @@ static inline void chipcHw_setUsbDevice(void)
832 832
833/****************************************************************************/ 833/****************************************************************************/
834/** 834/**
835* @brief Lower layer funtion to enable/disable a clock of a certain device 835* @brief Lower layer function to enable/disable a clock of a certain device
836* 836*
837* This function enables/disables a core clock 837* This function enables/disables a core clock
838* 838*
diff --git a/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h b/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h
index e01fc4607c9..0aeb6a6fe7f 100644
--- a/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h
+++ b/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h
@@ -109,9 +109,9 @@
109#define INTCHW_INTC0_DMA0C0 (1<<INTCHW_INTC0_DMA0C0_BITNUM) 109#define INTCHW_INTC0_DMA0C0 (1<<INTCHW_INTC0_DMA0C0_BITNUM)
110 110
111/* INTC1 - interrupt controller 1 */ 111/* INTC1 - interrupt controller 1 */
112#define INTCHW_INTC1_DDRVPMP_BITNUM 27 /* DDR and VPM PLL clock phase relationship interupt (Not for A0) */ 112#define INTCHW_INTC1_DDRVPMP_BITNUM 27 /* DDR and VPM PLL clock phase relationship interrupt (Not for A0) */
113#define INTCHW_INTC1_DDRVPMT_BITNUM 26 /* DDR and VPM HW phase align timeout interrupt (Not for A0) */ 113#define INTCHW_INTC1_DDRVPMT_BITNUM 26 /* DDR and VPM HW phase align timeout interrupt (Not for A0) */
114#define INTCHW_INTC1_DDRP_BITNUM 26 /* DDR and PLL clock phase relationship interupt (For A0 only)) */ 114#define INTCHW_INTC1_DDRP_BITNUM 26 /* DDR and PLL clock phase relationship interrupt (For A0 only)) */
115#define INTCHW_INTC1_RTC2_BITNUM 25 /* Real time clock tamper interrupt */ 115#define INTCHW_INTC1_RTC2_BITNUM 25 /* Real time clock tamper interrupt */
116#define INTCHW_INTC1_VDEC_BITNUM 24 /* Hantro Video Decoder interrupt */ 116#define INTCHW_INTC1_VDEC_BITNUM 24 /* Hantro Video Decoder interrupt */
117/* Bits 13-23 are non-secure versions of the corresponding secure bits in SINTC bits 0-10. */ 117/* Bits 13-23 are non-secure versions of the corresponding secure bits in SINTC bits 0-10. */
diff --git a/arch/arm/mach-bcmring/include/mach/reg_umi.h b/arch/arm/mach-bcmring/include/mach/reg_umi.h
index 06a355481ea..0992842caa7 100644
--- a/arch/arm/mach-bcmring/include/mach/reg_umi.h
+++ b/arch/arm/mach-bcmring/include/mach/reg_umi.h
@@ -88,7 +88,7 @@
88/* REG_UMI_FLASH0/1/2_TCR, REG_UMI_SRAM0/1_TCR bits */ 88/* REG_UMI_FLASH0/1/2_TCR, REG_UMI_SRAM0/1_TCR bits */
89/* Enable wait pin during burst write or read */ 89/* Enable wait pin during burst write or read */
90#define REG_UMI_TCR_WAITEN 0x80000000 90#define REG_UMI_TCR_WAITEN 0x80000000
91/* Enable mem ctrlr to work iwth ext mem of lower freq than AHB clk */ 91/* Enable mem ctrlr to work with ext mem of lower freq than AHB clk */
92#define REG_UMI_TCR_LOWFREQ 0x40000000 92#define REG_UMI_TCR_LOWFREQ 0x40000000
93/* 1=synch write, 0=async write */ 93/* 1=synch write, 0=async write */
94#define REG_UMI_TCR_MEMTYPE_SYNCWRITE 0x20000000 94#define REG_UMI_TCR_MEMTYPE_SYNCWRITE 0x20000000
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 32f147998cd..c0deacae778 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -63,6 +63,7 @@ config MACH_DAVINCI_EVM
63 depends on ARCH_DAVINCI_DM644x 63 depends on ARCH_DAVINCI_DM644x
64 select MISC_DEVICES 64 select MISC_DEVICES
65 select EEPROM_AT24 65 select EEPROM_AT24
66 select I2C
66 help 67 help
67 Configure this option to specify the whether the board used 68 Configure this option to specify the whether the board used
68 for development is a DM644x EVM 69 for development is a DM644x EVM
@@ -72,6 +73,7 @@ config MACH_SFFSDR
72 depends on ARCH_DAVINCI_DM644x 73 depends on ARCH_DAVINCI_DM644x
73 select MISC_DEVICES 74 select MISC_DEVICES
74 select EEPROM_AT24 75 select EEPROM_AT24
76 select I2C
75 help 77 help
76 Say Y here to select the Lyrtech Small Form Factor 78 Say Y here to select the Lyrtech Small Form Factor
77 Software Defined Radio (SFFSDR) board. 79 Software Defined Radio (SFFSDR) board.
@@ -105,6 +107,7 @@ config MACH_DAVINCI_DM6467_EVM
105 select MACH_DAVINCI_DM6467TEVM 107 select MACH_DAVINCI_DM6467TEVM
106 select MISC_DEVICES 108 select MISC_DEVICES
107 select EEPROM_AT24 109 select EEPROM_AT24
110 select I2C
108 help 111 help
109 Configure this option to specify the whether the board used 112 Configure this option to specify the whether the board used
110 for development is a DM6467 EVM 113 for development is a DM6467 EVM
@@ -118,6 +121,7 @@ config MACH_DAVINCI_DM365_EVM
118 depends on ARCH_DAVINCI_DM365 121 depends on ARCH_DAVINCI_DM365
119 select MISC_DEVICES 122 select MISC_DEVICES
120 select EEPROM_AT24 123 select EEPROM_AT24
124 select I2C
121 help 125 help
122 Configure this option to specify whether the board used 126 Configure this option to specify whether the board used
123 for development is a DM365 EVM 127 for development is a DM365 EVM
@@ -129,6 +133,7 @@ config MACH_DAVINCI_DA830_EVM
129 select GPIO_PCF857X 133 select GPIO_PCF857X
130 select MISC_DEVICES 134 select MISC_DEVICES
131 select EEPROM_AT24 135 select EEPROM_AT24
136 select I2C
132 help 137 help
133 Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module. 138 Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module.
134 139
@@ -205,6 +210,7 @@ config MACH_MITYOMAPL138
205 depends on ARCH_DAVINCI_DA850 210 depends on ARCH_DAVINCI_DA850
206 select MISC_DEVICES 211 select MISC_DEVICES
207 select EEPROM_AT24 212 select EEPROM_AT24
213 select I2C
208 help 214 help
209 Say Y here to select the Critical Link MityDSP-L138/MityARM-1808 215 Say Y here to select the Critical Link MityDSP-L138/MityARM-1808
210 System on Module. Information on this SoM may be found at 216 System on Module. Information on this SoM may be found at
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 2aa79c54f98..606a6f27ed6 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -29,7 +29,7 @@
29#include <mach/mux.h> 29#include <mach/mux.h>
30#include <mach/spi.h> 30#include <mach/spi.h>
31 31
32#define MITYOMAPL138_PHY_ID "0:03" 32#define MITYOMAPL138_PHY_ID ""
33 33
34#define FACTORY_CONFIG_MAGIC 0x012C0138 34#define FACTORY_CONFIG_MAGIC 0x012C0138
35#define FACTORY_CONFIG_VERSION 0x00010001 35#define FACTORY_CONFIG_VERSION 0x00010001
@@ -414,7 +414,7 @@ static struct resource mityomapl138_nandflash_resource[] = {
414 414
415static struct platform_device mityomapl138_nandflash_device = { 415static struct platform_device mityomapl138_nandflash_device = {
416 .name = "davinci_nand", 416 .name = "davinci_nand",
417 .id = 0, 417 .id = 1,
418 .dev = { 418 .dev = {
419 .platform_data = &mityomapl138_nandflash_data, 419 .platform_data = &mityomapl138_nandflash_data,
420 }, 420 },
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 6c389ff1020..3e7be2de96d 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -11,7 +11,7 @@
11 * DM644X-EVM board. It has: 11 * DM644X-EVM board. It has:
12 * DM6446M02 module with 256MB NAND, 256MB RAM, TLV320AIC32 AIC, 12 * DM6446M02 module with 256MB NAND, 256MB RAM, TLV320AIC32 AIC,
13 * USB, Ethernet, SD/MMC, UART, THS8200, TVP7000 for video. 13 * USB, Ethernet, SD/MMC, UART, THS8200, TVP7000 for video.
14 * Additionaly realtime clock, IR remote control receiver, 14 * Additionally realtime clock, IR remote control receiver,
15 * IR Blaster based on MSP430 (firmware although is different 15 * IR Blaster based on MSP430 (firmware although is different
16 * from used in DM644X-EVM), internal ATA-6 3.5” HDD drive 16 * from used in DM644X-EVM), internal ATA-6 3.5” HDD drive
17 * with PATA interface, two muxed red-green leds. 17 * with PATA interface, two muxed red-green leds.
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index 4a68c2b1ec1..0a95be1512b 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -167,7 +167,7 @@ static int davinci_cpu_init(struct cpufreq_policy *policy)
167 /* 167 /*
168 * Time measurement across the target() function yields ~1500-1800us 168 * Time measurement across the target() function yields ~1500-1800us
169 * time taken with no drivers on notification list. 169 * time taken with no drivers on notification list.
170 * Setting the latency to 2000 us to accomodate addition of drivers 170 * Setting the latency to 2000 us to accommodate addition of drivers
171 * to pre/post change notification list. 171 * to pre/post change notification list.
172 */ 172 */
173 policy->cpuinfo.transition_latency = 2000 * 1000; 173 policy->cpuinfo.transition_latency = 2000 * 1000;
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 68fe4c289d7..b95b9196dee 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1123,7 +1123,7 @@ void __init da850_init(void)
1123 * This helps keeping the peripherals on this domain insulated 1123 * This helps keeping the peripherals on this domain insulated
1124 * from CPU frequency changes caused by DVFS. The firmware sets 1124 * from CPU frequency changes caused by DVFS. The firmware sets
1125 * both PLL0 and PLL1 to the same frequency so, there should not 1125 * both PLL0 and PLL1 to the same frequency so, there should not
1126 * be any noticible change even in non-DVFS use cases. 1126 * be any noticeable change even in non-DVFS use cases.
1127 */ 1127 */
1128 da850_set_async3_src(1); 1128 da850_set_async3_src(1);
1129 1129
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 625d4b66718..58a02dc7b15 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -39,7 +39,8 @@
39#define DA8XX_GPIO_BASE 0x01e26000 39#define DA8XX_GPIO_BASE 0x01e26000
40#define DA8XX_I2C1_BASE 0x01e28000 40#define DA8XX_I2C1_BASE 0x01e28000
41#define DA8XX_SPI0_BASE 0x01c41000 41#define DA8XX_SPI0_BASE 0x01c41000
42#define DA8XX_SPI1_BASE 0x01f0e000 42#define DA830_SPI1_BASE 0x01e12000
43#define DA850_SPI1_BASE 0x01f0e000
43 44
44#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 45#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
45#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 46#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
@@ -762,8 +763,8 @@ static struct resource da8xx_spi0_resources[] = {
762 763
763static struct resource da8xx_spi1_resources[] = { 764static struct resource da8xx_spi1_resources[] = {
764 [0] = { 765 [0] = {
765 .start = DA8XX_SPI1_BASE, 766 .start = DA830_SPI1_BASE,
766 .end = DA8XX_SPI1_BASE + SZ_4K - 1, 767 .end = DA830_SPI1_BASE + SZ_4K - 1,
767 .flags = IORESOURCE_MEM, 768 .flags = IORESOURCE_MEM,
768 }, 769 },
769 [1] = { 770 [1] = {
@@ -832,5 +833,10 @@ int __init da8xx_register_spi(int instance, struct spi_board_info *info,
832 833
833 da8xx_spi_pdata[instance].num_chipselect = len; 834 da8xx_spi_pdata[instance].num_chipselect = len;
834 835
836 if (instance == 1 && cpu_is_davinci_da850()) {
837 da8xx_spi1_resources[0].start = DA850_SPI1_BASE;
838 da8xx_spi1_resources[0].end = DA850_SPI1_BASE + SZ_4K - 1;
839 }
840
835 return platform_device_register(&da8xx_spi_device[instance]); 841 return platform_device_register(&da8xx_spi_device[instance]);
836} 842}
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 76364d1345d..a3a94e9c937 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -314,7 +314,7 @@ static struct clk timer2_clk = {
314 .name = "timer2", 314 .name = "timer2",
315 .parent = &pll1_aux_clk, 315 .parent = &pll1_aux_clk,
316 .lpsc = DAVINCI_LPSC_TIMER2, 316 .lpsc = DAVINCI_LPSC_TIMER2,
317 .usecount = 1, /* REVISIT: why cant' this be disabled? */ 317 .usecount = 1, /* REVISIT: why can't this be disabled? */
318}; 318};
319 319
320static struct clk timer3_clk = { 320static struct clk timer3_clk = {
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 9a2376b3137..4c82c271629 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -274,7 +274,7 @@ static struct clk timer2_clk = {
274 .name = "timer2", 274 .name = "timer2",
275 .parent = &pll1_aux_clk, 275 .parent = &pll1_aux_clk,
276 .lpsc = DAVINCI_LPSC_TIMER2, 276 .lpsc = DAVINCI_LPSC_TIMER2,
277 .usecount = 1, /* REVISIT: why cant' this be disabled? */ 277 .usecount = 1, /* REVISIT: why can't this be disabled? */
278}; 278};
279 279
280static struct clk_lookup dm644x_clks[] = { 280static struct clk_lookup dm644x_clks[] = {
diff --git a/arch/arm/mach-davinci/include/mach/cputype.h b/arch/arm/mach-davinci/include/mach/cputype.h
index cea6b897204..957fb87e832 100644
--- a/arch/arm/mach-davinci/include/mach/cputype.h
+++ b/arch/arm/mach-davinci/include/mach/cputype.h
@@ -4,7 +4,7 @@
4 * Author: Kevin Hilman, Deep Root Systems, LLC 4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 * 5 *
6 * Defines the cpu_is_*() macros for runtime detection of DaVinci 6 * Defines the cpu_is_*() macros for runtime detection of DaVinci
7 * device type. In addtion, if support for a given device is not 7 * device type. In addition, if support for a given device is not
8 * compiled in to the kernel, the macros return 0 so that 8 * compiled in to the kernel, the macros return 0 so that
9 * resulting code can be optimized out. 9 * resulting code can be optimized out.
10 * 10 *
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index 9f1befc5ac3..f8b7ea4f623 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -24,6 +24,9 @@
24 24
25#define UART_SHIFT 2 25#define UART_SHIFT 2
26 26
27#define davinci_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
28#define davinci_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
29
27 .pushsection .data 30 .pushsection .data
28davinci_uart_phys: .word 0 31davinci_uart_phys: .word 0
29davinci_uart_virt: .word 0 32davinci_uart_virt: .word 0
@@ -34,7 +37,7 @@ davinci_uart_virt: .word 0
34 /* Use davinci_uart_phys/virt if already configured */ 37 /* Use davinci_uart_phys/virt if already configured */
3510: mrc p15, 0, \rp, c1, c0 3810: mrc p15, 0, \rp, c1, c0
36 tst \rp, #1 @ MMU enabled? 39 tst \rp, #1 @ MMU enabled?
37 ldreq \rp, =__virt_to_phys(davinci_uart_phys) 40 ldreq \rp, =davinci_uart_v2p(davinci_uart_phys)
38 ldrne \rp, =davinci_uart_phys 41 ldrne \rp, =davinci_uart_phys
39 add \rv, \rp, #4 @ davinci_uart_virt 42 add \rv, \rp, #4 @ davinci_uart_virt
40 ldr \rp, [\rp, #0] 43 ldr \rp, [\rp, #0]
@@ -48,18 +51,18 @@ davinci_uart_virt: .word 0
48 tst \rp, #1 @ MMU enabled? 51 tst \rp, #1 @ MMU enabled?
49 52
50 /* Copy uart phys address from decompressor uart info */ 53 /* Copy uart phys address from decompressor uart info */
51 ldreq \rv, =__virt_to_phys(davinci_uart_phys) 54 ldreq \rv, =davinci_uart_v2p(davinci_uart_phys)
52 ldrne \rv, =davinci_uart_phys 55 ldrne \rv, =davinci_uart_phys
53 ldreq \rp, =DAVINCI_UART_INFO 56 ldreq \rp, =DAVINCI_UART_INFO
54 ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO) 57 ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
55 ldr \rp, [\rp, #0] 58 ldr \rp, [\rp, #0]
56 str \rp, [\rv] 59 str \rp, [\rv]
57 60
58 /* Copy uart virt address from decompressor uart info */ 61 /* Copy uart virt address from decompressor uart info */
59 ldreq \rv, =__virt_to_phys(davinci_uart_virt) 62 ldreq \rv, =davinci_uart_v2p(davinci_uart_virt)
60 ldrne \rv, =davinci_uart_virt 63 ldrne \rv, =davinci_uart_virt
61 ldreq \rp, =DAVINCI_UART_INFO 64 ldreq \rp, =DAVINCI_UART_INFO
62 ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO) 65 ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
63 ldr \rp, [\rp, #4] 66 ldr \rp, [\rp, #4]
64 str \rp, [\rv] 67 str \rp, [\rv]
65 68
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index 8051110b8ac..c9e6ce185a6 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -22,7 +22,7 @@
22 * 22 *
23 * This area sits just below the page tables (see arch/arm/kernel/head.S). 23 * This area sits just below the page tables (see arch/arm/kernel/head.S).
24 */ 24 */
25#define DAVINCI_UART_INFO (PHYS_OFFSET + 0x3ff8) 25#define DAVINCI_UART_INFO (PLAT_PHYS_OFFSET + 0x3ff8)
26 26
27#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) 27#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
28#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400) 28#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 47723e8d75a..78d80683cdc 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -25,8 +25,7 @@
25 25
26#include <mach/serial.h> 26#include <mach/serial.h>
27 27
28static u32 *uart; 28u32 *uart;
29static u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
30 29
31/* PORT_16C550A, in polled non-fifo mode */ 30/* PORT_16C550A, in polled non-fifo mode */
32static void putc(char c) 31static void putc(char c)
@@ -44,6 +43,8 @@ static inline void flush(void)
44 43
45static inline void set_uart_info(u32 phys, void * __iomem virt) 44static inline void set_uart_info(u32 phys, void * __iomem virt)
46{ 45{
46 u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
47
47 uart = (u32 *)phys; 48 uart = (u32 *)phys;
48 uart_info[0] = phys; 49 uart_info[0] = phys;
49 uart_info[1] = (u32)virt; 50 uart_info[1] = (u32)virt;
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index e6269a6e001..bfe68ec4e1a 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -29,8 +29,6 @@
29#include <mach/common.h> 29#include <mach/common.h>
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
31 31
32#define IRQ_BIT(irq) ((irq) & 0x1f)
33
34#define FIQ_REG0_OFFSET 0x0000 32#define FIQ_REG0_OFFSET 0x0000
35#define FIQ_REG1_OFFSET 0x0004 33#define FIQ_REG1_OFFSET 0x0004
36#define IRQ_REG0_OFFSET 0x0008 34#define IRQ_REG0_OFFSET 0x0008
@@ -42,78 +40,33 @@
42#define IRQ_INTPRI0_REG_OFFSET 0x0030 40#define IRQ_INTPRI0_REG_OFFSET 0x0030
43#define IRQ_INTPRI7_REG_OFFSET 0x004C 41#define IRQ_INTPRI7_REG_OFFSET 0x004C
44 42
45static inline unsigned int davinci_irq_readl(int offset)
46{
47 return __raw_readl(davinci_intc_base + offset);
48}
49
50static inline void davinci_irq_writel(unsigned long value, int offset) 43static inline void davinci_irq_writel(unsigned long value, int offset)
51{ 44{
52 __raw_writel(value, davinci_intc_base + offset); 45 __raw_writel(value, davinci_intc_base + offset);
53} 46}
54 47
55/* Disable interrupt */ 48static __init void
56static void davinci_mask_irq(struct irq_data *d) 49davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
57{ 50{
58 unsigned int mask; 51 struct irq_chip_generic *gc;
59 u32 l; 52 struct irq_chip_type *ct;
60 53
61 mask = 1 << IRQ_BIT(d->irq); 54 gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq);
62 55 ct = gc->chip_types;
63 if (d->irq > 31) { 56 ct->chip.irq_ack = irq_gc_ack;
64 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET); 57 ct->chip.irq_mask = irq_gc_mask_clr_bit;
65 l &= ~mask; 58 ct->chip.irq_unmask = irq_gc_mask_set_bit;
66 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET); 59
67 } else { 60 ct->regs.ack = IRQ_REG0_OFFSET;
68 l = davinci_irq_readl(IRQ_ENT_REG0_OFFSET); 61 ct->regs.mask = IRQ_ENT_REG0_OFFSET;
69 l &= ~mask; 62 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
70 davinci_irq_writel(l, IRQ_ENT_REG0_OFFSET); 63 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
71 }
72}
73
74/* Enable interrupt */
75static void davinci_unmask_irq(struct irq_data *d)
76{
77 unsigned int mask;
78 u32 l;
79
80 mask = 1 << IRQ_BIT(d->irq);
81
82 if (d->irq > 31) {
83 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET);
84 l |= mask;
85 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET);
86 } else {
87 l = davinci_irq_readl(IRQ_ENT_REG0_OFFSET);
88 l |= mask;
89 davinci_irq_writel(l, IRQ_ENT_REG0_OFFSET);
90 }
91} 64}
92 65
93/* EOI interrupt */
94static void davinci_ack_irq(struct irq_data *d)
95{
96 unsigned int mask;
97
98 mask = 1 << IRQ_BIT(d->irq);
99
100 if (d->irq > 31)
101 davinci_irq_writel(mask, IRQ_REG1_OFFSET);
102 else
103 davinci_irq_writel(mask, IRQ_REG0_OFFSET);
104}
105
106static struct irq_chip davinci_irq_chip_0 = {
107 .name = "AINTC",
108 .irq_ack = davinci_ack_irq,
109 .irq_mask = davinci_mask_irq,
110 .irq_unmask = davinci_unmask_irq,
111};
112
113/* ARM Interrupt Controller Initialization */ 66/* ARM Interrupt Controller Initialization */
114void __init davinci_irq_init(void) 67void __init davinci_irq_init(void)
115{ 68{
116 unsigned i; 69 unsigned i, j;
117 const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios; 70 const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios;
118 71
119 davinci_intc_type = DAVINCI_INTC_TYPE_AINTC; 72 davinci_intc_type = DAVINCI_INTC_TYPE_AINTC;
@@ -144,7 +97,6 @@ void __init davinci_irq_init(void)
144 davinci_irq_writel(~0x0, IRQ_REG1_OFFSET); 97 davinci_irq_writel(~0x0, IRQ_REG1_OFFSET);
145 98
146 for (i = IRQ_INTPRI0_REG_OFFSET; i <= IRQ_INTPRI7_REG_OFFSET; i += 4) { 99 for (i = IRQ_INTPRI0_REG_OFFSET; i <= IRQ_INTPRI7_REG_OFFSET; i += 4) {
147 unsigned j;
148 u32 pri; 100 u32 pri;
149 101
150 for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++) 102 for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++)
@@ -152,13 +104,8 @@ void __init davinci_irq_init(void)
152 davinci_irq_writel(pri, i); 104 davinci_irq_writel(pri, i);
153 } 105 }
154 106
155 /* set up genirq dispatch for ARM INTC */ 107 for (i = 0, j = 0; i < davinci_soc_info.intc_irq_num; i += 32, j += 0x04)
156 for (i = 0; i < davinci_soc_info.intc_irq_num; i++) { 108 davinci_alloc_gc(davinci_intc_base + j, i, 32);
157 irq_set_chip(i, &davinci_irq_chip_0); 109
158 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 110 irq_set_handler(IRQ_TINT1_TINT34, handle_level_irq);
159 if (i != IRQ_TINT1_TINT34)
160 irq_set_handler(i, handle_edge_irq);
161 else
162 irq_set_handler(i, handle_level_irq);
163 }
164} 111}
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index e06a88f1f81..5ed51b84c1b 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -16,10 +16,8 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/mbus.h> 18#include <linux/mbus.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/mv643xx_i2c.h>
21#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
22#include <linux/spi/orion_spi.h> 20#include <linux/serial_8250.h>
23#include <linux/gpio.h> 21#include <linux/gpio.h>
24#include <asm/page.h> 22#include <asm/page.h>
25#include <asm/setup.h> 23#include <asm/setup.h>
@@ -32,11 +30,12 @@
32#include <mach/bridge-regs.h> 30#include <mach/bridge-regs.h>
33#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
34#include <linux/irq.h> 32#include <linux/irq.h>
35#include <plat/mv_xor.h>
36#include <plat/ehci-orion.h>
37#include <plat/time.h> 33#include <plat/time.h>
34#include <plat/common.h>
38#include "common.h" 35#include "common.h"
39 36
37static int get_tclk(void);
38
40/***************************************************************************** 39/*****************************************************************************
41 * I/O Address Mapping 40 * I/O Address Mapping
42 ****************************************************************************/ 41 ****************************************************************************/
@@ -70,463 +69,106 @@ void __init dove_map_io(void)
70} 69}
71 70
72/***************************************************************************** 71/*****************************************************************************
73 * EHCI
74 ****************************************************************************/
75static struct orion_ehci_data dove_ehci_data = {
76 .dram = &dove_mbus_dram_info,
77 .phy_version = EHCI_PHY_NA,
78};
79
80static u64 ehci_dmamask = DMA_BIT_MASK(32);
81
82/*****************************************************************************
83 * EHCI0 72 * EHCI0
84 ****************************************************************************/ 73 ****************************************************************************/
85static struct resource dove_ehci0_resources[] = {
86 {
87 .start = DOVE_USB0_PHYS_BASE,
88 .end = DOVE_USB0_PHYS_BASE + SZ_4K - 1,
89 .flags = IORESOURCE_MEM,
90 }, {
91 .start = IRQ_DOVE_USB0,
92 .end = IRQ_DOVE_USB0,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97static struct platform_device dove_ehci0 = {
98 .name = "orion-ehci",
99 .id = 0,
100 .dev = {
101 .dma_mask = &ehci_dmamask,
102 .coherent_dma_mask = DMA_BIT_MASK(32),
103 .platform_data = &dove_ehci_data,
104 },
105 .resource = dove_ehci0_resources,
106 .num_resources = ARRAY_SIZE(dove_ehci0_resources),
107};
108
109void __init dove_ehci0_init(void) 74void __init dove_ehci0_init(void)
110{ 75{
111 platform_device_register(&dove_ehci0); 76 orion_ehci_init(&dove_mbus_dram_info,
77 DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0);
112} 78}
113 79
114/***************************************************************************** 80/*****************************************************************************
115 * EHCI1 81 * EHCI1
116 ****************************************************************************/ 82 ****************************************************************************/
117static struct resource dove_ehci1_resources[] = {
118 {
119 .start = DOVE_USB1_PHYS_BASE,
120 .end = DOVE_USB1_PHYS_BASE + SZ_4K - 1,
121 .flags = IORESOURCE_MEM,
122 }, {
123 .start = IRQ_DOVE_USB1,
124 .end = IRQ_DOVE_USB1,
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129static struct platform_device dove_ehci1 = {
130 .name = "orion-ehci",
131 .id = 1,
132 .dev = {
133 .dma_mask = &ehci_dmamask,
134 .coherent_dma_mask = DMA_BIT_MASK(32),
135 .platform_data = &dove_ehci_data,
136 },
137 .resource = dove_ehci1_resources,
138 .num_resources = ARRAY_SIZE(dove_ehci1_resources),
139};
140
141void __init dove_ehci1_init(void) 83void __init dove_ehci1_init(void)
142{ 84{
143 platform_device_register(&dove_ehci1); 85 orion_ehci_1_init(&dove_mbus_dram_info,
86 DOVE_USB1_PHYS_BASE, IRQ_DOVE_USB1);
144} 87}
145 88
146/***************************************************************************** 89/*****************************************************************************
147 * GE00 90 * GE00
148 ****************************************************************************/ 91 ****************************************************************************/
149struct mv643xx_eth_shared_platform_data dove_ge00_shared_data = {
150 .t_clk = 0,
151 .dram = &dove_mbus_dram_info,
152};
153
154static struct resource dove_ge00_shared_resources[] = {
155 {
156 .name = "ge00 base",
157 .start = DOVE_GE00_PHYS_BASE + 0x2000,
158 .end = DOVE_GE00_PHYS_BASE + SZ_16K - 1,
159 .flags = IORESOURCE_MEM,
160 },
161};
162
163static struct platform_device dove_ge00_shared = {
164 .name = MV643XX_ETH_SHARED_NAME,
165 .id = 0,
166 .dev = {
167 .platform_data = &dove_ge00_shared_data,
168 },
169 .num_resources = 1,
170 .resource = dove_ge00_shared_resources,
171};
172
173static struct resource dove_ge00_resources[] = {
174 {
175 .name = "ge00 irq",
176 .start = IRQ_DOVE_GE00_SUM,
177 .end = IRQ_DOVE_GE00_SUM,
178 .flags = IORESOURCE_IRQ,
179 },
180};
181
182static struct platform_device dove_ge00 = {
183 .name = MV643XX_ETH_NAME,
184 .id = 0,
185 .num_resources = 1,
186 .resource = dove_ge00_resources,
187 .dev = {
188 .coherent_dma_mask = 0xffffffff,
189 },
190};
191
192void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data) 92void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
193{ 93{
194 eth_data->shared = &dove_ge00_shared; 94 orion_ge00_init(eth_data, &dove_mbus_dram_info,
195 dove_ge00.dev.platform_data = eth_data; 95 DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
196 96 0, get_tclk());
197 platform_device_register(&dove_ge00_shared);
198 platform_device_register(&dove_ge00);
199} 97}
200 98
201/***************************************************************************** 99/*****************************************************************************
202 * SoC RTC 100 * SoC RTC
203 ****************************************************************************/ 101 ****************************************************************************/
204static struct resource dove_rtc_resource[] = {
205 {
206 .start = DOVE_RTC_PHYS_BASE,
207 .end = DOVE_RTC_PHYS_BASE + 32 - 1,
208 .flags = IORESOURCE_MEM,
209 }, {
210 .start = IRQ_DOVE_RTC,
211 .flags = IORESOURCE_IRQ,
212 }
213};
214
215void __init dove_rtc_init(void) 102void __init dove_rtc_init(void)
216{ 103{
217 platform_device_register_simple("rtc-mv", -1, dove_rtc_resource, 2); 104 orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC);
218} 105}
219 106
220/***************************************************************************** 107/*****************************************************************************
221 * SATA 108 * SATA
222 ****************************************************************************/ 109 ****************************************************************************/
223static struct resource dove_sata_resources[] = {
224 {
225 .name = "sata base",
226 .start = DOVE_SATA_PHYS_BASE,
227 .end = DOVE_SATA_PHYS_BASE + 0x5000 - 1,
228 .flags = IORESOURCE_MEM,
229 }, {
230 .name = "sata irq",
231 .start = IRQ_DOVE_SATA,
232 .end = IRQ_DOVE_SATA,
233 .flags = IORESOURCE_IRQ,
234 },
235};
236
237static struct platform_device dove_sata = {
238 .name = "sata_mv",
239 .id = 0,
240 .dev = {
241 .coherent_dma_mask = DMA_BIT_MASK(32),
242 },
243 .num_resources = ARRAY_SIZE(dove_sata_resources),
244 .resource = dove_sata_resources,
245};
246
247void __init dove_sata_init(struct mv_sata_platform_data *sata_data) 110void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
248{ 111{
249 sata_data->dram = &dove_mbus_dram_info; 112 orion_sata_init(sata_data, &dove_mbus_dram_info,
250 dove_sata.dev.platform_data = sata_data; 113 DOVE_SATA_PHYS_BASE, IRQ_DOVE_SATA);
251 platform_device_register(&dove_sata); 114
252} 115}
253 116
254/***************************************************************************** 117/*****************************************************************************
255 * UART0 118 * UART0
256 ****************************************************************************/ 119 ****************************************************************************/
257static struct plat_serial8250_port dove_uart0_data[] = {
258 {
259 .mapbase = DOVE_UART0_PHYS_BASE,
260 .membase = (char *)DOVE_UART0_VIRT_BASE,
261 .irq = IRQ_DOVE_UART_0,
262 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
263 .iotype = UPIO_MEM,
264 .regshift = 2,
265 .uartclk = 0,
266 }, {
267 },
268};
269
270static struct resource dove_uart0_resources[] = {
271 {
272 .start = DOVE_UART0_PHYS_BASE,
273 .end = DOVE_UART0_PHYS_BASE + SZ_256 - 1,
274 .flags = IORESOURCE_MEM,
275 }, {
276 .start = IRQ_DOVE_UART_0,
277 .end = IRQ_DOVE_UART_0,
278 .flags = IORESOURCE_IRQ,
279 },
280};
281
282static struct platform_device dove_uart0 = {
283 .name = "serial8250",
284 .id = 0,
285 .dev = {
286 .platform_data = dove_uart0_data,
287 },
288 .resource = dove_uart0_resources,
289 .num_resources = ARRAY_SIZE(dove_uart0_resources),
290};
291
292void __init dove_uart0_init(void) 120void __init dove_uart0_init(void)
293{ 121{
294 platform_device_register(&dove_uart0); 122 orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
123 IRQ_DOVE_UART_0, get_tclk());
295} 124}
296 125
297/***************************************************************************** 126/*****************************************************************************
298 * UART1 127 * UART1
299 ****************************************************************************/ 128 ****************************************************************************/
300static struct plat_serial8250_port dove_uart1_data[] = {
301 {
302 .mapbase = DOVE_UART1_PHYS_BASE,
303 .membase = (char *)DOVE_UART1_VIRT_BASE,
304 .irq = IRQ_DOVE_UART_1,
305 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
306 .iotype = UPIO_MEM,
307 .regshift = 2,
308 .uartclk = 0,
309 }, {
310 },
311};
312
313static struct resource dove_uart1_resources[] = {
314 {
315 .start = DOVE_UART1_PHYS_BASE,
316 .end = DOVE_UART1_PHYS_BASE + SZ_256 - 1,
317 .flags = IORESOURCE_MEM,
318 }, {
319 .start = IRQ_DOVE_UART_1,
320 .end = IRQ_DOVE_UART_1,
321 .flags = IORESOURCE_IRQ,
322 },
323};
324
325static struct platform_device dove_uart1 = {
326 .name = "serial8250",
327 .id = 1,
328 .dev = {
329 .platform_data = dove_uart1_data,
330 },
331 .resource = dove_uart1_resources,
332 .num_resources = ARRAY_SIZE(dove_uart1_resources),
333};
334
335void __init dove_uart1_init(void) 129void __init dove_uart1_init(void)
336{ 130{
337 platform_device_register(&dove_uart1); 131 orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
132 IRQ_DOVE_UART_1, get_tclk());
338} 133}
339 134
340/***************************************************************************** 135/*****************************************************************************
341 * UART2 136 * UART2
342 ****************************************************************************/ 137 ****************************************************************************/
343static struct plat_serial8250_port dove_uart2_data[] = {
344 {
345 .mapbase = DOVE_UART2_PHYS_BASE,
346 .membase = (char *)DOVE_UART2_VIRT_BASE,
347 .irq = IRQ_DOVE_UART_2,
348 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
349 .iotype = UPIO_MEM,
350 .regshift = 2,
351 .uartclk = 0,
352 }, {
353 },
354};
355
356static struct resource dove_uart2_resources[] = {
357 {
358 .start = DOVE_UART2_PHYS_BASE,
359 .end = DOVE_UART2_PHYS_BASE + SZ_256 - 1,
360 .flags = IORESOURCE_MEM,
361 }, {
362 .start = IRQ_DOVE_UART_2,
363 .end = IRQ_DOVE_UART_2,
364 .flags = IORESOURCE_IRQ,
365 },
366};
367
368static struct platform_device dove_uart2 = {
369 .name = "serial8250",
370 .id = 2,
371 .dev = {
372 .platform_data = dove_uart2_data,
373 },
374 .resource = dove_uart2_resources,
375 .num_resources = ARRAY_SIZE(dove_uart2_resources),
376};
377
378void __init dove_uart2_init(void) 138void __init dove_uart2_init(void)
379{ 139{
380 platform_device_register(&dove_uart2); 140 orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
141 IRQ_DOVE_UART_2, get_tclk());
381} 142}
382 143
383/***************************************************************************** 144/*****************************************************************************
384 * UART3 145 * UART3
385 ****************************************************************************/ 146 ****************************************************************************/
386static struct plat_serial8250_port dove_uart3_data[] = {
387 {
388 .mapbase = DOVE_UART3_PHYS_BASE,
389 .membase = (char *)DOVE_UART3_VIRT_BASE,
390 .irq = IRQ_DOVE_UART_3,
391 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
392 .iotype = UPIO_MEM,
393 .regshift = 2,
394 .uartclk = 0,
395 }, {
396 },
397};
398
399static struct resource dove_uart3_resources[] = {
400 {
401 .start = DOVE_UART3_PHYS_BASE,
402 .end = DOVE_UART3_PHYS_BASE + SZ_256 - 1,
403 .flags = IORESOURCE_MEM,
404 }, {
405 .start = IRQ_DOVE_UART_3,
406 .end = IRQ_DOVE_UART_3,
407 .flags = IORESOURCE_IRQ,
408 },
409};
410
411static struct platform_device dove_uart3 = {
412 .name = "serial8250",
413 .id = 3,
414 .dev = {
415 .platform_data = dove_uart3_data,
416 },
417 .resource = dove_uart3_resources,
418 .num_resources = ARRAY_SIZE(dove_uart3_resources),
419};
420
421void __init dove_uart3_init(void) 147void __init dove_uart3_init(void)
422{ 148{
423 platform_device_register(&dove_uart3); 149 orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
150 IRQ_DOVE_UART_3, get_tclk());
424} 151}
425 152
426/***************************************************************************** 153/*****************************************************************************
427 * SPI0 154 * SPI
428 ****************************************************************************/ 155 ****************************************************************************/
429static struct orion_spi_info dove_spi0_data = {
430 .tclk = 0,
431};
432
433static struct resource dove_spi0_resources[] = {
434 {
435 .start = DOVE_SPI0_PHYS_BASE,
436 .end = DOVE_SPI0_PHYS_BASE + SZ_512 - 1,
437 .flags = IORESOURCE_MEM,
438 }, {
439 .start = IRQ_DOVE_SPI0,
440 .end = IRQ_DOVE_SPI0,
441 .flags = IORESOURCE_IRQ,
442 },
443};
444
445static struct platform_device dove_spi0 = {
446 .name = "orion_spi",
447 .id = 0,
448 .resource = dove_spi0_resources,
449 .dev = {
450 .platform_data = &dove_spi0_data,
451 },
452 .num_resources = ARRAY_SIZE(dove_spi0_resources),
453};
454
455void __init dove_spi0_init(void) 156void __init dove_spi0_init(void)
456{ 157{
457 platform_device_register(&dove_spi0); 158 orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk());
458} 159}
459 160
460/*****************************************************************************
461 * SPI1
462 ****************************************************************************/
463static struct orion_spi_info dove_spi1_data = {
464 .tclk = 0,
465};
466
467static struct resource dove_spi1_resources[] = {
468 {
469 .start = DOVE_SPI1_PHYS_BASE,
470 .end = DOVE_SPI1_PHYS_BASE + SZ_512 - 1,
471 .flags = IORESOURCE_MEM,
472 }, {
473 .start = IRQ_DOVE_SPI1,
474 .end = IRQ_DOVE_SPI1,
475 .flags = IORESOURCE_IRQ,
476 },
477};
478
479static struct platform_device dove_spi1 = {
480 .name = "orion_spi",
481 .id = 1,
482 .resource = dove_spi1_resources,
483 .dev = {
484 .platform_data = &dove_spi1_data,
485 },
486 .num_resources = ARRAY_SIZE(dove_spi1_resources),
487};
488
489void __init dove_spi1_init(void) 161void __init dove_spi1_init(void)
490{ 162{
491 platform_device_register(&dove_spi1); 163 orion_spi_init(DOVE_SPI1_PHYS_BASE, get_tclk());
492} 164}
493 165
494/***************************************************************************** 166/*****************************************************************************
495 * I2C 167 * I2C
496 ****************************************************************************/ 168 ****************************************************************************/
497static struct mv64xxx_i2c_pdata dove_i2c_data = {
498 .freq_m = 10, /* assumes 166 MHz TCLK gets 94.3kHz */
499 .freq_n = 3,
500 .timeout = 1000, /* Default timeout of 1 second */
501};
502
503static struct resource dove_i2c_resources[] = {
504 {
505 .name = "i2c base",
506 .start = DOVE_I2C_PHYS_BASE,
507 .end = DOVE_I2C_PHYS_BASE + 0x20 - 1,
508 .flags = IORESOURCE_MEM,
509 }, {
510 .name = "i2c irq",
511 .start = IRQ_DOVE_I2C,
512 .end = IRQ_DOVE_I2C,
513 .flags = IORESOURCE_IRQ,
514 },
515};
516
517static struct platform_device dove_i2c = {
518 .name = MV64XXX_I2C_CTLR_NAME,
519 .id = 0,
520 .num_resources = ARRAY_SIZE(dove_i2c_resources),
521 .resource = dove_i2c_resources,
522 .dev = {
523 .platform_data = &dove_i2c_data,
524 },
525};
526
527void __init dove_i2c_init(void) 169void __init dove_i2c_init(void)
528{ 170{
529 platform_device_register(&dove_i2c); 171 orion_i2c_init(DOVE_I2C_PHYS_BASE, IRQ_DOVE_I2C, 10);
530} 172}
531 173
532/***************************************************************************** 174/*****************************************************************************
@@ -554,208 +196,22 @@ struct sys_timer dove_timer = {
554}; 196};
555 197
556/***************************************************************************** 198/*****************************************************************************
557 * XOR
558 ****************************************************************************/
559static struct mv_xor_platform_shared_data dove_xor_shared_data = {
560 .dram = &dove_mbus_dram_info,
561};
562
563/*****************************************************************************
564 * XOR 0 199 * XOR 0
565 ****************************************************************************/ 200 ****************************************************************************/
566static u64 dove_xor0_dmamask = DMA_BIT_MASK(32);
567
568static struct resource dove_xor0_shared_resources[] = {
569 {
570 .name = "xor 0 low",
571 .start = DOVE_XOR0_PHYS_BASE,
572 .end = DOVE_XOR0_PHYS_BASE + 0xff,
573 .flags = IORESOURCE_MEM,
574 }, {
575 .name = "xor 0 high",
576 .start = DOVE_XOR0_HIGH_PHYS_BASE,
577 .end = DOVE_XOR0_HIGH_PHYS_BASE + 0xff,
578 .flags = IORESOURCE_MEM,
579 },
580};
581
582static struct platform_device dove_xor0_shared = {
583 .name = MV_XOR_SHARED_NAME,
584 .id = 0,
585 .dev = {
586 .platform_data = &dove_xor_shared_data,
587 },
588 .num_resources = ARRAY_SIZE(dove_xor0_shared_resources),
589 .resource = dove_xor0_shared_resources,
590};
591
592static struct resource dove_xor00_resources[] = {
593 [0] = {
594 .start = IRQ_DOVE_XOR_00,
595 .end = IRQ_DOVE_XOR_00,
596 .flags = IORESOURCE_IRQ,
597 },
598};
599
600static struct mv_xor_platform_data dove_xor00_data = {
601 .shared = &dove_xor0_shared,
602 .hw_id = 0,
603 .pool_size = PAGE_SIZE,
604};
605
606static struct platform_device dove_xor00_channel = {
607 .name = MV_XOR_NAME,
608 .id = 0,
609 .num_resources = ARRAY_SIZE(dove_xor00_resources),
610 .resource = dove_xor00_resources,
611 .dev = {
612 .dma_mask = &dove_xor0_dmamask,
613 .coherent_dma_mask = DMA_BIT_MASK(64),
614 .platform_data = &dove_xor00_data,
615 },
616};
617
618static struct resource dove_xor01_resources[] = {
619 [0] = {
620 .start = IRQ_DOVE_XOR_01,
621 .end = IRQ_DOVE_XOR_01,
622 .flags = IORESOURCE_IRQ,
623 },
624};
625
626static struct mv_xor_platform_data dove_xor01_data = {
627 .shared = &dove_xor0_shared,
628 .hw_id = 1,
629 .pool_size = PAGE_SIZE,
630};
631
632static struct platform_device dove_xor01_channel = {
633 .name = MV_XOR_NAME,
634 .id = 1,
635 .num_resources = ARRAY_SIZE(dove_xor01_resources),
636 .resource = dove_xor01_resources,
637 .dev = {
638 .dma_mask = &dove_xor0_dmamask,
639 .coherent_dma_mask = DMA_BIT_MASK(64),
640 .platform_data = &dove_xor01_data,
641 },
642};
643
644void __init dove_xor0_init(void) 201void __init dove_xor0_init(void)
645{ 202{
646 platform_device_register(&dove_xor0_shared); 203 orion_xor0_init(&dove_mbus_dram_info,
647 204 DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE,
648 /* 205 IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01);
649 * two engines can't do memset simultaneously, this limitation
650 * satisfied by removing memset support from one of the engines.
651 */
652 dma_cap_set(DMA_MEMCPY, dove_xor00_data.cap_mask);
653 dma_cap_set(DMA_XOR, dove_xor00_data.cap_mask);
654 platform_device_register(&dove_xor00_channel);
655
656 dma_cap_set(DMA_MEMCPY, dove_xor01_data.cap_mask);
657 dma_cap_set(DMA_MEMSET, dove_xor01_data.cap_mask);
658 dma_cap_set(DMA_XOR, dove_xor01_data.cap_mask);
659 platform_device_register(&dove_xor01_channel);
660} 206}
661 207
662/***************************************************************************** 208/*****************************************************************************
663 * XOR 1 209 * XOR 1
664 ****************************************************************************/ 210 ****************************************************************************/
665static u64 dove_xor1_dmamask = DMA_BIT_MASK(32);
666
667static struct resource dove_xor1_shared_resources[] = {
668 {
669 .name = "xor 0 low",
670 .start = DOVE_XOR1_PHYS_BASE,
671 .end = DOVE_XOR1_PHYS_BASE + 0xff,
672 .flags = IORESOURCE_MEM,
673 }, {
674 .name = "xor 0 high",
675 .start = DOVE_XOR1_HIGH_PHYS_BASE,
676 .end = DOVE_XOR1_HIGH_PHYS_BASE + 0xff,
677 .flags = IORESOURCE_MEM,
678 },
679};
680
681static struct platform_device dove_xor1_shared = {
682 .name = MV_XOR_SHARED_NAME,
683 .id = 1,
684 .dev = {
685 .platform_data = &dove_xor_shared_data,
686 },
687 .num_resources = ARRAY_SIZE(dove_xor1_shared_resources),
688 .resource = dove_xor1_shared_resources,
689};
690
691static struct resource dove_xor10_resources[] = {
692 [0] = {
693 .start = IRQ_DOVE_XOR_10,
694 .end = IRQ_DOVE_XOR_10,
695 .flags = IORESOURCE_IRQ,
696 },
697};
698
699static struct mv_xor_platform_data dove_xor10_data = {
700 .shared = &dove_xor1_shared,
701 .hw_id = 0,
702 .pool_size = PAGE_SIZE,
703};
704
705static struct platform_device dove_xor10_channel = {
706 .name = MV_XOR_NAME,
707 .id = 2,
708 .num_resources = ARRAY_SIZE(dove_xor10_resources),
709 .resource = dove_xor10_resources,
710 .dev = {
711 .dma_mask = &dove_xor1_dmamask,
712 .coherent_dma_mask = DMA_BIT_MASK(64),
713 .platform_data = &dove_xor10_data,
714 },
715};
716
717static struct resource dove_xor11_resources[] = {
718 [0] = {
719 .start = IRQ_DOVE_XOR_11,
720 .end = IRQ_DOVE_XOR_11,
721 .flags = IORESOURCE_IRQ,
722 },
723};
724
725static struct mv_xor_platform_data dove_xor11_data = {
726 .shared = &dove_xor1_shared,
727 .hw_id = 1,
728 .pool_size = PAGE_SIZE,
729};
730
731static struct platform_device dove_xor11_channel = {
732 .name = MV_XOR_NAME,
733 .id = 3,
734 .num_resources = ARRAY_SIZE(dove_xor11_resources),
735 .resource = dove_xor11_resources,
736 .dev = {
737 .dma_mask = &dove_xor1_dmamask,
738 .coherent_dma_mask = DMA_BIT_MASK(64),
739 .platform_data = &dove_xor11_data,
740 },
741};
742
743void __init dove_xor1_init(void) 211void __init dove_xor1_init(void)
744{ 212{
745 platform_device_register(&dove_xor1_shared); 213 orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE,
746 214 IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11);
747 /*
748 * two engines can't do memset simultaneously, this limitation
749 * satisfied by removing memset support from one of the engines.
750 */
751 dma_cap_set(DMA_MEMCPY, dove_xor10_data.cap_mask);
752 dma_cap_set(DMA_XOR, dove_xor10_data.cap_mask);
753 platform_device_register(&dove_xor10_channel);
754
755 dma_cap_set(DMA_MEMCPY, dove_xor11_data.cap_mask);
756 dma_cap_set(DMA_MEMSET, dove_xor11_data.cap_mask);
757 dma_cap_set(DMA_XOR, dove_xor11_data.cap_mask);
758 platform_device_register(&dove_xor11_channel);
759} 215}
760 216
761/***************************************************************************** 217/*****************************************************************************
@@ -833,14 +289,6 @@ void __init dove_init(void)
833#endif 289#endif
834 dove_setup_cpu_mbus(); 290 dove_setup_cpu_mbus();
835 291
836 dove_ge00_shared_data.t_clk = tclk;
837 dove_uart0_data[0].uartclk = tclk;
838 dove_uart1_data[0].uartclk = tclk;
839 dove_uart2_data[0].uartclk = tclk;
840 dove_uart3_data[0].uartclk = tclk;
841 dove_spi0_data.tclk = tclk;
842 dove_spi1_data.tclk = tclk;
843
844 /* internal devices that every board has */ 292 /* internal devices that every board has */
845 dove_rtc_init(); 293 dove_rtc_init();
846 dove_xor0_init(); 294 dove_xor0_init();
diff --git a/arch/arm/mach-dove/mpp.c b/arch/arm/mach-dove/mpp.c
index c66c7634690..51e0e411c9c 100644
--- a/arch/arm/mach-dove/mpp.c
+++ b/arch/arm/mach-dove/mpp.c
@@ -11,24 +11,17 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/io.h> 13#include <linux/io.h>
14 14#include <plat/mpp.h>
15#include <mach/dove.h> 15#include <mach/dove.h>
16
17#include "mpp.h" 16#include "mpp.h"
18 17
19#define MPP_NR_REGS 4
20#define MPP_CTRL(i) ((i) == 3 ? \
21 DOVE_MPP_CTRL4_VIRT_BASE : \
22 DOVE_MPP_VIRT_BASE + (i) * 4)
23#define PMU_SIG_REGS 2
24#define PMU_SIG_CTRL(i) (DOVE_PMU_SIG_CTRL + (i) * 4)
25
26struct dove_mpp_grp { 18struct dove_mpp_grp {
27 int start; 19 int start;
28 int end; 20 int end;
29}; 21};
30 22
31static struct dove_mpp_grp dove_mpp_grp[] = { 23/* Map a group to a range of GPIO pins in that group */
24static const struct dove_mpp_grp dove_mpp_grp[] = {
32 [MPP_24_39] = { 25 [MPP_24_39] = {
33 .start = 24, 26 .start = 24,
34 .end = 39, 27 .end = 39,
@@ -38,8 +31,8 @@ static struct dove_mpp_grp dove_mpp_grp[] = {
38 .end = 45, 31 .end = 45,
39 }, 32 },
40 [MPP_46_51] = { 33 [MPP_46_51] = {
41 .start = 40, 34 .start = 46,
42 .end = 45, 35 .end = 51,
43 }, 36 },
44 [MPP_58_61] = { 37 [MPP_58_61] = {
45 .start = 58, 38 .start = 58,
@@ -51,6 +44,8 @@ static struct dove_mpp_grp dove_mpp_grp[] = {
51 }, 44 },
52}; 45};
53 46
47/* Enable gpio for a range of pins. mode should be a combination of
48 GPIO_OUTPUT_OK | GPIO_INPUT_OK */
54static void dove_mpp_gpio_mode(int start, int end, int gpio_mode) 49static void dove_mpp_gpio_mode(int start, int end, int gpio_mode)
55{ 50{
56 int i; 51 int i;
@@ -59,24 +54,17 @@ static void dove_mpp_gpio_mode(int start, int end, int gpio_mode)
59 orion_gpio_set_valid(i, gpio_mode); 54 orion_gpio_set_valid(i, gpio_mode);
60} 55}
61 56
57/* Dump all the extra MPP registers. The platform code will dump the
58 registers for pins 0-23. */
62static void dove_mpp_dump_regs(void) 59static void dove_mpp_dump_regs(void)
63{ 60{
64#ifdef DEBUG 61 pr_debug("PMU_CTRL4_CTRL: %08x\n",
65 int i; 62 readl(DOVE_MPP_CTRL4_VIRT_BASE));
66 63
67 pr_debug("MPP_CTRL regs:"); 64 pr_debug("PMU_MPP_GENERAL_CTRL: %08x\n",
68 for (i = 0; i < MPP_NR_REGS; i++) 65 readl(DOVE_PMU_MPP_GENERAL_CTRL));
69 printk(" %08x", readl(MPP_CTRL(i)));
70 printk("\n");
71 66
72 pr_debug("PMU_SIG_CTRL regs:");
73 for (i = 0; i < PMU_SIG_REGS; i++)
74 printk(" %08x", readl(PMU_SIG_CTRL(i)));
75 printk("\n");
76
77 pr_debug("PMU_MPP_GENERAL_CTRL: %08x\n", readl(DOVE_PMU_MPP_GENERAL_CTRL));
78 pr_debug("MPP_GENERAL: %08x\n", readl(DOVE_MPP_GENERAL_VIRT_BASE)); 67 pr_debug("MPP_GENERAL: %08x\n", readl(DOVE_MPP_GENERAL_VIRT_BASE));
79#endif
80} 68}
81 69
82static void dove_mpp_cfg_nfc(int sel) 70static void dove_mpp_cfg_nfc(int sel)
@@ -92,7 +80,7 @@ static void dove_mpp_cfg_nfc(int sel)
92 80
93static void dove_mpp_cfg_au1(int sel) 81static void dove_mpp_cfg_au1(int sel)
94{ 82{
95 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 83 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
96 u32 ssp_ctrl1 = readl(DOVE_SSP_CTRL_STATUS_1); 84 u32 ssp_ctrl1 = readl(DOVE_SSP_CTRL_STATUS_1);
97 u32 mpp_gen_ctrl = readl(DOVE_MPP_GENERAL_VIRT_BASE); 85 u32 mpp_gen_ctrl = readl(DOVE_MPP_GENERAL_VIRT_BASE);
98 u32 global_cfg_2 = readl(DOVE_GLOBAL_CONFIG_2); 86 u32 global_cfg_2 = readl(DOVE_GLOBAL_CONFIG_2);
@@ -128,82 +116,46 @@ static void dove_mpp_cfg_au1(int sel)
128 writel(global_cfg_2, DOVE_GLOBAL_CONFIG_2); 116 writel(global_cfg_2, DOVE_GLOBAL_CONFIG_2);
129} 117}
130 118
131static void dove_mpp_conf_grp(int num, int sel, u32 *mpp_ctrl) 119/* Configure the group registers, enabling GPIO if sel indicates the
132{ 120 pin is to be used for GPIO */
133 int start = dove_mpp_grp[num].start; 121static void dove_mpp_conf_grp(unsigned int *mpp_grp_list)
134 int end = dove_mpp_grp[num].end;
135 int gpio_mode = sel ? GPIO_OUTPUT_OK | GPIO_INPUT_OK : 0;
136
137 *mpp_ctrl &= ~(0x1 << num);
138 *mpp_ctrl |= sel << num;
139
140 dove_mpp_gpio_mode(start, end, gpio_mode);
141}
142
143void __init dove_mpp_conf(unsigned int *mpp_list)
144{ 122{
145 u32 mpp_ctrl[MPP_NR_REGS]; 123 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
146 u32 pmu_mpp_ctrl = 0; 124 int gpio_mode;
147 u32 pmu_sig_ctrl[PMU_SIG_REGS];
148 int i;
149
150 for (i = 0; i < MPP_NR_REGS; i++)
151 mpp_ctrl[i] = readl(MPP_CTRL(i));
152
153 for (i = 0; i < PMU_SIG_REGS; i++)
154 pmu_sig_ctrl[i] = readl(PMU_SIG_CTRL(i));
155
156 pmu_mpp_ctrl = readl(DOVE_PMU_MPP_GENERAL_CTRL);
157 125
158 dove_mpp_dump_regs(); 126 for ( ; *mpp_grp_list; mpp_grp_list++) {
159 127 unsigned int num = MPP_NUM(*mpp_grp_list);
160 for ( ; *mpp_list != MPP_END; mpp_list++) { 128 unsigned int sel = MPP_SEL(*mpp_grp_list);
161 unsigned int num = MPP_NUM(*mpp_list);
162 unsigned int sel = MPP_SEL(*mpp_list);
163 int shift, gpio_mode;
164
165 if (num > MPP_MAX) {
166 pr_err("dove: invalid MPP number (%u)\n", num);
167 continue;
168 }
169
170 if (*mpp_list & MPP_NFC_MASK) {
171 dove_mpp_cfg_nfc(sel);
172 continue;
173 }
174 129
175 if (*mpp_list & MPP_AU1_MASK) { 130 if (num > MPP_GRP_MAX) {
176 dove_mpp_cfg_au1(sel); 131 pr_err("dove: invalid MPP GRP number (%u)\n", num);
177 continue; 132 continue;
178 } 133 }
179 134
180 if (*mpp_list & MPP_GRP_MASK) { 135 mpp_ctrl4 &= ~(0x1 << num);
181 dove_mpp_conf_grp(num, sel, &mpp_ctrl[3]); 136 mpp_ctrl4 |= sel << num;
182 continue;
183 }
184
185 shift = (num & 7) << 2;
186 if (*mpp_list & MPP_PMU_MASK) {
187 pmu_mpp_ctrl |= (0x1 << num);
188 pmu_sig_ctrl[num / 8] &= ~(0xf << shift);
189 pmu_sig_ctrl[num / 8] |= 0xf << shift;
190 gpio_mode = 0;
191 } else {
192 mpp_ctrl[num / 8] &= ~(0xf << shift);
193 mpp_ctrl[num / 8] |= sel << shift;
194 gpio_mode = GPIO_OUTPUT_OK | GPIO_INPUT_OK;
195 }
196 137
197 orion_gpio_set_valid(num, gpio_mode); 138 gpio_mode = sel ? GPIO_OUTPUT_OK | GPIO_INPUT_OK : 0;
139 dove_mpp_gpio_mode(dove_mpp_grp[num].start,
140 dove_mpp_grp[num].end, gpio_mode);
198 } 141 }
142 writel(mpp_ctrl4, DOVE_MPP_CTRL4_VIRT_BASE);
143}
199 144
200 for (i = 0; i < MPP_NR_REGS; i++) 145/* Configure the various MPP pins on Dove */
201 writel(mpp_ctrl[i], MPP_CTRL(i)); 146void __init dove_mpp_conf(unsigned int *mpp_list,
147 unsigned int *mpp_grp_list,
148 unsigned int grp_au1_52_57,
149 unsigned int grp_nfc_64_71)
150{
151 dove_mpp_dump_regs();
202 152
203 for (i = 0; i < PMU_SIG_REGS; i++) 153 /* Use platform code for pins 0-23 */
204 writel(pmu_sig_ctrl[i], PMU_SIG_CTRL(i)); 154 orion_mpp_conf(mpp_list, 0, MPP_MAX, DOVE_MPP_VIRT_BASE);
205 155
206 writel(pmu_mpp_ctrl, DOVE_PMU_MPP_GENERAL_CTRL); 156 dove_mpp_conf_grp(mpp_grp_list);
157 dove_mpp_cfg_au1(grp_au1_52_57);
158 dove_mpp_cfg_nfc(grp_nfc_64_71);
207 159
208 dove_mpp_dump_regs(); 160 dove_mpp_dump_regs();
209} 161}
diff --git a/arch/arm/mach-dove/mpp.h b/arch/arm/mach-dove/mpp.h
index 2a43ce413b1..fbec7c52bfa 100644
--- a/arch/arm/mach-dove/mpp.h
+++ b/arch/arm/mach-dove/mpp.h
@@ -1,178 +1,150 @@
1#ifndef __ARCH_DOVE_MPP_CODED_H 1#ifndef __ARCH_DOVE_MPP_CODED_H
2#define __ARCH_DOVE_MPP_CODED_H 2#define __ARCH_DOVE_MPP_CODED_H
3 3
4#define MPP(_num, _mode, _pmu, _grp, _au1, _nfc) ( \ 4#define MPP(_num, _sel, _in, _out) ( \
5/* MPP/group number */ ((_num) & 0xff) | \ 5 /* MPP number */ ((_num) & 0xff) | \
6/* MPP select value */ (((_mode) & 0xf) << 8) | \ 6 /* MPP select value */ (((_sel) & 0xf) << 8) | \
7/* MPP PMU */ ((!!(_pmu)) << 12) | \ 7 /* may be input signal */ ((!!(_in)) << 12) | \
8/* group flag */ ((!!(_grp)) << 13) | \ 8 /* may be output signal */ ((!!(_out)) << 13))
9/* AU1 flag */ ((!!(_au1)) << 14) | \ 9
10/* NFCE flag */ ((!!(_nfc)) << 15)) 10#define MPP0_GPIO0 MPP(0, 0x0, 1, 1)
11 11#define MPP0_UA2_RTSn MPP(0, 0x2, 0, 0)
12#define MPP_MAX 71 12#define MPP0_SDIO0_CD MPP(0, 0x3, 0, 0)
13 13#define MPP0_LCD0_PWM MPP(0, 0xf, 0, 0)
14#define MPP_NUM(x) ((x) & 0xff) 14
15#define MPP_SEL(x) (((x) >> 8) & 0xf) 15#define MPP1_GPIO1 MPP(1, 0x0, 1, 1)
16 16#define MPP1_UA2_CTSn MPP(1, 0x2, 0, 0)
17#define MPP_PMU_MASK MPP(0, 0x0, 1, 0, 0, 0) 17#define MPP1_SDIO0_WP MPP(1, 0x3, 0, 0)
18#define MPP_GRP_MASK MPP(0, 0x0, 0, 1, 0, 0) 18#define MPP1_LCD1_PWM MPP(1, 0xf, 0, 0)
19#define MPP_AU1_MASK MPP(0, 0x0, 0, 0, 1, 0) 19
20#define MPP_NFC_MASK MPP(0, 0x0, 0, 0, 0, 1) 20#define MPP2_GPIO2 MPP(2, 0x0, 1, 1)
21 21#define MPP2_SATA_PRESENT MPP(2, 0x1, 0, 0)
22#define MPP_END MPP(0xff, 0xf, 1, 1, 1, 1) 22#define MPP2_UA2_TXD MPP(2, 0x2, 0, 0)
23 23#define MPP2_SDIO0_BUS_POWER MPP(2, 0x3, 0, 0)
24#define MPP_PMU_DRIVE_0 0x1 24#define MPP2_UA_RTSn1 MPP(2, 0x4, 0, 0)
25#define MPP_PMU_DRIVE_1 0x2 25
26#define MPP_PMU_SDI 0x3 26#define MPP3_GPIO3 MPP(3, 0x0, 1, 1)
27#define MPP_PMU_CPU_PWRDWN 0x4 27#define MPP3_SATA_ACT MPP(3, 0x1, 0, 0)
28#define MPP_PMU_STBY_PWRDWN 0x5 28#define MPP3_UA2_RXD MPP(3, 0x2, 0, 0)
29#define MPP_PMU_CORE_PWR_GOOD 0x8 29#define MPP3_SDIO0_LED_CTRL MPP(3, 0x3, 0, 0)
30#define MPP_PMU_BAT_FAULT 0xa 30#define MPP3_UA_CTSn1 MPP(3, 0x4, 0, 0)
31#define MPP_PMU_EXT0_WU 0xb 31#define MPP3_SPI_LCD_CS1 MPP(3, 0xf, 0, 0)
32#define MPP_PMU_EXT1_WU 0xc 32
33#define MPP_PMU_EXT2_WU 0xd 33#define MPP4_GPIO4 MPP(4, 0x0, 1, 1)
34#define MPP_PMU_BLINK 0xe 34#define MPP4_UA3_RTSn MPP(4, 0x2, 0, 0)
35#define MPP_PMU(_num, _mode) MPP((_num), MPP_PMU_##_mode, 1, 0, 0, 0) 35#define MPP4_SDIO1_CD MPP(4, 0x3, 0, 0)
36 36#define MPP4_SPI_1_MISO MPP(4, 0x4, 0, 0)
37#define MPP_PIN(_num, _mode) MPP((_num), (_mode), 0, 0, 0, 0) 37
38#define MPP_GRP(_grp, _mode) MPP((_grp), (_mode), 0, 1, 0, 0) 38#define MPP5_GPIO5 MPP(5, 0x0, 1, 1)
39#define MPP_GRP_AU1(_mode) MPP(0, (_mode), 0, 0, 1, 0) 39#define MPP5_UA3_CTSn MPP(5, 0x2, 0, 0)
40#define MPP_GRP_NFC(_mode) MPP(0, (_mode), 0, 0, 0, 1) 40#define MPP5_SDIO1_WP MPP(5, 0x3, 0, 0)
41 41#define MPP5_SPI_1_CS MPP(5, 0x4, 0, 0)
42#define MPP0_GPIO0 MPP_PIN(0, 0x0) 42
43#define MPP0_UA2_RTSn MPP_PIN(0, 0x2) 43#define MPP6_GPIO6 MPP(6, 0x0, 1, 1)
44#define MPP0_SDIO0_CD MPP_PIN(0, 0x3) 44#define MPP6_UA3_TXD MPP(6, 0x2, 0, 0)
45#define MPP0_LCD0_PWM MPP_PIN(0, 0xf) 45#define MPP6_SDIO1_BUS_POWER MPP(6, 0x3, 0, 0)
46 46#define MPP6_SPI_1_MOSI MPP(6, 0x4, 0, 0)
47#define MPP1_GPIO1 MPP_PIN(1, 0x0) 47
48#define MPP1_UA2_CTSn MPP_PIN(1, 0x2) 48#define MPP7_GPIO7 MPP(7, 0x0, 1, 1)
49#define MPP1_SDIO0_WP MPP_PIN(1, 0x3) 49#define MPP7_UA3_RXD MPP(7, 0x2, 0, 0)
50#define MPP1_LCD1_PWM MPP_PIN(1, 0xf) 50#define MPP7_SDIO1_LED_CTRL MPP(7, 0x3, 0, 0)
51 51#define MPP7_SPI_1_SCK MPP(7, 0x4, 0, 0)
52#define MPP2_GPIO2 MPP_PIN(2, 0x0) 52
53#define MPP2_SATA_PRESENT MPP_PIN(2, 0x1) 53#define MPP8_GPIO8 MPP(8, 0x0, 1, 1)
54#define MPP2_UA2_TXD MPP_PIN(2, 0x2) 54#define MPP8_WD_RST_OUT MPP(8, 0x1, 0, 0)
55#define MPP2_SDIO0_BUS_POWER MPP_PIN(2, 0x3) 55
56#define MPP2_UA_RTSn1 MPP_PIN(2, 0x4) 56#define MPP9_GPIO9 MPP(9, 0x0, 1, 1)
57 57#define MPP9_PEX1_CLKREQn MPP(9, 0x5, 0, 0)
58#define MPP3_GPIO3 MPP_PIN(3, 0x0) 58
59#define MPP3_SATA_ACT MPP_PIN(3, 0x1) 59#define MPP10_GPIO10 MPP(10, 0x0, 1, 1)
60#define MPP3_UA2_RXD MPP_PIN(3, 0x2) 60#define MPP10_SSP_SCLK MPP(10, 0x5, 0, 0)
61#define MPP3_SDIO0_LED_CTRL MPP_PIN(3, 0x3) 61
62#define MPP3_UA_CTSn1 MPP_PIN(3, 0x4) 62#define MPP11_GPIO11 MPP(11, 0x0, 1, 1)
63#define MPP3_SPI_LCD_CS1 MPP_PIN(3, 0xf) 63#define MPP11_SATA_PRESENT MPP(11, 0x1, 0, 0)
64 64#define MPP11_SATA_ACT MPP(11, 0x2, 0, 0)
65#define MPP4_GPIO4 MPP_PIN(4, 0x0) 65#define MPP11_SDIO0_LED_CTRL MPP(11, 0x3, 0, 0)
66#define MPP4_UA3_RTSn MPP_PIN(4, 0x2) 66#define MPP11_SDIO1_LED_CTRL MPP(11, 0x4, 0, 0)
67#define MPP4_SDIO1_CD MPP_PIN(4, 0x3) 67#define MPP11_PEX0_CLKREQn MPP(11, 0x5, 0, 0)
68#define MPP4_SPI_1_MISO MPP_PIN(4, 0x4) 68
69 69#define MPP12_GPIO12 MPP(12, 0x0, 1, 1)
70#define MPP5_GPIO5 MPP_PIN(5, 0x0) 70#define MPP12_SATA_ACT MPP(12, 0x1, 0, 0)
71#define MPP5_UA3_CTSn MPP_PIN(5, 0x2) 71#define MPP12_UA2_RTSn MPP(12, 0x2, 0, 0)
72#define MPP5_SDIO1_WP MPP_PIN(5, 0x3) 72#define MPP12_AD0_I2S_EXT_MCLK MPP(12, 0x3, 0, 0)
73#define MPP5_SPI_1_CS MPP_PIN(5, 0x4) 73#define MPP12_SDIO1_CD MPP(12, 0x4, 0, 0)
74 74
75#define MPP6_GPIO6 MPP_PIN(6, 0x0) 75#define MPP13_GPIO13 MPP(13, 0x0, 1, 1)
76#define MPP6_UA3_TXD MPP_PIN(6, 0x2) 76#define MPP13_UA2_CTSn MPP(13, 0x2, 0, 0)
77#define MPP6_SDIO1_BUS_POWER MPP_PIN(6, 0x3) 77#define MPP13_AD1_I2S_EXT_MCLK MPP(13, 0x3, 0, 0)
78#define MPP6_SPI_1_MOSI MPP_PIN(6, 0x4) 78#define MPP13_SDIO1WP MPP(13, 0x4, 0, 0)
79 79#define MPP13_SSP_EXTCLK MPP(13, 0x5, 0, 0)
80#define MPP7_GPIO7 MPP_PIN(7, 0x0) 80
81#define MPP7_UA3_RXD MPP_PIN(7, 0x2) 81#define MPP14_GPIO14 MPP(14, 0x0, 1, 1)
82#define MPP7_SDIO1_LED_CTRL MPP_PIN(7, 0x3) 82#define MPP14_UA2_TXD MPP(14, 0x2, 0, 0)
83#define MPP7_SPI_1_SCK MPP_PIN(7, 0x4) 83#define MPP14_SDIO1_BUS_POWER MPP(14, 0x4, 0, 0)
84 84#define MPP14_SSP_RXD MPP(14, 0x5, 0, 0)
85#define MPP8_GPIO8 MPP_PIN(8, 0x0) 85
86#define MPP8_WD_RST_OUT MPP_PIN(8, 0x1) 86#define MPP15_GPIO15 MPP(15, 0x0, 1, 1)
87 87#define MPP15_UA2_RXD MPP(15, 0x2, 0, 0)
88#define MPP9_GPIO9 MPP_PIN(9, 0x0) 88#define MPP15_SDIO1_LED_CTRL MPP(15, 0x4, 0, 0)
89#define MPP9_PEX1_CLKREQn MPP_PIN(9, 0x5) 89#define MPP15_SSP_SFRM MPP(15, 0x5, 0, 0)
90 90
91#define MPP10_GPIO10 MPP_PIN(10, 0x0) 91#define MPP16_GPIO16 MPP(16, 0x0, 1, 1)
92#define MPP10_SSP_SCLK MPP_PIN(10, 0x5) 92#define MPP16_UA3_RTSn MPP(16, 0x2, 0, 0)
93 93#define MPP16_SDIO0_CD MPP(16, 0x3, 0, 0)
94#define MPP11_GPIO11 MPP_PIN(11, 0x0) 94#define MPP16_SPI_LCD_CS1 MPP(16, 0x4, 0, 0)
95#define MPP11_SATA_PRESENT MPP_PIN(11, 0x1) 95#define MPP16_AC97_SDATA_IN1 MPP(16, 0x5, 0, 0)
96#define MPP11_SATA_ACT MPP_PIN(11, 0x2) 96
97#define MPP11_SDIO0_LED_CTRL MPP_PIN(11, 0x3) 97#define MPP17_GPIO17 MPP(17, 0x0, 1, 1)
98#define MPP11_SDIO1_LED_CTRL MPP_PIN(11, 0x4) 98#define MPP17_AC97_SYSCLK_OUT MPP(17, 0x1, 0, 0)
99#define MPP11_PEX0_CLKREQn MPP_PIN(11, 0x5) 99#define MPP17_UA3_CTSn MPP(17, 0x2, 0, 0)
100 100#define MPP17_SDIO0_WP MPP(17, 0x3, 0, 0)
101#define MPP12_GPIO12 MPP_PIN(12, 0x0) 101#define MPP17_TW_SDA2 MPP(17, 0x4, 0, 0)
102#define MPP12_SATA_ACT MPP_PIN(12, 0x1) 102#define MPP17_AC97_SDATA_IN2 MPP(17, 0x5, 0, 0)
103#define MPP12_UA2_RTSn MPP_PIN(12, 0x2) 103
104#define MPP12_AD0_I2S_EXT_MCLK MPP_PIN(12, 0x3) 104#define MPP18_GPIO18 MPP(18, 0x0, 1, 1)
105#define MPP12_SDIO1_CD MPP_PIN(12, 0x4) 105#define MPP18_UA3_TXD MPP(18, 0x2, 0, 0)
106 106#define MPP18_SDIO0_BUS_POWER MPP(18, 0x3, 0, 0)
107#define MPP13_GPIO13 MPP_PIN(13, 0x0) 107#define MPP18_LCD0_PWM MPP(18, 0x4, 0, 0)
108#define MPP13_UA2_CTSn MPP_PIN(13, 0x2) 108#define MPP18_AC_SDATA_IN3 MPP(18, 0x5, 0, 0)
109#define MPP13_AD1_I2S_EXT_MCLK MPP_PIN(13, 0x3) 109
110#define MPP13_SDIO1WP MPP_PIN(13, 0x4) 110#define MPP19_GPIO19 MPP(19, 0x0, 1, 1)
111#define MPP13_SSP_EXTCLK MPP_PIN(13, 0x5) 111#define MPP19_UA3_RXD MPP(19, 0x2, 0, 0)
112 112#define MPP19_SDIO0_LED_CTRL MPP(19, 0x3, 0, 0)
113#define MPP14_GPIO14 MPP_PIN(14, 0x0) 113#define MPP19_TW_SCK2 MPP(19, 0x4, 0, 0)
114#define MPP14_UA2_TXD MPP_PIN(14, 0x2) 114
115#define MPP14_SDIO1_BUS_POWER MPP_PIN(14, 0x4) 115#define MPP20_GPIO20 MPP(20, 0x0, 1, 1)
116#define MPP14_SSP_RXD MPP_PIN(14, 0x5) 116#define MPP20_AC97_SYSCLK_OUT MPP(20, 0x1, 0, 0)
117 117#define MPP20_SPI_LCD_MISO MPP(20, 0x2, 0, 0)
118#define MPP15_GPIO15 MPP_PIN(15, 0x0) 118#define MPP20_SDIO1_CD MPP(20, 0x3, 0, 0)
119#define MPP15_UA2_RXD MPP_PIN(15, 0x2) 119#define MPP20_SDIO0_CD MPP(20, 0x5, 0, 0)
120#define MPP15_SDIO1_LED_CTRL MPP_PIN(15, 0x4) 120#define MPP20_SPI_1_MISO MPP(20, 0x6, 0, 0)
121#define MPP15_SSP_SFRM MPP_PIN(15, 0x5) 121
122 122#define MPP21_GPIO21 MPP(21, 0x0, 1, 1)
123#define MPP16_GPIO16 MPP_PIN(16, 0x0) 123#define MPP21_UA1_RTSn MPP(21, 0x1, 0, 0)
124#define MPP16_UA3_RTSn MPP_PIN(16, 0x2) 124#define MPP21_SPI_LCD_CS0 MPP(21, 0x2, 0, 0)
125#define MPP16_SDIO0_CD MPP_PIN(16, 0x3) 125#define MPP21_SDIO1_WP MPP(21, 0x3, 0, 0)
126#define MPP16_SPI_LCD_CS1 MPP_PIN(16, 0x4) 126#define MPP21_SSP_SFRM MPP(21, 0x4, 0, 0)
127#define MPP16_AC97_SDATA_IN1 MPP_PIN(16, 0x5) 127#define MPP21_SDIO0_WP MPP(21, 0x5, 0, 0)
128 128#define MPP21_SPI_1_CS MPP(21, 0x6, 0, 0)
129#define MPP17_GPIO17 MPP_PIN(17, 0x0) 129
130#define MPP17_AC97_SYSCLK_OUT MPP_PIN(17, 0x1) 130#define MPP22_GPIO22 MPP(22, 0x0, 1, 1)
131#define MPP17_UA3_CTSn MPP_PIN(17, 0x2) 131#define MPP22_UA1_CTSn MPP(22, 0x1, 0, 0)
132#define MPP17_SDIO0_WP MPP_PIN(17, 0x3) 132#define MPP22_SPI_LCD_MOSI MPP(22, 0x2, 0, 0)
133#define MPP17_TW_SDA2 MPP_PIN(17, 0x4) 133#define MPP22_SDIO1_BUS_POWER MPP(22, 0x3, 0, 0)
134#define MPP17_AC97_SDATA_IN2 MPP_PIN(17, 0x5) 134#define MPP22_SSP_TXD MPP(22, 0x4, 0, 0)
135 135#define MPP22_SDIO0_BUS_POWER MPP(22, 0x5, 0, 0)
136#define MPP18_GPIO18 MPP_PIN(18, 0x0) 136#define MPP22_SPI_1_MOSI MPP(22, 0x6, 0, 0)
137#define MPP18_UA3_TXD MPP_PIN(18, 0x2) 137
138#define MPP18_SDIO0_BUS_POWER MPP_PIN(18, 0x3) 138#define MPP23_GPIO23 MPP(23, 0x0, 1, 1)
139#define MPP18_LCD0_PWM MPP_PIN(18, 0x4) 139#define MPP23_SPI_LCD_SCK MPP(23, 0x2, 0, 0)
140#define MPP18_AC_SDATA_IN3 MPP_PIN(18, 0x5) 140#define MPP23_SDIO1_LED_CTRL MPP(23, 0x3, 0, 0)
141 141#define MPP23_SSP_SCLK MPP(23, 0x4, 0, 0)
142#define MPP19_GPIO19 MPP_PIN(19, 0x0) 142#define MPP23_SDIO0_LED_CTRL MPP(23, 0x5, 0, 0)
143#define MPP19_UA3_RXD MPP_PIN(19, 0x2) 143#define MPP23_SPI_1_SCK MPP(23, 0x6, 0, 0)
144#define MPP19_SDIO0_LED_CTRL MPP_PIN(19, 0x3) 144
145#define MPP19_TW_SCK2 MPP_PIN(19, 0x4) 145#define MPP_MAX 23
146 146
147#define MPP20_GPIO20 MPP_PIN(20, 0x0) 147#define MPP_GRP(_grp, _mode) MPP((_grp), (_mode), 0, 0)
148#define MPP20_AC97_SYSCLK_OUT MPP_PIN(20, 0x1)
149#define MPP20_SPI_LCD_MISO MPP_PIN(20, 0x2)
150#define MPP20_SDIO1_CD MPP_PIN(20, 0x3)
151#define MPP20_SDIO0_CD MPP_PIN(20, 0x5)
152#define MPP20_SPI_1_MISO MPP_PIN(20, 0x6)
153
154#define MPP21_GPIO21 MPP_PIN(21, 0x0)
155#define MPP21_UA1_RTSn MPP_PIN(21, 0x1)
156#define MPP21_SPI_LCD_CS0 MPP_PIN(21, 0x2)
157#define MPP21_SDIO1_WP MPP_PIN(21, 0x3)
158#define MPP21_SSP_SFRM MPP_PIN(21, 0x4)
159#define MPP21_SDIO0_WP MPP_PIN(21, 0x5)
160#define MPP21_SPI_1_CS MPP_PIN(21, 0x6)
161
162#define MPP22_GPIO22 MPP_PIN(22, 0x0)
163#define MPP22_UA1_CTSn MPP_PIN(22, 0x1)
164#define MPP22_SPI_LCD_MOSI MPP_PIN(22, 0x2)
165#define MPP22_SDIO1_BUS_POWER MPP_PIN(22, 0x3)
166#define MPP22_SSP_TXD MPP_PIN(22, 0x4)
167#define MPP22_SDIO0_BUS_POWER MPP_PIN(22, 0x5)
168#define MPP22_SPI_1_MOSI MPP_PIN(22, 0x6)
169
170#define MPP23_GPIO23 MPP_PIN(23, 0x0)
171#define MPP23_SPI_LCD_SCK MPP_PIN(23, 0x2)
172#define MPP23_SDIO1_LED_CTRL MPP_PIN(23, 0x3)
173#define MPP23_SSP_SCLK MPP_PIN(23, 0x4)
174#define MPP23_SDIO0_LED_CTRL MPP_PIN(23, 0x5)
175#define MPP23_SPI_1_SCK MPP_PIN(23, 0x6)
176 148
177/* for MPP groups _num is a group index */ 149/* for MPP groups _num is a group index */
178enum dove_mpp_grp_idx { 150enum dove_mpp_grp_idx {
@@ -181,40 +153,44 @@ enum dove_mpp_grp_idx {
181 MPP_46_51 = 1, 153 MPP_46_51 = 1,
182 MPP_58_61 = 5, 154 MPP_58_61 = 5,
183 MPP_62_63 = 4, 155 MPP_62_63 = 4,
156 MPP_GRP_MAX = 5,
184}; 157};
185 158
186#define MPP24_39_GPIO MPP_GRP(MPP_24_39, 0x1) 159#define MPP_GRP_24_39_GPIO MPP_GRP(MPP_24_39, 0x1)
187#define MPP24_39_CAM MPP_GRP(MPP_24_39, 0x0) 160#define MPP_GRP_24_39_CAM MPP_GRP(MPP_24_39, 0x0)
188 161
189#define MPP40_45_GPIO MPP_GRP(MPP_40_45, 0x1) 162#define MPP_GRP_40_45_GPIO MPP_GRP(MPP_40_45, 0x1)
190#define MPP40_45_SD0 MPP_GRP(MPP_40_45, 0x0) 163#define MPP_GRP_40_45_SD0 MPP_GRP(MPP_40_45, 0x0)
191 164
192#define MPP46_51_GPIO MPP_GRP(MPP_46_51, 0x1) 165#define MPP_GRP_46_51_GPIO MPP_GRP(MPP_46_51, 0x1)
193#define MPP46_51_SD1 MPP_GRP(MPP_46_51, 0x0) 166#define MPP_GRP_46_51_SD1 MPP_GRP(MPP_46_51, 0x0)
194 167
195#define MPP58_61_GPIO MPP_GRP(MPP_58_61, 0x1) 168#define MPP_GRP_58_61_GPIO MPP_GRP(MPP_58_61, 0x1)
196#define MPP58_61_SPI MPP_GRP(MPP_58_61, 0x0) 169#define MPP_GRP_58_61_SPI MPP_GRP(MPP_58_61, 0x0)
197 170
198#define MPP62_63_GPIO MPP_GRP(MPP_62_63, 0x1) 171#define MPP_GRP_62_63_GPIO MPP_GRP(MPP_62_63, 0x1)
199#define MPP62_63_UA1 MPP_GRP(MPP_62_63, 0x0) 172#define MPP_GRP_62_63_UA1 MPP_GRP(MPP_62_63, 0x0)
200 173
201/* The MPP[64:71] control differs from other groups */ 174/* The MPP[64:71] control differs from other groups */
202#define MPP64_71_GPO MPP_GRP_NFC(0x1) 175#define MPP_GRP_NFC_64_71_GPO 0x1
203#define MPP64_71_NFC MPP_GRP_NFC(0x0) 176#define MPP_GRP_NFC_64_71_NFC 0x0
204 177
205/* 178/*
206 * The MPP[52:57] functionality is encoded by 4 bits in different 179 * The MPP[52:57] functionality is encoded by 4 bits in different
207 * registers. The _num field in this case encodes those bits in 180 * registers. The _num field in this case encodes those bits in
208 * correspodence with Table 135 of 88AP510 Functional specification 181 * correspodence with Table 135 of 88AP510 Functional specification
209 */ 182 */
210#define MPP52_57_AU1 MPP_GRP_AU1(0x0) 183#define MPP_GRP_AU1_52_57_AU1 0x0
211#define MPP52_57_AU1_GPIO57 MPP_GRP_AU1(0x2) 184#define MPP_GRP_AU1_52_57_AU1_GPIO57 0x2
212#define MPP52_57_GPIO MPP_GRP_AU1(0xa) 185#define MPP_GRP_AU1_52_57_GPIO 0xa
213#define MPP52_57_TW_GPIO MPP_GRP_AU1(0xb) 186#define MPP_GRP_AU1_52_57_TW_GPIO 0xb
214#define MPP52_57_AU1_SSP MPP_GRP_AU1(0xc) 187#define MPP_GRP_AU1_52_57_AU1_SSP 0xc
215#define MPP52_57_SSP_GPIO MPP_GRP_AU1(0xe) 188#define MPP_GRP_AU1_52_57_SSP_GPIO 0xe
216#define MPP52_57_SSP_TW MPP_GRP_AU1(0xf) 189#define MPP_GRP_AU1_52_57_SSP_TW 0xf
217 190
218void dove_mpp_conf(unsigned int *mpp_list); 191void dove_mpp_conf(unsigned int *mpp_list,
192 unsigned int *mpp_grp_list,
193 unsigned int grp_au1_52_57,
194 unsigned int grp_nfc_64_71);
219 195
220#endif /* __ARCH_DOVE_MPP_CODED_H */ 196#endif /* __ARCH_DOVE_MPP_CODED_H */
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c
index 180b8a9d0d2..a5a9ff70b19 100644
--- a/arch/arm/mach-ep93xx/gpio.c
+++ b/arch/arm/mach-ep93xx/gpio.c
@@ -101,7 +101,7 @@ static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc)
101static void ep93xx_gpio_f_irq_handler(unsigned int irq, struct irq_desc *desc) 101static void ep93xx_gpio_f_irq_handler(unsigned int irq, struct irq_desc *desc)
102{ 102{
103 /* 103 /*
104 * map discontiguous hw irq range to continous sw irq range: 104 * map discontiguous hw irq range to continuous sw irq range:
105 * 105 *
106 * IRQ_EP93XX_GPIO{0..7}MUX -> gpio_to_irq(EP93XX_GPIO_LINE_F({0..7}) 106 * IRQ_EP93XX_GPIO{0..7}MUX -> gpio_to_irq(EP93XX_GPIO_LINE_F({0..7})
107 */ 107 */
diff --git a/arch/arm/mach-exynos4/include/mach/gpio.h b/arch/arm/mach-exynos4/include/mach/gpio.h
index 939728b38d4..be9266b10fd 100644
--- a/arch/arm/mach-exynos4/include/mach/gpio.h
+++ b/arch/arm/mach-exynos4/include/mach/gpio.h
@@ -18,7 +18,7 @@
18#define gpio_cansleep __gpio_cansleep 18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq 19#define gpio_to_irq __gpio_to_irq
20 20
21/* Practically, GPIO banks upto GPZ are the configurable gpio banks */ 21/* Practically, GPIO banks up to GPZ are the configurable gpio banks */
22 22
23/* GPIO bank sizes */ 23/* GPIO bank sizes */
24#define EXYNOS4_GPIO_A0_NR (8) 24#define EXYNOS4_GPIO_A0_NR (8)
diff --git a/arch/arm/mach-exynos4/irq-combiner.c b/arch/arm/mach-exynos4/irq-combiner.c
index f488b66d680..5a2758ab055 100644
--- a/arch/arm/mach-exynos4/irq-combiner.c
+++ b/arch/arm/mach-exynos4/irq-combiner.c
@@ -59,8 +59,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
59 unsigned int cascade_irq, combiner_irq; 59 unsigned int cascade_irq, combiner_irq;
60 unsigned long status; 60 unsigned long status;
61 61
62 /* primary controller ack'ing */ 62 chained_irq_enter(chip, desc);
63 chip->irq_ack(&desc->irq_data);
64 63
65 spin_lock(&irq_controller_lock); 64 spin_lock(&irq_controller_lock);
66 status = __raw_readl(chip_data->base + COMBINER_INT_STATUS); 65 status = __raw_readl(chip_data->base + COMBINER_INT_STATUS);
@@ -79,8 +78,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
79 generic_handle_irq(cascade_irq); 78 generic_handle_irq(cascade_irq);
80 79
81 out: 80 out:
82 /* primary controller unmasking */ 81 chained_irq_exit(chip, desc);
83 chip->irq_unmask(&desc->irq_data);
84} 82}
85 83
86static struct irq_chip combiner_chip = { 84static struct irq_chip combiner_chip = {
diff --git a/arch/arm/mach-exynos4/mct.c b/arch/arm/mach-exynos4/mct.c
index af82a8fbb68..14ac10b7ec0 100644
--- a/arch/arm/mach-exynos4/mct.c
+++ b/arch/arm/mach-exynos4/mct.c
@@ -276,7 +276,7 @@ static void exynos4_mct_tick_start(unsigned long cycles,
276 /* update interrupt count buffer */ 276 /* update interrupt count buffer */
277 exynos4_mct_write(tmp, mevt->base + MCT_L_ICNTB_OFFSET); 277 exynos4_mct_write(tmp, mevt->base + MCT_L_ICNTB_OFFSET);
278 278
279 /* enable MCT tick interupt */ 279 /* enable MCT tick interrupt */
280 exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); 280 exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET);
281 281
282 tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET); 282 tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET);
diff --git a/arch/arm/mach-exynos4/setup-sdhci-gpio.c b/arch/arm/mach-exynos4/setup-sdhci-gpio.c
index 1b3d3a2de95..e8d08bf8965 100644
--- a/arch/arm/mach-exynos4/setup-sdhci-gpio.c
+++ b/arch/arm/mach-exynos4/setup-sdhci-gpio.c
@@ -38,14 +38,14 @@ void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
38 switch (width) { 38 switch (width) {
39 case 8: 39 case 8:
40 for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) { 40 for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
41 /* Data pin GPK1[3:6] to special-funtion 3 */ 41 /* Data pin GPK1[3:6] to special-function 3 */
42 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); 42 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
43 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); 43 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
44 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); 44 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
45 } 45 }
46 case 4: 46 case 4:
47 for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) { 47 for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) {
48 /* Data pin GPK0[3:6] to special-funtion 2 */ 48 /* Data pin GPK0[3:6] to special-function 2 */
49 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); 49 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
50 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); 50 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
51 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); 51 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
diff --git a/arch/arm/mach-exynos4/setup-sdhci.c b/arch/arm/mach-exynos4/setup-sdhci.c
index 85f9433d483..1e83f8cf236 100644
--- a/arch/arm/mach-exynos4/setup-sdhci.c
+++ b/arch/arm/mach-exynos4/setup-sdhci.c
@@ -35,7 +35,7 @@ void exynos4_setup_sdhci_cfg_card(struct platform_device *dev, void __iomem *r,
35{ 35{
36 u32 ctrl2, ctrl3; 36 u32 ctrl2, ctrl3;
37 37
38 /* don't need to alter anything acording to card-type */ 38 /* don't need to alter anything according to card-type */
39 39
40 ctrl2 = readl(r + S3C_SDHCI_CONTROL2); 40 ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
41 41
diff --git a/arch/arm/mach-gemini/include/mach/uncompress.h b/arch/arm/mach-gemini/include/mach/uncompress.h
index 5483f61a806..0efa2624723 100644
--- a/arch/arm/mach-gemini/include/mach/uncompress.h
+++ b/arch/arm/mach-gemini/include/mach/uncompress.h
@@ -16,7 +16,7 @@
16#include <linux/serial_reg.h> 16#include <linux/serial_reg.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18 18
19static volatile unsigned long *UART = (unsigned long *)GEMINI_UART_BASE; 19static volatile unsigned long * const UART = (unsigned long *)GEMINI_UART_BASE;
20 20
21/* 21/*
22 * The following code assumes the serial port has already been 22 * The following code assumes the serial port has already been
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 773ea0c95b9..ba3dae352a2 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -225,7 +225,7 @@ static u32 iop13xx_atue_cfg_address(struct pci_bus *bus, int devfn, int where)
225/* This routine checks the status of the last configuration cycle. If an error 225/* This routine checks the status of the last configuration cycle. If an error
226 * was detected it returns >0, else it returns a 0. The errors being checked 226 * was detected it returns >0, else it returns a 0. The errors being checked
227 * are parity, master abort, target abort (master and target). These types of 227 * are parity, master abort, target abort (master and target). These types of
228 * errors occure during a config cycle where there is no device, like during 228 * errors occur during a config cycle where there is no device, like during
229 * the discovery stage. 229 * the discovery stage.
230 */ 230 */
231static int iop13xx_atux_pci_status(int clear) 231static int iop13xx_atux_pci_status(int clear)
@@ -332,7 +332,7 @@ static struct pci_ops iop13xx_atux_ops = {
332/* This routine checks the status of the last configuration cycle. If an error 332/* This routine checks the status of the last configuration cycle. If an error
333 * was detected it returns >0, else it returns a 0. The errors being checked 333 * was detected it returns >0, else it returns a 0. The errors being checked
334 * are parity, master abort, target abort (master and target). These types of 334 * are parity, master abort, target abort (master and target). These types of
335 * errors occure during a config cycle where there is no device, like during 335 * errors occur during a config cycle where there is no device, like during
336 * the discovery stage. 336 * the discovery stage.
337 */ 337 */
338static int iop13xx_atue_pci_status(int clear) 338static int iop13xx_atue_pci_status(int clear)
diff --git a/arch/arm/mach-iop32x/include/mach/uncompress.h b/arch/arm/mach-iop32x/include/mach/uncompress.h
index b247551b6f5..4fd715496f4 100644
--- a/arch/arm/mach-iop32x/include/mach/uncompress.h
+++ b/arch/arm/mach-iop32x/include/mach/uncompress.h
@@ -7,7 +7,7 @@
7#include <linux/serial_reg.h> 7#include <linux/serial_reg.h>
8#include <mach/hardware.h> 8#include <mach/hardware.h>
9 9
10static volatile u8 *uart_base; 10volatile u8 *uart_base;
11 11
12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE) 12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
13 13
diff --git a/arch/arm/mach-iop33x/include/mach/uncompress.h b/arch/arm/mach-iop33x/include/mach/uncompress.h
index b42423f6330..f99bb848c5a 100644
--- a/arch/arm/mach-iop33x/include/mach/uncompress.h
+++ b/arch/arm/mach-iop33x/include/mach/uncompress.h
@@ -7,7 +7,7 @@
7#include <linux/serial_reg.h> 7#include <linux/serial_reg.h>
8#include <mach/hardware.h> 8#include <mach/hardware.h>
9 9
10static volatile u32 *uart_base; 10volatile u32 *uart_base;
11 11
12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE) 12#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
13 13
diff --git a/arch/arm/mach-ixp4xx/include/mach/uncompress.h b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
index 2db0078a8cf..219d7c1dcdb 100644
--- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h
+++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h
@@ -19,7 +19,7 @@
19 19
20#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE) 20#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
21 21
22static volatile u32* uart_base; 22volatile u32* uart_base;
23 23
24static inline void putc(int c) 24static inline void putc(int c)
25{ 25{
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 20e71df3e3b..f3248cfbe51 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -13,11 +13,9 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h>
18#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
19#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
20#include <linux/spi/orion_spi.h> 18#include <linux/dma-mapping.h>
21#include <net/dsa.h> 19#include <net/dsa.h>
22#include <asm/page.h> 20#include <asm/page.h>
23#include <asm/timex.h> 21#include <asm/timex.h>
@@ -28,11 +26,9 @@
28#include <mach/bridge-regs.h> 26#include <mach/bridge-regs.h>
29#include <plat/audio.h> 27#include <plat/audio.h>
30#include <plat/cache-feroceon-l2.h> 28#include <plat/cache-feroceon-l2.h>
31#include <plat/ehci-orion.h>
32#include <plat/mvsdio.h> 29#include <plat/mvsdio.h>
33#include <plat/mv_xor.h>
34#include <plat/orion_nand.h> 30#include <plat/orion_nand.h>
35#include <plat/orion_wdt.h> 31#include <plat/common.h>
36#include <plat/time.h> 32#include <plat/time.h>
37#include "common.h" 33#include "common.h"
38 34
@@ -69,210 +65,52 @@ void __init kirkwood_map_io(void)
69 * registered. Some reserved bits must be set to 1. 65 * registered. Some reserved bits must be set to 1.
70 */ 66 */
71unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; 67unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED;
72
73
74/*****************************************************************************
75 * EHCI
76 ****************************************************************************/
77static struct orion_ehci_data kirkwood_ehci_data = {
78 .dram = &kirkwood_mbus_dram_info,
79 .phy_version = EHCI_PHY_NA,
80};
81
82static u64 ehci_dmamask = 0xffffffffUL;
83 68
84 69
85/***************************************************************************** 70/*****************************************************************************
86 * EHCI0 71 * EHCI0
87 ****************************************************************************/ 72 ****************************************************************************/
88static struct resource kirkwood_ehci_resources[] = {
89 {
90 .start = USB_PHYS_BASE,
91 .end = USB_PHYS_BASE + 0x0fff,
92 .flags = IORESOURCE_MEM,
93 }, {
94 .start = IRQ_KIRKWOOD_USB,
95 .end = IRQ_KIRKWOOD_USB,
96 .flags = IORESOURCE_IRQ,
97 },
98};
99
100static struct platform_device kirkwood_ehci = {
101 .name = "orion-ehci",
102 .id = 0,
103 .dev = {
104 .dma_mask = &ehci_dmamask,
105 .coherent_dma_mask = 0xffffffff,
106 .platform_data = &kirkwood_ehci_data,
107 },
108 .resource = kirkwood_ehci_resources,
109 .num_resources = ARRAY_SIZE(kirkwood_ehci_resources),
110};
111
112void __init kirkwood_ehci_init(void) 73void __init kirkwood_ehci_init(void)
113{ 74{
114 kirkwood_clk_ctrl |= CGC_USB0; 75 kirkwood_clk_ctrl |= CGC_USB0;
115 platform_device_register(&kirkwood_ehci); 76 orion_ehci_init(&kirkwood_mbus_dram_info,
77 USB_PHYS_BASE, IRQ_KIRKWOOD_USB);
116} 78}
117 79
118 80
119/***************************************************************************** 81/*****************************************************************************
120 * GE00 82 * GE00
121 ****************************************************************************/ 83 ****************************************************************************/
122struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = {
123 .dram = &kirkwood_mbus_dram_info,
124};
125
126static struct resource kirkwood_ge00_shared_resources[] = {
127 {
128 .name = "ge00 base",
129 .start = GE00_PHYS_BASE + 0x2000,
130 .end = GE00_PHYS_BASE + 0x3fff,
131 .flags = IORESOURCE_MEM,
132 }, {
133 .name = "ge00 err irq",
134 .start = IRQ_KIRKWOOD_GE00_ERR,
135 .end = IRQ_KIRKWOOD_GE00_ERR,
136 .flags = IORESOURCE_IRQ,
137 },
138};
139
140static struct platform_device kirkwood_ge00_shared = {
141 .name = MV643XX_ETH_SHARED_NAME,
142 .id = 0,
143 .dev = {
144 .platform_data = &kirkwood_ge00_shared_data,
145 },
146 .num_resources = ARRAY_SIZE(kirkwood_ge00_shared_resources),
147 .resource = kirkwood_ge00_shared_resources,
148};
149
150static struct resource kirkwood_ge00_resources[] = {
151 {
152 .name = "ge00 irq",
153 .start = IRQ_KIRKWOOD_GE00_SUM,
154 .end = IRQ_KIRKWOOD_GE00_SUM,
155 .flags = IORESOURCE_IRQ,
156 },
157};
158
159static struct platform_device kirkwood_ge00 = {
160 .name = MV643XX_ETH_NAME,
161 .id = 0,
162 .num_resources = 1,
163 .resource = kirkwood_ge00_resources,
164 .dev = {
165 .coherent_dma_mask = 0xffffffff,
166 },
167};
168
169void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) 84void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
170{ 85{
171 kirkwood_clk_ctrl |= CGC_GE0; 86 kirkwood_clk_ctrl |= CGC_GE0;
172 eth_data->shared = &kirkwood_ge00_shared;
173 kirkwood_ge00.dev.platform_data = eth_data;
174 87
175 platform_device_register(&kirkwood_ge00_shared); 88 orion_ge00_init(eth_data, &kirkwood_mbus_dram_info,
176 platform_device_register(&kirkwood_ge00); 89 GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
90 IRQ_KIRKWOOD_GE00_ERR, kirkwood_tclk);
177} 91}
178 92
179 93
180/***************************************************************************** 94/*****************************************************************************
181 * GE01 95 * GE01
182 ****************************************************************************/ 96 ****************************************************************************/
183struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = {
184 .dram = &kirkwood_mbus_dram_info,
185 .shared_smi = &kirkwood_ge00_shared,
186};
187
188static struct resource kirkwood_ge01_shared_resources[] = {
189 {
190 .name = "ge01 base",
191 .start = GE01_PHYS_BASE + 0x2000,
192 .end = GE01_PHYS_BASE + 0x3fff,
193 .flags = IORESOURCE_MEM,
194 }, {
195 .name = "ge01 err irq",
196 .start = IRQ_KIRKWOOD_GE01_ERR,
197 .end = IRQ_KIRKWOOD_GE01_ERR,
198 .flags = IORESOURCE_IRQ,
199 },
200};
201
202static struct platform_device kirkwood_ge01_shared = {
203 .name = MV643XX_ETH_SHARED_NAME,
204 .id = 1,
205 .dev = {
206 .platform_data = &kirkwood_ge01_shared_data,
207 },
208 .num_resources = ARRAY_SIZE(kirkwood_ge01_shared_resources),
209 .resource = kirkwood_ge01_shared_resources,
210};
211
212static struct resource kirkwood_ge01_resources[] = {
213 {
214 .name = "ge01 irq",
215 .start = IRQ_KIRKWOOD_GE01_SUM,
216 .end = IRQ_KIRKWOOD_GE01_SUM,
217 .flags = IORESOURCE_IRQ,
218 },
219};
220
221static struct platform_device kirkwood_ge01 = {
222 .name = MV643XX_ETH_NAME,
223 .id = 1,
224 .num_resources = 1,
225 .resource = kirkwood_ge01_resources,
226 .dev = {
227 .coherent_dma_mask = 0xffffffff,
228 },
229};
230
231void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) 97void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
232{ 98{
99
233 kirkwood_clk_ctrl |= CGC_GE1; 100 kirkwood_clk_ctrl |= CGC_GE1;
234 eth_data->shared = &kirkwood_ge01_shared;
235 kirkwood_ge01.dev.platform_data = eth_data;
236 101
237 platform_device_register(&kirkwood_ge01_shared); 102 orion_ge01_init(eth_data, &kirkwood_mbus_dram_info,
238 platform_device_register(&kirkwood_ge01); 103 GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
104 IRQ_KIRKWOOD_GE01_ERR, kirkwood_tclk);
239} 105}
240 106
241 107
242/***************************************************************************** 108/*****************************************************************************
243 * Ethernet switch 109 * Ethernet switch
244 ****************************************************************************/ 110 ****************************************************************************/
245static struct resource kirkwood_switch_resources[] = {
246 {
247 .start = 0,
248 .end = 0,
249 .flags = IORESOURCE_IRQ,
250 },
251};
252
253static struct platform_device kirkwood_switch_device = {
254 .name = "dsa",
255 .id = 0,
256 .num_resources = 0,
257 .resource = kirkwood_switch_resources,
258};
259
260void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) 111void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
261{ 112{
262 int i; 113 orion_ge00_switch_init(d, irq);
263
264 if (irq != NO_IRQ) {
265 kirkwood_switch_resources[0].start = irq;
266 kirkwood_switch_resources[0].end = irq;
267 kirkwood_switch_device.num_resources = 1;
268 }
269
270 d->netdev = &kirkwood_ge00.dev;
271 for (i = 0; i < d->nr_chips; i++)
272 d->chip[i].mii_bus = &kirkwood_ge00_shared.dev;
273 kirkwood_switch_device.dev.platform_data = d;
274
275 platform_device_register(&kirkwood_switch_device);
276} 114}
277 115
278 116
@@ -325,53 +163,23 @@ void __init kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
325/***************************************************************************** 163/*****************************************************************************
326 * SoC RTC 164 * SoC RTC
327 ****************************************************************************/ 165 ****************************************************************************/
328static struct resource kirkwood_rtc_resource = {
329 .start = RTC_PHYS_BASE,
330 .end = RTC_PHYS_BASE + SZ_16 - 1,
331 .flags = IORESOURCE_MEM,
332};
333
334static void __init kirkwood_rtc_init(void) 166static void __init kirkwood_rtc_init(void)
335{ 167{
336 platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1); 168 orion_rtc_init(RTC_PHYS_BASE, IRQ_KIRKWOOD_RTC);
337} 169}
338 170
339 171
340/***************************************************************************** 172/*****************************************************************************
341 * SATA 173 * SATA
342 ****************************************************************************/ 174 ****************************************************************************/
343static struct resource kirkwood_sata_resources[] = {
344 {
345 .name = "sata base",
346 .start = SATA_PHYS_BASE,
347 .end = SATA_PHYS_BASE + 0x5000 - 1,
348 .flags = IORESOURCE_MEM,
349 }, {
350 .name = "sata irq",
351 .start = IRQ_KIRKWOOD_SATA,
352 .end = IRQ_KIRKWOOD_SATA,
353 .flags = IORESOURCE_IRQ,
354 },
355};
356
357static struct platform_device kirkwood_sata = {
358 .name = "sata_mv",
359 .id = 0,
360 .dev = {
361 .coherent_dma_mask = 0xffffffff,
362 },
363 .num_resources = ARRAY_SIZE(kirkwood_sata_resources),
364 .resource = kirkwood_sata_resources,
365};
366
367void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) 175void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
368{ 176{
369 kirkwood_clk_ctrl |= CGC_SATA0; 177 kirkwood_clk_ctrl |= CGC_SATA0;
370 if (sata_data->n_ports > 1) 178 if (sata_data->n_ports > 1)
371 kirkwood_clk_ctrl |= CGC_SATA1; 179 kirkwood_clk_ctrl |= CGC_SATA1;
372 sata_data->dram = &kirkwood_mbus_dram_info; 180
373 kirkwood_sata.dev.platform_data = sata_data; 181 orion_sata_init(sata_data, &kirkwood_mbus_dram_info,
374 platform_device_register(&kirkwood_sata); 182 SATA_PHYS_BASE, IRQ_KIRKWOOD_SATA);
375} 183}
376 184
377 185
@@ -391,14 +199,14 @@ static struct resource mvsdio_resources[] = {
391 }, 199 },
392}; 200};
393 201
394static u64 mvsdio_dmamask = 0xffffffffUL; 202static u64 mvsdio_dmamask = DMA_BIT_MASK(32);
395 203
396static struct platform_device kirkwood_sdio = { 204static struct platform_device kirkwood_sdio = {
397 .name = "mvsdio", 205 .name = "mvsdio",
398 .id = -1, 206 .id = -1,
399 .dev = { 207 .dev = {
400 .dma_mask = &mvsdio_dmamask, 208 .dma_mask = &mvsdio_dmamask,
401 .coherent_dma_mask = 0xffffffff, 209 .coherent_dma_mask = DMA_BIT_MASK(32),
402 }, 210 },
403 .num_resources = ARRAY_SIZE(mvsdio_resources), 211 .num_resources = ARRAY_SIZE(mvsdio_resources),
404 .resource = mvsdio_resources, 212 .resource = mvsdio_resources,
@@ -423,424 +231,84 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
423/***************************************************************************** 231/*****************************************************************************
424 * SPI 232 * SPI
425 ****************************************************************************/ 233 ****************************************************************************/
426static struct orion_spi_info kirkwood_spi_plat_data = {
427};
428
429static struct resource kirkwood_spi_resources[] = {
430 {
431 .start = SPI_PHYS_BASE,
432 .end = SPI_PHYS_BASE + SZ_512 - 1,
433 .flags = IORESOURCE_MEM,
434 },
435};
436
437static struct platform_device kirkwood_spi = {
438 .name = "orion_spi",
439 .id = 0,
440 .resource = kirkwood_spi_resources,
441 .dev = {
442 .platform_data = &kirkwood_spi_plat_data,
443 },
444 .num_resources = ARRAY_SIZE(kirkwood_spi_resources),
445};
446
447void __init kirkwood_spi_init() 234void __init kirkwood_spi_init()
448{ 235{
449 kirkwood_clk_ctrl |= CGC_RUNIT; 236 kirkwood_clk_ctrl |= CGC_RUNIT;
450 platform_device_register(&kirkwood_spi); 237 orion_spi_init(SPI_PHYS_BASE, kirkwood_tclk);
451} 238}
452 239
453 240
454/***************************************************************************** 241/*****************************************************************************
455 * I2C 242 * I2C
456 ****************************************************************************/ 243 ****************************************************************************/
457static struct mv64xxx_i2c_pdata kirkwood_i2c_pdata = {
458 .freq_m = 8, /* assumes 166 MHz TCLK */
459 .freq_n = 3,
460 .timeout = 1000, /* Default timeout of 1 second */
461};
462
463static struct resource kirkwood_i2c_resources[] = {
464 {
465 .start = I2C_PHYS_BASE,
466 .end = I2C_PHYS_BASE + 0x1f,
467 .flags = IORESOURCE_MEM,
468 }, {
469 .start = IRQ_KIRKWOOD_TWSI,
470 .end = IRQ_KIRKWOOD_TWSI,
471 .flags = IORESOURCE_IRQ,
472 },
473};
474
475static struct platform_device kirkwood_i2c = {
476 .name = MV64XXX_I2C_CTLR_NAME,
477 .id = 0,
478 .num_resources = ARRAY_SIZE(kirkwood_i2c_resources),
479 .resource = kirkwood_i2c_resources,
480 .dev = {
481 .platform_data = &kirkwood_i2c_pdata,
482 },
483};
484
485void __init kirkwood_i2c_init(void) 244void __init kirkwood_i2c_init(void)
486{ 245{
487 platform_device_register(&kirkwood_i2c); 246 orion_i2c_init(I2C_PHYS_BASE, IRQ_KIRKWOOD_TWSI, 8);
488} 247}
489 248
490 249
491/***************************************************************************** 250/*****************************************************************************
492 * UART0 251 * UART0
493 ****************************************************************************/ 252 ****************************************************************************/
494static struct plat_serial8250_port kirkwood_uart0_data[] = {
495 {
496 .mapbase = UART0_PHYS_BASE,
497 .membase = (char *)UART0_VIRT_BASE,
498 .irq = IRQ_KIRKWOOD_UART_0,
499 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
500 .iotype = UPIO_MEM,
501 .regshift = 2,
502 .uartclk = 0,
503 }, {
504 },
505};
506
507static struct resource kirkwood_uart0_resources[] = {
508 {
509 .start = UART0_PHYS_BASE,
510 .end = UART0_PHYS_BASE + 0xff,
511 .flags = IORESOURCE_MEM,
512 }, {
513 .start = IRQ_KIRKWOOD_UART_0,
514 .end = IRQ_KIRKWOOD_UART_0,
515 .flags = IORESOURCE_IRQ,
516 },
517};
518
519static struct platform_device kirkwood_uart0 = {
520 .name = "serial8250",
521 .id = 0,
522 .dev = {
523 .platform_data = kirkwood_uart0_data,
524 },
525 .resource = kirkwood_uart0_resources,
526 .num_resources = ARRAY_SIZE(kirkwood_uart0_resources),
527};
528 253
529void __init kirkwood_uart0_init(void) 254void __init kirkwood_uart0_init(void)
530{ 255{
531 platform_device_register(&kirkwood_uart0); 256 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
257 IRQ_KIRKWOOD_UART_0, kirkwood_tclk);
532} 258}
533 259
534 260
535/***************************************************************************** 261/*****************************************************************************
536 * UART1 262 * UART1
537 ****************************************************************************/ 263 ****************************************************************************/
538static struct plat_serial8250_port kirkwood_uart1_data[] = {
539 {
540 .mapbase = UART1_PHYS_BASE,
541 .membase = (char *)UART1_VIRT_BASE,
542 .irq = IRQ_KIRKWOOD_UART_1,
543 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
544 .iotype = UPIO_MEM,
545 .regshift = 2,
546 .uartclk = 0,
547 }, {
548 },
549};
550
551static struct resource kirkwood_uart1_resources[] = {
552 {
553 .start = UART1_PHYS_BASE,
554 .end = UART1_PHYS_BASE + 0xff,
555 .flags = IORESOURCE_MEM,
556 }, {
557 .start = IRQ_KIRKWOOD_UART_1,
558 .end = IRQ_KIRKWOOD_UART_1,
559 .flags = IORESOURCE_IRQ,
560 },
561};
562
563static struct platform_device kirkwood_uart1 = {
564 .name = "serial8250",
565 .id = 1,
566 .dev = {
567 .platform_data = kirkwood_uart1_data,
568 },
569 .resource = kirkwood_uart1_resources,
570 .num_resources = ARRAY_SIZE(kirkwood_uart1_resources),
571};
572
573void __init kirkwood_uart1_init(void) 264void __init kirkwood_uart1_init(void)
574{ 265{
575 platform_device_register(&kirkwood_uart1); 266 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
267 IRQ_KIRKWOOD_UART_1, kirkwood_tclk);
576} 268}
577 269
578
579/***************************************************************************** 270/*****************************************************************************
580 * Cryptographic Engines and Security Accelerator (CESA) 271 * Cryptographic Engines and Security Accelerator (CESA)
581 ****************************************************************************/ 272 ****************************************************************************/
582
583static struct resource kirkwood_crypto_res[] = {
584 {
585 .name = "regs",
586 .start = CRYPTO_PHYS_BASE,
587 .end = CRYPTO_PHYS_BASE + 0xffff,
588 .flags = IORESOURCE_MEM,
589 }, {
590 .name = "sram",
591 .start = KIRKWOOD_SRAM_PHYS_BASE,
592 .end = KIRKWOOD_SRAM_PHYS_BASE + KIRKWOOD_SRAM_SIZE - 1,
593 .flags = IORESOURCE_MEM,
594 }, {
595 .name = "crypto interrupt",
596 .start = IRQ_KIRKWOOD_CRYPTO,
597 .end = IRQ_KIRKWOOD_CRYPTO,
598 .flags = IORESOURCE_IRQ,
599 },
600};
601
602static struct platform_device kirkwood_crypto_device = {
603 .name = "mv_crypto",
604 .id = -1,
605 .num_resources = ARRAY_SIZE(kirkwood_crypto_res),
606 .resource = kirkwood_crypto_res,
607};
608
609void __init kirkwood_crypto_init(void) 273void __init kirkwood_crypto_init(void)
610{ 274{
611 kirkwood_clk_ctrl |= CGC_CRYPTO; 275 kirkwood_clk_ctrl |= CGC_CRYPTO;
612 platform_device_register(&kirkwood_crypto_device); 276 orion_crypto_init(CRYPTO_PHYS_BASE, KIRKWOOD_SRAM_PHYS_BASE,
277 KIRKWOOD_SRAM_SIZE, IRQ_KIRKWOOD_CRYPTO);
613} 278}
614 279
615 280
616/***************************************************************************** 281/*****************************************************************************
617 * XOR
618 ****************************************************************************/
619static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = {
620 .dram = &kirkwood_mbus_dram_info,
621};
622
623static u64 kirkwood_xor_dmamask = DMA_BIT_MASK(32);
624
625
626/*****************************************************************************
627 * XOR0 282 * XOR0
628 ****************************************************************************/ 283 ****************************************************************************/
629static struct resource kirkwood_xor0_shared_resources[] = {
630 {
631 .name = "xor 0 low",
632 .start = XOR0_PHYS_BASE,
633 .end = XOR0_PHYS_BASE + 0xff,
634 .flags = IORESOURCE_MEM,
635 }, {
636 .name = "xor 0 high",
637 .start = XOR0_HIGH_PHYS_BASE,
638 .end = XOR0_HIGH_PHYS_BASE + 0xff,
639 .flags = IORESOURCE_MEM,
640 },
641};
642
643static struct platform_device kirkwood_xor0_shared = {
644 .name = MV_XOR_SHARED_NAME,
645 .id = 0,
646 .dev = {
647 .platform_data = &kirkwood_xor_shared_data,
648 },
649 .num_resources = ARRAY_SIZE(kirkwood_xor0_shared_resources),
650 .resource = kirkwood_xor0_shared_resources,
651};
652
653static struct resource kirkwood_xor00_resources[] = {
654 [0] = {
655 .start = IRQ_KIRKWOOD_XOR_00,
656 .end = IRQ_KIRKWOOD_XOR_00,
657 .flags = IORESOURCE_IRQ,
658 },
659};
660
661static struct mv_xor_platform_data kirkwood_xor00_data = {
662 .shared = &kirkwood_xor0_shared,
663 .hw_id = 0,
664 .pool_size = PAGE_SIZE,
665};
666
667static struct platform_device kirkwood_xor00_channel = {
668 .name = MV_XOR_NAME,
669 .id = 0,
670 .num_resources = ARRAY_SIZE(kirkwood_xor00_resources),
671 .resource = kirkwood_xor00_resources,
672 .dev = {
673 .dma_mask = &kirkwood_xor_dmamask,
674 .coherent_dma_mask = DMA_BIT_MASK(64),
675 .platform_data = &kirkwood_xor00_data,
676 },
677};
678
679static struct resource kirkwood_xor01_resources[] = {
680 [0] = {
681 .start = IRQ_KIRKWOOD_XOR_01,
682 .end = IRQ_KIRKWOOD_XOR_01,
683 .flags = IORESOURCE_IRQ,
684 },
685};
686
687static struct mv_xor_platform_data kirkwood_xor01_data = {
688 .shared = &kirkwood_xor0_shared,
689 .hw_id = 1,
690 .pool_size = PAGE_SIZE,
691};
692
693static struct platform_device kirkwood_xor01_channel = {
694 .name = MV_XOR_NAME,
695 .id = 1,
696 .num_resources = ARRAY_SIZE(kirkwood_xor01_resources),
697 .resource = kirkwood_xor01_resources,
698 .dev = {
699 .dma_mask = &kirkwood_xor_dmamask,
700 .coherent_dma_mask = DMA_BIT_MASK(64),
701 .platform_data = &kirkwood_xor01_data,
702 },
703};
704
705static void __init kirkwood_xor0_init(void) 284static void __init kirkwood_xor0_init(void)
706{ 285{
707 kirkwood_clk_ctrl |= CGC_XOR0; 286 kirkwood_clk_ctrl |= CGC_XOR0;
708 platform_device_register(&kirkwood_xor0_shared);
709 287
710 /* 288 orion_xor0_init(&kirkwood_mbus_dram_info,
711 * two engines can't do memset simultaneously, this limitation 289 XOR0_PHYS_BASE, XOR0_HIGH_PHYS_BASE,
712 * satisfied by removing memset support from one of the engines. 290 IRQ_KIRKWOOD_XOR_00, IRQ_KIRKWOOD_XOR_01);
713 */
714 dma_cap_set(DMA_MEMCPY, kirkwood_xor00_data.cap_mask);
715 dma_cap_set(DMA_XOR, kirkwood_xor00_data.cap_mask);
716 platform_device_register(&kirkwood_xor00_channel);
717
718 dma_cap_set(DMA_MEMCPY, kirkwood_xor01_data.cap_mask);
719 dma_cap_set(DMA_MEMSET, kirkwood_xor01_data.cap_mask);
720 dma_cap_set(DMA_XOR, kirkwood_xor01_data.cap_mask);
721 platform_device_register(&kirkwood_xor01_channel);
722} 291}
723 292
724 293
725/***************************************************************************** 294/*****************************************************************************
726 * XOR1 295 * XOR1
727 ****************************************************************************/ 296 ****************************************************************************/
728static struct resource kirkwood_xor1_shared_resources[] = {
729 {
730 .name = "xor 1 low",
731 .start = XOR1_PHYS_BASE,
732 .end = XOR1_PHYS_BASE + 0xff,
733 .flags = IORESOURCE_MEM,
734 }, {
735 .name = "xor 1 high",
736 .start = XOR1_HIGH_PHYS_BASE,
737 .end = XOR1_HIGH_PHYS_BASE + 0xff,
738 .flags = IORESOURCE_MEM,
739 },
740};
741
742static struct platform_device kirkwood_xor1_shared = {
743 .name = MV_XOR_SHARED_NAME,
744 .id = 1,
745 .dev = {
746 .platform_data = &kirkwood_xor_shared_data,
747 },
748 .num_resources = ARRAY_SIZE(kirkwood_xor1_shared_resources),
749 .resource = kirkwood_xor1_shared_resources,
750};
751
752static struct resource kirkwood_xor10_resources[] = {
753 [0] = {
754 .start = IRQ_KIRKWOOD_XOR_10,
755 .end = IRQ_KIRKWOOD_XOR_10,
756 .flags = IORESOURCE_IRQ,
757 },
758};
759
760static struct mv_xor_platform_data kirkwood_xor10_data = {
761 .shared = &kirkwood_xor1_shared,
762 .hw_id = 0,
763 .pool_size = PAGE_SIZE,
764};
765
766static struct platform_device kirkwood_xor10_channel = {
767 .name = MV_XOR_NAME,
768 .id = 2,
769 .num_resources = ARRAY_SIZE(kirkwood_xor10_resources),
770 .resource = kirkwood_xor10_resources,
771 .dev = {
772 .dma_mask = &kirkwood_xor_dmamask,
773 .coherent_dma_mask = DMA_BIT_MASK(64),
774 .platform_data = &kirkwood_xor10_data,
775 },
776};
777
778static struct resource kirkwood_xor11_resources[] = {
779 [0] = {
780 .start = IRQ_KIRKWOOD_XOR_11,
781 .end = IRQ_KIRKWOOD_XOR_11,
782 .flags = IORESOURCE_IRQ,
783 },
784};
785
786static struct mv_xor_platform_data kirkwood_xor11_data = {
787 .shared = &kirkwood_xor1_shared,
788 .hw_id = 1,
789 .pool_size = PAGE_SIZE,
790};
791
792static struct platform_device kirkwood_xor11_channel = {
793 .name = MV_XOR_NAME,
794 .id = 3,
795 .num_resources = ARRAY_SIZE(kirkwood_xor11_resources),
796 .resource = kirkwood_xor11_resources,
797 .dev = {
798 .dma_mask = &kirkwood_xor_dmamask,
799 .coherent_dma_mask = DMA_BIT_MASK(64),
800 .platform_data = &kirkwood_xor11_data,
801 },
802};
803
804static void __init kirkwood_xor1_init(void) 297static void __init kirkwood_xor1_init(void)
805{ 298{
806 kirkwood_clk_ctrl |= CGC_XOR1; 299 kirkwood_clk_ctrl |= CGC_XOR1;
807 platform_device_register(&kirkwood_xor1_shared);
808 300
809 /* 301 orion_xor1_init(XOR1_PHYS_BASE, XOR1_HIGH_PHYS_BASE,
810 * two engines can't do memset simultaneously, this limitation 302 IRQ_KIRKWOOD_XOR_10, IRQ_KIRKWOOD_XOR_11);
811 * satisfied by removing memset support from one of the engines.
812 */
813 dma_cap_set(DMA_MEMCPY, kirkwood_xor10_data.cap_mask);
814 dma_cap_set(DMA_XOR, kirkwood_xor10_data.cap_mask);
815 platform_device_register(&kirkwood_xor10_channel);
816
817 dma_cap_set(DMA_MEMCPY, kirkwood_xor11_data.cap_mask);
818 dma_cap_set(DMA_MEMSET, kirkwood_xor11_data.cap_mask);
819 dma_cap_set(DMA_XOR, kirkwood_xor11_data.cap_mask);
820 platform_device_register(&kirkwood_xor11_channel);
821} 303}
822 304
823 305
824/***************************************************************************** 306/*****************************************************************************
825 * Watchdog 307 * Watchdog
826 ****************************************************************************/ 308 ****************************************************************************/
827static struct orion_wdt_platform_data kirkwood_wdt_data = {
828 .tclk = 0,
829};
830
831static struct platform_device kirkwood_wdt_device = {
832 .name = "orion_wdt",
833 .id = -1,
834 .dev = {
835 .platform_data = &kirkwood_wdt_data,
836 },
837 .num_resources = 0,
838};
839
840static void __init kirkwood_wdt_init(void) 309static void __init kirkwood_wdt_init(void)
841{ 310{
842 kirkwood_wdt_data.tclk = kirkwood_tclk; 311 orion_wdt_init(kirkwood_tclk);
843 platform_device_register(&kirkwood_wdt_device);
844} 312}
845 313
846 314
@@ -984,11 +452,6 @@ void __init kirkwood_init(void)
984{ 452{
985 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", 453 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
986 kirkwood_id(), kirkwood_tclk); 454 kirkwood_id(), kirkwood_tclk);
987 kirkwood_ge00_shared_data.t_clk = kirkwood_tclk;
988 kirkwood_ge01_shared_data.t_clk = kirkwood_tclk;
989 kirkwood_spi_plat_data.tclk = kirkwood_tclk;
990 kirkwood_uart0_data[0].uartclk = kirkwood_tclk;
991 kirkwood_uart1_data[0].uartclk = kirkwood_tclk;
992 kirkwood_i2s_data.tclk = kirkwood_tclk; 455 kirkwood_i2s_data.tclk = kirkwood_tclk;
993 456
994 /* 457 /*
diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h
index 9da2eb59180..2bf8161e3b5 100644
--- a/arch/arm/mach-kirkwood/include/mach/irqs.h
+++ b/arch/arm/mach-kirkwood/include/mach/irqs.h
@@ -51,6 +51,7 @@
51#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41 51#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41
52#define IRQ_KIRKWOOD_GE00_ERR 46 52#define IRQ_KIRKWOOD_GE00_ERR 46
53#define IRQ_KIRKWOOD_GE01_ERR 47 53#define IRQ_KIRKWOOD_GE01_ERR 47
54#define IRQ_KIRKWOOD_RTC 53
54 55
55/* 56/*
56 * KIRKWOOD General Purpose Pins 57 * KIRKWOOD General Purpose Pins
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 7ce20184806..b0a7d979a8e 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/gpio.h> 15#include <asm/gpio.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <plat/mpp.h>
17#include "common.h" 18#include "common.h"
18#include "mpp.h" 19#include "mpp.h"
19 20
@@ -36,61 +37,8 @@ static unsigned int __init kirkwood_variant(void)
36 return 0; 37 return 0;
37} 38}
38 39
39#define MPP_CTRL(i) (DEV_BUS_VIRT_BASE + (i) * 4)
40#define MPP_NR_REGS (1 + MPP_MAX/8)
41
42void __init kirkwood_mpp_conf(unsigned int *mpp_list) 40void __init kirkwood_mpp_conf(unsigned int *mpp_list)
43{ 41{
44 u32 mpp_ctrl[MPP_NR_REGS]; 42 orion_mpp_conf(mpp_list, kirkwood_variant(),
45 unsigned int variant_mask; 43 MPP_MAX, DEV_BUS_VIRT_BASE);
46 int i;
47
48 variant_mask = kirkwood_variant();
49 if (!variant_mask)
50 return;
51
52 printk(KERN_DEBUG "initial MPP regs:");
53 for (i = 0; i < MPP_NR_REGS; i++) {
54 mpp_ctrl[i] = readl(MPP_CTRL(i));
55 printk(" %08x", mpp_ctrl[i]);
56 }
57 printk("\n");
58
59 for ( ; *mpp_list; mpp_list++) {
60 unsigned int num = MPP_NUM(*mpp_list);
61 unsigned int sel = MPP_SEL(*mpp_list);
62 int shift, gpio_mode;
63
64 if (num > MPP_MAX) {
65 printk(KERN_ERR "kirkwood_mpp_conf: invalid MPP "
66 "number (%u)\n", num);
67 continue;
68 }
69 if (!(*mpp_list & variant_mask)) {
70 printk(KERN_WARNING
71 "kirkwood_mpp_conf: requested MPP%u config "
72 "unavailable on this hardware\n", num);
73 continue;
74 }
75
76 shift = (num & 7) << 2;
77 mpp_ctrl[num / 8] &= ~(0xf << shift);
78 mpp_ctrl[num / 8] |= sel << shift;
79
80 gpio_mode = 0;
81 if (*mpp_list & MPP_INPUT_MASK)
82 gpio_mode |= GPIO_INPUT_OK;
83 if (*mpp_list & MPP_OUTPUT_MASK)
84 gpio_mode |= GPIO_OUTPUT_OK;
85 if (sel != 0)
86 gpio_mode = 0;
87 orion_gpio_set_valid(num, gpio_mode);
88 }
89
90 printk(KERN_DEBUG " final MPP regs:");
91 for (i = 0; i < MPP_NR_REGS; i++) {
92 writel(mpp_ctrl[i], MPP_CTRL(i));
93 printk(" %08x", mpp_ctrl[i]);
94 }
95 printk("\n");
96} 44}
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h
index 9b0a94d85c3..ac787957e2d 100644
--- a/arch/arm/mach-kirkwood/mpp.h
+++ b/arch/arm/mach-kirkwood/mpp.h
@@ -22,14 +22,8 @@
22 /* available on F6281 */ ((!!(_F6281)) << 17) | \ 22 /* available on F6281 */ ((!!(_F6281)) << 17) | \
23 /* available on F6282 */ ((!!(_F6282)) << 18)) 23 /* available on F6282 */ ((!!(_F6282)) << 18))
24 24
25#define MPP_NUM(x) ((x) & 0xff)
26#define MPP_SEL(x) (((x) >> 8) & 0xf)
27
28 /* num sel i o 6180 6190 6192 6281 6282 */ 25 /* num sel i o 6180 6190 6192 6281 6282 */
29 26
30#define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0, 0 )
31#define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0, 0 )
32
33#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 ) 27#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 )
34#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 ) 28#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 )
35#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 ) 29#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 )
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c
index f781164e623..24294b2bc46 100644
--- a/arch/arm/mach-kirkwood/tsx1x-common.c
+++ b/arch/arm/mach-kirkwood/tsx1x-common.c
@@ -15,7 +15,7 @@
15 15
16/**************************************************************************** 16/****************************************************************************
17 * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the 17 * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the
18 * partitions on the device because we want to keep compatability with 18 * partitions on the device because we want to keep compatibility with
19 * the QNAP firmware. 19 * the QNAP firmware.
20 * Layout as used by QNAP: 20 * Layout as used by QNAP:
21 * 0x00000000-0x00080000 : "U-Boot" 21 * 0x00000000-0x00080000 : "U-Boot"
diff --git a/arch/arm/mach-loki/common.c b/arch/arm/mach-loki/common.c
index e41e909cf8f..5f02664db81 100644
--- a/arch/arm/mach-loki/common.c
+++ b/arch/arm/mach-loki/common.c
@@ -13,7 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/dma-mapping.h>
17#include <asm/page.h> 17#include <asm/page.h>
18#include <asm/timex.h> 18#include <asm/timex.h>
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
@@ -22,6 +22,7 @@
22#include <mach/loki.h> 22#include <mach/loki.h>
23#include <plat/orion_nand.h> 23#include <plat/orion_nand.h>
24#include <plat/time.h> 24#include <plat/time.h>
25#include <plat/common.h>
25#include "common.h" 26#include "common.h"
26 27
27/***************************************************************************** 28/*****************************************************************************
@@ -43,116 +44,28 @@ void __init loki_map_io(void)
43 44
44 45
45/***************************************************************************** 46/*****************************************************************************
46 * GE0 47 * GE00
47 ****************************************************************************/ 48 ****************************************************************************/
48struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = {
49 .t_clk = LOKI_TCLK,
50 .dram = &loki_mbus_dram_info,
51};
52
53static struct resource loki_ge0_shared_resources[] = {
54 {
55 .name = "ge0 base",
56 .start = GE0_PHYS_BASE + 0x2000,
57 .end = GE0_PHYS_BASE + 0x3fff,
58 .flags = IORESOURCE_MEM,
59 },
60};
61
62static struct platform_device loki_ge0_shared = {
63 .name = MV643XX_ETH_SHARED_NAME,
64 .id = 0,
65 .dev = {
66 .platform_data = &loki_ge0_shared_data,
67 },
68 .num_resources = 1,
69 .resource = loki_ge0_shared_resources,
70};
71
72static struct resource loki_ge0_resources[] = {
73 {
74 .name = "ge0 irq",
75 .start = IRQ_LOKI_GBE_A_INT,
76 .end = IRQ_LOKI_GBE_A_INT,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct platform_device loki_ge0 = {
82 .name = MV643XX_ETH_NAME,
83 .id = 0,
84 .num_resources = 1,
85 .resource = loki_ge0_resources,
86 .dev = {
87 .coherent_dma_mask = 0xffffffff,
88 },
89};
90
91void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data) 49void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
92{ 50{
93 eth_data->shared = &loki_ge0_shared;
94 loki_ge0.dev.platform_data = eth_data;
95
96 writel(0x00079220, GE0_VIRT_BASE + 0x20b0); 51 writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
97 platform_device_register(&loki_ge0_shared); 52
98 platform_device_register(&loki_ge0); 53 orion_ge00_init(eth_data, &loki_mbus_dram_info,
54 GE0_PHYS_BASE, IRQ_LOKI_GBE_A_INT,
55 0, LOKI_TCLK);
99} 56}
100 57
101 58
102/***************************************************************************** 59/*****************************************************************************
103 * GE1 60 * GE01
104 ****************************************************************************/ 61 ****************************************************************************/
105struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = {
106 .t_clk = LOKI_TCLK,
107 .dram = &loki_mbus_dram_info,
108};
109
110static struct resource loki_ge1_shared_resources[] = {
111 {
112 .name = "ge1 base",
113 .start = GE1_PHYS_BASE + 0x2000,
114 .end = GE1_PHYS_BASE + 0x3fff,
115 .flags = IORESOURCE_MEM,
116 },
117};
118
119static struct platform_device loki_ge1_shared = {
120 .name = MV643XX_ETH_SHARED_NAME,
121 .id = 1,
122 .dev = {
123 .platform_data = &loki_ge1_shared_data,
124 },
125 .num_resources = 1,
126 .resource = loki_ge1_shared_resources,
127};
128
129static struct resource loki_ge1_resources[] = {
130 {
131 .name = "ge1 irq",
132 .start = IRQ_LOKI_GBE_B_INT,
133 .end = IRQ_LOKI_GBE_B_INT,
134 .flags = IORESOURCE_IRQ,
135 },
136};
137
138static struct platform_device loki_ge1 = {
139 .name = MV643XX_ETH_NAME,
140 .id = 1,
141 .num_resources = 1,
142 .resource = loki_ge1_resources,
143 .dev = {
144 .coherent_dma_mask = 0xffffffff,
145 },
146};
147
148void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data) 62void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
149{ 63{
150 eth_data->shared = &loki_ge1_shared;
151 loki_ge1.dev.platform_data = eth_data;
152
153 writel(0x00079220, GE1_VIRT_BASE + 0x20b0); 64 writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
154 platform_device_register(&loki_ge1_shared); 65
155 platform_device_register(&loki_ge1); 66 orion_ge01_init(eth_data, &loki_mbus_dram_info,
67 GE1_PHYS_BASE, IRQ_LOKI_GBE_B_INT,
68 0, LOKI_TCLK);
156} 69}
157 70
158 71
@@ -187,7 +100,7 @@ static struct platform_device loki_sas = {
187 .name = "mvsas", 100 .name = "mvsas",
188 .id = 0, 101 .id = 0,
189 .dev = { 102 .dev = {
190 .coherent_dma_mask = 0xffffffff, 103 .coherent_dma_mask = DMA_BIT_MASK(32),
191 }, 104 },
192 .num_resources = ARRAY_SIZE(loki_sas_resources), 105 .num_resources = ARRAY_SIZE(loki_sas_resources),
193 .resource = loki_sas_resources, 106 .resource = loki_sas_resources,
@@ -203,88 +116,19 @@ void __init loki_sas_init(void)
203/***************************************************************************** 116/*****************************************************************************
204 * UART0 117 * UART0
205 ****************************************************************************/ 118 ****************************************************************************/
206static struct plat_serial8250_port loki_uart0_data[] = {
207 {
208 .mapbase = UART0_PHYS_BASE,
209 .membase = (char *)UART0_VIRT_BASE,
210 .irq = IRQ_LOKI_UART0,
211 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
212 .iotype = UPIO_MEM,
213 .regshift = 2,
214 .uartclk = LOKI_TCLK,
215 }, {
216 },
217};
218
219static struct resource loki_uart0_resources[] = {
220 {
221 .start = UART0_PHYS_BASE,
222 .end = UART0_PHYS_BASE + 0xff,
223 .flags = IORESOURCE_MEM,
224 }, {
225 .start = IRQ_LOKI_UART0,
226 .end = IRQ_LOKI_UART0,
227 .flags = IORESOURCE_IRQ,
228 },
229};
230
231static struct platform_device loki_uart0 = {
232 .name = "serial8250",
233 .id = 0,
234 .dev = {
235 .platform_data = loki_uart0_data,
236 },
237 .resource = loki_uart0_resources,
238 .num_resources = ARRAY_SIZE(loki_uart0_resources),
239};
240
241void __init loki_uart0_init(void) 119void __init loki_uart0_init(void)
242{ 120{
243 platform_device_register(&loki_uart0); 121 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
122 IRQ_LOKI_UART0, LOKI_TCLK);
244} 123}
245 124
246
247/***************************************************************************** 125/*****************************************************************************
248 * UART1 126 * UART1
249 ****************************************************************************/ 127 ****************************************************************************/
250static struct plat_serial8250_port loki_uart1_data[] = {
251 {
252 .mapbase = UART1_PHYS_BASE,
253 .membase = (char *)UART1_VIRT_BASE,
254 .irq = IRQ_LOKI_UART1,
255 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
256 .iotype = UPIO_MEM,
257 .regshift = 2,
258 .uartclk = LOKI_TCLK,
259 }, {
260 },
261};
262
263static struct resource loki_uart1_resources[] = {
264 {
265 .start = UART1_PHYS_BASE,
266 .end = UART1_PHYS_BASE + 0xff,
267 .flags = IORESOURCE_MEM,
268 }, {
269 .start = IRQ_LOKI_UART1,
270 .end = IRQ_LOKI_UART1,
271 .flags = IORESOURCE_IRQ,
272 },
273};
274
275static struct platform_device loki_uart1 = {
276 .name = "serial8250",
277 .id = 1,
278 .dev = {
279 .platform_data = loki_uart1_data,
280 },
281 .resource = loki_uart1_resources,
282 .num_resources = ARRAY_SIZE(loki_uart1_resources),
283};
284
285void __init loki_uart1_init(void) 128void __init loki_uart1_init(void)
286{ 129{
287 platform_device_register(&loki_uart1); 130 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
131 IRQ_LOKI_UART1, LOKI_TCLK);
288} 132}
289 133
290 134
diff --git a/arch/arm/mach-lpc32xx/pm.c b/arch/arm/mach-lpc32xx/pm.c
index e76d41bb705..b9c80597b7b 100644
--- a/arch/arm/mach-lpc32xx/pm.c
+++ b/arch/arm/mach-lpc32xx/pm.c
@@ -41,7 +41,7 @@
41 * DRAM clocking and refresh are slightly different for systems with DDR 41 * DRAM clocking and refresh are slightly different for systems with DDR
42 * DRAM or regular SDRAM devices. If SDRAM is used in the system, the 42 * DRAM or regular SDRAM devices. If SDRAM is used in the system, the
43 * SDRAM will still be accessible in direct-run mode. In DDR based systems, 43 * SDRAM will still be accessible in direct-run mode. In DDR based systems,
44 * a transistion to direct-run mode will stop all DDR accesses (no clocks). 44 * a transition to direct-run mode will stop all DDR accesses (no clocks).
45 * Because of this, the code to switch power modes and the code to enter 45 * Because of this, the code to switch power modes and the code to enter
46 * and exit DRAM self-refresh modes must not be executed in DRAM. A small 46 * and exit DRAM self-refresh modes must not be executed in DRAM. A small
47 * section of IRAM is used instead for this. 47 * section of IRAM is used instead for this.
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
index ee8b02ed801..7bfb827f3fe 100644
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ b/arch/arm/mach-mmp/include/mach/gpio.h
@@ -10,7 +10,7 @@
10#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) 10#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
11#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x)))) 11#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
12 12
13#define NR_BUILTIN_GPIO (192) 13#define NR_BUILTIN_GPIO IRQ_GPIO_NUM
14 14
15#define gpio_to_bank(gpio) ((gpio) >> 5) 15#define gpio_to_bank(gpio) ((gpio) >> 5)
16#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) 16#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
index 4621067c772..713be155a44 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
@@ -8,6 +8,15 @@
8#define MFP_DRIVE_MEDIUM (0x2 << 13) 8#define MFP_DRIVE_MEDIUM (0x2 << 13)
9#define MFP_DRIVE_FAST (0x3 << 13) 9#define MFP_DRIVE_FAST (0x3 << 13)
10 10
11#undef MFP_CFG
12#undef MFP_CFG_DRV
13
14#define MFP_CFG(pin, af) \
15 (MFP_LPM_INPUT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_MEDIUM)
16
17#define MFP_CFG_DRV(pin, af, drv) \
18 (MFP_LPM_INPUT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_##drv)
19
11/* GPIO */ 20/* GPIO */
12#define GPIO0_GPIO MFP_CFG(GPIO0, AF5) 21#define GPIO0_GPIO MFP_CFG(GPIO0, AF5)
13#define GPIO1_GPIO MFP_CFG(GPIO1, AF5) 22#define GPIO1_GPIO MFP_CFG(GPIO1, AF5)
diff --git a/arch/arm/mach-mmp/include/mach/uncompress.h b/arch/arm/mach-mmp/include/mach/uncompress.h
index 85bd8a2d84b..d6daeb7e4ef 100644
--- a/arch/arm/mach-mmp/include/mach/uncompress.h
+++ b/arch/arm/mach-mmp/include/mach/uncompress.h
@@ -14,7 +14,7 @@
14#define UART2_BASE (APB_PHYS_BASE + 0x17000) 14#define UART2_BASE (APB_PHYS_BASE + 0x17000)
15#define UART3_BASE (APB_PHYS_BASE + 0x18000) 15#define UART3_BASE (APB_PHYS_BASE + 0x18000)
16 16
17static volatile unsigned long *UART; 17volatile unsigned long *UART;
18 18
19static inline void putc(char c) 19static inline void putc(char c)
20{ 20{
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index aeb9ae23e6c..99833b9485c 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -9,7 +9,7 @@
9 * 2008-04-11: Jason Chagas <Jason.chagas@marvell.com> 9 * 2008-04-11: Jason Chagas <Jason.chagas@marvell.com>
10 * 2008-10-08: Bin Yang <bin.yang@marvell.com> 10 * 2008-10-08: Bin Yang <bin.yang@marvell.com>
11 * 11 *
12 * The timers module actually includes three timers, each timer with upto 12 * The timers module actually includes three timers, each timer with up to
13 * three match comparators. Timer #0 is used here in free-running mode as 13 * three match comparators. Timer #0 is used here in free-running mode as
14 * the clock source, and match comparator #1 used as clock event device. 14 * the clock source, and match comparator #1 used as clock event device.
15 * 15 *
diff --git a/arch/arm/mach-msm/acpuclock-arm11.c b/arch/arm/mach-msm/acpuclock-arm11.c
index 7ffbd987eb5..805d4ee53f7 100644
--- a/arch/arm/mach-msm/acpuclock-arm11.c
+++ b/arch/arm/mach-msm/acpuclock-arm11.c
@@ -343,7 +343,7 @@ int acpuclk_set_rate(unsigned long rate, int for_power_collapse)
343 } 343 }
344 } 344 }
345 345
346 /* Set wait states for CPU inbetween frequency changes */ 346 /* Set wait states for CPU between frequency changes */
347 reg_clkctl = readl(A11S_CLK_CNTL_ADDR); 347 reg_clkctl = readl(A11S_CLK_CNTL_ADDR);
348 reg_clkctl |= (100 << 16); /* set WT_ST_CNT */ 348 reg_clkctl |= (100 << 16); /* set WT_ST_CNT */
349 writel(reg_clkctl, A11S_CLK_CNTL_ADDR); 349 writel(reg_clkctl, A11S_CLK_CNTL_ADDR);
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 7f568611547..6a96911b0ad 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -160,10 +160,7 @@ static struct msm_mmc_platform_data qsd8x50_sdc1_data = {
160 160
161static void __init qsd8x50_init_mmc(void) 161static void __init qsd8x50_init_mmc(void)
162{ 162{
163 if (machine_is_qsd8x50_ffa() || machine_is_qsd8x50a_ffa()) 163 vreg_mmc = vreg_get(NULL, "gp5");
164 vreg_mmc = vreg_get(NULL, "gp6");
165 else
166 vreg_mmc = vreg_get(NULL, "gp5");
167 164
168 if (IS_ERR(vreg_mmc)) { 165 if (IS_ERR(vreg_mmc)) {
169 pr_err("vreg get for vreg_mmc failed (%ld)\n", 166 pr_err("vreg get for vreg_mmc failed (%ld)\n",
diff --git a/arch/arm/mach-msm/gpio-v2.c b/arch/arm/mach-msm/gpio-v2.c
index 56a964e52ad..cc9c4fd7ccc 100644
--- a/arch/arm/mach-msm/gpio-v2.c
+++ b/arch/arm/mach-msm/gpio-v2.c
@@ -27,6 +27,9 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30
31#include <asm/mach/irq.h>
32
30#include <mach/msm_iomap.h> 33#include <mach/msm_iomap.h>
31#include "gpiomux.h" 34#include "gpiomux.h"
32 35
@@ -309,8 +312,10 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type)
309 */ 312 */
310static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc) 313static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc)
311{ 314{
312 struct irq_data *data = irq_desc_get_irq_data(desc);
313 unsigned long i; 315 unsigned long i;
316 struct irq_chip *chip = irq_desc_get_chip(desc);
317
318 chained_irq_enter(chip, desc);
314 319
315 for (i = find_first_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS); 320 for (i = find_first_bit(msm_gpio.enabled_irqs, NR_GPIO_IRQS);
316 i < NR_GPIO_IRQS; 321 i < NR_GPIO_IRQS;
@@ -319,7 +324,8 @@ static void msm_summary_irq_handler(unsigned int irq, struct irq_desc *desc)
319 generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip, 324 generic_handle_irq(msm_gpio_to_irq(&msm_gpio.gpio_chip,
320 i)); 325 i));
321 } 326 }
322 data->chip->irq_ack(data); 327
328 chained_irq_exit(chip, desc);
323} 329}
324 330
325static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) 331static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
diff --git a/arch/arm/mach-msm/scm.c b/arch/arm/mach-msm/scm.c
index cfa808dd489..232f97a0450 100644
--- a/arch/arm/mach-msm/scm.c
+++ b/arch/arm/mach-msm/scm.c
@@ -46,7 +46,7 @@ static DEFINE_MUTEX(scm_lock);
46 * @id: command to be executed 46 * @id: command to be executed
47 * @buf: buffer returned from scm_get_command_buffer() 47 * @buf: buffer returned from scm_get_command_buffer()
48 * 48 *
49 * An SCM command is layed out in memory as follows: 49 * An SCM command is laid out in memory as follows:
50 * 50 *
51 * ------------------- <--- struct scm_command 51 * ------------------- <--- struct scm_command
52 * | command header | 52 * | command header |
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 56f920c55b6..38b95e949d1 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -269,7 +269,7 @@ int __cpuinit local_timer_setup(struct clock_event_device *evt)
269 269
270 /* Use existing clock_event for cpu 0 */ 270 /* Use existing clock_event for cpu 0 */
271 if (!smp_processor_id()) 271 if (!smp_processor_id())
272 return; 272 return 0;
273 273
274 writel(DGT_CLK_CTL_DIV_4, MSM_TMR_BASE + DGT_CLK_CTL); 274 writel(DGT_CLK_CTL_DIV_4, MSM_TMR_BASE + DGT_CLK_CTL);
275 275
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 44fb4e55be0..23d3980ef59 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -13,8 +13,6 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h>
18#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
19#include <linux/ethtool.h> 17#include <linux/ethtool.h>
20#include <asm/mach/map.h> 18#include <asm/mach/map.h>
@@ -22,11 +20,12 @@
22#include <mach/mv78xx0.h> 20#include <mach/mv78xx0.h>
23#include <mach/bridge-regs.h> 21#include <mach/bridge-regs.h>
24#include <plat/cache-feroceon-l2.h> 22#include <plat/cache-feroceon-l2.h>
25#include <plat/ehci-orion.h>
26#include <plat/orion_nand.h> 23#include <plat/orion_nand.h>
27#include <plat/time.h> 24#include <plat/time.h>
25#include <plat/common.h>
28#include "common.h" 26#include "common.h"
29 27
28static int get_tclk(void);
30 29
31/***************************************************************************** 30/*****************************************************************************
32 * Common bits 31 * Common bits
@@ -168,285 +167,62 @@ void __init mv78xx0_map_io(void)
168/***************************************************************************** 167/*****************************************************************************
169 * EHCI 168 * EHCI
170 ****************************************************************************/ 169 ****************************************************************************/
171static struct orion_ehci_data mv78xx0_ehci_data = {
172 .dram = &mv78xx0_mbus_dram_info,
173 .phy_version = EHCI_PHY_NA,
174};
175
176static u64 ehci_dmamask = 0xffffffffUL;
177
178
179/*****************************************************************************
180 * EHCI0
181 ****************************************************************************/
182static struct resource mv78xx0_ehci0_resources[] = {
183 {
184 .start = USB0_PHYS_BASE,
185 .end = USB0_PHYS_BASE + 0x0fff,
186 .flags = IORESOURCE_MEM,
187 }, {
188 .start = IRQ_MV78XX0_USB_0,
189 .end = IRQ_MV78XX0_USB_0,
190 .flags = IORESOURCE_IRQ,
191 },
192};
193
194static struct platform_device mv78xx0_ehci0 = {
195 .name = "orion-ehci",
196 .id = 0,
197 .dev = {
198 .dma_mask = &ehci_dmamask,
199 .coherent_dma_mask = 0xffffffff,
200 .platform_data = &mv78xx0_ehci_data,
201 },
202 .resource = mv78xx0_ehci0_resources,
203 .num_resources = ARRAY_SIZE(mv78xx0_ehci0_resources),
204};
205
206void __init mv78xx0_ehci0_init(void) 170void __init mv78xx0_ehci0_init(void)
207{ 171{
208 platform_device_register(&mv78xx0_ehci0); 172 orion_ehci_init(&mv78xx0_mbus_dram_info,
173 USB0_PHYS_BASE, IRQ_MV78XX0_USB_0);
209} 174}
210 175
211 176
212/***************************************************************************** 177/*****************************************************************************
213 * EHCI1 178 * EHCI1
214 ****************************************************************************/ 179 ****************************************************************************/
215static struct resource mv78xx0_ehci1_resources[] = {
216 {
217 .start = USB1_PHYS_BASE,
218 .end = USB1_PHYS_BASE + 0x0fff,
219 .flags = IORESOURCE_MEM,
220 }, {
221 .start = IRQ_MV78XX0_USB_1,
222 .end = IRQ_MV78XX0_USB_1,
223 .flags = IORESOURCE_IRQ,
224 },
225};
226
227static struct platform_device mv78xx0_ehci1 = {
228 .name = "orion-ehci",
229 .id = 1,
230 .dev = {
231 .dma_mask = &ehci_dmamask,
232 .coherent_dma_mask = 0xffffffff,
233 .platform_data = &mv78xx0_ehci_data,
234 },
235 .resource = mv78xx0_ehci1_resources,
236 .num_resources = ARRAY_SIZE(mv78xx0_ehci1_resources),
237};
238
239void __init mv78xx0_ehci1_init(void) 180void __init mv78xx0_ehci1_init(void)
240{ 181{
241 platform_device_register(&mv78xx0_ehci1); 182 orion_ehci_1_init(&mv78xx0_mbus_dram_info,
183 USB1_PHYS_BASE, IRQ_MV78XX0_USB_1);
242} 184}
243 185
244 186
245/***************************************************************************** 187/*****************************************************************************
246 * EHCI2 188 * EHCI2
247 ****************************************************************************/ 189 ****************************************************************************/
248static struct resource mv78xx0_ehci2_resources[] = {
249 {
250 .start = USB2_PHYS_BASE,
251 .end = USB2_PHYS_BASE + 0x0fff,
252 .flags = IORESOURCE_MEM,
253 }, {
254 .start = IRQ_MV78XX0_USB_2,
255 .end = IRQ_MV78XX0_USB_2,
256 .flags = IORESOURCE_IRQ,
257 },
258};
259
260static struct platform_device mv78xx0_ehci2 = {
261 .name = "orion-ehci",
262 .id = 2,
263 .dev = {
264 .dma_mask = &ehci_dmamask,
265 .coherent_dma_mask = 0xffffffff,
266 .platform_data = &mv78xx0_ehci_data,
267 },
268 .resource = mv78xx0_ehci2_resources,
269 .num_resources = ARRAY_SIZE(mv78xx0_ehci2_resources),
270};
271
272void __init mv78xx0_ehci2_init(void) 190void __init mv78xx0_ehci2_init(void)
273{ 191{
274 platform_device_register(&mv78xx0_ehci2); 192 orion_ehci_2_init(&mv78xx0_mbus_dram_info,
193 USB2_PHYS_BASE, IRQ_MV78XX0_USB_2);
275} 194}
276 195
277 196
278/***************************************************************************** 197/*****************************************************************************
279 * GE00 198 * GE00
280 ****************************************************************************/ 199 ****************************************************************************/
281struct mv643xx_eth_shared_platform_data mv78xx0_ge00_shared_data = {
282 .t_clk = 0,
283 .dram = &mv78xx0_mbus_dram_info,
284};
285
286static struct resource mv78xx0_ge00_shared_resources[] = {
287 {
288 .name = "ge00 base",
289 .start = GE00_PHYS_BASE + 0x2000,
290 .end = GE00_PHYS_BASE + 0x3fff,
291 .flags = IORESOURCE_MEM,
292 }, {
293 .name = "ge err irq",
294 .start = IRQ_MV78XX0_GE_ERR,
295 .end = IRQ_MV78XX0_GE_ERR,
296 .flags = IORESOURCE_IRQ,
297 },
298};
299
300static struct platform_device mv78xx0_ge00_shared = {
301 .name = MV643XX_ETH_SHARED_NAME,
302 .id = 0,
303 .dev = {
304 .platform_data = &mv78xx0_ge00_shared_data,
305 },
306 .num_resources = ARRAY_SIZE(mv78xx0_ge00_shared_resources),
307 .resource = mv78xx0_ge00_shared_resources,
308};
309
310static struct resource mv78xx0_ge00_resources[] = {
311 {
312 .name = "ge00 irq",
313 .start = IRQ_MV78XX0_GE00_SUM,
314 .end = IRQ_MV78XX0_GE00_SUM,
315 .flags = IORESOURCE_IRQ,
316 },
317};
318
319static struct platform_device mv78xx0_ge00 = {
320 .name = MV643XX_ETH_NAME,
321 .id = 0,
322 .num_resources = 1,
323 .resource = mv78xx0_ge00_resources,
324 .dev = {
325 .coherent_dma_mask = 0xffffffff,
326 },
327};
328
329void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data) 200void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
330{ 201{
331 eth_data->shared = &mv78xx0_ge00_shared; 202 orion_ge00_init(eth_data, &mv78xx0_mbus_dram_info,
332 mv78xx0_ge00.dev.platform_data = eth_data; 203 GE00_PHYS_BASE, IRQ_MV78XX0_GE00_SUM,
333 204 IRQ_MV78XX0_GE_ERR, get_tclk());
334 platform_device_register(&mv78xx0_ge00_shared);
335 platform_device_register(&mv78xx0_ge00);
336} 205}
337 206
338 207
339/***************************************************************************** 208/*****************************************************************************
340 * GE01 209 * GE01
341 ****************************************************************************/ 210 ****************************************************************************/
342struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = {
343 .t_clk = 0,
344 .dram = &mv78xx0_mbus_dram_info,
345 .shared_smi = &mv78xx0_ge00_shared,
346};
347
348static struct resource mv78xx0_ge01_shared_resources[] = {
349 {
350 .name = "ge01 base",
351 .start = GE01_PHYS_BASE + 0x2000,
352 .end = GE01_PHYS_BASE + 0x3fff,
353 .flags = IORESOURCE_MEM,
354 },
355};
356
357static struct platform_device mv78xx0_ge01_shared = {
358 .name = MV643XX_ETH_SHARED_NAME,
359 .id = 1,
360 .dev = {
361 .platform_data = &mv78xx0_ge01_shared_data,
362 },
363 .num_resources = 1,
364 .resource = mv78xx0_ge01_shared_resources,
365};
366
367static struct resource mv78xx0_ge01_resources[] = {
368 {
369 .name = "ge01 irq",
370 .start = IRQ_MV78XX0_GE01_SUM,
371 .end = IRQ_MV78XX0_GE01_SUM,
372 .flags = IORESOURCE_IRQ,
373 },
374};
375
376static struct platform_device mv78xx0_ge01 = {
377 .name = MV643XX_ETH_NAME,
378 .id = 1,
379 .num_resources = 1,
380 .resource = mv78xx0_ge01_resources,
381 .dev = {
382 .coherent_dma_mask = 0xffffffff,
383 },
384};
385
386void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data) 211void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
387{ 212{
388 eth_data->shared = &mv78xx0_ge01_shared; 213 orion_ge01_init(eth_data, &mv78xx0_mbus_dram_info,
389 mv78xx0_ge01.dev.platform_data = eth_data; 214 GE01_PHYS_BASE, IRQ_MV78XX0_GE01_SUM,
390 215 NO_IRQ, get_tclk());
391 platform_device_register(&mv78xx0_ge01_shared);
392 platform_device_register(&mv78xx0_ge01);
393} 216}
394 217
395 218
396/***************************************************************************** 219/*****************************************************************************
397 * GE10 220 * GE10
398 ****************************************************************************/ 221 ****************************************************************************/
399struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = {
400 .t_clk = 0,
401 .dram = &mv78xx0_mbus_dram_info,
402 .shared_smi = &mv78xx0_ge00_shared,
403};
404
405static struct resource mv78xx0_ge10_shared_resources[] = {
406 {
407 .name = "ge10 base",
408 .start = GE10_PHYS_BASE + 0x2000,
409 .end = GE10_PHYS_BASE + 0x3fff,
410 .flags = IORESOURCE_MEM,
411 },
412};
413
414static struct platform_device mv78xx0_ge10_shared = {
415 .name = MV643XX_ETH_SHARED_NAME,
416 .id = 2,
417 .dev = {
418 .platform_data = &mv78xx0_ge10_shared_data,
419 },
420 .num_resources = 1,
421 .resource = mv78xx0_ge10_shared_resources,
422};
423
424static struct resource mv78xx0_ge10_resources[] = {
425 {
426 .name = "ge10 irq",
427 .start = IRQ_MV78XX0_GE10_SUM,
428 .end = IRQ_MV78XX0_GE10_SUM,
429 .flags = IORESOURCE_IRQ,
430 },
431};
432
433static struct platform_device mv78xx0_ge10 = {
434 .name = MV643XX_ETH_NAME,
435 .id = 2,
436 .num_resources = 1,
437 .resource = mv78xx0_ge10_resources,
438 .dev = {
439 .coherent_dma_mask = 0xffffffff,
440 },
441};
442
443void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) 222void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
444{ 223{
445 u32 dev, rev; 224 u32 dev, rev;
446 225
447 eth_data->shared = &mv78xx0_ge10_shared;
448 mv78xx0_ge10.dev.platform_data = eth_data;
449
450 /* 226 /*
451 * On the Z0, ge10 and ge11 are internally connected back 227 * On the Z0, ge10 and ge11 are internally connected back
452 * to back, and not brought out. 228 * to back, and not brought out.
@@ -458,65 +234,19 @@ void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
458 eth_data->duplex = DUPLEX_FULL; 234 eth_data->duplex = DUPLEX_FULL;
459 } 235 }
460 236
461 platform_device_register(&mv78xx0_ge10_shared); 237 orion_ge10_init(eth_data, &mv78xx0_mbus_dram_info,
462 platform_device_register(&mv78xx0_ge10); 238 GE10_PHYS_BASE, IRQ_MV78XX0_GE10_SUM,
239 NO_IRQ, get_tclk());
463} 240}
464 241
465 242
466/***************************************************************************** 243/*****************************************************************************
467 * GE11 244 * GE11
468 ****************************************************************************/ 245 ****************************************************************************/
469struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = {
470 .t_clk = 0,
471 .dram = &mv78xx0_mbus_dram_info,
472 .shared_smi = &mv78xx0_ge00_shared,
473};
474
475static struct resource mv78xx0_ge11_shared_resources[] = {
476 {
477 .name = "ge11 base",
478 .start = GE11_PHYS_BASE + 0x2000,
479 .end = GE11_PHYS_BASE + 0x3fff,
480 .flags = IORESOURCE_MEM,
481 },
482};
483
484static struct platform_device mv78xx0_ge11_shared = {
485 .name = MV643XX_ETH_SHARED_NAME,
486 .id = 3,
487 .dev = {
488 .platform_data = &mv78xx0_ge11_shared_data,
489 },
490 .num_resources = 1,
491 .resource = mv78xx0_ge11_shared_resources,
492};
493
494static struct resource mv78xx0_ge11_resources[] = {
495 {
496 .name = "ge11 irq",
497 .start = IRQ_MV78XX0_GE11_SUM,
498 .end = IRQ_MV78XX0_GE11_SUM,
499 .flags = IORESOURCE_IRQ,
500 },
501};
502
503static struct platform_device mv78xx0_ge11 = {
504 .name = MV643XX_ETH_NAME,
505 .id = 3,
506 .num_resources = 1,
507 .resource = mv78xx0_ge11_resources,
508 .dev = {
509 .coherent_dma_mask = 0xffffffff,
510 },
511};
512
513void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) 246void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
514{ 247{
515 u32 dev, rev; 248 u32 dev, rev;
516 249
517 eth_data->shared = &mv78xx0_ge11_shared;
518 mv78xx0_ge11.dev.platform_data = eth_data;
519
520 /* 250 /*
521 * On the Z0, ge10 and ge11 are internally connected back 251 * On the Z0, ge10 and ge11 are internally connected back
522 * to back, and not brought out. 252 * to back, and not brought out.
@@ -528,293 +258,68 @@ void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
528 eth_data->duplex = DUPLEX_FULL; 258 eth_data->duplex = DUPLEX_FULL;
529 } 259 }
530 260
531 platform_device_register(&mv78xx0_ge11_shared); 261 orion_ge11_init(eth_data, &mv78xx0_mbus_dram_info,
532 platform_device_register(&mv78xx0_ge11); 262 GE11_PHYS_BASE, IRQ_MV78XX0_GE11_SUM,
263 NO_IRQ, get_tclk());
533} 264}
534 265
535/***************************************************************************** 266/*****************************************************************************
536 * I2C bus 0 267 * I2C
537 ****************************************************************************/
538
539static struct mv64xxx_i2c_pdata mv78xx0_i2c_0_pdata = {
540 .freq_m = 8, /* assumes 166 MHz TCLK */
541 .freq_n = 3,
542 .timeout = 1000, /* Default timeout of 1 second */
543};
544
545static struct resource mv78xx0_i2c_0_resources[] = {
546 {
547 .start = I2C_0_PHYS_BASE,
548 .end = I2C_0_PHYS_BASE + 0x1f,
549 .flags = IORESOURCE_MEM,
550 }, {
551 .start = IRQ_MV78XX0_I2C_0,
552 .end = IRQ_MV78XX0_I2C_0,
553 .flags = IORESOURCE_IRQ,
554 },
555};
556
557
558static struct platform_device mv78xx0_i2c_0 = {
559 .name = MV64XXX_I2C_CTLR_NAME,
560 .id = 0,
561 .num_resources = ARRAY_SIZE(mv78xx0_i2c_0_resources),
562 .resource = mv78xx0_i2c_0_resources,
563 .dev = {
564 .platform_data = &mv78xx0_i2c_0_pdata,
565 },
566};
567
568/*****************************************************************************
569 * I2C bus 1
570 ****************************************************************************/ 268 ****************************************************************************/
571
572static struct mv64xxx_i2c_pdata mv78xx0_i2c_1_pdata = {
573 .freq_m = 8, /* assumes 166 MHz TCLK */
574 .freq_n = 3,
575 .timeout = 1000, /* Default timeout of 1 second */
576};
577
578static struct resource mv78xx0_i2c_1_resources[] = {
579 {
580 .start = I2C_1_PHYS_BASE,
581 .end = I2C_1_PHYS_BASE + 0x1f,
582 .flags = IORESOURCE_MEM,
583 }, {
584 .start = IRQ_MV78XX0_I2C_1,
585 .end = IRQ_MV78XX0_I2C_1,
586 .flags = IORESOURCE_IRQ,
587 },
588};
589
590
591static struct platform_device mv78xx0_i2c_1 = {
592 .name = MV64XXX_I2C_CTLR_NAME,
593 .id = 1,
594 .num_resources = ARRAY_SIZE(mv78xx0_i2c_1_resources),
595 .resource = mv78xx0_i2c_1_resources,
596 .dev = {
597 .platform_data = &mv78xx0_i2c_1_pdata,
598 },
599};
600
601void __init mv78xx0_i2c_init(void) 269void __init mv78xx0_i2c_init(void)
602{ 270{
603 platform_device_register(&mv78xx0_i2c_0); 271 orion_i2c_init(I2C_0_PHYS_BASE, IRQ_MV78XX0_I2C_0, 8);
604 platform_device_register(&mv78xx0_i2c_1); 272 orion_i2c_1_init(I2C_1_PHYS_BASE, IRQ_MV78XX0_I2C_1, 8);
605} 273}
606 274
607/***************************************************************************** 275/*****************************************************************************
608 * SATA 276 * SATA
609 ****************************************************************************/ 277 ****************************************************************************/
610static struct resource mv78xx0_sata_resources[] = {
611 {
612 .name = "sata base",
613 .start = SATA_PHYS_BASE,
614 .end = SATA_PHYS_BASE + 0x5000 - 1,
615 .flags = IORESOURCE_MEM,
616 }, {
617 .name = "sata irq",
618 .start = IRQ_MV78XX0_SATA,
619 .end = IRQ_MV78XX0_SATA,
620 .flags = IORESOURCE_IRQ,
621 },
622};
623
624static struct platform_device mv78xx0_sata = {
625 .name = "sata_mv",
626 .id = 0,
627 .dev = {
628 .coherent_dma_mask = 0xffffffff,
629 },
630 .num_resources = ARRAY_SIZE(mv78xx0_sata_resources),
631 .resource = mv78xx0_sata_resources,
632};
633
634void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data) 278void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
635{ 279{
636 sata_data->dram = &mv78xx0_mbus_dram_info; 280 orion_sata_init(sata_data, &mv78xx0_mbus_dram_info,
637 mv78xx0_sata.dev.platform_data = sata_data; 281 SATA_PHYS_BASE, IRQ_MV78XX0_SATA);
638 platform_device_register(&mv78xx0_sata);
639} 282}
640 283
641 284
642/***************************************************************************** 285/*****************************************************************************
643 * UART0 286 * UART0
644 ****************************************************************************/ 287 ****************************************************************************/
645static struct plat_serial8250_port mv78xx0_uart0_data[] = {
646 {
647 .mapbase = UART0_PHYS_BASE,
648 .membase = (char *)UART0_VIRT_BASE,
649 .irq = IRQ_MV78XX0_UART_0,
650 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
651 .iotype = UPIO_MEM,
652 .regshift = 2,
653 .uartclk = 0,
654 }, {
655 },
656};
657
658static struct resource mv78xx0_uart0_resources[] = {
659 {
660 .start = UART0_PHYS_BASE,
661 .end = UART0_PHYS_BASE + 0xff,
662 .flags = IORESOURCE_MEM,
663 }, {
664 .start = IRQ_MV78XX0_UART_0,
665 .end = IRQ_MV78XX0_UART_0,
666 .flags = IORESOURCE_IRQ,
667 },
668};
669
670static struct platform_device mv78xx0_uart0 = {
671 .name = "serial8250",
672 .id = 0,
673 .dev = {
674 .platform_data = mv78xx0_uart0_data,
675 },
676 .resource = mv78xx0_uart0_resources,
677 .num_resources = ARRAY_SIZE(mv78xx0_uart0_resources),
678};
679
680void __init mv78xx0_uart0_init(void) 288void __init mv78xx0_uart0_init(void)
681{ 289{
682 platform_device_register(&mv78xx0_uart0); 290 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
291 IRQ_MV78XX0_UART_0, get_tclk());
683} 292}
684 293
685 294
686/***************************************************************************** 295/*****************************************************************************
687 * UART1 296 * UART1
688 ****************************************************************************/ 297 ****************************************************************************/
689static struct plat_serial8250_port mv78xx0_uart1_data[] = {
690 {
691 .mapbase = UART1_PHYS_BASE,
692 .membase = (char *)UART1_VIRT_BASE,
693 .irq = IRQ_MV78XX0_UART_1,
694 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
695 .iotype = UPIO_MEM,
696 .regshift = 2,
697 .uartclk = 0,
698 }, {
699 },
700};
701
702static struct resource mv78xx0_uart1_resources[] = {
703 {
704 .start = UART1_PHYS_BASE,
705 .end = UART1_PHYS_BASE + 0xff,
706 .flags = IORESOURCE_MEM,
707 }, {
708 .start = IRQ_MV78XX0_UART_1,
709 .end = IRQ_MV78XX0_UART_1,
710 .flags = IORESOURCE_IRQ,
711 },
712};
713
714static struct platform_device mv78xx0_uart1 = {
715 .name = "serial8250",
716 .id = 1,
717 .dev = {
718 .platform_data = mv78xx0_uart1_data,
719 },
720 .resource = mv78xx0_uart1_resources,
721 .num_resources = ARRAY_SIZE(mv78xx0_uart1_resources),
722};
723
724void __init mv78xx0_uart1_init(void) 298void __init mv78xx0_uart1_init(void)
725{ 299{
726 platform_device_register(&mv78xx0_uart1); 300 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
301 IRQ_MV78XX0_UART_1, get_tclk());
727} 302}
728 303
729 304
730/***************************************************************************** 305/*****************************************************************************
731 * UART2 306 * UART2
732 ****************************************************************************/ 307 ****************************************************************************/
733static struct plat_serial8250_port mv78xx0_uart2_data[] = {
734 {
735 .mapbase = UART2_PHYS_BASE,
736 .membase = (char *)UART2_VIRT_BASE,
737 .irq = IRQ_MV78XX0_UART_2,
738 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
739 .iotype = UPIO_MEM,
740 .regshift = 2,
741 .uartclk = 0,
742 }, {
743 },
744};
745
746static struct resource mv78xx0_uart2_resources[] = {
747 {
748 .start = UART2_PHYS_BASE,
749 .end = UART2_PHYS_BASE + 0xff,
750 .flags = IORESOURCE_MEM,
751 }, {
752 .start = IRQ_MV78XX0_UART_2,
753 .end = IRQ_MV78XX0_UART_2,
754 .flags = IORESOURCE_IRQ,
755 },
756};
757
758static struct platform_device mv78xx0_uart2 = {
759 .name = "serial8250",
760 .id = 2,
761 .dev = {
762 .platform_data = mv78xx0_uart2_data,
763 },
764 .resource = mv78xx0_uart2_resources,
765 .num_resources = ARRAY_SIZE(mv78xx0_uart2_resources),
766};
767
768void __init mv78xx0_uart2_init(void) 308void __init mv78xx0_uart2_init(void)
769{ 309{
770 platform_device_register(&mv78xx0_uart2); 310 orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE,
311 IRQ_MV78XX0_UART_2, get_tclk());
771} 312}
772 313
773
774/***************************************************************************** 314/*****************************************************************************
775 * UART3 315 * UART3
776 ****************************************************************************/ 316 ****************************************************************************/
777static struct plat_serial8250_port mv78xx0_uart3_data[] = {
778 {
779 .mapbase = UART3_PHYS_BASE,
780 .membase = (char *)UART3_VIRT_BASE,
781 .irq = IRQ_MV78XX0_UART_3,
782 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
783 .iotype = UPIO_MEM,
784 .regshift = 2,
785 .uartclk = 0,
786 }, {
787 },
788};
789
790static struct resource mv78xx0_uart3_resources[] = {
791 {
792 .start = UART3_PHYS_BASE,
793 .end = UART3_PHYS_BASE + 0xff,
794 .flags = IORESOURCE_MEM,
795 }, {
796 .start = IRQ_MV78XX0_UART_3,
797 .end = IRQ_MV78XX0_UART_3,
798 .flags = IORESOURCE_IRQ,
799 },
800};
801
802static struct platform_device mv78xx0_uart3 = {
803 .name = "serial8250",
804 .id = 3,
805 .dev = {
806 .platform_data = mv78xx0_uart3_data,
807 },
808 .resource = mv78xx0_uart3_resources,
809 .num_resources = ARRAY_SIZE(mv78xx0_uart3_resources),
810};
811
812void __init mv78xx0_uart3_init(void) 317void __init mv78xx0_uart3_init(void)
813{ 318{
814 platform_device_register(&mv78xx0_uart3); 319 orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE,
320 IRQ_MV78XX0_UART_3, get_tclk());
815} 321}
816 322
817
818/***************************************************************************** 323/*****************************************************************************
819 * Time handling 324 * Time handling
820 ****************************************************************************/ 325 ****************************************************************************/
@@ -895,13 +400,4 @@ void __init mv78xx0_init(void)
895#ifdef CONFIG_CACHE_FEROCEON_L2 400#ifdef CONFIG_CACHE_FEROCEON_L2
896 feroceon_l2_init(is_l2_writethrough()); 401 feroceon_l2_init(is_l2_writethrough());
897#endif 402#endif
898
899 mv78xx0_ge00_shared_data.t_clk = tclk;
900 mv78xx0_ge01_shared_data.t_clk = tclk;
901 mv78xx0_ge10_shared_data.t_clk = tclk;
902 mv78xx0_ge11_shared_data.t_clk = tclk;
903 mv78xx0_uart0_data[0].uartclk = tclk;
904 mv78xx0_uart1_data[0].uartclk = tclk;
905 mv78xx0_uart2_data[0].uartclk = tclk;
906 mv78xx0_uart3_data[0].uartclk = tclk;
907} 403}
diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
index 65b72c454cb..59b7686b920 100644
--- a/arch/arm/mach-mv78xx0/mpp.c
+++ b/arch/arm/mach-mv78xx0/mpp.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <plat/mpp.h>
15#include <asm/gpio.h> 16#include <asm/gpio.h>
16#include <mach/hardware.h> 17#include <mach/hardware.h>
17#include "common.h" 18#include "common.h"
@@ -31,61 +32,8 @@ static unsigned int __init mv78xx0_variant(void)
31 return 0; 32 return 0;
32} 33}
33 34
34#define MPP_CTRL(i) (DEV_BUS_VIRT_BASE + (i) * 4)
35#define MPP_NR_REGS (1 + MPP_MAX/8)
36
37void __init mv78xx0_mpp_conf(unsigned int *mpp_list) 35void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
38{ 36{
39 u32 mpp_ctrl[MPP_NR_REGS]; 37 orion_mpp_conf(mpp_list, mv78xx0_variant(),
40 unsigned int variant_mask; 38 MPP_MAX, DEV_BUS_VIRT_BASE);
41 int i;
42
43 variant_mask = mv78xx0_variant();
44 if (!variant_mask)
45 return;
46
47 printk(KERN_DEBUG "initial MPP regs:");
48 for (i = 0; i < MPP_NR_REGS; i++) {
49 mpp_ctrl[i] = readl(MPP_CTRL(i));
50 printk(" %08x", mpp_ctrl[i]);
51 }
52 printk("\n");
53
54 for ( ; *mpp_list; mpp_list++) {
55 unsigned int num = MPP_NUM(*mpp_list);
56 unsigned int sel = MPP_SEL(*mpp_list);
57 int shift, gpio_mode;
58
59 if (num > MPP_MAX) {
60 printk(KERN_ERR "mv78xx0_mpp_conf: invalid MPP "
61 "number (%u)\n", num);
62 continue;
63 }
64 if (!(*mpp_list & variant_mask)) {
65 printk(KERN_WARNING
66 "mv78xx0_mpp_conf: requested MPP%u config "
67 "unavailable on this hardware\n", num);
68 continue;
69 }
70
71 shift = (num & 7) << 2;
72 mpp_ctrl[num / 8] &= ~(0xf << shift);
73 mpp_ctrl[num / 8] |= sel << shift;
74
75 gpio_mode = 0;
76 if (*mpp_list & MPP_INPUT_MASK)
77 gpio_mode |= GPIO_INPUT_OK;
78 if (*mpp_list & MPP_OUTPUT_MASK)
79 gpio_mode |= GPIO_OUTPUT_OK;
80 if (sel != 0)
81 gpio_mode = 0;
82 orion_gpio_set_valid(num, gpio_mode);
83 }
84
85 printk(KERN_DEBUG " final MPP regs:");
86 for (i = 0; i < MPP_NR_REGS; i++) {
87 writel(mpp_ctrl[i], MPP_CTRL(i));
88 printk(" %08x", mpp_ctrl[i]);
89 }
90 printk("\n");
91} 39}
diff --git a/arch/arm/mach-mv78xx0/mpp.h b/arch/arm/mach-mv78xx0/mpp.h
index 80840b781ea..b61b5092712 100644
--- a/arch/arm/mach-mv78xx0/mpp.h
+++ b/arch/arm/mach-mv78xx0/mpp.h
@@ -19,14 +19,8 @@
19 /* may be output signal */ ((!!(_out)) << 13) | \ 19 /* may be output signal */ ((!!(_out)) << 13) | \
20 /* available on A0 */ ((!!(_78100_A0)) << 14)) 20 /* available on A0 */ ((!!(_78100_A0)) << 14))
21 21
22#define MPP_NUM(x) ((x) & 0xff)
23#define MPP_SEL(x) (((x) >> 8) & 0xf)
24
25 /* num sel i o 78100_A0 */ 22 /* num sel i o 78100_A0 */
26 23
27#define MPP_INPUT_MASK MPP(0, 0x0, 1, 0, 0)
28#define MPP_OUTPUT_MASK MPP(0, 0x0, 0, 1, 0)
29
30#define MPP_78100_A0_MASK MPP(0, 0x0, 0, 0, 1) 24#define MPP_78100_A0_MASK MPP(0, 0x0, 0, 0, 1)
31 25
32#define MPP0_GPIO MPP(0, 0x0, 1, 1, 1) 26#define MPP0_GPIO MPP(0, 0x0, 1, 1, 1)
diff --git a/arch/arm/mach-mxs/include/mach/uncompress.h b/arch/arm/mach-mxs/include/mach/uncompress.h
index f12a1732d8b..7f8bf653964 100644
--- a/arch/arm/mach-mxs/include/mach/uncompress.h
+++ b/arch/arm/mach-mxs/include/mach/uncompress.h
@@ -20,7 +20,7 @@
20 20
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22 22
23static unsigned long mxs_duart_base; 23unsigned long mxs_duart_base;
24 24
25#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x))) 25#define MXS_DUART(x) (*(volatile unsigned long *)(mxs_duart_base + (x)))
26 26
diff --git a/arch/arm/mach-ns9xxx/include/mach/uncompress.h b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
index 770a68c46e8..00ef4a6d7cb 100644
--- a/arch/arm/mach-ns9xxx/include/mach/uncompress.h
+++ b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
@@ -20,7 +20,7 @@ static void putc_dummy(char c, void __iomem *base)
20 /* nothing */ 20 /* nothing */
21} 21}
22 22
23static int timeout; 23int timeout;
24 24
25static void putc_ns9360(char c, void __iomem *base) 25static void putc_ns9360(char c, void __iomem *base)
26{ 26{
diff --git a/arch/arm/mach-nuc93x/include/mach/uncompress.h b/arch/arm/mach-nuc93x/include/mach/uncompress.h
index 73082cd61e8..381cb9baadd 100644
--- a/arch/arm/mach-nuc93x/include/mach/uncompress.h
+++ b/arch/arm/mach-nuc93x/include/mach/uncompress.h
@@ -27,7 +27,7 @@
27#define arch_decomp_wdog() 27#define arch_decomp_wdog()
28 28
29#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE) 29#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
30static u32 * uart_base = (u32 *)UART0_PA; 30static u32 * const uart_base = (u32 *)UART0_PA;
31 31
32static void putc(int ch) 32static void putc(int ch)
33{ 33{
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
index 927d5a18176..c1c5fb6a5b4 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S
+++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
@@ -79,7 +79,7 @@
79 79
80 80
81/* 81/*
82 * Register useage 82 * Register usage
83 * r8 - temporary 83 * r8 - temporary
84 * r9 - the driver buffer 84 * r9 - the driver buffer
85 * r10 - temporary 85 * r10 - temporary
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index d41fe2d0616..0ad781db4e6 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -399,7 +399,7 @@ static void __init omap_sx1_init(void)
399 sx1_mmc_init(); 399 sx1_mmc_init();
400 400
401 /* turn on USB power */ 401 /* turn on USB power */
402 /* sx1_setusbpower(1); cant do it here because i2c is not ready */ 402 /* sx1_setusbpower(1); can't do it here because i2c is not ready */
403 gpio_request(1, "A_IRDA_OFF"); 403 gpio_request(1, "A_IRDA_OFF");
404 gpio_request(11, "A_SWITCH"); 404 gpio_request(11, "A_SWITCH");
405 gpio_request(15, "A_USB_ON"); 405 gpio_request(15, "A_USB_ON");
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index b0f4c231595..36f26c3fa25 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -281,7 +281,7 @@ static inline void omap_init_audio(void) {}
281 * Claiming GPIOs, and setting their direction and initial values, is the 281 * Claiming GPIOs, and setting their direction and initial values, is the
282 * responsibility of the device drivers. So is responding to probe(). 282 * responsibility of the device drivers. So is responding to probe().
283 * 283 *
284 * Board-specific knowlege like creating devices or pin setup is to be 284 * Board-specific knowledge like creating devices or pin setup is to be
285 * kept out of drivers as much as possible. In particular, pin setup 285 * kept out of drivers as much as possible. In particular, pin setup
286 * may be handled by the boot loader, and drivers should expect it will 286 * may be handled by the boot loader, and drivers should expect it will
287 * normally have been done by the time they're probed. 287 * normally have been done by the time they're probed.
diff --git a/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h b/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
index 7a2df29400c..23eed0035ed 100644
--- a/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
+++ b/arch/arm/mach-omap1/include/mach/ams-delta-fiq.h
@@ -31,7 +31,7 @@
31#endif 31#endif
32 32
33/* 33/*
34 * These are the offsets from the begining of the fiq_buffer. They are put here 34 * These are the offsets from the beginning of the fiq_buffer. They are put here
35 * since the buffer and header need to be accessed by drivers servicing devices 35 * since the buffer and header need to be accessed by drivers servicing devices
36 * which generate GPIO interrupts - e.g. keyboard, modem, hook switch. 36 * which generate GPIO interrupts - e.g. keyboard, modem, hook switch.
37 */ 37 */
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a45cd640968..512b1520445 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -68,7 +68,7 @@ obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o
68obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o 68obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o
69 69
70AFLAGS_sleep24xx.o :=-Wa,-march=armv6 70AFLAGS_sleep24xx.o :=-Wa,-march=armv6
71AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a 71AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
72 72
73ifeq ($(CONFIG_PM_VERBOSE),y) 73ifeq ($(CONFIG_PM_VERBOSE),y)
74CFLAGS_pm_bus.o += -DDEBUG 74CFLAGS_pm_bus.o += -DDEBUG
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 5f8a2fd0633..34cf982b967 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -696,7 +696,7 @@ static void __init igep2_init(void)
696 igep2_init_smsc911x(); 696 igep2_init_smsc911x();
697 697
698 /* 698 /*
699 * WLAN-BT combo module from MuRata wich has a Marvell WLAN 699 * WLAN-BT combo module from MuRata which has a Marvell WLAN
700 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. 700 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
701 */ 701 */
702 igep2_wlan_bt_init(); 702 igep2_wlan_bt_init();
diff --git a/arch/arm/mach-omap2/board-igep0030.c b/arch/arm/mach-omap2/board-igep0030.c
index b10db0e6ee6..2cf86c3cb1a 100644
--- a/arch/arm/mach-omap2/board-igep0030.c
+++ b/arch/arm/mach-omap2/board-igep0030.c
@@ -440,7 +440,7 @@ static void __init igep3_init(void)
440 igep3_leds_init(); 440 igep3_leds_init();
441 441
442 /* 442 /*
443 * WLAN-BT combo module from MuRata wich has a Marvell WLAN 443 * WLAN-BT combo module from MuRata which has a Marvell WLAN
444 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. 444 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
445 */ 445 */
446 igep3_wifi_bt_init(); 446 igep3_wifi_bt_init();
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index e964895b80e..f8ba20a14e6 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -141,14 +141,19 @@ static void __init rx51_init(void)
141static void __init rx51_map_io(void) 141static void __init rx51_map_io(void)
142{ 142{
143 omap2_set_globals_3xxx(); 143 omap2_set_globals_3xxx();
144 rx51_video_mem_init();
145 omap34xx_map_common_io(); 144 omap34xx_map_common_io();
146} 145}
147 146
147static void __init rx51_reserve(void)
148{
149 rx51_video_mem_init();
150 omap_reserve();
151}
152
148MACHINE_START(NOKIA_RX51, "Nokia RX-51 board") 153MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
149 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */ 154 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
150 .boot_params = 0x80000100, 155 .boot_params = 0x80000100,
151 .reserve = omap_reserve, 156 .reserve = rx51_reserve,
152 .map_io = rx51_map_io, 157 .map_io = rx51_map_io,
153 .init_early = rx51_init_early, 158 .init_early = rx51_init_early,
154 .init_irq = omap_init_irq, 159 .init_irq = omap_init_irq,
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 276992d3b7f..8c965671b4d 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3116,14 +3116,9 @@ static struct omap_clk omap44xx_clks[] = {
3116 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X), 3116 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
3117 CLK("omapdss_dss", "sys_clk", &dss_sys_clk, CK_443X), 3117 CLK("omapdss_dss", "sys_clk", &dss_sys_clk, CK_443X),
3118 CLK("omapdss_dss", "tv_clk", &dss_tv_clk, CK_443X), 3118 CLK("omapdss_dss", "tv_clk", &dss_tv_clk, CK_443X),
3119 CLK("omapdss_dss", "dss_clk", &dss_dss_clk, CK_443X),
3120 CLK("omapdss_dss", "video_clk", &dss_48mhz_clk, CK_443X), 3119 CLK("omapdss_dss", "video_clk", &dss_48mhz_clk, CK_443X),
3121 CLK("omapdss_dss", "fck", &dss_fck, CK_443X), 3120 CLK("omapdss_dss", "fck", &dss_dss_clk, CK_443X),
3122 /* 3121 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
3123 * On OMAP4, DSS ick is a dummy clock; this is needed for compatibility
3124 * with OMAP2/3.
3125 */
3126 CLK("omapdss_dss", "ick", &dummy_ck, CK_443X),
3127 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X), 3122 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
3128 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X), 3123 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
3129 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X), 3124 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index ab878545bd9..6cb6c03293d 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -258,7 +258,7 @@ static void _resolve_clkdm_deps(struct clockdomain *clkdm,
258 * clkdm_init - set up the clockdomain layer 258 * clkdm_init - set up the clockdomain layer
259 * @clkdms: optional pointer to an array of clockdomains to register 259 * @clkdms: optional pointer to an array of clockdomains to register
260 * @init_autodeps: optional pointer to an array of autodeps to register 260 * @init_autodeps: optional pointer to an array of autodeps to register
261 * @custom_funcs: func pointers for arch specfic implementations 261 * @custom_funcs: func pointers for arch specific implementations
262 * 262 *
263 * Set up internal state. If a pointer to an array of clockdomains 263 * Set up internal state. If a pointer to an array of clockdomains
264 * @clkdms was supplied, loop through the list of clockdomains, 264 * @clkdms was supplied, loop through the list of clockdomains,
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 85b3dce6564..5823584d9cd 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -125,7 +125,7 @@ struct clockdomain {
125}; 125};
126 126
127/** 127/**
128 * struct clkdm_ops - Arch specfic function implementations 128 * struct clkdm_ops - Arch specific function implementations
129 * @clkdm_add_wkdep: Add a wakeup dependency between clk domains 129 * @clkdm_add_wkdep: Add a wakeup dependency between clk domains
130 * @clkdm_del_wkdep: Delete a wakeup dependency between clk domains 130 * @clkdm_del_wkdep: Delete a wakeup dependency between clk domains
131 * @clkdm_read_wkdep: Read wakeup dependency state between clk domains 131 * @clkdm_read_wkdep: Read wakeup dependency state between clk domains
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm2xxx_3xxx.c
index 9d0dec806e9..38830d8d478 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c
@@ -247,6 +247,7 @@ struct omap3_cm_regs {
247 u32 per_cm_clksel; 247 u32 per_cm_clksel;
248 u32 emu_cm_clksel; 248 u32 emu_cm_clksel;
249 u32 emu_cm_clkstctrl; 249 u32 emu_cm_clkstctrl;
250 u32 pll_cm_autoidle;
250 u32 pll_cm_autoidle2; 251 u32 pll_cm_autoidle2;
251 u32 pll_cm_clksel4; 252 u32 pll_cm_clksel4;
252 u32 pll_cm_clksel5; 253 u32 pll_cm_clksel5;
@@ -319,6 +320,15 @@ void omap3_cm_save_context(void)
319 omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1); 320 omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1);
320 cm_context.emu_cm_clkstctrl = 321 cm_context.emu_cm_clkstctrl =
321 omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, OMAP2_CM_CLKSTCTRL); 322 omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, OMAP2_CM_CLKSTCTRL);
323 /*
324 * As per erratum i671, ROM code does not respect the PER DPLL
325 * programming scheme if CM_AUTOIDLE_PLL.AUTO_PERIPH_DPLL == 1.
326 * In this case, even though this register has been saved in
327 * scratchpad contents, we need to restore AUTO_PERIPH_DPLL
328 * by ourselves. So, we need to save it anyway.
329 */
330 cm_context.pll_cm_autoidle =
331 omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
322 cm_context.pll_cm_autoidle2 = 332 cm_context.pll_cm_autoidle2 =
323 omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2); 333 omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
324 cm_context.pll_cm_clksel4 = 334 cm_context.pll_cm_clksel4 =
@@ -441,6 +451,13 @@ void omap3_cm_restore_context(void)
441 CM_CLKSEL1); 451 CM_CLKSEL1);
442 omap2_cm_write_mod_reg(cm_context.emu_cm_clkstctrl, OMAP3430_EMU_MOD, 452 omap2_cm_write_mod_reg(cm_context.emu_cm_clkstctrl, OMAP3430_EMU_MOD,
443 OMAP2_CM_CLKSTCTRL); 453 OMAP2_CM_CLKSTCTRL);
454 /*
455 * As per erratum i671, ROM code does not respect the PER DPLL
456 * programming scheme if CM_AUTOIDLE_PLL.AUTO_PERIPH_DPLL == 1.
457 * In this case, we need to restore AUTO_PERIPH_DPLL by ourselves.
458 */
459 omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle, PLL_MOD,
460 CM_AUTOIDLE);
444 omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle2, PLL_MOD, 461 omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle2, PLL_MOD,
445 CM_AUTOIDLE2); 462 CM_AUTOIDLE2);
446 omap2_cm_write_mod_reg(cm_context.pll_cm_clksel4, PLL_MOD, 463 omap2_cm_write_mod_reg(cm_context.pll_cm_clksel4, PLL_MOD,
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 69527941902..da53ba3917c 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -316,8 +316,14 @@ void omap3_save_scratchpad_contents(void)
316 omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL); 316 omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
317 prcm_block_contents.cm_clken_pll = 317 prcm_block_contents.cm_clken_pll =
318 omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 318 omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
319 /*
320 * As per erratum i671, ROM code does not respect the PER DPLL
321 * programming scheme if CM_AUTOIDLE_PLL..AUTO_PERIPH_DPLL == 1.
322 * Then, in anycase, clear these bits to avoid extra latencies.
323 */
319 prcm_block_contents.cm_autoidle_pll = 324 prcm_block_contents.cm_autoidle_pll =
320 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL); 325 omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE) &
326 ~OMAP3430_AUTO_PERIPH_DPLL_MASK;
321 prcm_block_contents.cm_clksel1_pll = 327 prcm_block_contents.cm_clksel1_pll =
322 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL); 328 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);
323 prcm_block_contents.cm_clksel2_pll = 329 prcm_block_contents.cm_clksel2_pll =
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index a44c5230340..1c240eff391 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -297,8 +297,8 @@ DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
297 297
298/** 298/**
299 * omap3_cpuidle_update_states() - Update the cpuidle states 299 * omap3_cpuidle_update_states() - Update the cpuidle states
300 * @mpu_deepest_state: Enable states upto and including this for mpu domain 300 * @mpu_deepest_state: Enable states up to and including this for mpu domain
301 * @core_deepest_state: Enable states upto and including this for core domain 301 * @core_deepest_state: Enable states up to and including this for core domain
302 * 302 *
303 * This goes through the list of states available and enables and disables the 303 * This goes through the list of states available and enables and disables the
304 * validity of C states based on deepest state that can be achieved for the 304 * validity of C states based on deepest state that can be achieved for the
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 84d1b735fe8..7b855856459 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -253,7 +253,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
253 ARRAY_SIZE(omap_keyboard_latency), 0); 253 ARRAY_SIZE(omap_keyboard_latency), 0);
254 254
255 if (IS_ERR(od)) { 255 if (IS_ERR(od)) {
256 WARN(1, "Cant build omap_device for %s:%s.\n", 256 WARN(1, "Can't build omap_device for %s:%s.\n",
257 name, oh->name); 257 name, oh->name);
258 return PTR_ERR(od); 258 return PTR_ERR(od);
259 } 259 }
@@ -373,7 +373,7 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
373 od = omap_device_build(name, spi_num, oh, pdata, 373 od = omap_device_build(name, spi_num, oh, pdata,
374 sizeof(*pdata), omap_mcspi_latency, 374 sizeof(*pdata), omap_mcspi_latency,
375 ARRAY_SIZE(omap_mcspi_latency), 0); 375 ARRAY_SIZE(omap_mcspi_latency), 0);
376 WARN(IS_ERR(od), "Cant build omap_device for %s:%s\n", 376 WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n",
377 name, oh->name); 377 name, oh->name);
378 kfree(pdata); 378 kfree(pdata);
379 return 0; 379 return 0;
@@ -725,7 +725,7 @@ static int __init omap_init_wdt(void)
725 od = omap_device_build(dev_name, id, oh, NULL, 0, 725 od = omap_device_build(dev_name, id, oh, NULL, 0,
726 omap_wdt_latency, 726 omap_wdt_latency,
727 ARRAY_SIZE(omap_wdt_latency), 0); 727 ARRAY_SIZE(omap_wdt_latency), 0);
728 WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n", 728 WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n",
729 dev_name, oh->name); 729 dev_name, oh->name);
730 return 0; 730 return 0;
731} 731}
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index 34922b2d2e3..c9ff0e79703 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -262,7 +262,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
262 omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0); 262 omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
263 kfree(p); 263 kfree(p);
264 if (IS_ERR(od)) { 264 if (IS_ERR(od)) {
265 pr_err("%s: Cant build omap_device for %s:%s.\n", 265 pr_err("%s: Can't build omap_device for %s:%s.\n",
266 __func__, name, oh->name); 266 __func__, name, oh->name);
267 return PTR_ERR(od); 267 return PTR_ERR(od);
268 } 268 }
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 413de18c1d2..9529842ae05 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -82,7 +82,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
82 kfree(pdata); 82 kfree(pdata);
83 83
84 if (IS_ERR(od)) { 84 if (IS_ERR(od)) {
85 WARN(1, "Cant build omap_device for %s:%s.\n", 85 WARN(1, "Can't build omap_device for %s:%s.\n",
86 name, oh->name); 86 name, oh->name);
87 return PTR_ERR(od); 87 return PTR_ERR(od);
88 } 88 }
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 137e1a5f3d8..b2f30bed5a2 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -465,7 +465,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
465 od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, 465 od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
466 sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); 466 sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
467 if (IS_ERR(od)) { 467 if (IS_ERR(od)) {
468 WARN(1, "Cant build omap_device for %s:%s.\n", name, oh->name); 468 WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
469 kfree(mmc_data->slots[0].name); 469 kfree(mmc_data->slots[0].name);
470 goto done; 470 goto done;
471 } 471 }
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 237e4530abf..3af2b7a1045 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -73,83 +73,18 @@ static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
73 return __raw_readl(bank->base_reg + reg); 73 return __raw_readl(bank->base_reg + reg);
74} 74}
75 75
76static int previous_irq;
77
78/*
79 * On 34xx we can get occasional spurious interrupts if the ack from
80 * an interrupt handler does not get posted before we unmask. Warn about
81 * the interrupt handlers that need to flush posted writes.
82 */
83static int omap_check_spurious(unsigned int irq)
84{
85 u32 sir, spurious;
86
87 sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR);
88 spurious = sir >> 7;
89
90 if (spurious) {
91 printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush "
92 "posted write for irq %i\n",
93 irq, sir, previous_irq);
94 return spurious;
95 }
96
97 return 0;
98}
99
100/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 76/* XXX: FIQ and additional INTC support (only MPU at the moment) */
101static void omap_ack_irq(struct irq_data *d) 77static void omap_ack_irq(struct irq_data *d)
102{ 78{
103 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL); 79 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL);
104} 80}
105 81
106static void omap_mask_irq(struct irq_data *d)
107{
108 unsigned int irq = d->irq;
109 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
110
111 if (cpu_is_omap34xx() && !cpu_is_ti816x()) {
112 int spurious = 0;
113
114 /*
115 * INT_34XX_GPT12_IRQ is also the spurious irq. Maybe because
116 * it is the highest irq number?
117 */
118 if (irq == INT_34XX_GPT12_IRQ)
119 spurious = omap_check_spurious(irq);
120
121 if (!spurious)
122 previous_irq = irq;
123 }
124
125 irq &= (IRQ_BITS_PER_REG - 1);
126
127 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset);
128}
129
130static void omap_unmask_irq(struct irq_data *d)
131{
132 unsigned int irq = d->irq;
133 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
134
135 irq &= (IRQ_BITS_PER_REG - 1);
136
137 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + offset);
138}
139
140static void omap_mask_ack_irq(struct irq_data *d) 82static void omap_mask_ack_irq(struct irq_data *d)
141{ 83{
142 omap_mask_irq(d); 84 irq_gc_mask_disable_reg(d);
143 omap_ack_irq(d); 85 omap_ack_irq(d);
144} 86}
145 87
146static struct irq_chip omap_irq_chip = {
147 .name = "INTC",
148 .irq_ack = omap_mask_ack_irq,
149 .irq_mask = omap_mask_irq,
150 .irq_unmask = omap_unmask_irq,
151};
152
153static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) 88static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
154{ 89{
155 unsigned long tmp; 90 unsigned long tmp;
@@ -186,11 +121,31 @@ int omap_irq_pending(void)
186 return 0; 121 return 0;
187} 122}
188 123
124static __init void
125omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
126{
127 struct irq_chip_generic *gc;
128 struct irq_chip_type *ct;
129
130 gc = irq_alloc_generic_chip("INTC", 1, irq_start, base,
131 handle_level_irq);
132 ct = gc->chip_types;
133 ct->chip.irq_ack = omap_mask_ack_irq;
134 ct->chip.irq_mask = irq_gc_mask_disable_reg;
135 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
136
137 ct->regs.ack = INTC_CONTROL;
138 ct->regs.enable = INTC_MIR_CLEAR0;
139 ct->regs.disable = INTC_MIR_SET0;
140 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
141 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
142}
143
189void __init omap_init_irq(void) 144void __init omap_init_irq(void)
190{ 145{
191 unsigned long nr_of_irqs = 0; 146 unsigned long nr_of_irqs = 0;
192 unsigned int nr_banks = 0; 147 unsigned int nr_banks = 0;
193 int i; 148 int i, j;
194 149
195 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) { 150 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
196 unsigned long base = 0; 151 unsigned long base = 0;
@@ -215,17 +170,15 @@ void __init omap_init_irq(void)
215 170
216 omap_irq_bank_init_one(bank); 171 omap_irq_bank_init_one(bank);
217 172
173 for (i = 0, j = 0; i < bank->nr_irqs; i += 32, j += 0x20)
174 omap_alloc_gc(bank->base_reg + j, i, 32);
175
218 nr_of_irqs += bank->nr_irqs; 176 nr_of_irqs += bank->nr_irqs;
219 nr_banks++; 177 nr_banks++;
220 } 178 }
221 179
222 printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n", 180 printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n",
223 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : ""); 181 nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
224
225 for (i = 0; i < nr_of_irqs; i++) {
226 irq_set_chip_and_handler(i, &omap_irq_chip, handle_level_irq);
227 set_irq_flags(i, IRQF_VALID);
228 }
229} 182}
230 183
231#ifdef CONFIG_ARCH_OMAP3 184#ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 565b9064a32..4a6ef6ab845 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -149,7 +149,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
149 ARRAY_SIZE(omap2_mcbsp_latency), false); 149 ARRAY_SIZE(omap2_mcbsp_latency), false);
150 kfree(pdata); 150 kfree(pdata);
151 if (IS_ERR(od)) { 151 if (IS_ERR(od)) {
152 pr_err("%s: Cant build omap_device for %s:%s.\n", __func__, 152 pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
153 name, oh->name); 153 name, oh->name);
154 return PTR_ERR(od); 154 return PTR_ERR(od);
155 } 155 }
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index bb043cbb388..a4ab1e36431 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -518,7 +518,7 @@ static int omap_mux_dbg_board_show(struct seq_file *s, void *unused)
518 seq_printf(s, "/* %s */\n", m->muxnames[mode]); 518 seq_printf(s, "/* %s */\n", m->muxnames[mode]);
519 519
520 /* 520 /*
521 * XXX: Might be revisited to support differences accross 521 * XXX: Might be revisited to support differences across
522 * same OMAP generation. 522 * same OMAP generation.
523 */ 523 */
524 seq_printf(s, "OMAP%d_MUX(%s, ", omap_gen, m0_def); 524 seq_printf(s, "OMAP%d_MUX(%s, ", omap_gen, m0_def);
diff --git a/arch/arm/mach-omap2/mux2430.h b/arch/arm/mach-omap2/mux2430.h
index adbea0d03e0..9fd93149ebd 100644
--- a/arch/arm/mach-omap2/mux2430.h
+++ b/arch/arm/mach-omap2/mux2430.h
@@ -22,7 +22,7 @@
22 * absolute addresses. The name in the macro is the mode-0 name of 22 * absolute addresses. The name in the macro is the mode-0 name of
23 * the pin. NOTE: These registers are 8-bits wide. 23 * the pin. NOTE: These registers are 8-bits wide.
24 * 24 *
25 * Note that these defines use SDMMC instead of MMC for compability 25 * Note that these defines use SDMMC instead of MMC for compatibility
26 * with signal names used in 3630. 26 * with signal names used in 3630.
27 */ 27 */
28#define OMAP2430_CONTROL_PADCONF_GPMC_CLK_OFFSET 0x000 28#define OMAP2430_CONTROL_PADCONF_GPMC_CLK_OFFSET 0x000
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 8eb3ce1bbfb..c4d0ae87d62 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -1639,6 +1639,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves[] = {
1639 1639
1640static struct omap_hwmod omap2420_gpio1_hwmod = { 1640static struct omap_hwmod omap2420_gpio1_hwmod = {
1641 .name = "gpio1", 1641 .name = "gpio1",
1642 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1642 .mpu_irqs = omap242x_gpio1_irqs, 1643 .mpu_irqs = omap242x_gpio1_irqs,
1643 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs), 1644 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs),
1644 .main_clk = "gpios_fck", 1645 .main_clk = "gpios_fck",
@@ -1669,6 +1670,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio2_slaves[] = {
1669 1670
1670static struct omap_hwmod omap2420_gpio2_hwmod = { 1671static struct omap_hwmod omap2420_gpio2_hwmod = {
1671 .name = "gpio2", 1672 .name = "gpio2",
1673 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1672 .mpu_irqs = omap242x_gpio2_irqs, 1674 .mpu_irqs = omap242x_gpio2_irqs,
1673 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio2_irqs), 1675 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio2_irqs),
1674 .main_clk = "gpios_fck", 1676 .main_clk = "gpios_fck",
@@ -1699,6 +1701,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio3_slaves[] = {
1699 1701
1700static struct omap_hwmod omap2420_gpio3_hwmod = { 1702static struct omap_hwmod omap2420_gpio3_hwmod = {
1701 .name = "gpio3", 1703 .name = "gpio3",
1704 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1702 .mpu_irqs = omap242x_gpio3_irqs, 1705 .mpu_irqs = omap242x_gpio3_irqs,
1703 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio3_irqs), 1706 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio3_irqs),
1704 .main_clk = "gpios_fck", 1707 .main_clk = "gpios_fck",
@@ -1729,6 +1732,7 @@ static struct omap_hwmod_ocp_if *omap2420_gpio4_slaves[] = {
1729 1732
1730static struct omap_hwmod omap2420_gpio4_hwmod = { 1733static struct omap_hwmod omap2420_gpio4_hwmod = {
1731 .name = "gpio4", 1734 .name = "gpio4",
1735 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1732 .mpu_irqs = omap242x_gpio4_irqs, 1736 .mpu_irqs = omap242x_gpio4_irqs,
1733 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio4_irqs), 1737 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio4_irqs),
1734 .main_clk = "gpios_fck", 1738 .main_clk = "gpios_fck",
@@ -1782,7 +1786,7 @@ static struct omap_hwmod_irq_info omap2420_dma_system_irqs[] = {
1782static struct omap_hwmod_addr_space omap2420_dma_system_addrs[] = { 1786static struct omap_hwmod_addr_space omap2420_dma_system_addrs[] = {
1783 { 1787 {
1784 .pa_start = 0x48056000, 1788 .pa_start = 0x48056000,
1785 .pa_end = 0x4a0560ff, 1789 .pa_end = 0x48056fff,
1786 .flags = ADDR_TYPE_RT 1790 .flags = ADDR_TYPE_RT
1787 }, 1791 },
1788}; 1792};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index a860fb5024c..9682dd519f8 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1559,7 +1559,7 @@ static struct omap_hwmod omap2430_i2c1_hwmod = {
1559 * I2CHS IP's do not follow the usual pattern. 1559 * I2CHS IP's do not follow the usual pattern.
1560 * prcm_reg_id alone cannot be used to program 1560 * prcm_reg_id alone cannot be used to program
1561 * the iclk and fclk. Needs to be handled using 1561 * the iclk and fclk. Needs to be handled using
1562 * additonal flags when clk handling is moved 1562 * additional flags when clk handling is moved
1563 * to hwmod framework. 1563 * to hwmod framework.
1564 */ 1564 */
1565 .module_offs = CORE_MOD, 1565 .module_offs = CORE_MOD,
@@ -1742,6 +1742,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio1_slaves[] = {
1742 1742
1743static struct omap_hwmod omap2430_gpio1_hwmod = { 1743static struct omap_hwmod omap2430_gpio1_hwmod = {
1744 .name = "gpio1", 1744 .name = "gpio1",
1745 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1745 .mpu_irqs = omap243x_gpio1_irqs, 1746 .mpu_irqs = omap243x_gpio1_irqs,
1746 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio1_irqs), 1747 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio1_irqs),
1747 .main_clk = "gpios_fck", 1748 .main_clk = "gpios_fck",
@@ -1772,6 +1773,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio2_slaves[] = {
1772 1773
1773static struct omap_hwmod omap2430_gpio2_hwmod = { 1774static struct omap_hwmod omap2430_gpio2_hwmod = {
1774 .name = "gpio2", 1775 .name = "gpio2",
1776 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1775 .mpu_irqs = omap243x_gpio2_irqs, 1777 .mpu_irqs = omap243x_gpio2_irqs,
1776 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio2_irqs), 1778 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio2_irqs),
1777 .main_clk = "gpios_fck", 1779 .main_clk = "gpios_fck",
@@ -1802,6 +1804,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio3_slaves[] = {
1802 1804
1803static struct omap_hwmod omap2430_gpio3_hwmod = { 1805static struct omap_hwmod omap2430_gpio3_hwmod = {
1804 .name = "gpio3", 1806 .name = "gpio3",
1807 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1805 .mpu_irqs = omap243x_gpio3_irqs, 1808 .mpu_irqs = omap243x_gpio3_irqs,
1806 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio3_irqs), 1809 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio3_irqs),
1807 .main_clk = "gpios_fck", 1810 .main_clk = "gpios_fck",
@@ -1832,6 +1835,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio4_slaves[] = {
1832 1835
1833static struct omap_hwmod omap2430_gpio4_hwmod = { 1836static struct omap_hwmod omap2430_gpio4_hwmod = {
1834 .name = "gpio4", 1837 .name = "gpio4",
1838 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1835 .mpu_irqs = omap243x_gpio4_irqs, 1839 .mpu_irqs = omap243x_gpio4_irqs,
1836 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio4_irqs), 1840 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio4_irqs),
1837 .main_clk = "gpios_fck", 1841 .main_clk = "gpios_fck",
@@ -1862,6 +1866,7 @@ static struct omap_hwmod_ocp_if *omap2430_gpio5_slaves[] = {
1862 1866
1863static struct omap_hwmod omap2430_gpio5_hwmod = { 1867static struct omap_hwmod omap2430_gpio5_hwmod = {
1864 .name = "gpio5", 1868 .name = "gpio5",
1869 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1865 .mpu_irqs = omap243x_gpio5_irqs, 1870 .mpu_irqs = omap243x_gpio5_irqs,
1866 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio5_irqs), 1871 .mpu_irqs_cnt = ARRAY_SIZE(omap243x_gpio5_irqs),
1867 .main_clk = "gpio5_fck", 1872 .main_clk = "gpio5_fck",
@@ -1915,7 +1920,7 @@ static struct omap_hwmod_irq_info omap2430_dma_system_irqs[] = {
1915static struct omap_hwmod_addr_space omap2430_dma_system_addrs[] = { 1920static struct omap_hwmod_addr_space omap2430_dma_system_addrs[] = {
1916 { 1921 {
1917 .pa_start = 0x48056000, 1922 .pa_start = 0x48056000,
1918 .pa_end = 0x4a0560ff, 1923 .pa_end = 0x48056fff,
1919 .flags = ADDR_TYPE_RT 1924 .flags = ADDR_TYPE_RT
1920 }, 1925 },
1921}; 1926};
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index b98e2dfcba2..909a84de668 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -2141,6 +2141,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
2141 2141
2142static struct omap_hwmod omap3xxx_gpio1_hwmod = { 2142static struct omap_hwmod omap3xxx_gpio1_hwmod = {
2143 .name = "gpio1", 2143 .name = "gpio1",
2144 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2144 .mpu_irqs = omap3xxx_gpio1_irqs, 2145 .mpu_irqs = omap3xxx_gpio1_irqs,
2145 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio1_irqs), 2146 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio1_irqs),
2146 .main_clk = "gpio1_ick", 2147 .main_clk = "gpio1_ick",
@@ -2177,6 +2178,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = {
2177 2178
2178static struct omap_hwmod omap3xxx_gpio2_hwmod = { 2179static struct omap_hwmod omap3xxx_gpio2_hwmod = {
2179 .name = "gpio2", 2180 .name = "gpio2",
2181 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2180 .mpu_irqs = omap3xxx_gpio2_irqs, 2182 .mpu_irqs = omap3xxx_gpio2_irqs,
2181 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio2_irqs), 2183 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio2_irqs),
2182 .main_clk = "gpio2_ick", 2184 .main_clk = "gpio2_ick",
@@ -2213,6 +2215,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = {
2213 2215
2214static struct omap_hwmod omap3xxx_gpio3_hwmod = { 2216static struct omap_hwmod omap3xxx_gpio3_hwmod = {
2215 .name = "gpio3", 2217 .name = "gpio3",
2218 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2216 .mpu_irqs = omap3xxx_gpio3_irqs, 2219 .mpu_irqs = omap3xxx_gpio3_irqs,
2217 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio3_irqs), 2220 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio3_irqs),
2218 .main_clk = "gpio3_ick", 2221 .main_clk = "gpio3_ick",
@@ -2249,6 +2252,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = {
2249 2252
2250static struct omap_hwmod omap3xxx_gpio4_hwmod = { 2253static struct omap_hwmod omap3xxx_gpio4_hwmod = {
2251 .name = "gpio4", 2254 .name = "gpio4",
2255 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2252 .mpu_irqs = omap3xxx_gpio4_irqs, 2256 .mpu_irqs = omap3xxx_gpio4_irqs,
2253 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio4_irqs), 2257 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio4_irqs),
2254 .main_clk = "gpio4_ick", 2258 .main_clk = "gpio4_ick",
@@ -2285,6 +2289,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = {
2285 2289
2286static struct omap_hwmod omap3xxx_gpio5_hwmod = { 2290static struct omap_hwmod omap3xxx_gpio5_hwmod = {
2287 .name = "gpio5", 2291 .name = "gpio5",
2292 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2288 .mpu_irqs = omap3xxx_gpio5_irqs, 2293 .mpu_irqs = omap3xxx_gpio5_irqs,
2289 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio5_irqs), 2294 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio5_irqs),
2290 .main_clk = "gpio5_ick", 2295 .main_clk = "gpio5_ick",
@@ -2321,6 +2326,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = {
2321 2326
2322static struct omap_hwmod omap3xxx_gpio6_hwmod = { 2327static struct omap_hwmod omap3xxx_gpio6_hwmod = {
2323 .name = "gpio6", 2328 .name = "gpio6",
2329 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
2324 .mpu_irqs = omap3xxx_gpio6_irqs, 2330 .mpu_irqs = omap3xxx_gpio6_irqs,
2325 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio6_irqs), 2331 .mpu_irqs_cnt = ARRAY_SIZE(omap3xxx_gpio6_irqs),
2326 .main_clk = "gpio6_ick", 2332 .main_clk = "gpio6_ick",
@@ -2386,7 +2392,7 @@ static struct omap_hwmod_irq_info omap3xxx_dma_system_irqs[] = {
2386static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = { 2392static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = {
2387 { 2393 {
2388 .pa_start = 0x48056000, 2394 .pa_start = 0x48056000,
2389 .pa_end = 0x4a0560ff, 2395 .pa_end = 0x48056fff,
2390 .flags = ADDR_TYPE_RT 2396 .flags = ADDR_TYPE_RT
2391 }, 2397 },
2392}; 2398};
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 3e88dd3f8ef..abc548a0c98 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -885,7 +885,7 @@ static struct omap_hwmod_ocp_if *omap44xx_dma_system_masters[] = {
885static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = { 885static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = {
886 { 886 {
887 .pa_start = 0x4a056000, 887 .pa_start = 0x4a056000,
888 .pa_end = 0x4a0560ff, 888 .pa_end = 0x4a056fff,
889 .flags = ADDR_TYPE_RT 889 .flags = ADDR_TYPE_RT
890 }, 890 },
891}; 891};
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c
index 5f2da7565b6..4321e793892 100644
--- a/arch/arm/mach-omap2/omap_l3_smx.c
+++ b/arch/arm/mach-omap2/omap_l3_smx.c
@@ -196,11 +196,11 @@ static irqreturn_t omap3_l3_app_irq(int irq, void *_l3)
196 /* No timeout error for debug sources */ 196 /* No timeout error for debug sources */
197 } 197 }
198 198
199 base = ((l3->rt) + (*(omap3_l3_bases[int_type] + err_source)));
200
201 /* identify the error source */ 199 /* identify the error source */
202 for (err_source = 0; !(status & (1 << err_source)); err_source++) 200 for (err_source = 0; !(status & (1 << err_source)); err_source++)
203 ; 201 ;
202
203 base = l3->rt + *(omap3_l3_bases[int_type] + err_source);
204 error = omap3_l3_readll(base, L3_ERROR_LOG); 204 error = omap3_l3_readll(base, L3_ERROR_LOG);
205 205
206 if (error) { 206 if (error) {
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index e2e605fe913..05f6abc96b0 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -112,12 +112,12 @@ int omap4430_phy_power(struct device *dev, int ID, int on)
112 else 112 else
113 /* 113 /*
114 * Enable VBUS Valid, AValid and IDDIG 114 * Enable VBUS Valid, AValid and IDDIG
115 * high impedence 115 * high impedance
116 */ 116 */
117 __raw_writel(IDDIG | AVALID | VBUSVALID, 117 __raw_writel(IDDIG | AVALID | VBUSVALID,
118 ctrl_base + USBOTGHS_CONTROL); 118 ctrl_base + USBOTGHS_CONTROL);
119 } else { 119 } else {
120 /* Enable session END and IDIG to high impedence. */ 120 /* Enable session END and IDIG to high impedance. */
121 __raw_writel(SESSEND | IDDIG, ctrl_base + 121 __raw_writel(SESSEND | IDDIG, ctrl_base +
122 USBOTGHS_CONTROL); 122 USBOTGHS_CONTROL);
123 } 123 }
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 0a8e74e3e81..07d6140baa9 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -308,7 +308,7 @@ int __init omap3_twl_init(void)
308 * Strategy Software Scaling Mode (ENABLE_VMODE=0), for setting the voltages, 308 * Strategy Software Scaling Mode (ENABLE_VMODE=0), for setting the voltages,
309 * in those scenarios this bit is to be cleared (enable = false). 309 * in those scenarios this bit is to be cleared (enable = false).
310 * 310 *
311 * Returns 0 on sucess, error is returned if I2C read/write fails. 311 * Returns 0 on success, error is returned if I2C read/write fails.
312 */ 312 */
313int __init omap3_twl_set_sr_bit(bool enable) 313int __init omap3_twl_set_sr_bit(bool enable)
314{ 314{
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 30af3351c2d..49486f522dc 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -89,6 +89,7 @@ static void omap2_init_processor_devices(void)
89 if (cpu_is_omap44xx()) { 89 if (cpu_is_omap44xx()) {
90 _init_omap_device("l3_main_1", &l3_dev); 90 _init_omap_device("l3_main_1", &l3_dev);
91 _init_omap_device("dsp", &dsp_dev); 91 _init_omap_device("dsp", &dsp_dev);
92 _init_omap_device("iva", &iva_dev);
92 } else { 93 } else {
93 _init_omap_device("l3_main", &l3_dev); 94 _init_omap_device("l3_main", &l3_dev);
94 } 95 }
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 49c6513e90d..9af08473bf1 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -196,7 +196,7 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
196/** 196/**
197 * pwrdm_init - set up the powerdomain layer 197 * pwrdm_init - set up the powerdomain layer
198 * @pwrdm_list: array of struct powerdomain pointers to register 198 * @pwrdm_list: array of struct powerdomain pointers to register
199 * @custom_funcs: func pointers for arch specfic implementations 199 * @custom_funcs: func pointers for arch specific implementations
200 * 200 *
201 * Loop through the array of powerdomains @pwrdm_list, registering all 201 * Loop through the array of powerdomains @pwrdm_list, registering all
202 * that are available on the current CPU. If pwrdm_list is supplied 202 * that are available on the current CPU. If pwrdm_list is supplied
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 027f40bd235..d23d979b9c3 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -121,7 +121,7 @@ struct powerdomain {
121}; 121};
122 122
123/** 123/**
124 * struct pwrdm_ops - Arch specfic function implementations 124 * struct pwrdm_ops - Arch specific function implementations
125 * @pwrdm_set_next_pwrst: Set the target power state for a pd 125 * @pwrdm_set_next_pwrst: Set the target power state for a pd
126 * @pwrdm_read_next_pwrst: Read the target power state set for a pd 126 * @pwrdm_read_next_pwrst: Read the target power state set for a pd
127 * @pwrdm_read_pwrst: Read the current power state of a pd 127 * @pwrdm_read_pwrst: Read the current power state of a pd
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index 9c9c113788b..469a920a74d 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -72,7 +72,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
72 72
73/* 73/*
74 * The USBTLL Save-and-Restore mechanism is broken on 74 * The USBTLL Save-and-Restore mechanism is broken on
75 * 3430s upto ES3.0 and 3630ES1.0. Hence this feature 75 * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
76 * needs to be disabled on these chips. 76 * needs to be disabled on these chips.
77 * Refer: 3430 errata ID i459 and 3630 errata ID i579 77 * Refer: 3430 errata ID i459 and 3630 errata ID i579
78 * 78 *
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 8f674c9442b..13e24f913dd 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -247,7 +247,7 @@ static void sr_stop_vddautocomp(struct omap_sr *sr)
247 * driver register and sr device intializtion API's. Only one call 247 * driver register and sr device intializtion API's. Only one call
248 * will ultimately succeed. 248 * will ultimately succeed.
249 * 249 *
250 * Currenly this function registers interrrupt handler for a particular SR 250 * Currently this function registers interrrupt handler for a particular SR
251 * if smartreflex class driver is already registered and has 251 * if smartreflex class driver is already registered and has
252 * requested for interrupts and the SR interrupt line in present. 252 * requested for interrupts and the SR interrupt line in present.
253 */ 253 */
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index c6facf7becf..0c1552d9d99 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -114,7 +114,6 @@ static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
114 sys_clk_speed /= 1000; 114 sys_clk_speed /= 1000;
115 115
116 /* Generic voltage parameters */ 116 /* Generic voltage parameters */
117 vdd->curr_volt = 1200000;
118 vdd->volt_scale = vp_forceupdate_scale_voltage; 117 vdd->volt_scale = vp_forceupdate_scale_voltage;
119 vdd->vp_enabled = false; 118 vdd->vp_enabled = false;
120 119
@@ -851,7 +850,7 @@ int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
851 * @voltdm: pointer to the VDD whose voltage is to be reset. 850 * @voltdm: pointer to the VDD whose voltage is to be reset.
852 * 851 *
853 * This API finds out the correct voltage the voltage domain is supposed 852 * This API finds out the correct voltage the voltage domain is supposed
854 * to be at and resets the voltage to that level. Should be used expecially 853 * to be at and resets the voltage to that level. Should be used especially
855 * while disabling any voltage compensation modules. 854 * while disabling any voltage compensation modules.
856 */ 855 */
857void omap_voltage_reset(struct voltagedomain *voltdm) 856void omap_voltage_reset(struct voltagedomain *voltdm)
@@ -912,7 +911,7 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
912 * This API searches only through the non-compensated voltages int the 911 * This API searches only through the non-compensated voltages int the
913 * voltage table. 912 * voltage table.
914 * Returns pointer to the voltage table entry corresponding to volt on 913 * Returns pointer to the voltage table entry corresponding to volt on
915 * sucess. Returns -ENODATA if no voltage table exisits for the passed voltage 914 * success. Returns -ENODATA if no voltage table exisits for the passed voltage
916 * domain or if there is no matching entry. 915 * domain or if there is no matching entry.
917 */ 916 */
918struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, 917struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index 1a5d6a0e260..5ceafdccc45 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -19,7 +19,7 @@
19#include "common.h" 19#include "common.h"
20 20
21/* 21/*
22 * The Orion has fully programable address map. There's a separate address 22 * The Orion has fully programmable address map. There's a separate address
23 * map for each of the device _master_ interfaces, e.g. CPU, PCI, PCIe, USB, 23 * map for each of the device _master_ interfaces, e.g. CPU, PCI, PCIe, USB,
24 * Gigabit Ethernet, DMA/XOR engines, etc. Each interface has its own 24 * Gigabit Ethernet, DMA/XOR engines, etc. Each interface has its own
25 * address decode windows that allow it to access any of the Orion resources. 25 * address decode windows that allow it to access any of the Orion resources.
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 986c3bf4e6b..0ab531d047f 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -13,12 +13,11 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/dma-mapping.h>
16#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
17#include <linux/mbus.h> 18#include <linux/mbus.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/mv643xx_i2c.h> 19#include <linux/mv643xx_i2c.h>
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/spi/orion_spi.h>
22#include <net/dsa.h> 21#include <net/dsa.h>
23#include <asm/page.h> 22#include <asm/page.h>
24#include <asm/setup.h> 23#include <asm/setup.h>
@@ -29,11 +28,9 @@
29#include <mach/bridge-regs.h> 28#include <mach/bridge-regs.h>
30#include <mach/hardware.h> 29#include <mach/hardware.h>
31#include <mach/orion5x.h> 30#include <mach/orion5x.h>
32#include <plat/ehci-orion.h>
33#include <plat/mv_xor.h>
34#include <plat/orion_nand.h> 31#include <plat/orion_nand.h>
35#include <plat/orion_wdt.h>
36#include <plat/time.h> 32#include <plat/time.h>
33#include <plat/common.h>
37#include "common.h" 34#include "common.h"
38 35
39/***************************************************************************** 36/*****************************************************************************
@@ -70,530 +67,124 @@ void __init orion5x_map_io(void)
70 67
71 68
72/***************************************************************************** 69/*****************************************************************************
73 * EHCI
74 ****************************************************************************/
75static struct orion_ehci_data orion5x_ehci_data = {
76 .dram = &orion5x_mbus_dram_info,
77 .phy_version = EHCI_PHY_ORION,
78};
79
80static u64 ehci_dmamask = 0xffffffffUL;
81
82
83/*****************************************************************************
84 * EHCI0 70 * EHCI0
85 ****************************************************************************/ 71 ****************************************************************************/
86static struct resource orion5x_ehci0_resources[] = {
87 {
88 .start = ORION5X_USB0_PHYS_BASE,
89 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
90 .flags = IORESOURCE_MEM,
91 }, {
92 .start = IRQ_ORION5X_USB0_CTRL,
93 .end = IRQ_ORION5X_USB0_CTRL,
94 .flags = IORESOURCE_IRQ,
95 },
96};
97
98static struct platform_device orion5x_ehci0 = {
99 .name = "orion-ehci",
100 .id = 0,
101 .dev = {
102 .dma_mask = &ehci_dmamask,
103 .coherent_dma_mask = 0xffffffff,
104 .platform_data = &orion5x_ehci_data,
105 },
106 .resource = orion5x_ehci0_resources,
107 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
108};
109
110void __init orion5x_ehci0_init(void) 72void __init orion5x_ehci0_init(void)
111{ 73{
112 platform_device_register(&orion5x_ehci0); 74 orion_ehci_init(&orion5x_mbus_dram_info,
75 ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL);
113} 76}
114 77
115 78
116/***************************************************************************** 79/*****************************************************************************
117 * EHCI1 80 * EHCI1
118 ****************************************************************************/ 81 ****************************************************************************/
119static struct resource orion5x_ehci1_resources[] = {
120 {
121 .start = ORION5X_USB1_PHYS_BASE,
122 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
123 .flags = IORESOURCE_MEM,
124 }, {
125 .start = IRQ_ORION5X_USB1_CTRL,
126 .end = IRQ_ORION5X_USB1_CTRL,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct platform_device orion5x_ehci1 = {
132 .name = "orion-ehci",
133 .id = 1,
134 .dev = {
135 .dma_mask = &ehci_dmamask,
136 .coherent_dma_mask = 0xffffffff,
137 .platform_data = &orion5x_ehci_data,
138 },
139 .resource = orion5x_ehci1_resources,
140 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
141};
142
143void __init orion5x_ehci1_init(void) 82void __init orion5x_ehci1_init(void)
144{ 83{
145 platform_device_register(&orion5x_ehci1); 84 orion_ehci_1_init(&orion5x_mbus_dram_info,
85 ORION5X_USB1_PHYS_BASE, IRQ_ORION5X_USB1_CTRL);
146} 86}
147 87
148 88
149/***************************************************************************** 89/*****************************************************************************
150 * GigE 90 * GE00
151 ****************************************************************************/ 91 ****************************************************************************/
152struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
153 .dram = &orion5x_mbus_dram_info,
154};
155
156static struct resource orion5x_eth_shared_resources[] = {
157 {
158 .start = ORION5X_ETH_PHYS_BASE + 0x2000,
159 .end = ORION5X_ETH_PHYS_BASE + 0x3fff,
160 .flags = IORESOURCE_MEM,
161 }, {
162 .start = IRQ_ORION5X_ETH_ERR,
163 .end = IRQ_ORION5X_ETH_ERR,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168static struct platform_device orion5x_eth_shared = {
169 .name = MV643XX_ETH_SHARED_NAME,
170 .id = 0,
171 .dev = {
172 .platform_data = &orion5x_eth_shared_data,
173 },
174 .num_resources = ARRAY_SIZE(orion5x_eth_shared_resources),
175 .resource = orion5x_eth_shared_resources,
176};
177
178static struct resource orion5x_eth_resources[] = {
179 {
180 .name = "eth irq",
181 .start = IRQ_ORION5X_ETH_SUM,
182 .end = IRQ_ORION5X_ETH_SUM,
183 .flags = IORESOURCE_IRQ,
184 },
185};
186
187static struct platform_device orion5x_eth = {
188 .name = MV643XX_ETH_NAME,
189 .id = 0,
190 .num_resources = 1,
191 .resource = orion5x_eth_resources,
192 .dev = {
193 .coherent_dma_mask = 0xffffffff,
194 },
195};
196
197void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) 92void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
198{ 93{
199 eth_data->shared = &orion5x_eth_shared; 94 orion_ge00_init(eth_data, &orion5x_mbus_dram_info,
200 orion5x_eth.dev.platform_data = eth_data; 95 ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM,
201 96 IRQ_ORION5X_ETH_ERR, orion5x_tclk);
202 platform_device_register(&orion5x_eth_shared);
203 platform_device_register(&orion5x_eth);
204} 97}
205 98
206 99
207/***************************************************************************** 100/*****************************************************************************
208 * Ethernet switch 101 * Ethernet switch
209 ****************************************************************************/ 102 ****************************************************************************/
210static struct resource orion5x_switch_resources[] = {
211 {
212 .start = 0,
213 .end = 0,
214 .flags = IORESOURCE_IRQ,
215 },
216};
217
218static struct platform_device orion5x_switch_device = {
219 .name = "dsa",
220 .id = 0,
221 .num_resources = 0,
222 .resource = orion5x_switch_resources,
223};
224
225void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq) 103void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
226{ 104{
227 int i; 105 orion_ge00_switch_init(d, irq);
228
229 if (irq != NO_IRQ) {
230 orion5x_switch_resources[0].start = irq;
231 orion5x_switch_resources[0].end = irq;
232 orion5x_switch_device.num_resources = 1;
233 }
234
235 d->netdev = &orion5x_eth.dev;
236 for (i = 0; i < d->nr_chips; i++)
237 d->chip[i].mii_bus = &orion5x_eth_shared.dev;
238 orion5x_switch_device.dev.platform_data = d;
239
240 platform_device_register(&orion5x_switch_device);
241} 106}
242 107
243 108
244/***************************************************************************** 109/*****************************************************************************
245 * I2C 110 * I2C
246 ****************************************************************************/ 111 ****************************************************************************/
247static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
248 .freq_m = 8, /* assumes 166 MHz TCLK */
249 .freq_n = 3,
250 .timeout = 1000, /* Default timeout of 1 second */
251};
252
253static struct resource orion5x_i2c_resources[] = {
254 {
255 .start = I2C_PHYS_BASE,
256 .end = I2C_PHYS_BASE + 0x1f,
257 .flags = IORESOURCE_MEM,
258 }, {
259 .start = IRQ_ORION5X_I2C,
260 .end = IRQ_ORION5X_I2C,
261 .flags = IORESOURCE_IRQ,
262 },
263};
264
265static struct platform_device orion5x_i2c = {
266 .name = MV64XXX_I2C_CTLR_NAME,
267 .id = 0,
268 .num_resources = ARRAY_SIZE(orion5x_i2c_resources),
269 .resource = orion5x_i2c_resources,
270 .dev = {
271 .platform_data = &orion5x_i2c_pdata,
272 },
273};
274
275void __init orion5x_i2c_init(void) 112void __init orion5x_i2c_init(void)
276{ 113{
277 platform_device_register(&orion5x_i2c); 114 orion_i2c_init(I2C_PHYS_BASE, IRQ_ORION5X_I2C, 8);
115
278} 116}
279 117
280 118
281/***************************************************************************** 119/*****************************************************************************
282 * SATA 120 * SATA
283 ****************************************************************************/ 121 ****************************************************************************/
284static struct resource orion5x_sata_resources[] = {
285 {
286 .name = "sata base",
287 .start = ORION5X_SATA_PHYS_BASE,
288 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
289 .flags = IORESOURCE_MEM,
290 }, {
291 .name = "sata irq",
292 .start = IRQ_ORION5X_SATA,
293 .end = IRQ_ORION5X_SATA,
294 .flags = IORESOURCE_IRQ,
295 },
296};
297
298static struct platform_device orion5x_sata = {
299 .name = "sata_mv",
300 .id = 0,
301 .dev = {
302 .coherent_dma_mask = 0xffffffff,
303 },
304 .num_resources = ARRAY_SIZE(orion5x_sata_resources),
305 .resource = orion5x_sata_resources,
306};
307
308void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) 122void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
309{ 123{
310 sata_data->dram = &orion5x_mbus_dram_info; 124 orion_sata_init(sata_data, &orion5x_mbus_dram_info,
311 orion5x_sata.dev.platform_data = sata_data; 125 ORION5X_SATA_PHYS_BASE, IRQ_ORION5X_SATA);
312 platform_device_register(&orion5x_sata);
313} 126}
314 127
315 128
316/***************************************************************************** 129/*****************************************************************************
317 * SPI 130 * SPI
318 ****************************************************************************/ 131 ****************************************************************************/
319static struct orion_spi_info orion5x_spi_plat_data = {
320 .tclk = 0,
321 .enable_clock_fix = 1,
322};
323
324static struct resource orion5x_spi_resources[] = {
325 {
326 .name = "spi base",
327 .start = SPI_PHYS_BASE,
328 .end = SPI_PHYS_BASE + 0x1f,
329 .flags = IORESOURCE_MEM,
330 },
331};
332
333static struct platform_device orion5x_spi = {
334 .name = "orion_spi",
335 .id = 0,
336 .dev = {
337 .platform_data = &orion5x_spi_plat_data,
338 },
339 .num_resources = ARRAY_SIZE(orion5x_spi_resources),
340 .resource = orion5x_spi_resources,
341};
342
343void __init orion5x_spi_init() 132void __init orion5x_spi_init()
344{ 133{
345 platform_device_register(&orion5x_spi); 134 orion_spi_init(SPI_PHYS_BASE, orion5x_tclk);
346} 135}
347 136
348 137
349/***************************************************************************** 138/*****************************************************************************
350 * UART0 139 * UART0
351 ****************************************************************************/ 140 ****************************************************************************/
352static struct plat_serial8250_port orion5x_uart0_data[] = {
353 {
354 .mapbase = UART0_PHYS_BASE,
355 .membase = (char *)UART0_VIRT_BASE,
356 .irq = IRQ_ORION5X_UART0,
357 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
358 .iotype = UPIO_MEM,
359 .regshift = 2,
360 .uartclk = 0,
361 }, {
362 },
363};
364
365static struct resource orion5x_uart0_resources[] = {
366 {
367 .start = UART0_PHYS_BASE,
368 .end = UART0_PHYS_BASE + 0xff,
369 .flags = IORESOURCE_MEM,
370 }, {
371 .start = IRQ_ORION5X_UART0,
372 .end = IRQ_ORION5X_UART0,
373 .flags = IORESOURCE_IRQ,
374 },
375};
376
377static struct platform_device orion5x_uart0 = {
378 .name = "serial8250",
379 .id = PLAT8250_DEV_PLATFORM,
380 .dev = {
381 .platform_data = orion5x_uart0_data,
382 },
383 .resource = orion5x_uart0_resources,
384 .num_resources = ARRAY_SIZE(orion5x_uart0_resources),
385};
386
387void __init orion5x_uart0_init(void) 141void __init orion5x_uart0_init(void)
388{ 142{
389 platform_device_register(&orion5x_uart0); 143 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
144 IRQ_ORION5X_UART0, orion5x_tclk);
390} 145}
391 146
392
393/***************************************************************************** 147/*****************************************************************************
394 * UART1 148 * UART1
395 ****************************************************************************/ 149 ****************************************************************************/
396static struct plat_serial8250_port orion5x_uart1_data[] = {
397 {
398 .mapbase = UART1_PHYS_BASE,
399 .membase = (char *)UART1_VIRT_BASE,
400 .irq = IRQ_ORION5X_UART1,
401 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
402 .iotype = UPIO_MEM,
403 .regshift = 2,
404 .uartclk = 0,
405 }, {
406 },
407};
408
409static struct resource orion5x_uart1_resources[] = {
410 {
411 .start = UART1_PHYS_BASE,
412 .end = UART1_PHYS_BASE + 0xff,
413 .flags = IORESOURCE_MEM,
414 }, {
415 .start = IRQ_ORION5X_UART1,
416 .end = IRQ_ORION5X_UART1,
417 .flags = IORESOURCE_IRQ,
418 },
419};
420
421static struct platform_device orion5x_uart1 = {
422 .name = "serial8250",
423 .id = PLAT8250_DEV_PLATFORM1,
424 .dev = {
425 .platform_data = orion5x_uart1_data,
426 },
427 .resource = orion5x_uart1_resources,
428 .num_resources = ARRAY_SIZE(orion5x_uart1_resources),
429};
430
431void __init orion5x_uart1_init(void) 150void __init orion5x_uart1_init(void)
432{ 151{
433 platform_device_register(&orion5x_uart1); 152 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
153 IRQ_ORION5X_UART1, orion5x_tclk);
434} 154}
435 155
436
437/***************************************************************************** 156/*****************************************************************************
438 * XOR engine 157 * XOR engine
439 ****************************************************************************/ 158 ****************************************************************************/
440struct mv_xor_platform_shared_data orion5x_xor_shared_data = {
441 .dram = &orion5x_mbus_dram_info,
442};
443
444static struct resource orion5x_xor_shared_resources[] = {
445 {
446 .name = "xor low",
447 .start = ORION5X_XOR_PHYS_BASE,
448 .end = ORION5X_XOR_PHYS_BASE + 0xff,
449 .flags = IORESOURCE_MEM,
450 }, {
451 .name = "xor high",
452 .start = ORION5X_XOR_PHYS_BASE + 0x200,
453 .end = ORION5X_XOR_PHYS_BASE + 0x2ff,
454 .flags = IORESOURCE_MEM,
455 },
456};
457
458static struct platform_device orion5x_xor_shared = {
459 .name = MV_XOR_SHARED_NAME,
460 .id = 0,
461 .dev = {
462 .platform_data = &orion5x_xor_shared_data,
463 },
464 .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources),
465 .resource = orion5x_xor_shared_resources,
466};
467
468static u64 orion5x_xor_dmamask = DMA_BIT_MASK(32);
469
470static struct resource orion5x_xor0_resources[] = {
471 [0] = {
472 .start = IRQ_ORION5X_XOR0,
473 .end = IRQ_ORION5X_XOR0,
474 .flags = IORESOURCE_IRQ,
475 },
476};
477
478static struct mv_xor_platform_data orion5x_xor0_data = {
479 .shared = &orion5x_xor_shared,
480 .hw_id = 0,
481 .pool_size = PAGE_SIZE,
482};
483
484static struct platform_device orion5x_xor0_channel = {
485 .name = MV_XOR_NAME,
486 .id = 0,
487 .num_resources = ARRAY_SIZE(orion5x_xor0_resources),
488 .resource = orion5x_xor0_resources,
489 .dev = {
490 .dma_mask = &orion5x_xor_dmamask,
491 .coherent_dma_mask = DMA_BIT_MASK(64),
492 .platform_data = &orion5x_xor0_data,
493 },
494};
495
496static struct resource orion5x_xor1_resources[] = {
497 [0] = {
498 .start = IRQ_ORION5X_XOR1,
499 .end = IRQ_ORION5X_XOR1,
500 .flags = IORESOURCE_IRQ,
501 },
502};
503
504static struct mv_xor_platform_data orion5x_xor1_data = {
505 .shared = &orion5x_xor_shared,
506 .hw_id = 1,
507 .pool_size = PAGE_SIZE,
508};
509
510static struct platform_device orion5x_xor1_channel = {
511 .name = MV_XOR_NAME,
512 .id = 1,
513 .num_resources = ARRAY_SIZE(orion5x_xor1_resources),
514 .resource = orion5x_xor1_resources,
515 .dev = {
516 .dma_mask = &orion5x_xor_dmamask,
517 .coherent_dma_mask = DMA_BIT_MASK(64),
518 .platform_data = &orion5x_xor1_data,
519 },
520};
521
522void __init orion5x_xor_init(void) 159void __init orion5x_xor_init(void)
523{ 160{
524 platform_device_register(&orion5x_xor_shared); 161 orion_xor0_init(&orion5x_mbus_dram_info,
525 162 ORION5X_XOR_PHYS_BASE,
526 /* 163 ORION5X_XOR_PHYS_BASE + 0x200,
527 * two engines can't do memset simultaneously, this limitation 164 IRQ_ORION5X_XOR0, IRQ_ORION5X_XOR1);
528 * satisfied by removing memset support from one of the engines.
529 */
530 dma_cap_set(DMA_MEMCPY, orion5x_xor0_data.cap_mask);
531 dma_cap_set(DMA_XOR, orion5x_xor0_data.cap_mask);
532 platform_device_register(&orion5x_xor0_channel);
533
534 dma_cap_set(DMA_MEMCPY, orion5x_xor1_data.cap_mask);
535 dma_cap_set(DMA_MEMSET, orion5x_xor1_data.cap_mask);
536 dma_cap_set(DMA_XOR, orion5x_xor1_data.cap_mask);
537 platform_device_register(&orion5x_xor1_channel);
538} 165}
539 166
540static struct resource orion5x_crypto_res[] = { 167/*****************************************************************************
541 { 168 * Cryptographic Engines and Security Accelerator (CESA)
542 .name = "regs", 169 ****************************************************************************/
543 .start = ORION5X_CRYPTO_PHYS_BASE, 170static void __init orion5x_crypto_init(void)
544 .end = ORION5X_CRYPTO_PHYS_BASE + 0xffff,
545 .flags = IORESOURCE_MEM,
546 }, {
547 .name = "sram",
548 .start = ORION5X_SRAM_PHYS_BASE,
549 .end = ORION5X_SRAM_PHYS_BASE + SZ_8K - 1,
550 .flags = IORESOURCE_MEM,
551 }, {
552 .name = "crypto interrupt",
553 .start = IRQ_ORION5X_CESA,
554 .end = IRQ_ORION5X_CESA,
555 .flags = IORESOURCE_IRQ,
556 },
557};
558
559static struct platform_device orion5x_crypto_device = {
560 .name = "mv_crypto",
561 .id = -1,
562 .num_resources = ARRAY_SIZE(orion5x_crypto_res),
563 .resource = orion5x_crypto_res,
564};
565
566static int __init orion5x_crypto_init(void)
567{ 171{
568 int ret; 172 int ret;
569 173
570 ret = orion5x_setup_sram_win(); 174 ret = orion5x_setup_sram_win();
571 if (ret) 175 if (ret)
572 return ret; 176 return;
573 177
574 return platform_device_register(&orion5x_crypto_device); 178 orion_crypto_init(ORION5X_CRYPTO_PHYS_BASE, ORION5X_SRAM_PHYS_BASE,
179 SZ_8K, IRQ_ORION5X_CESA);
575} 180}
576 181
577/***************************************************************************** 182/*****************************************************************************
578 * Watchdog 183 * Watchdog
579 ****************************************************************************/ 184 ****************************************************************************/
580static struct orion_wdt_platform_data orion5x_wdt_data = {
581 .tclk = 0,
582};
583
584static struct platform_device orion5x_wdt_device = {
585 .name = "orion_wdt",
586 .id = -1,
587 .dev = {
588 .platform_data = &orion5x_wdt_data,
589 },
590 .num_resources = 0,
591};
592
593void __init orion5x_wdt_init(void) 185void __init orion5x_wdt_init(void)
594{ 186{
595 orion5x_wdt_data.tclk = orion5x_tclk; 187 orion_wdt_init(orion5x_tclk);
596 platform_device_register(&orion5x_wdt_device);
597} 188}
598 189
599 190
@@ -685,11 +276,6 @@ void __init orion5x_init(void)
685 orion5x_id(&dev, &rev, &dev_name); 276 orion5x_id(&dev, &rev, &dev_name);
686 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); 277 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
687 278
688 orion5x_eth_shared_data.t_clk = orion5x_tclk;
689 orion5x_spi_plat_data.tclk = orion5x_tclk;
690 orion5x_uart0_data[0].uartclk = orion5x_tclk;
691 orion5x_uart1_data[0].uartclk = orion5x_tclk;
692
693 /* 279 /*
694 * Setup Orion address map 280 * Setup Orion address map
695 */ 281 */
diff --git a/arch/arm/mach-orion5x/d2net-setup.c b/arch/arm/mach-orion5x/d2net-setup.c
index 42580757930..19cf5bf99f1 100644
--- a/arch/arm/mach-orion5x/d2net-setup.c
+++ b/arch/arm/mach-orion5x/d2net-setup.c
@@ -267,28 +267,28 @@ static struct platform_device d2net_gpio_buttons = {
267 * General Setup 267 * General Setup
268 ****************************************************************************/ 268 ****************************************************************************/
269 269
270static struct orion5x_mpp_mode d2net_mpp_modes[] __initdata = { 270static unsigned int d2net_mpp_modes[] __initdata = {
271 { 0, MPP_GPIO }, /* Board ID (bit 0) */ 271 MPP0_GPIO, /* Board ID (bit 0) */
272 { 1, MPP_GPIO }, /* Board ID (bit 1) */ 272 MPP1_GPIO, /* Board ID (bit 1) */
273 { 2, MPP_GPIO }, /* Board ID (bit 2) */ 273 MPP2_GPIO, /* Board ID (bit 2) */
274 { 3, MPP_GPIO }, /* SATA 0 power */ 274 MPP3_GPIO, /* SATA 0 power */
275 { 4, MPP_UNUSED }, 275 MPP4_UNUSED,
276 { 5, MPP_GPIO }, /* Fan fail detection */ 276 MPP5_GPIO, /* Fan fail detection */
277 { 6, MPP_GPIO }, /* Red front LED */ 277 MPP6_GPIO, /* Red front LED */
278 { 7, MPP_UNUSED }, 278 MPP7_UNUSED,
279 { 8, MPP_GPIO }, /* Rear power switch (on|auto) */ 279 MPP8_GPIO, /* Rear power switch (on|auto) */
280 { 9, MPP_GPIO }, /* Rear power switch (auto|off) */ 280 MPP9_GPIO, /* Rear power switch (auto|off) */
281 { 10, MPP_UNUSED }, 281 MPP10_UNUSED,
282 { 11, MPP_UNUSED }, 282 MPP11_UNUSED,
283 { 12, MPP_GPIO }, /* SATA 1 power */ 283 MPP12_GPIO, /* SATA 1 power */
284 { 13, MPP_UNUSED }, 284 MPP13_UNUSED,
285 { 14, MPP_SATA_LED }, /* SATA 0 active */ 285 MPP14_SATA_LED, /* SATA 0 active */
286 { 15, MPP_SATA_LED }, /* SATA 1 active */ 286 MPP15_SATA_LED, /* SATA 1 active */
287 { 16, MPP_GPIO }, /* Blue front LED blink control */ 287 MPP16_GPIO, /* Blue front LED blink control */
288 { 17, MPP_UNUSED }, 288 MPP17_UNUSED,
289 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */ 289 MPP18_GPIO, /* Front button (0 = Released, 1 = Pushed ) */
290 { 19, MPP_UNUSED }, 290 MPP19_UNUSED,
291 { -1 } 291 0,
292 /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */ 292 /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */
293 /* 23: Blue front LED off */ 293 /* 23: Blue front LED off */
294 /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */ 294 /* 24: Inhibit board power off (0 = Disabled, 1 = Enabled) */
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index b7d4591214e..f95d3cb01cb 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -298,28 +298,28 @@ static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
298/***************************************************************************** 298/*****************************************************************************
299 * General Setup 299 * General Setup
300 ****************************************************************************/ 300 ****************************************************************************/
301static struct orion5x_mpp_mode db88f5281_mpp_modes[] __initdata = { 301static unsigned int db88f5281_mpp_modes[] __initdata = {
302 { 0, MPP_GPIO }, /* USB Over Current */ 302 MPP0_GPIO, /* USB Over Current */
303 { 1, MPP_GPIO }, /* USB Vbat input */ 303 MPP1_GPIO, /* USB Vbat input */
304 { 2, MPP_PCI_ARB }, /* PCI_REQn[2] */ 304 MPP2_PCI_ARB, /* PCI_REQn[2] */
305 { 3, MPP_PCI_ARB }, /* PCI_GNTn[2] */ 305 MPP3_PCI_ARB, /* PCI_GNTn[2] */
306 { 4, MPP_PCI_ARB }, /* PCI_REQn[3] */ 306 MPP4_PCI_ARB, /* PCI_REQn[3] */
307 { 5, MPP_PCI_ARB }, /* PCI_GNTn[3] */ 307 MPP5_PCI_ARB, /* PCI_GNTn[3] */
308 { 6, MPP_GPIO }, /* JP0, CON17.2 */ 308 MPP6_GPIO, /* JP0, CON17.2 */
309 { 7, MPP_GPIO }, /* JP1, CON17.1 */ 309 MPP7_GPIO, /* JP1, CON17.1 */
310 { 8, MPP_GPIO }, /* JP2, CON11.2 */ 310 MPP8_GPIO, /* JP2, CON11.2 */
311 { 9, MPP_GPIO }, /* JP3, CON11.3 */ 311 MPP9_GPIO, /* JP3, CON11.3 */
312 { 10, MPP_GPIO }, /* RTC int */ 312 MPP10_GPIO, /* RTC int */
313 { 11, MPP_GPIO }, /* Baud Rate Generator */ 313 MPP11_GPIO, /* Baud Rate Generator */
314 { 12, MPP_GPIO }, /* PCI int 1 */ 314 MPP12_GPIO, /* PCI int 1 */
315 { 13, MPP_GPIO }, /* PCI int 2 */ 315 MPP13_GPIO, /* PCI int 2 */
316 { 14, MPP_NAND }, /* NAND_REn[2] */ 316 MPP14_NAND, /* NAND_REn[2] */
317 { 15, MPP_NAND }, /* NAND_WEn[2] */ 317 MPP15_NAND, /* NAND_WEn[2] */
318 { 16, MPP_UART }, /* UART1_RX */ 318 MPP16_UART, /* UART1_RX */
319 { 17, MPP_UART }, /* UART1_TX */ 319 MPP17_UART, /* UART1_TX */
320 { 18, MPP_UART }, /* UART1_CTSn */ 320 MPP18_UART, /* UART1_CTSn */
321 { 19, MPP_UART }, /* UART1_RTSn */ 321 MPP19_UART, /* UART1_RTSn */
322 { -1 }, 322 0,
323}; 323};
324 324
325static void __init db88f5281_init(void) 325static void __init db88f5281_init(void)
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 90ab022eabe..855e0e77d56 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -385,76 +385,76 @@ static struct mv_sata_platform_data dns323_sata_data = {
385/**************************************************************************** 385/****************************************************************************
386 * General Setup 386 * General Setup
387 */ 387 */
388static struct orion5x_mpp_mode dns323a_mpp_modes[] __initdata = { 388static unsigned int dns323a_mpp_modes[] __initdata = {
389 { 0, MPP_PCIE_RST_OUTn }, 389 MPP0_PCIE_RST_OUTn,
390 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 390 MPP1_GPIO, /* right amber LED (sata ch0) */
391 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 391 MPP2_GPIO, /* left amber LED (sata ch1) */
392 { 3, MPP_UNUSED }, 392 MPP3_UNUSED,
393 { 4, MPP_GPIO }, /* power button LED */ 393 MPP4_GPIO, /* power button LED */
394 { 5, MPP_GPIO }, /* power button LED */ 394 MPP5_GPIO, /* power button LED */
395 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ 395 MPP6_GPIO, /* GMT G751-2f overtemp */
396 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */ 396 MPP7_GPIO, /* M41T80 nIRQ/OUT/SQW */
397 { 8, MPP_GPIO }, /* triggers power off */ 397 MPP8_GPIO, /* triggers power off */
398 { 9, MPP_GPIO }, /* power button switch */ 398 MPP9_GPIO, /* power button switch */
399 { 10, MPP_GPIO }, /* reset button switch */ 399 MPP10_GPIO, /* reset button switch */
400 { 11, MPP_UNUSED }, 400 MPP11_UNUSED,
401 { 12, MPP_UNUSED }, 401 MPP12_UNUSED,
402 { 13, MPP_UNUSED }, 402 MPP13_UNUSED,
403 { 14, MPP_UNUSED }, 403 MPP14_UNUSED,
404 { 15, MPP_UNUSED }, 404 MPP15_UNUSED,
405 { 16, MPP_UNUSED }, 405 MPP16_UNUSED,
406 { 17, MPP_UNUSED }, 406 MPP17_UNUSED,
407 { 18, MPP_UNUSED }, 407 MPP18_UNUSED,
408 { 19, MPP_UNUSED }, 408 MPP19_UNUSED,
409 { -1 }, 409 0,
410}; 410};
411 411
412static struct orion5x_mpp_mode dns323b_mpp_modes[] __initdata = { 412static unsigned int dns323b_mpp_modes[] __initdata = {
413 { 0, MPP_UNUSED }, 413 MPP0_UNUSED,
414 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 414 MPP1_GPIO, /* right amber LED (sata ch0) */
415 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 415 MPP2_GPIO, /* left amber LED (sata ch1) */
416 { 3, MPP_GPIO }, /* system up flag */ 416 MPP3_GPIO, /* system up flag */
417 { 4, MPP_GPIO }, /* power button LED */ 417 MPP4_GPIO, /* power button LED */
418 { 5, MPP_GPIO }, /* power button LED */ 418 MPP5_GPIO, /* power button LED */
419 { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ 419 MPP6_GPIO, /* GMT G751-2f overtemp */
420 { 7, MPP_GPIO }, /* M41T80 nIRQ/OUT/SQW */ 420 MPP7_GPIO, /* M41T80 nIRQ/OUT/SQW */
421 { 8, MPP_GPIO }, /* triggers power off */ 421 MPP8_GPIO, /* triggers power off */
422 { 9, MPP_GPIO }, /* power button switch */ 422 MPP9_GPIO, /* power button switch */
423 { 10, MPP_GPIO }, /* reset button switch */ 423 MPP10_GPIO, /* reset button switch */
424 { 11, MPP_UNUSED }, 424 MPP11_UNUSED,
425 { 12, MPP_SATA_LED }, 425 MPP12_SATA_LED,
426 { 13, MPP_SATA_LED }, 426 MPP13_SATA_LED,
427 { 14, MPP_SATA_LED }, 427 MPP14_SATA_LED,
428 { 15, MPP_SATA_LED }, 428 MPP15_SATA_LED,
429 { 16, MPP_UNUSED }, 429 MPP16_UNUSED,
430 { 17, MPP_UNUSED }, 430 MPP17_UNUSED,
431 { 18, MPP_UNUSED }, 431 MPP18_UNUSED,
432 { 19, MPP_UNUSED }, 432 MPP19_UNUSED,
433 { -1 }, 433 0,
434}; 434};
435 435
436static struct orion5x_mpp_mode dns323c_mpp_modes[] __initdata = { 436static unsigned int dns323c_mpp_modes[] __initdata = {
437 { 0, MPP_GPIO }, /* ? input */ 437 MPP0_GPIO, /* ? input */
438 { 1, MPP_GPIO }, /* input power switch (0 = pressed) */ 438 MPP1_GPIO, /* input power switch (0 = pressed) */
439 { 2, MPP_GPIO }, /* output power off */ 439 MPP2_GPIO, /* output power off */
440 { 3, MPP_UNUSED }, /* ? output */ 440 MPP3_UNUSED, /* ? output */
441 { 4, MPP_UNUSED }, /* ? output */ 441 MPP4_UNUSED, /* ? output */
442 { 5, MPP_UNUSED }, /* ? output */ 442 MPP5_UNUSED, /* ? output */
443 { 6, MPP_UNUSED }, /* ? output */ 443 MPP6_UNUSED, /* ? output */
444 { 7, MPP_UNUSED }, /* ? output */ 444 MPP7_UNUSED, /* ? output */
445 { 8, MPP_GPIO }, /* i/o right amber LED */ 445 MPP8_GPIO, /* i/o right amber LED */
446 { 9, MPP_GPIO }, /* i/o left amber LED */ 446 MPP9_GPIO, /* i/o left amber LED */
447 { 10, MPP_GPIO }, /* input */ 447 MPP10_GPIO, /* input */
448 { 11, MPP_UNUSED }, 448 MPP11_UNUSED,
449 { 12, MPP_SATA_LED }, 449 MPP12_SATA_LED,
450 { 13, MPP_SATA_LED }, 450 MPP13_SATA_LED,
451 { 14, MPP_SATA_LED }, 451 MPP14_SATA_LED,
452 { 15, MPP_SATA_LED }, 452 MPP15_SATA_LED,
453 { 16, MPP_UNUSED }, 453 MPP16_UNUSED,
454 { 17, MPP_GPIO }, /* power button LED */ 454 MPP17_GPIO, /* power button LED */
455 { 18, MPP_GPIO }, /* fan speed bit 0 */ 455 MPP18_GPIO, /* fan speed bit 0 */
456 { 19, MPP_GPIO }, /* fan speed bit 1 */ 456 MPP19_GPIO, /* fan speed bit 1 */
457 { -1 }, 457 0,
458}; 458};
459 459
460/* Rev C1 Fan speed notes: 460/* Rev C1 Fan speed notes:
diff --git a/arch/arm/mach-orion5x/edmini_v2-setup.c b/arch/arm/mach-orion5x/edmini_v2-setup.c
index d037a90c216..b67cff0d4cf 100644
--- a/arch/arm/mach-orion5x/edmini_v2-setup.c
+++ b/arch/arm/mach-orion5x/edmini_v2-setup.c
@@ -180,31 +180,31 @@ static struct platform_device edmini_v2_gpio_buttons = {
180/***************************************************************************** 180/*****************************************************************************
181 * General Setup 181 * General Setup
182 ****************************************************************************/ 182 ****************************************************************************/
183static struct orion5x_mpp_mode edminiv2_mpp_modes[] __initdata = { 183static unsigned int edminiv2_mpp_modes[] __initdata = {
184 { 0, MPP_UNUSED }, 184 MPP0_UNUSED,
185 { 1, MPP_UNUSED }, 185 MPP1_UNUSED,
186 { 2, MPP_UNUSED }, 186 MPP2_UNUSED,
187 { 3, MPP_GPIO }, /* RTC interrupt */ 187 MPP3_GPIO, /* RTC interrupt */
188 { 4, MPP_UNUSED }, 188 MPP4_UNUSED,
189 { 5, MPP_UNUSED }, 189 MPP5_UNUSED,
190 { 6, MPP_UNUSED }, 190 MPP6_UNUSED,
191 { 7, MPP_UNUSED }, 191 MPP7_UNUSED,
192 { 8, MPP_UNUSED }, 192 MPP8_UNUSED,
193 { 9, MPP_UNUSED }, 193 MPP9_UNUSED,
194 { 10, MPP_UNUSED }, 194 MPP10_UNUSED,
195 { 11, MPP_UNUSED }, 195 MPP11_UNUSED,
196 { 12, MPP_SATA_LED }, /* SATA 0 presence */ 196 MPP12_SATA_LED, /* SATA 0 presence */
197 { 13, MPP_SATA_LED }, /* SATA 1 presence */ 197 MPP13_SATA_LED, /* SATA 1 presence */
198 { 14, MPP_SATA_LED }, /* SATA 0 active */ 198 MPP14_SATA_LED, /* SATA 0 active */
199 { 15, MPP_SATA_LED }, /* SATA 1 active */ 199 MPP15_SATA_LED, /* SATA 1 active */
200 /* 16: Power LED control (0 = On, 1 = Off) */ 200 /* 16: Power LED control (0 = On, 1 = Off) */
201 { 16, MPP_GPIO }, 201 MPP16_GPIO,
202 /* 17: Power LED control select (0 = CPLD, 1 = GPIO16) */ 202 /* 17: Power LED control select (0 = CPLD, 1 = GPIO16) */
203 { 17, MPP_GPIO }, 203 MPP17_GPIO,
204 /* 18: Power button status (0 = Released, 1 = Pressed) */ 204 /* 18: Power button status (0 = Released, 1 = Pressed) */
205 { 18, MPP_GPIO }, 205 MPP18_GPIO,
206 { 19, MPP_UNUSED }, 206 MPP19_UNUSED,
207 { -1 } 207 0,
208}; 208};
209 209
210static void __init edmini_v2_init(void) 210static void __init edmini_v2_init(void)
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 47497c76162..c0eb6462633 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -315,28 +315,28 @@ static void kurobox_pro_power_off(void)
315/***************************************************************************** 315/*****************************************************************************
316 * General Setup 316 * General Setup
317 ****************************************************************************/ 317 ****************************************************************************/
318static struct orion5x_mpp_mode kurobox_pro_mpp_modes[] __initdata = { 318static unsigned int kurobox_pro_mpp_modes[] __initdata = {
319 { 0, MPP_UNUSED }, 319 MPP0_UNUSED,
320 { 1, MPP_UNUSED }, 320 MPP1_UNUSED,
321 { 2, MPP_GPIO }, /* GPIO Micon */ 321 MPP2_GPIO, /* GPIO Micon */
322 { 3, MPP_GPIO }, /* GPIO Rtc */ 322 MPP3_GPIO, /* GPIO Rtc */
323 { 4, MPP_UNUSED }, 323 MPP4_UNUSED,
324 { 5, MPP_UNUSED }, 324 MPP5_UNUSED,
325 { 6, MPP_NAND }, /* NAND Flash REn */ 325 MPP6_NAND, /* NAND Flash REn */
326 { 7, MPP_NAND }, /* NAND Flash WEn */ 326 MPP7_NAND, /* NAND Flash WEn */
327 { 8, MPP_UNUSED }, 327 MPP8_UNUSED,
328 { 9, MPP_UNUSED }, 328 MPP9_UNUSED,
329 { 10, MPP_UNUSED }, 329 MPP10_UNUSED,
330 { 11, MPP_UNUSED }, 330 MPP11_UNUSED,
331 { 12, MPP_SATA_LED }, /* SATA 0 presence */ 331 MPP12_SATA_LED, /* SATA 0 presence */
332 { 13, MPP_SATA_LED }, /* SATA 1 presence */ 332 MPP13_SATA_LED, /* SATA 1 presence */
333 { 14, MPP_SATA_LED }, /* SATA 0 active */ 333 MPP14_SATA_LED, /* SATA 0 active */
334 { 15, MPP_SATA_LED }, /* SATA 1 active */ 334 MPP15_SATA_LED, /* SATA 1 active */
335 { 16, MPP_UART }, /* UART1 RXD */ 335 MPP16_UART, /* UART1 RXD */
336 { 17, MPP_UART }, /* UART1 TXD */ 336 MPP17_UART, /* UART1 TXD */
337 { 18, MPP_UART }, /* UART1 CTSn */ 337 MPP18_UART, /* UART1 CTSn */
338 { 19, MPP_UART }, /* UART1 RTSn */ 338 MPP19_UART, /* UART1 RTSn */
339 { -1 }, 339 0,
340}; 340};
341 341
342static void __init kurobox_pro_init(void) 342static void __init kurobox_pro_init(void)
diff --git a/arch/arm/mach-orion5x/ls-chl-setup.c b/arch/arm/mach-orion5x/ls-chl-setup.c
index 6ae12aa6d75..5065803ca82 100644
--- a/arch/arm/mach-orion5x/ls-chl-setup.c
+++ b/arch/arm/mach-orion5x/ls-chl-setup.c
@@ -251,28 +251,28 @@ static struct platform_device lschl_fan_device = {
251 * GPIO Data 251 * GPIO Data
252 ****************************************************************************/ 252 ****************************************************************************/
253 253
254static struct orion5x_mpp_mode lschl_mpp_modes[] __initdata = { 254static unsigned int lschl_mpp_modes[] __initdata = {
255 { 0, MPP_GPIO }, /* LED POWER */ 255 MPP0_GPIO, /* LED POWER */
256 { 1, MPP_GPIO }, /* HDD POWER */ 256 MPP1_GPIO, /* HDD POWER */
257 { 2, MPP_GPIO }, /* LED ALARM */ 257 MPP2_GPIO, /* LED ALARM */
258 { 3, MPP_GPIO }, /* LED INFO */ 258 MPP3_GPIO, /* LED INFO */
259 { 4, MPP_UNUSED }, 259 MPP4_UNUSED,
260 { 5, MPP_UNUSED }, 260 MPP5_UNUSED,
261 { 6, MPP_GPIO }, /* FAN LOCK */ 261 MPP6_GPIO, /* FAN LOCK */
262 { 7, MPP_GPIO }, /* SW INIT */ 262 MPP7_GPIO, /* SW INIT */
263 { 8, MPP_GPIO }, /* SW POWER */ 263 MPP8_GPIO, /* SW POWER */
264 { 9, MPP_GPIO }, /* USB POWER */ 264 MPP9_GPIO, /* USB POWER */
265 { 10, MPP_GPIO }, /* SW AUTO POWER */ 265 MPP10_GPIO, /* SW AUTO POWER */
266 { 11, MPP_UNUSED }, 266 MPP11_UNUSED,
267 { 12, MPP_UNUSED }, 267 MPP12_UNUSED,
268 { 13, MPP_UNUSED }, 268 MPP13_UNUSED,
269 { 14, MPP_GPIO }, /* FAN HIGH */ 269 MPP14_GPIO, /* FAN HIGH */
270 { 15, MPP_GPIO }, /* SW FUNC */ 270 MPP15_GPIO, /* SW FUNC */
271 { 16, MPP_GPIO }, /* FAN LOW */ 271 MPP16_GPIO, /* FAN LOW */
272 { 17, MPP_GPIO }, /* LED FUNC */ 272 MPP17_GPIO, /* LED FUNC */
273 { 18, MPP_UNUSED }, 273 MPP18_UNUSED,
274 { 19, MPP_UNUSED }, 274 MPP19_UNUSED,
275 { -1 }, 275 0,
276}; 276};
277 277
278static void __init lschl_init(void) 278static void __init lschl_init(void)
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
index 7adafd79cf9..8503d0a42d4 100644
--- a/arch/arm/mach-orion5x/ls_hgl-setup.c
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -200,28 +200,28 @@ static void ls_hgl_power_off(void)
200 200
201#define LS_HGL_GPIO_HDD_POWER 1 201#define LS_HGL_GPIO_HDD_POWER 1
202 202
203static struct orion5x_mpp_mode ls_hgl_mpp_modes[] __initdata = { 203static unsigned int ls_hgl_mpp_modes[] __initdata = {
204 { 0, MPP_GPIO }, /* LED_PWR */ 204 MPP0_GPIO, /* LED_PWR */
205 { 1, MPP_GPIO }, /* HDD_PWR */ 205 MPP1_GPIO, /* HDD_PWR */
206 { 2, MPP_GPIO }, /* LED_ALARM */ 206 MPP2_GPIO, /* LED_ALARM */
207 { 3, MPP_GPIO }, /* LED_INFO */ 207 MPP3_GPIO, /* LED_INFO */
208 { 4, MPP_UNUSED }, 208 MPP4_UNUSED,
209 { 5, MPP_UNUSED }, 209 MPP5_UNUSED,
210 { 6, MPP_GPIO }, /* FAN_LCK */ 210 MPP6_GPIO, /* FAN_LCK */
211 { 7, MPP_GPIO }, /* INIT */ 211 MPP7_GPIO, /* INIT */
212 { 8, MPP_GPIO }, /* POWER */ 212 MPP8_GPIO, /* POWER */
213 { 9, MPP_GPIO }, /* USB_PWR */ 213 MPP9_GPIO, /* USB_PWR */
214 { 10, MPP_GPIO }, /* AUTO_POWER */ 214 MPP10_GPIO, /* AUTO_POWER */
215 { 11, MPP_UNUSED }, /* LED_ETH (dummy) */ 215 MPP11_UNUSED, /* LED_ETH (dummy) */
216 { 12, MPP_UNUSED }, 216 MPP12_UNUSED,
217 { 13, MPP_UNUSED }, 217 MPP13_UNUSED,
218 { 14, MPP_UNUSED }, 218 MPP14_UNUSED,
219 { 15, MPP_GPIO }, /* FUNC */ 219 MPP15_GPIO, /* FUNC */
220 { 16, MPP_UNUSED }, 220 MPP16_UNUSED,
221 { 17, MPP_GPIO }, /* LED_FUNC */ 221 MPP17_GPIO, /* LED_FUNC */
222 { 18, MPP_UNUSED }, 222 MPP18_UNUSED,
223 { 19, MPP_UNUSED }, 223 MPP19_UNUSED,
224 { -1 }, 224 0,
225}; 225};
226 226
227static void __init ls_hgl_init(void) 227static void __init ls_hgl_init(void)
diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c
index 869958f5c39..9c82723c05c 100644
--- a/arch/arm/mach-orion5x/lsmini-setup.c
+++ b/arch/arm/mach-orion5x/lsmini-setup.c
@@ -201,28 +201,28 @@ static void lsmini_power_off(void)
201#define LSMINI_GPIO_HDD_POWER0 1 201#define LSMINI_GPIO_HDD_POWER0 1
202#define LSMINI_GPIO_HDD_POWER1 19 202#define LSMINI_GPIO_HDD_POWER1 19
203 203
204static struct orion5x_mpp_mode lsmini_mpp_modes[] __initdata = { 204static unsigned int lsmini_mpp_modes[] __initdata = {
205 { 0, MPP_UNUSED }, /* LED_RESERVE1 (unused) */ 205 MPP0_UNUSED, /* LED_RESERVE1 (unused) */
206 { 1, MPP_GPIO }, /* HDD_PWR */ 206 MPP1_GPIO, /* HDD_PWR */
207 { 2, MPP_GPIO }, /* LED_ALARM */ 207 MPP2_GPIO, /* LED_ALARM */
208 { 3, MPP_GPIO }, /* LED_INFO */ 208 MPP3_GPIO, /* LED_INFO */
209 { 4, MPP_UNUSED }, 209 MPP4_UNUSED,
210 { 5, MPP_UNUSED }, 210 MPP5_UNUSED,
211 { 6, MPP_UNUSED }, 211 MPP6_UNUSED,
212 { 7, MPP_UNUSED }, 212 MPP7_UNUSED,
213 { 8, MPP_UNUSED }, 213 MPP8_UNUSED,
214 { 9, MPP_GPIO }, /* LED_FUNC */ 214 MPP9_GPIO, /* LED_FUNC */
215 { 10, MPP_UNUSED }, 215 MPP10_UNUSED,
216 { 11, MPP_UNUSED }, /* LED_ETH (dummy) */ 216 MPP11_UNUSED, /* LED_ETH (dummy) */
217 { 12, MPP_UNUSED }, 217 MPP12_UNUSED,
218 { 13, MPP_UNUSED }, 218 MPP13_UNUSED,
219 { 14, MPP_GPIO }, /* LED_PWR */ 219 MPP14_GPIO, /* LED_PWR */
220 { 15, MPP_GPIO }, /* FUNC */ 220 MPP15_GPIO, /* FUNC */
221 { 16, MPP_GPIO }, /* USB_PWR */ 221 MPP16_GPIO, /* USB_PWR */
222 { 17, MPP_GPIO }, /* AUTO_POWER */ 222 MPP17_GPIO, /* AUTO_POWER */
223 { 18, MPP_GPIO }, /* POWER */ 223 MPP18_GPIO, /* POWER */
224 { 19, MPP_GPIO }, /* HDD_PWR1 */ 224 MPP19_GPIO, /* HDD_PWR1 */
225 { -1 }, 225 0,
226}; 226};
227 227
228static void __init lsmini_init(void) 228static void __init lsmini_init(void)
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
index 2288207726e..f12c41b98d4 100644
--- a/arch/arm/mach-orion5x/mpp.c
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -12,154 +12,34 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/gpio.h>
16#include <mach/hardware.h> 15#include <mach/hardware.h>
17#include "common.h" 16#include <plat/mpp.h>
18#include "mpp.h" 17#include "mpp.h"
18#include "common.h"
19 19
20static int is_5181l(void) 20static unsigned int __init orion5x_variant(void)
21{
22 u32 dev;
23 u32 rev;
24
25 orion5x_pcie_id(&dev, &rev);
26
27 return !!(dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0);
28}
29
30static int is_5182(void)
31{ 21{
32 u32 dev; 22 u32 dev;
33 u32 rev; 23 u32 rev;
34 24
35 orion5x_pcie_id(&dev, &rev); 25 orion5x_pcie_id(&dev, &rev);
36 26
37 return !!(dev == MV88F5182_DEV_ID); 27 if (dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0)
38} 28 return MPP_F5181_MASK;
39 29
40static int is_5281(void) 30 if (dev == MV88F5182_DEV_ID)
41{ 31 return MPP_F5182_MASK;
42 u32 dev;
43 u32 rev;
44 32
45 orion5x_pcie_id(&dev, &rev); 33 if (dev == MV88F5281_DEV_ID)
34 return MPP_F5281_MASK;
46 35
47 return !!(dev == MV88F5281_DEV_ID); 36 printk(KERN_ERR "MPP setup: unknown orion5x variant "
37 "(dev %#x rev %#x)\n", dev, rev);
38 return 0;
48} 39}
49 40
50static int __init determine_type_encoding(int mpp, enum orion5x_mpp_type type) 41void __init orion5x_mpp_conf(unsigned int *mpp_list)
51{ 42{
52 switch (type) { 43 orion_mpp_conf(mpp_list, orion5x_variant(),
53 case MPP_UNUSED: 44 MPP_MAX, ORION5X_DEV_BUS_VIRT_BASE);
54 case MPP_GPIO:
55 if (mpp == 0)
56 return 3;
57 if (mpp >= 1 && mpp <= 15)
58 return 0;
59 if (mpp >= 16 && mpp <= 19) {
60 if (is_5182())
61 return 5;
62 if (type == MPP_UNUSED)
63 return 0;
64 }
65 return -1;
66
67 case MPP_PCIE_RST_OUTn:
68 if (mpp == 0)
69 return 0;
70 return -1;
71
72 case MPP_PCI_ARB:
73 if (mpp >= 0 && mpp <= 7)
74 return 2;
75 return -1;
76
77 case MPP_PCI_PMEn:
78 if (mpp == 2)
79 return 3;
80 return -1;
81
82 case MPP_GIGE:
83 if (mpp >= 8 && mpp <= 19)
84 return 1;
85 return -1;
86
87 case MPP_NAND:
88 if (is_5182() || is_5281()) {
89 if (mpp >= 4 && mpp <= 7)
90 return 4;
91 if (mpp >= 12 && mpp <= 17)
92 return 4;
93 }
94 return -1;
95
96 case MPP_PCI_CLK:
97 if (is_5181l() && mpp >= 6 && mpp <= 7)
98 return 5;
99 return -1;
100
101 case MPP_SATA_LED:
102 if (is_5182()) {
103 if (mpp >= 4 && mpp <= 7)
104 return 5;
105 if (mpp >= 12 && mpp <= 15)
106 return 5;
107 }
108 return -1;
109
110 case MPP_UART:
111 if (mpp >= 16 && mpp <= 19)
112 return 0;
113 return -1;
114 }
115
116 printk(KERN_INFO "unknown MPP type %d\n", type);
117
118 return -1;
119}
120
121void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
122{
123 u32 mpp_0_7_ctrl = readl(MPP_0_7_CTRL);
124 u32 mpp_8_15_ctrl = readl(MPP_8_15_CTRL);
125 u32 mpp_16_19_ctrl = readl(MPP_16_19_CTRL);
126
127 for ( ; mode->mpp >= 0; mode++) {
128 u32 *reg;
129 int num_type;
130 int shift;
131
132 if (mode->mpp >= 0 && mode->mpp <= 7)
133 reg = &mpp_0_7_ctrl;
134 else if (mode->mpp >= 8 && mode->mpp <= 15)
135 reg = &mpp_8_15_ctrl;
136 else if (mode->mpp >= 16 && mode->mpp <= 19)
137 reg = &mpp_16_19_ctrl;
138 else {
139 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
140 "(%d)\n", mode->mpp);
141 continue;
142 }
143
144 num_type = determine_type_encoding(mode->mpp, mode->type);
145 if (num_type < 0) {
146 printk(KERN_ERR "orion5x_mpp_conf: invalid MPP "
147 "combination (%d, %d)\n", mode->mpp,
148 mode->type);
149 continue;
150 }
151
152 shift = (mode->mpp & 7) << 2;
153 *reg &= ~(0xf << shift);
154 *reg |= (num_type & 0xf) << shift;
155
156 if (mode->type == MPP_UNUSED && (mode->mpp < 16 || is_5182()))
157 orion_gpio_set_unused(mode->mpp);
158
159 orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
160 }
161
162 writel(mpp_0_7_ctrl, MPP_0_7_CTRL);
163 writel(mpp_8_15_ctrl, MPP_8_15_CTRL);
164 writel(mpp_16_19_ctrl, MPP_16_19_CTRL);
165} 45}
diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h
index 290e610dc01..eac68978a2c 100644
--- a/arch/arm/mach-orion5x/mpp.h
+++ b/arch/arm/mach-orion5x/mpp.h
@@ -1,74 +1,129 @@
1#ifndef __ARCH_ORION5X_MPP_H 1#ifndef __ARCH_ORION5X_MPP_H
2#define __ARCH_ORION5X_MPP_H 2#define __ARCH_ORION5X_MPP_H
3 3
4enum orion5x_mpp_type { 4#define MPP(_num, _sel, _in, _out, _F5181l, _F5182, _F5281) ( \
5 /* 5 /* MPP number */ ((_num) & 0xff) | \
6 * This MPP is unused. 6 /* MPP select value */ (((_sel) & 0xf) << 8) | \
7 */ 7 /* may be input signal */ ((!!(_in)) << 12) | \
8 MPP_UNUSED, 8 /* may be output signal */ ((!!(_out)) << 13) | \
9 9 /* available on F5181l */ ((!!(_F5181l)) << 14) | \
10 /* 10 /* available on F5182 */ ((!!(_F5182)) << 15) | \
11 * This MPP pin is used as a generic GPIO pin. Valid for 11 /* available on F5281 */ ((!!(_F5281)) << 16))
12 * MPPs 0-15 and device bus data pins 16-31. On 5182, also
13 * valid for MPPs 16-19.
14 */
15 MPP_GPIO,
16
17 /*
18 * This MPP is used as PCIe_RST_OUTn pin. Valid for
19 * MPP 0 only.
20 */
21 MPP_PCIE_RST_OUTn,
22
23 /*
24 * This MPP is used as PCI arbiter pin (REQn/GNTn).
25 * Valid for MPPs 0-7 only.
26 */
27 MPP_PCI_ARB,
28
29 /*
30 * This MPP is used as PCI_PMEn pin. Valid for MPP 2 only.
31 */
32 MPP_PCI_PMEn,
33
34 /*
35 * This MPP is used as GigE half-duplex (COL, CRS) or GMII
36 * (RXERR, CRS, TXERR, TXD[7:4], RXD[7:4]) pin. Valid for
37 * MPPs 8-19 only.
38 */
39 MPP_GIGE,
40
41 /*
42 * This MPP is used as NAND REn/WEn pin. Valid for MPPs
43 * 4-7 and 12-17 only, and only on the 5181l/5182/5281.
44 */
45 MPP_NAND,
46
47 /*
48 * This MPP is used as a PCI clock output pin. Valid for
49 * MPPs 6-7 only, and only on the 5181l.
50 */
51 MPP_PCI_CLK,
52
53 /*
54 * This MPP is used as a SATA presence/activity LED.
55 * Valid for MPPs 4-7 and 12-15 only, and only on the 5182.
56 */
57 MPP_SATA_LED,
58
59 /*
60 * This MPP is used as UART1 RXD/TXD/CTSn/RTSn pin.
61 * Valid for MPPs 16-19 only.
62 */
63 MPP_UART,
64};
65
66struct orion5x_mpp_mode {
67 int mpp;
68 enum orion5x_mpp_type type;
69};
70
71void orion5x_mpp_conf(struct orion5x_mpp_mode *mode);
72 12
13 /* num sel i o 5181 5182 5281 */
14
15#define MPP_F5181_MASK MPP(0, 0x0, 0, 0, 1, 0, 0)
16#define MPP_F5182_MASK MPP(0, 0x0, 0, 0, 0, 1, 0)
17#define MPP_F5281_MASK MPP(0, 0x0, 0, 0, 0, 0, 1)
18
19#define MPP0_UNUSED MPP(0, 0x3, 0, 0, 1, 1, 1)
20#define MPP0_GPIO MPP(0, 0x3, 1, 1, 1, 1, 1)
21#define MPP0_PCIE_RST_OUTn MPP(0, 0x0, 0, 0, 1, 1, 1)
22#define MPP0_PCI_ARB MPP(0, 0x2, 0, 0, 1, 1, 1)
23
24#define MPP1_UNUSED MPP(1, 0x0, 0, 0, 1, 1, 1)
25#define MPP1_GPIO MPP(1, 0x0, 1, 1, 1, 1, 1)
26#define MPP1_PCI_ARB MPP(1, 0x2, 0, 0, 1, 1, 1)
27
28#define MPP2_UNUSED MPP(2, 0x0, 0, 0, 1, 1, 1)
29#define MPP2_GPIO MPP(2, 0x0, 1, 1, 1, 1, 1)
30#define MPP2_PCI_ARB MPP(2, 0x2, 0, 0, 1, 1, 1)
31#define MPP2_PCI_PMEn MPP(2, 0x3, 0, 0, 1, 1, 1)
32
33#define MPP3_UNUSED MPP(3, 0x0, 0, 0, 1, 1, 1)
34#define MPP3_GPIO MPP(3, 0x0, 1, 1, 1, 1, 1)
35#define MPP3_PCI_ARB MPP(3, 0x2, 0, 0, 1, 1, 1)
36
37#define MPP4_UNUSED MPP(4, 0x0, 0, 0, 1, 1, 1)
38#define MPP4_GPIO MPP(4, 0x0, 1, 1, 1, 1, 1)
39#define MPP4_PCI_ARB MPP(4, 0x2, 0, 0, 1, 1, 1)
40#define MPP4_NAND MPP(4, 0x4, 0, 0, 0, 1, 1)
41#define MPP4_SATA_LED MPP(4, 0x5, 0, 0, 0, 1, 0)
42
43#define MPP5_UNUSED MPP(5, 0x0, 0, 0, 1, 1, 1)
44#define MPP5_GPIO MPP(5, 0x0, 1, 1, 1, 1, 1)
45#define MPP5_PCI_ARB MPP(5, 0x2, 0, 0, 1, 1, 1)
46#define MPP5_NAND MPP(5, 0x4, 0, 0, 0, 1, 1)
47#define MPP5_SATA_LED MPP(5, 0x5, 0, 0, 0, 1, 0)
48
49#define MPP6_UNUSED MPP(6, 0x0, 0, 0, 1, 1, 1)
50#define MPP6_GPIO MPP(6, 0x0, 1, 1, 1, 1, 1)
51#define MPP6_PCI_ARB MPP(6, 0x2, 0, 0, 1, 1, 1)
52#define MPP6_NAND MPP(6, 0x4, 0, 0, 0, 1, 1)
53#define MPP6_PCI_CLK MPP(6, 0x5, 0, 0, 1, 0, 0)
54#define MPP6_SATA_LED MPP(6, 0x5, 0, 0, 0, 1, 0)
55
56#define MPP7_UNUSED MPP(7, 0x0, 0, 0, 1, 1, 1)
57#define MPP7_GPIO MPP(7, 0x0, 1, 1, 1, 1, 1)
58#define MPP7_PCI_ARB MPP(7, 0x2, 0, 0, 1, 1, 1)
59#define MPP7_NAND MPP(7, 0x4, 0, 0, 0, 1, 1)
60#define MPP7_PCI_CLK MPP(7, 0x5, 0, 0, 1, 0, 0)
61#define MPP7_SATA_LED MPP(7, 0x5, 0, 0, 0, 1, 0)
62
63#define MPP8_UNUSED MPP(8, 0x0, 0, 0, 1, 1, 1)
64#define MPP8_GPIO MPP(8, 0x0, 1, 1, 1, 1, 1)
65#define MPP8_GIGE MPP(8, 0x1, 0, 0, 1, 1, 1)
66
67#define MPP9_UNUSED MPP(9, 0x0, 0, 0, 1, 1, 1)
68#define MPP9_GPIO MPP(9, 0x0, 0, 0, 1, 1, 1)
69#define MPP9_GIGE MPP(9, 0x1, 1, 1, 1, 1, 1)
70
71#define MPP10_UNUSED MPP(10, 0x0, 0, 0, 1, 1, 1)
72#define MPP10_GPIO MPP(10, 0x0, 1, 1, 1, 1, 1)
73#define MPP10_GIGE MPP(10, 0x1, 0, 0, 1, 1, 1)
74
75#define MPP11_UNUSED MPP(11, 0x0, 0, 0, 1, 1, 1)
76#define MPP11_GPIO MPP(11, 0x0, 1, 1, 1, 1, 1)
77#define MPP11_GIGE MPP(11, 0x1, 0, 0, 1, 1, 1)
78
79#define MPP12_UNUSED MPP(12, 0x0, 0, 0, 1, 1, 1)
80#define MPP12_GPIO MPP(12, 0x0, 1, 1, 1, 1, 1)
81#define MPP12_GIGE MPP(12, 0x1, 0, 0, 1, 1, 1)
82#define MPP12_NAND MPP(12, 0x4, 0, 0, 0, 1, 1)
83#define MPP12_SATA_LED MPP(12, 0x5, 0, 0, 0, 1, 0)
84
85#define MPP13_UNUSED MPP(13, 0x0, 0, 0, 1, 1, 1)
86#define MPP13_GPIO MPP(13, 0x0, 1, 1, 1, 1, 1)
87#define MPP13_GIGE MPP(13, 0x1, 0, 0, 1, 1, 1)
88#define MPP13_NAND MPP(13, 0x4, 0, 0, 0, 1, 1)
89#define MPP13_SATA_LED MPP(13, 0x5, 0, 0, 0, 1, 0)
90
91#define MPP14_UNUSED MPP(14, 0x0, 0, 0, 1, 1, 1)
92#define MPP14_GPIO MPP(14, 0x0, 1, 1, 1, 1, 1)
93#define MPP14_GIGE MPP(14, 0x1, 0, 0, 1, 1, 1)
94#define MPP14_NAND MPP(14, 0x4, 0, 0, 0, 1, 1)
95#define MPP14_SATA_LED MPP(14, 0x5, 0, 0, 0, 1, 0)
96
97#define MPP15_UNUSED MPP(15, 0x0, 0, 0, 1, 1, 1)
98#define MPP15_GPIO MPP(15, 0x0, 1, 1, 1, 1, 1)
99#define MPP15_GIGE MPP(15, 0x1, 0, 0, 1, 1, 1)
100#define MPP15_NAND MPP(15, 0x4, 0, 0, 0, 1, 1)
101#define MPP15_SATA_LED MPP(15, 0x5, 0, 0, 0, 1, 0)
102
103#define MPP16_UNUSED MPP(16, 0x0, 0, 0, 1, 1, 1)
104#define MPP16_GPIO MPP(16, 0x5, 1, 1, 0, 1, 0)
105#define MPP16_GIGE MPP(16, 0x1, 0, 0, 1, 1, 1)
106#define MPP16_NAND MPP(16, 0x4, 0, 0, 0, 1, 1)
107#define MPP16_UART MPP(16, 0x0, 0, 0, 0, 1, 1)
108
109#define MPP17_UNUSED MPP(17, 0x0, 0, 0, 1, 1, 1)
110#define MPP17_GPIO MPP(17, 0x5, 1, 1, 0, 1, 0)
111#define MPP17_GIGE MPP(17, 0x1, 0, 0, 1, 1, 1)
112#define MPP17_NAND MPP(17, 0x4, 0, 0, 0, 1, 1)
113#define MPP17_UART MPP(17, 0x0, 0, 0, 0, 1, 1)
114
115#define MPP18_UNUSED MPP(18, 0x0, 0, 0, 1, 1, 1)
116#define MPP18_GPIO MPP(18, 0x5, 1, 1, 0, 1, 0)
117#define MPP18_GIGE MPP(18, 0x1, 0, 0, 1, 1, 1)
118#define MPP18_UART MPP(18, 0x0, 0, 0, 0, 1, 1)
119
120#define MPP19_UNUSED MPP(19, 0x0, 0, 0, 1, 1, 1)
121#define MPP19_GPIO MPP(19, 0x5, 1, 1, 0, 1, 0)
122#define MPP19_GIGE MPP(19, 0x1, 0, 0, 1, 1, 1)
123#define MPP19_UART MPP(19, 0x0, 0, 0, 0, 1, 1)
124
125#define MPP_MAX 19
126
127void orion5x_mpp_conf(unsigned int *mpp_list);
73 128
74#endif 129#endif
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
index b43b208153c..59263b73d1e 100644
--- a/arch/arm/mach-orion5x/mss2-setup.c
+++ b/arch/arm/mach-orion5x/mss2-setup.c
@@ -193,28 +193,28 @@ static void mss2_power_off(void)
193/**************************************************************************** 193/****************************************************************************
194 * General Setup 194 * General Setup
195 ****************************************************************************/ 195 ****************************************************************************/
196static struct orion5x_mpp_mode mss2_mpp_modes[] __initdata = { 196static unsigned int mss2_mpp_modes[] __initdata = {
197 { 0, MPP_GPIO }, /* Power LED */ 197 MPP0_GPIO, /* Power LED */
198 { 1, MPP_GPIO }, /* Error LED */ 198 MPP1_GPIO, /* Error LED */
199 { 2, MPP_UNUSED }, 199 MPP2_UNUSED,
200 { 3, MPP_GPIO }, /* RTC interrupt */ 200 MPP3_GPIO, /* RTC interrupt */
201 { 4, MPP_GPIO }, /* HDD ind. (Single/Dual)*/ 201 MPP4_GPIO, /* HDD ind. (Single/Dual)*/
202 { 5, MPP_GPIO }, /* HD0 5V control */ 202 MPP5_GPIO, /* HD0 5V control */
203 { 6, MPP_GPIO }, /* HD0 12V control */ 203 MPP6_GPIO, /* HD0 12V control */
204 { 7, MPP_GPIO }, /* HD1 5V control */ 204 MPP7_GPIO, /* HD1 5V control */
205 { 8, MPP_GPIO }, /* HD1 12V control */ 205 MPP8_GPIO, /* HD1 12V control */
206 { 9, MPP_UNUSED }, 206 MPP9_UNUSED,
207 { 10, MPP_GPIO }, /* Fan control */ 207 MPP10_GPIO, /* Fan control */
208 { 11, MPP_GPIO }, /* Power button */ 208 MPP11_GPIO, /* Power button */
209 { 12, MPP_GPIO }, /* Reset button */ 209 MPP12_GPIO, /* Reset button */
210 { 13, MPP_UNUSED }, 210 MPP13_UNUSED,
211 { 14, MPP_SATA_LED }, /* SATA 0 active */ 211 MPP14_SATA_LED, /* SATA 0 active */
212 { 15, MPP_SATA_LED }, /* SATA 1 active */ 212 MPP15_SATA_LED, /* SATA 1 active */
213 { 16, MPP_UNUSED }, 213 MPP16_UNUSED,
214 { 17, MPP_UNUSED }, 214 MPP17_UNUSED,
215 { 18, MPP_UNUSED }, 215 MPP18_UNUSED,
216 { 19, MPP_UNUSED }, 216 MPP19_UNUSED,
217 { -1 }, 217 0,
218}; 218};
219 219
220static void __init mss2_init(void) 220static void __init mss2_init(void)
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
index c55d071707f..63ff10c3c46 100644
--- a/arch/arm/mach-orion5x/mv2120-setup.c
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -108,28 +108,28 @@ static struct platform_device mv2120_button_device = {
108/**************************************************************************** 108/****************************************************************************
109 * General Setup 109 * General Setup
110 ****************************************************************************/ 110 ****************************************************************************/
111static struct orion5x_mpp_mode mv2120_mpp_modes[] __initdata = { 111static unsigned int mv2120_mpp_modes[] __initdata = {
112 { 0, MPP_GPIO }, /* Sys status LED */ 112 MPP0_GPIO, /* Sys status LED */
113 { 1, MPP_GPIO }, /* Sys error LED */ 113 MPP1_GPIO, /* Sys error LED */
114 { 2, MPP_GPIO }, /* OverTemp interrupt */ 114 MPP2_GPIO, /* OverTemp interrupt */
115 { 3, MPP_GPIO }, /* RTC interrupt */ 115 MPP3_GPIO, /* RTC interrupt */
116 { 4, MPP_GPIO }, /* V_LED 5V */ 116 MPP4_GPIO, /* V_LED 5V */
117 { 5, MPP_GPIO }, /* V_LED 3.3V */ 117 MPP5_GPIO, /* V_LED 3.3V */
118 { 6, MPP_UNUSED }, 118 MPP6_UNUSED,
119 { 7, MPP_UNUSED }, 119 MPP7_UNUSED,
120 { 8, MPP_GPIO }, /* SATA 0 fail LED */ 120 MPP8_GPIO, /* SATA 0 fail LED */
121 { 9, MPP_GPIO }, /* SATA 1 fail LED */ 121 MPP9_GPIO, /* SATA 1 fail LED */
122 { 10, MPP_UNUSED }, 122 MPP10_UNUSED,
123 { 11, MPP_UNUSED }, 123 MPP11_UNUSED,
124 { 12, MPP_SATA_LED }, /* SATA 0 presence */ 124 MPP12_SATA_LED, /* SATA 0 presence */
125 { 13, MPP_SATA_LED }, /* SATA 1 presence */ 125 MPP13_SATA_LED, /* SATA 1 presence */
126 { 14, MPP_SATA_LED }, /* SATA 0 active */ 126 MPP14_SATA_LED, /* SATA 0 active */
127 { 15, MPP_SATA_LED }, /* SATA 1 active */ 127 MPP15_SATA_LED, /* SATA 1 active */
128 { 16, MPP_UNUSED }, 128 MPP16_UNUSED,
129 { 17, MPP_GPIO }, /* Reset button */ 129 MPP17_GPIO, /* Reset button */
130 { 18, MPP_GPIO }, /* Power button */ 130 MPP18_GPIO, /* Power button */
131 { 19, MPP_GPIO }, /* Power off */ 131 MPP19_GPIO, /* Power off */
132 { -1 }, 132 0,
133}; 133};
134 134
135static struct i2c_board_info __initdata mv2120_i2c_rtc = { 135static struct i2c_board_info __initdata mv2120_i2c_rtc = {
diff --git a/arch/arm/mach-orion5x/net2big-setup.c b/arch/arm/mach-orion5x/net2big-setup.c
index 429ecafe9fd..e43b39cc7fe 100644
--- a/arch/arm/mach-orion5x/net2big-setup.c
+++ b/arch/arm/mach-orion5x/net2big-setup.c
@@ -190,7 +190,7 @@ err_free_1:
190 * The power front LEDs (blue and red) and SATA red LEDs are controlled via a 190 * The power front LEDs (blue and red) and SATA red LEDs are controlled via a
191 * single GPIO line and are compatible with the leds-gpio driver. 191 * single GPIO line and are compatible with the leds-gpio driver.
192 * 192 *
193 * The SATA blue LEDs have some hardware blink capabilities which are detailled 193 * The SATA blue LEDs have some hardware blink capabilities which are detailed
194 * in the following array: 194 * in the following array:
195 * 195 *
196 * SATAx blue LED | SATAx activity | LED state 196 * SATAx blue LED | SATAx activity | LED state
@@ -339,28 +339,28 @@ static struct platform_device net2big_gpio_buttons = {
339 * General Setup 339 * General Setup
340 ****************************************************************************/ 340 ****************************************************************************/
341 341
342static struct orion5x_mpp_mode net2big_mpp_modes[] __initdata = { 342static unsigned int net2big_mpp_modes[] __initdata = {
343 { 0, MPP_GPIO }, /* Raid mode (bit 0) */ 343 MPP0_GPIO, /* Raid mode (bit 0) */
344 { 1, MPP_GPIO }, /* USB port 2 fuse (0 = Fail, 1 = Ok) */ 344 MPP1_GPIO, /* USB port 2 fuse (0 = Fail, 1 = Ok) */
345 { 2, MPP_GPIO }, /* Raid mode (bit 1) */ 345 MPP2_GPIO, /* Raid mode (bit 1) */
346 { 3, MPP_GPIO }, /* Board ID (bit 0) */ 346 MPP3_GPIO, /* Board ID (bit 0) */
347 { 4, MPP_GPIO }, /* Fan activity (0 = Off, 1 = On) */ 347 MPP4_GPIO, /* Fan activity (0 = Off, 1 = On) */
348 { 5, MPP_GPIO }, /* Fan fail detection */ 348 MPP5_GPIO, /* Fan fail detection */
349 { 6, MPP_GPIO }, /* Red front LED (0 = Off, 1 = On) */ 349 MPP6_GPIO, /* Red front LED (0 = Off, 1 = On) */
350 { 7, MPP_GPIO }, /* Disable initial blinking on front LED */ 350 MPP7_GPIO, /* Disable initial blinking on front LED */
351 { 8, MPP_GPIO }, /* Rear power switch (on|auto) */ 351 MPP8_GPIO, /* Rear power switch (on|auto) */
352 { 9, MPP_GPIO }, /* Rear power switch (auto|off) */ 352 MPP9_GPIO, /* Rear power switch (auto|off) */
353 { 10, MPP_GPIO }, /* SATA 1 red LED (0 = Off, 1 = On) */ 353 MPP10_GPIO, /* SATA 1 red LED (0 = Off, 1 = On) */
354 { 11, MPP_GPIO }, /* SATA 0 red LED (0 = Off, 1 = On) */ 354 MPP11_GPIO, /* SATA 0 red LED (0 = Off, 1 = On) */
355 { 12, MPP_GPIO }, /* Board ID (bit 1) */ 355 MPP12_GPIO, /* Board ID (bit 1) */
356 { 13, MPP_GPIO }, /* SATA 1 blue LED blink control */ 356 MPP13_GPIO, /* SATA 1 blue LED blink control */
357 { 14, MPP_SATA_LED }, 357 MPP14_SATA_LED,
358 { 15, MPP_SATA_LED }, 358 MPP15_SATA_LED,
359 { 16, MPP_GPIO }, /* Blue front LED control */ 359 MPP16_GPIO, /* Blue front LED control */
360 { 17, MPP_GPIO }, /* SATA 0 blue LED blink control */ 360 MPP17_GPIO, /* SATA 0 blue LED blink control */
361 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */ 361 MPP18_GPIO, /* Front button (0 = Released, 1 = Pushed ) */
362 { 19, MPP_GPIO }, /* SATA{0,1} power On/Off request */ 362 MPP19_GPIO, /* SATA{0,1} power On/Off request */
363 { -1 } 363 0,
364 /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */ 364 /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */
365 /* 23: SATA 0 power status */ 365 /* 23: SATA 0 power status */
366 /* 24: Board power off */ 366 /* 24: Board power off */
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 34310ab56e2..9eec7c2375e 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -64,28 +64,28 @@ static struct platform_device rd88f5181l_fxo_nor_boot_flash = {
64/***************************************************************************** 64/*****************************************************************************
65 * General Setup 65 * General Setup
66 ****************************************************************************/ 66 ****************************************************************************/
67static struct orion5x_mpp_mode rd88f5181l_fxo_mpp_modes[] __initdata = { 67static unsigned int rd88f5181l_fxo_mpp_modes[] __initdata = {
68 { 0, MPP_GPIO }, /* LED1 CardBus LED (front panel) */ 68 MPP0_GPIO, /* LED1 CardBus LED (front panel) */
69 { 1, MPP_GPIO }, /* PCI_intA */ 69 MPP1_GPIO, /* PCI_intA */
70 { 2, MPP_GPIO }, /* Hard Reset / Factory Init*/ 70 MPP2_GPIO, /* Hard Reset / Factory Init*/
71 { 3, MPP_GPIO }, /* FXS or DAA select */ 71 MPP3_GPIO, /* FXS or DAA select */
72 { 4, MPP_GPIO }, /* LED6 - phone LED (front panel) */ 72 MPP4_GPIO, /* LED6 - phone LED (front panel) */
73 { 5, MPP_GPIO }, /* LED5 - phone LED (front panel) */ 73 MPP5_GPIO, /* LED5 - phone LED (front panel) */
74 { 6, MPP_PCI_CLK }, /* CPU PCI refclk */ 74 MPP6_PCI_CLK, /* CPU PCI refclk */
75 { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */ 75 MPP7_PCI_CLK, /* PCI/PCIe refclk */
76 { 8, MPP_GPIO }, /* CardBus reset */ 76 MPP8_GPIO, /* CardBus reset */
77 { 9, MPP_GPIO }, /* GE_RXERR */ 77 MPP9_GPIO, /* GE_RXERR */
78 { 10, MPP_GPIO }, /* LED2 MiniPCI LED (front panel) */ 78 MPP10_GPIO, /* LED2 MiniPCI LED (front panel) */
79 { 11, MPP_GPIO }, /* Lifeline control */ 79 MPP11_GPIO, /* Lifeline control */
80 { 12, MPP_GIGE }, /* GE_TXD[4] */ 80 MPP12_GIGE, /* GE_TXD[4] */
81 { 13, MPP_GIGE }, /* GE_TXD[5] */ 81 MPP13_GIGE, /* GE_TXD[5] */
82 { 14, MPP_GIGE }, /* GE_TXD[6] */ 82 MPP14_GIGE, /* GE_TXD[6] */
83 { 15, MPP_GIGE }, /* GE_TXD[7] */ 83 MPP15_GIGE, /* GE_TXD[7] */
84 { 16, MPP_GIGE }, /* GE_RXD[4] */ 84 MPP16_GIGE, /* GE_RXD[4] */
85 { 17, MPP_GIGE }, /* GE_RXD[5] */ 85 MPP17_GIGE, /* GE_RXD[5] */
86 { 18, MPP_GIGE }, /* GE_RXD[6] */ 86 MPP18_GIGE, /* GE_RXD[6] */
87 { 19, MPP_GIGE }, /* GE_RXD[7] */ 87 MPP19_GIGE, /* GE_RXD[7] */
88 { -1 }, 88 0,
89}; 89};
90 90
91static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = { 91static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index c1f79fa014e..0cc90bbfd32 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -65,28 +65,28 @@ static struct platform_device rd88f5181l_ge_nor_boot_flash = {
65/***************************************************************************** 65/*****************************************************************************
66 * General Setup 66 * General Setup
67 ****************************************************************************/ 67 ****************************************************************************/
68static struct orion5x_mpp_mode rd88f5181l_ge_mpp_modes[] __initdata = { 68static unsigned int rd88f5181l_ge_mpp_modes[] __initdata = {
69 { 0, MPP_GPIO }, /* LED1 */ 69 MPP0_GPIO, /* LED1 */
70 { 1, MPP_GPIO }, /* LED5 */ 70 MPP1_GPIO, /* LED5 */
71 { 2, MPP_GPIO }, /* LED4 */ 71 MPP2_GPIO, /* LED4 */
72 { 3, MPP_GPIO }, /* LED3 */ 72 MPP3_GPIO, /* LED3 */
73 { 4, MPP_GPIO }, /* PCI_intA */ 73 MPP4_GPIO, /* PCI_intA */
74 { 5, MPP_GPIO }, /* RTC interrupt */ 74 MPP5_GPIO, /* RTC interrupt */
75 { 6, MPP_PCI_CLK }, /* CPU PCI refclk */ 75 MPP6_PCI_CLK, /* CPU PCI refclk */
76 { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */ 76 MPP7_PCI_CLK, /* PCI/PCIe refclk */
77 { 8, MPP_GPIO }, /* 88e6131 interrupt */ 77 MPP8_GPIO, /* 88e6131 interrupt */
78 { 9, MPP_GPIO }, /* GE_RXERR */ 78 MPP9_GPIO, /* GE_RXERR */
79 { 10, MPP_GPIO }, /* PCI_intB */ 79 MPP10_GPIO, /* PCI_intB */
80 { 11, MPP_GPIO }, /* LED2 */ 80 MPP11_GPIO, /* LED2 */
81 { 12, MPP_GIGE }, /* GE_TXD[4] */ 81 MPP12_GIGE, /* GE_TXD[4] */
82 { 13, MPP_GIGE }, /* GE_TXD[5] */ 82 MPP13_GIGE, /* GE_TXD[5] */
83 { 14, MPP_GIGE }, /* GE_TXD[6] */ 83 MPP14_GIGE, /* GE_TXD[6] */
84 { 15, MPP_GIGE }, /* GE_TXD[7] */ 84 MPP15_GIGE, /* GE_TXD[7] */
85 { 16, MPP_GIGE }, /* GE_RXD[4] */ 85 MPP16_GIGE, /* GE_RXD[4] */
86 { 17, MPP_GIGE }, /* GE_RXD[5] */ 86 MPP17_GIGE, /* GE_RXD[5] */
87 { 18, MPP_GIGE }, /* GE_RXD[6] */ 87 MPP18_GIGE, /* GE_RXD[6] */
88 { 19, MPP_GIGE }, /* GE_RXD[7] */ 88 MPP19_GIGE, /* GE_RXD[7] */
89 { -1 }, 89 0,
90}; 90};
91 91
92static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = { 92static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 4fc46772a08..48da39b9bdb 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -241,28 +241,28 @@ static struct mv_sata_platform_data rd88f5182_sata_data = {
241/***************************************************************************** 241/*****************************************************************************
242 * General Setup 242 * General Setup
243 ****************************************************************************/ 243 ****************************************************************************/
244static struct orion5x_mpp_mode rd88f5182_mpp_modes[] __initdata = { 244static unsigned int rd88f5182_mpp_modes[] __initdata = {
245 { 0, MPP_GPIO }, /* Debug Led */ 245 MPP0_GPIO, /* Debug Led */
246 { 1, MPP_GPIO }, /* Reset Switch */ 246 MPP1_GPIO, /* Reset Switch */
247 { 2, MPP_UNUSED }, 247 MPP2_UNUSED,
248 { 3, MPP_GPIO }, /* RTC Int */ 248 MPP3_GPIO, /* RTC Int */
249 { 4, MPP_GPIO }, 249 MPP4_GPIO,
250 { 5, MPP_GPIO }, 250 MPP5_GPIO,
251 { 6, MPP_GPIO }, /* PCI_intA */ 251 MPP6_GPIO, /* PCI_intA */
252 { 7, MPP_GPIO }, /* PCI_intB */ 252 MPP7_GPIO, /* PCI_intB */
253 { 8, MPP_UNUSED }, 253 MPP8_UNUSED,
254 { 9, MPP_UNUSED }, 254 MPP9_UNUSED,
255 { 10, MPP_UNUSED }, 255 MPP10_UNUSED,
256 { 11, MPP_UNUSED }, 256 MPP11_UNUSED,
257 { 12, MPP_SATA_LED }, /* SATA 0 presence */ 257 MPP12_SATA_LED, /* SATA 0 presence */
258 { 13, MPP_SATA_LED }, /* SATA 1 presence */ 258 MPP13_SATA_LED, /* SATA 1 presence */
259 { 14, MPP_SATA_LED }, /* SATA 0 active */ 259 MPP14_SATA_LED, /* SATA 0 active */
260 { 15, MPP_SATA_LED }, /* SATA 1 active */ 260 MPP15_SATA_LED, /* SATA 1 active */
261 { 16, MPP_UNUSED }, 261 MPP16_UNUSED,
262 { 17, MPP_UNUSED }, 262 MPP17_UNUSED,
263 { 18, MPP_UNUSED }, 263 MPP18_UNUSED,
264 { 19, MPP_UNUSED }, 264 MPP19_UNUSED,
265 { -1 }, 265 0,
266}; 266};
267 267
268static void __init rd88f5182_init(void) 268static void __init rd88f5182_init(void)
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
index b080c6966d1..ad2eba9286a 100644
--- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
@@ -27,7 +27,6 @@
27#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
28#include <mach/orion5x.h> 28#include <mach/orion5x.h>
29#include "common.h" 29#include "common.h"
30#include "mpp.h"
31 30
32static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = { 31static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
33 .phy_addr = -1, 32 .phy_addr = -1,
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index 61600414391..29ce826c3c2 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -295,28 +295,28 @@ static void tsp2_power_off(void)
295/***************************************************************************** 295/*****************************************************************************
296 * General Setup 296 * General Setup
297 ****************************************************************************/ 297 ****************************************************************************/
298static struct orion5x_mpp_mode tsp2_mpp_modes[] __initdata = { 298static unsigned int tsp2_mpp_modes[] __initdata = {
299 { 0, MPP_PCIE_RST_OUTn }, 299 MPP0_PCIE_RST_OUTn,
300 { 1, MPP_UNUSED }, 300 MPP1_UNUSED,
301 { 2, MPP_UNUSED }, 301 MPP2_UNUSED,
302 { 3, MPP_UNUSED }, 302 MPP3_UNUSED,
303 { 4, MPP_NAND }, /* BOOT NAND Flash REn */ 303 MPP4_NAND, /* BOOT NAND Flash REn */
304 { 5, MPP_NAND }, /* BOOT NAND Flash WEn */ 304 MPP5_NAND, /* BOOT NAND Flash WEn */
305 { 6, MPP_NAND }, /* BOOT NAND Flash HREn[0] */ 305 MPP6_NAND, /* BOOT NAND Flash HREn[0] */
306 { 7, MPP_NAND }, /* BOOT NAND Flash WEn[0] */ 306 MPP7_NAND, /* BOOT NAND Flash WEn[0] */
307 { 8, MPP_GPIO }, /* MICON int */ 307 MPP8_GPIO, /* MICON int */
308 { 9, MPP_GPIO }, /* RTC int */ 308 MPP9_GPIO, /* RTC int */
309 { 10, MPP_UNUSED }, 309 MPP10_UNUSED,
310 { 11, MPP_GPIO }, /* PCI Int A */ 310 MPP11_GPIO, /* PCI Int A */
311 { 12, MPP_UNUSED }, 311 MPP12_UNUSED,
312 { 13, MPP_GPIO }, /* UPS on UART0 enable */ 312 MPP13_GPIO, /* UPS on UART0 enable */
313 { 14, MPP_GPIO }, /* UPS low battery detection */ 313 MPP14_GPIO, /* UPS low battery detection */
314 { 15, MPP_UNUSED }, 314 MPP15_UNUSED,
315 { 16, MPP_UART }, /* UART1 RXD */ 315 MPP16_UART, /* UART1 RXD */
316 { 17, MPP_UART }, /* UART1 TXD */ 316 MPP17_UART, /* UART1 TXD */
317 { 18, MPP_UART }, /* UART1 CTSn */ 317 MPP18_UART, /* UART1 CTSn */
318 { 19, MPP_UART }, /* UART1 RTSn */ 318 MPP19_UART, /* UART1 RTSn */
319 { -1 }, 319 0,
320}; 320};
321 321
322static void __init tsp2_init(void) 322static void __init tsp2_init(void)
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index f0f43e13ac8..47162fd5f04 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -36,7 +36,7 @@
36 36
37/**************************************************************************** 37/****************************************************************************
38 * 8MiB NOR flash. The struct mtd_partition is not in the same order as the 38 * 8MiB NOR flash. The struct mtd_partition is not in the same order as the
39 * partitions on the device because we want to keep compatability with 39 * partitions on the device because we want to keep compatibility with
40 * existing QNAP firmware. 40 * existing QNAP firmware.
41 * 41 *
42 * Layout as used by QNAP: 42 * Layout as used by QNAP:
@@ -244,28 +244,28 @@ static struct mv_sata_platform_data qnap_ts209_sata_data = {
244 244
245 * General Setup 245 * General Setup
246 ****************************************************************************/ 246 ****************************************************************************/
247static struct orion5x_mpp_mode ts209_mpp_modes[] __initdata = { 247static unsigned int ts209_mpp_modes[] __initdata = {
248 { 0, MPP_UNUSED }, 248 MPP0_UNUSED,
249 { 1, MPP_GPIO }, /* USB copy button */ 249 MPP1_GPIO, /* USB copy button */
250 { 2, MPP_GPIO }, /* Load defaults button */ 250 MPP2_GPIO, /* Load defaults button */
251 { 3, MPP_GPIO }, /* GPIO RTC */ 251 MPP3_GPIO, /* GPIO RTC */
252 { 4, MPP_UNUSED }, 252 MPP4_UNUSED,
253 { 5, MPP_UNUSED }, 253 MPP5_UNUSED,
254 { 6, MPP_GPIO }, /* PCI Int A */ 254 MPP6_GPIO, /* PCI Int A */
255 { 7, MPP_GPIO }, /* PCI Int B */ 255 MPP7_GPIO, /* PCI Int B */
256 { 8, MPP_UNUSED }, 256 MPP8_UNUSED,
257 { 9, MPP_UNUSED }, 257 MPP9_UNUSED,
258 { 10, MPP_UNUSED }, 258 MPP10_UNUSED,
259 { 11, MPP_UNUSED }, 259 MPP11_UNUSED,
260 { 12, MPP_SATA_LED }, /* SATA 0 presence */ 260 MPP12_SATA_LED, /* SATA 0 presence */
261 { 13, MPP_SATA_LED }, /* SATA 1 presence */ 261 MPP13_SATA_LED, /* SATA 1 presence */
262 { 14, MPP_SATA_LED }, /* SATA 0 active */ 262 MPP14_SATA_LED, /* SATA 0 active */
263 { 15, MPP_SATA_LED }, /* SATA 1 active */ 263 MPP15_SATA_LED, /* SATA 1 active */
264 { 16, MPP_UART }, /* UART1 RXD */ 264 MPP16_UART, /* UART1 RXD */
265 { 17, MPP_UART }, /* UART1 TXD */ 265 MPP17_UART, /* UART1 TXD */
266 { 18, MPP_GPIO }, /* SW_RST */ 266 MPP18_GPIO, /* SW_RST */
267 { 19, MPP_UNUSED }, 267 MPP19_UNUSED,
268 { -1 }, 268 0,
269}; 269};
270 270
271static void __init qnap_ts209_init(void) 271static void __init qnap_ts209_init(void)
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index 92f393f08fa..5aacc7ac5cf 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -56,7 +56,7 @@
56 56
57/**************************************************************************** 57/****************************************************************************
58 * 8MiB NOR flash. The struct mtd_partition is not in the same order as the 58 * 8MiB NOR flash. The struct mtd_partition is not in the same order as the
59 * partitions on the device because we want to keep compatability with 59 * partitions on the device because we want to keep compatibility with
60 * existing QNAP firmware. 60 * existing QNAP firmware.
61 * 61 *
62 * Layout as used by QNAP: 62 * Layout as used by QNAP:
@@ -242,28 +242,28 @@ static struct platform_device qnap_ts409_button_device = {
242/***************************************************************************** 242/*****************************************************************************
243 * General Setup 243 * General Setup
244 ****************************************************************************/ 244 ****************************************************************************/
245static struct orion5x_mpp_mode ts409_mpp_modes[] __initdata = { 245static unsigned int ts409_mpp_modes[] __initdata = {
246 { 0, MPP_UNUSED }, 246 MPP0_UNUSED,
247 { 1, MPP_UNUSED }, 247 MPP1_UNUSED,
248 { 2, MPP_UNUSED }, 248 MPP2_UNUSED,
249 { 3, MPP_UNUSED }, 249 MPP3_UNUSED,
250 { 4, MPP_GPIO }, /* HDD 1 status */ 250 MPP4_GPIO, /* HDD 1 status */
251 { 5, MPP_GPIO }, /* HDD 2 status */ 251 MPP5_GPIO, /* HDD 2 status */
252 { 6, MPP_GPIO }, /* HDD 3 status */ 252 MPP6_GPIO, /* HDD 3 status */
253 { 7, MPP_GPIO }, /* HDD 4 status */ 253 MPP7_GPIO, /* HDD 4 status */
254 { 8, MPP_UNUSED }, 254 MPP8_UNUSED,
255 { 9, MPP_UNUSED }, 255 MPP9_UNUSED,
256 { 10, MPP_GPIO }, /* RTC int */ 256 MPP10_GPIO, /* RTC int */
257 { 11, MPP_UNUSED }, 257 MPP11_UNUSED,
258 { 12, MPP_UNUSED }, 258 MPP12_UNUSED,
259 { 13, MPP_UNUSED }, 259 MPP13_UNUSED,
260 { 14, MPP_GPIO }, /* SW_RST */ 260 MPP14_GPIO, /* SW_RST */
261 { 15, MPP_GPIO }, /* USB copy button */ 261 MPP15_GPIO, /* USB copy button */
262 { 16, MPP_UART }, /* UART1 RXD */ 262 MPP16_UART, /* UART1 RXD */
263 { 17, MPP_UART }, /* UART1 TXD */ 263 MPP17_UART, /* UART1 TXD */
264 { 18, MPP_UNUSED }, 264 MPP18_UNUSED,
265 { 19, MPP_UNUSED }, 265 MPP19_UNUSED,
266 { -1 }, 266 0,
267}; 267};
268 268
269static void __init qnap_ts409_init(void) 269static void __init qnap_ts409_init(void)
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index edb1dd2d161..6b7b54116f3 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -557,27 +557,27 @@ static struct kobj_attribute ts78xx_fpga_attr =
557/***************************************************************************** 557/*****************************************************************************
558 * General Setup 558 * General Setup
559 ****************************************************************************/ 559 ****************************************************************************/
560static struct orion5x_mpp_mode ts78xx_mpp_modes[] __initdata = { 560static unsigned int ts78xx_mpp_modes[] __initdata = {
561 { 0, MPP_UNUSED }, 561 MPP0_UNUSED,
562 { 1, MPP_GPIO }, /* JTAG Clock */ 562 MPP1_GPIO, /* JTAG Clock */
563 { 2, MPP_GPIO }, /* JTAG Data In */ 563 MPP2_GPIO, /* JTAG Data In */
564 { 3, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB2B */ 564 MPP3_GPIO, /* Lat ECP2 256 FPGA - PB2B */
565 { 4, MPP_GPIO }, /* JTAG Data Out */ 565 MPP4_GPIO, /* JTAG Data Out */
566 { 5, MPP_GPIO }, /* JTAG TMS */ 566 MPP5_GPIO, /* JTAG TMS */
567 { 6, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB31A_CLK4+ */ 567 MPP6_GPIO, /* Lat ECP2 256 FPGA - PB31A_CLK4+ */
568 { 7, MPP_GPIO }, /* Lat ECP2 256 FPGA - PB22B */ 568 MPP7_GPIO, /* Lat ECP2 256 FPGA - PB22B */
569 { 8, MPP_UNUSED }, 569 MPP8_UNUSED,
570 { 9, MPP_UNUSED }, 570 MPP9_UNUSED,
571 { 10, MPP_UNUSED }, 571 MPP10_UNUSED,
572 { 11, MPP_UNUSED }, 572 MPP11_UNUSED,
573 { 12, MPP_UNUSED }, 573 MPP12_UNUSED,
574 { 13, MPP_UNUSED }, 574 MPP13_UNUSED,
575 { 14, MPP_UNUSED }, 575 MPP14_UNUSED,
576 { 15, MPP_UNUSED }, 576 MPP15_UNUSED,
577 { 16, MPP_UART }, 577 MPP16_UART,
578 { 17, MPP_UART }, 578 MPP17_UART,
579 { 18, MPP_UART }, 579 MPP18_UART,
580 { 19, MPP_UART }, 580 MPP19_UART,
581 /* 581 /*
582 * MPP[20] PCI Clock Out 1 582 * MPP[20] PCI Clock Out 1
583 * MPP[21] PCI Clock Out 0 583 * MPP[21] PCI Clock Out 0
@@ -586,7 +586,7 @@ static struct orion5x_mpp_mode ts78xx_mpp_modes[] __initdata = {
586 * MPP[24] Unused 586 * MPP[24] Unused
587 * MPP[25] Unused 587 * MPP[25] Unused
588 */ 588 */
589 { -1 }, 589 0,
590}; 590};
591 591
592static void __init ts78xx_init(void) 592static void __init ts78xx_init(void)
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 4e5216be074..444a1c7fdfd 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -24,28 +24,28 @@
24#include "common.h" 24#include "common.h"
25#include "mpp.h" 25#include "mpp.h"
26 26
27static struct orion5x_mpp_mode wnr854t_mpp_modes[] __initdata = { 27static unsigned int wnr854t_mpp_modes[] __initdata = {
28 { 0, MPP_GPIO }, /* Power LED green (0=on) */ 28 MPP0_GPIO, /* Power LED green (0=on) */
29 { 1, MPP_GPIO }, /* Reset Button (0=off) */ 29 MPP1_GPIO, /* Reset Button (0=off) */
30 { 2, MPP_GPIO }, /* Power LED blink (0=off) */ 30 MPP2_GPIO, /* Power LED blink (0=off) */
31 { 3, MPP_GPIO }, /* WAN Status LED amber (0=off) */ 31 MPP3_GPIO, /* WAN Status LED amber (0=off) */
32 { 4, MPP_GPIO }, /* PCI int */ 32 MPP4_GPIO, /* PCI int */
33 { 5, MPP_GPIO }, /* ??? */ 33 MPP5_GPIO, /* ??? */
34 { 6, MPP_GPIO }, /* ??? */ 34 MPP6_GPIO, /* ??? */
35 { 7, MPP_GPIO }, /* ??? */ 35 MPP7_GPIO, /* ??? */
36 { 8, MPP_UNUSED }, /* ??? */ 36 MPP8_UNUSED, /* ??? */
37 { 9, MPP_GIGE }, /* GE_RXERR */ 37 MPP9_GIGE, /* GE_RXERR */
38 { 10, MPP_UNUSED }, /* ??? */ 38 MPP10_UNUSED, /* ??? */
39 { 11, MPP_UNUSED }, /* ??? */ 39 MPP11_UNUSED, /* ??? */
40 { 12, MPP_GIGE }, /* GE_TXD[4] */ 40 MPP12_GIGE, /* GE_TXD[4] */
41 { 13, MPP_GIGE }, /* GE_TXD[5] */ 41 MPP13_GIGE, /* GE_TXD[5] */
42 { 14, MPP_GIGE }, /* GE_TXD[6] */ 42 MPP14_GIGE, /* GE_TXD[6] */
43 { 15, MPP_GIGE }, /* GE_TXD[7] */ 43 MPP15_GIGE, /* GE_TXD[7] */
44 { 16, MPP_GIGE }, /* GE_RXD[4] */ 44 MPP16_GIGE, /* GE_RXD[4] */
45 { 17, MPP_GIGE }, /* GE_RXD[5] */ 45 MPP17_GIGE, /* GE_RXD[5] */
46 { 18, MPP_GIGE }, /* GE_RXD[6] */ 46 MPP18_GIGE, /* GE_RXD[6] */
47 { 19, MPP_GIGE }, /* GE_RXD[7] */ 47 MPP19_GIGE, /* GE_RXD[7] */
48 { -1 }, 48 0,
49}; 49};
50 50
51/* 51/*
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index fab79d09cc5..d1952be0ae1 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -101,28 +101,28 @@ static struct platform_device wrt350n_v2_button_device = {
101/* 101/*
102 * General setup 102 * General setup
103 */ 103 */
104static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = { 104static unsigned int wrt350n_v2_mpp_modes[] __initdata = {
105 { 0, MPP_GPIO }, /* Power LED green (0=on) */ 105 MPP0_GPIO, /* Power LED green (0=on) */
106 { 1, MPP_GPIO }, /* Security LED (0=on) */ 106 MPP1_GPIO, /* Security LED (0=on) */
107 { 2, MPP_GPIO }, /* Internal Button (0=on) */ 107 MPP2_GPIO, /* Internal Button (0=on) */
108 { 3, MPP_GPIO }, /* Reset Button (0=on) */ 108 MPP3_GPIO, /* Reset Button (0=on) */
109 { 4, MPP_GPIO }, /* PCI int */ 109 MPP4_GPIO, /* PCI int */
110 { 5, MPP_GPIO }, /* Power LED orange (0=on) */ 110 MPP5_GPIO, /* Power LED orange (0=on) */
111 { 6, MPP_GPIO }, /* USB LED (0=on) */ 111 MPP6_GPIO, /* USB LED (0=on) */
112 { 7, MPP_GPIO }, /* Wireless LED (0=on) */ 112 MPP7_GPIO, /* Wireless LED (0=on) */
113 { 8, MPP_UNUSED }, /* ??? */ 113 MPP8_UNUSED, /* ??? */
114 { 9, MPP_GIGE }, /* GE_RXERR */ 114 MPP9_GIGE, /* GE_RXERR */
115 { 10, MPP_UNUSED }, /* ??? */ 115 MPP10_UNUSED, /* ??? */
116 { 11, MPP_UNUSED }, /* ??? */ 116 MPP11_UNUSED, /* ??? */
117 { 12, MPP_GIGE }, /* GE_TXD[4] */ 117 MPP12_GIGE, /* GE_TXD[4] */
118 { 13, MPP_GIGE }, /* GE_TXD[5] */ 118 MPP13_GIGE, /* GE_TXD[5] */
119 { 14, MPP_GIGE }, /* GE_TXD[6] */ 119 MPP14_GIGE, /* GE_TXD[6] */
120 { 15, MPP_GIGE }, /* GE_TXD[7] */ 120 MPP15_GIGE, /* GE_TXD[7] */
121 { 16, MPP_GIGE }, /* GE_RXD[4] */ 121 MPP16_GIGE, /* GE_RXD[4] */
122 { 17, MPP_GIGE }, /* GE_RXD[5] */ 122 MPP17_GIGE, /* GE_RXD[5] */
123 { 18, MPP_GIGE }, /* GE_RXD[6] */ 123 MPP18_GIGE, /* GE_RXD[6] */
124 { 19, MPP_GIGE }, /* GE_RXD[7] */ 124 MPP19_GIGE, /* GE_RXD[7] */
125 { -1 }, 125 0,
126}; 126};
127 127
128/* 128/*
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 6de0ad0eea6..9cdcca59792 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -711,7 +711,7 @@ static struct regulator_consumer_supply bq24022_consumers[] = {
711static struct regulator_init_data bq24022_init_data = { 711static struct regulator_init_data bq24022_init_data = {
712 .constraints = { 712 .constraints = {
713 .max_uA = 500000, 713 .max_uA = 500000,
714 .valid_ops_mask = REGULATOR_CHANGE_CURRENT, 714 .valid_ops_mask = REGULATOR_CHANGE_CURRENT|REGULATOR_CHANGE_STATUS,
715 }, 715 },
716 .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), 716 .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers),
717 .consumer_supplies = bq24022_consumers, 717 .consumer_supplies = bq24022_consumers,
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index b024a8b3743..c4639502efc 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -99,11 +99,24 @@
99#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2)) 99#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
100 100
101 101
102#define NR_BUILTIN_GPIO 128 102#define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
103 103
104#define gpio_to_bank(gpio) ((gpio) >> 5) 104#define gpio_to_bank(gpio) ((gpio) >> 5)
105#define gpio_to_irq(gpio) IRQ_GPIO(gpio) 105#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
106#define irq_to_gpio(irq) IRQ_TO_GPIO(irq) 106
107static inline int irq_to_gpio(unsigned int irq)
108{
109 int gpio;
110
111 if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1)
112 return irq - IRQ_GPIO0;
113
114 gpio = irq - PXA_GPIO_IRQ_BASE;
115 if (gpio >= 2 && gpio < NR_BUILTIN_GPIO)
116 return gpio;
117
118 return -1;
119}
107 120
108#ifdef CONFIG_CPU_PXA26x 121#ifdef CONFIG_CPU_PXA26x
109/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted, 122/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index a4285fc0087..038402404e3 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -93,9 +93,6 @@
93#define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x)) 93#define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x))
94#define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x)) 94#define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))
95 95
96#define IRQ_TO_GPIO_2_x(i) ((i) - PXA_GPIO_IRQ_BASE)
97#define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i))
98
99/* 96/*
100 * The following interrupts are for board specific purposes. Since 97 * The following interrupts are for board specific purposes. Since
101 * the kernel can only run on one machine at a time, we can re-use 98 * the kernel can only run on one machine at a time, we can re-use
diff --git a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
index e4fb4668c26..207ecb49a61 100644
--- a/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
+++ b/arch/arm/mach-pxa/include/mach/pxa3xx-regs.h
@@ -38,7 +38,7 @@
38#define PCMD(x) __REG(0x40F50110 + ((x) << 2)) 38#define PCMD(x) __REG(0x40F50110 + ((x) << 2))
39 39
40/* 40/*
41 * Slave Power Managment Unit 41 * Slave Power Management Unit
42 */ 42 */
43#define ASCR __REG(0x40f40000) /* Application Subsystem Power Status/Configuration */ 43#define ASCR __REG(0x40f40000) /* Application Subsystem Power Status/Configuration */
44#define ARSR __REG(0x40f40004) /* Application Subsystem Reset Status */ 44#define ARSR __REG(0x40f40004) /* Application Subsystem Reset Status */
diff --git a/arch/arm/mach-pxa/include/mach/uncompress.h b/arch/arm/mach-pxa/include/mach/uncompress.h
index 759b851ec98..5519a34b667 100644
--- a/arch/arm/mach-pxa/include/mach/uncompress.h
+++ b/arch/arm/mach-pxa/include/mach/uncompress.h
@@ -16,9 +16,9 @@
16#define BTUART_BASE (0x40200000) 16#define BTUART_BASE (0x40200000)
17#define STUART_BASE (0x40700000) 17#define STUART_BASE (0x40700000)
18 18
19static unsigned long uart_base; 19unsigned long uart_base;
20static unsigned int uart_shift; 20unsigned int uart_shift;
21static unsigned int uart_is_pxa; 21unsigned int uart_is_pxa;
22 22
23static inline unsigned char uart_read(int offset) 23static inline unsigned char uart_read(int offset)
24{ 24{
diff --git a/arch/arm/mach-pxa/include/mach/zeus.h b/arch/arm/mach-pxa/include/mach/zeus.h
index faa408ab7ad..0641f31a56b 100644
--- a/arch/arm/mach-pxa/include/mach/zeus.h
+++ b/arch/arm/mach-pxa/include/mach/zeus.h
@@ -64,7 +64,7 @@
64 64
65/* 65/*
66 * CPLD registers: 66 * CPLD registers:
67 * Only 4 registers, but spreaded over a 32MB address space. 67 * Only 4 registers, but spread over a 32MB address space.
68 * Be gentle, and remap that over 32kB... 68 * Be gentle, and remap that over 32kB...
69 */ 69 */
70 70
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index a72993dde2b..9984ef70bd7 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -599,7 +599,7 @@ static struct regulator_consumer_supply bq24022_consumers[] = {
599static struct regulator_init_data bq24022_init_data = { 599static struct regulator_init_data bq24022_init_data = {
600 .constraints = { 600 .constraints = {
601 .max_uA = 500000, 601 .max_uA = 500000,
602 .valid_ops_mask = REGULATOR_CHANGE_CURRENT, 602 .valid_ops_mask = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS,
603 }, 603 },
604 .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), 604 .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers),
605 .consumer_supplies = bq24022_consumers, 605 .consumer_supplies = bq24022_consumers,
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index dd13bb63259..23925db8ff7 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -458,7 +458,7 @@ static struct platform_device strataflash = {
458/* 458/*
459 * Suspend/Resume bootstrap management 459 * Suspend/Resume bootstrap management
460 * 460 *
461 * MIO A701 reboot sequence is highly ROM dependant. From the one dissassembled, 461 * MIO A701 reboot sequence is highly ROM dependent. From the one dissassembled,
462 * this sequence is as follows : 462 * this sequence is as follows :
463 * - disables interrupts 463 * - disables interrupts
464 * - initialize SDRAM (self refresh RAM into active RAM) 464 * - initialize SDRAM (self refresh RAM into active RAM)
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 6bde5956358..a4af8c52d7e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -285,7 +285,7 @@ static inline void pxa25x_init_pm(void) {}
285 285
286static int pxa25x_set_wake(struct irq_data *d, unsigned int on) 286static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
287{ 287{
288 int gpio = IRQ_TO_GPIO(d->irq); 288 int gpio = irq_to_gpio(d->irq);
289 uint32_t mask = 0; 289 uint32_t mask = 0;
290 290
291 if (gpio >= 0 && gpio < 85) 291 if (gpio >= 0 && gpio < 85)
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 1cb5d0f9723..909756eaf4b 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -345,7 +345,7 @@ static inline void pxa27x_init_pm(void) {}
345 */ 345 */
346static int pxa27x_set_wake(struct irq_data *d, unsigned int on) 346static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
347{ 347{
348 int gpio = IRQ_TO_GPIO(d->irq); 348 int gpio = irq_to_gpio(d->irq);
349 uint32_t mask; 349 uint32_t mask;
350 350
351 if (gpio >= 0 && gpio < 128) 351 if (gpio >= 0 && gpio < 128)
diff --git a/arch/arm/mach-rpc/include/mach/uncompress.h b/arch/arm/mach-rpc/include/mach/uncompress.h
index 8c9e2c7161c..9cd9bcdad6c 100644
--- a/arch/arm/mach-rpc/include/mach/uncompress.h
+++ b/arch/arm/mach-rpc/include/mach/uncompress.h
@@ -66,12 +66,12 @@ extern __attribute__((pure)) struct param_struct *params(void);
66#define params (params()) 66#define params (params())
67 67
68#ifndef STANDALONE_DEBUG 68#ifndef STANDALONE_DEBUG
69static unsigned long video_num_cols; 69unsigned long video_num_cols;
70static unsigned long video_num_rows; 70unsigned long video_num_rows;
71static unsigned long video_x; 71unsigned long video_x;
72static unsigned long video_y; 72unsigned long video_y;
73static unsigned char bytes_per_char_v; 73unsigned char bytes_per_char_v;
74static int white; 74int white;
75 75
76/* 76/*
77 * This does not append a newline 77 * This does not append a newline
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
index cf68136cc66..b2b2a5bb275 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -19,7 +19,7 @@
19#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ 19#define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */
20 20
21/* We use `virtual` dma channels to hide the fact we have only a limited 21/* We use `virtual` dma channels to hide the fact we have only a limited
22 * number of DMA channels, and not of all of them (dependant on the device) 22 * number of DMA channels, and not of all of them (dependent on the device)
23 * can be attached to any DMA source. We therefore let the DMA core handle 23 * can be attached to any DMA source. We therefore let the DMA core handle
24 * the allocation of hardware channels to clients. 24 * the allocation of hardware channels to clients.
25*/ 25*/
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-mem.h b/arch/arm/mach-s3c2410/include/mach/regs-mem.h
index 7f7c5294796..988a6863e54 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-mem.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-mem.h
@@ -101,7 +101,7 @@
101#define S3C2410_BANKCON_PMC16 (0x03) 101#define S3C2410_BANKCON_PMC16 (0x03)
102 102
103/* bank configurations for banks 0..7, note banks 103/* bank configurations for banks 0..7, note banks
104 * 6 and 7 have differnt configurations depending on 104 * 6 and 7 have different configurations depending on
105 * the memory type bits */ 105 * the memory type bits */
106 106
107#define S3C2410_BANKCON_Tacp2 (0x0 << 2) 107#define S3C2410_BANKCON_Tacp2 (0x0 << 2)
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 66f44440d5d..079dcaa602d 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -252,7 +252,7 @@ static struct s3c24xx_led_platdata n30_blue_led_pdata = {
252 .def_trigger = "", 252 .def_trigger = "",
253}; 253};
254 254
255/* This is the blue LED on the device. Originaly used to indicate GPS activity 255/* This is the blue LED on the device. Originally used to indicate GPS activity
256 * by flashing. */ 256 * by flashing. */
257static struct s3c24xx_led_platdata n35_blue_led_pdata = { 257static struct s3c24xx_led_platdata n35_blue_led_pdata = {
258 .name = "blue_led", 258 .name = "blue_led",
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 0db2411ef4b..716662008ce 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -409,6 +409,10 @@ struct platform_device s3c24xx_pwm_device = {
409 .num_resources = 0, 409 .num_resources = 0,
410}; 410};
411 411
412static struct platform_device gta02_dfbmcs320_device = {
413 .name = "dfbmcs320",
414};
415
412static struct i2c_board_info gta02_i2c_devs[] __initdata = { 416static struct i2c_board_info gta02_i2c_devs[] __initdata = {
413 { 417 {
414 I2C_BOARD_INFO("pcf50633", 0x73), 418 I2C_BOARD_INFO("pcf50633", 0x73),
@@ -523,6 +527,7 @@ static struct platform_device *gta02_devices[] __initdata = {
523 &s3c_device_iis, 527 &s3c_device_iis,
524 &samsung_asoc_dma, 528 &samsung_asoc_dma,
525 &s3c_device_i2c0, 529 &s3c_device_i2c0,
530 &gta02_dfbmcs320_device,
526 &gta02_buttons_device, 531 &gta02_buttons_device,
527 &s3c_device_adc, 532 &s3c_device_adc,
528 &s3c_device_ts, 533 &s3c_device_ts,
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index dfedc9c9e00..dd3120df09f 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -155,7 +155,7 @@ static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
155 * the same timings, however, anything smaller than 1024x768 155 * the same timings, however, anything smaller than 1024x768
156 * will only be displayed in the top left corner of a 1024x768 156 * will only be displayed in the top left corner of a 1024x768
157 * XGA output unless you add optional dip switches to the shield. 157 * XGA output unless you add optional dip switches to the shield.
158 * Therefore timings for other resolutions have been ommited here. 158 * Therefore timings for other resolutions have been omitted here.
159 */ 159 */
160 [2] = { 160 [2] = {
161 _LCD_DECLARE( 161 _LCD_DECLARE(
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index c35585cf8c4..b197171e7d0 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -315,7 +315,7 @@ int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op)
315 case S3C2410_DMAOP_FLUSH: 315 case S3C2410_DMAOP_FLUSH:
316 return s3c64xx_dma_flush(chan); 316 return s3c64xx_dma_flush(chan);
317 317
318 /* belive PAUSE/RESUME are no-ops */ 318 /* believe PAUSE/RESUME are no-ops */
319 case S3C2410_DMAOP_PAUSE: 319 case S3C2410_DMAOP_PAUSE:
320 case S3C2410_DMAOP_RESUME: 320 case S3C2410_DMAOP_RESUME:
321 case S3C2410_DMAOP_STARTED: 321 case S3C2410_DMAOP_STARTED:
diff --git a/arch/arm/mach-s3c64xx/irq.c b/arch/arm/mach-s3c64xx/irq.c
index 67a145d440f..97660c8141a 100644
--- a/arch/arm/mach-s3c64xx/irq.c
+++ b/arch/arm/mach-s3c64xx/irq.c
@@ -58,12 +58,7 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
58 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, 0); 58 vic_init(VA_VIC1, IRQ_VIC1_BASE, vic1_valid, 0);
59 59
60 /* add the timer sub-irqs */ 60 /* add the timer sub-irqs */
61 61 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
62 s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0);
63 s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
64 s3c_init_vic_timer_irq(IRQ_TIMER2_VIC, IRQ_TIMER2);
65 s3c_init_vic_timer_irq(IRQ_TIMER3_VIC, IRQ_TIMER3);
66 s3c_init_vic_timer_irq(IRQ_TIMER4_VIC, IRQ_TIMER4);
67 62
68 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs)); 63 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
69} 64}
diff --git a/arch/arm/mach-s5p64x0/include/mach/uncompress.h b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
index c65b229aab2..1608faf870f 100644
--- a/arch/arm/mach-s5p64x0/include/mach/uncompress.h
+++ b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
@@ -24,8 +24,8 @@ typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
24 24
25/* uart setup */ 25/* uart setup */
26 26
27static unsigned int fifo_mask; 27unsigned int fifo_mask;
28static unsigned int fifo_max; 28unsigned int fifo_max;
29 29
30/* forward declerations */ 30/* forward declerations */
31 31
@@ -43,7 +43,7 @@ static void arch_detect_cpu(void);
43/* how many bytes we allow into the FIFO at a time in FIFO mode */ 43/* how many bytes we allow into the FIFO at a time in FIFO mode */
44#define FIFO_MAX (14) 44#define FIFO_MAX (14)
45 45
46static unsigned long uart_base; 46unsigned long uart_base;
47 47
48static __inline__ void get_uart_base(void) 48static __inline__ void get_uart_base(void)
49{ 49{
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-fb.h b/arch/arm/mach-s5pc100/include/mach/regs-fb.h
index 4be4cc9abf7..07aa4d6054f 100644
--- a/arch/arm/mach-s5pc100/include/mach/regs-fb.h
+++ b/arch/arm/mach-s5pc100/include/mach/regs-fb.h
@@ -29,7 +29,7 @@
29#define WPALCON_H (0x19c) 29#define WPALCON_H (0x19c)
30#define WPALCON_L (0x1a0) 30#define WPALCON_L (0x1a0)
31 31
32/* Pallete contro for WPAL0 and WPAL1 is the same as in S3C64xx, but 32/* Palette control for WPAL0 and WPAL1 is the same as in S3C64xx, but
33 * different for WPAL2-4 33 * different for WPAL2-4
34 */ 34 */
35/* In WPALCON_L (aka WPALCON) */ 35/* In WPALCON_L (aka WPALCON) */
diff --git a/arch/arm/mach-s5pc100/setup-sdhci.c b/arch/arm/mach-s5pc100/setup-sdhci.c
index f16946e456e..be25879bb2e 100644
--- a/arch/arm/mach-s5pc100/setup-sdhci.c
+++ b/arch/arm/mach-s5pc100/setup-sdhci.c
@@ -40,7 +40,7 @@ void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
40{ 40{
41 u32 ctrl2, ctrl3; 41 u32 ctrl2, ctrl3;
42 42
43 /* don't need to alter anything acording to card-type */ 43 /* don't need to alter anything according to card-type */
44 44
45 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4); 45 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4);
46 46
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio.h
index 1f4b595534c..a5a1e331f8e 100644
--- a/arch/arm/mach-s5pv210/include/mach/gpio.h
+++ b/arch/arm/mach-s5pv210/include/mach/gpio.h
@@ -18,7 +18,7 @@
18#define gpio_cansleep __gpio_cansleep 18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq 19#define gpio_to_irq __gpio_to_irq
20 20
21/* Practically, GPIO banks upto MP03 are the configurable gpio banks */ 21/* Practically, GPIO banks up to MP03 are the configurable gpio banks */
22 22
23/* GPIO bank sizes */ 23/* GPIO bank sizes */
24#define S5PV210_GPIO_A0_NR (8) 24#define S5PV210_GPIO_A0_NR (8)
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
index 746777d56df..3e3ac05bb7b 100644
--- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
@@ -32,10 +32,10 @@ void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
32 32
33 switch (width) { 33 switch (width) {
34 case 8: 34 case 8:
35 /* GPG1[3:6] special-funtion 3 */ 35 /* GPG1[3:6] special-function 3 */
36 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3)); 36 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3));
37 case 4: 37 case 4:
38 /* GPG0[3:6] special-funtion 2 */ 38 /* GPG0[3:6] special-function 2 */
39 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2)); 39 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2));
40 default: 40 default:
41 break; 41 break;
diff --git a/arch/arm/mach-s5pv210/setup-sdhci.c b/arch/arm/mach-s5pv210/setup-sdhci.c
index c32e202731c..a83b6c909f6 100644
--- a/arch/arm/mach-s5pv210/setup-sdhci.c
+++ b/arch/arm/mach-s5pv210/setup-sdhci.c
@@ -38,7 +38,7 @@ void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
38{ 38{
39 u32 ctrl2, ctrl3; 39 u32 ctrl2, ctrl3;
40 40
41 /* don't need to alter anything acording to card-type */ 41 /* don't need to alter anything according to card-type */
42 42
43 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4); 43 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4);
44 44
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index e697691eed2..41252d22e65 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -50,7 +50,7 @@ led-$(CONFIG_SA1100_SIMPAD) += leds-simpad.o
50# LEDs support 50# LEDs support
51obj-$(CONFIG_LEDS) += $(led-y) 51obj-$(CONFIG_LEDS) += $(led-y)
52 52
53# Miscelaneous functions 53# Miscellaneous functions
54obj-$(CONFIG_PM) += pm.o sleep.o 54obj-$(CONFIG_PM) += pm.o sleep.o
55obj-$(CONFIG_SA1100_SSP) += ssp.o 55obj-$(CONFIG_SA1100_SSP) += ssp.o
56 56
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index 07d4e8ba371..aaa8acf76b7 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -68,7 +68,7 @@
68 * clock change in ROM and jump to that code from the kernel. The main 68 * clock change in ROM and jump to that code from the kernel. The main
69 * disadvantage is that the ROM has to be modified, which is not 69 * disadvantage is that the ROM has to be modified, which is not
70 * possible on all SA-1100 platforms. Another disadvantage is that 70 * possible on all SA-1100 platforms. Another disadvantage is that
71 * jumping to ROM makes clock switching unecessary complicated. 71 * jumping to ROM makes clock switching unnecessary complicated.
72 * 72 *
73 * The idea behind this driver is that the memory configuration can be 73 * The idea behind this driver is that the memory configuration can be
74 * changed while running from DRAM (even with interrupts turned on!) 74 * changed while running from DRAM (even with interrupts turned on!)
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1100.h b/arch/arm/mach-sa1100/include/mach/SA-1100.h
index 4f7ea012e1e..bae8296f5db 100644
--- a/arch/arm/mach-sa1100/include/mach/SA-1100.h
+++ b/arch/arm/mach-sa1100/include/mach/SA-1100.h
@@ -1794,7 +1794,7 @@
1794 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \ 1794 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1795 DDAR_Ser4SSPRc + DDAR_DevAdd (__PREG(Ser4SSDR))) 1795 DDAR_Ser4SSPRc + DDAR_DevAdd (__PREG(Ser4SSDR)))
1796 1796
1797#define DCSR_RUN 0x00000001 /* DMA RUNing */ 1797#define DCSR_RUN 0x00000001 /* DMA running */
1798#define DCSR_IE 0x00000002 /* DMA Interrupt Enable */ 1798#define DCSR_IE 0x00000002 /* DMA Interrupt Enable */
1799#define DCSR_ERROR 0x00000004 /* DMA ERROR */ 1799#define DCSR_ERROR 0x00000004 /* DMA ERROR */
1800#define DCSR_DONEA 0x00000008 /* DONE DMA transfer buffer A */ 1800#define DCSR_DONEA 0x00000008 /* DONE DMA transfer buffer A */
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 9d490c66891..f50b00bd18a 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -29,7 +29,7 @@ static unsigned long jornada_ssp_flags;
29/** 29/**
30 * jornada_ssp_reverse - reverses input byte 30 * jornada_ssp_reverse - reverses input byte
31 * 31 *
32 * we need to reverse all data we recieve from the mcu due to its physical location 32 * we need to reverse all data we receive from the mcu due to its physical location
33 * returns : 01110111 -> 11101110 33 * returns : 01110111 -> 11101110
34 */ 34 */
35u8 inline jornada_ssp_reverse(u8 byte) 35u8 inline jornada_ssp_reverse(u8 byte)
@@ -179,7 +179,7 @@ static int __devinit jornada_ssp_probe(struct platform_device *dev)
179 179
180static int jornada_ssp_remove(struct platform_device *dev) 180static int jornada_ssp_remove(struct platform_device *dev)
181{ 181{
182 /* Note that this doesnt actually remove the driver, since theres nothing to remove 182 /* Note that this doesn't actually remove the driver, since theres nothing to remove
183 * It just makes sure everything is turned off */ 183 * It just makes sure everything is turned off */
184 GPSR = GPIO_GPIO25; 184 GPSR = GPIO_GPIO25;
185 ssp_exit(); 185 ssp_exit();
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 783b66fa95f..1e35fa976d6 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -947,7 +947,7 @@ static struct platform_device *ap4evb_devices[] __initdata = {
947 &ap4evb_camera, 947 &ap4evb_camera,
948}; 948};
949 949
950static int __init hdmi_init_pm_clock(void) 950static void __init hdmi_init_pm_clock(void)
951{ 951{
952 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick"); 952 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
953 int ret; 953 int ret;
@@ -988,20 +988,15 @@ static int __init hdmi_init_pm_clock(void)
988 pr_debug("PLLC2 set frequency %lu\n", rate); 988 pr_debug("PLLC2 set frequency %lu\n", rate);
989 989
990 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); 990 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
991 if (ret < 0) { 991 if (ret < 0)
992 pr_err("Cannot set HDMI parent: %d\n", ret); 992 pr_err("Cannot set HDMI parent: %d\n", ret);
993 goto out;
994 }
995 993
996out: 994out:
997 if (!IS_ERR(hdmi_ick)) 995 if (!IS_ERR(hdmi_ick))
998 clk_put(hdmi_ick); 996 clk_put(hdmi_ick);
999 return ret;
1000} 997}
1001 998
1002device_initcall(hdmi_init_pm_clock); 999static void __init fsi_init_pm_clock(void)
1003
1004static int __init fsi_init_pm_clock(void)
1005{ 1000{
1006 struct clk *fsia_ick; 1001 struct clk *fsia_ick;
1007 int ret; 1002 int ret;
@@ -1010,7 +1005,7 @@ static int __init fsi_init_pm_clock(void)
1010 if (IS_ERR(fsia_ick)) { 1005 if (IS_ERR(fsia_ick)) {
1011 ret = PTR_ERR(fsia_ick); 1006 ret = PTR_ERR(fsia_ick);
1012 pr_err("Cannot get FSI ICK: %d\n", ret); 1007 pr_err("Cannot get FSI ICK: %d\n", ret);
1013 return ret; 1008 return;
1014 } 1009 }
1015 1010
1016 ret = clk_set_parent(fsia_ick, &sh7372_fsiack_clk); 1011 ret = clk_set_parent(fsia_ick, &sh7372_fsiack_clk);
@@ -1018,10 +1013,7 @@ static int __init fsi_init_pm_clock(void)
1018 pr_err("Cannot set FSI-A parent: %d\n", ret); 1013 pr_err("Cannot set FSI-A parent: %d\n", ret);
1019 1014
1020 clk_put(fsia_ick); 1015 clk_put(fsia_ick);
1021
1022 return ret;
1023} 1016}
1024device_initcall(fsi_init_pm_clock);
1025 1017
1026/* 1018/*
1027 * FIXME !! 1019 * FIXME !!
@@ -1348,6 +1340,9 @@ static void __init ap4evb_init(void)
1348 __raw_writel(srcr4 & ~(1 << 13), SRCR4); 1340 __raw_writel(srcr4 & ~(1 << 13), SRCR4);
1349 1341
1350 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); 1342 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
1343
1344 hdmi_init_pm_clock();
1345 fsi_init_pm_clock();
1351} 1346}
1352 1347
1353static void __init ap4evb_timer_init(void) 1348static void __init ap4evb_timer_init(void)
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 8184d4d4f23..7da2ca24229 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -423,7 +423,7 @@ static struct platform_device fsi_hdmi_device = {
423 .name = "sh_fsi2_b_hdmi", 423 .name = "sh_fsi2_b_hdmi",
424}; 424};
425 425
426static int __init hdmi_init_pm_clock(void) 426static void __init hdmi_init_pm_clock(void)
427{ 427{
428 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick"); 428 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
429 int ret; 429 int ret;
@@ -467,17 +467,13 @@ static int __init hdmi_init_pm_clock(void)
467 pr_debug("PLLC2 set frequency %lu\n", rate); 467 pr_debug("PLLC2 set frequency %lu\n", rate);
468 468
469 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); 469 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
470 if (ret < 0) { 470 if (ret < 0)
471 pr_err("Cannot set HDMI parent: %d\n", ret); 471 pr_err("Cannot set HDMI parent: %d\n", ret);
472 goto out;
473 }
474 472
475out: 473out:
476 if (!IS_ERR(hdmi_ick)) 474 if (!IS_ERR(hdmi_ick))
477 clk_put(hdmi_ick); 475 clk_put(hdmi_ick);
478 return ret;
479} 476}
480device_initcall(hdmi_init_pm_clock);
481 477
482/* USB1 (Host) */ 478/* USB1 (Host) */
483static void usb1_host_port_power(int port, int power) 479static void usb1_host_port_power(int port, int power)
@@ -1218,6 +1214,8 @@ static void __init mackerel_init(void)
1218 sh7372_add_standard_devices(); 1214 sh7372_add_standard_devices();
1219 1215
1220 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); 1216 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
1217
1218 hdmi_init_pm_clock();
1221} 1219}
1222 1220
1223static void __init mackerel_timer_init(void) 1221static void __init mackerel_timer_init(void)
diff --git a/arch/arm/mach-shmobile/include/mach/mmc.h b/arch/arm/mach-shmobile/include/mach/mmc.h
index e11560a525a..21a59db638b 100644
--- a/arch/arm/mach-shmobile/include/mach/mmc.h
+++ b/arch/arm/mach-shmobile/include/mach/mmc.h
@@ -9,7 +9,7 @@
9 9
10#ifdef CONFIG_MACH_AP4EVB 10#ifdef CONFIG_MACH_AP4EVB
11#include "mach/mmc-ap4eb.h" 11#include "mach/mmc-ap4eb.h"
12#elif CONFIG_MACH_MACKEREL 12#elif defined(CONFIG_MACH_MACKEREL)
13#include "mach/mmc-mackerel.h" 13#include "mach/mmc-mackerel.h"
14#else 14#else
15#error "unsupported board." 15#error "unsupported board."
diff --git a/arch/arm/mach-shmobile/include/mach/zboot.h b/arch/arm/mach-shmobile/include/mach/zboot.h
index 6d6a205bcf9..9320aff0a20 100644
--- a/arch/arm/mach-shmobile/include/mach/zboot.h
+++ b/arch/arm/mach-shmobile/include/mach/zboot.h
@@ -13,7 +13,7 @@
13#ifdef CONFIG_MACH_AP4EVB 13#ifdef CONFIG_MACH_AP4EVB
14#define MACH_TYPE MACH_TYPE_AP4EVB 14#define MACH_TYPE MACH_TYPE_AP4EVB
15#include "mach/head-ap4evb.txt" 15#include "mach/head-ap4evb.txt"
16#elif CONFIG_MACH_MACKEREL 16#elif defined(CONFIG_MACH_MACKEREL)
17#define MACH_TYPE MACH_TYPE_MACKEREL 17#define MACH_TYPE MACH_TYPE_MACKEREL
18#include "mach/head-mackerel.txt" 18#include "mach/head-mackerel.txt"
19#else 19#else
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 1afe05038c2..823c703e573 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -1,7 +1,7 @@
1obj-y += common.o 1obj-y += common.o
2obj-y += devices.o 2obj-y += devices.o
3obj-y += io.o 3obj-y += io.o
4obj-y += irq.o legacy_irq.o 4obj-y += irq.o
5obj-y += clock.o 5obj-y += clock.o
6obj-y += timer.o 6obj-y += timer.o
7obj-y += gpio.o 7obj-y += gpio.o
diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c
index e945ae28ee7..f4ef5eb317b 100644
--- a/arch/arm/mach-tegra/dma.c
+++ b/arch/arm/mach-tegra/dma.c
@@ -223,7 +223,7 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
223 * - Change the source selector to invalid to stop the DMA from 223 * - Change the source selector to invalid to stop the DMA from
224 * FIFO to memory. 224 * FIFO to memory.
225 * - Read the status register to know the number of pending 225 * - Read the status register to know the number of pending
226 * bytes to be transfered. 226 * bytes to be transferred.
227 * - Finally stop or program the DMA to the next buffer in the 227 * - Finally stop or program the DMA to the next buffer in the
228 * list. 228 * list.
229 */ 229 */
@@ -244,7 +244,7 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
244 if (status & STA_BUSY) 244 if (status & STA_BUSY)
245 req->bytes_transferred -= to_transfer; 245 req->bytes_transferred -= to_transfer;
246 246
247 /* In continous transfer mode, DMA only tracks the count of the 247 /* In continuous transfer mode, DMA only tracks the count of the
248 * half DMA buffer. So, if the DMA already finished half the DMA 248 * half DMA buffer. So, if the DMA already finished half the DMA
249 * then add the half buffer to the completed count. 249 * then add the half buffer to the completed count.
250 * 250 *
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 76a3f654220..919d6383773 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -24,6 +24,8 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26 26
27#include <asm/mach/irq.h>
28
27#include <mach/iomap.h> 29#include <mach/iomap.h>
28#include <mach/suspend.h> 30#include <mach/suspend.h>
29 31
@@ -221,8 +223,9 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
221 int port; 223 int port;
222 int pin; 224 int pin;
223 int unmasked = 0; 225 int unmasked = 0;
226 struct irq_chip *chip = irq_desc_get_chip(desc);
224 227
225 desc->irq_data.chip->irq_ack(&desc->irq_data); 228 chained_irq_enter(chip, desc);
226 229
227 bank = irq_get_handler_data(irq); 230 bank = irq_get_handler_data(irq);
228 231
@@ -241,7 +244,7 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
241 */ 244 */
242 if (lvl & (0x100 << pin)) { 245 if (lvl & (0x100 << pin)) {
243 unmasked = 1; 246 unmasked = 1;
244 desc->irq_data.chip->irq_unmask(&desc->irq_data); 247 chained_irq_exit(chip, desc);
245 } 248 }
246 249
247 generic_handle_irq(gpio_to_irq(gpio + pin)); 250 generic_handle_irq(gpio_to_irq(gpio + pin));
@@ -249,7 +252,7 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
249 } 252 }
250 253
251 if (!unmasked) 254 if (!unmasked)
252 desc->irq_data.chip->irq_unmask(&desc->irq_data); 255 chained_irq_exit(chip, desc);
253 256
254} 257}
255 258
@@ -257,7 +260,8 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
257void tegra_gpio_resume(void) 260void tegra_gpio_resume(void)
258{ 261{
259 unsigned long flags; 262 unsigned long flags;
260 int b, p, i; 263 int b;
264 int p;
261 265
262 local_irq_save(flags); 266 local_irq_save(flags);
263 267
@@ -280,7 +284,8 @@ void tegra_gpio_resume(void)
280void tegra_gpio_suspend(void) 284void tegra_gpio_suspend(void)
281{ 285{
282 unsigned long flags; 286 unsigned long flags;
283 int b, p, i; 287 int b;
288 int p;
284 289
285 local_irq_save(flags); 290 local_irq_save(flags);
286 for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { 291 for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) {
diff --git a/arch/arm/mach-tegra/include/mach/dma.h b/arch/arm/mach-tegra/include/mach/dma.h
index 39011bd9a92..d0132e8031a 100644
--- a/arch/arm/mach-tegra/include/mach/dma.h
+++ b/arch/arm/mach-tegra/include/mach/dma.h
@@ -92,11 +92,11 @@ struct tegra_dma_req {
92 /* This is a called from the DMA ISR context when the DMA is still in 92 /* This is a called from the DMA ISR context when the DMA is still in
93 * progress and is actively filling same buffer. 93 * progress and is actively filling same buffer.
94 * 94 *
95 * In case of continous mode receive, this threshold is 1/2 the buffer 95 * In case of continuous mode receive, this threshold is 1/2 the buffer
96 * size. In other cases, this will not even be called as there is no 96 * size. In other cases, this will not even be called as there is no
97 * hardware support for it. 97 * hardware support for it.
98 * 98 *
99 * In the case of continous mode receive, if there is next req already 99 * In the case of continuous mode receive, if there is next req already
100 * queued, DMA programs the HW to use that req when this req is 100 * queued, DMA programs the HW to use that req when this req is
101 * completed. If there is no "next req" queued, then DMA ISR doesn't do 101 * completed. If there is no "next req" queued, then DMA ISR doesn't do
102 * anything before calling this callback. 102 * anything before calling this callback.
diff --git a/arch/arm/mach-tegra/include/mach/legacy_irq.h b/arch/arm/mach-tegra/include/mach/legacy_irq.h
deleted file mode 100644
index d898c0e3d90..00000000000
--- a/arch/arm/mach-tegra/include/mach/legacy_irq.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/legacy_irq.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H
19#define _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H
20
21void tegra_legacy_mask_irq(unsigned int irq);
22void tegra_legacy_unmask_irq(unsigned int irq);
23void tegra_legacy_select_fiq(unsigned int irq, bool fiq);
24void tegra_legacy_force_irq_set(unsigned int irq);
25void tegra_legacy_force_irq_clr(unsigned int irq);
26int tegra_legacy_force_irq_status(unsigned int irq);
27void tegra_legacy_select_fiq(unsigned int irq, bool fiq);
28unsigned long tegra_legacy_vfiq(int nr);
29unsigned long tegra_legacy_class(int nr);
30int tegra_legacy_irq_set_wake(int irq, int enable);
31void tegra_legacy_irq_set_lp1_wake_mask(void);
32void tegra_legacy_irq_restore_mask(void);
33void tegra_init_legacy_irq(void);
34
35#endif
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 4330d8995b2..4956c3cea73 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Copyright (C) 2010 Google, Inc. 2 * Copyright (C) 2011 Google, Inc.
3 * 3 *
4 * Author: 4 * Author:
5 * Colin Cross <ccross@google.com> 5 * Colin Cross <ccross@android.com>
6 * 6 *
7 * Copyright (C) 2010, NVIDIA Corporation 7 * Copyright (C) 2010, NVIDIA Corporation
8 * 8 *
@@ -18,8 +18,6 @@
18 */ 18 */
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/delay.h>
22#include <linux/init.h>
23#include <linux/interrupt.h> 21#include <linux/interrupt.h>
24#include <linux/irq.h> 22#include <linux/irq.h>
25#include <linux/io.h> 23#include <linux/io.h>
@@ -27,134 +25,110 @@
27#include <asm/hardware/gic.h> 25#include <asm/hardware/gic.h>
28 26
29#include <mach/iomap.h> 27#include <mach/iomap.h>
30#include <mach/legacy_irq.h>
31#include <mach/suspend.h>
32 28
33#include "board.h" 29#include "board.h"
34 30
35#define PMC_CTRL 0x0 31#define INT_SYS_NR (INT_GPIO_BASE - INT_PRI_BASE)
36#define PMC_CTRL_LATCH_WAKEUPS (1 << 5) 32#define INT_SYS_SZ (INT_SEC_BASE - INT_PRI_BASE)
37#define PMC_WAKE_MASK 0xc 33#define PPI_NR ((INT_SYS_NR+INT_SYS_SZ-1)/INT_SYS_SZ)
38#define PMC_WAKE_LEVEL 0x10 34
39#define PMC_WAKE_STATUS 0x14 35#define ICTLR_CPU_IEP_VFIQ 0x08
40#define PMC_SW_WAKE_STATUS 0x18 36#define ICTLR_CPU_IEP_FIR 0x14
41#define PMC_DPD_SAMPLE 0x20 37#define ICTLR_CPU_IEP_FIR_SET 0x18
38#define ICTLR_CPU_IEP_FIR_CLR 0x1c
39
40#define ICTLR_CPU_IER 0x20
41#define ICTLR_CPU_IER_SET 0x24
42#define ICTLR_CPU_IER_CLR 0x28
43#define ICTLR_CPU_IEP_CLASS 0x2C
44
45#define ICTLR_COP_IER 0x30
46#define ICTLR_COP_IER_SET 0x34
47#define ICTLR_COP_IER_CLR 0x38
48#define ICTLR_COP_IEP_CLASS 0x3c
49
50#define NUM_ICTLRS 4
51#define FIRST_LEGACY_IRQ 32
52
53static void __iomem *ictlr_reg_base[] = {
54 IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE),
55 IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE),
56 IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE),
57 IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE),
58};
42 59
43static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 60static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg)
61{
62 void __iomem *base;
63 u32 mask;
44 64
45static u32 tegra_lp0_wake_enb; 65 BUG_ON(irq < FIRST_LEGACY_IRQ ||
46static u32 tegra_lp0_wake_level; 66 irq >= FIRST_LEGACY_IRQ + NUM_ICTLRS * 32);
47static u32 tegra_lp0_wake_level_any;
48 67
49static void (*tegra_gic_mask_irq)(struct irq_data *d); 68 base = ictlr_reg_base[(irq - FIRST_LEGACY_IRQ) / 32];
50static void (*tegra_gic_unmask_irq)(struct irq_data *d); 69 mask = BIT((irq - FIRST_LEGACY_IRQ) % 32);
51static void (*tegra_gic_ack_irq)(struct irq_data *d);
52 70
53/* ensures that sufficient time is passed for a register write to 71 __raw_writel(mask, base + reg);
54 * serialize into the 32KHz domain */
55static void pmc_32kwritel(u32 val, unsigned long offs)
56{
57 writel(val, pmc + offs);
58 udelay(130);
59} 72}
60 73
61int tegra_set_lp1_wake(int irq, int enable) 74static void tegra_mask(struct irq_data *d)
62{ 75{
63 return tegra_legacy_irq_set_wake(irq, enable); 76 if (d->irq < FIRST_LEGACY_IRQ)
77 return;
78
79 tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_CLR);
64} 80}
65 81
66void tegra_set_lp0_wake_pads(u32 wake_enb, u32 wake_level, u32 wake_any) 82static void tegra_unmask(struct irq_data *d)
67{ 83{
68 u32 temp; 84 if (d->irq < FIRST_LEGACY_IRQ)
69 u32 status; 85 return;
70 u32 lvl;
71
72 wake_level &= wake_enb;
73 wake_any &= wake_enb;
74 86
75 wake_level |= (tegra_lp0_wake_level & tegra_lp0_wake_enb); 87 tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_SET);
76 wake_any |= (tegra_lp0_wake_level_any & tegra_lp0_wake_enb);
77
78 wake_enb |= tegra_lp0_wake_enb;
79
80 pmc_32kwritel(0, PMC_SW_WAKE_STATUS);
81 temp = readl(pmc + PMC_CTRL);
82 temp |= PMC_CTRL_LATCH_WAKEUPS;
83 pmc_32kwritel(temp, PMC_CTRL);
84 temp &= ~PMC_CTRL_LATCH_WAKEUPS;
85 pmc_32kwritel(temp, PMC_CTRL);
86 status = readl(pmc + PMC_SW_WAKE_STATUS);
87 lvl = readl(pmc + PMC_WAKE_LEVEL);
88
89 /* flip the wakeup trigger for any-edge triggered pads
90 * which are currently asserting as wakeups */
91 lvl ^= status;
92 lvl &= wake_any;
93
94 wake_level |= lvl;
95
96 writel(wake_level, pmc + PMC_WAKE_LEVEL);
97 /* Enable DPD sample to trigger sampling pads data and direction
98 * in which pad will be driven during lp0 mode*/
99 writel(0x1, pmc + PMC_DPD_SAMPLE);
100
101 writel(wake_enb, pmc + PMC_WAKE_MASK);
102} 88}
103 89
104static void tegra_mask(struct irq_data *d) 90static void tegra_ack(struct irq_data *d)
105{ 91{
106 tegra_gic_mask_irq(d); 92 if (d->irq < FIRST_LEGACY_IRQ)
107 tegra_legacy_mask_irq(d->irq); 93 return;
108}
109 94
110static void tegra_unmask(struct irq_data *d) 95 tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
111{
112 tegra_gic_unmask_irq(d);
113 tegra_legacy_unmask_irq(d->irq);
114} 96}
115 97
116static void tegra_ack(struct irq_data *d) 98static void tegra_eoi(struct irq_data *d)
117{ 99{
118 tegra_legacy_force_irq_clr(d->irq); 100 if (d->irq < FIRST_LEGACY_IRQ)
119 tegra_gic_ack_irq(d); 101 return;
102
103 tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR);
120} 104}
121 105
122static int tegra_retrigger(struct irq_data *d) 106static int tegra_retrigger(struct irq_data *d)
123{ 107{
124 tegra_legacy_force_irq_set(d->irq); 108 if (d->irq < FIRST_LEGACY_IRQ)
109 return 0;
110
111 tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_SET);
112
125 return 1; 113 return 1;
126} 114}
127 115
128static struct irq_chip tegra_irq = {
129 .name = "PPI",
130 .irq_ack = tegra_ack,
131 .irq_mask = tegra_mask,
132 .irq_unmask = tegra_unmask,
133 .irq_retrigger = tegra_retrigger,
134};
135
136void __init tegra_init_irq(void) 116void __init tegra_init_irq(void)
137{ 117{
138 struct irq_chip *gic; 118 int i;
139 unsigned int i;
140 int irq;
141 119
142 tegra_init_legacy_irq(); 120 for (i = 0; i < NUM_ICTLRS; i++) {
121 void __iomem *ictlr = ictlr_reg_base[i];
122 writel(~0, ictlr + ICTLR_CPU_IER_CLR);
123 writel(0, ictlr + ICTLR_CPU_IEP_CLASS);
124 }
125
126 gic_arch_extn.irq_ack = tegra_ack;
127 gic_arch_extn.irq_eoi = tegra_eoi;
128 gic_arch_extn.irq_mask = tegra_mask;
129 gic_arch_extn.irq_unmask = tegra_unmask;
130 gic_arch_extn.irq_retrigger = tegra_retrigger;
143 131
144 gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE), 132 gic_init(0, 29, IO_ADDRESS(TEGRA_ARM_INT_DIST_BASE),
145 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); 133 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100));
146
147 gic = irq_get_chip(29);
148 tegra_gic_unmask_irq = gic->irq_unmask;
149 tegra_gic_mask_irq = gic->irq_mask;
150 tegra_gic_ack_irq = gic->irq_ack;
151#ifdef CONFIG_SMP
152 tegra_irq.irq_set_affinity = gic->irq_set_affinity;
153#endif
154
155 for (i = 0; i < INT_MAIN_NR; i++) {
156 irq = INT_PRI_BASE + i;
157 irq_set_chip_and_handler(irq, &tegra_irq, handle_level_irq);
158 set_irq_flags(irq, IRQF_VALID);
159 }
160} 134}
diff --git a/arch/arm/mach-tegra/legacy_irq.c b/arch/arm/mach-tegra/legacy_irq.c
deleted file mode 100644
index 38eb719a4f5..00000000000
--- a/arch/arm/mach-tegra/legacy_irq.c
+++ /dev/null
@@ -1,215 +0,0 @@
1/*
2 * arch/arm/mach-tegra/legacy_irq.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#include <linux/io.h>
19#include <linux/kernel.h>
20#include <mach/iomap.h>
21#include <mach/irqs.h>
22#include <mach/legacy_irq.h>
23
24#define INT_SYS_NR (INT_GPIO_BASE - INT_PRI_BASE)
25#define INT_SYS_SZ (INT_SEC_BASE - INT_PRI_BASE)
26#define PPI_NR ((INT_SYS_NR+INT_SYS_SZ-1)/INT_SYS_SZ)
27
28#define ICTLR_CPU_IEP_VFIQ 0x08
29#define ICTLR_CPU_IEP_FIR 0x14
30#define ICTLR_CPU_IEP_FIR_SET 0x18
31#define ICTLR_CPU_IEP_FIR_CLR 0x1c
32
33#define ICTLR_CPU_IER 0x20
34#define ICTLR_CPU_IER_SET 0x24
35#define ICTLR_CPU_IER_CLR 0x28
36#define ICTLR_CPU_IEP_CLASS 0x2C
37
38#define ICTLR_COP_IER 0x30
39#define ICTLR_COP_IER_SET 0x34
40#define ICTLR_COP_IER_CLR 0x38
41#define ICTLR_COP_IEP_CLASS 0x3c
42
43#define NUM_ICTLRS 4
44
45static void __iomem *ictlr_reg_base[] = {
46 IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE),
47 IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE),
48 IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE),
49 IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE),
50};
51
52static u32 tegra_legacy_wake_mask[4];
53static u32 tegra_legacy_saved_mask[4];
54
55/* When going into deep sleep, the CPU is powered down, taking the GIC with it
56 In order to wake, the wake interrupts need to be enabled in the legacy
57 interrupt controller. */
58void tegra_legacy_unmask_irq(unsigned int irq)
59{
60 void __iomem *base;
61 pr_debug("%s: %d\n", __func__, irq);
62
63 irq -= 32;
64 base = ictlr_reg_base[irq>>5];
65 writel(1 << (irq & 31), base + ICTLR_CPU_IER_SET);
66}
67
68void tegra_legacy_mask_irq(unsigned int irq)
69{
70 void __iomem *base;
71 pr_debug("%s: %d\n", __func__, irq);
72
73 irq -= 32;
74 base = ictlr_reg_base[irq>>5];
75 writel(1 << (irq & 31), base + ICTLR_CPU_IER_CLR);
76}
77
78void tegra_legacy_force_irq_set(unsigned int irq)
79{
80 void __iomem *base;
81 pr_debug("%s: %d\n", __func__, irq);
82
83 irq -= 32;
84 base = ictlr_reg_base[irq>>5];
85 writel(1 << (irq & 31), base + ICTLR_CPU_IEP_FIR_SET);
86}
87
88void tegra_legacy_force_irq_clr(unsigned int irq)
89{
90 void __iomem *base;
91 pr_debug("%s: %d\n", __func__, irq);
92
93 irq -= 32;
94 base = ictlr_reg_base[irq>>5];
95 writel(1 << (irq & 31), base + ICTLR_CPU_IEP_FIR_CLR);
96}
97
98int tegra_legacy_force_irq_status(unsigned int irq)
99{
100 void __iomem *base;
101 pr_debug("%s: %d\n", __func__, irq);
102
103 irq -= 32;
104 base = ictlr_reg_base[irq>>5];
105 return !!(readl(base + ICTLR_CPU_IEP_FIR) & (1 << (irq & 31)));
106}
107
108void tegra_legacy_select_fiq(unsigned int irq, bool fiq)
109{
110 void __iomem *base;
111 pr_debug("%s: %d\n", __func__, irq);
112
113 irq -= 32;
114 base = ictlr_reg_base[irq>>5];
115 writel(fiq << (irq & 31), base + ICTLR_CPU_IEP_CLASS);
116}
117
118unsigned long tegra_legacy_vfiq(int nr)
119{
120 void __iomem *base;
121 base = ictlr_reg_base[nr];
122 return readl(base + ICTLR_CPU_IEP_VFIQ);
123}
124
125unsigned long tegra_legacy_class(int nr)
126{
127 void __iomem *base;
128 base = ictlr_reg_base[nr];
129 return readl(base + ICTLR_CPU_IEP_CLASS);
130}
131
132int tegra_legacy_irq_set_wake(int irq, int enable)
133{
134 irq -= 32;
135 if (enable)
136 tegra_legacy_wake_mask[irq >> 5] |= 1 << (irq & 31);
137 else
138 tegra_legacy_wake_mask[irq >> 5] &= ~(1 << (irq & 31));
139
140 return 0;
141}
142
143void tegra_legacy_irq_set_lp1_wake_mask(void)
144{
145 void __iomem *base;
146 int i;
147
148 for (i = 0; i < NUM_ICTLRS; i++) {
149 base = ictlr_reg_base[i];
150 tegra_legacy_saved_mask[i] = readl(base + ICTLR_CPU_IER);
151 writel(tegra_legacy_wake_mask[i], base + ICTLR_CPU_IER);
152 }
153}
154
155void tegra_legacy_irq_restore_mask(void)
156{
157 void __iomem *base;
158 int i;
159
160 for (i = 0; i < NUM_ICTLRS; i++) {
161 base = ictlr_reg_base[i];
162 writel(tegra_legacy_saved_mask[i], base + ICTLR_CPU_IER);
163 }
164}
165
166void tegra_init_legacy_irq(void)
167{
168 int i;
169
170 for (i = 0; i < NUM_ICTLRS; i++) {
171 void __iomem *ictlr = ictlr_reg_base[i];
172 writel(~0, ictlr + ICTLR_CPU_IER_CLR);
173 writel(0, ictlr + ICTLR_CPU_IEP_CLASS);
174 }
175}
176
177#ifdef CONFIG_PM
178static u32 cop_ier[NUM_ICTLRS];
179static u32 cpu_ier[NUM_ICTLRS];
180static u32 cpu_iep[NUM_ICTLRS];
181
182void tegra_irq_suspend(void)
183{
184 unsigned long flags;
185 int i;
186
187 local_irq_save(flags);
188 for (i = 0; i < NUM_ICTLRS; i++) {
189 void __iomem *ictlr = ictlr_reg_base[i];
190 cpu_ier[i] = readl(ictlr + ICTLR_CPU_IER);
191 cpu_iep[i] = readl(ictlr + ICTLR_CPU_IEP_CLASS);
192 cop_ier[i] = readl(ictlr + ICTLR_COP_IER);
193 writel(~0, ictlr + ICTLR_COP_IER_CLR);
194 }
195 local_irq_restore(flags);
196}
197
198void tegra_irq_resume(void)
199{
200 unsigned long flags;
201 int i;
202
203 local_irq_save(flags);
204 for (i = 0; i < NUM_ICTLRS; i++) {
205 void __iomem *ictlr = ictlr_reg_base[i];
206 writel(cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS);
207 writel(~0ul, ictlr + ICTLR_CPU_IER_CLR);
208 writel(cpu_ier[i], ictlr + ICTLR_CPU_IER_SET);
209 writel(0, ictlr + ICTLR_COP_IEP_CLASS);
210 writel(~0ul, ictlr + ICTLR_COP_IER_CLR);
211 writel(cop_ier[i], ictlr + ICTLR_COP_IER_SET);
212 }
213 local_irq_restore(flags);
214}
215#endif
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 6d7c4eea4dc..4459470c052 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -1362,14 +1362,15 @@ static int tegra_clk_shared_bus_set_rate(struct clk *c, unsigned long rate)
1362{ 1362{
1363 unsigned long flags; 1363 unsigned long flags;
1364 int ret; 1364 int ret;
1365 long new_rate = rate;
1365 1366
1366 rate = clk_round_rate(c->parent, rate); 1367 new_rate = clk_round_rate(c->parent, new_rate);
1367 if (rate < 0) 1368 if (new_rate < 0)
1368 return rate; 1369 return new_rate;
1369 1370
1370 spin_lock_irqsave(&c->parent->spinlock, flags); 1371 spin_lock_irqsave(&c->parent->spinlock, flags);
1371 1372
1372 c->u.shared_bus_user.rate = rate; 1373 c->u.shared_bus_user.rate = new_rate;
1373 ret = tegra_clk_shared_bus_update(c->parent); 1374 ret = tegra_clk_shared_bus_update(c->parent);
1374 1375
1375 spin_unlock_irqrestore(&c->parent->spinlock, flags); 1376 spin_unlock_irqrestore(&c->parent->spinlock, flags);
diff --git a/arch/arm/mach-u300/clock.c b/arch/arm/mach-u300/clock.c
index fabcc49abe8..5535dd0a78c 100644
--- a/arch/arm/mach-u300/clock.c
+++ b/arch/arm/mach-u300/clock.c
@@ -263,7 +263,7 @@ static void disable_i2s0_vcxo(void)
263 val = readw(U300_SYSCON_VBASE + U300_SYSCON_CCR); 263 val = readw(U300_SYSCON_VBASE + U300_SYSCON_CCR);
264 val &= ~U300_SYSCON_CCR_I2S0_USE_VCXO; 264 val &= ~U300_SYSCON_CCR_I2S0_USE_VCXO;
265 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR); 265 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR);
266 /* Deactivate VCXO if noone else is using VCXO */ 266 /* Deactivate VCXO if no one else is using VCXO */
267 if (!(val & U300_SYSCON_CCR_I2S1_USE_VCXO)) 267 if (!(val & U300_SYSCON_CCR_I2S1_USE_VCXO))
268 val &= ~U300_SYSCON_CCR_TURN_VCXO_ON; 268 val &= ~U300_SYSCON_CCR_TURN_VCXO_ON;
269 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR); 269 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR);
@@ -283,7 +283,7 @@ static void disable_i2s1_vcxo(void)
283 val = readw(U300_SYSCON_VBASE + U300_SYSCON_CCR); 283 val = readw(U300_SYSCON_VBASE + U300_SYSCON_CCR);
284 val &= ~U300_SYSCON_CCR_I2S1_USE_VCXO; 284 val &= ~U300_SYSCON_CCR_I2S1_USE_VCXO;
285 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR); 285 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR);
286 /* Deactivate VCXO if noone else is using VCXO */ 286 /* Deactivate VCXO if no one else is using VCXO */
287 if (!(val & U300_SYSCON_CCR_I2S0_USE_VCXO)) 287 if (!(val & U300_SYSCON_CCR_I2S0_USE_VCXO))
288 val &= ~U300_SYSCON_CCR_TURN_VCXO_ON; 288 val &= ~U300_SYSCON_CCR_TURN_VCXO_ON;
289 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR); 289 writew(val, U300_SYSCON_VBASE + U300_SYSCON_CCR);
@@ -649,7 +649,7 @@ static unsigned long clk_round_rate_cpuclk(struct clk *clk, unsigned long rate)
649 */ 649 */
650long clk_round_rate(struct clk *clk, unsigned long rate) 650long clk_round_rate(struct clk *clk, unsigned long rate)
651{ 651{
652 /* TODO: get apropriate switches for EMIFCLK, AHBCLK and MCLK */ 652 /* TODO: get appropriate switches for EMIFCLK, AHBCLK and MCLK */
653 /* Else default to fixed value */ 653 /* Else default to fixed value */
654 654
655 if (clk->round_rate) { 655 if (clk->round_rate) {
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index dc8746d7826..6e1907fa94f 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -52,7 +52,7 @@ static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
52 * on value present in GpioSel1 to GpioSel6 and AlternatFunction 52 * on value present in GpioSel1 to GpioSel6 and AlternatFunction
53 * register. This is the array of 7 configuration settings. 53 * register. This is the array of 7 configuration settings.
54 * One has to compile time decide these settings. Below is the 54 * One has to compile time decide these settings. Below is the
55 * explaination of these setting 55 * explanation of these setting
56 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO 56 * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
57 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO 57 * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
58 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO 58 * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
@@ -178,16 +178,15 @@ static struct i2c_board_info __initdata mop500_i2c0_devices[] = {
178 .irq = NOMADIK_GPIO_TO_IRQ(217), 178 .irq = NOMADIK_GPIO_TO_IRQ(217),
179 .platform_data = &mop500_tc35892_data, 179 .platform_data = &mop500_tc35892_data,
180 }, 180 },
181}; 181 /* I2C0 devices only available prior to HREFv60 */
182
183/* I2C0 devices only available prior to HREFv60 */
184static struct i2c_board_info __initdata mop500_i2c0_old_devices[] = {
185 { 182 {
186 I2C_BOARD_INFO("tps61052", 0x33), 183 I2C_BOARD_INFO("tps61052", 0x33),
187 .platform_data = &mop500_tps61052_data, 184 .platform_data = &mop500_tps61052_data,
188 }, 185 },
189}; 186};
190 187
188#define NUM_PRE_V60_I2C0_DEVICES 1
189
191static struct i2c_board_info __initdata mop500_i2c2_devices[] = { 190static struct i2c_board_info __initdata mop500_i2c2_devices[] = {
192 { 191 {
193 /* lp5521 LED driver, 1st device */ 192 /* lp5521 LED driver, 1st device */
@@ -425,6 +424,8 @@ static void __init mop500_uart_init(void)
425 424
426static void __init mop500_init_machine(void) 425static void __init mop500_init_machine(void)
427{ 426{
427 int i2c0_devs;
428
428 /* 429 /*
429 * The HREFv60 board removed a GPIO expander and routed 430 * The HREFv60 board removed a GPIO expander and routed
430 * all these GPIO pins to the internal GPIO controller 431 * all these GPIO pins to the internal GPIO controller
@@ -448,11 +449,11 @@ static void __init mop500_init_machine(void)
448 449
449 platform_device_register(&ab8500_device); 450 platform_device_register(&ab8500_device);
450 451
451 i2c_register_board_info(0, mop500_i2c0_devices, 452 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
452 ARRAY_SIZE(mop500_i2c0_devices)); 453 if (machine_is_hrefv60())
453 if (!machine_is_hrefv60()) 454 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
454 i2c_register_board_info(0, mop500_i2c0_old_devices, 455
455 ARRAY_SIZE(mop500_i2c0_old_devices)); 456 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
456 i2c_register_board_info(2, mop500_i2c2_devices, 457 i2c_register_board_info(2, mop500_i2c2_devices,
457 ARRAY_SIZE(mop500_i2c2_devices)); 458 ARRAY_SIZE(mop500_i2c2_devices));
458} 459}
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h
index 0fefb34c11e..16647b25537 100644
--- a/arch/arm/mach-ux500/include/mach/db8500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h
@@ -58,7 +58,7 @@
58#define U8500_GPIO2_BASE (U8500_PER2_BASE + 0xE000) 58#define U8500_GPIO2_BASE (U8500_PER2_BASE + 0xE000)
59#define U8500_GPIO3_BASE (U8500_PER5_BASE + 0x1E000) 59#define U8500_GPIO3_BASE (U8500_PER5_BASE + 0x1E000)
60 60
61/* per7 base addressess */ 61/* per7 base addresses */
62#define U8500_CR_BASE_ED (U8500_PER7_BASE_ED + 0x8000) 62#define U8500_CR_BASE_ED (U8500_PER7_BASE_ED + 0x8000)
63#define U8500_MTU0_BASE_ED (U8500_PER7_BASE_ED + 0xa000) 63#define U8500_MTU0_BASE_ED (U8500_PER7_BASE_ED + 0xa000)
64#define U8500_MTU1_BASE_ED (U8500_PER7_BASE_ED + 0xb000) 64#define U8500_MTU1_BASE_ED (U8500_PER7_BASE_ED + 0xb000)
@@ -68,7 +68,7 @@
68#define U8500_UART0_BASE (U8500_PER1_BASE + 0x0000) 68#define U8500_UART0_BASE (U8500_PER1_BASE + 0x0000)
69#define U8500_UART1_BASE (U8500_PER1_BASE + 0x1000) 69#define U8500_UART1_BASE (U8500_PER1_BASE + 0x1000)
70 70
71/* per6 base addressess */ 71/* per6 base addresses */
72#define U8500_RNG_BASE (U8500_PER6_BASE + 0x0000) 72#define U8500_RNG_BASE (U8500_PER6_BASE + 0x0000)
73#define U8500_PKA_BASE (U8500_PER6_BASE + 0x1000) 73#define U8500_PKA_BASE (U8500_PER6_BASE + 0x1000)
74#define U8500_PKAM_BASE (U8500_PER6_BASE + 0x2000) 74#define U8500_PKAM_BASE (U8500_PER6_BASE + 0x2000)
@@ -79,11 +79,11 @@
79#define U8500_CRYPTO1_BASE (U8500_PER6_BASE + 0xb000) 79#define U8500_CRYPTO1_BASE (U8500_PER6_BASE + 0xb000)
80#define U8500_CLKRST6_BASE (U8500_PER6_BASE + 0xf000) 80#define U8500_CLKRST6_BASE (U8500_PER6_BASE + 0xf000)
81 81
82/* per5 base addressess */ 82/* per5 base addresses */
83#define U8500_USBOTG_BASE (U8500_PER5_BASE + 0x00000) 83#define U8500_USBOTG_BASE (U8500_PER5_BASE + 0x00000)
84#define U8500_CLKRST5_BASE (U8500_PER5_BASE + 0x1f000) 84#define U8500_CLKRST5_BASE (U8500_PER5_BASE + 0x1f000)
85 85
86/* per4 base addressess */ 86/* per4 base addresses */
87#define U8500_BACKUPRAM0_BASE (U8500_PER4_BASE + 0x00000) 87#define U8500_BACKUPRAM0_BASE (U8500_PER4_BASE + 0x00000)
88#define U8500_BACKUPRAM1_BASE (U8500_PER4_BASE + 0x01000) 88#define U8500_BACKUPRAM1_BASE (U8500_PER4_BASE + 0x01000)
89#define U8500_RTT0_BASE (U8500_PER4_BASE + 0x02000) 89#define U8500_RTT0_BASE (U8500_PER4_BASE + 0x02000)
@@ -106,7 +106,7 @@
106#define U8500_SDI5_BASE (U8500_PER3_BASE + 0x8000) 106#define U8500_SDI5_BASE (U8500_PER3_BASE + 0x8000)
107#define U8500_CLKRST3_BASE (U8500_PER3_BASE + 0xf000) 107#define U8500_CLKRST3_BASE (U8500_PER3_BASE + 0xf000)
108 108
109/* per2 base addressess */ 109/* per2 base addresses */
110#define U8500_I2C3_BASE (U8500_PER2_BASE + 0x0000) 110#define U8500_I2C3_BASE (U8500_PER2_BASE + 0x0000)
111#define U8500_SPI2_BASE (U8500_PER2_BASE + 0x1000) 111#define U8500_SPI2_BASE (U8500_PER2_BASE + 0x1000)
112#define U8500_SPI1_BASE (U8500_PER2_BASE + 0x2000) 112#define U8500_SPI1_BASE (U8500_PER2_BASE + 0x2000)
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h
index ab0fe1432fa..088b550c40d 100644
--- a/arch/arm/mach-ux500/include/mach/uncompress.h
+++ b/arch/arm/mach-ux500/include/mach/uncompress.h
@@ -24,7 +24,7 @@
24#include <linux/amba/serial.h> 24#include <linux/amba/serial.h>
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26 26
27static u32 ux500_uart_base; 27u32 ux500_uart_base;
28 28
29static void putc(const char c) 29static void putc(const char c)
30{ 30{
diff --git a/arch/arm/mach-w90x900/include/mach/uncompress.h b/arch/arm/mach-w90x900/include/mach/uncompress.h
index 56f1a74d701..03130212ace 100644
--- a/arch/arm/mach-w90x900/include/mach/uncompress.h
+++ b/arch/arm/mach-w90x900/include/mach/uncompress.h
@@ -27,7 +27,7 @@
27#define arch_decomp_wdog() 27#define arch_decomp_wdog()
28 28
29#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE) 29#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
30static volatile u32 * uart_base = (u32 *)UART0_PA; 30static volatile u32 * const uart_base = (u32 *)UART0_PA;
31 31
32static void putc(int ch) 32static void putc(int ch)
33{ 33{
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S
index d3644db467b..f40c69656d8 100644
--- a/arch/arm/mm/cache-v4wb.S
+++ b/arch/arm/mm/cache-v4wb.S
@@ -32,7 +32,7 @@
32/* 32/*
33 * This is the size at which it becomes more efficient to 33 * This is the size at which it becomes more efficient to
34 * clean the whole cache, rather than using the individual 34 * clean the whole cache, rather than using the individual
35 * cache line maintainence instructions. 35 * cache line maintenance instructions.
36 * 36 *
37 * Size Clean (ticks) Dirty (ticks) 37 * Size Clean (ticks) Dirty (ticks)
38 * 4096 21 20 21 53 55 54 38 * 4096 21 20 21 53 55 54
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index 49c2b66cf3d..a7b276dbda1 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -34,7 +34,7 @@
34/* 34/*
35 * This is the size at which it becomes more efficient to 35 * This is the size at which it becomes more efficient to
36 * clean the whole cache, rather than using the individual 36 * clean the whole cache, rather than using the individual
37 * cache line maintainence instructions. 37 * cache line maintenance instructions.
38 * 38 *
39 * *** This needs benchmarking 39 * *** This needs benchmarking
40 */ 40 */
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 6136e68ce95..dc18d81ef8c 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -96,7 +96,7 @@ ENDPROC(v7_flush_dcache_all)
96 * Flush the entire cache system. 96 * Flush the entire cache system.
97 * The data cache flush is now achieved using atomic clean / invalidates 97 * The data cache flush is now achieved using atomic clean / invalidates
98 * working outwards from L1 cache. This is done using Set/Way based cache 98 * working outwards from L1 cache. This is done using Set/Way based cache
99 * maintainance instructions. 99 * maintenance instructions.
100 * The instruction cache can still be invalidated back to the point of 100 * The instruction cache can still be invalidated back to the point of
101 * unification in a single instruction. 101 * unification in a single instruction.
102 * 102 *
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index afe209e1e1f..74be05f3e03 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -7,6 +7,7 @@
7#include <linux/shm.h> 7#include <linux/shm.h>
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/personality.h>
10#include <linux/random.h> 11#include <linux/random.h>
11#include <asm/cputype.h> 12#include <asm/cputype.h>
12#include <asm/system.h> 13#include <asm/system.h>
@@ -82,7 +83,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
82 mm->cached_hole_size = 0; 83 mm->cached_hole_size = 0;
83 } 84 }
84 /* 8 bits of randomness in 20 address space bits */ 85 /* 8 bits of randomness in 20 address space bits */
85 if (current->flags & PF_RANDOMIZE) 86 if ((current->flags & PF_RANDOMIZE) &&
87 !(current->personality & ADDR_NO_RANDOMIZE))
86 addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT; 88 addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT;
87 89
88full_search: 90full_search:
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 226e3d8351c..6c4e7fd6c8a 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -64,7 +64,7 @@
64/* 64/*
65 * This is the size at which it becomes more efficient to 65 * This is the size at which it becomes more efficient to
66 * clean the whole cache, rather than using the individual 66 * clean the whole cache, rather than using the individual
67 * cache line maintainence instructions. 67 * cache line maintenance instructions.
68 */ 68 */
69#define CACHE_DLIMIT 32768 69#define CACHE_DLIMIT 32768
70 70
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index 86d9c2cf0bc..4ce947c1962 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -64,7 +64,7 @@
64/* 64/*
65 * This is the size at which it becomes more efficient to 65 * This is the size at which it becomes more efficient to
66 * clean the whole cache, rather than using the individual 66 * clean the whole cache, rather than using the individual
67 * cache line maintainence instructions. 67 * cache line maintenance instructions.
68 */ 68 */
69#define CACHE_DLIMIT 32768 69#define CACHE_DLIMIT 32768
70 70
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 83d3dd34f84..c8884c5413a 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -53,7 +53,7 @@
53/* 53/*
54 * This is the size at which it becomes more efficient to 54 * This is the size at which it becomes more efficient to
55 * clean the whole cache, rather than using the individual 55 * clean the whole cache, rather than using the individual
56 * cache line maintainence instructions. 56 * cache line maintenance instructions.
57 */ 57 */
58#define CACHE_DLIMIT 32768 58#define CACHE_DLIMIT 32768
59 59
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 686043ee728..413684660aa 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -53,7 +53,7 @@
53/* 53/*
54 * This is the size at which it becomes more efficient to 54 * This is the size at which it becomes more efficient to
55 * clean the whole cache, rather than using the individual 55 * clean the whole cache, rather than using the individual
56 * cache line maintainence instructions. 56 * cache line maintenance instructions.
57 */ 57 */
58#define CACHE_DLIMIT 32768 58#define CACHE_DLIMIT 32768
59 59
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index 665266da143..7a06e5964f5 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -63,7 +63,7 @@ ENTRY(cpu_arm720_proc_fin)
63/* 63/*
64 * Function: arm720_proc_do_idle(void) 64 * Function: arm720_proc_do_idle(void)
65 * Params : r0 = unused 65 * Params : r0 = unused
66 * Purpose : put the processer in proper idle mode 66 * Purpose : put the processor in proper idle mode
67 */ 67 */
68ENTRY(cpu_arm720_do_idle) 68ENTRY(cpu_arm720_do_idle)
69 mov pc, lr 69 mov pc, lr
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 219980ec8b6..bf8a1d1cccb 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -53,7 +53,7 @@
53/* 53/*
54 * This is the size at which it becomes more efficient to 54 * This is the size at which it becomes more efficient to
55 * clean the whole cache, rather than using the individual 55 * clean the whole cache, rather than using the individual
56 * cache line maintainence instructions. 56 * cache line maintenance instructions.
57 */ 57 */
58#define CACHE_DLIMIT 65536 58#define CACHE_DLIMIT 65536
59 59
@@ -390,7 +390,7 @@ ENTRY(cpu_arm920_set_pte_ext)
390/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ 390/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
391.globl cpu_arm920_suspend_size 391.globl cpu_arm920_suspend_size
392.equ cpu_arm920_suspend_size, 4 * 3 392.equ cpu_arm920_suspend_size, 4 * 3
393#ifdef CONFIG_PM 393#ifdef CONFIG_PM_SLEEP
394ENTRY(cpu_arm920_do_suspend) 394ENTRY(cpu_arm920_do_suspend)
395 stmfd sp!, {r4 - r7, lr} 395 stmfd sp!, {r4 - r7, lr}
396 mrc p15, 0, r4, c13, c0, 0 @ PID 396 mrc p15, 0, r4, c13, c0, 0 @ PID
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index 36154b1e792..95ba1fc56e4 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -54,7 +54,7 @@
54/* 54/*
55 * This is the size at which it becomes more efficient to 55 * This is the size at which it becomes more efficient to
56 * clean the whole cache, rather than using the individual 56 * clean the whole cache, rather than using the individual
57 * cache line maintainence instructions. (I think this should 57 * cache line maintenance instructions. (I think this should
58 * be 32768). 58 * be 32768).
59 */ 59 */
60#define CACHE_DLIMIT 8192 60#define CACHE_DLIMIT 8192
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 89c5e0009c4..541e4774eea 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -77,7 +77,7 @@
77/* 77/*
78 * This is the size at which it becomes more efficient to 78 * This is the size at which it becomes more efficient to
79 * clean the whole cache, rather than using the individual 79 * clean the whole cache, rather than using the individual
80 * cache line maintainence instructions. 80 * cache line maintenance instructions.
81 */ 81 */
82#define CACHE_DLIMIT 8192 82#define CACHE_DLIMIT 8192
83 83
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 6a4bdb2c94a..0ed85d930c0 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -404,7 +404,7 @@ ENTRY(cpu_arm926_set_pte_ext)
404/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */ 404/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
405.globl cpu_arm926_suspend_size 405.globl cpu_arm926_suspend_size
406.equ cpu_arm926_suspend_size, 4 * 3 406.equ cpu_arm926_suspend_size, 4 * 3
407#ifdef CONFIG_PM 407#ifdef CONFIG_PM_SLEEP
408ENTRY(cpu_arm926_do_suspend) 408ENTRY(cpu_arm926_do_suspend)
409 stmfd sp!, {r4 - r7, lr} 409 stmfd sp!, {r4 - r7, lr}
410 mrc p15, 0, r4, c13, c0, 0 @ PID 410 mrc p15, 0, r4, c13, c0, 0 @ PID
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e32fa499194..34261f9486b 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -85,7 +85,7 @@
85 85
86/* 86/*
87 * Sanity check the PTE configuration for the code below - which makes 87 * Sanity check the PTE configuration for the code below - which makes
88 * certain assumptions about how these bits are layed out. 88 * certain assumptions about how these bits are laid out.
89 */ 89 */
90#ifdef CONFIG_MMU 90#ifdef CONFIG_MMU
91#if L_PTE_SHARED != PTE_EXT_SHARED 91#if L_PTE_SHARED != PTE_EXT_SHARED
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 74483d1977f..184a9c997e3 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -171,7 +171,7 @@ ENTRY(cpu_sa1100_set_pte_ext)
171 171
172.globl cpu_sa1100_suspend_size 172.globl cpu_sa1100_suspend_size
173.equ cpu_sa1100_suspend_size, 4*4 173.equ cpu_sa1100_suspend_size, 4*4
174#ifdef CONFIG_PM 174#ifdef CONFIG_PM_SLEEP
175ENTRY(cpu_sa1100_do_suspend) 175ENTRY(cpu_sa1100_do_suspend)
176 stmfd sp!, {r4 - r7, lr} 176 stmfd sp!, {r4 - r7, lr}
177 mrc p15, 0, r4, c3, c0, 0 @ domain ID 177 mrc p15, 0, r4, c3, c0, 0 @ domain ID
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 832b6bdc192..ab17cc0d3fa 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -124,7 +124,7 @@ ENTRY(cpu_v6_set_pte_ext)
124/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */ 124/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */
125.globl cpu_v6_suspend_size 125.globl cpu_v6_suspend_size
126.equ cpu_v6_suspend_size, 4 * 8 126.equ cpu_v6_suspend_size, 4 * 8
127#ifdef CONFIG_PM 127#ifdef CONFIG_PM_SLEEP
128ENTRY(cpu_v6_do_suspend) 128ENTRY(cpu_v6_do_suspend)
129 stmfd sp!, {r4 - r11, lr} 129 stmfd sp!, {r4 - r11, lr}
130 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 130 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
@@ -132,7 +132,7 @@ ENTRY(cpu_v6_do_suspend)
132 mrc p15, 0, r6, c3, c0, 0 @ Domain ID 132 mrc p15, 0, r6, c3, c0, 0 @ Domain ID
133 mrc p15, 0, r7, c2, c0, 0 @ Translation table base 0 133 mrc p15, 0, r7, c2, c0, 0 @ Translation table base 0
134 mrc p15, 0, r8, c2, c0, 1 @ Translation table base 1 134 mrc p15, 0, r8, c2, c0, 1 @ Translation table base 1
135 mrc p15, 0, r9, c1, c0, 1 @ auxillary control register 135 mrc p15, 0, r9, c1, c0, 1 @ auxiliary control register
136 mrc p15, 0, r10, c1, c0, 2 @ co-processor access control 136 mrc p15, 0, r10, c1, c0, 2 @ co-processor access control
137 mrc p15, 0, r11, c1, c0, 0 @ control register 137 mrc p15, 0, r11, c1, c0, 0 @ control register
138 stmia r0, {r4 - r11} 138 stmia r0, {r4 - r11}
@@ -151,7 +151,7 @@ ENTRY(cpu_v6_do_resume)
151 mcr p15, 0, r6, c3, c0, 0 @ Domain ID 151 mcr p15, 0, r6, c3, c0, 0 @ Domain ID
152 mcr p15, 0, r7, c2, c0, 0 @ Translation table base 0 152 mcr p15, 0, r7, c2, c0, 0 @ Translation table base 0
153 mcr p15, 0, r8, c2, c0, 1 @ Translation table base 1 153 mcr p15, 0, r8, c2, c0, 1 @ Translation table base 1
154 mcr p15, 0, r9, c1, c0, 1 @ auxillary control register 154 mcr p15, 0, r9, c1, c0, 1 @ auxiliary control register
155 mcr p15, 0, r10, c1, c0, 2 @ co-processor access control 155 mcr p15, 0, r10, c1, c0, 2 @ co-processor access control
156 mcr p15, 0, ip, c2, c0, 2 @ TTB control register 156 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
157 mcr p15, 0, ip, c7, c5, 4 @ ISB 157 mcr p15, 0, ip, c7, c5, 4 @ ISB
@@ -175,11 +175,6 @@ cpu_v6_name:
175 .asciz "ARMv6-compatible processor" 175 .asciz "ARMv6-compatible processor"
176 .size cpu_v6_name, . - cpu_v6_name 176 .size cpu_v6_name, . - cpu_v6_name
177 177
178 .type cpu_pj4_name, #object
179cpu_pj4_name:
180 .asciz "Marvell PJ4 processor"
181 .size cpu_pj4_name, . - cpu_pj4_name
182
183 .align 178 .align
184 179
185 __CPUINIT 180 __CPUINIT
@@ -305,32 +300,3 @@ __v6_proc_info:
305 .long v6_user_fns 300 .long v6_user_fns
306 .long v6_cache_fns 301 .long v6_cache_fns
307 .size __v6_proc_info, . - __v6_proc_info 302 .size __v6_proc_info, . - __v6_proc_info
308
309 .type __pj4_v6_proc_info, #object
310__pj4_v6_proc_info:
311 .long 0x560f5810
312 .long 0xff0ffff0
313 ALT_SMP(.long \
314 PMD_TYPE_SECT | \
315 PMD_SECT_AP_WRITE | \
316 PMD_SECT_AP_READ | \
317 PMD_FLAGS_SMP)
318 ALT_UP(.long \
319 PMD_TYPE_SECT | \
320 PMD_SECT_AP_WRITE | \
321 PMD_SECT_AP_READ | \
322 PMD_FLAGS_UP)
323 .long PMD_TYPE_SECT | \
324 PMD_SECT_XN | \
325 PMD_SECT_AP_WRITE | \
326 PMD_SECT_AP_READ
327 b __v6_setup
328 .long cpu_arch_name
329 .long cpu_elf_name
330 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
331 .long cpu_pj4_name
332 .long v6_processor_functions
333 .long v6wbi_tlb_fns
334 .long v6_user_fns
335 .long v6_cache_fns
336 .size __pj4_v6_proc_info, . - __pj4_v6_proc_info
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 262fa88a743..babfba09c89 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -211,7 +211,7 @@ cpu_v7_name:
211/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ 211/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
212.globl cpu_v7_suspend_size 212.globl cpu_v7_suspend_size
213.equ cpu_v7_suspend_size, 4 * 8 213.equ cpu_v7_suspend_size, 4 * 8
214#ifdef CONFIG_PM 214#ifdef CONFIG_PM_SLEEP
215ENTRY(cpu_v7_do_suspend) 215ENTRY(cpu_v7_do_suspend)
216 stmfd sp!, {r4 - r11, lr} 216 stmfd sp!, {r4 - r11, lr}
217 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 217 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
@@ -237,7 +237,7 @@ ENTRY(cpu_v7_do_resume)
237 mcr p15, 0, r7, c2, c0, 0 @ TTB 0 237 mcr p15, 0, r7, c2, c0, 0 @ TTB 0
238 mcr p15, 0, r8, c2, c0, 1 @ TTB 1 238 mcr p15, 0, r8, c2, c0, 1 @ TTB 1
239 mcr p15, 0, ip, c2, c0, 2 @ TTB control register 239 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
240 mcr p15, 0, r10, c1, c0, 1 @ Auxillary control register 240 mcr p15, 0, r10, c1, c0, 1 @ Auxiliary control register
241 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control 241 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control
242 ldr r4, =PRRR @ PRRR 242 ldr r4, =PRRR @ PRRR
243 ldr r5, =NMRR @ NMRR 243 ldr r5, =NMRR @ NMRR
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index 63d8b2044e8..596213699f3 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -417,7 +417,7 @@ ENTRY(cpu_xsc3_set_pte_ext)
417 417
418.globl cpu_xsc3_suspend_size 418.globl cpu_xsc3_suspend_size
419.equ cpu_xsc3_suspend_size, 4 * 8 419.equ cpu_xsc3_suspend_size, 4 * 8
420#ifdef CONFIG_PM 420#ifdef CONFIG_PM_SLEEP
421ENTRY(cpu_xsc3_do_suspend) 421ENTRY(cpu_xsc3_do_suspend)
422 stmfd sp!, {r4 - r10, lr} 422 stmfd sp!, {r4 - r10, lr}
423 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode 423 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index 086038cd86a..42af97664c9 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -395,7 +395,7 @@ ENTRY(xscale_dma_a0_map_area)
395 teq r2, #DMA_TO_DEVICE 395 teq r2, #DMA_TO_DEVICE
396 beq xscale_dma_clean_range 396 beq xscale_dma_clean_range
397 b xscale_dma_flush_range 397 b xscale_dma_flush_range
398ENDPROC(xscsale_dma_a0_map_area) 398ENDPROC(xscale_dma_a0_map_area)
399 399
400/* 400/*
401 * dma_unmap_area(start, size, dir) 401 * dma_unmap_area(start, size, dir)
@@ -518,7 +518,7 @@ ENTRY(cpu_xscale_set_pte_ext)
518 518
519.globl cpu_xscale_suspend_size 519.globl cpu_xscale_suspend_size
520.equ cpu_xscale_suspend_size, 4 * 7 520.equ cpu_xscale_suspend_size, 4 * 7
521#ifdef CONFIG_PM 521#ifdef CONFIG_PM_SLEEP
522ENTRY(cpu_xscale_do_suspend) 522ENTRY(cpu_xscale_do_suspend)
523 stmfd sp!, {r4 - r10, lr} 523 stmfd sp!, {r4 - r10, lr}
524 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode 524 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c
index ce81481becf..4268a2bdf14 100644
--- a/arch/arm/plat-mxc/cpufreq.c
+++ b/arch/arm/plat-mxc/cpufreq.c
@@ -13,7 +13,7 @@
13 13
14/* 14/*
15 * A driver for the Freescale Semiconductor i.MXC CPUfreq module. 15 * A driver for the Freescale Semiconductor i.MXC CPUfreq module.
16 * The CPUFREQ driver is for controling CPU frequency. It allows you to change 16 * The CPUFREQ driver is for controlling CPU frequency. It allows you to change
17 * the CPU clock speed on the fly. 17 * the CPU clock speed on the fly.
18 */ 18 */
19 19
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 7a107246fd9..6cd6d7f686f 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -295,6 +295,12 @@ static int mxc_gpio_direction_output(struct gpio_chip *chip,
295 return 0; 295 return 0;
296} 296}
297 297
298/*
299 * This lock class tells lockdep that GPIO irqs are in a different
300 * category than their parents, so it won't report false recursion.
301 */
302static struct lock_class_key gpio_lock_class;
303
298int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt) 304int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
299{ 305{
300 int i, j; 306 int i, j;
@@ -311,6 +317,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
311 __raw_writel(~0, port[i].base + GPIO_ISR); 317 __raw_writel(~0, port[i].base + GPIO_ISR);
312 for (j = port[i].virtual_irq_start; 318 for (j = port[i].virtual_irq_start;
313 j < port[i].virtual_irq_start + 32; j++) { 319 j < port[i].virtual_irq_start + 32; j++) {
320 irq_set_lockdep_class(j, &gpio_lock_class);
314 irq_set_chip_and_handler(j, &gpio_irq_chip, 321 irq_set_chip_and_handler(j, &gpio_irq_chip,
315 handle_level_irq); 322 handle_level_irq);
316 set_irq_flags(j, IRQF_VALID); 323 set_irq_flags(j, IRQF_VALID);
diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
index bd9bb979914..2e49e71b1b9 100644
--- a/arch/arm/plat-mxc/include/mach/entry-macro.S
+++ b/arch/arm/plat-mxc/include/mach/entry-macro.S
@@ -33,9 +33,9 @@
33 .macro arch_ret_to_user, tmp1, tmp2 33 .macro arch_ret_to_user, tmp1, tmp2
34 .endm 34 .endm
35 35
36 @ this macro checks which interrupt occured 36 @ this macro checks which interrupt occurred
37 @ and returns its number in irqnr 37 @ and returns its number in irqnr
38 @ and returns if an interrupt occured in irqstat 38 @ and returns if an interrupt occurred in irqstat
39 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 39 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
40#ifndef CONFIG_MXC_TZIC 40#ifndef CONFIG_MXC_TZIC
41 @ Load offset & priority of the highest priority 41 @ Load offset & priority of the highest priority
diff --git a/arch/arm/plat-mxc/include/mach/mxc_nand.h b/arch/arm/plat-mxc/include/mach/mxc_nand.h
index 04c0d060d81..6bb96ef1600 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_nand.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_nand.h
@@ -24,7 +24,7 @@
24 24
25struct mxc_nand_platform_data { 25struct mxc_nand_platform_data {
26 unsigned int width; /* data bus width in bytes */ 26 unsigned int width; /* data bus width in bytes */
27 unsigned int hw_ecc:1; /* 0 if supress hardware ECC */ 27 unsigned int hw_ecc:1; /* 0 if suppress hardware ECC */
28 unsigned int flash_bbt:1; /* set to 1 to use a flash based bbt */ 28 unsigned int flash_bbt:1; /* set to 1 to use a flash based bbt */
29 struct mtd_partition *parts; /* partition table */ 29 struct mtd_partition *parts; /* partition table */
30 int nr_parts; /* size of parts */ 30 int nr_parts; /* size of parts */
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index 4864b0afd44..d85e2d1c032 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -21,7 +21,7 @@
21 21
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23 23
24static unsigned long uart_base; 24unsigned long uart_base;
25 25
26#define UART(x) (*(volatile unsigned long *)(uart_base + (x))) 26#define UART(x) (*(volatile unsigned long *)(uart_base + (x)))
27 27
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index f49748eca1a..307b8131aa8 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -23,6 +23,8 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25 25
26#include <asm/mach/irq.h>
27
26#include <plat/pincfg.h> 28#include <plat/pincfg.h>
27#include <mach/hardware.h> 29#include <mach/hardware.h>
28#include <mach/gpio.h> 30#include <mach/gpio.h>
@@ -681,13 +683,7 @@ static void __nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc,
681 struct irq_chip *host_chip = irq_get_chip(irq); 683 struct irq_chip *host_chip = irq_get_chip(irq);
682 unsigned int first_irq; 684 unsigned int first_irq;
683 685
684 if (host_chip->irq_mask_ack) 686 chained_irq_enter(host_chip, desc);
685 host_chip->irq_mask_ack(&desc->irq_data);
686 else {
687 host_chip->irq_mask(&desc->irq_data);
688 if (host_chip->irq_ack)
689 host_chip->irq_ack(&desc->irq_data);
690 }
691 687
692 nmk_chip = irq_get_handler_data(irq); 688 nmk_chip = irq_get_handler_data(irq);
693 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base); 689 first_irq = NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base);
@@ -698,7 +694,7 @@ static void __nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc,
698 status &= ~BIT(bit); 694 status &= ~BIT(bit);
699 } 695 }
700 696
701 host_chip->irq_unmask(&desc->irq_data); 697 chained_irq_exit(host_chip, desc);
702} 698}
703 699
704static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 700static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 7d9f815cede..ea28f98d5d6 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -280,7 +280,7 @@ EXPORT_SYMBOL(omap_dsp_get_mempool_base);
280 * Claiming GPIOs, and setting their direction and initial values, is the 280 * Claiming GPIOs, and setting their direction and initial values, is the
281 * responsibility of the device drivers. So is responding to probe(). 281 * responsibility of the device drivers. So is responding to probe().
282 * 282 *
283 * Board-specific knowlege like creating devices or pin setup is to be 283 * Board-specific knowledge like creating devices or pin setup is to be
284 * kept out of drivers as much as possible. In particular, pin setup 284 * kept out of drivers as much as possible. In particular, pin setup
285 * may be handled by the boot loader, and drivers should expect it will 285 * may be handled by the boot loader, and drivers should expect it will
286 * normally have been done by the time they're probed. 286 * normally have been done by the time they're probed.
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 2ec3b5d9f21..c22217c2ee5 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1019,7 +1019,7 @@ EXPORT_SYMBOL(omap_set_dma_callback);
1019 * If the channel is running the caller must disable interrupts prior calling 1019 * If the channel is running the caller must disable interrupts prior calling
1020 * this function and process the returned value before re-enabling interrupt to 1020 * this function and process the returned value before re-enabling interrupt to
1021 * prevent races with the interrupt handler. Note that in continuous mode there 1021 * prevent races with the interrupt handler. Note that in continuous mode there
1022 * is a chance for CSSA_L register overflow inbetween the two reads resulting 1022 * is a chance for CSSA_L register overflow between the two reads resulting
1023 * in incorrect return value. 1023 * in incorrect return value.
1024 */ 1024 */
1025dma_addr_t omap_get_dma_src_pos(int lch) 1025dma_addr_t omap_get_dma_src_pos(int lch)
@@ -1046,7 +1046,7 @@ EXPORT_SYMBOL(omap_get_dma_src_pos);
1046 * If the channel is running the caller must disable interrupts prior calling 1046 * If the channel is running the caller must disable interrupts prior calling
1047 * this function and process the returned value before re-enabling interrupt to 1047 * this function and process the returned value before re-enabling interrupt to
1048 * prevent races with the interrupt handler. Note that in continuous mode there 1048 * prevent races with the interrupt handler. Note that in continuous mode there
1049 * is a chance for CDSA_L register overflow inbetween the two reads resulting 1049 * is a chance for CDSA_L register overflow between the two reads resulting
1050 * in incorrect return value. 1050 * in incorrect return value.
1051 */ 1051 */
1052dma_addr_t omap_get_dma_dst_pos(int lch) 1052dma_addr_t omap_get_dma_dst_pos(int lch)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index d2adcdda23c..a2478ebb53f 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1137,8 +1137,9 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1137 struct gpio_bank *bank; 1137 struct gpio_bank *bank;
1138 u32 retrigger = 0; 1138 u32 retrigger = 0;
1139 int unmasked = 0; 1139 int unmasked = 0;
1140 struct irq_chip *chip = irq_desc_get_chip(desc);
1140 1141
1141 desc->irq_data.chip->irq_ack(&desc->irq_data); 1142 chained_irq_enter(chip, desc);
1142 1143
1143 bank = irq_get_handler_data(irq); 1144 bank = irq_get_handler_data(irq);
1144#ifdef CONFIG_ARCH_OMAP1 1145#ifdef CONFIG_ARCH_OMAP1
@@ -1195,7 +1196,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1195 configured, we could unmask GPIO bank interrupt immediately */ 1196 configured, we could unmask GPIO bank interrupt immediately */
1196 if (!level_mask && !unmasked) { 1197 if (!level_mask && !unmasked) {
1197 unmasked = 1; 1198 unmasked = 1;
1198 desc->irq_data.chip->irq_unmask(&desc->irq_data); 1199 chained_irq_exit(chip, desc);
1199 } 1200 }
1200 1201
1201 isr |= retrigger; 1202 isr |= retrigger;
@@ -1231,7 +1232,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1231 interrupt */ 1232 interrupt */
1232exit: 1233exit:
1233 if (!unmasked) 1234 if (!unmasked)
1234 desc->irq_data.chip->irq_unmask(&desc->irq_data); 1235 chained_irq_exit(chip, desc);
1235} 1236}
1236 1237
1237static void gpio_irq_shutdown(struct irq_data *d) 1238static void gpio_irq_shutdown(struct irq_data *d)
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index d6f9fa0f62a..cac2e8ac696 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -93,7 +93,7 @@ extern void omap_gpio_restore_context(void);
93/* Wrappers for "new style" GPIO calls, using the new infrastructure 93/* Wrappers for "new style" GPIO calls, using the new infrastructure
94 * which lets us plug in FPGA, I2C, and other implementations. 94 * which lets us plug in FPGA, I2C, and other implementations.
95 * * 95 * *
96 * The original OMAP-specfic calls should eventually be removed. 96 * The original OMAP-specific calls should eventually be removed.
97 */ 97 */
98 98
99#include <linux/errno.h> 99#include <linux/errno.h>
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/plat-omap/include/plat/gpmc.h
index 12b31616503..1527929b445 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/plat-omap/include/plat/gpmc.h
@@ -90,7 +90,7 @@ enum omap_ecc {
90 /* 1-bit ecc: stored at end of spare area */ 90 /* 1-bit ecc: stored at end of spare area */
91 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */ 91 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
92 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */ 92 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
93 /* 1-bit ecc: stored at begining of spare area as romcode */ 93 /* 1-bit ecc: stored at beginning of spare area as romcode */
94 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ 94 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
95}; 95};
96 96
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index 30b891c4a93..565d2664f5a 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -27,8 +27,8 @@
27 27
28#define MDR1_MODE_MASK 0x07 28#define MDR1_MODE_MASK 0x07
29 29
30static volatile u8 *uart_base; 30volatile u8 *uart_base;
31static int uart_shift; 31int uart_shift;
32 32
33/* 33/*
34 * Store the DEBUG_LL uart number into memory. 34 * Store the DEBUG_LL uart number into memory.
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index d598d9fd65a..5587acf0eb2 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -1103,7 +1103,7 @@ int omap_mcbsp_pollread(unsigned int id, u16 *buf)
1103 /* resend */ 1103 /* resend */
1104 return -1; 1104 return -1;
1105 } else { 1105 } else {
1106 /* wait for recieve confirmation */ 1106 /* wait for receive confirmation */
1107 int attemps = 0; 1107 int attemps = 0;
1108 while (!(MCBSP_READ(mcbsp, SPCR1) & RRDY)) { 1108 while (!(MCBSP_READ(mcbsp, SPCR1) & RRDY)) {
1109 if (attemps++ > 1000) { 1109 if (attemps++ > 1000) {
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index 56021a72e10..95a5fc53b6d 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := irq.o pcie.o time.o 5obj-y := irq.o pcie.o time.o common.o mpp.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
new file mode 100644
index 00000000000..9e5451b3c8e
--- /dev/null
+++ b/arch/arm/plat-orion/common.c
@@ -0,0 +1,957 @@
1/*
2 * arch/arm/plat-orion/common.c
3 *
4 * Marvell Orion SoC common setup code used by multiple mach-/common.c
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/dma-mapping.h>
15#include <linux/serial_8250.h>
16#include <linux/mbus.h>
17#include <linux/ata_platform.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/mv643xx_i2c.h>
20#include <net/dsa.h>
21#include <linux/spi/orion_spi.h>
22#include <plat/orion_wdt.h>
23#include <plat/mv_xor.h>
24#include <plat/ehci-orion.h>
25
26/* Fill in the resources structure and link it into the platform
27 device structure. There is always a memory region, and nearly
28 always an interrupt.*/
29static void fill_resources(struct platform_device *device,
30 struct resource *resources,
31 resource_size_t mapbase,
32 resource_size_t size,
33 unsigned int irq)
34{
35 device->resource = resources;
36 device->num_resources = 1;
37 resources[0].flags = IORESOURCE_MEM;
38 resources[0].start = mapbase;
39 resources[0].end = mapbase + size;
40
41 if (irq != NO_IRQ) {
42 device->num_resources++;
43 resources[1].flags = IORESOURCE_IRQ;
44 resources[1].start = irq;
45 resources[1].end = irq;
46 }
47}
48
49/*****************************************************************************
50 * UART
51 ****************************************************************************/
52static void __init uart_complete(
53 struct platform_device *orion_uart,
54 struct plat_serial8250_port *data,
55 struct resource *resources,
56 unsigned int membase,
57 resource_size_t mapbase,
58 unsigned int irq,
59 unsigned int uartclk)
60{
61 data->mapbase = mapbase;
62 data->membase = (void __iomem *)membase;
63 data->irq = irq;
64 data->uartclk = uartclk;
65 orion_uart->dev.platform_data = data;
66
67 fill_resources(orion_uart, resources, mapbase, 0xff, irq);
68 platform_device_register(orion_uart);
69}
70
71/*****************************************************************************
72 * UART0
73 ****************************************************************************/
74static struct plat_serial8250_port orion_uart0_data[] = {
75 {
76 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
77 .iotype = UPIO_MEM,
78 .regshift = 2,
79 }, {
80 },
81};
82
83static struct resource orion_uart0_resources[2];
84
85static struct platform_device orion_uart0 = {
86 .name = "serial8250",
87 .id = PLAT8250_DEV_PLATFORM,
88};
89
90void __init orion_uart0_init(unsigned int membase,
91 resource_size_t mapbase,
92 unsigned int irq,
93 unsigned int uartclk)
94{
95 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
96 membase, mapbase, irq, uartclk);
97}
98
99/*****************************************************************************
100 * UART1
101 ****************************************************************************/
102static struct plat_serial8250_port orion_uart1_data[] = {
103 {
104 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
105 .iotype = UPIO_MEM,
106 .regshift = 2,
107 }, {
108 },
109};
110
111static struct resource orion_uart1_resources[2];
112
113static struct platform_device orion_uart1 = {
114 .name = "serial8250",
115 .id = PLAT8250_DEV_PLATFORM1,
116};
117
118void __init orion_uart1_init(unsigned int membase,
119 resource_size_t mapbase,
120 unsigned int irq,
121 unsigned int uartclk)
122{
123 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
124 membase, mapbase, irq, uartclk);
125}
126
127/*****************************************************************************
128 * UART2
129 ****************************************************************************/
130static struct plat_serial8250_port orion_uart2_data[] = {
131 {
132 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
133 .iotype = UPIO_MEM,
134 .regshift = 2,
135 }, {
136 },
137};
138
139static struct resource orion_uart2_resources[2];
140
141static struct platform_device orion_uart2 = {
142 .name = "serial8250",
143 .id = PLAT8250_DEV_PLATFORM2,
144};
145
146void __init orion_uart2_init(unsigned int membase,
147 resource_size_t mapbase,
148 unsigned int irq,
149 unsigned int uartclk)
150{
151 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
152 membase, mapbase, irq, uartclk);
153}
154
155/*****************************************************************************
156 * UART3
157 ****************************************************************************/
158static struct plat_serial8250_port orion_uart3_data[] = {
159 {
160 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
161 .iotype = UPIO_MEM,
162 .regshift = 2,
163 }, {
164 },
165};
166
167static struct resource orion_uart3_resources[2];
168
169static struct platform_device orion_uart3 = {
170 .name = "serial8250",
171 .id = 3,
172};
173
174void __init orion_uart3_init(unsigned int membase,
175 resource_size_t mapbase,
176 unsigned int irq,
177 unsigned int uartclk)
178{
179 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
180 membase, mapbase, irq, uartclk);
181}
182
183/*****************************************************************************
184 * SoC RTC
185 ****************************************************************************/
186static struct resource orion_rtc_resource[2];
187
188void __init orion_rtc_init(unsigned long mapbase,
189 unsigned long irq)
190{
191 orion_rtc_resource[0].start = mapbase;
192 orion_rtc_resource[0].end = mapbase + SZ_32 - 1;
193 orion_rtc_resource[0].flags = IORESOURCE_MEM;
194 orion_rtc_resource[1].start = irq;
195 orion_rtc_resource[1].end = irq;
196 orion_rtc_resource[1].flags = IORESOURCE_IRQ;
197
198 platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2);
199}
200
201/*****************************************************************************
202 * GE
203 ****************************************************************************/
204static __init void ge_complete(
205 struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
206 struct mbus_dram_target_info *mbus_dram_info, int tclk,
207 struct resource *orion_ge_resource, unsigned long irq,
208 struct platform_device *orion_ge_shared,
209 struct mv643xx_eth_platform_data *eth_data,
210 struct platform_device *orion_ge)
211{
212 orion_ge_shared_data->dram = mbus_dram_info;
213 orion_ge_shared_data->t_clk = tclk;
214 orion_ge_resource->start = irq;
215 orion_ge_resource->end = irq;
216 eth_data->shared = orion_ge_shared;
217 orion_ge->dev.platform_data = eth_data;
218
219 platform_device_register(orion_ge_shared);
220 platform_device_register(orion_ge);
221}
222
223/*****************************************************************************
224 * GE00
225 ****************************************************************************/
226struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
227
228static struct resource orion_ge00_shared_resources[] = {
229 {
230 .name = "ge00 base",
231 }, {
232 .name = "ge00 err irq",
233 },
234};
235
236static struct platform_device orion_ge00_shared = {
237 .name = MV643XX_ETH_SHARED_NAME,
238 .id = 0,
239 .dev = {
240 .platform_data = &orion_ge00_shared_data,
241 },
242};
243
244static struct resource orion_ge00_resources[] = {
245 {
246 .name = "ge00 irq",
247 .flags = IORESOURCE_IRQ,
248 },
249};
250
251static struct platform_device orion_ge00 = {
252 .name = MV643XX_ETH_NAME,
253 .id = 0,
254 .num_resources = 1,
255 .resource = orion_ge00_resources,
256 .dev = {
257 .coherent_dma_mask = DMA_BIT_MASK(32),
258 },
259};
260
261void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
262 struct mbus_dram_target_info *mbus_dram_info,
263 unsigned long mapbase,
264 unsigned long irq,
265 unsigned long irq_err,
266 int tclk)
267{
268 fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
269 mapbase + 0x2000, SZ_16K - 1, irq_err);
270 ge_complete(&orion_ge00_shared_data, mbus_dram_info, tclk,
271 orion_ge00_resources, irq, &orion_ge00_shared,
272 eth_data, &orion_ge00);
273}
274
275/*****************************************************************************
276 * GE01
277 ****************************************************************************/
278struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = {
279 .shared_smi = &orion_ge00_shared,
280};
281
282static struct resource orion_ge01_shared_resources[] = {
283 {
284 .name = "ge01 base",
285 }, {
286 .name = "ge01 err irq",
287 },
288};
289
290static struct platform_device orion_ge01_shared = {
291 .name = MV643XX_ETH_SHARED_NAME,
292 .id = 1,
293 .dev = {
294 .platform_data = &orion_ge01_shared_data,
295 },
296};
297
298static struct resource orion_ge01_resources[] = {
299 {
300 .name = "ge01 irq",
301 .flags = IORESOURCE_IRQ,
302 },
303};
304
305static struct platform_device orion_ge01 = {
306 .name = MV643XX_ETH_NAME,
307 .id = 1,
308 .num_resources = 1,
309 .resource = orion_ge01_resources,
310 .dev = {
311 .coherent_dma_mask = DMA_BIT_MASK(32),
312 },
313};
314
315void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
316 struct mbus_dram_target_info *mbus_dram_info,
317 unsigned long mapbase,
318 unsigned long irq,
319 unsigned long irq_err,
320 int tclk)
321{
322 fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
323 mapbase + 0x2000, SZ_16K - 1, irq_err);
324 ge_complete(&orion_ge01_shared_data, mbus_dram_info, tclk,
325 orion_ge01_resources, irq, &orion_ge01_shared,
326 eth_data, &orion_ge01);
327}
328
329/*****************************************************************************
330 * GE10
331 ****************************************************************************/
332struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = {
333 .shared_smi = &orion_ge00_shared,
334};
335
336static struct resource orion_ge10_shared_resources[] = {
337 {
338 .name = "ge10 base",
339 }, {
340 .name = "ge10 err irq",
341 },
342};
343
344static struct platform_device orion_ge10_shared = {
345 .name = MV643XX_ETH_SHARED_NAME,
346 .id = 1,
347 .dev = {
348 .platform_data = &orion_ge10_shared_data,
349 },
350};
351
352static struct resource orion_ge10_resources[] = {
353 {
354 .name = "ge10 irq",
355 .flags = IORESOURCE_IRQ,
356 },
357};
358
359static struct platform_device orion_ge10 = {
360 .name = MV643XX_ETH_NAME,
361 .id = 1,
362 .num_resources = 2,
363 .resource = orion_ge10_resources,
364 .dev = {
365 .coherent_dma_mask = DMA_BIT_MASK(32),
366 },
367};
368
369void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
370 struct mbus_dram_target_info *mbus_dram_info,
371 unsigned long mapbase,
372 unsigned long irq,
373 unsigned long irq_err,
374 int tclk)
375{
376 fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
377 mapbase + 0x2000, SZ_16K - 1, irq_err);
378 ge_complete(&orion_ge10_shared_data, mbus_dram_info, tclk,
379 orion_ge10_resources, irq, &orion_ge10_shared,
380 eth_data, &orion_ge10);
381}
382
383/*****************************************************************************
384 * GE11
385 ****************************************************************************/
386struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = {
387 .shared_smi = &orion_ge00_shared,
388};
389
390static struct resource orion_ge11_shared_resources[] = {
391 {
392 .name = "ge11 base",
393 }, {
394 .name = "ge11 err irq",
395 },
396};
397
398static struct platform_device orion_ge11_shared = {
399 .name = MV643XX_ETH_SHARED_NAME,
400 .id = 1,
401 .dev = {
402 .platform_data = &orion_ge11_shared_data,
403 },
404};
405
406static struct resource orion_ge11_resources[] = {
407 {
408 .name = "ge11 irq",
409 .flags = IORESOURCE_IRQ,
410 },
411};
412
413static struct platform_device orion_ge11 = {
414 .name = MV643XX_ETH_NAME,
415 .id = 1,
416 .num_resources = 2,
417 .resource = orion_ge11_resources,
418 .dev = {
419 .coherent_dma_mask = DMA_BIT_MASK(32),
420 },
421};
422
423void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
424 struct mbus_dram_target_info *mbus_dram_info,
425 unsigned long mapbase,
426 unsigned long irq,
427 unsigned long irq_err,
428 int tclk)
429{
430 fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
431 mapbase + 0x2000, SZ_16K - 1, irq_err);
432 ge_complete(&orion_ge11_shared_data, mbus_dram_info, tclk,
433 orion_ge11_resources, irq, &orion_ge11_shared,
434 eth_data, &orion_ge11);
435}
436
437/*****************************************************************************
438 * Ethernet switch
439 ****************************************************************************/
440static struct resource orion_switch_resources[] = {
441 {
442 .start = 0,
443 .end = 0,
444 .flags = IORESOURCE_IRQ,
445 },
446};
447
448static struct platform_device orion_switch_device = {
449 .name = "dsa",
450 .id = 0,
451 .num_resources = 0,
452 .resource = orion_switch_resources,
453};
454
455void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
456{
457 int i;
458
459 if (irq != NO_IRQ) {
460 orion_switch_resources[0].start = irq;
461 orion_switch_resources[0].end = irq;
462 orion_switch_device.num_resources = 1;
463 }
464
465 d->netdev = &orion_ge00.dev;
466 for (i = 0; i < d->nr_chips; i++)
467 d->chip[i].mii_bus = &orion_ge00_shared.dev;
468 orion_switch_device.dev.platform_data = d;
469
470 platform_device_register(&orion_switch_device);
471}
472
473/*****************************************************************************
474 * I2C
475 ****************************************************************************/
476static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
477 .freq_n = 3,
478 .timeout = 1000, /* Default timeout of 1 second */
479};
480
481static struct resource orion_i2c_resources[2];
482
483static struct platform_device orion_i2c = {
484 .name = MV64XXX_I2C_CTLR_NAME,
485 .id = 0,
486 .dev = {
487 .platform_data = &orion_i2c_pdata,
488 },
489};
490
491static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
492 .freq_n = 3,
493 .timeout = 1000, /* Default timeout of 1 second */
494};
495
496static struct resource orion_i2c_1_resources[2];
497
498static struct platform_device orion_i2c_1 = {
499 .name = MV64XXX_I2C_CTLR_NAME,
500 .id = 1,
501 .dev = {
502 .platform_data = &orion_i2c_1_pdata,
503 },
504};
505
506void __init orion_i2c_init(unsigned long mapbase,
507 unsigned long irq,
508 unsigned long freq_m)
509{
510 orion_i2c_pdata.freq_m = freq_m;
511 fill_resources(&orion_i2c, orion_i2c_resources, mapbase,
512 SZ_32 - 1, irq);
513 platform_device_register(&orion_i2c);
514}
515
516void __init orion_i2c_1_init(unsigned long mapbase,
517 unsigned long irq,
518 unsigned long freq_m)
519{
520 orion_i2c_1_pdata.freq_m = freq_m;
521 fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase,
522 SZ_32 - 1, irq);
523 platform_device_register(&orion_i2c_1);
524}
525
526/*****************************************************************************
527 * SPI
528 ****************************************************************************/
529static struct orion_spi_info orion_spi_plat_data;
530static struct resource orion_spi_resources;
531
532static struct platform_device orion_spi = {
533 .name = "orion_spi",
534 .id = 0,
535 .dev = {
536 .platform_data = &orion_spi_plat_data,
537 },
538};
539
540static struct orion_spi_info orion_spi_1_plat_data;
541static struct resource orion_spi_1_resources;
542
543static struct platform_device orion_spi_1 = {
544 .name = "orion_spi",
545 .id = 1,
546 .dev = {
547 .platform_data = &orion_spi_1_plat_data,
548 },
549};
550
551/* Note: The SPI silicon core does have interrupts. However the
552 * current Linux software driver does not use interrupts. */
553
554void __init orion_spi_init(unsigned long mapbase,
555 unsigned long tclk)
556{
557 orion_spi_plat_data.tclk = tclk;
558 fill_resources(&orion_spi, &orion_spi_resources,
559 mapbase, SZ_512 - 1, NO_IRQ);
560 platform_device_register(&orion_spi);
561}
562
563void __init orion_spi_1_init(unsigned long mapbase,
564 unsigned long tclk)
565{
566 orion_spi_1_plat_data.tclk = tclk;
567 fill_resources(&orion_spi_1, &orion_spi_1_resources,
568 mapbase, SZ_512 - 1, NO_IRQ);
569 platform_device_register(&orion_spi_1);
570}
571
572/*****************************************************************************
573 * Watchdog
574 ****************************************************************************/
575static struct orion_wdt_platform_data orion_wdt_data;
576
577static struct platform_device orion_wdt_device = {
578 .name = "orion_wdt",
579 .id = -1,
580 .dev = {
581 .platform_data = &orion_wdt_data,
582 },
583 .num_resources = 0,
584};
585
586void __init orion_wdt_init(unsigned long tclk)
587{
588 orion_wdt_data.tclk = tclk;
589 platform_device_register(&orion_wdt_device);
590}
591
592/*****************************************************************************
593 * XOR
594 ****************************************************************************/
595static struct mv_xor_platform_shared_data orion_xor_shared_data;
596
597static u64 orion_xor_dmamask = DMA_BIT_MASK(32);
598
599void __init orion_xor_init_channels(
600 struct mv_xor_platform_data *orion_xor0_data,
601 struct platform_device *orion_xor0_channel,
602 struct mv_xor_platform_data *orion_xor1_data,
603 struct platform_device *orion_xor1_channel)
604{
605 /*
606 * two engines can't do memset simultaneously, this limitation
607 * satisfied by removing memset support from one of the engines.
608 */
609 dma_cap_set(DMA_MEMCPY, orion_xor0_data->cap_mask);
610 dma_cap_set(DMA_XOR, orion_xor0_data->cap_mask);
611 platform_device_register(orion_xor0_channel);
612
613 dma_cap_set(DMA_MEMCPY, orion_xor1_data->cap_mask);
614 dma_cap_set(DMA_MEMSET, orion_xor1_data->cap_mask);
615 dma_cap_set(DMA_XOR, orion_xor1_data->cap_mask);
616 platform_device_register(orion_xor1_channel);
617}
618
619/*****************************************************************************
620 * XOR0
621 ****************************************************************************/
622static struct resource orion_xor0_shared_resources[] = {
623 {
624 .name = "xor 0 low",
625 .flags = IORESOURCE_MEM,
626 }, {
627 .name = "xor 0 high",
628 .flags = IORESOURCE_MEM,
629 },
630};
631
632static struct platform_device orion_xor0_shared = {
633 .name = MV_XOR_SHARED_NAME,
634 .id = 0,
635 .dev = {
636 .platform_data = &orion_xor_shared_data,
637 },
638 .num_resources = ARRAY_SIZE(orion_xor0_shared_resources),
639 .resource = orion_xor0_shared_resources,
640};
641
642static struct resource orion_xor00_resources[] = {
643 [0] = {
644 .flags = IORESOURCE_IRQ,
645 },
646};
647
648static struct mv_xor_platform_data orion_xor00_data = {
649 .shared = &orion_xor0_shared,
650 .hw_id = 0,
651 .pool_size = PAGE_SIZE,
652};
653
654static struct platform_device orion_xor00_channel = {
655 .name = MV_XOR_NAME,
656 .id = 0,
657 .num_resources = ARRAY_SIZE(orion_xor00_resources),
658 .resource = orion_xor00_resources,
659 .dev = {
660 .dma_mask = &orion_xor_dmamask,
661 .coherent_dma_mask = DMA_BIT_MASK(64),
662 .platform_data = &orion_xor00_data,
663 },
664};
665
666static struct resource orion_xor01_resources[] = {
667 [0] = {
668 .flags = IORESOURCE_IRQ,
669 },
670};
671
672static struct mv_xor_platform_data orion_xor01_data = {
673 .shared = &orion_xor0_shared,
674 .hw_id = 1,
675 .pool_size = PAGE_SIZE,
676};
677
678static struct platform_device orion_xor01_channel = {
679 .name = MV_XOR_NAME,
680 .id = 1,
681 .num_resources = ARRAY_SIZE(orion_xor01_resources),
682 .resource = orion_xor01_resources,
683 .dev = {
684 .dma_mask = &orion_xor_dmamask,
685 .coherent_dma_mask = DMA_BIT_MASK(64),
686 .platform_data = &orion_xor01_data,
687 },
688};
689
690void __init orion_xor0_init(struct mbus_dram_target_info *mbus_dram_info,
691 unsigned long mapbase_low,
692 unsigned long mapbase_high,
693 unsigned long irq_0,
694 unsigned long irq_1)
695{
696 orion_xor_shared_data.dram = mbus_dram_info;
697
698 orion_xor0_shared_resources[0].start = mapbase_low;
699 orion_xor0_shared_resources[0].end = mapbase_low + 0xff;
700 orion_xor0_shared_resources[1].start = mapbase_high;
701 orion_xor0_shared_resources[1].end = mapbase_high + 0xff;
702
703 orion_xor00_resources[0].start = irq_0;
704 orion_xor00_resources[0].end = irq_0;
705 orion_xor01_resources[0].start = irq_1;
706 orion_xor01_resources[0].end = irq_1;
707
708 platform_device_register(&orion_xor0_shared);
709
710 orion_xor_init_channels(&orion_xor00_data, &orion_xor00_channel,
711 &orion_xor01_data, &orion_xor01_channel);
712}
713
714/*****************************************************************************
715 * XOR1
716 ****************************************************************************/
717static struct resource orion_xor1_shared_resources[] = {
718 {
719 .name = "xor 1 low",
720 .flags = IORESOURCE_MEM,
721 }, {
722 .name = "xor 1 high",
723 .flags = IORESOURCE_MEM,
724 },
725};
726
727static struct platform_device orion_xor1_shared = {
728 .name = MV_XOR_SHARED_NAME,
729 .id = 1,
730 .dev = {
731 .platform_data = &orion_xor_shared_data,
732 },
733 .num_resources = ARRAY_SIZE(orion_xor1_shared_resources),
734 .resource = orion_xor1_shared_resources,
735};
736
737static struct resource orion_xor10_resources[] = {
738 [0] = {
739 .flags = IORESOURCE_IRQ,
740 },
741};
742
743static struct mv_xor_platform_data orion_xor10_data = {
744 .shared = &orion_xor1_shared,
745 .hw_id = 0,
746 .pool_size = PAGE_SIZE,
747};
748
749static struct platform_device orion_xor10_channel = {
750 .name = MV_XOR_NAME,
751 .id = 2,
752 .num_resources = ARRAY_SIZE(orion_xor10_resources),
753 .resource = orion_xor10_resources,
754 .dev = {
755 .dma_mask = &orion_xor_dmamask,
756 .coherent_dma_mask = DMA_BIT_MASK(64),
757 .platform_data = &orion_xor10_data,
758 },
759};
760
761static struct resource orion_xor11_resources[] = {
762 [0] = {
763 .flags = IORESOURCE_IRQ,
764 },
765};
766
767static struct mv_xor_platform_data orion_xor11_data = {
768 .shared = &orion_xor1_shared,
769 .hw_id = 1,
770 .pool_size = PAGE_SIZE,
771};
772
773static struct platform_device orion_xor11_channel = {
774 .name = MV_XOR_NAME,
775 .id = 3,
776 .num_resources = ARRAY_SIZE(orion_xor11_resources),
777 .resource = orion_xor11_resources,
778 .dev = {
779 .dma_mask = &orion_xor_dmamask,
780 .coherent_dma_mask = DMA_BIT_MASK(64),
781 .platform_data = &orion_xor11_data,
782 },
783};
784
785void __init orion_xor1_init(unsigned long mapbase_low,
786 unsigned long mapbase_high,
787 unsigned long irq_0,
788 unsigned long irq_1)
789{
790 orion_xor1_shared_resources[0].start = mapbase_low;
791 orion_xor1_shared_resources[0].end = mapbase_low + 0xff;
792 orion_xor1_shared_resources[1].start = mapbase_high;
793 orion_xor1_shared_resources[1].end = mapbase_high + 0xff;
794
795 orion_xor10_resources[0].start = irq_0;
796 orion_xor10_resources[0].end = irq_0;
797 orion_xor11_resources[0].start = irq_1;
798 orion_xor11_resources[0].end = irq_1;
799
800 platform_device_register(&orion_xor1_shared);
801
802 orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel,
803 &orion_xor11_data, &orion_xor11_channel);
804}
805
806/*****************************************************************************
807 * EHCI
808 ****************************************************************************/
809static struct orion_ehci_data orion_ehci_data = {
810 .phy_version = EHCI_PHY_NA,
811};
812
813static u64 ehci_dmamask = DMA_BIT_MASK(32);
814
815
816/*****************************************************************************
817 * EHCI0
818 ****************************************************************************/
819static struct resource orion_ehci_resources[2];
820
821static struct platform_device orion_ehci = {
822 .name = "orion-ehci",
823 .id = 0,
824 .dev = {
825 .dma_mask = &ehci_dmamask,
826 .coherent_dma_mask = DMA_BIT_MASK(32),
827 .platform_data = &orion_ehci_data,
828 },
829};
830
831void __init orion_ehci_init(struct mbus_dram_target_info *mbus_dram_info,
832 unsigned long mapbase,
833 unsigned long irq)
834{
835 orion_ehci_data.dram = mbus_dram_info;
836 fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
837 irq);
838
839 platform_device_register(&orion_ehci);
840}
841
842/*****************************************************************************
843 * EHCI1
844 ****************************************************************************/
845static struct resource orion_ehci_1_resources[2];
846
847static struct platform_device orion_ehci_1 = {
848 .name = "orion-ehci",
849 .id = 1,
850 .dev = {
851 .dma_mask = &ehci_dmamask,
852 .coherent_dma_mask = DMA_BIT_MASK(32),
853 .platform_data = &orion_ehci_data,
854 },
855};
856
857void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info,
858 unsigned long mapbase,
859 unsigned long irq)
860{
861 orion_ehci_data.dram = mbus_dram_info;
862 fill_resources(&orion_ehci_1, orion_ehci_1_resources,
863 mapbase, SZ_4K - 1, irq);
864
865 platform_device_register(&orion_ehci_1);
866}
867
868/*****************************************************************************
869 * EHCI2
870 ****************************************************************************/
871static struct resource orion_ehci_2_resources[2];
872
873static struct platform_device orion_ehci_2 = {
874 .name = "orion-ehci",
875 .id = 2,
876 .dev = {
877 .dma_mask = &ehci_dmamask,
878 .coherent_dma_mask = DMA_BIT_MASK(32),
879 .platform_data = &orion_ehci_data,
880 },
881};
882
883void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info,
884 unsigned long mapbase,
885 unsigned long irq)
886{
887 orion_ehci_data.dram = mbus_dram_info;
888 fill_resources(&orion_ehci_2, orion_ehci_2_resources,
889 mapbase, SZ_4K - 1, irq);
890
891 platform_device_register(&orion_ehci_2);
892}
893
894/*****************************************************************************
895 * SATA
896 ****************************************************************************/
897static struct resource orion_sata_resources[2] = {
898 {
899 .name = "sata base",
900 }, {
901 .name = "sata irq",
902 },
903};
904
905static struct platform_device orion_sata = {
906 .name = "sata_mv",
907 .id = 0,
908 .dev = {
909 .coherent_dma_mask = DMA_BIT_MASK(32),
910 },
911};
912
913void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
914 struct mbus_dram_target_info *mbus_dram_info,
915 unsigned long mapbase,
916 unsigned long irq)
917{
918 sata_data->dram = mbus_dram_info;
919 orion_sata.dev.platform_data = sata_data;
920 fill_resources(&orion_sata, orion_sata_resources,
921 mapbase, 0x5000 - 1, irq);
922
923 platform_device_register(&orion_sata);
924}
925
926/*****************************************************************************
927 * Cryptographic Engines and Security Accelerator (CESA)
928 ****************************************************************************/
929static struct resource orion_crypto_resources[] = {
930 {
931 .name = "regs",
932 }, {
933 .name = "crypto interrupt",
934 }, {
935 .name = "sram",
936 .flags = IORESOURCE_MEM,
937 },
938};
939
940static struct platform_device orion_crypto = {
941 .name = "mv_crypto",
942 .id = -1,
943};
944
945void __init orion_crypto_init(unsigned long mapbase,
946 unsigned long srambase,
947 unsigned long sram_size,
948 unsigned long irq)
949{
950 fill_resources(&orion_crypto, orion_crypto_resources,
951 mapbase, 0xffff, irq);
952 orion_crypto.num_resources = 3;
953 orion_crypto_resources[2].start = srambase;
954 orion_crypto_resources[2].end = srambase + sram_size - 1;
955
956 platform_device_register(&orion_crypto);
957}
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index a431a138f40..5b4fffab1eb 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -321,59 +321,16 @@ EXPORT_SYMBOL(orion_gpio_set_blink);
321 * polarity LEVEL mask 321 * polarity LEVEL mask
322 * 322 *
323 ****************************************************************************/ 323 ****************************************************************************/
324static void gpio_irq_ack(struct irq_data *d)
325{
326 struct orion_gpio_chip *ochip = irq_data_get_irq_chip_data(d);
327 int type = irqd_get_trigger_type(d);
328
329 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
330 int pin = d->irq - ochip->secondary_irq_base;
331
332 writel(~(1 << pin), GPIO_EDGE_CAUSE(ochip));
333 }
334}
335
336static void gpio_irq_mask(struct irq_data *d)
337{
338 struct orion_gpio_chip *ochip = irq_data_get_irq_chip_data(d);
339 int type = irqd_get_trigger_type(d);
340 void __iomem *reg;
341 int pin;
342
343 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
344 reg = GPIO_EDGE_MASK(ochip);
345 else
346 reg = GPIO_LEVEL_MASK(ochip);
347
348 pin = d->irq - ochip->secondary_irq_base;
349
350 writel(readl(reg) & ~(1 << pin), reg);
351}
352
353static void gpio_irq_unmask(struct irq_data *d)
354{
355 struct orion_gpio_chip *ochip = irq_data_get_irq_chip_data(d);
356 int type = irqd_get_trigger_type(d);
357 void __iomem *reg;
358 int pin;
359
360 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
361 reg = GPIO_EDGE_MASK(ochip);
362 else
363 reg = GPIO_LEVEL_MASK(ochip);
364
365 pin = d->irq - ochip->secondary_irq_base;
366
367 writel(readl(reg) | (1 << pin), reg);
368}
369 324
370static int gpio_irq_set_type(struct irq_data *d, u32 type) 325static int gpio_irq_set_type(struct irq_data *d, u32 type)
371{ 326{
372 struct orion_gpio_chip *ochip = irq_data_get_irq_chip_data(d); 327 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
328 struct irq_chip_type *ct = irq_data_get_chip_type(d);
329 struct orion_gpio_chip *ochip = gc->private;
373 int pin; 330 int pin;
374 u32 u; 331 u32 u;
375 332
376 pin = d->irq - ochip->secondary_irq_base; 333 pin = d->irq - gc->irq_base;
377 334
378 u = readl(GPIO_IO_CONF(ochip)) & (1 << pin); 335 u = readl(GPIO_IO_CONF(ochip)) & (1 << pin);
379 if (!u) { 336 if (!u) {
@@ -382,18 +339,14 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
382 return -EINVAL; 339 return -EINVAL;
383 } 340 }
384 341
385 /* 342 type &= IRQ_TYPE_SENSE_MASK;
386 * Set edge/level type. 343 if (type == IRQ_TYPE_NONE)
387 */
388 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
389 __irq_set_handler_locked(d->irq, handle_edge_irq);
390 } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
391 __irq_set_handler_locked(d->irq, handle_level_irq);
392 } else {
393 printk(KERN_ERR "failed to set irq=%d (type=%d)\n",
394 d->irq, type);
395 return -EINVAL; 344 return -EINVAL;
396 } 345
346 /* Check if we need to change chip and handler */
347 if (!(ct->type & type))
348 if (irq_setup_alt_chip(d, type))
349 return -EINVAL;
397 350
398 /* 351 /*
399 * Configure interrupt polarity. 352 * Configure interrupt polarity.
@@ -425,19 +378,12 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
425 return 0; 378 return 0;
426} 379}
427 380
428struct irq_chip orion_gpio_irq_chip = {
429 .name = "orion_gpio_irq",
430 .irq_ack = gpio_irq_ack,
431 .irq_mask = gpio_irq_mask,
432 .irq_unmask = gpio_irq_unmask,
433 .irq_set_type = gpio_irq_set_type,
434};
435
436void __init orion_gpio_init(int gpio_base, int ngpio, 381void __init orion_gpio_init(int gpio_base, int ngpio,
437 u32 base, int mask_offset, int secondary_irq_base) 382 u32 base, int mask_offset, int secondary_irq_base)
438{ 383{
439 struct orion_gpio_chip *ochip; 384 struct orion_gpio_chip *ochip;
440 int i; 385 struct irq_chip_generic *gc;
386 struct irq_chip_type *ct;
441 387
442 if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips)) 388 if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips))
443 return; 389 return;
@@ -471,15 +417,29 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
471 writel(0, GPIO_EDGE_MASK(ochip)); 417 writel(0, GPIO_EDGE_MASK(ochip));
472 writel(0, GPIO_LEVEL_MASK(ochip)); 418 writel(0, GPIO_LEVEL_MASK(ochip));
473 419
474 for (i = 0; i < ngpio; i++) { 420 gc = irq_alloc_generic_chip("orion_gpio_irq", 2, secondary_irq_base,
475 unsigned int irq = secondary_irq_base + i; 421 ochip->base, handle_level_irq);
476 422 gc->private = ochip;
477 irq_set_chip_and_handler(irq, &orion_gpio_irq_chip, 423
478 handle_level_irq); 424 ct = gc->chip_types;
479 irq_set_chip_data(irq, ochip); 425 ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF;
480 irq_set_status_flags(irq, IRQ_LEVEL); 426 ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW;
481 set_irq_flags(irq, IRQF_VALID); 427 ct->chip.irq_mask = irq_gc_mask_clr_bit;
482 } 428 ct->chip.irq_unmask = irq_gc_mask_set_bit;
429 ct->chip.irq_set_type = gpio_irq_set_type;
430
431 ct++;
432 ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF;
433 ct->regs.ack = GPIO_EDGE_CAUSE_OFF;
434 ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
435 ct->chip.irq_ack = irq_gc_ack;
436 ct->chip.irq_mask = irq_gc_mask_clr_bit;
437 ct->chip.irq_unmask = irq_gc_mask_set_bit;
438 ct->chip.irq_set_type = gpio_irq_set_type;
439 ct->handler = handle_edge_irq;
440
441 irq_setup_generic_chip(gc, IRQ_MSK(ngpio), IRQ_GC_INIT_MASK_CACHE,
442 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
483} 443}
484 444
485void orion_gpio_irq_handler(int pinoff) 445void orion_gpio_irq_handler(int pinoff)
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
new file mode 100644
index 00000000000..a63c357e2ab
--- /dev/null
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -0,0 +1,117 @@
1/*
2 * arch/arm/plat-orion/include/plat/common.h
3 *
4 * Marvell Orion SoC common setup code used by different mach-/common.c
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __PLAT_COMMON_H
12#include <linux/mv643xx_eth.h>
13
14struct dsa_platform_data;
15
16void __init orion_uart0_init(unsigned int membase,
17 resource_size_t mapbase,
18 unsigned int irq,
19 unsigned int uartclk);
20
21void __init orion_uart1_init(unsigned int membase,
22 resource_size_t mapbase,
23 unsigned int irq,
24 unsigned int uartclk);
25
26void __init orion_uart2_init(unsigned int membase,
27 resource_size_t mapbase,
28 unsigned int irq,
29 unsigned int uartclk);
30
31void __init orion_uart3_init(unsigned int membase,
32 resource_size_t mapbase,
33 unsigned int irq,
34 unsigned int uartclk);
35
36void __init orion_rtc_init(unsigned long mapbase,
37 unsigned long irq);
38
39void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
40 struct mbus_dram_target_info *mbus_dram_info,
41 unsigned long mapbase,
42 unsigned long irq,
43 unsigned long irq_err,
44 int tclk);
45
46void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
47 struct mbus_dram_target_info *mbus_dram_info,
48 unsigned long mapbase,
49 unsigned long irq,
50 unsigned long irq_err,
51 int tclk);
52
53void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
54 struct mbus_dram_target_info *mbus_dram_info,
55 unsigned long mapbase,
56 unsigned long irq,
57 unsigned long irq_err,
58 int tclk);
59
60void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
61 struct mbus_dram_target_info *mbus_dram_info,
62 unsigned long mapbase,
63 unsigned long irq,
64 unsigned long irq_err,
65 int tclk);
66
67void __init orion_ge00_switch_init(struct dsa_platform_data *d,
68 int irq);
69void __init orion_i2c_init(unsigned long mapbase,
70 unsigned long irq,
71 unsigned long freq_m);
72
73void __init orion_i2c_1_init(unsigned long mapbase,
74 unsigned long irq,
75 unsigned long freq_m);
76
77void __init orion_spi_init(unsigned long mapbase,
78 unsigned long tclk);
79
80void __init orion_spi_1_init(unsigned long mapbase,
81 unsigned long tclk);
82
83void __init orion_wdt_init(unsigned long tclk);
84
85void __init orion_xor0_init(struct mbus_dram_target_info *mbus_dram_info,
86 unsigned long mapbase_low,
87 unsigned long mapbase_high,
88 unsigned long irq_0,
89 unsigned long irq_1);
90
91void __init orion_xor1_init(unsigned long mapbase_low,
92 unsigned long mapbase_high,
93 unsigned long irq_0,
94 unsigned long irq_1);
95
96void __init orion_ehci_init(struct mbus_dram_target_info *mbus_dram_info,
97 unsigned long mapbase,
98 unsigned long irq);
99
100void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info,
101 unsigned long mapbase,
102 unsigned long irq);
103
104void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info,
105 unsigned long mapbase,
106 unsigned long irq);
107
108void __init orion_sata_init(struct mv_sata_platform_data *sata_data,
109 struct mbus_dram_target_info *mbus_dram_info,
110 unsigned long mapbase,
111 unsigned long irq);
112
113void __init orion_crypto_init(unsigned long mapbase,
114 unsigned long srambase,
115 unsigned long sram_size,
116 unsigned long irq);
117#endif
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 5578b9803fc..3075b9fdde8 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -39,7 +39,6 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
39/* 39/*
40 * GPIO interrupt handling. 40 * GPIO interrupt handling.
41 */ 41 */
42extern struct irq_chip orion_gpio_irq_chip;
43void orion_gpio_irq_handler(int irqoff); 42void orion_gpio_irq_handler(int irqoff);
44 43
45 44
diff --git a/arch/arm/plat-orion/include/plat/mpp.h b/arch/arm/plat-orion/include/plat/mpp.h
new file mode 100644
index 00000000000..723adce99f4
--- /dev/null
+++ b/arch/arm/plat-orion/include/plat/mpp.h
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/plat-orion/include/plat/mpp.h
3 *
4 * Marvell Orion SoC MPP handling.
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __PLAT_MPP_H
12#define __PLAT_MPP_H
13
14#define MPP_NUM(x) ((x) & 0xff)
15#define MPP_SEL(x) (((x) >> 8) & 0xf)
16
17/* This is the generic MPP macro, without any variant information.
18 Each machine architecture is expected to extend this with further
19 bit fields indicating which MPP configurations are valid for a
20 specific variant. */
21
22#define GENERIC_MPP(_num, _sel, _in, _out) ( \
23 /* MPP number */ ((_num) & 0xff) | \
24 /* MPP select value */ (((_sel) & 0xf) << 8) | \
25 /* may be input signal */ ((!!(_in)) << 12) | \
26 /* may be output signal */ ((!!(_out)) << 13))
27
28#define MPP_INPUT_MASK GENERIC_MPP(0, 0x0, 1, 0)
29#define MPP_OUTPUT_MASK GENERIC_MPP(0, 0x0, 0, 1)
30
31void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
32 unsigned int mpp_max, unsigned int dev_bus);
33
34#endif
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index d8d638e09f8..2d5b9c1ef38 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -14,52 +14,21 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <plat/irq.h> 15#include <plat/irq.h>
16 16
17static void orion_irq_mask(struct irq_data *d)
18{
19 void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
20 u32 mask;
21
22 mask = readl(maskaddr);
23 mask &= ~(1 << (d->irq & 31));
24 writel(mask, maskaddr);
25}
26
27static void orion_irq_unmask(struct irq_data *d)
28{
29 void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
30 u32 mask;
31
32 mask = readl(maskaddr);
33 mask |= 1 << (d->irq & 31);
34 writel(mask, maskaddr);
35}
36
37static struct irq_chip orion_irq_chip = {
38 .name = "orion_irq",
39 .irq_mask = orion_irq_mask,
40 .irq_mask_ack = orion_irq_mask,
41 .irq_unmask = orion_irq_unmask,
42};
43
44void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) 17void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
45{ 18{
46 unsigned int i; 19 struct irq_chip_generic *gc;
20 struct irq_chip_type *ct;
47 21
48 /* 22 /*
49 * Mask all interrupts initially. 23 * Mask all interrupts initially.
50 */ 24 */
51 writel(0, maskaddr); 25 writel(0, maskaddr);
52 26
53 /* 27 gc = irq_alloc_generic_chip("orion_irq", 1, irq_start, maskaddr,
54 * Register IRQ sources. 28 handle_level_irq);
55 */ 29 ct = gc->chip_types;
56 for (i = 0; i < 32; i++) { 30 ct->chip.irq_mask = irq_gc_mask_clr_bit;
57 unsigned int irq = irq_start + i; 31 ct->chip.irq_unmask = irq_gc_mask_set_bit;
58 32 irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_MASK_CACHE,
59 irq_set_chip_and_handler(irq, &orion_irq_chip, 33 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
60 handle_level_irq);
61 irq_set_chip_data(irq, maskaddr);
62 irq_set_status_flags(irq, IRQ_LEVEL);
63 set_irq_flags(irq, IRQF_VALID);
64 }
65} 34}
diff --git a/arch/arm/plat-orion/mpp.c b/arch/arm/plat-orion/mpp.c
new file mode 100644
index 00000000000..91553432711
--- /dev/null
+++ b/arch/arm/plat-orion/mpp.c
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/plat-orion/mpp.c
3 *
4 * MPP functions for Marvell orion SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/mbus.h>
14#include <linux/io.h>
15#include <linux/gpio.h>
16#include <mach/hardware.h>
17#include <plat/mpp.h>
18
19/* Address of the ith MPP control register */
20static __init unsigned long mpp_ctrl_addr(unsigned int i,
21 unsigned long dev_bus)
22{
23 return dev_bus + (i) * 4;
24}
25
26
27void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
28 unsigned int mpp_max, unsigned int dev_bus)
29{
30 unsigned int mpp_nr_regs = (1 + mpp_max/8);
31 u32 mpp_ctrl[mpp_nr_regs];
32 int i;
33
34 printk(KERN_DEBUG "initial MPP regs:");
35 for (i = 0; i < mpp_nr_regs; i++) {
36 mpp_ctrl[i] = readl(mpp_ctrl_addr(i, dev_bus));
37 printk(" %08x", mpp_ctrl[i]);
38 }
39 printk("\n");
40
41 for ( ; *mpp_list; mpp_list++) {
42 unsigned int num = MPP_NUM(*mpp_list);
43 unsigned int sel = MPP_SEL(*mpp_list);
44 int shift, gpio_mode;
45
46 if (num > mpp_max) {
47 printk(KERN_ERR "orion_mpp_conf: invalid MPP "
48 "number (%u)\n", num);
49 continue;
50 }
51 if (variant_mask & !(*mpp_list & variant_mask)) {
52 printk(KERN_WARNING
53 "orion_mpp_conf: requested MPP%u config "
54 "unavailable on this hardware\n", num);
55 continue;
56 }
57
58 shift = (num & 7) << 2;
59 mpp_ctrl[num / 8] &= ~(0xf << shift);
60 mpp_ctrl[num / 8] |= sel << shift;
61
62 gpio_mode = 0;
63 if (*mpp_list & MPP_INPUT_MASK)
64 gpio_mode |= GPIO_INPUT_OK;
65 if (*mpp_list & MPP_OUTPUT_MASK)
66 gpio_mode |= GPIO_OUTPUT_OK;
67 if (sel != 0)
68 gpio_mode = 0;
69 orion_gpio_set_valid(num, gpio_mode);
70 }
71
72 printk(KERN_DEBUG " final MPP regs:");
73 for (i = 0; i < mpp_nr_regs; i++) {
74 writel(mpp_ctrl[i], mpp_ctrl_addr(i, dev_bus));
75 printk(" %08x", mpp_ctrl[i]);
76 }
77 printk("\n");
78}
diff --git a/arch/arm/plat-pxa/include/plat/mfp.h b/arch/arm/plat-pxa/include/plat/mfp.h
index 75f65647124..89e68e07b0a 100644
--- a/arch/arm/plat-pxa/include/plat/mfp.h
+++ b/arch/arm/plat-pxa/include/plat/mfp.h
@@ -434,7 +434,7 @@ typedef unsigned long mfp_cfg_t;
434 * 434 *
435 * mfp_init_addr() - accepts a table of "mfp_addr_map" structure, which 435 * mfp_init_addr() - accepts a table of "mfp_addr_map" structure, which
436 * represents a range of MFP pins from "start" to "end", with the offset 436 * represents a range of MFP pins from "start" to "end", with the offset
437 * begining at "offset", to define a single pin, let "end" = -1. 437 * beginning at "offset", to define a single pin, let "end" = -1.
438 * 438 *
439 * use 439 * use
440 * 440 *
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index c2064c30871..0291bd6e236 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -23,7 +23,7 @@ obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
23obj-$(CONFIG_CPU_FREQ_S3C24XX) += cpu-freq.o 23obj-$(CONFIG_CPU_FREQ_S3C24XX) += cpu-freq.o
24obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpu-freq-debugfs.o 24obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpu-freq-debugfs.o
25 25
26# Architecture dependant builds 26# Architecture dependent builds
27 27
28obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o 28obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
29obj-$(CONFIG_PM) += pm.o 29obj-$(CONFIG_PM) += pm.o
diff --git a/arch/arm/plat-s3c24xx/cpu-freq.c b/arch/arm/plat-s3c24xx/cpu-freq.c
index eea75ff81d1..b3d3d027899 100644
--- a/arch/arm/plat-s3c24xx/cpu-freq.c
+++ b/arch/arm/plat-s3c24xx/cpu-freq.c
@@ -455,7 +455,7 @@ static int s3c_cpufreq_resume(struct cpufreq_policy *policy)
455 455
456 /* whilst we will be called later on, we try and re-set the 456 /* whilst we will be called later on, we try and re-set the
457 * cpu frequencies as soon as possible so that we do not end 457 * cpu frequencies as soon as possible so that we do not end
458 * up resuming devices and then immediatley having to re-set 458 * up resuming devices and then immediately having to re-set
459 * a number of settings once these devices have restarted. 459 * a number of settings once these devices have restarted.
460 * 460 *
461 * as a note, it is expected devices are not used until they 461 * as a note, it is expected devices are not used until they
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 6ad274e7593..27ea852e337 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -557,7 +557,7 @@ s3c2410_dma_lastxfer(struct s3c2410_dma_chan *chan)
557 break; 557 break;
558 558
559 case S3C2410_DMALOAD_1LOADED_1RUNNING: 559 case S3C2410_DMALOAD_1LOADED_1RUNNING:
560 /* I belive in this case we do not have anything to do 560 /* I believe in this case we do not have anything to do
561 * until the next buffer comes along, and we turn off the 561 * until the next buffer comes along, and we turn off the
562 * reload */ 562 * reload */
563 return; 563 return;
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index 46dd078147d..135abda31c9 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -41,72 +41,11 @@ struct s5p_gpioint_bank {
41 41
42LIST_HEAD(banks); 42LIST_HEAD(banks);
43 43
44static int s5p_gpioint_get_offset(struct irq_data *data) 44static int s5p_gpioint_set_type(struct irq_data *d, unsigned int type)
45{ 45{
46 struct s3c_gpio_chip *chip = irq_data_get_irq_handler_data(data); 46 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
47 return data->irq - chip->irq_base; 47 struct irq_chip_type *ct = gc->chip_types;
48} 48 unsigned int shift = (d->irq - gc->irq_base) << 2;
49
50static void s5p_gpioint_ack(struct irq_data *data)
51{
52 struct s3c_gpio_chip *chip = irq_data_get_irq_handler_data(data);
53 int group, offset, pend_offset;
54 unsigned int value;
55
56 group = chip->group;
57 offset = s5p_gpioint_get_offset(data);
58 pend_offset = REG_OFFSET(group);
59
60 value = __raw_readl(GPIO_BASE(chip) + PEND_OFFSET + pend_offset);
61 value |= BIT(offset);
62 __raw_writel(value, GPIO_BASE(chip) + PEND_OFFSET + pend_offset);
63}
64
65static void s5p_gpioint_mask(struct irq_data *data)
66{
67 struct s3c_gpio_chip *chip = irq_data_get_irq_handler_data(data);
68 int group, offset, mask_offset;
69 unsigned int value;
70
71 group = chip->group;
72 offset = s5p_gpioint_get_offset(data);
73 mask_offset = REG_OFFSET(group);
74
75 value = __raw_readl(GPIO_BASE(chip) + MASK_OFFSET + mask_offset);
76 value |= BIT(offset);
77 __raw_writel(value, GPIO_BASE(chip) + MASK_OFFSET + mask_offset);
78}
79
80static void s5p_gpioint_unmask(struct irq_data *data)
81{
82 struct s3c_gpio_chip *chip = irq_data_get_irq_handler_data(data);
83 int group, offset, mask_offset;
84 unsigned int value;
85
86 group = chip->group;
87 offset = s5p_gpioint_get_offset(data);
88 mask_offset = REG_OFFSET(group);
89
90 value = __raw_readl(GPIO_BASE(chip) + MASK_OFFSET + mask_offset);
91 value &= ~BIT(offset);
92 __raw_writel(value, GPIO_BASE(chip) + MASK_OFFSET + mask_offset);
93}
94
95static void s5p_gpioint_mask_ack(struct irq_data *data)
96{
97 s5p_gpioint_mask(data);
98 s5p_gpioint_ack(data);
99}
100
101static int s5p_gpioint_set_type(struct irq_data *data, unsigned int type)
102{
103 struct s3c_gpio_chip *chip = irq_data_get_irq_handler_data(data);
104 int group, offset, con_offset;
105 unsigned int value;
106
107 group = chip->group;
108 offset = s5p_gpioint_get_offset(data);
109 con_offset = REG_OFFSET(group);
110 49
111 switch (type) { 50 switch (type) {
112 case IRQ_TYPE_EDGE_RISING: 51 case IRQ_TYPE_EDGE_RISING:
@@ -130,23 +69,12 @@ static int s5p_gpioint_set_type(struct irq_data *data, unsigned int type)
130 return -EINVAL; 69 return -EINVAL;
131 } 70 }
132 71
133 value = __raw_readl(GPIO_BASE(chip) + CON_OFFSET + con_offset); 72 gc->type_cache &= ~(0x7 << shift);
134 value &= ~(0x7 << (offset * 0x4)); 73 gc->type_cache |= type << shift;
135 value |= (type << (offset * 0x4)); 74 writel(gc->type_cache, gc->reg_base + ct->regs.type);
136 __raw_writel(value, GPIO_BASE(chip) + CON_OFFSET + con_offset);
137
138 return 0; 75 return 0;
139} 76}
140 77
141static struct irq_chip s5p_gpioint = {
142 .name = "s5p_gpioint",
143 .irq_ack = s5p_gpioint_ack,
144 .irq_mask = s5p_gpioint_mask,
145 .irq_mask_ack = s5p_gpioint_mask_ack,
146 .irq_unmask = s5p_gpioint_unmask,
147 .irq_set_type = s5p_gpioint_set_type,
148};
149
150static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc) 78static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
151{ 79{
152 struct s5p_gpioint_bank *bank = irq_get_handler_data(irq); 80 struct s5p_gpioint_bank *bank = irq_get_handler_data(irq);
@@ -179,9 +107,10 @@ static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
179static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip) 107static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
180{ 108{
181 static int used_gpioint_groups = 0; 109 static int used_gpioint_groups = 0;
182 int irq, group = chip->group; 110 int group = chip->group;
183 int i;
184 struct s5p_gpioint_bank *bank = NULL; 111 struct s5p_gpioint_bank *bank = NULL;
112 struct irq_chip_generic *gc;
113 struct irq_chip_type *ct;
185 114
186 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT) 115 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT)
187 return -ENOMEM; 116 return -ENOMEM;
@@ -208,22 +137,31 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
208 } 137 }
209 138
210 /* 139 /*
211 * chained GPIO irq has been sucessfully registered, allocate new gpio 140 * chained GPIO irq has been successfully registered, allocate new gpio
212 * int group and assign irq nubmers 141 * int group and assign irq nubmers
213 */ 142 */
214
215 chip->irq_base = S5P_GPIOINT_BASE + 143 chip->irq_base = S5P_GPIOINT_BASE +
216 used_gpioint_groups * S5P_GPIOINT_GROUP_SIZE; 144 used_gpioint_groups * S5P_GPIOINT_GROUP_SIZE;
217 used_gpioint_groups++; 145 used_gpioint_groups++;
218 146
219 bank->chips[group - bank->start] = chip; 147 bank->chips[group - bank->start] = chip;
220 for (i = 0; i < chip->chip.ngpio; i++) { 148
221 irq = chip->irq_base + i; 149 gc = irq_alloc_generic_chip("s5p_gpioint", 1, chip->irq_base,
222 irq_set_chip(irq, &s5p_gpioint); 150 (void __iomem *)GPIO_BASE(chip),
223 irq_set_handler_data(irq, chip); 151 handle_level_irq);
224 irq_set_handler(irq, handle_level_irq); 152 if (!gc)
225 set_irq_flags(irq, IRQF_VALID); 153 return -ENOMEM;
226 } 154 ct = gc->chip_types;
155 ct->chip.irq_ack = irq_gc_ack;
156 ct->chip.irq_mask = irq_gc_mask_set_bit;
157 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
158 ct->chip.irq_set_type = s5p_gpioint_set_type,
159 ct->regs.ack = PEND_OFFSET + REG_OFFSET(chip->group);
160 ct->regs.mask = MASK_OFFSET + REG_OFFSET(chip->group);
161 ct->regs.type = CON_OFFSET + REG_OFFSET(chip->group);
162 irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio),
163 IRQ_GC_INIT_MASK_CACHE,
164 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
227 return 0; 165 return 0;
228} 166}
229 167
diff --git a/arch/arm/plat-s5p/irq.c b/arch/arm/plat-s5p/irq.c
index 5560b12035d..a97c08957f4 100644
--- a/arch/arm/plat-s5p/irq.c
+++ b/arch/arm/plat-s5p/irq.c
@@ -64,11 +64,7 @@ void __init s5p_init_irq(u32 *vic, u32 num_vic)
64 vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0); 64 vic_init(VA_VIC(irq), VIC_BASE(irq), vic[irq], 0);
65#endif 65#endif
66 66
67 s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0); 67 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
68 s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
69 s3c_init_vic_timer_irq(IRQ_TIMER2_VIC, IRQ_TIMER2);
70 s3c_init_vic_timer_irq(IRQ_TIMER3_VIC, IRQ_TIMER3);
71 s3c_init_vic_timer_irq(IRQ_TIMER4_VIC, IRQ_TIMER4);
72 68
73 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs)); 69 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
74} 70}
diff --git a/arch/arm/plat-s5p/pm.c b/arch/arm/plat-s5p/pm.c
index d592b6304b4..d15dc47b0e3 100644
--- a/arch/arm/plat-s5p/pm.c
+++ b/arch/arm/plat-s5p/pm.c
@@ -19,17 +19,6 @@
19 19
20#define PFX "s5p pm: " 20#define PFX "s5p pm: "
21 21
22/* s3c_pm_check_resume_pin
23 *
24 * check to see if the pin is configured correctly for sleep mode, and
25 * make any necessary adjustments if it is not
26*/
27
28static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
29{
30 /* nothing here yet */
31}
32
33/* s3c_pm_configure_extint 22/* s3c_pm_configure_extint
34 * 23 *
35 * configure all external interrupt pins 24 * configure all external interrupt pins
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 9a82b887491..983c578b827 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -21,7 +21,7 @@ struct clk;
21 * @set_parent: set the clock's parent, see clk_set_parent(). 21 * @set_parent: set the clock's parent, see clk_set_parent().
22 * 22 *
23 * Group the common clock implementations together so that we 23 * Group the common clock implementations together so that we
24 * don't have to keep setting the same fiels again. We leave 24 * don't have to keep setting the same fields again. We leave
25 * enable in struct clk. 25 * enable in struct clk.
26 * 26 *
27 * Adding an extra layer of indirection into the process should 27 * Adding an extra layer of indirection into the process should
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
index 5603db0b79b..3ad8386599c 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
@@ -114,7 +114,7 @@ extern unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip,
114 * of control per GPIO, generally in the form of: 114 * of control per GPIO, generally in the form of:
115 * 0000 = Input 115 * 0000 = Input
116 * 0001 = Output 116 * 0001 = Output
117 * others = Special functions (dependant on bank) 117 * others = Special functions (dependent on bank)
118 * 118 *
119 * Note, since the code to deal with the case where there are two control 119 * Note, since the code to deal with the case where there are two control
120 * registers instead of one, we do not have a separate set of functions for 120 * registers instead of one, we do not have a separate set of functions for
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index 5e04fa6eda7..1762dcb4cb9 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -125,7 +125,7 @@ extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
125 * 125 *
126 * These values control the state of the weak pull-{up,down} resistors 126 * These values control the state of the weak pull-{up,down} resistors
127 * available on most pins on the S3C series. Not all chips support both 127 * available on most pins on the S3C series. Not all chips support both
128 * up or down settings, and it may be dependant on the chip that is being 128 * up or down settings, and it may be dependent on the chip that is being
129 * used to whether the particular mode is available. 129 * used to whether the particular mode is available.
130 */ 130 */
131#define S3C_GPIO_PULL_NONE ((__force s3c_gpio_pull_t)0x00) 131#define S3C_GPIO_PULL_NONE ((__force s3c_gpio_pull_t)0x00)
@@ -138,7 +138,7 @@ extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
138 * @pull: The configuration for the pull resistor. 138 * @pull: The configuration for the pull resistor.
139 * 139 *
140 * This function sets the state of the pull-{up,down} resistor for the 140 * This function sets the state of the pull-{up,down} resistor for the
141 * specified pin. It will return 0 if successfull, or a negative error 141 * specified pin. It will return 0 if successful, or a negative error
142 * code if the pin cannot support the requested pull setting. 142 * code if the pin cannot support the requested pull setting.
143 * 143 *
144 * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP. 144 * @pull is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP.
@@ -202,7 +202,7 @@ extern s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin);
202 * @drvstr: The new value of the driver strength 202 * @drvstr: The new value of the driver strength
203 * 203 *
204 * This function sets the driver strength value for the specified pin. 204 * This function sets the driver strength value for the specified pin.
205 * It will return 0 if successfull, or a negative error code if the pin 205 * It will return 0 if successful, or a negative error code if the pin
206 * cannot support the requested setting. 206 * cannot support the requested setting.
207*/ 207*/
208extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr); 208extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr);
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index dac35d0a711..8cad4cf19c3 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -108,7 +108,7 @@ extern void s3c_gpiolib_add(struct s3c_gpio_chip *chip);
108 * of control per GPIO, generally in the form of: 108 * of control per GPIO, generally in the form of:
109 * 0000 = Input 109 * 0000 = Input
110 * 0001 = Output 110 * 0001 = Output
111 * others = Special functions (dependant on bank) 111 * others = Special functions (dependent on bank)
112 * 112 *
113 * Note, since the code to deal with the case where there are two control 113 * Note, since the code to deal with the case where there are two control
114 * registers instead of one, we do not have a separate set of function 114 * registers instead of one, we do not have a separate set of function
diff --git a/arch/arm/plat-samsung/include/plat/irq-vic-timer.h b/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
index a90b53431b5..5b9c42fd32d 100644
--- a/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
+++ b/arch/arm/plat-samsung/include/plat/irq-vic-timer.h
@@ -10,4 +10,4 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13extern void s3c_init_vic_timer_irq(unsigned int vic, unsigned int timer); 13extern void s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq);
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index b0bdf16549d..058e09654fe 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -57,7 +57,7 @@ enum clk_types {
57 * @cfg_gpio: Configure the GPIO for a specific card bit-width 57 * @cfg_gpio: Configure the GPIO for a specific card bit-width
58 * @cfg_card: Configure the interface for a specific card and speed. This 58 * @cfg_card: Configure the interface for a specific card and speed. This
59 * is necessary the controllers and/or GPIO blocks require the 59 * is necessary the controllers and/or GPIO blocks require the
60 * changing of driver-strength and other controls dependant on 60 * changing of driver-strength and other controls dependent on
61 * the card and speed of operation. 61 * the card and speed of operation.
62 * 62 *
63 * Initialisation data specific to either the machine or the platform 63 * Initialisation data specific to either the machine or the platform
@@ -108,7 +108,7 @@ extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
108extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata; 108extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
109extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata; 109extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
110 110
111/* Helper function availablity */ 111/* Helper function availability */
112 112
113extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 113extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
114extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 114extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index 7d6ed7263d5..ee48e12a1e7 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -18,8 +18,8 @@ typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
18 18
19/* uart setup */ 19/* uart setup */
20 20
21static unsigned int fifo_mask; 21unsigned int fifo_mask;
22static unsigned int fifo_max; 22unsigned int fifo_max;
23 23
24/* forward declerations */ 24/* forward declerations */
25 25
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
index 4d4e571af55..32582c0958e 100644
--- a/arch/arm/plat-samsung/irq-uart.c
+++ b/arch/arm/plat-samsung/irq-uart.c
@@ -27,60 +27,6 @@
27/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3] 27/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
28 * are consecutive when looking up the interrupt in the demux routines. 28 * are consecutive when looking up the interrupt in the demux routines.
29 */ 29 */
30
31static inline void __iomem *s3c_irq_uart_base(struct irq_data *data)
32{
33 struct s3c_uart_irq *uirq = irq_data_get_irq_chip_data(data);
34 return uirq->regs;
35}
36
37static inline unsigned int s3c_irq_uart_bit(unsigned int irq)
38{
39 return irq & 3;
40}
41
42static void s3c_irq_uart_mask(struct irq_data *data)
43{
44 void __iomem *regs = s3c_irq_uart_base(data);
45 unsigned int bit = s3c_irq_uart_bit(data->irq);
46 u32 reg;
47
48 reg = __raw_readl(regs + S3C64XX_UINTM);
49 reg |= (1 << bit);
50 __raw_writel(reg, regs + S3C64XX_UINTM);
51}
52
53static void s3c_irq_uart_maskack(struct irq_data *data)
54{
55 void __iomem *regs = s3c_irq_uart_base(data);
56 unsigned int bit = s3c_irq_uart_bit(data->irq);
57 u32 reg;
58
59 reg = __raw_readl(regs + S3C64XX_UINTM);
60 reg |= (1 << bit);
61 __raw_writel(reg, regs + S3C64XX_UINTM);
62 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
63}
64
65static void s3c_irq_uart_unmask(struct irq_data *data)
66{
67 void __iomem *regs = s3c_irq_uart_base(data);
68 unsigned int bit = s3c_irq_uart_bit(data->irq);
69 u32 reg;
70
71 reg = __raw_readl(regs + S3C64XX_UINTM);
72 reg &= ~(1 << bit);
73 __raw_writel(reg, regs + S3C64XX_UINTM);
74}
75
76static void s3c_irq_uart_ack(struct irq_data *data)
77{
78 void __iomem *regs = s3c_irq_uart_base(data);
79 unsigned int bit = s3c_irq_uart_bit(data->irq);
80
81 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
82}
83
84static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc) 30static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
85{ 31{
86 struct s3c_uart_irq *uirq = desc->irq_data.handler_data; 32 struct s3c_uart_irq *uirq = desc->irq_data.handler_data;
@@ -97,30 +43,25 @@ static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
97 generic_handle_irq(base + 3); 43 generic_handle_irq(base + 3);
98} 44}
99 45
100static struct irq_chip s3c_irq_uart = {
101 .name = "s3c-uart",
102 .irq_mask = s3c_irq_uart_mask,
103 .irq_unmask = s3c_irq_uart_unmask,
104 .irq_mask_ack = s3c_irq_uart_maskack,
105 .irq_ack = s3c_irq_uart_ack,
106};
107
108static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq) 46static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
109{ 47{
110 void __iomem *reg_base = uirq->regs; 48 void __iomem *reg_base = uirq->regs;
111 unsigned int irq; 49 struct irq_chip_generic *gc;
112 int offs; 50 struct irq_chip_type *ct;
113 51
114 /* mask all interrupts at the start. */ 52 /* mask all interrupts at the start. */
115 __raw_writel(0xf, reg_base + S3C64XX_UINTM); 53 __raw_writel(0xf, reg_base + S3C64XX_UINTM);
116 54
117 for (offs = 0; offs < 3; offs++) { 55 gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base,
118 irq = uirq->base_irq + offs; 56 handle_level_irq);
119 57 ct = gc->chip_types;
120 irq_set_chip_and_handler(irq, &s3c_irq_uart, handle_level_irq); 58 ct->chip.irq_ack = irq_gc_ack;
121 irq_set_chip_data(irq, uirq); 59 ct->chip.irq_mask = irq_gc_mask_set_bit;
122 set_irq_flags(irq, IRQF_VALID); 60 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
123 } 61 ct->regs.ack = S3C64XX_UINTP;
62 ct->regs.mask = S3C64XX_UINTM;
63 irq_setup_generic_chip(gc, IRQ_MSK(4), IRQ_GC_INIT_MASK_CACHE,
64 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
124 65
125 irq_set_handler_data(uirq->parent_irq, uirq); 66 irq_set_handler_data(uirq->parent_irq, uirq);
126 irq_set_chained_handler(uirq->parent_irq, s3c_irq_demux_uart); 67 irq_set_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index d6ad66ab929..a607546ddbd 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -28,60 +28,43 @@ static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
28} 28}
29 29
30/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */ 30/* We assume the IRQ_TIMER0..IRQ_TIMER4 range is continuous. */
31 31static void s3c_irq_timer_ack(struct irq_data *d)
32static void s3c_irq_timer_mask(struct irq_data *data)
33{
34 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
35 u32 mask = (u32)data->chip_data;
36
37 reg &= 0x1f; /* mask out pending interrupts */
38 reg &= ~mask;
39 __raw_writel(reg, S3C64XX_TINT_CSTAT);
40}
41
42static void s3c_irq_timer_unmask(struct irq_data *data)
43{ 32{
44 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 33 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
45 u32 mask = (u32)data->chip_data; 34 u32 mask = (1 << 5) << (d->irq - gc->irq_base);
46 35
47 reg &= 0x1f; /* mask out pending interrupts */ 36 irq_reg_writel(mask | gc->mask_cache, gc->reg_base);
48 reg |= mask;
49 __raw_writel(reg, S3C64XX_TINT_CSTAT);
50} 37}
51 38
52static void s3c_irq_timer_ack(struct irq_data *data)
53{
54 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
55 u32 mask = (u32)data->chip_data;
56
57 reg &= 0x1f;
58 reg |= mask << 5;
59 __raw_writel(reg, S3C64XX_TINT_CSTAT);
60}
61
62static struct irq_chip s3c_irq_timer = {
63 .name = "s3c-timer",
64 .irq_mask = s3c_irq_timer_mask,
65 .irq_unmask = s3c_irq_timer_unmask,
66 .irq_ack = s3c_irq_timer_ack,
67};
68
69/** 39/**
70 * s3c_init_vic_timer_irq() - initialise timer irq chanined off VIC.\ 40 * s3c_init_vic_timer_irq() - initialise timer irq chanined off VIC.\
71 * @parent_irq: The parent IRQ on the VIC for the timer. 41 * @num: Number of timers to initialize
72 * @timer_irq: The IRQ to be used for the timer. 42 * @timer_irq: Base IRQ number to be used for the timers.
73 * 43 *
74 * Register the necessary IRQ chaining and support for the timer IRQs 44 * Register the necessary IRQ chaining and support for the timer IRQs
75 * chained of the VIC. 45 * chained of the VIC.
76 */ 46 */
77void __init s3c_init_vic_timer_irq(unsigned int parent_irq, 47void __init s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq)
78 unsigned int timer_irq)
79{ 48{
49 unsigned int pirq[5] = { IRQ_TIMER0_VIC, IRQ_TIMER1_VIC, IRQ_TIMER2_VIC,
50 IRQ_TIMER3_VIC, IRQ_TIMER4_VIC };
51 struct irq_chip_generic *s3c_tgc;
52 struct irq_chip_type *ct;
53 unsigned int i;
80 54
81 irq_set_chained_handler(parent_irq, s3c_irq_demux_vic_timer); 55 s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq,
82 irq_set_handler_data(parent_irq, (void *)timer_irq); 56 S3C64XX_TINT_CSTAT, handle_level_irq);
57 ct = s3c_tgc->chip_types;
58 ct->chip.irq_mask = irq_gc_mask_clr_bit;
59 ct->chip.irq_unmask = irq_gc_mask_set_bit;
60 ct->chip.irq_ack = s3c_irq_timer_ack;
61 irq_setup_generic_chip(s3c_tgc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
62 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
63 /* Clear the upper bits of the mask_cache*/
64 s3c_tgc->mask_cache &= 0x1f;
83 65
84 irq_set_chip_and_handler(timer_irq, &s3c_irq_timer, handle_level_irq); 66 for (i = 0; i < num; i++, timer_irq++) {
85 irq_set_chip_data(timer_irq, (void *)(1 << (timer_irq - IRQ_TIMER0))); 67 irq_set_chained_handler(pirq[i], s3c_irq_demux_vic_timer);
86 set_irq_flags(timer_irq, IRQF_VALID); 68 irq_set_handler_data(pirq[i], (void *)timer_irq);
69 }
87} 70}
diff --git a/arch/arm/plat-samsung/pm-check.c b/arch/arm/plat-samsung/pm-check.c
index e4baf76f374..6b733fafe7c 100644
--- a/arch/arm/plat-samsung/pm-check.c
+++ b/arch/arm/plat-samsung/pm-check.c
@@ -164,7 +164,6 @@ static inline int in_region(void *ptr, int size, void *what, size_t whatsz)
164 */ 164 */
165static u32 *s3c_pm_runcheck(struct resource *res, u32 *val) 165static u32 *s3c_pm_runcheck(struct resource *res, u32 *val)
166{ 166{
167 void *save_at = phys_to_virt(s3c_sleep_save_phys);
168 unsigned long addr; 167 unsigned long addr;
169 unsigned long left; 168 unsigned long left;
170 void *stkpage; 169 void *stkpage;
@@ -192,11 +191,6 @@ static u32 *s3c_pm_runcheck(struct resource *res, u32 *val)
192 goto skip_check; 191 goto skip_check;
193 } 192 }
194 193
195 if (in_region(ptr, left, save_at, 32*4 )) {
196 S3C_PMDBG("skipping %08lx, has save block in\n", addr);
197 goto skip_check;
198 }
199
200 /* calculate and check the checksum */ 194 /* calculate and check the checksum */
201 195
202 calc = crc32_le(~0, ptr, left); 196 calc = crc32_le(~0, ptr, left);
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index d5b58d31903..5c0a440d6e1 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -214,8 +214,9 @@ void s3c_pm_do_restore_core(struct sleep_save *ptr, int count)
214 * 214 *
215 * print any IRQs asserted at resume time (ie, we woke from) 215 * print any IRQs asserted at resume time (ie, we woke from)
216*/ 216*/
217static void s3c_pm_show_resume_irqs(int start, unsigned long which, 217static void __maybe_unused s3c_pm_show_resume_irqs(int start,
218 unsigned long mask) 218 unsigned long which,
219 unsigned long mask)
219{ 220{
220 int i; 221 int i;
221 222
diff --git a/arch/arm/plat-samsung/s3c-pl330.c b/arch/arm/plat-samsung/s3c-pl330.c
index b4ff8d74ac4..f85638c6f5a 100644
--- a/arch/arm/plat-samsung/s3c-pl330.c
+++ b/arch/arm/plat-samsung/s3c-pl330.c
@@ -68,7 +68,7 @@ struct s3c_pl330_xfer {
68 * @req: Two requests to communicate with the PL330 engine. 68 * @req: Two requests to communicate with the PL330 engine.
69 * @callback_fn: Callback function to the client. 69 * @callback_fn: Callback function to the client.
70 * @rqcfg: Channel configuration for the xfers. 70 * @rqcfg: Channel configuration for the xfers.
71 * @xfer_head: Pointer to the xfer to be next excecuted. 71 * @xfer_head: Pointer to the xfer to be next executed.
72 * @dmac: Pointer to the DMAC that manages this channel, NULL if the 72 * @dmac: Pointer to the DMAC that manages this channel, NULL if the
73 * channel is available to be acquired. 73 * channel is available to be acquired.
74 * @client: Client of this channel. NULL if the 74 * @client: Client of this channel. NULL if the
diff --git a/arch/arm/plat-spear/include/plat/clock.h b/arch/arm/plat-spear/include/plat/clock.h
index 2ae6606930a..fcc0d0ad4a1 100644
--- a/arch/arm/plat-spear/include/plat/clock.h
+++ b/arch/arm/plat-spear/include/plat/clock.h
@@ -89,7 +89,7 @@ struct rate_config {
89 * @sibling: node for list of clocks having same parents 89 * @sibling: node for list of clocks having same parents
90 * @private_data: clock specific private data 90 * @private_data: clock specific private data
91 * @node: list to maintain clocks linearly 91 * @node: list to maintain clocks linearly
92 * @cl: clocklook up assoicated with this clock 92 * @cl: clocklook up associated with this clock
93 * @dent: object for debugfs 93 * @dent: object for debugfs
94 */ 94 */
95struct clk { 95struct clk {
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index bbf3da012af..f74695075e6 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -78,6 +78,14 @@ static void vfp_thread_exit(struct thread_info *thread)
78 put_cpu(); 78 put_cpu();
79} 79}
80 80
81static void vfp_thread_copy(struct thread_info *thread)
82{
83 struct thread_info *parent = current_thread_info();
84
85 vfp_sync_hwstate(parent);
86 thread->vfpstate = parent->vfpstate;
87}
88
81/* 89/*
82 * When this function is called with the following 'cmd's, the following 90 * When this function is called with the following 'cmd's, the following
83 * is true while this function is being run: 91 * is true while this function is being run:
@@ -104,12 +112,17 @@ static void vfp_thread_exit(struct thread_info *thread)
104static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) 112static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
105{ 113{
106 struct thread_info *thread = v; 114 struct thread_info *thread = v;
115 u32 fpexc;
116#ifdef CONFIG_SMP
117 unsigned int cpu;
118#endif
107 119
108 if (likely(cmd == THREAD_NOTIFY_SWITCH)) { 120 switch (cmd) {
109 u32 fpexc = fmrx(FPEXC); 121 case THREAD_NOTIFY_SWITCH:
122 fpexc = fmrx(FPEXC);
110 123
111#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
112 unsigned int cpu = thread->cpu; 125 cpu = thread->cpu;
113 126
114 /* 127 /*
115 * On SMP, if VFP is enabled, save the old state in 128 * On SMP, if VFP is enabled, save the old state in
@@ -134,13 +147,20 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
134 * old state. 147 * old state.
135 */ 148 */
136 fmxr(FPEXC, fpexc & ~FPEXC_EN); 149 fmxr(FPEXC, fpexc & ~FPEXC_EN);
137 return NOTIFY_DONE; 150 break;
138 }
139 151
140 if (cmd == THREAD_NOTIFY_FLUSH) 152 case THREAD_NOTIFY_FLUSH:
141 vfp_thread_flush(thread); 153 vfp_thread_flush(thread);
142 else 154 break;
155
156 case THREAD_NOTIFY_EXIT:
143 vfp_thread_exit(thread); 157 vfp_thread_exit(thread);
158 break;
159
160 case THREAD_NOTIFY_COPY:
161 vfp_thread_copy(thread);
162 break;
163 }
144 164
145 return NOTIFY_DONE; 165 return NOTIFY_DONE;
146} 166}