aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig21
-rw-r--r--arch/arm/common/gic.c66
-rw-r--r--arch/arm/common/it8152.c14
-rw-r--r--arch/arm/common/locomo.c24
-rw-r--r--arch/arm/common/sa1111.c96
-rw-r--r--arch/arm/common/vic.c32
-rw-r--r--arch/arm/kernel/ecard.c28
-rw-r--r--arch/arm/kernel/irq.c17
-rw-r--r--arch/arm/mach-aaec2000/core.c18
-rw-r--r--arch/arm/mach-at91/Kconfig13
-rw-r--r--arch/arm/mach-at91/Makefile2
-rw-r--r--arch/arm/mach-at91/board-foxg20.c274
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c584
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c1
-rw-r--r--arch/arm/mach-at91/gpio.c34
-rw-r--r--arch/arm/mach-at91/include/mach/gsia18s.h33
-rw-r--r--arch/arm/mach-at91/irq.c36
-rw-r--r--arch/arm/mach-bcmring/irq.c42
-rw-r--r--arch/arm/mach-clps711x/irq.c40
-rw-r--r--arch/arm/mach-davinci/cp_intc.c30
-rw-r--r--arch/arm/mach-davinci/gpio.c46
-rw-r--r--arch/arm/mach-davinci/irq.c26
-rw-r--r--arch/arm/mach-dove/irq.c18
-rw-r--r--arch/arm/mach-ebsa110/core.c14
-rw-r--r--arch/arm/mach-ep93xx/gpio.c36
-rw-r--r--arch/arm/mach-footbridge/common.c14
-rw-r--r--arch/arm/mach-footbridge/isa-irq.c36
-rw-r--r--arch/arm/mach-gemini/gpio.c26
-rw-r--r--arch/arm/mach-gemini/irq.c20
-rw-r--r--arch/arm/mach-h720x/common.c38
-rw-r--r--arch/arm/mach-h720x/cpu-h7202.c14
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c10
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c16
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c48
-rw-r--r--arch/arm/mach-iop13xx/irq.c64
-rw-r--r--arch/arm/mach-iop13xx/msi.c4
-rw-r--r--arch/arm/mach-iop32x/irq.c16
-rw-r--r--arch/arm/mach-iop33x/irq.c32
-rw-r--r--arch/arm/mach-ixp2000/core.c70
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c18
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c18
-rw-r--r--arch/arm/mach-ixp23xx/core.c55
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c36
-rw-r--r--arch/arm/mach-ixp4xx/common.c42
-rw-r--r--arch/arm/mach-ks8695/irq.c43
-rw-r--r--arch/arm/mach-lh7a40x/arch-kev7a400.c20
-rw-r--r--arch/arm/mach-lh7a40x/arch-lpd7a40x.c25
-rw-r--r--arch/arm/mach-lh7a40x/irq-lh7a400.c30
-rw-r--r--arch/arm/mach-lh7a40x/irq-lh7a404.c60
-rw-r--r--arch/arm/mach-lh7a40x/irq-lpd7a40x.c22
-rw-r--r--arch/arm/mach-lpc32xx/irq.c56
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-mmp2.h2
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa910.h2
-rw-r--r--arch/arm/mach-mmp/irq-mmp2.c46
-rw-r--r--arch/arm/mach-mmp/irq-pxa168.c18
-rw-r--r--arch/arm/mach-msm/board-trout-gpio.c42
-rw-r--r--arch/arm/mach-msm/gpio.c48
-rw-r--r--arch/arm/mach-msm/irq-vic.c65
-rw-r--r--arch/arm/mach-msm/irq.c45
-rw-r--r--arch/arm/mach-msm/sirc.c39
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c4
-rw-r--r--arch/arm/mach-mx3/mach-mx31ads.c18
-rw-r--r--arch/arm/mach-mx5/Kconfig20
-rw-r--r--arch/arm/mach-mx5/Makefile2
-rw-r--r--arch/arm/mach-mx5/board-mx51_3ds.c5
-rw-r--r--arch/arm/mach-mx5/board-mx53_evk.c74
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c111
-rw-r--r--arch/arm/mach-mx5/board-mx53_smd.c111
-rw-r--r--arch/arm/mach-mx5/clock-mx51-mx53.c18
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h8
-rw-r--r--arch/arm/mach-mx5/devices-imx53.h18
-rw-r--r--arch/arm/mach-mx5/devices.c19
-rw-r--r--arch/arm/mach-mx5/devices.h1
-rw-r--r--arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c5
-rw-r--r--arch/arm/mach-mxs/Kconfig4
-rw-r--r--arch/arm/mach-mxs/clock-mx23.c13
-rw-r--r--arch/arm/mach-mxs/clock-mx28.c14
-rw-r--r--arch/arm/mach-mxs/devices-mx23.h4
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h4
-rw-r--r--arch/arm/mach-mxs/devices.c17
-rw-r--r--arch/arm/mach-mxs/devices/Kconfig3
-rw-r--r--arch/arm/mach-mxs/devices/Makefile2
-rw-r--r--arch/arm/mach-mxs/devices/amba-duart.c40
-rw-r--r--arch/arm/mach-mxs/devices/platform-duart.c48
-rw-r--r--arch/arm/mach-mxs/devices/platform-fec.c2
-rw-r--r--arch/arm/mach-mxs/include/mach/devices-common.h11
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c26
-rw-r--r--arch/arm/mach-netx/generic.c30
-rw-r--r--arch/arm/mach-ns9xxx/board-a9m9750dev.c28
-rw-r--r--arch/arm/mach-ns9xxx/irq.c28
-rw-r--r--arch/arm/mach-nuc93x/irq.c16
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq.c8
-rw-r--r--arch/arm/mach-omap1/fpga.c28
-rw-r--r--arch/arm/mach-omap1/irq.c44
-rw-r--r--arch/arm/mach-omap2/irq.c22
-rw-r--r--arch/arm/mach-pnx4008/irq.c62
-rw-r--r--arch/arm/mach-pxa/balloon3.c23
-rw-r--r--arch/arm/mach-pxa/clock-pxa3xx.c1
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c2
-rw-r--r--arch/arm/mach-pxa/generic.h4
-rw-r--r--arch/arm/mach-pxa/irq.c83
-rw-r--r--arch/arm/mach-pxa/lpd270.c17
-rw-r--r--arch/arm/mach-pxa/lubbock.c17
-rw-r--r--arch/arm/mach-pxa/mainstone.c17
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c15
-rw-r--r--arch/arm/mach-pxa/pxa25x.c7
-rw-r--r--arch/arm/mach-pxa/pxa27x.c9
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c36
-rw-r--r--arch/arm/mach-pxa/spitz.c1
-rw-r--r--arch/arm/mach-pxa/viper.c22
-rw-r--r--arch/arm/mach-pxa/zeus.c26
-rw-r--r--arch/arm/mach-rpc/irq.c60
-rw-r--r--arch/arm/mach-s3c2410/bast-irq.c22
-rw-r--r--arch/arm/mach-s3c2410/include/mach/irqs.h4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/map.h4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h1
-rw-r--r--arch/arm/mach-s3c2412/irq.c50
-rw-r--r--arch/arm/mach-s3c2416/Kconfig12
-rw-r--r--arch/arm/mach-s3c2416/Makefile4
-rw-r--r--arch/arm/mach-s3c2416/clock.c18
-rw-r--r--arch/arm/mach-s3c2416/irq.c76
-rw-r--r--arch/arm/mach-s3c2416/mach-smdk2416.c23
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c5
-rw-r--r--arch/arm/mach-s3c2416/setup-sdhci-gpio.c34
-rw-r--r--arch/arm/mach-s3c2416/setup-sdhci.c61
-rw-r--r--arch/arm/mach-s3c2440/irq.c18
-rw-r--r--arch/arm/mach-s3c2440/s3c244x-irq.c18
-rw-r--r--arch/arm/mach-s3c2443/Kconfig3
-rw-r--r--arch/arm/mach-s3c2443/clock.c4
-rw-r--r--arch/arm/mach-s3c2443/irq.c95
-rw-r--r--arch/arm/mach-s3c2443/mach-smdk2443.c9
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c7
-rw-r--r--arch/arm/mach-s3c64xx/clock.c19
-rw-r--r--arch/arm/mach-s3c64xx/dma.c1
-rw-r--r--arch/arm/mach-s3c64xx/irq-eint.c37
-rw-r--r--arch/arm/mach-s5p6442/clock.c16
-rw-r--r--arch/arm/mach-s5p6442/include/mach/map.h3
-rw-r--r--arch/arm/mach-s5p6442/mach-smdk6442.c10
-rw-r--r--arch/arm/mach-s5p6442/setup-i2c0.c5
-rw-r--r--arch/arm/mach-s5p64x0/Makefile4
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c22
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c34
-rw-r--r--arch/arm/mach-s5p64x0/dev-audio.c123
-rw-r--r--arch/arm/mach-s5p64x0/gpiolib.c (renamed from arch/arm/mach-s5p64x0/gpio.c)221
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/map.h5
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-gpio.h57
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6440.c1
-rw-r--r--arch/arm/mach-s5p64x0/mach-smdk6450.c1
-rw-r--r--arch/arm/mach-s5pc100/clock.c16
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h2
-rw-r--r--arch/arm/mach-s5pv210/Kconfig2
-rw-r--r--arch/arm/mach-s5pv210/clock.c25
-rw-r--r--arch/arm/mach-s5pv210/cpu.c5
-rw-r--r--arch/arm/mach-s5pv210/include/mach/irqs.h3
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h6
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-clock.h5
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c1
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c139
-rw-r--r--arch/arm/mach-s5pv310/Kconfig21
-rw-r--r--arch/arm/mach-s5pv310/Makefile6
-rw-r--r--arch/arm/mach-s5pv310/clock.c77
-rw-r--r--arch/arm/mach-s5pv310/cpu.c21
-rw-r--r--arch/arm/mach-s5pv310/cpufreq.c580
-rw-r--r--arch/arm/mach-s5pv310/dev-pd.c139
-rw-r--r--arch/arm/mach-s5pv310/dev-sysmmu.c187
-rw-r--r--arch/arm/mach-s5pv310/include/mach/irqs.h34
-rw-r--r--arch/arm/mach-s5pv310/include/mach/map.h29
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-clock.h80
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-mem.h23
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-pmu.h30
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-srom.h50
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h24
-rw-r--r--arch/arm/mach-s5pv310/include/mach/sysmmu.h119
-rw-r--r--arch/arm/mach-s5pv310/irq-combiner.c32
-rw-r--r--arch/arm/mach-s5pv310/irq-eint.c55
-rw-r--r--arch/arm/mach-s5pv310/mach-smdkc210.c52
-rw-r--r--arch/arm/mach-s5pv310/mach-smdkv310.c52
-rw-r--r--arch/arm/mach-s5pv310/mach-universal_c210.c80
-rw-r--r--arch/arm/mach-sa1100/irq.c84
-rw-r--r--arch/arm/mach-sa1100/neponset.c8
-rw-r--r--arch/arm/mach-shark/irq.c26
-rw-r--r--arch/arm/mach-stmp378x/stmp378x.c16
-rw-r--r--arch/arm/mach-stmp37xx/stmp37xx.c24
-rw-r--r--arch/arm/mach-tcc8k/irq.c56
-rw-r--r--arch/arm/mach-tegra/gpio.c38
-rw-r--r--arch/arm/mach-tegra/irq.c36
-rw-r--r--arch/arm/mach-versatile/core.c18
-rw-r--r--arch/arm/mach-w90x900/irq.c20
-rw-r--r--arch/arm/plat-mxc/3ds_debugboard.c28
-rw-r--r--arch/arm/plat-mxc/avic.c14
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig2
-rw-r--r--arch/arm/plat-mxc/devices/platform-fec.c5
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-i2c.c9
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-keypad.c5
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_pwm.c9
-rw-r--r--arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c12
-rw-r--r--arch/arm/plat-mxc/devices/platform-spi_imx.c12
-rw-r--r--arch/arm/plat-mxc/gpio.c30
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx53.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-v3.h1
-rw-r--r--arch/arm/plat-mxc/include/mach/mx51.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/mx53.h28
-rw-r--r--arch/arm/plat-mxc/pwm.c2
-rw-r--r--arch/arm/plat-mxc/tzic.c38
-rw-r--r--arch/arm/plat-nomadik/gpio.c56
-rw-r--r--arch/arm/plat-omap/gpio.c95
-rw-r--r--arch/arm/plat-orion/gpio.c37
-rw-r--r--arch/arm/plat-orion/irq.c18
-rw-r--r--arch/arm/plat-pxa/gpio.c28
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio.h4
-rw-r--r--arch/arm/plat-s3c24xx/devs.c1
-rw-r--r--arch/arm/plat-s3c24xx/include/plat/irq.h4
-rw-r--r--arch/arm/plat-s3c24xx/irq-pm.c9
-rw-r--r--arch/arm/plat-s3c24xx/irq.c182
-rw-r--r--arch/arm/plat-s3c24xx/s3c2443-clock.c2
-rw-r--r--arch/arm/plat-s5p/Kconfig26
-rw-r--r--arch/arm/plat-s5p/Makefile3
-rw-r--r--arch/arm/plat-s5p/cpu.c5
-rw-r--r--arch/arm/plat-s5p/dev-csis0.c34
-rw-r--r--arch/arm/plat-s5p/dev-csis1.c34
-rw-r--r--arch/arm/plat-s5p/include/plat/csis.h28
-rw-r--r--arch/arm/plat-s5p/include/plat/map-s5p.h1
-rw-r--r--arch/arm/plat-s5p/include/plat/regs-srom.h54
-rw-r--r--arch/arm/plat-s5p/include/plat/sysmmu.h23
-rw-r--r--arch/arm/plat-s5p/irq-eint.c86
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c50
-rw-r--r--arch/arm/plat-s5p/irq-pm.c6
-rw-r--r--arch/arm/plat-s5p/sysmmu.c328
-rw-r--r--arch/arm/plat-samsung/Kconfig14
-rw-r--r--arch/arm/plat-samsung/Makefile4
-rw-r--r--arch/arm/plat-samsung/clock.c92
-rw-r--r--arch/arm/plat-samsung/dev-nand.c2
-rw-r--r--arch/arm/plat-samsung/gpio-config.c42
-rw-r--r--arch/arm/plat-samsung/gpiolib.c7
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h3
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h8
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/pd.h30
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h35
-rw-r--r--arch/arm/plat-samsung/irq-uart.c40
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c26
-rw-r--r--arch/arm/plat-samsung/pd.c95
-rw-r--r--arch/arm/plat-samsung/pm.c6
-rw-r--r--arch/arm/plat-spear/shirq.c22
-rw-r--r--arch/arm/plat-stmp3xxx/irq.c2
-rw-r--r--arch/arm/plat-stmp3xxx/pinmux.c32
249 files changed, 6533 insertions, 2396 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 629ff8261fc1..5cff165b7eb0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -26,6 +26,8 @@ config ARM
26 select HAVE_REGS_AND_STACK_ACCESS_API 26 select HAVE_REGS_AND_STACK_ACCESS_API
27 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7)) 27 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7))
28 select HAVE_C_RECORDMCOUNT 28 select HAVE_C_RECORDMCOUNT
29 select HAVE_GENERIC_HARDIRQS
30 select HAVE_SPARSE_IRQ
29 help 31 help
30 The ARM series is a line of low-power-consumption RISC chip designs 32 The ARM series is a line of low-power-consumption RISC chip designs
31 licensed by ARM Ltd and targeted at embedded applications and 33 licensed by ARM Ltd and targeted at embedded applications and
@@ -97,10 +99,6 @@ config MCA
97 <file:Documentation/mca.txt> (and especially the web page given 99 <file:Documentation/mca.txt> (and especially the web page given
98 there) before attempting to build an MCA bus kernel. 100 there) before attempting to build an MCA bus kernel.
99 101
100config GENERIC_HARDIRQS
101 bool
102 default y
103
104config STACKTRACE_SUPPORT 102config STACKTRACE_SUPPORT
105 bool 103 bool
106 default y 104 default y
@@ -180,9 +178,6 @@ config FIQ
180config ARCH_MTD_XIP 178config ARCH_MTD_XIP
181 bool 179 bool
182 180
183config GENERIC_HARDIRQS_NO__DO_IRQ
184 def_bool y
185
186config ARM_L1_CACHE_SHIFT_6 181config ARM_L1_CACHE_SHIFT_6
187 bool 182 bool
188 help 183 help
@@ -368,7 +363,7 @@ config ARCH_MXS
368 bool "Freescale MXS-based" 363 bool "Freescale MXS-based"
369 select GENERIC_CLOCKEVENTS 364 select GENERIC_CLOCKEVENTS
370 select ARCH_REQUIRE_GPIOLIB 365 select ARCH_REQUIRE_GPIOLIB
371 select COMMON_CLKDEV 366 select CLKDEV_LOOKUP
372 help 367 help
373 Support for Freescale MXS-based family of processors 368 Support for Freescale MXS-based family of processors
374 369
@@ -771,6 +766,7 @@ config ARCH_S5PV310
771 select ARCH_SPARSEMEM_ENABLE 766 select ARCH_SPARSEMEM_ENABLE
772 select GENERIC_GPIO 767 select GENERIC_GPIO
773 select HAVE_CLK 768 select HAVE_CLK
769 select ARCH_HAS_CPUFREQ
774 select GENERIC_CLOCKEVENTS 770 select GENERIC_CLOCKEVENTS
775 select HAVE_S3C_RTC if RTC_CLASS 771 select HAVE_S3C_RTC if RTC_CLASS
776 select HAVE_S3C2410_I2C if I2C 772 select HAVE_S3C2410_I2C if I2C
@@ -1452,15 +1448,6 @@ config HW_PERF_EVENTS
1452 Enable hardware performance counter support for perf events. If 1448 Enable hardware performance counter support for perf events. If
1453 disabled, perf events will use software events only. 1449 disabled, perf events will use software events only.
1454 1450
1455config SPARSE_IRQ
1456 def_bool n
1457 help
1458 This enables support for sparse irqs. This is useful in general
1459 as most CPUs have a fairly sparse array of IRQ vectors, which
1460 the irq_desc then maps directly on to. Systems with a high
1461 number of off-chip IRQs will want to treat this as
1462 experimental until they have been independently verified.
1463
1464source "mm/Kconfig" 1451source "mm/Kconfig"
1465 1452
1466config FORCE_MAX_ZONEORDER 1453config FORCE_MAX_ZONEORDER
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 0b89ef001330..224377211151 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -50,57 +50,56 @@ struct gic_chip_data {
50 50
51static struct gic_chip_data gic_data[MAX_GIC_NR] __read_mostly; 51static struct gic_chip_data gic_data[MAX_GIC_NR] __read_mostly;
52 52
53static inline void __iomem *gic_dist_base(unsigned int irq) 53static inline void __iomem *gic_dist_base(struct irq_data *d)
54{ 54{
55 struct gic_chip_data *gic_data = get_irq_chip_data(irq); 55 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
56 return gic_data->dist_base; 56 return gic_data->dist_base;
57} 57}
58 58
59static inline void __iomem *gic_cpu_base(unsigned int irq) 59static inline void __iomem *gic_cpu_base(struct irq_data *d)
60{ 60{
61 struct gic_chip_data *gic_data = get_irq_chip_data(irq); 61 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
62 return gic_data->cpu_base; 62 return gic_data->cpu_base;
63} 63}
64 64
65static inline unsigned int gic_irq(unsigned int irq) 65static inline unsigned int gic_irq(struct irq_data *d)
66{ 66{
67 struct gic_chip_data *gic_data = get_irq_chip_data(irq); 67 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
68 return irq - gic_data->irq_offset; 68 return d->irq - gic_data->irq_offset;
69} 69}
70 70
71/* 71/*
72 * Routines to acknowledge, disable and enable interrupts 72 * Routines to acknowledge, disable and enable interrupts
73 */ 73 */
74static void gic_ack_irq(unsigned int irq) 74static void gic_ack_irq(struct irq_data *d)
75{ 75{
76
77 spin_lock(&irq_controller_lock); 76 spin_lock(&irq_controller_lock);
78 writel(gic_irq(irq), gic_cpu_base(irq) + GIC_CPU_EOI); 77 writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
79 spin_unlock(&irq_controller_lock); 78 spin_unlock(&irq_controller_lock);
80} 79}
81 80
82static void gic_mask_irq(unsigned int irq) 81static void gic_mask_irq(struct irq_data *d)
83{ 82{
84 u32 mask = 1 << (irq % 32); 83 u32 mask = 1 << (d->irq % 32);
85 84
86 spin_lock(&irq_controller_lock); 85 spin_lock(&irq_controller_lock);
87 writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_CLEAR + (gic_irq(irq) / 32) * 4); 86 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
88 spin_unlock(&irq_controller_lock); 87 spin_unlock(&irq_controller_lock);
89} 88}
90 89
91static void gic_unmask_irq(unsigned int irq) 90static void gic_unmask_irq(struct irq_data *d)
92{ 91{
93 u32 mask = 1 << (irq % 32); 92 u32 mask = 1 << (d->irq % 32);
94 93
95 spin_lock(&irq_controller_lock); 94 spin_lock(&irq_controller_lock);
96 writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_SET + (gic_irq(irq) / 32) * 4); 95 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
97 spin_unlock(&irq_controller_lock); 96 spin_unlock(&irq_controller_lock);
98} 97}
99 98
100static int gic_set_type(unsigned int irq, unsigned int type) 99static int gic_set_type(struct irq_data *d, unsigned int type)
101{ 100{
102 void __iomem *base = gic_dist_base(irq); 101 void __iomem *base = gic_dist_base(d);
103 unsigned int gicirq = gic_irq(irq); 102 unsigned int gicirq = gic_irq(d);
104 u32 enablemask = 1 << (gicirq % 32); 103 u32 enablemask = 1 << (gicirq % 32);
105 u32 enableoff = (gicirq / 32) * 4; 104 u32 enableoff = (gicirq / 32) * 4;
106 u32 confmask = 0x2 << ((gicirq % 16) * 2); 105 u32 confmask = 0x2 << ((gicirq % 16) * 2);
@@ -143,21 +142,22 @@ static int gic_set_type(unsigned int irq, unsigned int type)
143} 142}
144 143
145#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
146static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val) 145static int
146gic_set_cpu(struct irq_data *d, const struct cpumask *mask_val, bool force)
147{ 147{
148 void __iomem *reg = gic_dist_base(irq) + GIC_DIST_TARGET + (gic_irq(irq) & ~3); 148 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
149 unsigned int shift = (irq % 4) * 8; 149 unsigned int shift = (d->irq % 4) * 8;
150 unsigned int cpu = cpumask_first(mask_val); 150 unsigned int cpu = cpumask_first(mask_val);
151 u32 val; 151 u32 val;
152 struct irq_desc *desc; 152 struct irq_desc *desc;
153 153
154 spin_lock(&irq_controller_lock); 154 spin_lock(&irq_controller_lock);
155 desc = irq_to_desc(irq); 155 desc = irq_to_desc(d->irq);
156 if (desc == NULL) { 156 if (desc == NULL) {
157 spin_unlock(&irq_controller_lock); 157 spin_unlock(&irq_controller_lock);
158 return -EINVAL; 158 return -EINVAL;
159 } 159 }
160 desc->node = cpu; 160 d->node = cpu;
161 val = readl(reg) & ~(0xff << shift); 161 val = readl(reg) & ~(0xff << shift);
162 val |= 1 << (cpu + shift); 162 val |= 1 << (cpu + shift);
163 writel(val, reg); 163 writel(val, reg);
@@ -175,7 +175,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
175 unsigned long status; 175 unsigned long status;
176 176
177 /* primary controller ack'ing */ 177 /* primary controller ack'ing */
178 chip->ack(irq); 178 chip->irq_ack(&desc->irq_data);
179 179
180 spin_lock(&irq_controller_lock); 180 spin_lock(&irq_controller_lock);
181 status = readl(chip_data->cpu_base + GIC_CPU_INTACK); 181 status = readl(chip_data->cpu_base + GIC_CPU_INTACK);
@@ -193,17 +193,17 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
193 193
194 out: 194 out:
195 /* primary controller unmasking */ 195 /* primary controller unmasking */
196 chip->unmask(irq); 196 chip->irq_unmask(&desc->irq_data);
197} 197}
198 198
199static struct irq_chip gic_chip = { 199static struct irq_chip gic_chip = {
200 .name = "GIC", 200 .name = "GIC",
201 .ack = gic_ack_irq, 201 .irq_ack = gic_ack_irq,
202 .mask = gic_mask_irq, 202 .irq_mask = gic_mask_irq,
203 .unmask = gic_unmask_irq, 203 .irq_unmask = gic_unmask_irq,
204 .set_type = gic_set_type, 204 .irq_set_type = gic_set_type,
205#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
206 .set_affinity = gic_set_cpu, 206 .irq_set_affinity = gic_set_cpu,
207#endif 207#endif
208}; 208};
209 209
@@ -337,7 +337,7 @@ void __cpuinit gic_enable_ppi(unsigned int irq)
337 337
338 local_irq_save(flags); 338 local_irq_save(flags);
339 irq_to_desc(irq)->status |= IRQ_NOPROBE; 339 irq_to_desc(irq)->status |= IRQ_NOPROBE;
340 gic_unmask_irq(irq); 340 gic_unmask_irq(irq_get_irq_data(irq));
341 local_irq_restore(flags); 341 local_irq_restore(flags);
342} 342}
343 343
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index 665ebf7e62a6..fcddd48fe9da 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -31,8 +31,10 @@
31 31
32#define MAX_SLOTS 21 32#define MAX_SLOTS 21
33 33
34static void it8152_mask_irq(unsigned int irq) 34static void it8152_mask_irq(struct irq_data *d)
35{ 35{
36 unsigned int irq = d->irq;
37
36 if (irq >= IT8152_LD_IRQ(0)) { 38 if (irq >= IT8152_LD_IRQ(0)) {
37 __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) | 39 __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) |
38 (1 << (irq - IT8152_LD_IRQ(0)))), 40 (1 << (irq - IT8152_LD_IRQ(0)))),
@@ -48,8 +50,10 @@ static void it8152_mask_irq(unsigned int irq)
48 } 50 }
49} 51}
50 52
51static void it8152_unmask_irq(unsigned int irq) 53static void it8152_unmask_irq(struct irq_data *d)
52{ 54{
55 unsigned int irq = d->irq;
56
53 if (irq >= IT8152_LD_IRQ(0)) { 57 if (irq >= IT8152_LD_IRQ(0)) {
54 __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) & 58 __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) &
55 ~(1 << (irq - IT8152_LD_IRQ(0)))), 59 ~(1 << (irq - IT8152_LD_IRQ(0)))),
@@ -67,9 +71,9 @@ static void it8152_unmask_irq(unsigned int irq)
67 71
68static struct irq_chip it8152_irq_chip = { 72static struct irq_chip it8152_irq_chip = {
69 .name = "it8152", 73 .name = "it8152",
70 .ack = it8152_mask_irq, 74 .irq_ack = it8152_mask_irq,
71 .mask = it8152_mask_irq, 75 .irq_mask = it8152_mask_irq,
72 .unmask = it8152_unmask_irq, 76 .irq_unmask = it8152_unmask_irq,
73}; 77};
74 78
75void it8152_init_irq(void) 79void it8152_init_irq(void)
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 9dff07c80ddb..a026a6bf4892 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -144,7 +144,7 @@ static void locomo_handler(unsigned int irq, struct irq_desc *desc)
144 int req, i; 144 int req, i;
145 145
146 /* Acknowledge the parent IRQ */ 146 /* Acknowledge the parent IRQ */
147 desc->chip->ack(irq); 147 desc->irq_data.chip->irq_ack(&desc->irq_data);
148 148
149 /* check why this interrupt was generated */ 149 /* check why this interrupt was generated */
150 req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00; 150 req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
@@ -161,33 +161,33 @@ static void locomo_handler(unsigned int irq, struct irq_desc *desc)
161 } 161 }
162} 162}
163 163
164static void locomo_ack_irq(unsigned int irq) 164static void locomo_ack_irq(struct irq_data *d)
165{ 165{
166} 166}
167 167
168static void locomo_mask_irq(unsigned int irq) 168static void locomo_mask_irq(struct irq_data *d)
169{ 169{
170 struct locomo *lchip = get_irq_chip_data(irq); 170 struct locomo *lchip = irq_data_get_irq_chip_data(d);
171 unsigned int r; 171 unsigned int r;
172 r = locomo_readl(lchip->base + LOCOMO_ICR); 172 r = locomo_readl(lchip->base + LOCOMO_ICR);
173 r &= ~(0x0010 << (irq - lchip->irq_base)); 173 r &= ~(0x0010 << (d->irq - lchip->irq_base));
174 locomo_writel(r, lchip->base + LOCOMO_ICR); 174 locomo_writel(r, lchip->base + LOCOMO_ICR);
175} 175}
176 176
177static void locomo_unmask_irq(unsigned int irq) 177static void locomo_unmask_irq(struct irq_data *d)
178{ 178{
179 struct locomo *lchip = get_irq_chip_data(irq); 179 struct locomo *lchip = irq_data_get_irq_chip_data(d);
180 unsigned int r; 180 unsigned int r;
181 r = locomo_readl(lchip->base + LOCOMO_ICR); 181 r = locomo_readl(lchip->base + LOCOMO_ICR);
182 r |= (0x0010 << (irq - lchip->irq_base)); 182 r |= (0x0010 << (d->irq - lchip->irq_base));
183 locomo_writel(r, lchip->base + LOCOMO_ICR); 183 locomo_writel(r, lchip->base + LOCOMO_ICR);
184} 184}
185 185
186static struct irq_chip locomo_chip = { 186static struct irq_chip locomo_chip = {
187 .name = "LOCOMO", 187 .name = "LOCOMO",
188 .ack = locomo_ack_irq, 188 .irq_ack = locomo_ack_irq,
189 .mask = locomo_mask_irq, 189 .irq_mask = locomo_mask_irq,
190 .unmask = locomo_unmask_irq, 190 .irq_unmask = locomo_unmask_irq,
191}; 191};
192 192
193static void locomo_setup_irq(struct locomo *lchip) 193static void locomo_setup_irq(struct locomo *lchip)
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index c0258a8c103b..eb9796b0dab2 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -210,7 +210,7 @@ sa1111_irq_handler(unsigned int irq, struct irq_desc *desc)
210 210
211 sa1111_writel(stat0, mapbase + SA1111_INTSTATCLR0); 211 sa1111_writel(stat0, mapbase + SA1111_INTSTATCLR0);
212 212
213 desc->chip->ack(irq); 213 desc->irq_data.chip->irq_ack(&desc->irq_data);
214 214
215 sa1111_writel(stat1, mapbase + SA1111_INTSTATCLR1); 215 sa1111_writel(stat1, mapbase + SA1111_INTSTATCLR1);
216 216
@@ -228,35 +228,35 @@ sa1111_irq_handler(unsigned int irq, struct irq_desc *desc)
228 generic_handle_irq(i + sachip->irq_base); 228 generic_handle_irq(i + sachip->irq_base);
229 229
230 /* For level-based interrupts */ 230 /* For level-based interrupts */
231 desc->chip->unmask(irq); 231 desc->irq_data.chip->irq_unmask(&desc->irq_data);
232} 232}
233 233
234#define SA1111_IRQMASK_LO(x) (1 << (x - sachip->irq_base)) 234#define SA1111_IRQMASK_LO(x) (1 << (x - sachip->irq_base))
235#define SA1111_IRQMASK_HI(x) (1 << (x - sachip->irq_base - 32)) 235#define SA1111_IRQMASK_HI(x) (1 << (x - sachip->irq_base - 32))
236 236
237static void sa1111_ack_irq(unsigned int irq) 237static void sa1111_ack_irq(struct irq_data *d)
238{ 238{
239} 239}
240 240
241static void sa1111_mask_lowirq(unsigned int irq) 241static void sa1111_mask_lowirq(struct irq_data *d)
242{ 242{
243 struct sa1111 *sachip = get_irq_chip_data(irq); 243 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
244 void __iomem *mapbase = sachip->base + SA1111_INTC; 244 void __iomem *mapbase = sachip->base + SA1111_INTC;
245 unsigned long ie0; 245 unsigned long ie0;
246 246
247 ie0 = sa1111_readl(mapbase + SA1111_INTEN0); 247 ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
248 ie0 &= ~SA1111_IRQMASK_LO(irq); 248 ie0 &= ~SA1111_IRQMASK_LO(d->irq);
249 writel(ie0, mapbase + SA1111_INTEN0); 249 writel(ie0, mapbase + SA1111_INTEN0);
250} 250}
251 251
252static void sa1111_unmask_lowirq(unsigned int irq) 252static void sa1111_unmask_lowirq(struct irq_data *d)
253{ 253{
254 struct sa1111 *sachip = get_irq_chip_data(irq); 254 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
255 void __iomem *mapbase = sachip->base + SA1111_INTC; 255 void __iomem *mapbase = sachip->base + SA1111_INTC;
256 unsigned long ie0; 256 unsigned long ie0;
257 257
258 ie0 = sa1111_readl(mapbase + SA1111_INTEN0); 258 ie0 = sa1111_readl(mapbase + SA1111_INTEN0);
259 ie0 |= SA1111_IRQMASK_LO(irq); 259 ie0 |= SA1111_IRQMASK_LO(d->irq);
260 sa1111_writel(ie0, mapbase + SA1111_INTEN0); 260 sa1111_writel(ie0, mapbase + SA1111_INTEN0);
261} 261}
262 262
@@ -267,11 +267,11 @@ static void sa1111_unmask_lowirq(unsigned int irq)
267 * be triggered. In fact, its very difficult, if not impossible to get 267 * be triggered. In fact, its very difficult, if not impossible to get
268 * INTSET to re-trigger the interrupt. 268 * INTSET to re-trigger the interrupt.
269 */ 269 */
270static int sa1111_retrigger_lowirq(unsigned int irq) 270static int sa1111_retrigger_lowirq(struct irq_data *d)
271{ 271{
272 struct sa1111 *sachip = get_irq_chip_data(irq); 272 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
273 void __iomem *mapbase = sachip->base + SA1111_INTC; 273 void __iomem *mapbase = sachip->base + SA1111_INTC;
274 unsigned int mask = SA1111_IRQMASK_LO(irq); 274 unsigned int mask = SA1111_IRQMASK_LO(d->irq);
275 unsigned long ip0; 275 unsigned long ip0;
276 int i; 276 int i;
277 277
@@ -279,21 +279,21 @@ static int sa1111_retrigger_lowirq(unsigned int irq)
279 for (i = 0; i < 8; i++) { 279 for (i = 0; i < 8; i++) {
280 sa1111_writel(ip0 ^ mask, mapbase + SA1111_INTPOL0); 280 sa1111_writel(ip0 ^ mask, mapbase + SA1111_INTPOL0);
281 sa1111_writel(ip0, mapbase + SA1111_INTPOL0); 281 sa1111_writel(ip0, mapbase + SA1111_INTPOL0);
282 if (sa1111_readl(mapbase + SA1111_INTSTATCLR1) & mask) 282 if (sa1111_readl(mapbase + SA1111_INTSTATCLR0) & mask)
283 break; 283 break;
284 } 284 }
285 285
286 if (i == 8) 286 if (i == 8)
287 printk(KERN_ERR "Danger Will Robinson: failed to " 287 printk(KERN_ERR "Danger Will Robinson: failed to "
288 "re-trigger IRQ%d\n", irq); 288 "re-trigger IRQ%d\n", d->irq);
289 return i == 8 ? -1 : 0; 289 return i == 8 ? -1 : 0;
290} 290}
291 291
292static int sa1111_type_lowirq(unsigned int irq, unsigned int flags) 292static int sa1111_type_lowirq(struct irq_data *d, unsigned int flags)
293{ 293{
294 struct sa1111 *sachip = get_irq_chip_data(irq); 294 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
295 void __iomem *mapbase = sachip->base + SA1111_INTC; 295 void __iomem *mapbase = sachip->base + SA1111_INTC;
296 unsigned int mask = SA1111_IRQMASK_LO(irq); 296 unsigned int mask = SA1111_IRQMASK_LO(d->irq);
297 unsigned long ip0; 297 unsigned long ip0;
298 298
299 if (flags == IRQ_TYPE_PROBE) 299 if (flags == IRQ_TYPE_PROBE)
@@ -313,11 +313,11 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
313 return 0; 313 return 0;
314} 314}
315 315
316static int sa1111_wake_lowirq(unsigned int irq, unsigned int on) 316static int sa1111_wake_lowirq(struct irq_data *d, unsigned int on)
317{ 317{
318 struct sa1111 *sachip = get_irq_chip_data(irq); 318 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
319 void __iomem *mapbase = sachip->base + SA1111_INTC; 319 void __iomem *mapbase = sachip->base + SA1111_INTC;
320 unsigned int mask = SA1111_IRQMASK_LO(irq); 320 unsigned int mask = SA1111_IRQMASK_LO(d->irq);
321 unsigned long we0; 321 unsigned long we0;
322 322
323 we0 = sa1111_readl(mapbase + SA1111_WAKEEN0); 323 we0 = sa1111_readl(mapbase + SA1111_WAKEEN0);
@@ -332,33 +332,33 @@ static int sa1111_wake_lowirq(unsigned int irq, unsigned int on)
332 332
333static struct irq_chip sa1111_low_chip = { 333static struct irq_chip sa1111_low_chip = {
334 .name = "SA1111-l", 334 .name = "SA1111-l",
335 .ack = sa1111_ack_irq, 335 .irq_ack = sa1111_ack_irq,
336 .mask = sa1111_mask_lowirq, 336 .irq_mask = sa1111_mask_lowirq,
337 .unmask = sa1111_unmask_lowirq, 337 .irq_unmask = sa1111_unmask_lowirq,
338 .retrigger = sa1111_retrigger_lowirq, 338 .irq_retrigger = sa1111_retrigger_lowirq,
339 .set_type = sa1111_type_lowirq, 339 .irq_set_type = sa1111_type_lowirq,
340 .set_wake = sa1111_wake_lowirq, 340 .irq_set_wake = sa1111_wake_lowirq,
341}; 341};
342 342
343static void sa1111_mask_highirq(unsigned int irq) 343static void sa1111_mask_highirq(struct irq_data *d)
344{ 344{
345 struct sa1111 *sachip = get_irq_chip_data(irq); 345 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
346 void __iomem *mapbase = sachip->base + SA1111_INTC; 346 void __iomem *mapbase = sachip->base + SA1111_INTC;
347 unsigned long ie1; 347 unsigned long ie1;
348 348
349 ie1 = sa1111_readl(mapbase + SA1111_INTEN1); 349 ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
350 ie1 &= ~SA1111_IRQMASK_HI(irq); 350 ie1 &= ~SA1111_IRQMASK_HI(d->irq);
351 sa1111_writel(ie1, mapbase + SA1111_INTEN1); 351 sa1111_writel(ie1, mapbase + SA1111_INTEN1);
352} 352}
353 353
354static void sa1111_unmask_highirq(unsigned int irq) 354static void sa1111_unmask_highirq(struct irq_data *d)
355{ 355{
356 struct sa1111 *sachip = get_irq_chip_data(irq); 356 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
357 void __iomem *mapbase = sachip->base + SA1111_INTC; 357 void __iomem *mapbase = sachip->base + SA1111_INTC;
358 unsigned long ie1; 358 unsigned long ie1;
359 359
360 ie1 = sa1111_readl(mapbase + SA1111_INTEN1); 360 ie1 = sa1111_readl(mapbase + SA1111_INTEN1);
361 ie1 |= SA1111_IRQMASK_HI(irq); 361 ie1 |= SA1111_IRQMASK_HI(d->irq);
362 sa1111_writel(ie1, mapbase + SA1111_INTEN1); 362 sa1111_writel(ie1, mapbase + SA1111_INTEN1);
363} 363}
364 364
@@ -369,11 +369,11 @@ static void sa1111_unmask_highirq(unsigned int irq)
369 * be triggered. In fact, its very difficult, if not impossible to get 369 * be triggered. In fact, its very difficult, if not impossible to get
370 * INTSET to re-trigger the interrupt. 370 * INTSET to re-trigger the interrupt.
371 */ 371 */
372static int sa1111_retrigger_highirq(unsigned int irq) 372static int sa1111_retrigger_highirq(struct irq_data *d)
373{ 373{
374 struct sa1111 *sachip = get_irq_chip_data(irq); 374 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
375 void __iomem *mapbase = sachip->base + SA1111_INTC; 375 void __iomem *mapbase = sachip->base + SA1111_INTC;
376 unsigned int mask = SA1111_IRQMASK_HI(irq); 376 unsigned int mask = SA1111_IRQMASK_HI(d->irq);
377 unsigned long ip1; 377 unsigned long ip1;
378 int i; 378 int i;
379 379
@@ -387,15 +387,15 @@ static int sa1111_retrigger_highirq(unsigned int irq)
387 387
388 if (i == 8) 388 if (i == 8)
389 printk(KERN_ERR "Danger Will Robinson: failed to " 389 printk(KERN_ERR "Danger Will Robinson: failed to "
390 "re-trigger IRQ%d\n", irq); 390 "re-trigger IRQ%d\n", d->irq);
391 return i == 8 ? -1 : 0; 391 return i == 8 ? -1 : 0;
392} 392}
393 393
394static int sa1111_type_highirq(unsigned int irq, unsigned int flags) 394static int sa1111_type_highirq(struct irq_data *d, unsigned int flags)
395{ 395{
396 struct sa1111 *sachip = get_irq_chip_data(irq); 396 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
397 void __iomem *mapbase = sachip->base + SA1111_INTC; 397 void __iomem *mapbase = sachip->base + SA1111_INTC;
398 unsigned int mask = SA1111_IRQMASK_HI(irq); 398 unsigned int mask = SA1111_IRQMASK_HI(d->irq);
399 unsigned long ip1; 399 unsigned long ip1;
400 400
401 if (flags == IRQ_TYPE_PROBE) 401 if (flags == IRQ_TYPE_PROBE)
@@ -415,11 +415,11 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
415 return 0; 415 return 0;
416} 416}
417 417
418static int sa1111_wake_highirq(unsigned int irq, unsigned int on) 418static int sa1111_wake_highirq(struct irq_data *d, unsigned int on)
419{ 419{
420 struct sa1111 *sachip = get_irq_chip_data(irq); 420 struct sa1111 *sachip = irq_data_get_irq_chip_data(d);
421 void __iomem *mapbase = sachip->base + SA1111_INTC; 421 void __iomem *mapbase = sachip->base + SA1111_INTC;
422 unsigned int mask = SA1111_IRQMASK_HI(irq); 422 unsigned int mask = SA1111_IRQMASK_HI(d->irq);
423 unsigned long we1; 423 unsigned long we1;
424 424
425 we1 = sa1111_readl(mapbase + SA1111_WAKEEN1); 425 we1 = sa1111_readl(mapbase + SA1111_WAKEEN1);
@@ -434,12 +434,12 @@ static int sa1111_wake_highirq(unsigned int irq, unsigned int on)
434 434
435static struct irq_chip sa1111_high_chip = { 435static struct irq_chip sa1111_high_chip = {
436 .name = "SA1111-h", 436 .name = "SA1111-h",
437 .ack = sa1111_ack_irq, 437 .irq_ack = sa1111_ack_irq,
438 .mask = sa1111_mask_highirq, 438 .irq_mask = sa1111_mask_highirq,
439 .unmask = sa1111_unmask_highirq, 439 .irq_unmask = sa1111_unmask_highirq,
440 .retrigger = sa1111_retrigger_highirq, 440 .irq_retrigger = sa1111_retrigger_highirq,
441 .set_type = sa1111_type_highirq, 441 .irq_set_type = sa1111_type_highirq,
442 .set_wake = sa1111_wake_highirq, 442 .irq_set_wake = sa1111_wake_highirq,
443}; 443};
444 444
445static void sa1111_setup_irq(struct sa1111 *sachip) 445static void sa1111_setup_irq(struct sa1111 *sachip)
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index cb660bc54d7a..ae5fe7292e0d 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -204,26 +204,26 @@ static void __init vic_pm_register(void __iomem *base, unsigned int irq, u32 res
204static inline void vic_pm_register(void __iomem *base, unsigned int irq, u32 arg1) { } 204static inline void vic_pm_register(void __iomem *base, unsigned int irq, u32 arg1) { }
205#endif /* CONFIG_PM */ 205#endif /* CONFIG_PM */
206 206
207static void vic_ack_irq(unsigned int irq) 207static void vic_ack_irq(struct irq_data *d)
208{ 208{
209 void __iomem *base = get_irq_chip_data(irq); 209 void __iomem *base = irq_data_get_irq_chip_data(d);
210 irq &= 31; 210 unsigned int irq = d->irq & 31;
211 writel(1 << irq, base + VIC_INT_ENABLE_CLEAR); 211 writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
212 /* moreover, clear the soft-triggered, in case it was the reason */ 212 /* moreover, clear the soft-triggered, in case it was the reason */
213 writel(1 << irq, base + VIC_INT_SOFT_CLEAR); 213 writel(1 << irq, base + VIC_INT_SOFT_CLEAR);
214} 214}
215 215
216static void vic_mask_irq(unsigned int irq) 216static void vic_mask_irq(struct irq_data *d)
217{ 217{
218 void __iomem *base = get_irq_chip_data(irq); 218 void __iomem *base = irq_data_get_irq_chip_data(d);
219 irq &= 31; 219 unsigned int irq = d->irq & 31;
220 writel(1 << irq, base + VIC_INT_ENABLE_CLEAR); 220 writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
221} 221}
222 222
223static void vic_unmask_irq(unsigned int irq) 223static void vic_unmask_irq(struct irq_data *d)
224{ 224{
225 void __iomem *base = get_irq_chip_data(irq); 225 void __iomem *base = irq_data_get_irq_chip_data(d);
226 irq &= 31; 226 unsigned int irq = d->irq & 31;
227 writel(1 << irq, base + VIC_INT_ENABLE); 227 writel(1 << irq, base + VIC_INT_ENABLE);
228} 228}
229 229
@@ -242,10 +242,10 @@ static struct vic_device *vic_from_irq(unsigned int irq)
242 return NULL; 242 return NULL;
243} 243}
244 244
245static int vic_set_wake(unsigned int irq, unsigned int on) 245static int vic_set_wake(struct irq_data *d, unsigned int on)
246{ 246{
247 struct vic_device *v = vic_from_irq(irq); 247 struct vic_device *v = vic_from_irq(d->irq);
248 unsigned int off = irq & 31; 248 unsigned int off = d->irq & 31;
249 u32 bit = 1 << off; 249 u32 bit = 1 << off;
250 250
251 if (!v) 251 if (!v)
@@ -267,10 +267,10 @@ static int vic_set_wake(unsigned int irq, unsigned int on)
267 267
268static struct irq_chip vic_chip = { 268static struct irq_chip vic_chip = {
269 .name = "VIC", 269 .name = "VIC",
270 .ack = vic_ack_irq, 270 .irq_ack = vic_ack_irq,
271 .mask = vic_mask_irq, 271 .irq_mask = vic_mask_irq,
272 .unmask = vic_unmask_irq, 272 .irq_unmask = vic_unmask_irq,
273 .set_wake = vic_set_wake, 273 .irq_set_wake = vic_set_wake,
274}; 274};
275 275
276static void __init vic_disable(void __iomem *base) 276static void __init vic_disable(void __iomem *base)
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index eed2f795e1b3..2ad62df37730 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -443,40 +443,40 @@ static expansioncard_ops_t ecard_default_ops = {
443 * 443 *
444 * They are not meant to be called directly, but via enable/disable_irq. 444 * They are not meant to be called directly, but via enable/disable_irq.
445 */ 445 */
446static void ecard_irq_unmask(unsigned int irqnr) 446static void ecard_irq_unmask(struct irq_data *d)
447{ 447{
448 ecard_t *ec = slot_to_ecard(irqnr - 32); 448 ecard_t *ec = slot_to_ecard(d->irq - 32);
449 449
450 if (ec) { 450 if (ec) {
451 if (!ec->ops) 451 if (!ec->ops)
452 ec->ops = &ecard_default_ops; 452 ec->ops = &ecard_default_ops;
453 453
454 if (ec->claimed && ec->ops->irqenable) 454 if (ec->claimed && ec->ops->irqenable)
455 ec->ops->irqenable(ec, irqnr); 455 ec->ops->irqenable(ec, d->irq);
456 else 456 else
457 printk(KERN_ERR "ecard: rejecting request to " 457 printk(KERN_ERR "ecard: rejecting request to "
458 "enable IRQs for %d\n", irqnr); 458 "enable IRQs for %d\n", d->irq);
459 } 459 }
460} 460}
461 461
462static void ecard_irq_mask(unsigned int irqnr) 462static void ecard_irq_mask(struct irq_data *d)
463{ 463{
464 ecard_t *ec = slot_to_ecard(irqnr - 32); 464 ecard_t *ec = slot_to_ecard(d->irq - 32);
465 465
466 if (ec) { 466 if (ec) {
467 if (!ec->ops) 467 if (!ec->ops)
468 ec->ops = &ecard_default_ops; 468 ec->ops = &ecard_default_ops;
469 469
470 if (ec->ops && ec->ops->irqdisable) 470 if (ec->ops && ec->ops->irqdisable)
471 ec->ops->irqdisable(ec, irqnr); 471 ec->ops->irqdisable(ec, d->irq);
472 } 472 }
473} 473}
474 474
475static struct irq_chip ecard_chip = { 475static struct irq_chip ecard_chip = {
476 .name = "ECARD", 476 .name = "ECARD",
477 .ack = ecard_irq_mask, 477 .irq_ack = ecard_irq_mask,
478 .mask = ecard_irq_mask, 478 .irq_mask = ecard_irq_mask,
479 .unmask = ecard_irq_unmask, 479 .irq_unmask = ecard_irq_unmask,
480}; 480};
481 481
482void ecard_enablefiq(unsigned int fiqnr) 482void ecard_enablefiq(unsigned int fiqnr)
@@ -551,7 +551,7 @@ static void ecard_check_lockup(struct irq_desc *desc)
551 printk(KERN_ERR "\nInterrupt lockup detected - " 551 printk(KERN_ERR "\nInterrupt lockup detected - "
552 "disabling all expansion card interrupts\n"); 552 "disabling all expansion card interrupts\n");
553 553
554 desc->chip->mask(IRQ_EXPANSIONCARD); 554 desc->irq_data.chip->irq_mask(&desc->irq_data);
555 ecard_dump_irq_state(); 555 ecard_dump_irq_state();
556 } 556 }
557 } else 557 } else
@@ -574,7 +574,7 @@ ecard_irq_handler(unsigned int irq, struct irq_desc *desc)
574 ecard_t *ec; 574 ecard_t *ec;
575 int called = 0; 575 int called = 0;
576 576
577 desc->chip->mask(irq); 577 desc->irq_data.chip->irq_mask(&desc->irq_data);
578 for (ec = cards; ec; ec = ec->next) { 578 for (ec = cards; ec; ec = ec->next) {
579 int pending; 579 int pending;
580 580
@@ -591,7 +591,7 @@ ecard_irq_handler(unsigned int irq, struct irq_desc *desc)
591 called ++; 591 called ++;
592 } 592 }
593 } 593 }
594 desc->chip->unmask(irq); 594 desc->irq_data.chip->irq_unmask(&desc->irq_data);
595 595
596 if (called == 0) 596 if (called == 0)
597 ecard_check_lockup(desc); 597 ecard_check_lockup(desc);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 8135438b8818..28536e352deb 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -88,7 +88,7 @@ int show_interrupts(struct seq_file *p, void *v)
88 seq_printf(p, "%*d: ", prec, i); 88 seq_printf(p, "%*d: ", prec, i);
89 for_each_present_cpu(cpu) 89 for_each_present_cpu(cpu)
90 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu)); 90 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu));
91 seq_printf(p, " %10s", desc->chip->name ? : "-"); 91 seq_printf(p, " %10s", desc->irq_data.chip->name ? : "-");
92 seq_printf(p, " %s", action->name); 92 seq_printf(p, " %s", action->name);
93 for (action = action->next; action; action = action->next) 93 for (action = action->next; action; action = action->next)
94 seq_printf(p, ", %s", action->name); 94 seq_printf(p, ", %s", action->name);
@@ -181,10 +181,11 @@ int __init arch_probe_nr_irqs(void)
181 181
182static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu) 182static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
183{ 183{
184 pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", irq, desc->node, cpu); 184 pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", irq, desc->irq_data.node, cpu);
185 185
186 raw_spin_lock_irq(&desc->lock); 186 raw_spin_lock_irq(&desc->lock);
187 desc->chip->set_affinity(irq, cpumask_of(cpu)); 187 desc->irq_data.chip->irq_set_affinity(&desc->irq_data,
188 cpumask_of(cpu), false);
188 raw_spin_unlock_irq(&desc->lock); 189 raw_spin_unlock_irq(&desc->lock);
189} 190}
190 191
@@ -199,16 +200,18 @@ void migrate_irqs(void)
199 struct irq_desc *desc; 200 struct irq_desc *desc;
200 201
201 for_each_irq_desc(i, desc) { 202 for_each_irq_desc(i, desc) {
202 if (desc->node == cpu) { 203 struct irq_data *d = &desc->irq_data;
203 unsigned int newcpu = cpumask_any_and(desc->affinity, 204
205 if (d->node == cpu) {
206 unsigned int newcpu = cpumask_any_and(d->affinity,
204 cpu_online_mask); 207 cpu_online_mask);
205 if (newcpu >= nr_cpu_ids) { 208 if (newcpu >= nr_cpu_ids) {
206 if (printk_ratelimit()) 209 if (printk_ratelimit())
207 printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n", 210 printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n",
208 i, cpu); 211 i, cpu);
209 212
210 cpumask_setall(desc->affinity); 213 cpumask_setall(d->affinity);
211 newcpu = cpumask_any_and(desc->affinity, 214 newcpu = cpumask_any_and(d->affinity,
212 cpu_online_mask); 215 cpu_online_mask);
213 } 216 }
214 217
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index 3ef68330452a..f8465bd17e67 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -68,25 +68,25 @@ void __init aaec2000_map_io(void)
68/* 68/*
69 * Interrupt handling routines 69 * Interrupt handling routines
70 */ 70 */
71static void aaec2000_int_ack(unsigned int irq) 71static void aaec2000_int_ack(struct irq_data *d)
72{ 72{
73 IRQ_INTSR = 1 << irq; 73 IRQ_INTSR = 1 << d->irq;
74} 74}
75 75
76static void aaec2000_int_mask(unsigned int irq) 76static void aaec2000_int_mask(struct irq_data *d)
77{ 77{
78 IRQ_INTENC |= (1 << irq); 78 IRQ_INTENC |= (1 << d->irq);
79} 79}
80 80
81static void aaec2000_int_unmask(unsigned int irq) 81static void aaec2000_int_unmask(struct irq_data *d)
82{ 82{
83 IRQ_INTENS |= (1 << irq); 83 IRQ_INTENS |= (1 << d->irq);
84} 84}
85 85
86static struct irq_chip aaec2000_irq_chip = { 86static struct irq_chip aaec2000_irq_chip = {
87 .ack = aaec2000_int_ack, 87 .irq_ack = aaec2000_int_ack,
88 .mask = aaec2000_int_mask, 88 .irq_mask = aaec2000_int_mask,
89 .unmask = aaec2000_int_unmask, 89 .irq_unmask = aaec2000_int_unmask,
90}; 90};
91 91
92void __init aaec2000_init_irq(void) 92void __init aaec2000_init_irq(void)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index c015b684b4fe..19390231a0e9 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -362,6 +362,12 @@ config MACH_CPU9G20
362 Select this if you are using a Eukrea Electromatique's 362 Select this if you are using a Eukrea Electromatique's
363 CPU9G20 Board <http://www.eukrea.com/> 363 CPU9G20 Board <http://www.eukrea.com/>
364 364
365config MACH_ACMENETUSFOXG20
366 bool "Acme Systems srl FOX Board G20"
367 help
368 Select this if you are using Acme Systems
369 FOX Board G20 <http://www.acmesystems.it>
370
365config MACH_PORTUXG20 371config MACH_PORTUXG20
366 bool "taskit PortuxG20" 372 bool "taskit PortuxG20"
367 help 373 help
@@ -381,6 +387,13 @@ config MACH_PCONTROL_G20
381 Select this if you are using taskit's Stamp9G20 CPU module on this 387 Select this if you are using taskit's Stamp9G20 CPU module on this
382 carrier board, beeing the decentralized unit of a building automation 388 carrier board, beeing the decentralized unit of a building automation
383 system; featuring nvram, eth-switch, iso-rs485, display, io 389 system; featuring nvram, eth-switch, iso-rs485, display, io
390
391config MACH_GSIA18S
392 bool "GS_IA18_S board"
393 help
394 This enables support for the GS_IA18_S board
395 produced by GeoSIG Ltd company. This is an internet accelerograph.
396 <http://www.geosig.com>
384endif 397endif
385 398
386if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20) 399if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index d13add71f72a..a83835e0c185 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -63,9 +63,11 @@ obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
63# AT91SAM9G20 board-specific support 63# AT91SAM9G20 board-specific support
64obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o 64obj-$(CONFIG_MACH_AT91SAM9G20EK) += board-sam9g20ek.o
65obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o 65obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
66obj-$(CONFIG_MACH_ACMENETUSFOXG20) += board-foxg20.o
66obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o 67obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 68obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
68obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o 69obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
70obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o
69 71
70# AT91SAM9260/AT91SAM9G20 board-specific support 72# AT91SAM9260/AT91SAM9G20 board-specific support
71obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o 73obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
new file mode 100644
index 000000000000..dfc7dfe738e4
--- /dev/null
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -0,0 +1,274 @@
1/*
2 * Copyright (C) 2005 SAN People
3 * Copyright (C) 2008 Atmel
4 * Copyright (C) 2010 Lee McLoughlin - lee@lmmrtech.com
5 * Copyright (C) 2010 Sergio Tanzilli - tanzilli@acmesystems.it
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27#include <linux/spi/spi.h>
28#include <linux/spi/at73c213.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/clk.h>
33#include <linux/w1-gpio.h>
34
35#include <mach/hardware.h>
36#include <asm/setup.h>
37#include <asm/mach-types.h>
38#include <asm/irq.h>
39
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43
44#include <mach/board.h>
45#include <mach/at91sam9_smc.h>
46
47#include "sam9_smc.h"
48#include "generic.h"
49
50/*
51 * The FOX Board G20 hardware comes as the "Netus G20" board with
52 * just the cpu, ram, dataflash and two header connectors.
53 * This is plugged into the FOX Board which provides the ethernet,
54 * usb, rtc, leds, switch, ...
55 *
56 * For more info visit: http://www.acmesystems.it/foxg20
57 */
58
59
60static void __init foxg20_map_io(void)
61{
62 /* Initialize processor: 18.432 MHz crystal */
63 at91sam9260_initialize(18432000);
64
65 /* DBGU on ttyS0. (Rx & Tx only) */
66 at91_register_uart(0, 0, 0);
67
68 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
69 at91_register_uart(AT91SAM9260_ID_US0, 1,
70 ATMEL_UART_CTS
71 | ATMEL_UART_RTS
72 | ATMEL_UART_DTR
73 | ATMEL_UART_DSR
74 | ATMEL_UART_DCD
75 | ATMEL_UART_RI);
76
77 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
78 at91_register_uart(AT91SAM9260_ID_US1, 2,
79 ATMEL_UART_CTS
80 | ATMEL_UART_RTS);
81
82 /* USART2 on ttyS3. (Rx & Tx only) */
83 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
84
85 /* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */
86 at91_register_uart(AT91SAM9260_ID_US3, 4,
87 ATMEL_UART_CTS
88 | ATMEL_UART_RTS);
89
90 /* USART4 on ttyS5. (Rx & Tx only) */
91 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
92
93 /* USART5 on ttyS6. (Rx & Tx only) */
94 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
95
96 /* set serial console to ttyS0 (ie, DBGU) */
97 at91_set_serial_console(0);
98
99 /* Set the internal pull-up resistor on DRXD */
100 at91_set_A_periph(AT91_PIN_PB14, 1);
101
102}
103
104static void __init foxg20_init_irq(void)
105{
106 at91sam9260_init_interrupts(NULL);
107}
108
109
110/*
111 * USB Host port
112 */
113static struct at91_usbh_data __initdata foxg20_usbh_data = {
114 .ports = 2,
115};
116
117/*
118 * USB Device port
119 */
120static struct at91_udc_data __initdata foxg20_udc_data = {
121 .vbus_pin = AT91_PIN_PC6,
122 .pullup_pin = 0, /* pull-up driven by UDC */
123};
124
125
126/*
127 * SPI devices.
128 */
129static struct spi_board_info foxg20_spi_devices[] = {
130#if !defined(CONFIG_MMC_AT91)
131 {
132 .modalias = "mtd_dataflash",
133 .chip_select = 1,
134 .max_speed_hz = 15 * 1000 * 1000,
135 .bus_num = 0,
136 },
137#endif
138};
139
140
141/*
142 * MACB Ethernet device
143 */
144static struct at91_eth_data __initdata foxg20_macb_data = {
145 .phy_irq_pin = AT91_PIN_PA7,
146 .is_rmii = 1,
147};
148
149/*
150 * MCI (SD/MMC)
151 * det_pin, wp_pin and vcc_pin are not connected
152 */
153static struct at91_mmc_data __initdata foxg20_mmc_data = {
154 .slot_b = 1,
155 .wire4 = 1,
156};
157
158
159/*
160 * LEDs
161 */
162static struct gpio_led foxg20_leds[] = {
163 { /* user led, red */
164 .name = "user_led",
165 .gpio = AT91_PIN_PC7,
166 .active_low = 0,
167 .default_trigger = "heartbeat",
168 },
169};
170
171
172/*
173 * GPIO Buttons
174 */
175#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
176static struct gpio_keys_button foxg20_buttons[] = {
177 {
178 .gpio = AT91_PIN_PC4,
179 .code = BTN_1,
180 .desc = "Button 1",
181 .active_low = 1,
182 .wakeup = 1,
183 },
184};
185
186static struct gpio_keys_platform_data foxg20_button_data = {
187 .buttons = foxg20_buttons,
188 .nbuttons = ARRAY_SIZE(foxg20_buttons),
189};
190
191static struct platform_device foxg20_button_device = {
192 .name = "gpio-keys",
193 .id = -1,
194 .num_resources = 0,
195 .dev = {
196 .platform_data = &foxg20_button_data,
197 }
198};
199
200static void __init foxg20_add_device_buttons(void)
201{
202 at91_set_gpio_input(AT91_PIN_PC4, 1); /* btn1 */
203 at91_set_deglitch(AT91_PIN_PC4, 1);
204
205 platform_device_register(&foxg20_button_device);
206}
207#else
208static void __init foxg20_add_device_buttons(void) {}
209#endif
210
211
212#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
213static struct w1_gpio_platform_data w1_gpio_pdata = {
214 /* If you choose to use a pin other than PB16 it needs to be 3.3V */
215 .pin = AT91_PIN_PB16,
216 .is_open_drain = 1,
217};
218
219static struct platform_device w1_device = {
220 .name = "w1-gpio",
221 .id = -1,
222 .dev.platform_data = &w1_gpio_pdata,
223};
224
225static void __init at91_add_device_w1(void)
226{
227 at91_set_GPIO_periph(w1_gpio_pdata.pin, 1);
228 at91_set_multi_drive(w1_gpio_pdata.pin, 1);
229 platform_device_register(&w1_device);
230}
231
232#endif
233
234
235static struct i2c_board_info __initdata foxg20_i2c_devices[] = {
236 {
237 I2C_BOARD_INFO("24c512", 0x50),
238 },
239};
240
241
242static void __init foxg20_board_init(void)
243{
244 /* Serial */
245 at91_add_device_serial();
246 /* USB Host */
247 at91_add_device_usbh(&foxg20_usbh_data);
248 /* USB Device */
249 at91_add_device_udc(&foxg20_udc_data);
250 /* SPI */
251 at91_add_device_spi(foxg20_spi_devices, ARRAY_SIZE(foxg20_spi_devices));
252 /* Ethernet */
253 at91_add_device_eth(&foxg20_macb_data);
254 /* MMC */
255 at91_add_device_mmc(0, &foxg20_mmc_data);
256 /* I2C */
257 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));
258 /* LEDs */
259 at91_gpio_leds(foxg20_leds, ARRAY_SIZE(foxg20_leds));
260 /* Push Buttons */
261 foxg20_add_device_buttons();
262#if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE)
263 at91_add_device_w1();
264#endif
265}
266
267MACHINE_START(ACMENETUSFOXG20, "Acme Systems srl FOX Board G20")
268 /* Maintainer: Sergio Tanzilli */
269 .boot_params = AT91_SDRAM_BASE + 0x100,
270 .timer = &at91sam926x_timer,
271 .map_io = foxg20_map_io,
272 .init_irq = foxg20_init_irq,
273 .init_machine = foxg20_board_init,
274MACHINE_END
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
new file mode 100644
index 000000000000..bc28136ee249
--- /dev/null
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -0,0 +1,584 @@
1/*
2 * Copyright (C) 2010 Christian Glindkamp <christian.glindkamp@taskit.de>
3 * taskit GmbH
4 * 2010 Igor Plyatov <plyatov@gmail.com>
5 * GeoSIG Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/platform_device.h>
23#include <linux/gpio.h>
24#include <linux/w1-gpio.h>
25#include <linux/i2c.h>
26#include <linux/i2c/pcf857x.h>
27#include <linux/gpio_keys.h>
28#include <linux/input.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32
33#include <mach/board.h>
34#include <mach/at91sam9_smc.h>
35#include <mach/gsia18s.h>
36#include <mach/stamp9g20.h>
37
38#include "sam9_smc.h"
39#include "generic.h"
40
41static void __init gsia18s_map_io(void)
42{
43 stamp9g20_map_io();
44
45 /*
46 * USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI).
47 * Used for Internal Analog Modem.
48 */
49 at91_register_uart(AT91SAM9260_ID_US0, 1,
50 ATMEL_UART_CTS | ATMEL_UART_RTS |
51 ATMEL_UART_DTR | ATMEL_UART_DSR |
52 ATMEL_UART_DCD | ATMEL_UART_RI);
53 /*
54 * USART1 on ttyS2 (Rx, Tx, CTS, RTS).
55 * Used for GPS or WiFi or Data stream.
56 */
57 at91_register_uart(AT91SAM9260_ID_US1, 2,
58 ATMEL_UART_CTS | ATMEL_UART_RTS);
59 /*
60 * USART2 on ttyS3 (Rx, Tx, CTS, RTS).
61 * Used for External Modem.
62 */
63 at91_register_uart(AT91SAM9260_ID_US2, 3,
64 ATMEL_UART_CTS | ATMEL_UART_RTS);
65 /*
66 * USART3 on ttyS4 (Rx, Tx, RTS).
67 * Used for RS-485.
68 */
69 at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);
70
71 /*
72 * USART4 on ttyS5 (Rx, Tx).
73 * Used for TRX433 Radio Module.
74 */
75 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
76}
77
78static void __init init_irq(void)
79{
80 at91sam9260_init_interrupts(NULL);
81}
82
83/*
84 * Two USB Host ports
85 */
86static struct at91_usbh_data __initdata usbh_data = {
87 .ports = 2,
88};
89
90/*
91 * USB Device port
92 */
93static struct at91_udc_data __initdata udc_data = {
94 .vbus_pin = AT91_PIN_PA22,
95 .pullup_pin = 0, /* pull-up driven by UDC */
96};
97
98/*
99 * MACB Ethernet device
100 */
101static struct at91_eth_data __initdata macb_data = {
102 .phy_irq_pin = AT91_PIN_PA28,
103 .is_rmii = 1,
104};
105
106/*
107 * LEDs and GPOs
108 */
109static struct gpio_led gpio_leds[] = {
110 {
111 .name = "gpo:spi1reset",
112 .gpio = AT91_PIN_PC1,
113 .active_low = 0,
114 .default_trigger = "none",
115 .default_state = LEDS_GPIO_DEFSTATE_OFF,
116 },
117 {
118 .name = "gpo:trig_net_out",
119 .gpio = AT91_PIN_PB20,
120 .active_low = 0,
121 .default_trigger = "none",
122 .default_state = LEDS_GPIO_DEFSTATE_OFF,
123 },
124 {
125 .name = "gpo:trig_net_dir",
126 .gpio = AT91_PIN_PB19,
127 .active_low = 0,
128 .default_trigger = "none",
129 .default_state = LEDS_GPIO_DEFSTATE_OFF,
130 },
131 {
132 .name = "gpo:charge_dis",
133 .gpio = AT91_PIN_PC2,
134 .active_low = 0,
135 .default_trigger = "none",
136 .default_state = LEDS_GPIO_DEFSTATE_OFF,
137 },
138 {
139 .name = "led:event",
140 .gpio = AT91_PIN_PB17,
141 .active_low = 1,
142 .default_trigger = "none",
143 .default_state = LEDS_GPIO_DEFSTATE_OFF,
144 },
145 {
146 .name = "led:lan",
147 .gpio = AT91_PIN_PB18,
148 .active_low = 1,
149 .default_trigger = "none",
150 .default_state = LEDS_GPIO_DEFSTATE_OFF,
151 },
152 {
153 .name = "led:error",
154 .gpio = AT91_PIN_PB16,
155 .active_low = 1,
156 .default_trigger = "none",
157 .default_state = LEDS_GPIO_DEFSTATE_ON,
158 }
159};
160
161static struct gpio_led_platform_data gpio_led_info = {
162 .leds = gpio_leds,
163 .num_leds = ARRAY_SIZE(gpio_leds),
164};
165
166static struct platform_device leds = {
167 .name = "leds-gpio",
168 .id = 0,
169 .dev = {
170 .platform_data = &gpio_led_info,
171 }
172};
173
174static void __init gsia18s_leds_init(void)
175{
176 platform_device_register(&leds);
177}
178
179/* PCF8574 0x20 GPIO - U1 on the GS_IA18-CB_V3 board */
180static struct gpio_led pcf_gpio_leds1[] = {
181 { /* bit 0 */
182 .name = "gpo:hdc_power",
183 .gpio = PCF_GPIO_HDC_POWER,
184 .active_low = 0,
185 .default_trigger = "none",
186 .default_state = LEDS_GPIO_DEFSTATE_OFF,
187 },
188 { /* bit 1 */
189 .name = "gpo:wifi_setup",
190 .gpio = PCF_GPIO_WIFI_SETUP,
191 .active_low = 1,
192 .default_trigger = "none",
193 .default_state = LEDS_GPIO_DEFSTATE_OFF,
194 },
195 { /* bit 2 */
196 .name = "gpo:wifi_enable",
197 .gpio = PCF_GPIO_WIFI_ENABLE,
198 .active_low = 1,
199 .default_trigger = "none",
200 .default_state = LEDS_GPIO_DEFSTATE_OFF,
201 },
202 { /* bit 3 */
203 .name = "gpo:wifi_reset",
204 .gpio = PCF_GPIO_WIFI_RESET,
205 .active_low = 1,
206 .default_trigger = "none",
207 .default_state = LEDS_GPIO_DEFSTATE_ON,
208 },
209 /* bit 4 used as GPI */
210 { /* bit 5 */
211 .name = "gpo:gps_setup",
212 .gpio = PCF_GPIO_GPS_SETUP,
213 .active_low = 1,
214 .default_trigger = "none",
215 .default_state = LEDS_GPIO_DEFSTATE_OFF,
216 },
217 { /* bit 6 */
218 .name = "gpo:gps_standby",
219 .gpio = PCF_GPIO_GPS_STANDBY,
220 .active_low = 0,
221 .default_trigger = "none",
222 .default_state = LEDS_GPIO_DEFSTATE_ON,
223 },
224 { /* bit 7 */
225 .name = "gpo:gps_power",
226 .gpio = PCF_GPIO_GPS_POWER,
227 .active_low = 0,
228 .default_trigger = "none",
229 .default_state = LEDS_GPIO_DEFSTATE_OFF,
230 }
231};
232
233static struct gpio_led_platform_data pcf_gpio_led_info1 = {
234 .leds = pcf_gpio_leds1,
235 .num_leds = ARRAY_SIZE(pcf_gpio_leds1),
236};
237
238static struct platform_device pcf_leds1 = {
239 .name = "leds-gpio", /* GS_IA18-CB_board */
240 .id = 1,
241 .dev = {
242 .platform_data = &pcf_gpio_led_info1,
243 }
244};
245
246/* PCF8574 0x22 GPIO - U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
247static struct gpio_led pcf_gpio_leds2[] = {
248 { /* bit 0 */
249 .name = "gpo:alarm_1",
250 .gpio = PCF_GPIO_ALARM1,
251 .active_low = 1,
252 .default_trigger = "none",
253 .default_state = LEDS_GPIO_DEFSTATE_OFF,
254 },
255 { /* bit 1 */
256 .name = "gpo:alarm_2",
257 .gpio = PCF_GPIO_ALARM2,
258 .active_low = 1,
259 .default_trigger = "none",
260 .default_state = LEDS_GPIO_DEFSTATE_OFF,
261 },
262 { /* bit 2 */
263 .name = "gpo:alarm_3",
264 .gpio = PCF_GPIO_ALARM3,
265 .active_low = 1,
266 .default_trigger = "none",
267 .default_state = LEDS_GPIO_DEFSTATE_OFF,
268 },
269 { /* bit 3 */
270 .name = "gpo:alarm_4",
271 .gpio = PCF_GPIO_ALARM4,
272 .active_low = 1,
273 .default_trigger = "none",
274 .default_state = LEDS_GPIO_DEFSTATE_OFF,
275 },
276 /* bits 4, 5, 6 not used */
277 { /* bit 7 */
278 .name = "gpo:alarm_v_relay_on",
279 .gpio = PCF_GPIO_ALARM_V_RELAY_ON,
280 .active_low = 0,
281 .default_trigger = "none",
282 .default_state = LEDS_GPIO_DEFSTATE_OFF,
283 },
284};
285
286static struct gpio_led_platform_data pcf_gpio_led_info2 = {
287 .leds = pcf_gpio_leds2,
288 .num_leds = ARRAY_SIZE(pcf_gpio_leds2),
289};
290
291static struct platform_device pcf_leds2 = {
292 .name = "leds-gpio",
293 .id = 2,
294 .dev = {
295 .platform_data = &pcf_gpio_led_info2,
296 }
297};
298
299/* PCF8574 0x24 GPIO U1 on the GS_2G-OPT23-A_V0 board (Modem) */
300static struct gpio_led pcf_gpio_leds3[] = {
301 { /* bit 0 */
302 .name = "gpo:modem_power",
303 .gpio = PCF_GPIO_MODEM_POWER,
304 .active_low = 1,
305 .default_trigger = "none",
306 .default_state = LEDS_GPIO_DEFSTATE_OFF,
307 },
308 /* bits 1 and 2 not used */
309 { /* bit 3 */
310 .name = "gpo:modem_reset",
311 .gpio = PCF_GPIO_MODEM_RESET,
312 .active_low = 1,
313 .default_trigger = "none",
314 .default_state = LEDS_GPIO_DEFSTATE_ON,
315 },
316 /* bits 4, 5 and 6 not used */
317 { /* bit 7 */
318 .name = "gpo:trx_reset",
319 .gpio = PCF_GPIO_TRX_RESET,
320 .active_low = 1,
321 .default_trigger = "none",
322 .default_state = LEDS_GPIO_DEFSTATE_ON,
323 }
324};
325
326static struct gpio_led_platform_data pcf_gpio_led_info3 = {
327 .leds = pcf_gpio_leds3,
328 .num_leds = ARRAY_SIZE(pcf_gpio_leds3),
329};
330
331static struct platform_device pcf_leds3 = {
332 .name = "leds-gpio",
333 .id = 3,
334 .dev = {
335 .platform_data = &pcf_gpio_led_info3,
336 }
337};
338
339static void __init gsia18s_pcf_leds_init(void)
340{
341 platform_device_register(&pcf_leds1);
342 platform_device_register(&pcf_leds2);
343 platform_device_register(&pcf_leds3);
344}
345
346/*
347 * SPI busses.
348 */
349static struct spi_board_info gsia18s_spi_devices[] = {
350 { /* User accessible spi0, cs0 used for communication with MSP RTC */
351 .modalias = "spidev",
352 .bus_num = 0,
353 .chip_select = 0,
354 .max_speed_hz = 580000,
355 .mode = SPI_MODE_1,
356 },
357 { /* User accessible spi1, cs0 used for communication with int. DSP */
358 .modalias = "spidev",
359 .bus_num = 1,
360 .chip_select = 0,
361 .max_speed_hz = 5600000,
362 .mode = SPI_MODE_0,
363 },
364 { /* User accessible spi1, cs1 used for communication with ext. DSP */
365 .modalias = "spidev",
366 .bus_num = 1,
367 .chip_select = 1,
368 .max_speed_hz = 5600000,
369 .mode = SPI_MODE_0,
370 },
371 { /* User accessible spi1, cs2 used for communication with ext. DSP */
372 .modalias = "spidev",
373 .bus_num = 1,
374 .chip_select = 2,
375 .max_speed_hz = 5600000,
376 .mode = SPI_MODE_0,
377 },
378 { /* User accessible spi1, cs3 used for communication with ext. DSP */
379 .modalias = "spidev",
380 .bus_num = 1,
381 .chip_select = 3,
382 .max_speed_hz = 5600000,
383 .mode = SPI_MODE_0,
384 }
385};
386
387/*
388 * GPI Buttons
389 */
390static struct gpio_keys_button buttons[] = {
391 {
392 .gpio = GPIO_TRIG_NET_IN,
393 .code = BTN_1,
394 .desc = "TRIG_NET_IN",
395 .type = EV_KEY,
396 .active_low = 0,
397 .wakeup = 1,
398 },
399 { /* SW80 on the GS_IA18_S-MN board*/
400 .gpio = GPIO_CARD_UNMOUNT_0,
401 .code = BTN_2,
402 .desc = "Card umount 0",
403 .type = EV_KEY,
404 .active_low = 1,
405 .wakeup = 1,
406 },
407 { /* SW79 on the GS_IA18_S-MN board*/
408 .gpio = GPIO_CARD_UNMOUNT_1,
409 .code = BTN_3,
410 .desc = "Card umount 1",
411 .type = EV_KEY,
412 .active_low = 1,
413 .wakeup = 1,
414 },
415 { /* SW280 on the GS_IA18-CB board*/
416 .gpio = GPIO_KEY_POWER,
417 .code = KEY_POWER,
418 .desc = "Power Off Button",
419 .type = EV_KEY,
420 .active_low = 0,
421 .wakeup = 1,
422 }
423};
424
425static struct gpio_keys_platform_data button_data = {
426 .buttons = buttons,
427 .nbuttons = ARRAY_SIZE(buttons),
428};
429
430static struct platform_device button_device = {
431 .name = "gpio-keys",
432 .id = -1,
433 .num_resources = 0,
434 .dev = {
435 .platform_data = &button_data,
436 }
437};
438
439static void __init gsia18s_add_device_buttons(void)
440{
441 at91_set_gpio_input(GPIO_TRIG_NET_IN, 1);
442 at91_set_deglitch(GPIO_TRIG_NET_IN, 1);
443 at91_set_gpio_input(GPIO_CARD_UNMOUNT_0, 1);
444 at91_set_deglitch(GPIO_CARD_UNMOUNT_0, 1);
445 at91_set_gpio_input(GPIO_CARD_UNMOUNT_1, 1);
446 at91_set_deglitch(GPIO_CARD_UNMOUNT_1, 1);
447 at91_set_gpio_input(GPIO_KEY_POWER, 0);
448 at91_set_deglitch(GPIO_KEY_POWER, 1);
449
450 platform_device_register(&button_device);
451}
452
453/*
454 * I2C
455 */
456static int pcf8574x_0x20_setup(struct i2c_client *client, int gpio,
457 unsigned int ngpio, void *context)
458{
459 int status;
460
461 status = gpio_request(gpio + PCF_GPIO_ETH_DETECT, "eth_det");
462 if (status < 0) {
463 pr_err("error: can't request GPIO%d\n",
464 gpio + PCF_GPIO_ETH_DETECT);
465 return status;
466 }
467 status = gpio_direction_input(gpio + PCF_GPIO_ETH_DETECT);
468 if (status < 0) {
469 pr_err("error: can't setup GPIO%d as input\n",
470 gpio + PCF_GPIO_ETH_DETECT);
471 return status;
472 }
473 status = gpio_export(gpio + PCF_GPIO_ETH_DETECT, false);
474 if (status < 0) {
475 pr_err("error: can't export GPIO%d\n",
476 gpio + PCF_GPIO_ETH_DETECT);
477 return status;
478 }
479 status = gpio_sysfs_set_active_low(gpio + PCF_GPIO_ETH_DETECT, 1);
480 if (status < 0) {
481 pr_err("error: gpio_sysfs_set active_low(GPIO%d, 1)\n",
482 gpio + PCF_GPIO_ETH_DETECT);
483 return status;
484 }
485
486 return 0;
487}
488
489static int pcf8574x_0x20_teardown(struct i2c_client *client, int gpio,
490 unsigned ngpio, void *context)
491{
492 gpio_free(gpio + PCF_GPIO_ETH_DETECT);
493 return 0;
494}
495
496static struct pcf857x_platform_data pcf20_pdata = {
497 .gpio_base = GS_IA18_S_PCF_GPIO_BASE0,
498 .n_latch = (1 << 4),
499 .setup = pcf8574x_0x20_setup,
500 .teardown = pcf8574x_0x20_teardown,
501};
502
503static struct pcf857x_platform_data pcf22_pdata = {
504 .gpio_base = GS_IA18_S_PCF_GPIO_BASE1,
505};
506
507static struct pcf857x_platform_data pcf24_pdata = {
508 .gpio_base = GS_IA18_S_PCF_GPIO_BASE2,
509};
510
511static struct i2c_board_info __initdata gsia18s_i2c_devices[] = {
512 { /* U1 on the GS_IA18-CB_V3 board */
513 I2C_BOARD_INFO("pcf8574", 0x20),
514 .platform_data = &pcf20_pdata,
515 },
516 { /* U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
517 I2C_BOARD_INFO("pcf8574", 0x22),
518 .platform_data = &pcf22_pdata,
519 },
520 { /* U1 on the GS_2G-OPT23-A_V0 board (Modem) */
521 I2C_BOARD_INFO("pcf8574", 0x24),
522 .platform_data = &pcf24_pdata,
523 },
524 { /* U161 on the GS_IA18_S-MN board */
525 I2C_BOARD_INFO("24c1024", 0x50),
526 },
527 { /* U162 on the GS_IA18_S-MN board */
528 I2C_BOARD_INFO("24c01", 0x53),
529 },
530};
531
532/*
533 * Compact Flash
534 */
535static struct at91_cf_data __initdata gsia18s_cf1_data = {
536 .irq_pin = AT91_PIN_PA27,
537 .det_pin = AT91_PIN_PB30,
538 .rst_pin = AT91_PIN_PB31,
539 .chipselect = 5,
540 .flags = AT91_CF_TRUE_IDE,
541};
542
543/* Power Off by RTC */
544static void gsia18s_power_off(void)
545{
546 pr_notice("Power supply will be switched off automatically now or after 60 seconds without ArmDAS.\n");
547 at91_set_gpio_output(AT91_PIN_PA25, 1);
548 /* Spin to death... */
549 while (1)
550 ;
551}
552
553static int __init gsia18s_power_off_init(void)
554{
555 pm_power_off = gsia18s_power_off;
556 return 0;
557}
558
559/* ---------------------------------------------------------------------------*/
560
561static void __init gsia18s_board_init(void)
562{
563 stamp9g20_board_init();
564 at91_add_device_usbh(&usbh_data);
565 at91_add_device_udc(&udc_data);
566 at91_add_device_eth(&macb_data);
567 gsia18s_leds_init();
568 gsia18s_pcf_leds_init();
569 gsia18s_add_device_buttons();
570 at91_add_device_i2c(gsia18s_i2c_devices,
571 ARRAY_SIZE(gsia18s_i2c_devices));
572 at91_add_device_cf(&gsia18s_cf1_data);
573 at91_add_device_spi(gsia18s_spi_devices,
574 ARRAY_SIZE(gsia18s_spi_devices));
575 gsia18s_power_off_init();
576}
577
578MACHINE_START(GSIA18S, "GS_IA18_S")
579 .boot_params = AT91_SDRAM_BASE + 0x100,
580 .timer = &at91sam926x_timer,
581 .map_io = gsia18s_map_io,
582 .init_irq = init_irq,
583 .init_machine = gsia18s_board_init,
584MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 86ff4b52db32..6c999dbd2bcf 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -37,7 +37,6 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
39 39
40#include <mach/hardware.h>
41#include <mach/board.h> 40#include <mach/board.h>
42#include <mach/gpio.h> 41#include <mach/gpio.h>
43#include <mach/at91sam9_smc.h> 42#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index ae4772e744ac..af818a21587c 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -274,10 +274,10 @@ EXPORT_SYMBOL(at91_get_gpio_value);
274static u32 wakeups[MAX_GPIO_BANKS]; 274static u32 wakeups[MAX_GPIO_BANKS];
275static u32 backups[MAX_GPIO_BANKS]; 275static u32 backups[MAX_GPIO_BANKS];
276 276
277static int gpio_irq_set_wake(unsigned pin, unsigned state) 277static int gpio_irq_set_wake(struct irq_data *d, unsigned state)
278{ 278{
279 unsigned mask = pin_to_mask(pin); 279 unsigned mask = pin_to_mask(d->irq);
280 unsigned bank = (pin - PIN_BASE) / 32; 280 unsigned bank = (d->irq - PIN_BASE) / 32;
281 281
282 if (unlikely(bank >= MAX_GPIO_BANKS)) 282 if (unlikely(bank >= MAX_GPIO_BANKS))
283 return -EINVAL; 283 return -EINVAL;
@@ -344,25 +344,25 @@ void at91_gpio_resume(void)
344 * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering. 344 * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
345 */ 345 */
346 346
347static void gpio_irq_mask(unsigned pin) 347static void gpio_irq_mask(struct irq_data *d)
348{ 348{
349 void __iomem *pio = pin_to_controller(pin); 349 void __iomem *pio = pin_to_controller(d->irq);
350 unsigned mask = pin_to_mask(pin); 350 unsigned mask = pin_to_mask(d->irq);
351 351
352 if (pio) 352 if (pio)
353 __raw_writel(mask, pio + PIO_IDR); 353 __raw_writel(mask, pio + PIO_IDR);
354} 354}
355 355
356static void gpio_irq_unmask(unsigned pin) 356static void gpio_irq_unmask(struct irq_data *d)
357{ 357{
358 void __iomem *pio = pin_to_controller(pin); 358 void __iomem *pio = pin_to_controller(d->irq);
359 unsigned mask = pin_to_mask(pin); 359 unsigned mask = pin_to_mask(d->irq);
360 360
361 if (pio) 361 if (pio)
362 __raw_writel(mask, pio + PIO_IER); 362 __raw_writel(mask, pio + PIO_IER);
363} 363}
364 364
365static int gpio_irq_type(unsigned pin, unsigned type) 365static int gpio_irq_type(struct irq_data *d, unsigned type)
366{ 366{
367 switch (type) { 367 switch (type) {
368 case IRQ_TYPE_NONE: 368 case IRQ_TYPE_NONE:
@@ -375,10 +375,10 @@ static int gpio_irq_type(unsigned pin, unsigned type)
375 375
376static struct irq_chip gpio_irqchip = { 376static struct irq_chip gpio_irqchip = {
377 .name = "GPIO", 377 .name = "GPIO",
378 .mask = gpio_irq_mask, 378 .irq_mask = gpio_irq_mask,
379 .unmask = gpio_irq_unmask, 379 .irq_unmask = gpio_irq_unmask,
380 .set_type = gpio_irq_type, 380 .irq_set_type = gpio_irq_type,
381 .set_wake = gpio_irq_set_wake, 381 .irq_set_wake = gpio_irq_set_wake,
382}; 382};
383 383
384static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) 384static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
@@ -393,7 +393,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
393 pio = at91_gpio->regbase; 393 pio = at91_gpio->regbase;
394 394
395 /* temporarily mask (level sensitive) parent IRQ */ 395 /* temporarily mask (level sensitive) parent IRQ */
396 desc->chip->ack(irq); 396 desc->irq_data.chip->irq_ack(&desc->irq_data);
397 for (;;) { 397 for (;;) {
398 /* Reading ISR acks pending (edge triggered) GPIO interrupts. 398 /* Reading ISR acks pending (edge triggered) GPIO interrupts.
399 * When there none are pending, we're finished unless we need 399 * When there none are pending, we're finished unless we need
@@ -419,7 +419,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
419 * another IRQ must be generated before it actually gets 419 * another IRQ must be generated before it actually gets
420 * here to be disabled on the GPIO controller. 420 * here to be disabled on the GPIO controller.
421 */ 421 */
422 gpio_irq_mask(pin); 422 gpio_irq_mask(irq_get_irq_data(pin));
423 } 423 }
424 else 424 else
425 generic_handle_irq(pin); 425 generic_handle_irq(pin);
@@ -429,7 +429,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
429 isr >>= 1; 429 isr >>= 1;
430 } 430 }
431 } 431 }
432 desc->chip->unmask(irq); 432 desc->irq_data.chip->irq_unmask(&desc->irq_data);
433 /* now it may re-trigger */ 433 /* now it may re-trigger */
434} 434}
435 435
diff --git a/arch/arm/mach-at91/include/mach/gsia18s.h b/arch/arm/mach-at91/include/mach/gsia18s.h
new file mode 100644
index 000000000000..307c194926f9
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/gsia18s.h
@@ -0,0 +1,33 @@
1/* Buttons */
2#define GPIO_TRIG_NET_IN AT91_PIN_PB21
3#define GPIO_CARD_UNMOUNT_0 AT91_PIN_PB13
4#define GPIO_CARD_UNMOUNT_1 AT91_PIN_PB12
5#define GPIO_KEY_POWER AT91_PIN_PA25
6
7/* PCF8574 0x20 GPIO - U1 on the GS_IA18-CB_V3 board */
8#define GS_IA18_S_PCF_GPIO_BASE0 NR_BUILTIN_GPIO
9#define PCF_GPIO_HDC_POWER (GS_IA18_S_PCF_GPIO_BASE0 + 0)
10#define PCF_GPIO_WIFI_SETUP (GS_IA18_S_PCF_GPIO_BASE0 + 1)
11#define PCF_GPIO_WIFI_ENABLE (GS_IA18_S_PCF_GPIO_BASE0 + 2)
12#define PCF_GPIO_WIFI_RESET (GS_IA18_S_PCF_GPIO_BASE0 + 3)
13#define PCF_GPIO_ETH_DETECT 4 /* this is a GPI */
14#define PCF_GPIO_GPS_SETUP (GS_IA18_S_PCF_GPIO_BASE0 + 5)
15#define PCF_GPIO_GPS_STANDBY (GS_IA18_S_PCF_GPIO_BASE0 + 6)
16#define PCF_GPIO_GPS_POWER (GS_IA18_S_PCF_GPIO_BASE0 + 7)
17
18/* PCF8574 0x22 GPIO - U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
19#define GS_IA18_S_PCF_GPIO_BASE1 (GS_IA18_S_PCF_GPIO_BASE0 + 8)
20#define PCF_GPIO_ALARM1 (GS_IA18_S_PCF_GPIO_BASE1 + 0)
21#define PCF_GPIO_ALARM2 (GS_IA18_S_PCF_GPIO_BASE1 + 1)
22#define PCF_GPIO_ALARM3 (GS_IA18_S_PCF_GPIO_BASE1 + 2)
23#define PCF_GPIO_ALARM4 (GS_IA18_S_PCF_GPIO_BASE1 + 3)
24/* bits 4, 5, 6 not used */
25#define PCF_GPIO_ALARM_V_RELAY_ON (GS_IA18_S_PCF_GPIO_BASE1 + 7)
26
27/* PCF8574 0x24 GPIO U1 on the GS_2G-OPT23-A_V0 board (Modem) */
28#define GS_IA18_S_PCF_GPIO_BASE2 (GS_IA18_S_PCF_GPIO_BASE1 + 8)
29#define PCF_GPIO_MODEM_POWER (GS_IA18_S_PCF_GPIO_BASE2 + 0)
30#define PCF_GPIO_MODEM_RESET (GS_IA18_S_PCF_GPIO_BASE2 + 3)
31/* bits 1, 2, 4, 5 not used */
32#define PCF_GPIO_TRX_RESET (GS_IA18_S_PCF_GPIO_BASE2 + 6)
33/* bit 7 not used */
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index da3494a53423..b56d6b3a4087 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -34,23 +34,23 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36 36
37static void at91_aic_mask_irq(unsigned int irq) 37static void at91_aic_mask_irq(struct irq_data *d)
38{ 38{
39 /* Disable interrupt on AIC */ 39 /* Disable interrupt on AIC */
40 at91_sys_write(AT91_AIC_IDCR, 1 << irq); 40 at91_sys_write(AT91_AIC_IDCR, 1 << d->irq);
41} 41}
42 42
43static void at91_aic_unmask_irq(unsigned int irq) 43static void at91_aic_unmask_irq(struct irq_data *d)
44{ 44{
45 /* Enable interrupt on AIC */ 45 /* Enable interrupt on AIC */
46 at91_sys_write(AT91_AIC_IECR, 1 << irq); 46 at91_sys_write(AT91_AIC_IECR, 1 << d->irq);
47} 47}
48 48
49unsigned int at91_extern_irq; 49unsigned int at91_extern_irq;
50 50
51#define is_extern_irq(irq) ((1 << (irq)) & at91_extern_irq) 51#define is_extern_irq(irq) ((1 << (irq)) & at91_extern_irq)
52 52
53static int at91_aic_set_type(unsigned irq, unsigned type) 53static int at91_aic_set_type(struct irq_data *d, unsigned type)
54{ 54{
55 unsigned int smr, srctype; 55 unsigned int smr, srctype;
56 56
@@ -62,13 +62,13 @@ static int at91_aic_set_type(unsigned irq, unsigned type)
62 srctype = AT91_AIC_SRCTYPE_RISING; 62 srctype = AT91_AIC_SRCTYPE_RISING;
63 break; 63 break;
64 case IRQ_TYPE_LEVEL_LOW: 64 case IRQ_TYPE_LEVEL_LOW:
65 if ((irq == AT91_ID_FIQ) || is_extern_irq(irq)) /* only supported on external interrupts */ 65 if ((d->irq == AT91_ID_FIQ) || is_extern_irq(d->irq)) /* only supported on external interrupts */
66 srctype = AT91_AIC_SRCTYPE_LOW; 66 srctype = AT91_AIC_SRCTYPE_LOW;
67 else 67 else
68 return -EINVAL; 68 return -EINVAL;
69 break; 69 break;
70 case IRQ_TYPE_EDGE_FALLING: 70 case IRQ_TYPE_EDGE_FALLING:
71 if ((irq == AT91_ID_FIQ) || is_extern_irq(irq)) /* only supported on external interrupts */ 71 if ((d->irq == AT91_ID_FIQ) || is_extern_irq(d->irq)) /* only supported on external interrupts */
72 srctype = AT91_AIC_SRCTYPE_FALLING; 72 srctype = AT91_AIC_SRCTYPE_FALLING;
73 else 73 else
74 return -EINVAL; 74 return -EINVAL;
@@ -77,8 +77,8 @@ static int at91_aic_set_type(unsigned irq, unsigned type)
77 return -EINVAL; 77 return -EINVAL;
78 } 78 }
79 79
80 smr = at91_sys_read(AT91_AIC_SMR(irq)) & ~AT91_AIC_SRCTYPE; 80 smr = at91_sys_read(AT91_AIC_SMR(d->irq)) & ~AT91_AIC_SRCTYPE;
81 at91_sys_write(AT91_AIC_SMR(irq), smr | srctype); 81 at91_sys_write(AT91_AIC_SMR(d->irq), smr | srctype);
82 return 0; 82 return 0;
83} 83}
84 84
@@ -87,15 +87,15 @@ static int at91_aic_set_type(unsigned irq, unsigned type)
87static u32 wakeups; 87static u32 wakeups;
88static u32 backups; 88static u32 backups;
89 89
90static int at91_aic_set_wake(unsigned irq, unsigned value) 90static int at91_aic_set_wake(struct irq_data *d, unsigned value)
91{ 91{
92 if (unlikely(irq >= 32)) 92 if (unlikely(d->irq >= 32))
93 return -EINVAL; 93 return -EINVAL;
94 94
95 if (value) 95 if (value)
96 wakeups |= (1 << irq); 96 wakeups |= (1 << d->irq);
97 else 97 else
98 wakeups &= ~(1 << irq); 98 wakeups &= ~(1 << d->irq);
99 99
100 return 0; 100 return 0;
101} 101}
@@ -119,11 +119,11 @@ void at91_irq_resume(void)
119 119
120static struct irq_chip at91_aic_chip = { 120static struct irq_chip at91_aic_chip = {
121 .name = "AIC", 121 .name = "AIC",
122 .ack = at91_aic_mask_irq, 122 .irq_ack = at91_aic_mask_irq,
123 .mask = at91_aic_mask_irq, 123 .irq_mask = at91_aic_mask_irq,
124 .unmask = at91_aic_unmask_irq, 124 .irq_unmask = at91_aic_unmask_irq,
125 .set_type = at91_aic_set_type, 125 .irq_set_type = at91_aic_set_type,
126 .set_wake = at91_aic_set_wake, 126 .irq_set_wake = at91_aic_set_wake,
127}; 127};
128 128
129/* 129/*
diff --git a/arch/arm/mach-bcmring/irq.c b/arch/arm/mach-bcmring/irq.c
index e3152631eb37..84dcda0d1d9a 100644
--- a/arch/arm/mach-bcmring/irq.c
+++ b/arch/arm/mach-bcmring/irq.c
@@ -30,61 +30,61 @@
30#include <mach/csp/intcHw_reg.h> 30#include <mach/csp/intcHw_reg.h>
31#include <mach/csp/mm_io.h> 31#include <mach/csp/mm_io.h>
32 32
33static void bcmring_mask_irq0(unsigned int irq) 33static void bcmring_mask_irq0(struct irq_data *d)
34{ 34{
35 writel(1 << (irq - IRQ_INTC0_START), 35 writel(1 << (d->irq - IRQ_INTC0_START),
36 MM_IO_BASE_INTC0 + INTCHW_INTENCLEAR); 36 MM_IO_BASE_INTC0 + INTCHW_INTENCLEAR);
37} 37}
38 38
39static void bcmring_unmask_irq0(unsigned int irq) 39static void bcmring_unmask_irq0(struct irq_data *d)
40{ 40{
41 writel(1 << (irq - IRQ_INTC0_START), 41 writel(1 << (d->irq - IRQ_INTC0_START),
42 MM_IO_BASE_INTC0 + INTCHW_INTENABLE); 42 MM_IO_BASE_INTC0 + INTCHW_INTENABLE);
43} 43}
44 44
45static void bcmring_mask_irq1(unsigned int irq) 45static void bcmring_mask_irq1(struct irq_data *d)
46{ 46{
47 writel(1 << (irq - IRQ_INTC1_START), 47 writel(1 << (d->irq - IRQ_INTC1_START),
48 MM_IO_BASE_INTC1 + INTCHW_INTENCLEAR); 48 MM_IO_BASE_INTC1 + INTCHW_INTENCLEAR);
49} 49}
50 50
51static void bcmring_unmask_irq1(unsigned int irq) 51static void bcmring_unmask_irq1(struct irq_data *d)
52{ 52{
53 writel(1 << (irq - IRQ_INTC1_START), 53 writel(1 << (d->irq - IRQ_INTC1_START),
54 MM_IO_BASE_INTC1 + INTCHW_INTENABLE); 54 MM_IO_BASE_INTC1 + INTCHW_INTENABLE);
55} 55}
56 56
57static void bcmring_mask_irq2(unsigned int irq) 57static void bcmring_mask_irq2(struct irq_data *d)
58{ 58{
59 writel(1 << (irq - IRQ_SINTC_START), 59 writel(1 << (d->irq - IRQ_SINTC_START),
60 MM_IO_BASE_SINTC + INTCHW_INTENCLEAR); 60 MM_IO_BASE_SINTC + INTCHW_INTENCLEAR);
61} 61}
62 62
63static void bcmring_unmask_irq2(unsigned int irq) 63static void bcmring_unmask_irq2(struct irq_data *d)
64{ 64{
65 writel(1 << (irq - IRQ_SINTC_START), 65 writel(1 << (d->irq - IRQ_SINTC_START),
66 MM_IO_BASE_SINTC + INTCHW_INTENABLE); 66 MM_IO_BASE_SINTC + INTCHW_INTENABLE);
67} 67}
68 68
69static struct irq_chip bcmring_irq0_chip = { 69static struct irq_chip bcmring_irq0_chip = {
70 .name = "ARM-INTC0", 70 .name = "ARM-INTC0",
71 .ack = bcmring_mask_irq0, 71 .irq_ack = bcmring_mask_irq0,
72 .mask = bcmring_mask_irq0, /* mask a specific interrupt, blocking its delivery. */ 72 .irq_mask = bcmring_mask_irq0, /* mask a specific interrupt, blocking its delivery. */
73 .unmask = bcmring_unmask_irq0, /* unmaks an interrupt */ 73 .irq_unmask = bcmring_unmask_irq0, /* unmaks an interrupt */
74}; 74};
75 75
76static struct irq_chip bcmring_irq1_chip = { 76static struct irq_chip bcmring_irq1_chip = {
77 .name = "ARM-INTC1", 77 .name = "ARM-INTC1",
78 .ack = bcmring_mask_irq1, 78 .irq_ack = bcmring_mask_irq1,
79 .mask = bcmring_mask_irq1, 79 .irq_mask = bcmring_mask_irq1,
80 .unmask = bcmring_unmask_irq1, 80 .irq_unmask = bcmring_unmask_irq1,
81}; 81};
82 82
83static struct irq_chip bcmring_irq2_chip = { 83static struct irq_chip bcmring_irq2_chip = {
84 .name = "ARM-SINTC", 84 .name = "ARM-SINTC",
85 .ack = bcmring_mask_irq2, 85 .irq_ack = bcmring_mask_irq2,
86 .mask = bcmring_mask_irq2, 86 .irq_mask = bcmring_mask_irq2,
87 .unmask = bcmring_unmask_irq2, 87 .irq_unmask = bcmring_unmask_irq2,
88}; 88};
89 89
90static void vic_init(void __iomem *base, struct irq_chip *chip, 90static void vic_init(void __iomem *base, struct irq_chip *chip,
diff --git a/arch/arm/mach-clps711x/irq.c b/arch/arm/mach-clps711x/irq.c
index 9a12d8562284..86da7a1b2bbe 100644
--- a/arch/arm/mach-clps711x/irq.c
+++ b/arch/arm/mach-clps711x/irq.c
@@ -27,24 +27,24 @@
27 27
28#include <asm/hardware/clps7111.h> 28#include <asm/hardware/clps7111.h>
29 29
30static void int1_mask(unsigned int irq) 30static void int1_mask(struct irq_data *d)
31{ 31{
32 u32 intmr1; 32 u32 intmr1;
33 33
34 intmr1 = clps_readl(INTMR1); 34 intmr1 = clps_readl(INTMR1);
35 intmr1 &= ~(1 << irq); 35 intmr1 &= ~(1 << d->irq);
36 clps_writel(intmr1, INTMR1); 36 clps_writel(intmr1, INTMR1);
37} 37}
38 38
39static void int1_ack(unsigned int irq) 39static void int1_ack(struct irq_data *d)
40{ 40{
41 u32 intmr1; 41 u32 intmr1;
42 42
43 intmr1 = clps_readl(INTMR1); 43 intmr1 = clps_readl(INTMR1);
44 intmr1 &= ~(1 << irq); 44 intmr1 &= ~(1 << d->irq);
45 clps_writel(intmr1, INTMR1); 45 clps_writel(intmr1, INTMR1);
46 46
47 switch (irq) { 47 switch (d->irq) {
48 case IRQ_CSINT: clps_writel(0, COEOI); break; 48 case IRQ_CSINT: clps_writel(0, COEOI); break;
49 case IRQ_TC1OI: clps_writel(0, TC1EOI); break; 49 case IRQ_TC1OI: clps_writel(0, TC1EOI); break;
50 case IRQ_TC2OI: clps_writel(0, TC2EOI); break; 50 case IRQ_TC2OI: clps_writel(0, TC2EOI); break;
@@ -54,56 +54,56 @@ static void int1_ack(unsigned int irq)
54 } 54 }
55} 55}
56 56
57static void int1_unmask(unsigned int irq) 57static void int1_unmask(struct irq_data *d)
58{ 58{
59 u32 intmr1; 59 u32 intmr1;
60 60
61 intmr1 = clps_readl(INTMR1); 61 intmr1 = clps_readl(INTMR1);
62 intmr1 |= 1 << irq; 62 intmr1 |= 1 << d->irq;
63 clps_writel(intmr1, INTMR1); 63 clps_writel(intmr1, INTMR1);
64} 64}
65 65
66static struct irq_chip int1_chip = { 66static struct irq_chip int1_chip = {
67 .ack = int1_ack, 67 .irq_ack = int1_ack,
68 .mask = int1_mask, 68 .irq_mask = int1_mask,
69 .unmask = int1_unmask, 69 .irq_unmask = int1_unmask,
70}; 70};
71 71
72static void int2_mask(unsigned int irq) 72static void int2_mask(struct irq_data *d)
73{ 73{
74 u32 intmr2; 74 u32 intmr2;
75 75
76 intmr2 = clps_readl(INTMR2); 76 intmr2 = clps_readl(INTMR2);
77 intmr2 &= ~(1 << (irq - 16)); 77 intmr2 &= ~(1 << (d->irq - 16));
78 clps_writel(intmr2, INTMR2); 78 clps_writel(intmr2, INTMR2);
79} 79}
80 80
81static void int2_ack(unsigned int irq) 81static void int2_ack(struct irq_data *d)
82{ 82{
83 u32 intmr2; 83 u32 intmr2;
84 84
85 intmr2 = clps_readl(INTMR2); 85 intmr2 = clps_readl(INTMR2);
86 intmr2 &= ~(1 << (irq - 16)); 86 intmr2 &= ~(1 << (d->irq - 16));
87 clps_writel(intmr2, INTMR2); 87 clps_writel(intmr2, INTMR2);
88 88
89 switch (irq) { 89 switch (d->irq) {
90 case IRQ_KBDINT: clps_writel(0, KBDEOI); break; 90 case IRQ_KBDINT: clps_writel(0, KBDEOI); break;
91 } 91 }
92} 92}
93 93
94static void int2_unmask(unsigned int irq) 94static void int2_unmask(struct irq_data *d)
95{ 95{
96 u32 intmr2; 96 u32 intmr2;
97 97
98 intmr2 = clps_readl(INTMR2); 98 intmr2 = clps_readl(INTMR2);
99 intmr2 |= 1 << (irq - 16); 99 intmr2 |= 1 << (d->irq - 16);
100 clps_writel(intmr2, INTMR2); 100 clps_writel(intmr2, INTMR2);
101} 101}
102 102
103static struct irq_chip int2_chip = { 103static struct irq_chip int2_chip = {
104 .ack = int2_ack, 104 .irq_ack = int2_ack,
105 .mask = int2_mask, 105 .irq_mask = int2_mask,
106 .unmask = int2_unmask, 106 .irq_unmask = int2_unmask,
107}; 107};
108 108
109void __init clps711x_init_irq(void) 109void __init clps711x_init_irq(void)
diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
index bb4c40ecb803..9abc80a86a22 100644
--- a/arch/arm/mach-davinci/cp_intc.c
+++ b/arch/arm/mach-davinci/cp_intc.c
@@ -26,30 +26,30 @@ static inline void cp_intc_write(unsigned long value, unsigned offset)
26 __raw_writel(value, davinci_intc_base + offset); 26 __raw_writel(value, davinci_intc_base + offset);
27} 27}
28 28
29static void cp_intc_ack_irq(unsigned int irq) 29static void cp_intc_ack_irq(struct irq_data *d)
30{ 30{
31 cp_intc_write(irq, CP_INTC_SYS_STAT_IDX_CLR); 31 cp_intc_write(d->irq, CP_INTC_SYS_STAT_IDX_CLR);
32} 32}
33 33
34/* Disable interrupt */ 34/* Disable interrupt */
35static void cp_intc_mask_irq(unsigned int irq) 35static void cp_intc_mask_irq(struct irq_data *d)
36{ 36{
37 /* XXX don't know why we need to disable nIRQ here... */ 37 /* XXX don't know why we need to disable nIRQ here... */
38 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_CLR); 38 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_CLR);
39 cp_intc_write(irq, CP_INTC_SYS_ENABLE_IDX_CLR); 39 cp_intc_write(d->irq, CP_INTC_SYS_ENABLE_IDX_CLR);
40 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_SET); 40 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_SET);
41} 41}
42 42
43/* Enable interrupt */ 43/* Enable interrupt */
44static void cp_intc_unmask_irq(unsigned int irq) 44static void cp_intc_unmask_irq(struct irq_data *d)
45{ 45{
46 cp_intc_write(irq, CP_INTC_SYS_ENABLE_IDX_SET); 46 cp_intc_write(d->irq, CP_INTC_SYS_ENABLE_IDX_SET);
47} 47}
48 48
49static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type) 49static int cp_intc_set_irq_type(struct irq_data *d, unsigned int flow_type)
50{ 50{
51 unsigned reg = BIT_WORD(irq); 51 unsigned reg = BIT_WORD(d->irq);
52 unsigned mask = BIT_MASK(irq); 52 unsigned mask = BIT_MASK(d->irq);
53 unsigned polarity = cp_intc_read(CP_INTC_SYS_POLARITY(reg)); 53 unsigned polarity = cp_intc_read(CP_INTC_SYS_POLARITY(reg));
54 unsigned type = cp_intc_read(CP_INTC_SYS_TYPE(reg)); 54 unsigned type = cp_intc_read(CP_INTC_SYS_TYPE(reg));
55 55
@@ -85,18 +85,18 @@ static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type)
85 * generic drivers which call {enable|disable}_irq_wake for 85 * generic drivers which call {enable|disable}_irq_wake for
86 * wake up interrupt sources (eg RTC on DA850). 86 * wake up interrupt sources (eg RTC on DA850).
87 */ 87 */
88static int cp_intc_set_wake(unsigned int irq, unsigned int on) 88static int cp_intc_set_wake(struct irq_data *d, unsigned int on)
89{ 89{
90 return 0; 90 return 0;
91} 91}
92 92
93static struct irq_chip cp_intc_irq_chip = { 93static struct irq_chip cp_intc_irq_chip = {
94 .name = "cp_intc", 94 .name = "cp_intc",
95 .ack = cp_intc_ack_irq, 95 .irq_ack = cp_intc_ack_irq,
96 .mask = cp_intc_mask_irq, 96 .irq_mask = cp_intc_mask_irq,
97 .unmask = cp_intc_unmask_irq, 97 .irq_unmask = cp_intc_unmask_irq,
98 .set_type = cp_intc_set_irq_type, 98 .irq_set_type = cp_intc_set_irq_type,
99 .set_wake = cp_intc_set_wake, 99 .irq_set_wake = cp_intc_set_wake,
100}; 100};
101 101
102void __init cp_intc_init(void) 102void __init cp_intc_init(void)
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
index bf0ff587e46a..20d66e5e4663 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/arch/arm/mach-davinci/gpio.c
@@ -205,20 +205,20 @@ pure_initcall(davinci_gpio_setup);
205 * serve as EDMA event triggers. 205 * serve as EDMA event triggers.
206 */ 206 */
207 207
208static void gpio_irq_disable(unsigned irq) 208static void gpio_irq_disable(struct irq_data *d)
209{ 209{
210 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 210 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
211 u32 mask = (u32) get_irq_data(irq); 211 u32 mask = (u32) irq_data_get_irq_data(d);
212 212
213 __raw_writel(mask, &g->clr_falling); 213 __raw_writel(mask, &g->clr_falling);
214 __raw_writel(mask, &g->clr_rising); 214 __raw_writel(mask, &g->clr_rising);
215} 215}
216 216
217static void gpio_irq_enable(unsigned irq) 217static void gpio_irq_enable(struct irq_data *d)
218{ 218{
219 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 219 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
220 u32 mask = (u32) get_irq_data(irq); 220 u32 mask = (u32) irq_data_get_irq_data(d);
221 unsigned status = irq_desc[irq].status; 221 unsigned status = irq_desc[d->irq].status;
222 222
223 status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; 223 status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
224 if (!status) 224 if (!status)
@@ -230,19 +230,19 @@ static void gpio_irq_enable(unsigned irq)
230 __raw_writel(mask, &g->set_rising); 230 __raw_writel(mask, &g->set_rising);
231} 231}
232 232
233static int gpio_irq_type(unsigned irq, unsigned trigger) 233static int gpio_irq_type(struct irq_data *d, unsigned trigger)
234{ 234{
235 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 235 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
236 u32 mask = (u32) get_irq_data(irq); 236 u32 mask = (u32) irq_data_get_irq_data(d);
237 237
238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
239 return -EINVAL; 239 return -EINVAL;
240 240
241 irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK; 241 irq_desc[d->irq].status &= ~IRQ_TYPE_SENSE_MASK;
242 irq_desc[irq].status |= trigger; 242 irq_desc[d->irq].status |= trigger;
243 243
244 /* don't enable the IRQ if it's currently disabled */ 244 /* don't enable the IRQ if it's currently disabled */
245 if (irq_desc[irq].depth == 0) { 245 if (irq_desc[d->irq].depth == 0) {
246 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING) 246 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
247 ? &g->set_falling : &g->clr_falling); 247 ? &g->set_falling : &g->clr_falling);
248 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING) 248 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
@@ -253,9 +253,9 @@ static int gpio_irq_type(unsigned irq, unsigned trigger)
253 253
254static struct irq_chip gpio_irqchip = { 254static struct irq_chip gpio_irqchip = {
255 .name = "GPIO", 255 .name = "GPIO",
256 .enable = gpio_irq_enable, 256 .irq_enable = gpio_irq_enable,
257 .disable = gpio_irq_disable, 257 .irq_disable = gpio_irq_disable,
258 .set_type = gpio_irq_type, 258 .irq_set_type = gpio_irq_type,
259}; 259};
260 260
261static void 261static void
@@ -269,8 +269,8 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
269 mask <<= 16; 269 mask <<= 16;
270 270
271 /* temporarily mask (level sensitive) parent IRQ */ 271 /* temporarily mask (level sensitive) parent IRQ */
272 desc->chip->mask(irq); 272 desc->irq_data.chip->irq_mask(&desc->irq_data);
273 desc->chip->ack(irq); 273 desc->irq_data.chip->irq_ack(&desc->irq_data);
274 while (1) { 274 while (1) {
275 u32 status; 275 u32 status;
276 int n; 276 int n;
@@ -293,7 +293,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
293 status >>= res; 293 status >>= res;
294 } 294 }
295 } 295 }
296 desc->chip->unmask(irq); 296 desc->irq_data.chip->irq_unmask(&desc->irq_data);
297 /* now it may re-trigger */ 297 /* now it may re-trigger */
298} 298}
299 299
@@ -320,10 +320,10 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
320 return -ENODEV; 320 return -ENODEV;
321} 321}
322 322
323static int gpio_irq_type_unbanked(unsigned irq, unsigned trigger) 323static int gpio_irq_type_unbanked(struct irq_data *d, unsigned trigger)
324{ 324{
325 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 325 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
326 u32 mask = (u32) get_irq_data(irq); 326 u32 mask = (u32) irq_data_get_irq_data(d);
327 327
328 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 328 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
329 return -EINVAL; 329 return -EINVAL;
@@ -397,7 +397,7 @@ static int __init davinci_gpio_irq_setup(void)
397 irq = bank_irq; 397 irq = bank_irq;
398 gpio_irqchip_unbanked = *get_irq_desc_chip(irq_to_desc(irq)); 398 gpio_irqchip_unbanked = *get_irq_desc_chip(irq_to_desc(irq));
399 gpio_irqchip_unbanked.name = "GPIO-AINTC"; 399 gpio_irqchip_unbanked.name = "GPIO-AINTC";
400 gpio_irqchip_unbanked.set_type = gpio_irq_type_unbanked; 400 gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked;
401 401
402 /* default trigger: both edges */ 402 /* default trigger: both edges */
403 g = gpio2regs(0); 403 g = gpio2regs(0);
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index 784ddf3c5ad4..5e05c9b64e1f 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -53,14 +53,14 @@ static inline void davinci_irq_writel(unsigned long value, int offset)
53} 53}
54 54
55/* Disable interrupt */ 55/* Disable interrupt */
56static void davinci_mask_irq(unsigned int irq) 56static void davinci_mask_irq(struct irq_data *d)
57{ 57{
58 unsigned int mask; 58 unsigned int mask;
59 u32 l; 59 u32 l;
60 60
61 mask = 1 << IRQ_BIT(irq); 61 mask = 1 << IRQ_BIT(d->irq);
62 62
63 if (irq > 31) { 63 if (d->irq > 31) {
64 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET); 64 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET);
65 l &= ~mask; 65 l &= ~mask;
66 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET); 66 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET);
@@ -72,14 +72,14 @@ static void davinci_mask_irq(unsigned int irq)
72} 72}
73 73
74/* Enable interrupt */ 74/* Enable interrupt */
75static void davinci_unmask_irq(unsigned int irq) 75static void davinci_unmask_irq(struct irq_data *d)
76{ 76{
77 unsigned int mask; 77 unsigned int mask;
78 u32 l; 78 u32 l;
79 79
80 mask = 1 << IRQ_BIT(irq); 80 mask = 1 << IRQ_BIT(d->irq);
81 81
82 if (irq > 31) { 82 if (d->irq > 31) {
83 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET); 83 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET);
84 l |= mask; 84 l |= mask;
85 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET); 85 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET);
@@ -91,23 +91,23 @@ static void davinci_unmask_irq(unsigned int irq)
91} 91}
92 92
93/* EOI interrupt */ 93/* EOI interrupt */
94static void davinci_ack_irq(unsigned int irq) 94static void davinci_ack_irq(struct irq_data *d)
95{ 95{
96 unsigned int mask; 96 unsigned int mask;
97 97
98 mask = 1 << IRQ_BIT(irq); 98 mask = 1 << IRQ_BIT(d->irq);
99 99
100 if (irq > 31) 100 if (d->irq > 31)
101 davinci_irq_writel(mask, IRQ_REG1_OFFSET); 101 davinci_irq_writel(mask, IRQ_REG1_OFFSET);
102 else 102 else
103 davinci_irq_writel(mask, IRQ_REG0_OFFSET); 103 davinci_irq_writel(mask, IRQ_REG0_OFFSET);
104} 104}
105 105
106static struct irq_chip davinci_irq_chip_0 = { 106static struct irq_chip davinci_irq_chip_0 = {
107 .name = "AINTC", 107 .name = "AINTC",
108 .ack = davinci_ack_irq, 108 .irq_ack = davinci_ack_irq,
109 .mask = davinci_mask_irq, 109 .irq_mask = davinci_mask_irq,
110 .unmask = davinci_unmask_irq, 110 .irq_unmask = davinci_unmask_irq,
111}; 111};
112 112
113/* ARM Interrupt Controller Initialization */ 113/* ARM Interrupt Controller Initialization */
diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c
index 61bfcb3b08c2..9317f0558b57 100644
--- a/arch/arm/mach-dove/irq.c
+++ b/arch/arm/mach-dove/irq.c
@@ -36,9 +36,9 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
36 } 36 }
37} 37}
38 38
39static void pmu_irq_mask(unsigned int irq) 39static void pmu_irq_mask(struct irq_data *d)
40{ 40{
41 int pin = irq_to_pmu(irq); 41 int pin = irq_to_pmu(d->irq);
42 u32 u; 42 u32 u;
43 43
44 u = readl(PMU_INTERRUPT_MASK); 44 u = readl(PMU_INTERRUPT_MASK);
@@ -46,9 +46,9 @@ static void pmu_irq_mask(unsigned int irq)
46 writel(u, PMU_INTERRUPT_MASK); 46 writel(u, PMU_INTERRUPT_MASK);
47} 47}
48 48
49static void pmu_irq_unmask(unsigned int irq) 49static void pmu_irq_unmask(struct irq_data *d)
50{ 50{
51 int pin = irq_to_pmu(irq); 51 int pin = irq_to_pmu(d->irq);
52 u32 u; 52 u32 u;
53 53
54 u = readl(PMU_INTERRUPT_MASK); 54 u = readl(PMU_INTERRUPT_MASK);
@@ -56,9 +56,9 @@ static void pmu_irq_unmask(unsigned int irq)
56 writel(u, PMU_INTERRUPT_MASK); 56 writel(u, PMU_INTERRUPT_MASK);
57} 57}
58 58
59static void pmu_irq_ack(unsigned int irq) 59static void pmu_irq_ack(struct irq_data *d)
60{ 60{
61 int pin = irq_to_pmu(irq); 61 int pin = irq_to_pmu(d->irq);
62 u32 u; 62 u32 u;
63 63
64 u = ~(1 << (pin & 31)); 64 u = ~(1 << (pin & 31));
@@ -67,9 +67,9 @@ static void pmu_irq_ack(unsigned int irq)
67 67
68static struct irq_chip pmu_irq_chip = { 68static struct irq_chip pmu_irq_chip = {
69 .name = "pmu_irq", 69 .name = "pmu_irq",
70 .mask = pmu_irq_mask, 70 .irq_mask = pmu_irq_mask,
71 .unmask = pmu_irq_unmask, 71 .irq_unmask = pmu_irq_unmask,
72 .ack = pmu_irq_ack, 72 .irq_ack = pmu_irq_ack,
73}; 73};
74 74
75static void pmu_irq_handler(unsigned int irq, struct irq_desc *desc) 75static void pmu_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 5df4099fc14f..7df083f37fa7 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -35,20 +35,20 @@
35#define IRQ_STAT 0xff000000 /* read */ 35#define IRQ_STAT 0xff000000 /* read */
36#define IRQ_MCLR 0xff000000 /* write */ 36#define IRQ_MCLR 0xff000000 /* write */
37 37
38static void ebsa110_mask_irq(unsigned int irq) 38static void ebsa110_mask_irq(struct irq_data *d)
39{ 39{
40 __raw_writeb(1 << irq, IRQ_MCLR); 40 __raw_writeb(1 << d->irq, IRQ_MCLR);
41} 41}
42 42
43static void ebsa110_unmask_irq(unsigned int irq) 43static void ebsa110_unmask_irq(struct irq_data *d)
44{ 44{
45 __raw_writeb(1 << irq, IRQ_MSET); 45 __raw_writeb(1 << d->irq, IRQ_MSET);
46} 46}
47 47
48static struct irq_chip ebsa110_irq_chip = { 48static struct irq_chip ebsa110_irq_chip = {
49 .ack = ebsa110_mask_irq, 49 .irq_ack = ebsa110_mask_irq,
50 .mask = ebsa110_mask_irq, 50 .irq_mask = ebsa110_mask_irq,
51 .unmask = ebsa110_unmask_irq, 51 .irq_unmask = ebsa110_unmask_irq,
52}; 52};
53 53
54static void __init ebsa110_init_irq(void) 54static void __init ebsa110_init_irq(void)
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c
index cf547ad7ebd4..f3dc76fdcea8 100644
--- a/arch/arm/mach-ep93xx/gpio.c
+++ b/arch/arm/mach-ep93xx/gpio.c
@@ -112,13 +112,13 @@ static void ep93xx_gpio_f_irq_handler(unsigned int irq, struct irq_desc *desc)
112 generic_handle_irq(gpio_irq); 112 generic_handle_irq(gpio_irq);
113} 113}
114 114
115static void ep93xx_gpio_irq_ack(unsigned int irq) 115static void ep93xx_gpio_irq_ack(struct irq_data *d)
116{ 116{
117 int line = irq_to_gpio(irq); 117 int line = irq_to_gpio(d->irq);
118 int port = line >> 3; 118 int port = line >> 3;
119 int port_mask = 1 << (line & 7); 119 int port_mask = 1 << (line & 7);
120 120
121 if ((irq_desc[irq].status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { 121 if ((irq_desc[d->irq].status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
122 gpio_int_type2[port] ^= port_mask; /* switch edge direction */ 122 gpio_int_type2[port] ^= port_mask; /* switch edge direction */
123 ep93xx_gpio_update_int_params(port); 123 ep93xx_gpio_update_int_params(port);
124 } 124 }
@@ -126,13 +126,13 @@ static void ep93xx_gpio_irq_ack(unsigned int irq)
126 __raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port])); 126 __raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
127} 127}
128 128
129static void ep93xx_gpio_irq_mask_ack(unsigned int irq) 129static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
130{ 130{
131 int line = irq_to_gpio(irq); 131 int line = irq_to_gpio(d->irq);
132 int port = line >> 3; 132 int port = line >> 3;
133 int port_mask = 1 << (line & 7); 133 int port_mask = 1 << (line & 7);
134 134
135 if ((irq_desc[irq].status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) 135 if ((irq_desc[d->irq].status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH)
136 gpio_int_type2[port] ^= port_mask; /* switch edge direction */ 136 gpio_int_type2[port] ^= port_mask; /* switch edge direction */
137 137
138 gpio_int_unmasked[port] &= ~port_mask; 138 gpio_int_unmasked[port] &= ~port_mask;
@@ -141,18 +141,18 @@ static void ep93xx_gpio_irq_mask_ack(unsigned int irq)
141 __raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port])); 141 __raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
142} 142}
143 143
144static void ep93xx_gpio_irq_mask(unsigned int irq) 144static void ep93xx_gpio_irq_mask(struct irq_data *d)
145{ 145{
146 int line = irq_to_gpio(irq); 146 int line = irq_to_gpio(d->irq);
147 int port = line >> 3; 147 int port = line >> 3;
148 148
149 gpio_int_unmasked[port] &= ~(1 << (line & 7)); 149 gpio_int_unmasked[port] &= ~(1 << (line & 7));
150 ep93xx_gpio_update_int_params(port); 150 ep93xx_gpio_update_int_params(port);
151} 151}
152 152
153static void ep93xx_gpio_irq_unmask(unsigned int irq) 153static void ep93xx_gpio_irq_unmask(struct irq_data *d)
154{ 154{
155 int line = irq_to_gpio(irq); 155 int line = irq_to_gpio(d->irq);
156 int port = line >> 3; 156 int port = line >> 3;
157 157
158 gpio_int_unmasked[port] |= 1 << (line & 7); 158 gpio_int_unmasked[port] |= 1 << (line & 7);
@@ -164,10 +164,10 @@ static void ep93xx_gpio_irq_unmask(unsigned int irq)
164 * edge (1) triggered, while gpio_int_type2 controls whether it 164 * edge (1) triggered, while gpio_int_type2 controls whether it
165 * triggers on low/falling (0) or high/rising (1). 165 * triggers on low/falling (0) or high/rising (1).
166 */ 166 */
167static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type) 167static int ep93xx_gpio_irq_type(struct irq_data *d, unsigned int type)
168{ 168{
169 struct irq_desc *desc = irq_desc + irq; 169 struct irq_desc *desc = irq_desc + d->irq;
170 const int gpio = irq_to_gpio(irq); 170 const int gpio = irq_to_gpio(d->irq);
171 const int port = gpio >> 3; 171 const int port = gpio >> 3;
172 const int port_mask = 1 << (gpio & 7); 172 const int port_mask = 1 << (gpio & 7);
173 173
@@ -220,11 +220,11 @@ static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type)
220 220
221static struct irq_chip ep93xx_gpio_irq_chip = { 221static struct irq_chip ep93xx_gpio_irq_chip = {
222 .name = "GPIO", 222 .name = "GPIO",
223 .ack = ep93xx_gpio_irq_ack, 223 .irq_ack = ep93xx_gpio_irq_ack,
224 .mask_ack = ep93xx_gpio_irq_mask_ack, 224 .irq_mask_ack = ep93xx_gpio_irq_mask_ack,
225 .mask = ep93xx_gpio_irq_mask, 225 .irq_mask = ep93xx_gpio_irq_mask,
226 .unmask = ep93xx_gpio_irq_unmask, 226 .irq_unmask = ep93xx_gpio_irq_unmask,
227 .set_type = ep93xx_gpio_irq_type, 227 .irq_set_type = ep93xx_gpio_irq_type,
228}; 228};
229 229
230void __init ep93xx_gpio_init_irq(void) 230void __init ep93xx_gpio_init_irq(void)
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index 88b3dd89be89..84c5f258f2d8 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -75,20 +75,20 @@ static const int fb_irq_mask[] = {
75 IRQ_MASK_PCI_PERR, /* 19 */ 75 IRQ_MASK_PCI_PERR, /* 19 */
76}; 76};
77 77
78static void fb_mask_irq(unsigned int irq) 78static void fb_mask_irq(struct irq_data *d)
79{ 79{
80 *CSR_IRQ_DISABLE = fb_irq_mask[_DC21285_INR(irq)]; 80 *CSR_IRQ_DISABLE = fb_irq_mask[_DC21285_INR(d->irq)];
81} 81}
82 82
83static void fb_unmask_irq(unsigned int irq) 83static void fb_unmask_irq(struct irq_data *d)
84{ 84{
85 *CSR_IRQ_ENABLE = fb_irq_mask[_DC21285_INR(irq)]; 85 *CSR_IRQ_ENABLE = fb_irq_mask[_DC21285_INR(d->irq)];
86} 86}
87 87
88static struct irq_chip fb_chip = { 88static struct irq_chip fb_chip = {
89 .ack = fb_mask_irq, 89 .irq_ack = fb_mask_irq,
90 .mask = fb_mask_irq, 90 .irq_mask = fb_mask_irq,
91 .unmask = fb_unmask_irq, 91 .irq_unmask = fb_unmask_irq,
92}; 92};
93 93
94static void __init __fb_init_irq(void) 94static void __init __fb_init_irq(void)
diff --git a/arch/arm/mach-footbridge/isa-irq.c b/arch/arm/mach-footbridge/isa-irq.c
index 8bfd06aeb64d..de7a5cb5dbe1 100644
--- a/arch/arm/mach-footbridge/isa-irq.c
+++ b/arch/arm/mach-footbridge/isa-irq.c
@@ -30,61 +30,61 @@
30 30
31#include "common.h" 31#include "common.h"
32 32
33static void isa_mask_pic_lo_irq(unsigned int irq) 33static void isa_mask_pic_lo_irq(struct irq_data *d)
34{ 34{
35 unsigned int mask = 1 << (irq & 7); 35 unsigned int mask = 1 << (d->irq & 7);
36 36
37 outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); 37 outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO);
38} 38}
39 39
40static void isa_ack_pic_lo_irq(unsigned int irq) 40static void isa_ack_pic_lo_irq(struct irq_data *d)
41{ 41{
42 unsigned int mask = 1 << (irq & 7); 42 unsigned int mask = 1 << (d->irq & 7);
43 43
44 outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO); 44 outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO);
45 outb(0x20, PIC_LO); 45 outb(0x20, PIC_LO);
46} 46}
47 47
48static void isa_unmask_pic_lo_irq(unsigned int irq) 48static void isa_unmask_pic_lo_irq(struct irq_data *d)
49{ 49{
50 unsigned int mask = 1 << (irq & 7); 50 unsigned int mask = 1 << (d->irq & 7);
51 51
52 outb(inb(PIC_MASK_LO) & ~mask, PIC_MASK_LO); 52 outb(inb(PIC_MASK_LO) & ~mask, PIC_MASK_LO);
53} 53}
54 54
55static struct irq_chip isa_lo_chip = { 55static struct irq_chip isa_lo_chip = {
56 .ack = isa_ack_pic_lo_irq, 56 .irq_ack = isa_ack_pic_lo_irq,
57 .mask = isa_mask_pic_lo_irq, 57 .irq_mask = isa_mask_pic_lo_irq,
58 .unmask = isa_unmask_pic_lo_irq, 58 .irq_unmask = isa_unmask_pic_lo_irq,
59}; 59};
60 60
61static void isa_mask_pic_hi_irq(unsigned int irq) 61static void isa_mask_pic_hi_irq(struct irq_data *d)
62{ 62{
63 unsigned int mask = 1 << (irq & 7); 63 unsigned int mask = 1 << (d->irq & 7);
64 64
65 outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); 65 outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI);
66} 66}
67 67
68static void isa_ack_pic_hi_irq(unsigned int irq) 68static void isa_ack_pic_hi_irq(struct irq_data *d)
69{ 69{
70 unsigned int mask = 1 << (irq & 7); 70 unsigned int mask = 1 << (d->irq & 7);
71 71
72 outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI); 72 outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI);
73 outb(0x62, PIC_LO); 73 outb(0x62, PIC_LO);
74 outb(0x20, PIC_HI); 74 outb(0x20, PIC_HI);
75} 75}
76 76
77static void isa_unmask_pic_hi_irq(unsigned int irq) 77static void isa_unmask_pic_hi_irq(struct irq_data *d)
78{ 78{
79 unsigned int mask = 1 << (irq & 7); 79 unsigned int mask = 1 << (d->irq & 7);
80 80
81 outb(inb(PIC_MASK_HI) & ~mask, PIC_MASK_HI); 81 outb(inb(PIC_MASK_HI) & ~mask, PIC_MASK_HI);
82} 82}
83 83
84static struct irq_chip isa_hi_chip = { 84static struct irq_chip isa_hi_chip = {
85 .ack = isa_ack_pic_hi_irq, 85 .irq_ack = isa_ack_pic_hi_irq,
86 .mask = isa_mask_pic_hi_irq, 86 .irq_mask = isa_mask_pic_hi_irq,
87 .unmask = isa_unmask_pic_hi_irq, 87 .irq_unmask = isa_unmask_pic_hi_irq,
88}; 88};
89 89
90static void 90static void
diff --git a/arch/arm/mach-gemini/gpio.c b/arch/arm/mach-gemini/gpio.c
index fe3bd5ac8b10..fa3d333f21e1 100644
--- a/arch/arm/mach-gemini/gpio.c
+++ b/arch/arm/mach-gemini/gpio.c
@@ -54,33 +54,33 @@ static void _set_gpio_irqenable(unsigned int base, unsigned int index,
54 __raw_writel(reg, base + GPIO_INT_EN); 54 __raw_writel(reg, base + GPIO_INT_EN);
55} 55}
56 56
57static void gpio_ack_irq(unsigned int irq) 57static void gpio_ack_irq(struct irq_data *d)
58{ 58{
59 unsigned int gpio = irq_to_gpio(irq); 59 unsigned int gpio = irq_to_gpio(d->irq);
60 unsigned int base = GPIO_BASE(gpio / 32); 60 unsigned int base = GPIO_BASE(gpio / 32);
61 61
62 __raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR); 62 __raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR);
63} 63}
64 64
65static void gpio_mask_irq(unsigned int irq) 65static void gpio_mask_irq(struct irq_data *d)
66{ 66{
67 unsigned int gpio = irq_to_gpio(irq); 67 unsigned int gpio = irq_to_gpio(d->irq);
68 unsigned int base = GPIO_BASE(gpio / 32); 68 unsigned int base = GPIO_BASE(gpio / 32);
69 69
70 _set_gpio_irqenable(base, gpio % 32, 0); 70 _set_gpio_irqenable(base, gpio % 32, 0);
71} 71}
72 72
73static void gpio_unmask_irq(unsigned int irq) 73static void gpio_unmask_irq(struct irq_data *d)
74{ 74{
75 unsigned int gpio = irq_to_gpio(irq); 75 unsigned int gpio = irq_to_gpio(d->irq);
76 unsigned int base = GPIO_BASE(gpio / 32); 76 unsigned int base = GPIO_BASE(gpio / 32);
77 77
78 _set_gpio_irqenable(base, gpio % 32, 1); 78 _set_gpio_irqenable(base, gpio % 32, 1);
79} 79}
80 80
81static int gpio_set_irq_type(unsigned int irq, unsigned int type) 81static int gpio_set_irq_type(struct irq_data *d, unsigned int type)
82{ 82{
83 unsigned int gpio = irq_to_gpio(irq); 83 unsigned int gpio = irq_to_gpio(d->irq);
84 unsigned int gpio_mask = 1 << (gpio % 32); 84 unsigned int gpio_mask = 1 << (gpio % 32);
85 unsigned int base = GPIO_BASE(gpio / 32); 85 unsigned int base = GPIO_BASE(gpio / 32);
86 unsigned int reg_both, reg_level, reg_type; 86 unsigned int reg_both, reg_level, reg_type;
@@ -120,7 +120,7 @@ static int gpio_set_irq_type(unsigned int irq, unsigned int type)
120 __raw_writel(reg_level, base + GPIO_INT_LEVEL); 120 __raw_writel(reg_level, base + GPIO_INT_LEVEL);
121 __raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE); 121 __raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE);
122 122
123 gpio_ack_irq(irq); 123 gpio_ack_irq(d->irq);
124 124
125 return 0; 125 return 0;
126} 126}
@@ -146,10 +146,10 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
146 146
147static struct irq_chip gpio_irq_chip = { 147static struct irq_chip gpio_irq_chip = {
148 .name = "GPIO", 148 .name = "GPIO",
149 .ack = gpio_ack_irq, 149 .irq_ack = gpio_ack_irq,
150 .mask = gpio_mask_irq, 150 .irq_mask = gpio_mask_irq,
151 .unmask = gpio_unmask_irq, 151 .irq_unmask = gpio_unmask_irq,
152 .set_type = gpio_set_irq_type, 152 .irq_set_type = gpio_set_irq_type,
153}; 153};
154 154
155static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, 155static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
diff --git a/arch/arm/mach-gemini/irq.c b/arch/arm/mach-gemini/irq.c
index 9e613ca8120d..96bc227dd849 100644
--- a/arch/arm/mach-gemini/irq.c
+++ b/arch/arm/mach-gemini/irq.c
@@ -32,34 +32,34 @@
32#define FIQ_LEVEL(base_addr) (base_addr + 0x30) 32#define FIQ_LEVEL(base_addr) (base_addr + 0x30)
33#define FIQ_STATUS(base_addr) (base_addr + 0x34) 33#define FIQ_STATUS(base_addr) (base_addr + 0x34)
34 34
35static void gemini_ack_irq(unsigned int irq) 35static void gemini_ack_irq(struct irq_data *d)
36{ 36{
37 __raw_writel(1 << irq, IRQ_CLEAR(IO_ADDRESS(GEMINI_INTERRUPT_BASE))); 37 __raw_writel(1 << d->irq, IRQ_CLEAR(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
38} 38}
39 39
40static void gemini_mask_irq(unsigned int irq) 40static void gemini_mask_irq(struct irq_data *d)
41{ 41{
42 unsigned int mask; 42 unsigned int mask;
43 43
44 mask = __raw_readl(IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE))); 44 mask = __raw_readl(IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
45 mask &= ~(1 << irq); 45 mask &= ~(1 << d->irq);
46 __raw_writel(mask, IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE))); 46 __raw_writel(mask, IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
47} 47}
48 48
49static void gemini_unmask_irq(unsigned int irq) 49static void gemini_unmask_irq(struct irq_data *d)
50{ 50{
51 unsigned int mask; 51 unsigned int mask;
52 52
53 mask = __raw_readl(IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE))); 53 mask = __raw_readl(IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
54 mask |= (1 << irq); 54 mask |= (1 << d->irq);
55 __raw_writel(mask, IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE))); 55 __raw_writel(mask, IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
56} 56}
57 57
58static struct irq_chip gemini_irq_chip = { 58static struct irq_chip gemini_irq_chip = {
59 .name = "INTC", 59 .name = "INTC",
60 .ack = gemini_ack_irq, 60 .irq_ack = gemini_ack_irq,
61 .mask = gemini_mask_irq, 61 .irq_mask = gemini_mask_irq,
62 .unmask = gemini_unmask_irq, 62 .irq_unmask = gemini_unmask_irq,
63}; 63};
64 64
65static struct resource irq_resource = { 65static struct resource irq_resource = {
diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
index bdb3f6706801..1f28c90932c7 100644
--- a/arch/arm/mach-h720x/common.c
+++ b/arch/arm/mach-h720x/common.c
@@ -52,17 +52,17 @@ unsigned long h720x_gettimeoffset(void)
52/* 52/*
53 * mask Global irq's 53 * mask Global irq's
54 */ 54 */
55static void mask_global_irq (unsigned int irq ) 55static void mask_global_irq(struct irq_data *d)
56{ 56{
57 CPU_REG (IRQC_VIRT, IRQC_IER) &= ~(1 << irq); 57 CPU_REG (IRQC_VIRT, IRQC_IER) &= ~(1 << d->irq);
58} 58}
59 59
60/* 60/*
61 * unmask Global irq's 61 * unmask Global irq's
62 */ 62 */
63static void unmask_global_irq (unsigned int irq ) 63static void unmask_global_irq(struct irq_data *d)
64{ 64{
65 CPU_REG (IRQC_VIRT, IRQC_IER) |= (1 << irq); 65 CPU_REG (IRQC_VIRT, IRQC_IER) |= (1 << d->irq);
66} 66}
67 67
68 68
@@ -70,10 +70,10 @@ static void unmask_global_irq (unsigned int irq )
70 * ack GPIO irq's 70 * ack GPIO irq's
71 * Ack only for edge triggered int's valid 71 * Ack only for edge triggered int's valid
72 */ 72 */
73static void inline ack_gpio_irq(u32 irq) 73static void inline ack_gpio_irq(struct irq_data *d)
74{ 74{
75 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq)); 75 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(d->irq));
76 u32 bit = IRQ_TO_BIT(irq); 76 u32 bit = IRQ_TO_BIT(d->irq);
77 if ( (CPU_REG (reg_base, GPIO_EDGE) & bit)) 77 if ( (CPU_REG (reg_base, GPIO_EDGE) & bit))
78 CPU_REG (reg_base, GPIO_CLR) = bit; 78 CPU_REG (reg_base, GPIO_CLR) = bit;
79} 79}
@@ -81,20 +81,20 @@ static void inline ack_gpio_irq(u32 irq)
81/* 81/*
82 * mask GPIO irq's 82 * mask GPIO irq's
83 */ 83 */
84static void inline mask_gpio_irq(u32 irq) 84static void inline mask_gpio_irq(struct irq_data *d)
85{ 85{
86 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq)); 86 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(d->irq));
87 u32 bit = IRQ_TO_BIT(irq); 87 u32 bit = IRQ_TO_BIT(d->irq);
88 CPU_REG (reg_base, GPIO_MASK) &= ~bit; 88 CPU_REG (reg_base, GPIO_MASK) &= ~bit;
89} 89}
90 90
91/* 91/*
92 * unmask GPIO irq's 92 * unmask GPIO irq's
93 */ 93 */
94static void inline unmask_gpio_irq(u32 irq) 94static void inline unmask_gpio_irq(struct irq_data *d)
95{ 95{
96 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq)); 96 u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(d->irq));
97 u32 bit = IRQ_TO_BIT(irq); 97 u32 bit = IRQ_TO_BIT(d->irq);
98 CPU_REG (reg_base, GPIO_MASK) |= bit; 98 CPU_REG (reg_base, GPIO_MASK) |= bit;
99} 99}
100 100
@@ -170,15 +170,15 @@ h720x_gpioe_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
170#endif 170#endif
171 171
172static struct irq_chip h720x_global_chip = { 172static struct irq_chip h720x_global_chip = {
173 .ack = mask_global_irq, 173 .irq_ack = mask_global_irq,
174 .mask = mask_global_irq, 174 .irq_mask = mask_global_irq,
175 .unmask = unmask_global_irq, 175 .irq_unmask = unmask_global_irq,
176}; 176};
177 177
178static struct irq_chip h720x_gpio_chip = { 178static struct irq_chip h720x_gpio_chip = {
179 .ack = ack_gpio_irq, 179 .irq_ack = ack_gpio_irq,
180 .mask = mask_gpio_irq, 180 .irq_mask = mask_gpio_irq,
181 .unmask = unmask_gpio_irq, 181 .irq_unmask = unmask_gpio_irq,
182}; 182};
183 183
184/* 184/*
diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c
index fd33a19c813a..ac3f91442376 100644
--- a/arch/arm/mach-h720x/cpu-h7202.c
+++ b/arch/arm/mach-h720x/cpu-h7202.c
@@ -141,27 +141,27 @@ h7202_timer_interrupt(int irq, void *dev_id)
141/* 141/*
142 * mask multiplexed timer IRQs 142 * mask multiplexed timer IRQs
143 */ 143 */
144static void inline mask_timerx_irq (u32 irq) 144static void inline mask_timerx_irq(struct irq_data *d)
145{ 145{
146 unsigned int bit; 146 unsigned int bit;
147 bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1)); 147 bit = 2 << ((d->irq == IRQ_TIMER64B) ? 4 : (d->irq - IRQ_TIMER1));
148 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) &= ~bit; 148 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) &= ~bit;
149} 149}
150 150
151/* 151/*
152 * unmask multiplexed timer IRQs 152 * unmask multiplexed timer IRQs
153 */ 153 */
154static void inline unmask_timerx_irq (u32 irq) 154static void inline unmask_timerx_irq(struct irq_data *d)
155{ 155{
156 unsigned int bit; 156 unsigned int bit;
157 bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1)); 157 bit = 2 << ((d->irq == IRQ_TIMER64B) ? 4 : (d->irq - IRQ_TIMER1));
158 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) |= bit; 158 CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) |= bit;
159} 159}
160 160
161static struct irq_chip h7202_timerx_chip = { 161static struct irq_chip h7202_timerx_chip = {
162 .ack = mask_timerx_irq, 162 .irq_ack = mask_timerx_irq,
163 .mask = mask_timerx_irq, 163 .irq_mask = mask_timerx_irq,
164 .unmask = unmask_timerx_irq, 164 .irq_unmask = unmask_timerx_irq,
165}; 165};
166 166
167static struct irqaction h7202_timer_irq = { 167static struct irqaction h7202_timer_irq = {
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 17d2e608a214..56684b517070 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -243,6 +243,7 @@ config MACH_MX27_3DS
243 select IMX_HAVE_PLATFORM_MXC_EHCI 243 select IMX_HAVE_PLATFORM_MXC_EHCI
244 select IMX_HAVE_PLATFORM_MXC_MMC 244 select IMX_HAVE_PLATFORM_MXC_MMC
245 select IMX_HAVE_PLATFORM_SPI_IMX 245 select IMX_HAVE_PLATFORM_SPI_IMX
246 select MXC_DEBUG_BOARD
246 select MXC_ULPI if USB_ULPI 247 select MXC_ULPI if USB_ULPI
247 help 248 help
248 Include support for MX27PDK platform. This includes specific 249 Include support for MX27PDK platform. This includes specific
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 6fd0f8f6deb6..164331518bdd 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -37,12 +37,15 @@
37#include <mach/common.h> 37#include <mach/common.h>
38#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
39#include <mach/ulpi.h> 39#include <mach/ulpi.h>
40#include <mach/irqs.h>
41#include <mach/3ds_debugboard.h>
40 42
41#include "devices-imx27.h" 43#include "devices-imx27.h"
42 44
43#define SD1_EN_GPIO (GPIO_PORTB + 25) 45#define SD1_EN_GPIO (GPIO_PORTB + 25)
44#define OTG_PHY_RESET_GPIO (GPIO_PORTB + 23) 46#define OTG_PHY_RESET_GPIO (GPIO_PORTB + 23)
45#define SPI2_SS0 (GPIO_PORTD + 21) 47#define SPI2_SS0 (GPIO_PORTD + 21)
48#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTC + 28)
46 49
47static const int mx27pdk_pins[] __initconst = { 50static const int mx27pdk_pins[] __initconst = {
48 /* UART1 */ 51 /* UART1 */
@@ -215,10 +218,10 @@ static struct regulator_init_data vgen_init = {
215 218
216static struct mc13783_regulator_init_data mx27_3ds_regulators[] = { 219static struct mc13783_regulator_init_data mx27_3ds_regulators[] = {
217 { 220 {
218 .id = MC13783_REGU_VMMC1, 221 .id = MC13783_REG_VMMC1,
219 .init_data = &vmmc1_init, 222 .init_data = &vmmc1_init,
220 }, { 223 }, {
221 .id = MC13783_REGU_VGEN, 224 .id = MC13783_REG_VGEN,
222 .init_data = &vgen_init, 225 .init_data = &vgen_init,
223 }, 226 },
224}; 227};
@@ -276,6 +279,9 @@ static void __init mx27pdk_init(void)
276 imx27_add_spi_imx1(&spi2_pdata); 279 imx27_add_spi_imx1(&spi2_pdata);
277 spi_register_board_info(mx27_3ds_spi_devs, 280 spi_register_board_info(mx27_3ds_spi_devs,
278 ARRAY_SIZE(mx27_3ds_spi_devs)); 281 ARRAY_SIZE(mx27_3ds_spi_devs));
282
283 if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT))
284 pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n");
279} 285}
280 286
281static void __init mx27pdk_timer_init(void) 287static void __init mx27pdk_timer_init(void)
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 2774df8021dc..b666443b5cbb 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -156,21 +156,21 @@ static void __init ap_map_io(void)
156 156
157#define INTEGRATOR_SC_VALID_INT 0x003fffff 157#define INTEGRATOR_SC_VALID_INT 0x003fffff
158 158
159static void sc_mask_irq(unsigned int irq) 159static void sc_mask_irq(struct irq_data *d)
160{ 160{
161 writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_CLEAR); 161 writel(1 << d->irq, VA_IC_BASE + IRQ_ENABLE_CLEAR);
162} 162}
163 163
164static void sc_unmask_irq(unsigned int irq) 164static void sc_unmask_irq(struct irq_data *d)
165{ 165{
166 writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_SET); 166 writel(1 << d->irq, VA_IC_BASE + IRQ_ENABLE_SET);
167} 167}
168 168
169static struct irq_chip sc_chip = { 169static struct irq_chip sc_chip = {
170 .name = "SC", 170 .name = "SC",
171 .ack = sc_mask_irq, 171 .irq_ack = sc_mask_irq,
172 .mask = sc_mask_irq, 172 .irq_mask = sc_mask_irq,
173 .unmask = sc_unmask_irq, 173 .irq_unmask = sc_unmask_irq,
174}; 174};
175 175
176static void __init ap_init_irq(void) 176static void __init ap_init_irq(void)
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 85e48a5f77b9..e9327da1382e 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -146,61 +146,61 @@ static void __init intcp_map_io(void)
146#define sic_writel __raw_writel 146#define sic_writel __raw_writel
147#define sic_readl __raw_readl 147#define sic_readl __raw_readl
148 148
149static void cic_mask_irq(unsigned int irq) 149static void cic_mask_irq(struct irq_data *d)
150{ 150{
151 irq -= IRQ_CIC_START; 151 unsigned int irq = d->irq - IRQ_CIC_START;
152 cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR); 152 cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
153} 153}
154 154
155static void cic_unmask_irq(unsigned int irq) 155static void cic_unmask_irq(struct irq_data *d)
156{ 156{
157 irq -= IRQ_CIC_START; 157 unsigned int irq = d->irq - IRQ_CIC_START;
158 cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_SET); 158 cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_SET);
159} 159}
160 160
161static struct irq_chip cic_chip = { 161static struct irq_chip cic_chip = {
162 .name = "CIC", 162 .name = "CIC",
163 .ack = cic_mask_irq, 163 .irq_ack = cic_mask_irq,
164 .mask = cic_mask_irq, 164 .irq_mask = cic_mask_irq,
165 .unmask = cic_unmask_irq, 165 .irq_unmask = cic_unmask_irq,
166}; 166};
167 167
168static void pic_mask_irq(unsigned int irq) 168static void pic_mask_irq(struct irq_data *d)
169{ 169{
170 irq -= IRQ_PIC_START; 170 unsigned int irq = d->irq - IRQ_PIC_START;
171 pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR); 171 pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
172} 172}
173 173
174static void pic_unmask_irq(unsigned int irq) 174static void pic_unmask_irq(struct irq_data *d)
175{ 175{
176 irq -= IRQ_PIC_START; 176 unsigned int irq = d->irq - IRQ_PIC_START;
177 pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_SET); 177 pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_SET);
178} 178}
179 179
180static struct irq_chip pic_chip = { 180static struct irq_chip pic_chip = {
181 .name = "PIC", 181 .name = "PIC",
182 .ack = pic_mask_irq, 182 .irq_ack = pic_mask_irq,
183 .mask = pic_mask_irq, 183 .irq_mask = pic_mask_irq,
184 .unmask = pic_unmask_irq, 184 .irq_unmask = pic_unmask_irq,
185}; 185};
186 186
187static void sic_mask_irq(unsigned int irq) 187static void sic_mask_irq(struct irq_data *d)
188{ 188{
189 irq -= IRQ_SIC_START; 189 unsigned int irq = d->irq - IRQ_SIC_START;
190 sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR); 190 sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
191} 191}
192 192
193static void sic_unmask_irq(unsigned int irq) 193static void sic_unmask_irq(struct irq_data *d)
194{ 194{
195 irq -= IRQ_SIC_START; 195 unsigned int irq = d->irq - IRQ_SIC_START;
196 sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_SET); 196 sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_SET);
197} 197}
198 198
199static struct irq_chip sic_chip = { 199static struct irq_chip sic_chip = {
200 .name = "SIC", 200 .name = "SIC",
201 .ack = sic_mask_irq, 201 .irq_ack = sic_mask_irq,
202 .mask = sic_mask_irq, 202 .irq_mask = sic_mask_irq,
203 .unmask = sic_unmask_irq, 203 .irq_unmask = sic_unmask_irq,
204}; 204};
205 205
206static void 206static void
diff --git a/arch/arm/mach-iop13xx/irq.c b/arch/arm/mach-iop13xx/irq.c
index 0d099ca87bdf..a233470dd10c 100644
--- a/arch/arm/mach-iop13xx/irq.c
+++ b/arch/arm/mach-iop13xx/irq.c
@@ -123,79 +123,79 @@ static void write_intsize(u32 val)
123 123
124/* 0 = Interrupt Masked and 1 = Interrupt not masked */ 124/* 0 = Interrupt Masked and 1 = Interrupt not masked */
125static void 125static void
126iop13xx_irq_mask0 (unsigned int irq) 126iop13xx_irq_mask0 (struct irq_data *d)
127{ 127{
128 write_intctl_0(read_intctl_0() & ~(1 << (irq - 0))); 128 write_intctl_0(read_intctl_0() & ~(1 << (d->irq - 0)));
129} 129}
130 130
131static void 131static void
132iop13xx_irq_mask1 (unsigned int irq) 132iop13xx_irq_mask1 (struct irq_data *d)
133{ 133{
134 write_intctl_1(read_intctl_1() & ~(1 << (irq - 32))); 134 write_intctl_1(read_intctl_1() & ~(1 << (d->irq - 32)));
135} 135}
136 136
137static void 137static void
138iop13xx_irq_mask2 (unsigned int irq) 138iop13xx_irq_mask2 (struct irq_data *d)
139{ 139{
140 write_intctl_2(read_intctl_2() & ~(1 << (irq - 64))); 140 write_intctl_2(read_intctl_2() & ~(1 << (d->irq - 64)));
141} 141}
142 142
143static void 143static void
144iop13xx_irq_mask3 (unsigned int irq) 144iop13xx_irq_mask3 (struct irq_data *d)
145{ 145{
146 write_intctl_3(read_intctl_3() & ~(1 << (irq - 96))); 146 write_intctl_3(read_intctl_3() & ~(1 << (d->irq - 96)));
147} 147}
148 148
149static void 149static void
150iop13xx_irq_unmask0(unsigned int irq) 150iop13xx_irq_unmask0(struct irq_data *d)
151{ 151{
152 write_intctl_0(read_intctl_0() | (1 << (irq - 0))); 152 write_intctl_0(read_intctl_0() | (1 << (d->irq - 0)));
153} 153}
154 154
155static void 155static void
156iop13xx_irq_unmask1(unsigned int irq) 156iop13xx_irq_unmask1(struct irq_data *d)
157{ 157{
158 write_intctl_1(read_intctl_1() | (1 << (irq - 32))); 158 write_intctl_1(read_intctl_1() | (1 << (d->irq - 32)));
159} 159}
160 160
161static void 161static void
162iop13xx_irq_unmask2(unsigned int irq) 162iop13xx_irq_unmask2(struct irq_data *d)
163{ 163{
164 write_intctl_2(read_intctl_2() | (1 << (irq - 64))); 164 write_intctl_2(read_intctl_2() | (1 << (d->irq - 64)));
165} 165}
166 166
167static void 167static void
168iop13xx_irq_unmask3(unsigned int irq) 168iop13xx_irq_unmask3(struct irq_data *d)
169{ 169{
170 write_intctl_3(read_intctl_3() | (1 << (irq - 96))); 170 write_intctl_3(read_intctl_3() | (1 << (d->irq - 96)));
171} 171}
172 172
173static struct irq_chip iop13xx_irqchip1 = { 173static struct irq_chip iop13xx_irqchip1 = {
174 .name = "IOP13xx-1", 174 .name = "IOP13xx-1",
175 .ack = iop13xx_irq_mask0, 175 .irq_ack = iop13xx_irq_mask0,
176 .mask = iop13xx_irq_mask0, 176 .irq_mask = iop13xx_irq_mask0,
177 .unmask = iop13xx_irq_unmask0, 177 .irq_unmask = iop13xx_irq_unmask0,
178}; 178};
179 179
180static struct irq_chip iop13xx_irqchip2 = { 180static struct irq_chip iop13xx_irqchip2 = {
181 .name = "IOP13xx-2", 181 .name = "IOP13xx-2",
182 .ack = iop13xx_irq_mask1, 182 .irq_ack = iop13xx_irq_mask1,
183 .mask = iop13xx_irq_mask1, 183 .irq_mask = iop13xx_irq_mask1,
184 .unmask = iop13xx_irq_unmask1, 184 .irq_unmask = iop13xx_irq_unmask1,
185}; 185};
186 186
187static struct irq_chip iop13xx_irqchip3 = { 187static struct irq_chip iop13xx_irqchip3 = {
188 .name = "IOP13xx-3", 188 .name = "IOP13xx-3",
189 .ack = iop13xx_irq_mask2, 189 .irq_ack = iop13xx_irq_mask2,
190 .mask = iop13xx_irq_mask2, 190 .irq_mask = iop13xx_irq_mask2,
191 .unmask = iop13xx_irq_unmask2, 191 .irq_unmask = iop13xx_irq_unmask2,
192}; 192};
193 193
194static struct irq_chip iop13xx_irqchip4 = { 194static struct irq_chip iop13xx_irqchip4 = {
195 .name = "IOP13xx-4", 195 .name = "IOP13xx-4",
196 .ack = iop13xx_irq_mask3, 196 .irq_ack = iop13xx_irq_mask3,
197 .mask = iop13xx_irq_mask3, 197 .irq_mask = iop13xx_irq_mask3,
198 .unmask = iop13xx_irq_unmask3, 198 .irq_unmask = iop13xx_irq_unmask3,
199}; 199};
200 200
201extern void iop_init_cp6_handler(void); 201extern void iop_init_cp6_handler(void);
diff --git a/arch/arm/mach-iop13xx/msi.c b/arch/arm/mach-iop13xx/msi.c
index 7149fcc16c8a..c9c02e3698bc 100644
--- a/arch/arm/mach-iop13xx/msi.c
+++ b/arch/arm/mach-iop13xx/msi.c
@@ -156,14 +156,14 @@ void arch_teardown_msi_irq(unsigned int irq)
156 destroy_irq(irq); 156 destroy_irq(irq);
157} 157}
158 158
159static void iop13xx_msi_nop(unsigned int irq) 159static void iop13xx_msi_nop(struct irq_data *d)
160{ 160{
161 return; 161 return;
162} 162}
163 163
164static struct irq_chip iop13xx_msi_chip = { 164static struct irq_chip iop13xx_msi_chip = {
165 .name = "PCI-MSI", 165 .name = "PCI-MSI",
166 .ack = iop13xx_msi_nop, 166 .irq_ack = iop13xx_msi_nop,
167 .irq_enable = unmask_msi_irq, 167 .irq_enable = unmask_msi_irq,
168 .irq_disable = mask_msi_irq, 168 .irq_disable = mask_msi_irq,
169 .irq_mask = mask_msi_irq, 169 .irq_mask = mask_msi_irq,
diff --git a/arch/arm/mach-iop32x/irq.c b/arch/arm/mach-iop32x/irq.c
index ba59b2d17db1..d3426a120599 100644
--- a/arch/arm/mach-iop32x/irq.c
+++ b/arch/arm/mach-iop32x/irq.c
@@ -32,24 +32,24 @@ static void intstr_write(u32 val)
32} 32}
33 33
34static void 34static void
35iop32x_irq_mask(unsigned int irq) 35iop32x_irq_mask(struct irq_data *d)
36{ 36{
37 iop32x_mask &= ~(1 << irq); 37 iop32x_mask &= ~(1 << d->irq);
38 intctl_write(iop32x_mask); 38 intctl_write(iop32x_mask);
39} 39}
40 40
41static void 41static void
42iop32x_irq_unmask(unsigned int irq) 42iop32x_irq_unmask(struct irq_data *d)
43{ 43{
44 iop32x_mask |= 1 << irq; 44 iop32x_mask |= 1 << d->irq;
45 intctl_write(iop32x_mask); 45 intctl_write(iop32x_mask);
46} 46}
47 47
48struct irq_chip ext_chip = { 48struct irq_chip ext_chip = {
49 .name = "IOP32x", 49 .name = "IOP32x",
50 .ack = iop32x_irq_mask, 50 .irq_ack = iop32x_irq_mask,
51 .mask = iop32x_irq_mask, 51 .irq_mask = iop32x_irq_mask,
52 .unmask = iop32x_irq_unmask, 52 .irq_unmask = iop32x_irq_unmask,
53}; 53};
54 54
55void __init iop32x_init_irq(void) 55void __init iop32x_init_irq(void)
diff --git a/arch/arm/mach-iop33x/irq.c b/arch/arm/mach-iop33x/irq.c
index abb4ea2ed4fd..0ff2f74363a5 100644
--- a/arch/arm/mach-iop33x/irq.c
+++ b/arch/arm/mach-iop33x/irq.c
@@ -53,45 +53,45 @@ static void intsize_write(u32 val)
53} 53}
54 54
55static void 55static void
56iop33x_irq_mask1 (unsigned int irq) 56iop33x_irq_mask1 (struct irq_data *d)
57{ 57{
58 iop33x_mask0 &= ~(1 << irq); 58 iop33x_mask0 &= ~(1 << d->irq);
59 intctl0_write(iop33x_mask0); 59 intctl0_write(iop33x_mask0);
60} 60}
61 61
62static void 62static void
63iop33x_irq_mask2 (unsigned int irq) 63iop33x_irq_mask2 (struct irq_data *d)
64{ 64{
65 iop33x_mask1 &= ~(1 << (irq - 32)); 65 iop33x_mask1 &= ~(1 << (d->irq - 32));
66 intctl1_write(iop33x_mask1); 66 intctl1_write(iop33x_mask1);
67} 67}
68 68
69static void 69static void
70iop33x_irq_unmask1(unsigned int irq) 70iop33x_irq_unmask1(struct irq_data *d)
71{ 71{
72 iop33x_mask0 |= 1 << irq; 72 iop33x_mask0 |= 1 << d->irq;
73 intctl0_write(iop33x_mask0); 73 intctl0_write(iop33x_mask0);
74} 74}
75 75
76static void 76static void
77iop33x_irq_unmask2(unsigned int irq) 77iop33x_irq_unmask2(struct irq_data *d)
78{ 78{
79 iop33x_mask1 |= (1 << (irq - 32)); 79 iop33x_mask1 |= (1 << (d->irq - 32));
80 intctl1_write(iop33x_mask1); 80 intctl1_write(iop33x_mask1);
81} 81}
82 82
83struct irq_chip iop33x_irqchip1 = { 83struct irq_chip iop33x_irqchip1 = {
84 .name = "IOP33x-1", 84 .name = "IOP33x-1",
85 .ack = iop33x_irq_mask1, 85 .irq_ack = iop33x_irq_mask1,
86 .mask = iop33x_irq_mask1, 86 .irq_mask = iop33x_irq_mask1,
87 .unmask = iop33x_irq_unmask1, 87 .irq_unmask = iop33x_irq_unmask1,
88}; 88};
89 89
90struct irq_chip iop33x_irqchip2 = { 90struct irq_chip iop33x_irqchip2 = {
91 .name = "IOP33x-2", 91 .name = "IOP33x-2",
92 .ack = iop33x_irq_mask2, 92 .irq_ack = iop33x_irq_mask2,
93 .mask = iop33x_irq_mask2, 93 .irq_mask = iop33x_irq_mask2,
94 .unmask = iop33x_irq_unmask2, 94 .irq_unmask = iop33x_irq_unmask2,
95}; 95};
96 96
97void __init iop33x_init_irq(void) 97void __init iop33x_init_irq(void)
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index e24e3d05397f..5fc4e064b650 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -309,9 +309,9 @@ static void ixp2000_GPIO_irq_handler(unsigned int irq, struct irq_desc *desc)
309 } 309 }
310} 310}
311 311
312static int ixp2000_GPIO_irq_type(unsigned int irq, unsigned int type) 312static int ixp2000_GPIO_irq_type(struct irq_data *d, unsigned int type)
313{ 313{
314 int line = irq - IRQ_IXP2000_GPIO0; 314 int line = d->irq - IRQ_IXP2000_GPIO0;
315 315
316 /* 316 /*
317 * First, configure this GPIO line as an input. 317 * First, configure this GPIO line as an input.
@@ -342,8 +342,10 @@ static int ixp2000_GPIO_irq_type(unsigned int irq, unsigned int type)
342 return 0; 342 return 0;
343} 343}
344 344
345static void ixp2000_GPIO_irq_mask_ack(unsigned int irq) 345static void ixp2000_GPIO_irq_mask_ack(struct irq_data *d)
346{ 346{
347 unsigned int irq = d->irq;
348
347 ixp2000_reg_write(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0))); 349 ixp2000_reg_write(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0)));
348 350
349 ixp2000_reg_write(IXP2000_GPIO_EDSR, (1 << (irq - IRQ_IXP2000_GPIO0))); 351 ixp2000_reg_write(IXP2000_GPIO_EDSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
@@ -351,38 +353,42 @@ static void ixp2000_GPIO_irq_mask_ack(unsigned int irq)
351 ixp2000_reg_wrb(IXP2000_GPIO_INST, (1 << (irq - IRQ_IXP2000_GPIO0))); 353 ixp2000_reg_wrb(IXP2000_GPIO_INST, (1 << (irq - IRQ_IXP2000_GPIO0)));
352} 354}
353 355
354static void ixp2000_GPIO_irq_mask(unsigned int irq) 356static void ixp2000_GPIO_irq_mask(struct irq_data *d)
355{ 357{
358 unsigned int irq = d->irq;
359
356 ixp2000_reg_wrb(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0))); 360 ixp2000_reg_wrb(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0)));
357} 361}
358 362
359static void ixp2000_GPIO_irq_unmask(unsigned int irq) 363static void ixp2000_GPIO_irq_unmask(struct irq_data *d)
360{ 364{
365 unsigned int irq = d->irq;
366
361 ixp2000_reg_write(IXP2000_GPIO_INSR, (1 << (irq - IRQ_IXP2000_GPIO0))); 367 ixp2000_reg_write(IXP2000_GPIO_INSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
362} 368}
363 369
364static struct irq_chip ixp2000_GPIO_irq_chip = { 370static struct irq_chip ixp2000_GPIO_irq_chip = {
365 .ack = ixp2000_GPIO_irq_mask_ack, 371 .irq_ack = ixp2000_GPIO_irq_mask_ack,
366 .mask = ixp2000_GPIO_irq_mask, 372 .irq_mask = ixp2000_GPIO_irq_mask,
367 .unmask = ixp2000_GPIO_irq_unmask, 373 .irq_unmask = ixp2000_GPIO_irq_unmask,
368 .set_type = ixp2000_GPIO_irq_type, 374 .irq_set_type = ixp2000_GPIO_irq_type,
369}; 375};
370 376
371static void ixp2000_pci_irq_mask(unsigned int irq) 377static void ixp2000_pci_irq_mask(struct irq_data *d)
372{ 378{
373 unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE; 379 unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE;
374 if (irq == IRQ_IXP2000_PCIA) 380 if (d->irq == IRQ_IXP2000_PCIA)
375 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 26))); 381 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 26)));
376 else if (irq == IRQ_IXP2000_PCIB) 382 else if (d->irq == IRQ_IXP2000_PCIB)
377 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 27))); 383 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 27)));
378} 384}
379 385
380static void ixp2000_pci_irq_unmask(unsigned int irq) 386static void ixp2000_pci_irq_unmask(struct irq_data *d)
381{ 387{
382 unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE; 388 unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE;
383 if (irq == IRQ_IXP2000_PCIA) 389 if (d->irq == IRQ_IXP2000_PCIA)
384 ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 26))); 390 ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 26)));
385 else if (irq == IRQ_IXP2000_PCIB) 391 else if (d->irq == IRQ_IXP2000_PCIB)
386 ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 27))); 392 ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 27)));
387} 393}
388 394
@@ -401,44 +407,44 @@ static void ixp2000_err_irq_handler(unsigned int irq, struct irq_desc *desc)
401 } 407 }
402} 408}
403 409
404static void ixp2000_err_irq_mask(unsigned int irq) 410static void ixp2000_err_irq_mask(struct irq_data *d)
405{ 411{
406 ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_CLR, 412 ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_CLR,
407 (1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR))); 413 (1 << (d->irq - IRQ_IXP2000_DRAM0_MIN_ERR)));
408} 414}
409 415
410static void ixp2000_err_irq_unmask(unsigned int irq) 416static void ixp2000_err_irq_unmask(struct irq_data *d)
411{ 417{
412 ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_SET, 418 ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_SET,
413 (1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR))); 419 (1 << (d->irq - IRQ_IXP2000_DRAM0_MIN_ERR)));
414} 420}
415 421
416static struct irq_chip ixp2000_err_irq_chip = { 422static struct irq_chip ixp2000_err_irq_chip = {
417 .ack = ixp2000_err_irq_mask, 423 .irq_ack = ixp2000_err_irq_mask,
418 .mask = ixp2000_err_irq_mask, 424 .irq_mask = ixp2000_err_irq_mask,
419 .unmask = ixp2000_err_irq_unmask 425 .irq_unmask = ixp2000_err_irq_unmask
420}; 426};
421 427
422static struct irq_chip ixp2000_pci_irq_chip = { 428static struct irq_chip ixp2000_pci_irq_chip = {
423 .ack = ixp2000_pci_irq_mask, 429 .irq_ack = ixp2000_pci_irq_mask,
424 .mask = ixp2000_pci_irq_mask, 430 .irq_mask = ixp2000_pci_irq_mask,
425 .unmask = ixp2000_pci_irq_unmask 431 .irq_unmask = ixp2000_pci_irq_unmask
426}; 432};
427 433
428static void ixp2000_irq_mask(unsigned int irq) 434static void ixp2000_irq_mask(struct irq_data *d)
429{ 435{
430 ixp2000_reg_wrb(IXP2000_IRQ_ENABLE_CLR, (1 << irq)); 436 ixp2000_reg_wrb(IXP2000_IRQ_ENABLE_CLR, (1 << d->irq));
431} 437}
432 438
433static void ixp2000_irq_unmask(unsigned int irq) 439static void ixp2000_irq_unmask(struct irq_data *d)
434{ 440{
435 ixp2000_reg_write(IXP2000_IRQ_ENABLE_SET, (1 << irq)); 441 ixp2000_reg_write(IXP2000_IRQ_ENABLE_SET, (1 << d->irq));
436} 442}
437 443
438static struct irq_chip ixp2000_irq_chip = { 444static struct irq_chip ixp2000_irq_chip = {
439 .ack = ixp2000_irq_mask, 445 .irq_ack = ixp2000_irq_mask,
440 .mask = ixp2000_irq_mask, 446 .irq_mask = ixp2000_irq_mask,
441 .unmask = ixp2000_irq_unmask 447 .irq_unmask = ixp2000_irq_unmask
442}; 448};
443 449
444void __init ixp2000_init_irq(void) 450void __init ixp2000_init_irq(void)
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index 91fffb9b2084..7d90d3f13ee8 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -63,7 +63,7 @@ static struct slowport_cfg slowport_cpld_cfg = {
63}; 63};
64#endif 64#endif
65 65
66static void ixdp2x00_irq_mask(unsigned int irq) 66static void ixdp2x00_irq_mask(struct irq_data *d)
67{ 67{
68 unsigned long dummy; 68 unsigned long dummy;
69 static struct slowport_cfg old_cfg; 69 static struct slowport_cfg old_cfg;
@@ -78,7 +78,7 @@ static void ixdp2x00_irq_mask(unsigned int irq)
78#endif 78#endif
79 79
80 dummy = *board_irq_mask; 80 dummy = *board_irq_mask;
81 dummy |= IXP2000_BOARD_IRQ_MASK(irq); 81 dummy |= IXP2000_BOARD_IRQ_MASK(d->irq);
82 ixp2000_reg_wrb(board_irq_mask, dummy); 82 ixp2000_reg_wrb(board_irq_mask, dummy);
83 83
84#ifdef CONFIG_ARCH_IXDP2400 84#ifdef CONFIG_ARCH_IXDP2400
@@ -87,7 +87,7 @@ static void ixdp2x00_irq_mask(unsigned int irq)
87#endif 87#endif
88} 88}
89 89
90static void ixdp2x00_irq_unmask(unsigned int irq) 90static void ixdp2x00_irq_unmask(struct irq_data *d)
91{ 91{
92 unsigned long dummy; 92 unsigned long dummy;
93 static struct slowport_cfg old_cfg; 93 static struct slowport_cfg old_cfg;
@@ -98,7 +98,7 @@ static void ixdp2x00_irq_unmask(unsigned int irq)
98#endif 98#endif
99 99
100 dummy = *board_irq_mask; 100 dummy = *board_irq_mask;
101 dummy &= ~IXP2000_BOARD_IRQ_MASK(irq); 101 dummy &= ~IXP2000_BOARD_IRQ_MASK(d->irq);
102 ixp2000_reg_wrb(board_irq_mask, dummy); 102 ixp2000_reg_wrb(board_irq_mask, dummy);
103 103
104 if (machine_is_ixdp2400()) 104 if (machine_is_ixdp2400())
@@ -111,7 +111,7 @@ static void ixdp2x00_irq_handler(unsigned int irq, struct irq_desc *desc)
111 static struct slowport_cfg old_cfg; 111 static struct slowport_cfg old_cfg;
112 int i; 112 int i;
113 113
114 desc->chip->mask(irq); 114 desc->irq_data.chip->irq_mask(&desc->irq_data);
115 115
116#ifdef CONFIG_ARCH_IXDP2400 116#ifdef CONFIG_ARCH_IXDP2400
117 if (machine_is_ixdp2400()) 117 if (machine_is_ixdp2400())
@@ -133,13 +133,13 @@ static void ixdp2x00_irq_handler(unsigned int irq, struct irq_desc *desc)
133 } 133 }
134 } 134 }
135 135
136 desc->chip->unmask(irq); 136 desc->irq_data.chip->irq_unmask(&desc->irq_data);
137} 137}
138 138
139static struct irq_chip ixdp2x00_cpld_irq_chip = { 139static struct irq_chip ixdp2x00_cpld_irq_chip = {
140 .ack = ixdp2x00_irq_mask, 140 .irq_ack = ixdp2x00_irq_mask,
141 .mask = ixdp2x00_irq_mask, 141 .irq_mask = ixdp2x00_irq_mask,
142 .unmask = ixdp2x00_irq_unmask 142 .irq_unmask = ixdp2x00_irq_unmask
143}; 143};
144 144
145void __init ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long *mask_reg, unsigned long nr_of_irqs) 145void __init ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long *mask_reg, unsigned long nr_of_irqs)
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index 6c121bdbe311..34b1b2af37c8 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -48,16 +48,16 @@
48/************************************************************************* 48/*************************************************************************
49 * IXDP2x01 IRQ Handling 49 * IXDP2x01 IRQ Handling
50 *************************************************************************/ 50 *************************************************************************/
51static void ixdp2x01_irq_mask(unsigned int irq) 51static void ixdp2x01_irq_mask(struct irq_data *d)
52{ 52{
53 ixp2000_reg_wrb(IXDP2X01_INT_MASK_SET_REG, 53 ixp2000_reg_wrb(IXDP2X01_INT_MASK_SET_REG,
54 IXP2000_BOARD_IRQ_MASK(irq)); 54 IXP2000_BOARD_IRQ_MASK(d->irq));
55} 55}
56 56
57static void ixdp2x01_irq_unmask(unsigned int irq) 57static void ixdp2x01_irq_unmask(struct irq_data *d)
58{ 58{
59 ixp2000_reg_write(IXDP2X01_INT_MASK_CLR_REG, 59 ixp2000_reg_write(IXDP2X01_INT_MASK_CLR_REG,
60 IXP2000_BOARD_IRQ_MASK(irq)); 60 IXP2000_BOARD_IRQ_MASK(d->irq));
61} 61}
62 62
63static u32 valid_irq_mask; 63static u32 valid_irq_mask;
@@ -67,7 +67,7 @@ static void ixdp2x01_irq_handler(unsigned int irq, struct irq_desc *desc)
67 u32 ex_interrupt; 67 u32 ex_interrupt;
68 int i; 68 int i;
69 69
70 desc->chip->mask(irq); 70 desc->irq_data.chip->irq_mask(&desc->irq_data);
71 71
72 ex_interrupt = *IXDP2X01_INT_STAT_REG & valid_irq_mask; 72 ex_interrupt = *IXDP2X01_INT_STAT_REG & valid_irq_mask;
73 73
@@ -83,13 +83,13 @@ static void ixdp2x01_irq_handler(unsigned int irq, struct irq_desc *desc)
83 } 83 }
84 } 84 }
85 85
86 desc->chip->unmask(irq); 86 desc->irq_data.chip->irq_unmask(&desc->irq_data);
87} 87}
88 88
89static struct irq_chip ixdp2x01_irq_chip = { 89static struct irq_chip ixdp2x01_irq_chip = {
90 .mask = ixdp2x01_irq_mask, 90 .irq_mask = ixdp2x01_irq_mask,
91 .ack = ixdp2x01_irq_mask, 91 .irq_ack = ixdp2x01_irq_mask,
92 .unmask = ixdp2x01_irq_unmask 92 .irq_unmask = ixdp2x01_irq_unmask
93}; 93};
94 94
95/* 95/*
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index aa4c4420ff3d..9c8a33903216 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -111,9 +111,9 @@ enum ixp23xx_irq_type {
111 111
112static void ixp23xx_config_irq(unsigned int, enum ixp23xx_irq_type); 112static void ixp23xx_config_irq(unsigned int, enum ixp23xx_irq_type);
113 113
114static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type) 114static int ixp23xx_irq_set_type(struct irq_data *d, unsigned int type)
115{ 115{
116 int line = irq - IRQ_IXP23XX_GPIO6 + 6; 116 int line = d->irq - IRQ_IXP23XX_GPIO6 + 6;
117 u32 int_style; 117 u32 int_style;
118 enum ixp23xx_irq_type irq_type; 118 enum ixp23xx_irq_type irq_type;
119 volatile u32 *int_reg; 119 volatile u32 *int_reg;
@@ -149,7 +149,7 @@ static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
149 return -EINVAL; 149 return -EINVAL;
150 } 150 }
151 151
152 ixp23xx_config_irq(irq, irq_type); 152 ixp23xx_config_irq(d->irq, irq_type);
153 153
154 if (line >= 8) { /* pins 8-15 */ 154 if (line >= 8) { /* pins 8-15 */
155 line -= 8; 155 line -= 8;
@@ -173,9 +173,10 @@ static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
173 return 0; 173 return 0;
174} 174}
175 175
176static void ixp23xx_irq_mask(unsigned int irq) 176static void ixp23xx_irq_mask(struct irq_data *d)
177{ 177{
178 volatile unsigned long *intr_reg; 178 volatile unsigned long *intr_reg;
179 unsigned int irq = d->irq;
179 180
180 if (irq >= 56) 181 if (irq >= 56)
181 irq += 8; 182 irq += 8;
@@ -184,9 +185,9 @@ static void ixp23xx_irq_mask(unsigned int irq)
184 *intr_reg &= ~(1 << (irq % 32)); 185 *intr_reg &= ~(1 << (irq % 32));
185} 186}
186 187
187static void ixp23xx_irq_ack(unsigned int irq) 188static void ixp23xx_irq_ack(struct irq_data *d)
188{ 189{
189 int line = irq - IRQ_IXP23XX_GPIO6 + 6; 190 int line = d->irq - IRQ_IXP23XX_GPIO6 + 6;
190 191
191 if ((line < 6) || (line > 15)) 192 if ((line < 6) || (line > 15))
192 return; 193 return;
@@ -198,11 +199,12 @@ static void ixp23xx_irq_ack(unsigned int irq)
198 * Level triggered interrupts on GPIO lines can only be cleared when the 199 * Level triggered interrupts on GPIO lines can only be cleared when the
199 * interrupt condition disappears. 200 * interrupt condition disappears.
200 */ 201 */
201static void ixp23xx_irq_level_unmask(unsigned int irq) 202static void ixp23xx_irq_level_unmask(struct irq_data *d)
202{ 203{
203 volatile unsigned long *intr_reg; 204 volatile unsigned long *intr_reg;
205 unsigned int irq = d->irq;
204 206
205 ixp23xx_irq_ack(irq); 207 ixp23xx_irq_ack(d);
206 208
207 if (irq >= 56) 209 if (irq >= 56)
208 irq += 8; 210 irq += 8;
@@ -211,9 +213,10 @@ static void ixp23xx_irq_level_unmask(unsigned int irq)
211 *intr_reg |= (1 << (irq % 32)); 213 *intr_reg |= (1 << (irq % 32));
212} 214}
213 215
214static void ixp23xx_irq_edge_unmask(unsigned int irq) 216static void ixp23xx_irq_edge_unmask(struct irq_data *d)
215{ 217{
216 volatile unsigned long *intr_reg; 218 volatile unsigned long *intr_reg;
219 unsigned int irq = d->irq;
217 220
218 if (irq >= 56) 221 if (irq >= 56)
219 irq += 8; 222 irq += 8;
@@ -223,26 +226,30 @@ static void ixp23xx_irq_edge_unmask(unsigned int irq)
223} 226}
224 227
225static struct irq_chip ixp23xx_irq_level_chip = { 228static struct irq_chip ixp23xx_irq_level_chip = {
226 .ack = ixp23xx_irq_mask, 229 .irq_ack = ixp23xx_irq_mask,
227 .mask = ixp23xx_irq_mask, 230 .irq_mask = ixp23xx_irq_mask,
228 .unmask = ixp23xx_irq_level_unmask, 231 .irq_unmask = ixp23xx_irq_level_unmask,
229 .set_type = ixp23xx_irq_set_type 232 .irq_set_type = ixp23xx_irq_set_type
230}; 233};
231 234
232static struct irq_chip ixp23xx_irq_edge_chip = { 235static struct irq_chip ixp23xx_irq_edge_chip = {
233 .ack = ixp23xx_irq_ack, 236 .irq_ack = ixp23xx_irq_ack,
234 .mask = ixp23xx_irq_mask, 237 .irq_mask = ixp23xx_irq_mask,
235 .unmask = ixp23xx_irq_edge_unmask, 238 .irq_unmask = ixp23xx_irq_edge_unmask,
236 .set_type = ixp23xx_irq_set_type 239 .irq_set_type = ixp23xx_irq_set_type
237}; 240};
238 241
239static void ixp23xx_pci_irq_mask(unsigned int irq) 242static void ixp23xx_pci_irq_mask(struct irq_data *d)
240{ 243{
244 unsigned int irq = d->irq;
245
241 *IXP23XX_PCI_XSCALE_INT_ENABLE &= ~(1 << (IRQ_IXP23XX_INTA + 27 - irq)); 246 *IXP23XX_PCI_XSCALE_INT_ENABLE &= ~(1 << (IRQ_IXP23XX_INTA + 27 - irq));
242} 247}
243 248
244static void ixp23xx_pci_irq_unmask(unsigned int irq) 249static void ixp23xx_pci_irq_unmask(struct irq_data *d)
245{ 250{
251 unsigned int irq = d->irq;
252
246 *IXP23XX_PCI_XSCALE_INT_ENABLE |= (1 << (IRQ_IXP23XX_INTA + 27 - irq)); 253 *IXP23XX_PCI_XSCALE_INT_ENABLE |= (1 << (IRQ_IXP23XX_INTA + 27 - irq));
247} 254}
248 255
@@ -256,7 +263,7 @@ static void pci_handler(unsigned int irq, struct irq_desc *desc)
256 263
257 pci_interrupt = *IXP23XX_PCI_XSCALE_INT_STATUS; 264 pci_interrupt = *IXP23XX_PCI_XSCALE_INT_STATUS;
258 265
259 desc->chip->ack(irq); 266 desc->irq_data.chip->irq_ack(&desc->irq_data);
260 267
261 /* See which PCI_INTA, or PCI_INTB interrupted */ 268 /* See which PCI_INTA, or PCI_INTB interrupted */
262 if (pci_interrupt & (1 << 26)) { 269 if (pci_interrupt & (1 << 26)) {
@@ -269,13 +276,13 @@ static void pci_handler(unsigned int irq, struct irq_desc *desc)
269 276
270 generic_handle_irq(irqno); 277 generic_handle_irq(irqno);
271 278
272 desc->chip->unmask(irq); 279 desc->irq_data.chip->irq_unmask(&desc->irq_data);
273} 280}
274 281
275static struct irq_chip ixp23xx_pci_irq_chip = { 282static struct irq_chip ixp23xx_pci_irq_chip = {
276 .ack = ixp23xx_pci_irq_mask, 283 .irq_ack = ixp23xx_pci_irq_mask,
277 .mask = ixp23xx_pci_irq_mask, 284 .irq_mask = ixp23xx_pci_irq_mask,
278 .unmask = ixp23xx_pci_irq_unmask 285 .irq_unmask = ixp23xx_pci_irq_unmask
279}; 286};
280 287
281static void ixp23xx_config_irq(unsigned int irq, enum ixp23xx_irq_type type) 288static void ixp23xx_config_irq(unsigned int irq, enum ixp23xx_irq_type type)
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index 664e39c2a903..181116aa6591 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -48,14 +48,14 @@
48/* 48/*
49 * IXDP2351 Interrupt Handling 49 * IXDP2351 Interrupt Handling
50 */ 50 */
51static void ixdp2351_inta_mask(unsigned int irq) 51static void ixdp2351_inta_mask(struct irq_data *d)
52{ 52{
53 *IXDP2351_CPLD_INTA_MASK_SET_REG = IXDP2351_INTA_IRQ_MASK(irq); 53 *IXDP2351_CPLD_INTA_MASK_SET_REG = IXDP2351_INTA_IRQ_MASK(d->irq);
54} 54}
55 55
56static void ixdp2351_inta_unmask(unsigned int irq) 56static void ixdp2351_inta_unmask(struct irq_data *d)
57{ 57{
58 *IXDP2351_CPLD_INTA_MASK_CLR_REG = IXDP2351_INTA_IRQ_MASK(irq); 58 *IXDP2351_CPLD_INTA_MASK_CLR_REG = IXDP2351_INTA_IRQ_MASK(d->irq);
59} 59}
60 60
61static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc) 61static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc)
@@ -64,7 +64,7 @@ static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc)
64 *IXDP2351_CPLD_INTA_STAT_REG & IXDP2351_INTA_IRQ_VALID; 64 *IXDP2351_CPLD_INTA_STAT_REG & IXDP2351_INTA_IRQ_VALID;
65 int i; 65 int i;
66 66
67 desc->chip->mask(irq); 67 desc->irq_data.chip->irq_mask(&desc->irq_data);
68 68
69 for (i = 0; i < IXDP2351_INTA_IRQ_NUM; i++) { 69 for (i = 0; i < IXDP2351_INTA_IRQ_NUM; i++) {
70 if (ex_interrupt & (1 << i)) { 70 if (ex_interrupt & (1 << i)) {
@@ -74,23 +74,23 @@ static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc)
74 } 74 }
75 } 75 }
76 76
77 desc->chip->unmask(irq); 77 desc->irq_data.chip->irq_unmask(&desc->irq_data);
78} 78}
79 79
80static struct irq_chip ixdp2351_inta_chip = { 80static struct irq_chip ixdp2351_inta_chip = {
81 .ack = ixdp2351_inta_mask, 81 .irq_ack = ixdp2351_inta_mask,
82 .mask = ixdp2351_inta_mask, 82 .irq_mask = ixdp2351_inta_mask,
83 .unmask = ixdp2351_inta_unmask 83 .irq_unmask = ixdp2351_inta_unmask
84}; 84};
85 85
86static void ixdp2351_intb_mask(unsigned int irq) 86static void ixdp2351_intb_mask(struct irq_data *d)
87{ 87{
88 *IXDP2351_CPLD_INTB_MASK_SET_REG = IXDP2351_INTB_IRQ_MASK(irq); 88 *IXDP2351_CPLD_INTB_MASK_SET_REG = IXDP2351_INTB_IRQ_MASK(d->irq);
89} 89}
90 90
91static void ixdp2351_intb_unmask(unsigned int irq) 91static void ixdp2351_intb_unmask(struct irq_data *d)
92{ 92{
93 *IXDP2351_CPLD_INTB_MASK_CLR_REG = IXDP2351_INTB_IRQ_MASK(irq); 93 *IXDP2351_CPLD_INTB_MASK_CLR_REG = IXDP2351_INTB_IRQ_MASK(d->irq);
94} 94}
95 95
96static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc) 96static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc)
@@ -99,7 +99,7 @@ static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc)
99 *IXDP2351_CPLD_INTB_STAT_REG & IXDP2351_INTB_IRQ_VALID; 99 *IXDP2351_CPLD_INTB_STAT_REG & IXDP2351_INTB_IRQ_VALID;
100 int i; 100 int i;
101 101
102 desc->chip->ack(irq); 102 desc->irq_data.chip->irq_ack(&desc->irq_data);
103 103
104 for (i = 0; i < IXDP2351_INTB_IRQ_NUM; i++) { 104 for (i = 0; i < IXDP2351_INTB_IRQ_NUM; i++) {
105 if (ex_interrupt & (1 << i)) { 105 if (ex_interrupt & (1 << i)) {
@@ -109,13 +109,13 @@ static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc)
109 } 109 }
110 } 110 }
111 111
112 desc->chip->unmask(irq); 112 desc->irq_data.chip->irq_unmask(&desc->irq_data);
113} 113}
114 114
115static struct irq_chip ixdp2351_intb_chip = { 115static struct irq_chip ixdp2351_intb_chip = {
116 .ack = ixdp2351_intb_mask, 116 .irq_ack = ixdp2351_intb_mask,
117 .mask = ixdp2351_intb_mask, 117 .irq_mask = ixdp2351_intb_mask,
118 .unmask = ixdp2351_intb_unmask 118 .irq_unmask = ixdp2351_intb_unmask
119}; 119};
120 120
121void __init ixdp2351_init_irq(void) 121void __init ixdp2351_init_irq(void)
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 4dbfcbb9163c..4dc68d6bb6be 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -128,9 +128,9 @@ int irq_to_gpio(unsigned int irq)
128} 128}
129EXPORT_SYMBOL(irq_to_gpio); 129EXPORT_SYMBOL(irq_to_gpio);
130 130
131static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) 131static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
132{ 132{
133 int line = irq2gpio[irq]; 133 int line = irq2gpio[d->irq];
134 u32 int_style; 134 u32 int_style;
135 enum ixp4xx_irq_type irq_type; 135 enum ixp4xx_irq_type irq_type;
136 volatile u32 *int_reg; 136 volatile u32 *int_reg;
@@ -167,9 +167,9 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
167 } 167 }
168 168
169 if (irq_type == IXP4XX_IRQ_EDGE) 169 if (irq_type == IXP4XX_IRQ_EDGE)
170 ixp4xx_irq_edge |= (1 << irq); 170 ixp4xx_irq_edge |= (1 << d->irq);
171 else 171 else
172 ixp4xx_irq_edge &= ~(1 << irq); 172 ixp4xx_irq_edge &= ~(1 << d->irq);
173 173
174 if (line >= 8) { /* pins 8-15 */ 174 if (line >= 8) { /* pins 8-15 */
175 line -= 8; 175 line -= 8;
@@ -188,22 +188,22 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
188 *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); 188 *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
189 189
190 /* Configure the line as an input */ 190 /* Configure the line as an input */
191 gpio_line_config(irq2gpio[irq], IXP4XX_GPIO_IN); 191 gpio_line_config(irq2gpio[d->irq], IXP4XX_GPIO_IN);
192 192
193 return 0; 193 return 0;
194} 194}
195 195
196static void ixp4xx_irq_mask(unsigned int irq) 196static void ixp4xx_irq_mask(struct irq_data *d)
197{ 197{
198 if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) 198 if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32)
199 *IXP4XX_ICMR2 &= ~(1 << (irq - 32)); 199 *IXP4XX_ICMR2 &= ~(1 << (d->irq - 32));
200 else 200 else
201 *IXP4XX_ICMR &= ~(1 << irq); 201 *IXP4XX_ICMR &= ~(1 << d->irq);
202} 202}
203 203
204static void ixp4xx_irq_ack(unsigned int irq) 204static void ixp4xx_irq_ack(struct irq_data *d)
205{ 205{
206 int line = (irq < 32) ? irq2gpio[irq] : -1; 206 int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
207 207
208 if (line >= 0) 208 if (line >= 0)
209 *IXP4XX_GPIO_GPISR = (1 << line); 209 *IXP4XX_GPIO_GPISR = (1 << line);
@@ -213,23 +213,23 @@ static void ixp4xx_irq_ack(unsigned int irq)
213 * Level triggered interrupts on GPIO lines can only be cleared when the 213 * Level triggered interrupts on GPIO lines can only be cleared when the
214 * interrupt condition disappears. 214 * interrupt condition disappears.
215 */ 215 */
216static void ixp4xx_irq_unmask(unsigned int irq) 216static void ixp4xx_irq_unmask(struct irq_data *d)
217{ 217{
218 if (!(ixp4xx_irq_edge & (1 << irq))) 218 if (!(ixp4xx_irq_edge & (1 << d->irq)))
219 ixp4xx_irq_ack(irq); 219 ixp4xx_irq_ack(d);
220 220
221 if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) 221 if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32)
222 *IXP4XX_ICMR2 |= (1 << (irq - 32)); 222 *IXP4XX_ICMR2 |= (1 << (d->irq - 32));
223 else 223 else
224 *IXP4XX_ICMR |= (1 << irq); 224 *IXP4XX_ICMR |= (1 << d->irq);
225} 225}
226 226
227static struct irq_chip ixp4xx_irq_chip = { 227static struct irq_chip ixp4xx_irq_chip = {
228 .name = "IXP4xx", 228 .name = "IXP4xx",
229 .ack = ixp4xx_irq_ack, 229 .irq_ack = ixp4xx_irq_ack,
230 .mask = ixp4xx_irq_mask, 230 .irq_mask = ixp4xx_irq_mask,
231 .unmask = ixp4xx_irq_unmask, 231 .irq_unmask = ixp4xx_irq_unmask,
232 .set_type = ixp4xx_set_irq_type, 232 .irq_set_type = ixp4xx_set_irq_type,
233}; 233};
234 234
235void __init ixp4xx_init_irq(void) 235void __init ixp4xx_init_irq(void)
diff --git a/arch/arm/mach-ks8695/irq.c b/arch/arm/mach-ks8695/irq.c
index e375c1d53f81..7998ccaa6333 100644
--- a/arch/arm/mach-ks8695/irq.c
+++ b/arch/arm/mach-ks8695/irq.c
@@ -34,29 +34,29 @@
34#include <mach/regs-irq.h> 34#include <mach/regs-irq.h>
35#include <mach/regs-gpio.h> 35#include <mach/regs-gpio.h>
36 36
37static void ks8695_irq_mask(unsigned int irqno) 37static void ks8695_irq_mask(struct irq_data *d)
38{ 38{
39 unsigned long inten; 39 unsigned long inten;
40 40
41 inten = __raw_readl(KS8695_IRQ_VA + KS8695_INTEN); 41 inten = __raw_readl(KS8695_IRQ_VA + KS8695_INTEN);
42 inten &= ~(1 << irqno); 42 inten &= ~(1 << d->irq);
43 43
44 __raw_writel(inten, KS8695_IRQ_VA + KS8695_INTEN); 44 __raw_writel(inten, KS8695_IRQ_VA + KS8695_INTEN);
45} 45}
46 46
47static void ks8695_irq_unmask(unsigned int irqno) 47static void ks8695_irq_unmask(struct irq_data *d)
48{ 48{
49 unsigned long inten; 49 unsigned long inten;
50 50
51 inten = __raw_readl(KS8695_IRQ_VA + KS8695_INTEN); 51 inten = __raw_readl(KS8695_IRQ_VA + KS8695_INTEN);
52 inten |= (1 << irqno); 52 inten |= (1 << d->irq);
53 53
54 __raw_writel(inten, KS8695_IRQ_VA + KS8695_INTEN); 54 __raw_writel(inten, KS8695_IRQ_VA + KS8695_INTEN);
55} 55}
56 56
57static void ks8695_irq_ack(unsigned int irqno) 57static void ks8695_irq_ack(struct irq_data *d)
58{ 58{
59 __raw_writel((1 << irqno), KS8695_IRQ_VA + KS8695_INTST); 59 __raw_writel((1 << d->irq), KS8695_IRQ_VA + KS8695_INTST);
60} 60}
61 61
62 62
@@ -64,7 +64,7 @@ static struct irq_chip ks8695_irq_level_chip;
64static struct irq_chip ks8695_irq_edge_chip; 64static struct irq_chip ks8695_irq_edge_chip;
65 65
66 66
67static int ks8695_irq_set_type(unsigned int irqno, unsigned int type) 67static int ks8695_irq_set_type(struct irq_data *d, unsigned int type)
68{ 68{
69 unsigned long ctrl, mode; 69 unsigned long ctrl, mode;
70 unsigned short level_triggered = 0; 70 unsigned short level_triggered = 0;
@@ -93,7 +93,7 @@ static int ks8695_irq_set_type(unsigned int irqno, unsigned int type)
93 return -EINVAL; 93 return -EINVAL;
94 } 94 }
95 95
96 switch (irqno) { 96 switch (d->irq) {
97 case KS8695_IRQ_EXTERN0: 97 case KS8695_IRQ_EXTERN0:
98 ctrl &= ~IOPC_IOEINT0TM; 98 ctrl &= ~IOPC_IOEINT0TM;
99 ctrl |= IOPC_IOEINT0_MODE(mode); 99 ctrl |= IOPC_IOEINT0_MODE(mode);
@@ -115,12 +115,12 @@ static int ks8695_irq_set_type(unsigned int irqno, unsigned int type)
115 } 115 }
116 116
117 if (level_triggered) { 117 if (level_triggered) {
118 set_irq_chip(irqno, &ks8695_irq_level_chip); 118 set_irq_chip(d->irq, &ks8695_irq_level_chip);
119 set_irq_handler(irqno, handle_level_irq); 119 set_irq_handler(d->irq, handle_level_irq);
120 } 120 }
121 else { 121 else {
122 set_irq_chip(irqno, &ks8695_irq_edge_chip); 122 set_irq_chip(d->irq, &ks8695_irq_edge_chip);
123 set_irq_handler(irqno, handle_edge_irq); 123 set_irq_handler(d->irq, handle_edge_irq);
124 } 124 }
125 125
126 __raw_writel(ctrl, KS8695_GPIO_VA + KS8695_IOPC); 126 __raw_writel(ctrl, KS8695_GPIO_VA + KS8695_IOPC);
@@ -128,17 +128,17 @@ static int ks8695_irq_set_type(unsigned int irqno, unsigned int type)
128} 128}
129 129
130static struct irq_chip ks8695_irq_level_chip = { 130static struct irq_chip ks8695_irq_level_chip = {
131 .ack = ks8695_irq_mask, 131 .irq_ack = ks8695_irq_mask,
132 .mask = ks8695_irq_mask, 132 .irq_mask = ks8695_irq_mask,
133 .unmask = ks8695_irq_unmask, 133 .irq_unmask = ks8695_irq_unmask,
134 .set_type = ks8695_irq_set_type, 134 .irq_set_type = ks8695_irq_set_type,
135}; 135};
136 136
137static struct irq_chip ks8695_irq_edge_chip = { 137static struct irq_chip ks8695_irq_edge_chip = {
138 .ack = ks8695_irq_ack, 138 .irq_ack = ks8695_irq_ack,
139 .mask = ks8695_irq_mask, 139 .irq_mask = ks8695_irq_mask,
140 .unmask = ks8695_irq_unmask, 140 .irq_unmask = ks8695_irq_unmask,
141 .set_type = ks8695_irq_set_type, 141 .irq_set_type = ks8695_irq_set_type,
142}; 142};
143 143
144void __init ks8695_init_irq(void) 144void __init ks8695_init_irq(void)
@@ -164,7 +164,8 @@ void __init ks8695_init_irq(void)
164 164
165 /* Edge-triggered interrupts */ 165 /* Edge-triggered interrupts */
166 default: 166 default:
167 ks8695_irq_ack(irq); /* clear pending bit */ 167 /* clear pending bit */
168 ks8695_irq_ack(irq_get_irq_data(irq));
168 set_irq_chip(irq, &ks8695_irq_edge_chip); 169 set_irq_chip(irq, &ks8695_irq_edge_chip);
169 set_irq_handler(irq, handle_edge_irq); 170 set_irq_handler(irq, handle_edge_irq);
170 } 171 }
diff --git a/arch/arm/mach-lh7a40x/arch-kev7a400.c b/arch/arm/mach-lh7a40x/arch-kev7a400.c
index 9088c16662e8..71129c33c7d2 100644
--- a/arch/arm/mach-lh7a40x/arch-kev7a400.c
+++ b/arch/arm/mach-lh7a40x/arch-kev7a400.c
@@ -46,28 +46,28 @@ void __init kev7a400_map_io(void)
46 46
47static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */ 47static u16 CPLD_IRQ_mask; /* Mask for CPLD IRQs, 1 == unmasked */
48 48
49static void kev7a400_ack_cpld_irq (u32 irq) 49static void kev7a400_ack_cpld_irq(struct irq_data *d)
50{ 50{
51 CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD); 51 CPLD_CL_INT = 1 << (d->irq - IRQ_KEV7A400_CPLD);
52} 52}
53 53
54static void kev7a400_mask_cpld_irq (u32 irq) 54static void kev7a400_mask_cpld_irq(struct irq_data *d)
55{ 55{
56 CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD)); 56 CPLD_IRQ_mask &= ~(1 << (d->irq - IRQ_KEV7A400_CPLD));
57 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask; 57 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
58} 58}
59 59
60static void kev7a400_unmask_cpld_irq (u32 irq) 60static void kev7a400_unmask_cpld_irq(struct irq_data *d)
61{ 61{
62 CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD); 62 CPLD_IRQ_mask |= 1 << (d->irq - IRQ_KEV7A400_CPLD);
63 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask; 63 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
64} 64}
65 65
66static struct irq_chip kev7a400_cpld_chip = { 66static struct irq_chip kev7a400_cpld_chip = {
67 .name = "CPLD", 67 .name = "CPLD",
68 .ack = kev7a400_ack_cpld_irq, 68 .irq_ack = kev7a400_ack_cpld_irq,
69 .mask = kev7a400_mask_cpld_irq, 69 .irq_mask = kev7a400_mask_cpld_irq,
70 .unmask = kev7a400_unmask_cpld_irq, 70 .irq_unmask = kev7a400_unmask_cpld_irq,
71}; 71};
72 72
73 73
diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
index 7315a569aea1..e735546181ad 100644
--- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
@@ -159,7 +159,7 @@ static void __init lpd7a40x_init (void)
159#endif 159#endif
160} 160}
161 161
162static void lh7a40x_ack_cpld_irq (u32 irq) 162static void lh7a40x_ack_cpld_irq(struct irq_data *d)
163{ 163{
164 /* CPLD doesn't have ack capability, but some devices may */ 164 /* CPLD doesn't have ack capability, but some devices may */
165 165
@@ -167,14 +167,14 @@ static void lh7a40x_ack_cpld_irq (u32 irq)
167 /* The touch control *must* mask the interrupt because the 167 /* The touch control *must* mask the interrupt because the
168 * interrupt bit is read by the driver to determine if the pen 168 * interrupt bit is read by the driver to determine if the pen
169 * is still down. */ 169 * is still down. */
170 if (irq == IRQ_TOUCH) 170 if (d->irq == IRQ_TOUCH)
171 CPLD_INTERRUPTS |= CPLD_INTMASK_TOUCH; 171 CPLD_INTERRUPTS |= CPLD_INTMASK_TOUCH;
172#endif 172#endif
173} 173}
174 174
175static void lh7a40x_mask_cpld_irq (u32 irq) 175static void lh7a40x_mask_cpld_irq(struct irq_data *d)
176{ 176{
177 switch (irq) { 177 switch (d->irq) {
178 case IRQ_LPD7A40X_ETH_INT: 178 case IRQ_LPD7A40X_ETH_INT:
179 CPLD_INTERRUPTS |= CPLD_INTMASK_ETHERNET; 179 CPLD_INTERRUPTS |= CPLD_INTMASK_ETHERNET;
180 break; 180 break;
@@ -186,9 +186,9 @@ static void lh7a40x_mask_cpld_irq (u32 irq)
186 } 186 }
187} 187}
188 188
189static void lh7a40x_unmask_cpld_irq (u32 irq) 189static void lh7a40x_unmask_cpld_irq(struct irq_data *d)
190{ 190{
191 switch (irq) { 191 switch (d->irq) {
192 case IRQ_LPD7A40X_ETH_INT: 192 case IRQ_LPD7A40X_ETH_INT:
193 CPLD_INTERRUPTS &= ~CPLD_INTMASK_ETHERNET; 193 CPLD_INTERRUPTS &= ~CPLD_INTMASK_ETHERNET;
194 break; 194 break;
@@ -201,17 +201,17 @@ static void lh7a40x_unmask_cpld_irq (u32 irq)
201} 201}
202 202
203static struct irq_chip lpd7a40x_cpld_chip = { 203static struct irq_chip lpd7a40x_cpld_chip = {
204 .name = "CPLD", 204 .name = "CPLD",
205 .ack = lh7a40x_ack_cpld_irq, 205 .irq_ack = lh7a40x_ack_cpld_irq,
206 .mask = lh7a40x_mask_cpld_irq, 206 .irq_mask = lh7a40x_mask_cpld_irq,
207 .unmask = lh7a40x_unmask_cpld_irq, 207 .irq_unmask = lh7a40x_unmask_cpld_irq,
208}; 208};
209 209
210static void lpd7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc) 210static void lpd7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
211{ 211{
212 unsigned int mask = CPLD_INTERRUPTS; 212 unsigned int mask = CPLD_INTERRUPTS;
213 213
214 desc->chip->ack (irq); 214 desc->irq_data.chip->irq_ack(&desc->irq_data);
215 215
216 if ((mask & (1<<0)) == 0) /* WLAN */ 216 if ((mask & (1<<0)) == 0) /* WLAN */
217 generic_handle_irq(IRQ_LPD7A40X_ETH_INT); 217 generic_handle_irq(IRQ_LPD7A40X_ETH_INT);
@@ -221,7 +221,8 @@ static void lpd7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
221 generic_handle_irq(IRQ_TOUCH); 221 generic_handle_irq(IRQ_TOUCH);
222#endif 222#endif
223 223
224 desc->chip->unmask (irq); /* Level-triggered need this */ 224 /* Level-triggered need this */
225 desc->irq_data.chip->irq_unmask(&desc->irq_data);
225} 226}
226 227
227 228
diff --git a/arch/arm/mach-lh7a40x/irq-lh7a400.c b/arch/arm/mach-lh7a40x/irq-lh7a400.c
index 1ad3afcf6b3d..f2e7e655ca35 100644
--- a/arch/arm/mach-lh7a40x/irq-lh7a400.c
+++ b/arch/arm/mach-lh7a40x/irq-lh7a400.c
@@ -21,34 +21,34 @@
21 21
22 /* CPU IRQ handling */ 22 /* CPU IRQ handling */
23 23
24static void lh7a400_mask_irq (u32 irq) 24static void lh7a400_mask_irq(struct irq_data *d)
25{ 25{
26 INTC_INTENC = (1 << irq); 26 INTC_INTENC = (1 << d->irq);
27} 27}
28 28
29static void lh7a400_unmask_irq (u32 irq) 29static void lh7a400_unmask_irq(struct irq_data *d)
30{ 30{
31 INTC_INTENS = (1 << irq); 31 INTC_INTENS = (1 << d->irq);
32} 32}
33 33
34static void lh7a400_ack_gpio_irq (u32 irq) 34static void lh7a400_ack_gpio_irq(struct irq_data *d)
35{ 35{
36 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq)); 36 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (d->irq));
37 INTC_INTENC = (1 << irq); 37 INTC_INTENC = (1 << d->irq);
38} 38}
39 39
40static struct irq_chip lh7a400_internal_chip = { 40static struct irq_chip lh7a400_internal_chip = {
41 .name = "MPU", 41 .name = "MPU",
42 .ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */ 42 .irq_ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */
43 .mask = lh7a400_mask_irq, 43 .irq_mask = lh7a400_mask_irq,
44 .unmask = lh7a400_unmask_irq, 44 .irq_unmask = lh7a400_unmask_irq,
45}; 45};
46 46
47static struct irq_chip lh7a400_gpio_chip = { 47static struct irq_chip lh7a400_gpio_chip = {
48 .name = "GPIO", 48 .name = "GPIO",
49 .ack = lh7a400_ack_gpio_irq, 49 .irq_ack = lh7a400_ack_gpio_irq,
50 .mask = lh7a400_mask_irq, 50 .irq_mask = lh7a400_mask_irq,
51 .unmask = lh7a400_unmask_irq, 51 .irq_unmask = lh7a400_unmask_irq,
52}; 52};
53 53
54 54
diff --git a/arch/arm/mach-lh7a40x/irq-lh7a404.c b/arch/arm/mach-lh7a40x/irq-lh7a404.c
index 12b045b688c6..14b173389573 100644
--- a/arch/arm/mach-lh7a40x/irq-lh7a404.c
+++ b/arch/arm/mach-lh7a40x/irq-lh7a404.c
@@ -43,64 +43,64 @@ static unsigned char irq_pri_vic2[] = {
43 43
44 /* CPU IRQ handling */ 44 /* CPU IRQ handling */
45 45
46static void lh7a404_vic1_mask_irq (u32 irq) 46static void lh7a404_vic1_mask_irq(struct irq_data *d)
47{ 47{
48 VIC1_INTENCLR = (1 << irq); 48 VIC1_INTENCLR = (1 << d->irq);
49} 49}
50 50
51static void lh7a404_vic1_unmask_irq (u32 irq) 51static void lh7a404_vic1_unmask_irq(struct irq_data *d)
52{ 52{
53 VIC1_INTEN = (1 << irq); 53 VIC1_INTEN = (1 << d->irq);
54} 54}
55 55
56static void lh7a404_vic2_mask_irq (u32 irq) 56static void lh7a404_vic2_mask_irq(struct irq_data *d)
57{ 57{
58 VIC2_INTENCLR = (1 << (irq - 32)); 58 VIC2_INTENCLR = (1 << (d->irq - 32));
59} 59}
60 60
61static void lh7a404_vic2_unmask_irq (u32 irq) 61static void lh7a404_vic2_unmask_irq(struct irq_data *d)
62{ 62{
63 VIC2_INTEN = (1 << (irq - 32)); 63 VIC2_INTEN = (1 << (d->irq - 32));
64} 64}
65 65
66static void lh7a404_vic1_ack_gpio_irq (u32 irq) 66static void lh7a404_vic1_ack_gpio_irq(struct irq_data *d)
67{ 67{
68 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq)); 68 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (d->irq));
69 VIC1_INTENCLR = (1 << irq); 69 VIC1_INTENCLR = (1 << d->irq);
70} 70}
71 71
72static void lh7a404_vic2_ack_gpio_irq (u32 irq) 72static void lh7a404_vic2_ack_gpio_irq(struct irq_data *d)
73{ 73{
74 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq)); 74 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (d->irq));
75 VIC2_INTENCLR = (1 << irq); 75 VIC2_INTENCLR = (1 << d->irq);
76} 76}
77 77
78static struct irq_chip lh7a404_vic1_chip = { 78static struct irq_chip lh7a404_vic1_chip = {
79 .name = "VIC1", 79 .name = "VIC1",
80 .ack = lh7a404_vic1_mask_irq, /* Because level-triggered */ 80 .irq_ack = lh7a404_vic1_mask_irq, /* Because level-triggered */
81 .mask = lh7a404_vic1_mask_irq, 81 .irq_mask = lh7a404_vic1_mask_irq,
82 .unmask = lh7a404_vic1_unmask_irq, 82 .irq_unmask = lh7a404_vic1_unmask_irq,
83}; 83};
84 84
85static struct irq_chip lh7a404_vic2_chip = { 85static struct irq_chip lh7a404_vic2_chip = {
86 .name = "VIC2", 86 .name = "VIC2",
87 .ack = lh7a404_vic2_mask_irq, /* Because level-triggered */ 87 .irq_ack = lh7a404_vic2_mask_irq, /* Because level-triggered */
88 .mask = lh7a404_vic2_mask_irq, 88 .irq_mask = lh7a404_vic2_mask_irq,
89 .unmask = lh7a404_vic2_unmask_irq, 89 .irq_unmask = lh7a404_vic2_unmask_irq,
90}; 90};
91 91
92static struct irq_chip lh7a404_gpio_vic1_chip = { 92static struct irq_chip lh7a404_gpio_vic1_chip = {
93 .name = "GPIO-VIC1", 93 .name = "GPIO-VIC1",
94 .ack = lh7a404_vic1_ack_gpio_irq, 94 .irq_ack = lh7a404_vic1_ack_gpio_irq,
95 .mask = lh7a404_vic1_mask_irq, 95 .irq_mask = lh7a404_vic1_mask_irq,
96 .unmask = lh7a404_vic1_unmask_irq, 96 .irq_unmask = lh7a404_vic1_unmask_irq,
97}; 97};
98 98
99static struct irq_chip lh7a404_gpio_vic2_chip = { 99static struct irq_chip lh7a404_gpio_vic2_chip = {
100 .name = "GPIO-VIC2", 100 .name = "GPIO-VIC2",
101 .ack = lh7a404_vic2_ack_gpio_irq, 101 .irq_ack = lh7a404_vic2_ack_gpio_irq,
102 .mask = lh7a404_vic2_mask_irq, 102 .irq_mask = lh7a404_vic2_mask_irq,
103 .unmask = lh7a404_vic2_unmask_irq, 103 .irq_unmask = lh7a404_vic2_unmask_irq,
104}; 104};
105 105
106 /* IRQ initialization */ 106 /* IRQ initialization */
diff --git a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
index fd033bb4342f..1bfdcddcb93e 100644
--- a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
@@ -20,14 +20,14 @@
20 20
21#include "common.h" 21#include "common.h"
22 22
23static void lh7a40x_ack_cpld_irq (u32 irq) 23static void lh7a40x_ack_cpld_irq(struct irq_data *d)
24{ 24{
25 /* CPLD doesn't have ack capability */ 25 /* CPLD doesn't have ack capability */
26} 26}
27 27
28static void lh7a40x_mask_cpld_irq (u32 irq) 28static void lh7a40x_mask_cpld_irq(struct irq_data *d)
29{ 29{
30 switch (irq) { 30 switch (d->irq) {
31 case IRQ_LPD7A40X_ETH_INT: 31 case IRQ_LPD7A40X_ETH_INT:
32 CPLD_INTERRUPTS = CPLD_INTERRUPTS | 0x4; 32 CPLD_INTERRUPTS = CPLD_INTERRUPTS | 0x4;
33 break; 33 break;
@@ -37,9 +37,9 @@ static void lh7a40x_mask_cpld_irq (u32 irq)
37 } 37 }
38} 38}
39 39
40static void lh7a40x_unmask_cpld_irq (u32 irq) 40static void lh7a40x_unmask_cpld_irq(struct irq_data *d)
41{ 41{
42 switch (irq) { 42 switch (d->irq) {
43 case IRQ_LPD7A40X_ETH_INT: 43 case IRQ_LPD7A40X_ETH_INT:
44 CPLD_INTERRUPTS = CPLD_INTERRUPTS & ~ 0x4; 44 CPLD_INTERRUPTS = CPLD_INTERRUPTS & ~ 0x4;
45 break; 45 break;
@@ -50,17 +50,17 @@ static void lh7a40x_unmask_cpld_irq (u32 irq)
50} 50}
51 51
52static struct irq_chip lh7a40x_cpld_chip = { 52static struct irq_chip lh7a40x_cpld_chip = {
53 .name = "CPLD", 53 .name = "CPLD",
54 .ack = lh7a40x_ack_cpld_irq, 54 .irq_ack = lh7a40x_ack_cpld_irq,
55 .mask = lh7a40x_mask_cpld_irq, 55 .irq_mask = lh7a40x_mask_cpld_irq,
56 .unmask = lh7a40x_unmask_cpld_irq, 56 .irq_unmask = lh7a40x_unmask_cpld_irq,
57}; 57};
58 58
59static void lh7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc) 59static void lh7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
60{ 60{
61 unsigned int mask = CPLD_INTERRUPTS; 61 unsigned int mask = CPLD_INTERRUPTS;
62 62
63 desc->chip->ack (irq); 63 desc->irq_data.chip->ack (irq);
64 64
65 if ((mask & 0x1) == 0) /* WLAN */ 65 if ((mask & 0x1) == 0) /* WLAN */
66 generic_handle_irq(IRQ_LPD7A40X_ETH_INT); 66 generic_handle_irq(IRQ_LPD7A40X_ETH_INT);
@@ -68,7 +68,7 @@ static void lh7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
68 if ((mask & 0x2) == 0) /* Touch */ 68 if ((mask & 0x2) == 0) /* Touch */
69 generic_handle_irq(IRQ_LPD7A400_TS); 69 generic_handle_irq(IRQ_LPD7A400_TS);
70 70
71 desc->chip->unmask (irq); /* Level-triggered need this */ 71 desc->irq_data.chip->unmask (irq); /* Level-triggered need this */
72} 72}
73 73
74 74
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index bd0df26c415b..316ecbf6c586 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -191,38 +191,38 @@ static void get_controller(unsigned int irq, unsigned int *base,
191 } 191 }
192} 192}
193 193
194static void lpc32xx_mask_irq(unsigned int irq) 194static void lpc32xx_mask_irq(struct irq_data *d)
195{ 195{
196 unsigned int reg, ctrl, mask; 196 unsigned int reg, ctrl, mask;
197 197
198 get_controller(irq, &ctrl, &mask); 198 get_controller(d->irq, &ctrl, &mask);
199 199
200 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask; 200 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask;
201 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl)); 201 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
202} 202}
203 203
204static void lpc32xx_unmask_irq(unsigned int irq) 204static void lpc32xx_unmask_irq(struct irq_data *d)
205{ 205{
206 unsigned int reg, ctrl, mask; 206 unsigned int reg, ctrl, mask;
207 207
208 get_controller(irq, &ctrl, &mask); 208 get_controller(d->irq, &ctrl, &mask);
209 209
210 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask; 210 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask;
211 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl)); 211 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
212} 212}
213 213
214static void lpc32xx_ack_irq(unsigned int irq) 214static void lpc32xx_ack_irq(struct irq_data *d)
215{ 215{
216 unsigned int ctrl, mask; 216 unsigned int ctrl, mask;
217 217
218 get_controller(irq, &ctrl, &mask); 218 get_controller(d->irq, &ctrl, &mask);
219 219
220 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl)); 220 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl));
221 221
222 /* Also need to clear pending wake event */ 222 /* Also need to clear pending wake event */
223 if (lpc32xx_events[irq].mask != 0) 223 if (lpc32xx_events[d->irq].mask != 0)
224 __raw_writel(lpc32xx_events[irq].mask, 224 __raw_writel(lpc32xx_events[d->irq].mask,
225 lpc32xx_events[irq].event_group->rawstat_reg); 225 lpc32xx_events[d->irq].event_group->rawstat_reg);
226} 226}
227 227
228static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level, 228static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level,
@@ -261,27 +261,27 @@ static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level,
261 } 261 }
262} 262}
263 263
264static int lpc32xx_set_irq_type(unsigned int irq, unsigned int type) 264static int lpc32xx_set_irq_type(struct irq_data *d, unsigned int type)
265{ 265{
266 switch (type) { 266 switch (type) {
267 case IRQ_TYPE_EDGE_RISING: 267 case IRQ_TYPE_EDGE_RISING:
268 /* Rising edge sensitive */ 268 /* Rising edge sensitive */
269 __lpc32xx_set_irq_type(irq, 1, 1); 269 __lpc32xx_set_irq_type(d->irq, 1, 1);
270 break; 270 break;
271 271
272 case IRQ_TYPE_EDGE_FALLING: 272 case IRQ_TYPE_EDGE_FALLING:
273 /* Falling edge sensitive */ 273 /* Falling edge sensitive */
274 __lpc32xx_set_irq_type(irq, 0, 1); 274 __lpc32xx_set_irq_type(d->irq, 0, 1);
275 break; 275 break;
276 276
277 case IRQ_TYPE_LEVEL_LOW: 277 case IRQ_TYPE_LEVEL_LOW:
278 /* Low level sensitive */ 278 /* Low level sensitive */
279 __lpc32xx_set_irq_type(irq, 0, 0); 279 __lpc32xx_set_irq_type(d->irq, 0, 0);
280 break; 280 break;
281 281
282 case IRQ_TYPE_LEVEL_HIGH: 282 case IRQ_TYPE_LEVEL_HIGH:
283 /* High level sensitive */ 283 /* High level sensitive */
284 __lpc32xx_set_irq_type(irq, 1, 0); 284 __lpc32xx_set_irq_type(d->irq, 1, 0);
285 break; 285 break;
286 286
287 /* Other modes are not supported */ 287 /* Other modes are not supported */
@@ -290,33 +290,33 @@ static int lpc32xx_set_irq_type(unsigned int irq, unsigned int type)
290 } 290 }
291 291
292 /* Ok to use the level handler for all types */ 292 /* Ok to use the level handler for all types */
293 set_irq_handler(irq, handle_level_irq); 293 set_irq_handler(d->irq, handle_level_irq);
294 294
295 return 0; 295 return 0;
296} 296}
297 297
298static int lpc32xx_irq_wake(unsigned int irqno, unsigned int state) 298static int lpc32xx_irq_wake(struct irq_data *d, unsigned int state)
299{ 299{
300 unsigned long eventreg; 300 unsigned long eventreg;
301 301
302 if (lpc32xx_events[irqno].mask != 0) { 302 if (lpc32xx_events[d->irq].mask != 0) {
303 eventreg = __raw_readl(lpc32xx_events[irqno]. 303 eventreg = __raw_readl(lpc32xx_events[d->irq].
304 event_group->enab_reg); 304 event_group->enab_reg);
305 305
306 if (state) 306 if (state)
307 eventreg |= lpc32xx_events[irqno].mask; 307 eventreg |= lpc32xx_events[d->irq].mask;
308 else 308 else
309 eventreg &= ~lpc32xx_events[irqno].mask; 309 eventreg &= ~lpc32xx_events[d->irq].mask;
310 310
311 __raw_writel(eventreg, 311 __raw_writel(eventreg,
312 lpc32xx_events[irqno].event_group->enab_reg); 312 lpc32xx_events[d->irq].event_group->enab_reg);
313 313
314 return 0; 314 return 0;
315 } 315 }
316 316
317 /* Clear event */ 317 /* Clear event */
318 __raw_writel(lpc32xx_events[irqno].mask, 318 __raw_writel(lpc32xx_events[d->irq].mask,
319 lpc32xx_events[irqno].event_group->rawstat_reg); 319 lpc32xx_events[d->irq].event_group->rawstat_reg);
320 320
321 return -ENODEV; 321 return -ENODEV;
322} 322}
@@ -336,11 +336,11 @@ static void __init lpc32xx_set_default_mappings(unsigned int apr,
336} 336}
337 337
338static struct irq_chip lpc32xx_irq_chip = { 338static struct irq_chip lpc32xx_irq_chip = {
339 .ack = lpc32xx_ack_irq, 339 .irq_ack = lpc32xx_ack_irq,
340 .mask = lpc32xx_mask_irq, 340 .irq_mask = lpc32xx_mask_irq,
341 .unmask = lpc32xx_unmask_irq, 341 .irq_unmask = lpc32xx_unmask_irq,
342 .set_type = lpc32xx_set_irq_type, 342 .irq_set_type = lpc32xx_set_irq_type,
343 .set_wake = lpc32xx_irq_wake 343 .irq_set_wake = lpc32xx_irq_wake
344}; 344};
345 345
346static void lpc32xx_sic1_handler(unsigned int irq, struct irq_desc *desc) 346static void lpc32xx_sic1_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/mach-mmp/include/mach/mfp-mmp2.h b/arch/arm/mach-mmp/include/mach/mfp-mmp2.h
index 117e30366087..4ad38629c3f6 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-mmp2.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-mmp2.h
@@ -6,7 +6,7 @@
6#define MFP_DRIVE_VERY_SLOW (0x0 << 13) 6#define MFP_DRIVE_VERY_SLOW (0x0 << 13)
7#define MFP_DRIVE_SLOW (0x2 << 13) 7#define MFP_DRIVE_SLOW (0x2 << 13)
8#define MFP_DRIVE_MEDIUM (0x4 << 13) 8#define MFP_DRIVE_MEDIUM (0x4 << 13)
9#define MFP_DRIVE_FAST (0x8 << 13) 9#define MFP_DRIVE_FAST (0x6 << 13)
10 10
11/* GPIO */ 11/* GPIO */
12#define GPIO0_GPIO MFP_CFG(GPIO0, AF0) 12#define GPIO0_GPIO MFP_CFG(GPIO0, AF0)
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa910.h b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
index 7e8a80f25ddc..fbd7ee8e4897 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h
@@ -6,7 +6,7 @@
6#define MFP_DRIVE_VERY_SLOW (0x0 << 13) 6#define MFP_DRIVE_VERY_SLOW (0x0 << 13)
7#define MFP_DRIVE_SLOW (0x2 << 13) 7#define MFP_DRIVE_SLOW (0x2 << 13)
8#define MFP_DRIVE_MEDIUM (0x4 << 13) 8#define MFP_DRIVE_MEDIUM (0x4 << 13)
9#define MFP_DRIVE_FAST (0x8 << 13) 9#define MFP_DRIVE_FAST (0x6 << 13)
10 10
11/* UART2 */ 11/* UART2 */
12#define GPIO47_UART2_RXD MFP_CFG(GPIO47, AF6) 12#define GPIO47_UART2_RXD MFP_CFG(GPIO47, AF6)
diff --git a/arch/arm/mach-mmp/irq-mmp2.c b/arch/arm/mach-mmp/irq-mmp2.c
index 01342be91c3c..fa037038e7b8 100644
--- a/arch/arm/mach-mmp/irq-mmp2.c
+++ b/arch/arm/mach-mmp/irq-mmp2.c
@@ -20,48 +20,48 @@
20 20
21#include "common.h" 21#include "common.h"
22 22
23static void icu_mask_irq(unsigned int irq) 23static void icu_mask_irq(struct irq_data *d)
24{ 24{
25 uint32_t r = __raw_readl(ICU_INT_CONF(irq)); 25 uint32_t r = __raw_readl(ICU_INT_CONF(d->irq));
26 26
27 r &= ~ICU_INT_ROUTE_PJ4_IRQ; 27 r &= ~ICU_INT_ROUTE_PJ4_IRQ;
28 __raw_writel(r, ICU_INT_CONF(irq)); 28 __raw_writel(r, ICU_INT_CONF(d->irq));
29} 29}
30 30
31static void icu_unmask_irq(unsigned int irq) 31static void icu_unmask_irq(struct irq_data *d)
32{ 32{
33 uint32_t r = __raw_readl(ICU_INT_CONF(irq)); 33 uint32_t r = __raw_readl(ICU_INT_CONF(d->irq));
34 34
35 r |= ICU_INT_ROUTE_PJ4_IRQ; 35 r |= ICU_INT_ROUTE_PJ4_IRQ;
36 __raw_writel(r, ICU_INT_CONF(irq)); 36 __raw_writel(r, ICU_INT_CONF(d->irq));
37} 37}
38 38
39static struct irq_chip icu_irq_chip = { 39static struct irq_chip icu_irq_chip = {
40 .name = "icu_irq", 40 .name = "icu_irq",
41 .mask = icu_mask_irq, 41 .irq_mask = icu_mask_irq,
42 .mask_ack = icu_mask_irq, 42 .irq_mask_ack = icu_mask_irq,
43 .unmask = icu_unmask_irq, 43 .irq_unmask = icu_unmask_irq,
44}; 44};
45 45
46static void pmic_irq_ack(unsigned int irq) 46static void pmic_irq_ack(struct irq_data *d)
47{ 47{
48 if (irq == IRQ_MMP2_PMIC) 48 if (d->irq == IRQ_MMP2_PMIC)
49 mmp2_clear_pmic_int(); 49 mmp2_clear_pmic_int();
50} 50}
51 51
52#define SECOND_IRQ_MASK(_name_, irq_base, prefix) \ 52#define SECOND_IRQ_MASK(_name_, irq_base, prefix) \
53static void _name_##_mask_irq(unsigned int irq) \ 53static void _name_##_mask_irq(struct irq_data *d) \
54{ \ 54{ \
55 uint32_t r; \ 55 uint32_t r; \
56 r = __raw_readl(prefix##_MASK) | (1 << (irq - irq_base)); \ 56 r = __raw_readl(prefix##_MASK) | (1 << (d->irq - irq_base)); \
57 __raw_writel(r, prefix##_MASK); \ 57 __raw_writel(r, prefix##_MASK); \
58} 58}
59 59
60#define SECOND_IRQ_UNMASK(_name_, irq_base, prefix) \ 60#define SECOND_IRQ_UNMASK(_name_, irq_base, prefix) \
61static void _name_##_unmask_irq(unsigned int irq) \ 61static void _name_##_unmask_irq(struct irq_data *d) \
62{ \ 62{ \
63 uint32_t r; \ 63 uint32_t r; \
64 r = __raw_readl(prefix##_MASK) & ~(1 << (irq - irq_base)); \ 64 r = __raw_readl(prefix##_MASK) & ~(1 << (d->irq - irq_base)); \
65 __raw_writel(r, prefix##_MASK); \ 65 __raw_writel(r, prefix##_MASK); \
66} 66}
67 67
@@ -88,8 +88,8 @@ SECOND_IRQ_UNMASK(_name_, irq_base, prefix) \
88SECOND_IRQ_DEMUX(_name_, irq_base, prefix) \ 88SECOND_IRQ_DEMUX(_name_, irq_base, prefix) \
89static struct irq_chip _name_##_irq_chip = { \ 89static struct irq_chip _name_##_irq_chip = { \
90 .name = #_name_, \ 90 .name = #_name_, \
91 .mask = _name_##_mask_irq, \ 91 .irq_mask = _name_##_mask_irq, \
92 .unmask = _name_##_unmask_irq, \ 92 .irq_unmask = _name_##_unmask_irq, \
93} 93}
94 94
95SECOND_IRQ_CHIP(pmic, IRQ_MMP2_PMIC_BASE, MMP2_ICU_INT4); 95SECOND_IRQ_CHIP(pmic, IRQ_MMP2_PMIC_BASE, MMP2_ICU_INT4);
@@ -103,10 +103,12 @@ static void init_mux_irq(struct irq_chip *chip, int start, int num)
103 int irq; 103 int irq;
104 104
105 for (irq = start; num > 0; irq++, num--) { 105 for (irq = start; num > 0; irq++, num--) {
106 struct irq_data *d = irq_get_irq_data(irq);
107
106 /* mask and clear the IRQ */ 108 /* mask and clear the IRQ */
107 chip->mask(irq); 109 chip->irq_mask(d);
108 if (chip->ack) 110 if (chip->irq_ack)
109 chip->ack(irq); 111 chip->irq_ack(d);
110 112
111 set_irq_chip(irq, chip); 113 set_irq_chip(irq, chip);
112 set_irq_flags(irq, IRQF_VALID); 114 set_irq_flags(irq, IRQF_VALID);
@@ -119,7 +121,7 @@ void __init mmp2_init_icu(void)
119 int irq; 121 int irq;
120 122
121 for (irq = 0; irq < IRQ_MMP2_MUX_BASE; irq++) { 123 for (irq = 0; irq < IRQ_MMP2_MUX_BASE; irq++) {
122 icu_mask_irq(irq); 124 icu_mask_irq(irq_get_irq_data(irq));
123 set_irq_chip(irq, &icu_irq_chip); 125 set_irq_chip(irq, &icu_irq_chip);
124 set_irq_flags(irq, IRQF_VALID); 126 set_irq_flags(irq, IRQF_VALID);
125 127
@@ -139,7 +141,7 @@ void __init mmp2_init_icu(void)
139 /* NOTE: IRQ_MMP2_PMIC requires the PMIC MFPR register 141 /* NOTE: IRQ_MMP2_PMIC requires the PMIC MFPR register
140 * to be written to clear the interrupt 142 * to be written to clear the interrupt
141 */ 143 */
142 pmic_irq_chip.ack = pmic_irq_ack; 144 pmic_irq_chip.irq_ack = pmic_irq_ack;
143 145
144 init_mux_irq(&pmic_irq_chip, IRQ_MMP2_PMIC_BASE, 2); 146 init_mux_irq(&pmic_irq_chip, IRQ_MMP2_PMIC_BASE, 2);
145 init_mux_irq(&rtc_irq_chip, IRQ_MMP2_RTC_BASE, 2); 147 init_mux_irq(&rtc_irq_chip, IRQ_MMP2_RTC_BASE, 2);
diff --git a/arch/arm/mach-mmp/irq-pxa168.c b/arch/arm/mach-mmp/irq-pxa168.c
index 52ff2f065eba..f86b450cb93c 100644
--- a/arch/arm/mach-mmp/irq-pxa168.c
+++ b/arch/arm/mach-mmp/irq-pxa168.c
@@ -25,21 +25,21 @@
25#define PRIORITY_DEFAULT 0x1 25#define PRIORITY_DEFAULT 0x1
26#define PRIORITY_NONE 0x0 /* means IRQ disabled */ 26#define PRIORITY_NONE 0x0 /* means IRQ disabled */
27 27
28static void icu_mask_irq(unsigned int irq) 28static void icu_mask_irq(struct irq_data *d)
29{ 29{
30 __raw_writel(PRIORITY_NONE, ICU_INT_CONF(irq)); 30 __raw_writel(PRIORITY_NONE, ICU_INT_CONF(d->irq));
31} 31}
32 32
33static void icu_unmask_irq(unsigned int irq) 33static void icu_unmask_irq(struct irq_data *d)
34{ 34{
35 __raw_writel(IRQ_ROUTE_TO_AP | PRIORITY_DEFAULT, ICU_INT_CONF(irq)); 35 __raw_writel(IRQ_ROUTE_TO_AP | PRIORITY_DEFAULT, ICU_INT_CONF(d->irq));
36} 36}
37 37
38static struct irq_chip icu_irq_chip = { 38static struct irq_chip icu_irq_chip = {
39 .name = "icu_irq", 39 .name = "icu_irq",
40 .ack = icu_mask_irq, 40 .irq_ack = icu_mask_irq,
41 .mask = icu_mask_irq, 41 .irq_mask = icu_mask_irq,
42 .unmask = icu_unmask_irq, 42 .irq_unmask = icu_unmask_irq,
43}; 43};
44 44
45void __init icu_init_irq(void) 45void __init icu_init_irq(void)
@@ -47,7 +47,7 @@ void __init icu_init_irq(void)
47 int irq; 47 int irq;
48 48
49 for (irq = 0; irq < 64; irq++) { 49 for (irq = 0; irq < 64; irq++) {
50 icu_mask_irq(irq); 50 icu_mask_irq(irq_get_irq_data(irq));
51 set_irq_chip(irq, &icu_irq_chip); 51 set_irq_chip(irq, &icu_irq_chip);
52 set_irq_handler(irq, handle_level_irq); 52 set_irq_handler(irq, handle_level_irq);
53 set_irq_flags(irq, IRQF_VALID); 53 set_irq_flags(irq, IRQF_VALID);
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index f8c09ef6666f..a604ec1e44bf 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -113,52 +113,52 @@ static struct msm_gpio_chip msm_gpio_banks[] = {
113 TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0), 113 TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0),
114}; 114};
115 115
116static void trout_gpio_irq_ack(unsigned int irq) 116static void trout_gpio_irq_ack(struct irq_data *d)
117{ 117{
118 int bank = TROUT_INT_TO_BANK(irq); 118 int bank = TROUT_INT_TO_BANK(d->irq);
119 uint8_t mask = TROUT_INT_TO_MASK(irq); 119 uint8_t mask = TROUT_INT_TO_MASK(d->irq);
120 int reg = TROUT_BANK_TO_STAT_REG(bank); 120 int reg = TROUT_BANK_TO_STAT_REG(bank);
121 /*printk(KERN_INFO "trout_gpio_irq_ack irq %d\n", irq);*/ 121 /*printk(KERN_INFO "trout_gpio_irq_ack irq %d\n", d->irq);*/
122 writeb(mask, TROUT_CPLD_BASE + reg); 122 writeb(mask, TROUT_CPLD_BASE + reg);
123} 123}
124 124
125static void trout_gpio_irq_mask(unsigned int irq) 125static void trout_gpio_irq_mask(struct irq_data *d)
126{ 126{
127 unsigned long flags; 127 unsigned long flags;
128 uint8_t reg_val; 128 uint8_t reg_val;
129 int bank = TROUT_INT_TO_BANK(irq); 129 int bank = TROUT_INT_TO_BANK(d->irq);
130 uint8_t mask = TROUT_INT_TO_MASK(irq); 130 uint8_t mask = TROUT_INT_TO_MASK(d->irq);
131 int reg = TROUT_BANK_TO_MASK_REG(bank); 131 int reg = TROUT_BANK_TO_MASK_REG(bank);
132 132
133 local_irq_save(flags); 133 local_irq_save(flags);
134 reg_val = trout_int_mask[bank] |= mask; 134 reg_val = trout_int_mask[bank] |= mask;
135 /*printk(KERN_INFO "trout_gpio_irq_mask irq %d => %d:%02x\n", 135 /*printk(KERN_INFO "trout_gpio_irq_mask irq %d => %d:%02x\n",
136 irq, bank, reg_val);*/ 136 d->irq, bank, reg_val);*/
137 writeb(reg_val, TROUT_CPLD_BASE + reg); 137 writeb(reg_val, TROUT_CPLD_BASE + reg);
138 local_irq_restore(flags); 138 local_irq_restore(flags);
139} 139}
140 140
141static void trout_gpio_irq_unmask(unsigned int irq) 141static void trout_gpio_irq_unmask(struct irq_data *d)
142{ 142{
143 unsigned long flags; 143 unsigned long flags;
144 uint8_t reg_val; 144 uint8_t reg_val;
145 int bank = TROUT_INT_TO_BANK(irq); 145 int bank = TROUT_INT_TO_BANK(d->irq);
146 uint8_t mask = TROUT_INT_TO_MASK(irq); 146 uint8_t mask = TROUT_INT_TO_MASK(d->irq);
147 int reg = TROUT_BANK_TO_MASK_REG(bank); 147 int reg = TROUT_BANK_TO_MASK_REG(bank);
148 148
149 local_irq_save(flags); 149 local_irq_save(flags);
150 reg_val = trout_int_mask[bank] &= ~mask; 150 reg_val = trout_int_mask[bank] &= ~mask;
151 /*printk(KERN_INFO "trout_gpio_irq_unmask irq %d => %d:%02x\n", 151 /*printk(KERN_INFO "trout_gpio_irq_unmask irq %d => %d:%02x\n",
152 irq, bank, reg_val);*/ 152 d->irq, bank, reg_val);*/
153 writeb(reg_val, TROUT_CPLD_BASE + reg); 153 writeb(reg_val, TROUT_CPLD_BASE + reg);
154 local_irq_restore(flags); 154 local_irq_restore(flags);
155} 155}
156 156
157int trout_gpio_irq_set_wake(unsigned int irq, unsigned int on) 157int trout_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
158{ 158{
159 unsigned long flags; 159 unsigned long flags;
160 int bank = TROUT_INT_TO_BANK(irq); 160 int bank = TROUT_INT_TO_BANK(d->irq);
161 uint8_t mask = TROUT_INT_TO_MASK(irq); 161 uint8_t mask = TROUT_INT_TO_MASK(d->irq);
162 162
163 local_irq_save(flags); 163 local_irq_save(flags);
164 if(on) 164 if(on)
@@ -198,15 +198,15 @@ static void trout_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
198 } 198 }
199 int_base += TROUT_INT_BANK0_COUNT; 199 int_base += TROUT_INT_BANK0_COUNT;
200 } 200 }
201 desc->chip->ack(irq); 201 desc->irq_data.chip->irq_ack(&desc->irq_data);
202} 202}
203 203
204static struct irq_chip trout_gpio_irq_chip = { 204static struct irq_chip trout_gpio_irq_chip = {
205 .name = "troutgpio", 205 .name = "troutgpio",
206 .ack = trout_gpio_irq_ack, 206 .irq_ack = trout_gpio_irq_ack,
207 .mask = trout_gpio_irq_mask, 207 .irq_mask = trout_gpio_irq_mask,
208 .unmask = trout_gpio_irq_unmask, 208 .irq_unmask = trout_gpio_irq_unmask,
209 .set_wake = trout_gpio_irq_set_wake, 209 .irq_set_wake = trout_gpio_irq_set_wake,
210}; 210};
211 211
212/* 212/*
diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c
index 33051b509e88..176af9dcb8ee 100644
--- a/arch/arm/mach-msm/gpio.c
+++ b/arch/arm/mach-msm/gpio.c
@@ -225,21 +225,21 @@ struct msm_gpio_chip msm_gpio_chips[] = {
225#endif 225#endif
226}; 226};
227 227
228static void msm_gpio_irq_ack(unsigned int irq) 228static void msm_gpio_irq_ack(struct irq_data *d)
229{ 229{
230 unsigned long irq_flags; 230 unsigned long irq_flags;
231 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq); 231 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
232 spin_lock_irqsave(&msm_chip->lock, irq_flags); 232 spin_lock_irqsave(&msm_chip->lock, irq_flags);
233 msm_gpio_clear_detect_status(msm_chip, 233 msm_gpio_clear_detect_status(msm_chip,
234 irq - gpio_to_irq(msm_chip->chip.base)); 234 d->irq - gpio_to_irq(msm_chip->chip.base));
235 spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 235 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
236} 236}
237 237
238static void msm_gpio_irq_mask(unsigned int irq) 238static void msm_gpio_irq_mask(struct irq_data *d)
239{ 239{
240 unsigned long irq_flags; 240 unsigned long irq_flags;
241 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq); 241 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
242 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base); 242 unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base);
243 243
244 spin_lock_irqsave(&msm_chip->lock, irq_flags); 244 spin_lock_irqsave(&msm_chip->lock, irq_flags);
245 /* level triggered interrupts are also latched */ 245 /* level triggered interrupts are also latched */
@@ -250,11 +250,11 @@ static void msm_gpio_irq_mask(unsigned int irq)
250 spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 250 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
251} 251}
252 252
253static void msm_gpio_irq_unmask(unsigned int irq) 253static void msm_gpio_irq_unmask(struct irq_data *d)
254{ 254{
255 unsigned long irq_flags; 255 unsigned long irq_flags;
256 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq); 256 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
257 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base); 257 unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base);
258 258
259 spin_lock_irqsave(&msm_chip->lock, irq_flags); 259 spin_lock_irqsave(&msm_chip->lock, irq_flags);
260 /* level triggered interrupts are also latched */ 260 /* level triggered interrupts are also latched */
@@ -265,11 +265,11 @@ static void msm_gpio_irq_unmask(unsigned int irq)
265 spin_unlock_irqrestore(&msm_chip->lock, irq_flags); 265 spin_unlock_irqrestore(&msm_chip->lock, irq_flags);
266} 266}
267 267
268static int msm_gpio_irq_set_wake(unsigned int irq, unsigned int on) 268static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
269{ 269{
270 unsigned long irq_flags; 270 unsigned long irq_flags;
271 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq); 271 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
272 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base); 272 unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base);
273 273
274 spin_lock_irqsave(&msm_chip->lock, irq_flags); 274 spin_lock_irqsave(&msm_chip->lock, irq_flags);
275 275
@@ -282,21 +282,21 @@ static int msm_gpio_irq_set_wake(unsigned int irq, unsigned int on)
282 return 0; 282 return 0;
283} 283}
284 284
285static int msm_gpio_irq_set_type(unsigned int irq, unsigned int flow_type) 285static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type)
286{ 286{
287 unsigned long irq_flags; 287 unsigned long irq_flags;
288 struct msm_gpio_chip *msm_chip = get_irq_chip_data(irq); 288 struct msm_gpio_chip *msm_chip = irq_data_get_irq_chip_data(d);
289 unsigned offset = irq - gpio_to_irq(msm_chip->chip.base); 289 unsigned offset = d->irq - gpio_to_irq(msm_chip->chip.base);
290 unsigned val, mask = BIT(offset); 290 unsigned val, mask = BIT(offset);
291 291
292 spin_lock_irqsave(&msm_chip->lock, irq_flags); 292 spin_lock_irqsave(&msm_chip->lock, irq_flags);
293 val = readl(msm_chip->regs.int_edge); 293 val = readl(msm_chip->regs.int_edge);
294 if (flow_type & IRQ_TYPE_EDGE_BOTH) { 294 if (flow_type & IRQ_TYPE_EDGE_BOTH) {
295 writel(val | mask, msm_chip->regs.int_edge); 295 writel(val | mask, msm_chip->regs.int_edge);
296 irq_desc[irq].handle_irq = handle_edge_irq; 296 irq_desc[d->irq].handle_irq = handle_edge_irq;
297 } else { 297 } else {
298 writel(val & ~mask, msm_chip->regs.int_edge); 298 writel(val & ~mask, msm_chip->regs.int_edge);
299 irq_desc[irq].handle_irq = handle_level_irq; 299 irq_desc[d->irq].handle_irq = handle_level_irq;
300 } 300 }
301 if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { 301 if ((flow_type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
302 msm_chip->both_edge_detect |= mask; 302 msm_chip->both_edge_detect |= mask;
@@ -333,16 +333,16 @@ static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
333 msm_chip->chip.base + j); 333 msm_chip->chip.base + j);
334 } 334 }
335 } 335 }
336 desc->chip->ack(irq); 336 desc->irq_data.chip->irq_ack(&desc->irq_data);
337} 337}
338 338
339static struct irq_chip msm_gpio_irq_chip = { 339static struct irq_chip msm_gpio_irq_chip = {
340 .name = "msmgpio", 340 .name = "msmgpio",
341 .ack = msm_gpio_irq_ack, 341 .irq_ack = msm_gpio_irq_ack,
342 .mask = msm_gpio_irq_mask, 342 .irq_mask = msm_gpio_irq_mask,
343 .unmask = msm_gpio_irq_unmask, 343 .irq_unmask = msm_gpio_irq_unmask,
344 .set_wake = msm_gpio_irq_set_wake, 344 .irq_set_wake = msm_gpio_irq_set_wake,
345 .set_type = msm_gpio_irq_set_type, 345 .irq_set_type = msm_gpio_irq_set_type,
346}; 346};
347 347
348static int __init msm_init_gpio(void) 348static int __init msm_init_gpio(void)
diff --git a/arch/arm/mach-msm/irq-vic.c b/arch/arm/mach-msm/irq-vic.c
index 99f2c3473033..68c28bbdc969 100644
--- a/arch/arm/mach-msm/irq-vic.c
+++ b/arch/arm/mach-msm/irq-vic.c
@@ -226,19 +226,18 @@ static inline void msm_irq_write_all_regs(void __iomem *base, unsigned int val)
226 writel(val, base + (i * 4)); 226 writel(val, base + (i * 4));
227} 227}
228 228
229static void msm_irq_ack(unsigned int irq) 229static void msm_irq_ack(struct irq_data *d)
230{ 230{
231 void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_CLEAR0, irq); 231 void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_CLEAR0, d->irq);
232 irq = 1 << (irq & 31); 232 writel(1 << (d->irq & 31), reg);
233 writel(irq, reg);
234} 233}
235 234
236static void msm_irq_mask(unsigned int irq) 235static void msm_irq_mask(struct irq_data *d)
237{ 236{
238 void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_ENCLEAR0, irq); 237 void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_ENCLEAR0, d->irq);
239 unsigned index = VIC_INT_TO_REG_INDEX(irq); 238 unsigned index = VIC_INT_TO_REG_INDEX(d->irq);
240 uint32_t mask = 1UL << (irq & 31); 239 uint32_t mask = 1UL << (d->irq & 31);
241 int smsm_irq = msm_irq_to_smsm[irq]; 240 int smsm_irq = msm_irq_to_smsm[d->irq];
242 241
243 msm_irq_shadow_reg[index].int_en[0] &= ~mask; 242 msm_irq_shadow_reg[index].int_en[0] &= ~mask;
244 writel(mask, reg); 243 writel(mask, reg);
@@ -250,12 +249,12 @@ static void msm_irq_mask(unsigned int irq)
250 } 249 }
251} 250}
252 251
253static void msm_irq_unmask(unsigned int irq) 252static void msm_irq_unmask(struct irq_data *d)
254{ 253{
255 void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_ENSET0, irq); 254 void __iomem *reg = VIC_INT_TO_REG_ADDR(VIC_INT_ENSET0, d->irq);
256 unsigned index = VIC_INT_TO_REG_INDEX(irq); 255 unsigned index = VIC_INT_TO_REG_INDEX(d->irq);
257 uint32_t mask = 1UL << (irq & 31); 256 uint32_t mask = 1UL << (d->irq & 31);
258 int smsm_irq = msm_irq_to_smsm[irq]; 257 int smsm_irq = msm_irq_to_smsm[d->irq];
259 258
260 msm_irq_shadow_reg[index].int_en[0] |= mask; 259 msm_irq_shadow_reg[index].int_en[0] |= mask;
261 writel(mask, reg); 260 writel(mask, reg);
@@ -268,14 +267,14 @@ static void msm_irq_unmask(unsigned int irq)
268 } 267 }
269} 268}
270 269
271static int msm_irq_set_wake(unsigned int irq, unsigned int on) 270static int msm_irq_set_wake(struct irq_data *d, unsigned int on)
272{ 271{
273 unsigned index = VIC_INT_TO_REG_INDEX(irq); 272 unsigned index = VIC_INT_TO_REG_INDEX(d->irq);
274 uint32_t mask = 1UL << (irq & 31); 273 uint32_t mask = 1UL << (d->irq & 31);
275 int smsm_irq = msm_irq_to_smsm[irq]; 274 int smsm_irq = msm_irq_to_smsm[d->irq];
276 275
277 if (smsm_irq == 0) { 276 if (smsm_irq == 0) {
278 printk(KERN_ERR "msm_irq_set_wake: bad wakeup irq %d\n", irq); 277 printk(KERN_ERR "msm_irq_set_wake: bad wakeup irq %d\n", d->irq);
279 return -EINVAL; 278 return -EINVAL;
280 } 279 }
281 if (on) 280 if (on)
@@ -294,12 +293,12 @@ static int msm_irq_set_wake(unsigned int irq, unsigned int on)
294 return 0; 293 return 0;
295} 294}
296 295
297static int msm_irq_set_type(unsigned int irq, unsigned int flow_type) 296static int msm_irq_set_type(struct irq_data *d, unsigned int flow_type)
298{ 297{
299 void __iomem *treg = VIC_INT_TO_REG_ADDR(VIC_INT_TYPE0, irq); 298 void __iomem *treg = VIC_INT_TO_REG_ADDR(VIC_INT_TYPE0, d->irq);
300 void __iomem *preg = VIC_INT_TO_REG_ADDR(VIC_INT_POLARITY0, irq); 299 void __iomem *preg = VIC_INT_TO_REG_ADDR(VIC_INT_POLARITY0, d->irq);
301 unsigned index = VIC_INT_TO_REG_INDEX(irq); 300 unsigned index = VIC_INT_TO_REG_INDEX(d->irq);
302 int b = 1 << (irq & 31); 301 int b = 1 << (d->irq & 31);
303 uint32_t polarity; 302 uint32_t polarity;
304 uint32_t type; 303 uint32_t type;
305 304
@@ -314,11 +313,11 @@ static int msm_irq_set_type(unsigned int irq, unsigned int flow_type)
314 type = msm_irq_shadow_reg[index].int_type; 313 type = msm_irq_shadow_reg[index].int_type;
315 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 314 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
316 type |= b; 315 type |= b;
317 irq_desc[irq].handle_irq = handle_edge_irq; 316 irq_desc[d->irq].handle_irq = handle_edge_irq;
318 } 317 }
319 if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) { 318 if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) {
320 type &= ~b; 319 type &= ~b;
321 irq_desc[irq].handle_irq = handle_level_irq; 320 irq_desc[d->irq].handle_irq = handle_level_irq;
322 } 321 }
323 writel(type, treg); 322 writel(type, treg);
324 msm_irq_shadow_reg[index].int_type = type; 323 msm_irq_shadow_reg[index].int_type = type;
@@ -326,13 +325,13 @@ static int msm_irq_set_type(unsigned int irq, unsigned int flow_type)
326} 325}
327 326
328static struct irq_chip msm_irq_chip = { 327static struct irq_chip msm_irq_chip = {
329 .name = "msm", 328 .name = "msm",
330 .disable = msm_irq_mask, 329 .irq_disable = msm_irq_mask,
331 .ack = msm_irq_ack, 330 .irq_ack = msm_irq_ack,
332 .mask = msm_irq_mask, 331 .irq_mask = msm_irq_mask,
333 .unmask = msm_irq_unmask, 332 .irq_unmask = msm_irq_unmask,
334 .set_wake = msm_irq_set_wake, 333 .irq_set_wake = msm_irq_set_wake,
335 .set_type = msm_irq_set_type, 334 .irq_set_type = msm_irq_set_type,
336}; 335};
337 336
338void __init msm_init_irq(void) 337void __init msm_init_irq(void)
diff --git a/arch/arm/mach-msm/irq.c b/arch/arm/mach-msm/irq.c
index 6c8d5f8caef3..0b27d899f40e 100644
--- a/arch/arm/mach-msm/irq.c
+++ b/arch/arm/mach-msm/irq.c
@@ -64,35 +64,34 @@
64#define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4)) 64#define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4))
65#define VIC_VECTADDR(n) VIC_REG(0x0400+((n) * 4)) 65#define VIC_VECTADDR(n) VIC_REG(0x0400+((n) * 4))
66 66
67static void msm_irq_ack(unsigned int irq) 67static void msm_irq_ack(struct irq_data *d)
68{ 68{
69 void __iomem *reg = VIC_INT_CLEAR0 + ((irq & 32) ? 4 : 0); 69 void __iomem *reg = VIC_INT_CLEAR0 + ((d->irq & 32) ? 4 : 0);
70 irq = 1 << (irq & 31); 70 writel(1 << (d->irq & 31), reg);
71 writel(irq, reg);
72} 71}
73 72
74static void msm_irq_mask(unsigned int irq) 73static void msm_irq_mask(struct irq_data *d)
75{ 74{
76 void __iomem *reg = VIC_INT_ENCLEAR0 + ((irq & 32) ? 4 : 0); 75 void __iomem *reg = VIC_INT_ENCLEAR0 + ((d->irq & 32) ? 4 : 0);
77 writel(1 << (irq & 31), reg); 76 writel(1 << (d->irq & 31), reg);
78} 77}
79 78
80static void msm_irq_unmask(unsigned int irq) 79static void msm_irq_unmask(struct irq_data *d)
81{ 80{
82 void __iomem *reg = VIC_INT_ENSET0 + ((irq & 32) ? 4 : 0); 81 void __iomem *reg = VIC_INT_ENSET0 + ((d->irq & 32) ? 4 : 0);
83 writel(1 << (irq & 31), reg); 82 writel(1 << (d->irq & 31), reg);
84} 83}
85 84
86static int msm_irq_set_wake(unsigned int irq, unsigned int on) 85static int msm_irq_set_wake(struct irq_data *d, unsigned int on)
87{ 86{
88 return -EINVAL; 87 return -EINVAL;
89} 88}
90 89
91static int msm_irq_set_type(unsigned int irq, unsigned int flow_type) 90static int msm_irq_set_type(struct irq_data *d, unsigned int flow_type)
92{ 91{
93 void __iomem *treg = VIC_INT_TYPE0 + ((irq & 32) ? 4 : 0); 92 void __iomem *treg = VIC_INT_TYPE0 + ((d->irq & 32) ? 4 : 0);
94 void __iomem *preg = VIC_INT_POLARITY0 + ((irq & 32) ? 4 : 0); 93 void __iomem *preg = VIC_INT_POLARITY0 + ((d->irq & 32) ? 4 : 0);
95 int b = 1 << (irq & 31); 94 int b = 1 << (d->irq & 31);
96 95
97 if (flow_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW)) 96 if (flow_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
98 writel(readl(preg) | b, preg); 97 writel(readl(preg) | b, preg);
@@ -101,22 +100,22 @@ static int msm_irq_set_type(unsigned int irq, unsigned int flow_type)
101 100
102 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 101 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
103 writel(readl(treg) | b, treg); 102 writel(readl(treg) | b, treg);
104 irq_desc[irq].handle_irq = handle_edge_irq; 103 irq_desc[d->irq].handle_irq = handle_edge_irq;
105 } 104 }
106 if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) { 105 if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) {
107 writel(readl(treg) & (~b), treg); 106 writel(readl(treg) & (~b), treg);
108 irq_desc[irq].handle_irq = handle_level_irq; 107 irq_desc[d->irq].handle_irq = handle_level_irq;
109 } 108 }
110 return 0; 109 return 0;
111} 110}
112 111
113static struct irq_chip msm_irq_chip = { 112static struct irq_chip msm_irq_chip = {
114 .name = "msm", 113 .name = "msm",
115 .ack = msm_irq_ack, 114 .irq_ack = msm_irq_ack,
116 .mask = msm_irq_mask, 115 .irq_mask = msm_irq_mask,
117 .unmask = msm_irq_unmask, 116 .irq_unmask = msm_irq_unmask,
118 .set_wake = msm_irq_set_wake, 117 .irq_set_wake = msm_irq_set_wake,
119 .set_type = msm_irq_set_type, 118 .irq_set_type = msm_irq_set_type,
120}; 119};
121 120
122void __init msm_init_irq(void) 121void __init msm_init_irq(void)
diff --git a/arch/arm/mach-msm/sirc.c b/arch/arm/mach-msm/sirc.c
index 152eefda3ce6..11b54c7aeb09 100644
--- a/arch/arm/mach-msm/sirc.c
+++ b/arch/arm/mach-msm/sirc.c
@@ -42,12 +42,11 @@ static struct sirc_cascade_regs sirc_reg_table[] = {
42 42
43/* Mask off the given interrupt. Keep the int_enable mask in sync with 43/* Mask off the given interrupt. Keep the int_enable mask in sync with
44 the enable reg, so it can be restored after power collapse. */ 44 the enable reg, so it can be restored after power collapse. */
45static void sirc_irq_mask(unsigned int irq) 45static void sirc_irq_mask(struct irq_data *d)
46{ 46{
47 unsigned int mask; 47 unsigned int mask;
48 48
49 49 mask = 1 << (d->irq - FIRST_SIRC_IRQ);
50 mask = 1 << (irq - FIRST_SIRC_IRQ);
51 writel(mask, sirc_regs.int_enable_clear); 50 writel(mask, sirc_regs.int_enable_clear);
52 int_enable &= ~mask; 51 int_enable &= ~mask;
53 return; 52 return;
@@ -55,31 +54,31 @@ static void sirc_irq_mask(unsigned int irq)
55 54
56/* Unmask the given interrupt. Keep the int_enable mask in sync with 55/* Unmask the given interrupt. Keep the int_enable mask in sync with
57 the enable reg, so it can be restored after power collapse. */ 56 the enable reg, so it can be restored after power collapse. */
58static void sirc_irq_unmask(unsigned int irq) 57static void sirc_irq_unmask(struct irq_data *d)
59{ 58{
60 unsigned int mask; 59 unsigned int mask;
61 60
62 mask = 1 << (irq - FIRST_SIRC_IRQ); 61 mask = 1 << (d->irq - FIRST_SIRC_IRQ);
63 writel(mask, sirc_regs.int_enable_set); 62 writel(mask, sirc_regs.int_enable_set);
64 int_enable |= mask; 63 int_enable |= mask;
65 return; 64 return;
66} 65}
67 66
68static void sirc_irq_ack(unsigned int irq) 67static void sirc_irq_ack(struct irq_data *d)
69{ 68{
70 unsigned int mask; 69 unsigned int mask;
71 70
72 mask = 1 << (irq - FIRST_SIRC_IRQ); 71 mask = 1 << (d->irq - FIRST_SIRC_IRQ);
73 writel(mask, sirc_regs.int_clear); 72 writel(mask, sirc_regs.int_clear);
74 return; 73 return;
75} 74}
76 75
77static int sirc_irq_set_wake(unsigned int irq, unsigned int on) 76static int sirc_irq_set_wake(struct irq_data *d, unsigned int on)
78{ 77{
79 unsigned int mask; 78 unsigned int mask;
80 79
81 /* Used to set the interrupt enable mask during power collapse. */ 80 /* Used to set the interrupt enable mask during power collapse. */
82 mask = 1 << (irq - FIRST_SIRC_IRQ); 81 mask = 1 << (d->irq - FIRST_SIRC_IRQ);
83 if (on) 82 if (on)
84 wake_enable |= mask; 83 wake_enable |= mask;
85 else 84 else
@@ -88,12 +87,12 @@ static int sirc_irq_set_wake(unsigned int irq, unsigned int on)
88 return 0; 87 return 0;
89} 88}
90 89
91static int sirc_irq_set_type(unsigned int irq, unsigned int flow_type) 90static int sirc_irq_set_type(struct irq_data *d, unsigned int flow_type)
92{ 91{
93 unsigned int mask; 92 unsigned int mask;
94 unsigned int val; 93 unsigned int val;
95 94
96 mask = 1 << (irq - FIRST_SIRC_IRQ); 95 mask = 1 << (d->irq - FIRST_SIRC_IRQ);
97 val = readl(sirc_regs.int_polarity); 96 val = readl(sirc_regs.int_polarity);
98 97
99 if (flow_type & (IRQF_TRIGGER_LOW | IRQF_TRIGGER_FALLING)) 98 if (flow_type & (IRQF_TRIGGER_LOW | IRQF_TRIGGER_FALLING))
@@ -106,10 +105,10 @@ static int sirc_irq_set_type(unsigned int irq, unsigned int flow_type)
106 val = readl(sirc_regs.int_type); 105 val = readl(sirc_regs.int_type);
107 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { 106 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
108 val |= mask; 107 val |= mask;
109 irq_desc[irq].handle_irq = handle_edge_irq; 108 irq_desc[d->irq].handle_irq = handle_edge_irq;
110 } else { 109 } else {
111 val &= ~mask; 110 val &= ~mask;
112 irq_desc[irq].handle_irq = handle_level_irq; 111 irq_desc[d->irq].handle_irq = handle_level_irq;
113 } 112 }
114 113
115 writel(val, sirc_regs.int_type); 114 writel(val, sirc_regs.int_type);
@@ -139,16 +138,16 @@ static void sirc_irq_handler(unsigned int irq, struct irq_desc *desc)
139 ; 138 ;
140 generic_handle_irq(sirq+FIRST_SIRC_IRQ); 139 generic_handle_irq(sirq+FIRST_SIRC_IRQ);
141 140
142 desc->chip->ack(irq); 141 desc->irq_data.chip->irq_ack(&desc->irq_data);
143} 142}
144 143
145static struct irq_chip sirc_irq_chip = { 144static struct irq_chip sirc_irq_chip = {
146 .name = "sirc", 145 .name = "sirc",
147 .ack = sirc_irq_ack, 146 .irq_ack = sirc_irq_ack,
148 .mask = sirc_irq_mask, 147 .irq_mask = sirc_irq_mask,
149 .unmask = sirc_irq_unmask, 148 .irq_unmask = sirc_irq_unmask,
150 .set_wake = sirc_irq_set_wake, 149 .irq_set_wake = sirc_irq_set_wake,
151 .set_type = sirc_irq_set_type, 150 .irq_set_type = sirc_irq_set_type,
152}; 151};
153 152
154void __init msm_init_sirc(void) 153void __init msm_init_sirc(void)
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index 899a969e92fa..0d65db885be7 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -147,10 +147,10 @@ static struct mc13783_regulator_init_data mx31_3ds_regulators[] = {
147 .init_data = &pwgtx_init, 147 .init_data = &pwgtx_init,
148 }, { 148 }, {
149 149
150 .id = MC13783_REGU_GPO1, /* Turn on 1.8V */ 150 .id = MC13783_REG_GPO1, /* Turn on 1.8V */
151 .init_data = &gpo_init, 151 .init_data = &gpo_init,
152 }, { 152 }, {
153 .id = MC13783_REGU_GPO3, /* Turn on 3.3V */ 153 .id = MC13783_REG_GPO3, /* Turn on 3.3V */
154 .init_data = &gpo_init, 154 .init_data = &gpo_init,
155 }, 155 },
156}; 156};
diff --git a/arch/arm/mach-mx3/mach-mx31ads.c b/arch/arm/mach-mx3/mach-mx31ads.c
index b993b9bf6179..88b97d62b57e 100644
--- a/arch/arm/mach-mx3/mach-mx31ads.c
+++ b/arch/arm/mach-mx3/mach-mx31ads.c
@@ -162,9 +162,9 @@ static void mx31ads_expio_irq_handler(u32 irq, struct irq_desc *desc)
162 * Disable an expio pin's interrupt by setting the bit in the imr. 162 * Disable an expio pin's interrupt by setting the bit in the imr.
163 * @param irq an expio virtual irq number 163 * @param irq an expio virtual irq number
164 */ 164 */
165static void expio_mask_irq(u32 irq) 165static void expio_mask_irq(struct irq_data *d)
166{ 166{
167 u32 expio = MXC_IRQ_TO_EXPIO(irq); 167 u32 expio = MXC_IRQ_TO_EXPIO(d->irq);
168 /* mask the interrupt */ 168 /* mask the interrupt */
169 __raw_writew(1 << expio, PBC_INTMASK_CLEAR_REG); 169 __raw_writew(1 << expio, PBC_INTMASK_CLEAR_REG);
170 __raw_readw(PBC_INTMASK_CLEAR_REG); 170 __raw_readw(PBC_INTMASK_CLEAR_REG);
@@ -174,9 +174,9 @@ static void expio_mask_irq(u32 irq)
174 * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr. 174 * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr.
175 * @param irq an expanded io virtual irq number 175 * @param irq an expanded io virtual irq number
176 */ 176 */
177static void expio_ack_irq(u32 irq) 177static void expio_ack_irq(struct irq_data *d)
178{ 178{
179 u32 expio = MXC_IRQ_TO_EXPIO(irq); 179 u32 expio = MXC_IRQ_TO_EXPIO(d->irq);
180 /* clear the interrupt status */ 180 /* clear the interrupt status */
181 __raw_writew(1 << expio, PBC_INTSTATUS_REG); 181 __raw_writew(1 << expio, PBC_INTSTATUS_REG);
182} 182}
@@ -185,18 +185,18 @@ static void expio_ack_irq(u32 irq)
185 * Enable a expio pin's interrupt by clearing the bit in the imr. 185 * Enable a expio pin's interrupt by clearing the bit in the imr.
186 * @param irq a expio virtual irq number 186 * @param irq a expio virtual irq number
187 */ 187 */
188static void expio_unmask_irq(u32 irq) 188static void expio_unmask_irq(struct irq_data *d)
189{ 189{
190 u32 expio = MXC_IRQ_TO_EXPIO(irq); 190 u32 expio = MXC_IRQ_TO_EXPIO(d->irq);
191 /* unmask the interrupt */ 191 /* unmask the interrupt */
192 __raw_writew(1 << expio, PBC_INTMASK_SET_REG); 192 __raw_writew(1 << expio, PBC_INTMASK_SET_REG);
193} 193}
194 194
195static struct irq_chip expio_irq_chip = { 195static struct irq_chip expio_irq_chip = {
196 .name = "EXPIO(CPLD)", 196 .name = "EXPIO(CPLD)",
197 .ack = expio_ack_irq, 197 .irq_ack = expio_ack_irq,
198 .mask = expio_mask_irq, 198 .irq_mask = expio_mask_irq,
199 .unmask = expio_unmask_irq, 199 .irq_unmask = expio_unmask_irq,
200}; 200};
201 201
202static void __init mx31ads_init_expio(void) 202static void __init mx31ads_init_expio(void)
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 55254b6e9460..de4fa992fc3e 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -50,6 +50,7 @@ config MACH_MX51_BABBAGE
50config MACH_MX51_3DS 50config MACH_MX51_3DS
51 bool "Support MX51PDK (3DS)" 51 bool "Support MX51PDK (3DS)"
52 select SOC_IMX51 52 select SOC_IMX51
53 select IMX_HAVE_PLATFORM_IMX_KEYPAD
53 select IMX_HAVE_PLATFORM_IMX_UART 54 select IMX_HAVE_PLATFORM_IMX_UART
54 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 55 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
55 select IMX_HAVE_PLATFORM_SPI_IMX 56 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -77,6 +78,7 @@ choice
77config MACH_EUKREA_MBIMX51_BASEBOARD 78config MACH_EUKREA_MBIMX51_BASEBOARD
78 prompt "Eukrea MBIMX51 development board" 79 prompt "Eukrea MBIMX51 development board"
79 bool 80 bool
81 select IMX_HAVE_PLATFORM_IMX_KEYPAD
80 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 82 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
81 help 83 help
82 This adds board specific devices that can be found on Eukrea's 84 This adds board specific devices that can be found on Eukrea's
@@ -124,10 +126,28 @@ config MACH_MX53_EVK
124 bool "Support MX53 EVK platforms" 126 bool "Support MX53 EVK platforms"
125 select SOC_IMX53 127 select SOC_IMX53
126 select IMX_HAVE_PLATFORM_IMX_UART 128 select IMX_HAVE_PLATFORM_IMX_UART
129 select IMX_HAVE_PLATFORM_IMX_I2C
130 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
131 select IMX_HAVE_PLATFORM_SPI_IMX
127 help 132 help
128 Include support for MX53 EVK platform. This includes specific 133 Include support for MX53 EVK platform. This includes specific
129 configurations for the board and its peripherals. 134 configurations for the board and its peripherals.
130 135
136config MACH_MX53_SMD
137 bool "Support MX53 SMD platforms"
138 select SOC_IMX53
139 select IMX_HAVE_PLATFORM_IMX_UART
140 help
141 Include support for MX53 SMD platform. This includes specific
142 configurations for the board and its peripherals.
143
144config MACH_MX53_LOCO
145 bool "Support MX53 LOCO platforms"
146 select SOC_IMX53
147 select IMX_HAVE_PLATFORM_IMX_UART
148 help
149 Include support for MX53 LOCO platform. This includes specific
150 configurations for the board and its peripherals.
131 151
132config MACH_MX50_RDP 152config MACH_MX50_RDP
133 bool "Support MX50 reference design platform" 153 bool "Support MX50 reference design platform"
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 0c398baf11fe..0d43be98e51c 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -10,6 +10,8 @@ obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
10obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o 10obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
11obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o 11obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
12obj-$(CONFIG_MACH_MX53_EVK) += board-mx53_evk.o 12obj-$(CONFIG_MACH_MX53_EVK) += board-mx53_evk.o
13obj-$(CONFIG_MACH_MX53_SMD) += board-mx53_smd.o
14obj-$(CONFIG_MACH_MX53_LOCO) += board-mx53_loco.o
13obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o 15obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
14obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o 16obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
15obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o 17obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += board-cpuimx51sd.o
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
index e42bd2eb034e..49d644842379 100644
--- a/arch/arm/mach-mx5/board-mx51_3ds.c
+++ b/arch/arm/mach-mx5/board-mx51_3ds.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input/matrix_keypad.h>
16#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
17 16
18#include <asm/mach-types.h> 17#include <asm/mach-types.h>
@@ -120,14 +119,14 @@ static int mx51_3ds_board_keymap[] = {
120 KEY(3, 5, KEY_BACK) 119 KEY(3, 5, KEY_BACK)
121}; 120};
122 121
123static struct matrix_keymap_data mx51_3ds_map_data = { 122static const struct matrix_keymap_data mx51_3ds_map_data __initconst = {
124 .keymap = mx51_3ds_board_keymap, 123 .keymap = mx51_3ds_board_keymap,
125 .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap), 124 .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap),
126}; 125};
127 126
128static void mxc_init_keypad(void) 127static void mxc_init_keypad(void)
129{ 128{
130 mxc_register_device(&mxc_keypad_device, &mx51_3ds_map_data); 129 imx51_add_imx_keypad(&mx51_3ds_map_data);
131} 130}
132#else 131#else
133static inline void mxc_init_keypad(void) 132static inline void mxc_init_keypad(void)
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
index fa97d0d5dd05..caee04c08238 100644
--- a/arch/arm/mach-mx5/board-mx53_evk.c
+++ b/arch/arm/mach-mx5/board-mx53_evk.c
@@ -21,6 +21,11 @@
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/fec.h>
25#include <linux/delay.h>
26#include <linux/gpio.h>
27#include <linux/spi/flash.h>
28#include <linux/spi/spi.h>
24#include <mach/common.h> 29#include <mach/common.h>
25#include <mach/hardware.h> 30#include <mach/hardware.h>
26#include <asm/mach-types.h> 31#include <asm/mach-types.h>
@@ -29,6 +34,10 @@
29#include <mach/imx-uart.h> 34#include <mach/imx-uart.h>
30#include <mach/iomux-mx53.h> 35#include <mach/iomux-mx53.h>
31 36
37#define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6)
38#define EVK_ECSPI1_CS0 IMX_GPIO_NR(2, 30)
39#define EVK_ECSPI1_CS1 IMX_GPIO_NR(3, 19)
40
32#include "crm_regs.h" 41#include "crm_regs.h"
33#include "devices-imx53.h" 42#include "devices-imx53.h"
34 43
@@ -47,6 +56,14 @@ static iomux_v3_cfg_t mx53_evk_pads[] = {
47 MX53_PAD_ATA_CS_1__UART3_RXD, 56 MX53_PAD_ATA_CS_1__UART3_RXD,
48 MX53_PAD_ATA_DA_1__UART3_CTS, 57 MX53_PAD_ATA_DA_1__UART3_CTS,
49 MX53_PAD_ATA_DA_2__UART3_RTS, 58 MX53_PAD_ATA_DA_2__UART3_RTS,
59
60 MX53_PAD_EIM_D16__CSPI1_SCLK,
61 MX53_PAD_EIM_D17__CSPI1_MISO,
62 MX53_PAD_EIM_D18__CSPI1_MOSI,
63
64 /* ecspi chip select lines */
65 MX53_PAD_EIM_EB2__GPIO_2_30,
66 MX53_PAD_EIM_D19__GPIO_3_19,
50}; 67};
51 68
52static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = { 69static const struct imxuart_platform_data mx53_evk_uart_pdata __initconst = {
@@ -60,11 +77,68 @@ static inline void mx53_evk_init_uart(void)
60 imx53_add_imx_uart(2, &mx53_evk_uart_pdata); 77 imx53_add_imx_uart(2, &mx53_evk_uart_pdata);
61} 78}
62 79
80static const struct imxi2c_platform_data mx53_evk_i2c_data __initconst = {
81 .bitrate = 100000,
82};
83
84static inline void mx53_evk_fec_reset(void)
85{
86 int ret;
87
88 /* reset FEC PHY */
89 ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
90 if (ret) {
91 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
92 return;
93 }
94 gpio_direction_output(SMD_FEC_PHY_RST, 0);
95 gpio_set_value(SMD_FEC_PHY_RST, 0);
96 msleep(1);
97 gpio_set_value(SMD_FEC_PHY_RST, 1);
98}
99
100static struct fec_platform_data mx53_evk_fec_pdata = {
101 .phy = PHY_INTERFACE_MODE_RMII,
102};
103
104static struct spi_board_info mx53_evk_spi_board_info[] __initdata = {
105 {
106 .modalias = "mtd_dataflash",
107 .max_speed_hz = 25000000,
108 .bus_num = 0,
109 .chip_select = 1,
110 .mode = SPI_MODE_0,
111 .platform_data = NULL,
112 },
113};
114
115static int mx53_evk_spi_cs[] = {
116 EVK_ECSPI1_CS0,
117 EVK_ECSPI1_CS1,
118};
119
120static const struct spi_imx_master mx53_evk_spi_data __initconst = {
121 .chipselect = mx53_evk_spi_cs,
122 .num_chipselect = ARRAY_SIZE(mx53_evk_spi_cs),
123};
124
63static void __init mx53_evk_board_init(void) 125static void __init mx53_evk_board_init(void)
64{ 126{
65 mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads, 127 mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,
66 ARRAY_SIZE(mx53_evk_pads)); 128 ARRAY_SIZE(mx53_evk_pads));
67 mx53_evk_init_uart(); 129 mx53_evk_init_uart();
130 mx53_evk_fec_reset();
131 imx53_add_fec(&mx53_evk_fec_pdata);
132
133 imx53_add_imx_i2c(0, &mx53_evk_i2c_data);
134 imx53_add_imx_i2c(1, &mx53_evk_i2c_data);
135
136 imx53_add_sdhci_esdhc_imx(0, NULL);
137 imx53_add_sdhci_esdhc_imx(1, NULL);
138
139 spi_register_board_info(mx53_evk_spi_board_info,
140 ARRAY_SIZE(mx53_evk_spi_board_info));
141 imx53_add_ecspi(0, &mx53_evk_spi_data);
68} 142}
69 143
70static void __init mx53_evk_timer_init(void) 144static void __init mx53_evk_timer_init(void)
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
new file mode 100644
index 000000000000..d1348e04ace3
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/init.h>
22#include <linux/clk.h>
23#include <linux/fec.h>
24#include <linux/delay.h>
25#include <linux/gpio.h>
26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/imx-uart.h>
30#include <mach/iomux-mx53.h>
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35
36#include "crm_regs.h"
37#include "devices-imx53.h"
38
39#define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)
40
41static iomux_v3_cfg_t mx53_loco_pads[] = {
42 MX53_PAD_CSI0_D10__UART1_TXD,
43 MX53_PAD_CSI0_D11__UART1_RXD,
44 MX53_PAD_ATA_DIOW__UART1_TXD,
45 MX53_PAD_ATA_DMACK__UART1_RXD,
46
47 MX53_PAD_ATA_BUFFER_EN__UART2_RXD,
48 MX53_PAD_ATA_DMARQ__UART2_TXD,
49 MX53_PAD_ATA_DIOR__UART2_RTS,
50 MX53_PAD_ATA_INTRQ__UART2_CTS,
51
52 MX53_PAD_ATA_CS_0__UART3_TXD,
53 MX53_PAD_ATA_CS_1__UART3_RXD,
54 MX53_PAD_ATA_DA_1__UART3_CTS,
55 MX53_PAD_ATA_DA_2__UART3_RTS,
56};
57
58static const struct imxuart_platform_data mx53_loco_uart_data __initconst = {
59 .flags = IMXUART_HAVE_RTSCTS,
60};
61
62static inline void mx53_loco_init_uart(void)
63{
64 imx53_add_imx_uart(0, &mx53_loco_uart_data);
65 imx53_add_imx_uart(1, &mx53_loco_uart_data);
66 imx53_add_imx_uart(2, &mx53_loco_uart_data);
67}
68
69static inline void mx53_loco_fec_reset(void)
70{
71 int ret;
72
73 /* reset FEC PHY */
74 ret = gpio_request(LOCO_FEC_PHY_RST, "fec-phy-reset");
75 if (ret) {
76 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
77 return;
78 }
79 gpio_direction_output(LOCO_FEC_PHY_RST, 0);
80 msleep(1);
81 gpio_set_value(LOCO_FEC_PHY_RST, 1);
82}
83
84static struct fec_platform_data mx53_loco_fec_data = {
85 .phy = PHY_INTERFACE_MODE_RMII,
86};
87
88static void __init mx53_loco_board_init(void)
89{
90 mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
91 ARRAY_SIZE(mx53_loco_pads));
92 mx53_loco_init_uart();
93 mx53_loco_fec_reset();
94 imx53_add_fec(&mx53_loco_fec_data);
95}
96
97static void __init mx53_loco_timer_init(void)
98{
99 mx53_clocks_init(32768, 24000000, 0, 0);
100}
101
102static struct sys_timer mx53_loco_timer = {
103 .init = mx53_loco_timer_init,
104};
105
106MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board")
107 .map_io = mx53_map_io,
108 .init_irq = mx53_init_irq,
109 .init_machine = mx53_loco_board_init,
110 .timer = &mx53_loco_timer,
111MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c
new file mode 100644
index 000000000000..7970f7a48588
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx53_smd.c
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/init.h>
22#include <linux/clk.h>
23#include <linux/fec.h>
24#include <linux/delay.h>
25#include <linux/gpio.h>
26
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/imx-uart.h>
30#include <mach/iomux-mx53.h>
31
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35
36#include "crm_regs.h"
37#include "devices-imx53.h"
38
39#define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6)
40
41static iomux_v3_cfg_t mx53_smd_pads[] = {
42 MX53_PAD_CSI0_D10__UART1_TXD,
43 MX53_PAD_CSI0_D11__UART1_RXD,
44 MX53_PAD_ATA_DIOW__UART1_TXD,
45 MX53_PAD_ATA_DMACK__UART1_RXD,
46
47 MX53_PAD_ATA_BUFFER_EN__UART2_RXD,
48 MX53_PAD_ATA_DMARQ__UART2_TXD,
49 MX53_PAD_ATA_DIOR__UART2_RTS,
50 MX53_PAD_ATA_INTRQ__UART2_CTS,
51
52 MX53_PAD_ATA_CS_0__UART3_TXD,
53 MX53_PAD_ATA_CS_1__UART3_RXD,
54 MX53_PAD_ATA_DA_1__UART3_CTS,
55 MX53_PAD_ATA_DA_2__UART3_RTS,
56};
57
58static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
59 .flags = IMXUART_HAVE_RTSCTS,
60};
61
62static inline void mx53_smd_init_uart(void)
63{
64 imx53_add_imx_uart(0, &mx53_smd_uart_data);
65 imx53_add_imx_uart(1, &mx53_smd_uart_data);
66 imx53_add_imx_uart(2, &mx53_smd_uart_data);
67}
68
69static inline void mx53_smd_fec_reset(void)
70{
71 int ret;
72
73 /* reset FEC PHY */
74 ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
75 if (ret) {
76 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
77 return;
78 }
79 gpio_direction_output(SMD_FEC_PHY_RST, 0);
80 msleep(1);
81 gpio_set_value(SMD_FEC_PHY_RST, 1);
82}
83
84static struct fec_platform_data mx53_smd_fec_data = {
85 .phy = PHY_INTERFACE_MODE_RMII,
86};
87
88static void __init mx53_smd_board_init(void)
89{
90 mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
91 ARRAY_SIZE(mx53_smd_pads));
92 mx53_smd_init_uart();
93 mx53_smd_fec_reset();
94 imx53_add_fec(&mx53_smd_fec_data);
95}
96
97static void __init mx53_smd_timer_init(void)
98{
99 mx53_clocks_init(32768, 24000000, 22579200, 0);
100}
101
102static struct sys_timer mx53_smd_timer = {
103 .init = mx53_smd_timer_init,
104};
105
106MACHINE_START(MX53_SMD, "Freescale MX53 SMD Board")
107 .map_io = mx53_map_io,
108 .init_irq = mx53_init_irq,
109 .init_machine = mx53_smd_board_init,
110 .timer = &mx53_smd_timer,
111MACHINE_END
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 785e1a336183..0a19e7567c0b 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -1191,6 +1191,11 @@ DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET,
1191DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET, 1191DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
1192 NULL, NULL, &ipg_clk, &gpt_ipg_clk); 1192 NULL, NULL, &ipg_clk, &gpt_ipg_clk);
1193 1193
1194DEFINE_CLOCK(pwm1_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG6_OFFSET,
1195 NULL, NULL, &ipg_clk, NULL);
1196DEFINE_CLOCK(pwm2_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG8_OFFSET,
1197 NULL, NULL, &ipg_clk, NULL);
1198
1194/* I2C */ 1199/* I2C */
1195DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET, 1200DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET,
1196 NULL, NULL, &ipg_clk, NULL); 1201 NULL, NULL, &ipg_clk, NULL);
@@ -1283,6 +1288,8 @@ static struct clk_lookup mx51_lookups[] = {
1283 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 1288 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
1284 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1289 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
1285 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1290 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
1291 _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
1292 _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
1286 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) 1293 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
1287 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) 1294 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
1288 _REGISTER_CLOCK("imx-i2c.2", NULL, hsi2c_clk) 1295 _REGISTER_CLOCK("imx-i2c.2", NULL, hsi2c_clk)
@@ -1295,7 +1302,7 @@ static struct clk_lookup mx51_lookups[] = {
1295 _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk) 1302 _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk)
1296 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) 1303 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk)
1297 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) 1304 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk)
1298 _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk) 1305 _REGISTER_CLOCK("imx-keypad", NULL, kpp_clk)
1299 _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk) 1306 _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk)
1300 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) 1307 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
1301 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) 1308 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
@@ -1326,6 +1333,13 @@ static struct clk_lookup mx53_lookups[] = {
1326 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 1333 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
1327 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 1334 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
1328 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk) 1335 _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
1336 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
1337 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
1338 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
1339 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
1340 _REGISTER_CLOCK("imx53-ecspi.0", NULL, ecspi1_clk)
1341 _REGISTER_CLOCK("imx53-ecspi.1", NULL, ecspi2_clk)
1342 _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk)
1329}; 1343};
1330 1344
1331static void clk_tree_init(void) 1345static void clk_tree_init(void)
@@ -1363,7 +1377,6 @@ int __init mx51_clocks_init(unsigned long ckil, unsigned long osc,
1363 1377
1364 clk_tree_init(); 1378 clk_tree_init();
1365 1379
1366 clk_set_parent(&uart_root_clk, &pll3_sw_clk);
1367 clk_enable(&cpu_clk); 1380 clk_enable(&cpu_clk);
1368 clk_enable(&main_bus_clk); 1381 clk_enable(&main_bus_clk);
1369 1382
@@ -1406,6 +1419,7 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc,
1406 1419
1407 clk_tree_init(); 1420 clk_tree_init();
1408 1421
1422 clk_set_parent(&uart_root_clk, &pll3_sw_clk);
1409 clk_enable(&cpu_clk); 1423 clk_enable(&cpu_clk);
1410 clk_enable(&main_bus_clk); 1424 clk_enable(&main_bus_clk);
1411 1425
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
index 6302e4670000..7fff485e5603 100644
--- a/arch/arm/mach-mx5/devices-imx51.h
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -47,3 +47,11 @@ extern const struct imx_spi_imx_data imx51_ecspi_data[] __initconst;
47extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst; 47extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst;
48#define imx51_add_imx2_wdt(id, pdata) \ 48#define imx51_add_imx2_wdt(id, pdata) \
49 imx_add_imx2_wdt(&imx51_imx2_wdt_data[id]) 49 imx_add_imx2_wdt(&imx51_imx2_wdt_data[id])
50
51extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst;
52#define imx51_add_mxc_pwm(id) \
53 imx_add_mxc_pwm(&imx51_mxc_pwm_data[id])
54
55extern const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst;
56#define imx51_add_imx_keypad(pdata) \
57 imx_add_imx_keypad(&imx51_imx_keypad_data, pdata)
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 9d0ec2507fa6..8639735a117b 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -8,6 +8,24 @@
8#include <mach/mx53.h> 8#include <mach/mx53.h>
9#include <mach/devices-common.h> 9#include <mach/devices-common.h>
10 10
11extern const struct imx_fec_data imx53_fec_data __initconst;
12#define imx53_add_fec(pdata) \
13 imx_add_fec(&imx53_fec_data, pdata)
14
11extern const struct imx_imx_uart_1irq_data imx53_imx_uart_data[] __initconst; 15extern const struct imx_imx_uart_1irq_data imx53_imx_uart_data[] __initconst;
12#define imx53_add_imx_uart(id, pdata) \ 16#define imx53_add_imx_uart(id, pdata) \
13 imx_add_imx_uart_1irq(&imx53_imx_uart_data[id], pdata) 17 imx_add_imx_uart_1irq(&imx53_imx_uart_data[id], pdata)
18
19
20extern const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst;
21#define imx53_add_imx_i2c(id, pdata) \
22 imx_add_imx_i2c(&imx53_imx_i2c_data[id], pdata)
23
24extern const struct imx_sdhci_esdhc_imx_data
25imx53_sdhci_esdhc_imx_data[] __initconst;
26#define imx53_add_sdhci_esdhc_imx(id, pdata) \
27 imx_add_sdhci_esdhc_imx(&imx53_sdhci_esdhc_imx_data[id], pdata)
28
29extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst;
30#define imx53_add_ecspi(id, pdata) \
31 imx_add_spi_imx(&imx53_ecspi_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 1bda5cb339dc..153ada53e575 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -120,25 +120,6 @@ struct platform_device mxc_usbh2_device = {
120 }, 120 },
121}; 121};
122 122
123static struct resource mxc_kpp_resources[] = {
124 {
125 .start = MX51_MXC_INT_KPP,
126 .end = MX51_MXC_INT_KPP,
127 .flags = IORESOURCE_IRQ,
128 } , {
129 .start = MX51_KPP_BASE_ADDR,
130 .end = MX51_KPP_BASE_ADDR + 0x8 - 1,
131 .flags = IORESOURCE_MEM,
132 },
133};
134
135struct platform_device mxc_keypad_device = {
136 .name = "imx-keypad",
137 .id = 0,
138 .num_resources = ARRAY_SIZE(mxc_kpp_resources),
139 .resource = mxc_kpp_resources,
140};
141
142static struct mxc_gpio_port mxc_gpio_ports[] = { 123static struct mxc_gpio_port mxc_gpio_ports[] = {
143 { 124 {
144 .chip.label = "gpio-0", 125 .chip.label = "gpio-0",
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index 16891aa3573c..55a5129bc29f 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -3,4 +3,3 @@ extern struct platform_device mxc_usbh1_device;
3extern struct platform_device mxc_usbh2_device; 3extern struct platform_device mxc_usbh2_device;
4extern struct platform_device mxc_usbdr_udc_device; 4extern struct platform_device mxc_usbdr_udc_device;
5extern struct platform_device mxc_hsi2c_device; 5extern struct platform_device mxc_hsi2c_device;
6extern struct platform_device mxc_keypad_device;
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
index c96d018ff8a2..e83ffadb65f8 100644
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
@@ -21,7 +21,6 @@
21#include <linux/fsl_devices.h> 21#include <linux/fsl_devices.h>
22#include <linux/i2c/tsc2007.h> 22#include <linux/i2c/tsc2007.h>
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/input/matrix_keypad.h>
25 24
26#include <mach/common.h> 25#include <mach/common.h>
27#include <mach/hardware.h> 26#include <mach/hardware.h>
@@ -157,7 +156,7 @@ static int mbimx51_keymap[] = {
157 KEY(3, 3, KEY_ENTER), 156 KEY(3, 3, KEY_ENTER),
158}; 157};
159 158
160static struct matrix_keymap_data mbimx51_map_data = { 159static const struct matrix_keymap_data mbimx51_map_data __initconst = {
161 .keymap = mbimx51_keymap, 160 .keymap = mbimx51_keymap,
162 .keymap_size = ARRAY_SIZE(mbimx51_keymap), 161 .keymap_size = ARRAY_SIZE(mbimx51_keymap),
163}; 162};
@@ -209,7 +208,7 @@ void __init eukrea_mbimx51_baseboard_init(void)
209 208
210 platform_add_devices(devices, ARRAY_SIZE(devices)); 209 platform_add_devices(devices, ARRAY_SIZE(devices));
211 210
212 mxc_register_device(&mxc_keypad_device, &mbimx51_map_data); 211 imx51_add_imx_keypad(&mbimx51_map_data);
213 212
214 gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq"); 213 gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
215 gpio_direction_input(MBIMX51_TSC2007_GPIO); 214 gpio_direction_input(MBIMX51_TSC2007_GPIO);
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index c4ac7b415195..8bfc8df54617 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -15,7 +15,7 @@ comment "MXS platforms:"
15config MACH_MX23EVK 15config MACH_MX23EVK
16 bool "Support MX23EVK Platform" 16 bool "Support MX23EVK Platform"
17 select SOC_IMX23 17 select SOC_IMX23
18 select MXS_HAVE_PLATFORM_DUART 18 select MXS_HAVE_AMBA_DUART
19 default y 19 default y
20 help 20 help
21 Include support for MX23EVK platform. This includes specific 21 Include support for MX23EVK platform. This includes specific
@@ -24,7 +24,7 @@ config MACH_MX23EVK
24config MACH_MX28EVK 24config MACH_MX28EVK
25 bool "Support MX28EVK Platform" 25 bool "Support MX28EVK Platform"
26 select SOC_IMX28 26 select SOC_IMX28
27 select MXS_HAVE_PLATFORM_DUART 27 select MXS_HAVE_AMBA_DUART
28 select MXS_HAVE_PLATFORM_FEC 28 select MXS_HAVE_PLATFORM_FEC
29 default y 29 default y
30 help 30 help
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index 8f5a19ab558c..b1a362ebfded 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/clkdev.h>
24 25
25#include <asm/clkdev.h> 26#include <asm/clkdev.h>
26#include <asm/div64.h> 27#include <asm/div64.h>
@@ -437,10 +438,12 @@ _DEFINE_CLOCK(clk32k_clk, XTAL, TIMROT_CLK32K_GATE, &ref_xtal_clk);
437 }, 438 },
438 439
439static struct clk_lookup lookups[] = { 440static struct clk_lookup lookups[] = {
440 _REGISTER_CLOCK("mxs-duart.0", NULL, uart_clk) 441 /* for amba bus driver */
442 _REGISTER_CLOCK("duart", "apb_pclk", xbus_clk)
443 /* for amba-pl011 driver */
444 _REGISTER_CLOCK("duart", NULL, uart_clk)
441 _REGISTER_CLOCK("rtc", NULL, rtc_clk) 445 _REGISTER_CLOCK("rtc", NULL, rtc_clk)
442 _REGISTER_CLOCK(NULL, "hclk", hbus_clk) 446 _REGISTER_CLOCK(NULL, "hclk", hbus_clk)
443 _REGISTER_CLOCK(NULL, "xclk", xbus_clk)
444 _REGISTER_CLOCK(NULL, "usb", usb_clk) 447 _REGISTER_CLOCK(NULL, "usb", usb_clk)
445 _REGISTER_CLOCK(NULL, "audio", audio_clk) 448 _REGISTER_CLOCK(NULL, "audio", audio_clk)
446 _REGISTER_CLOCK(NULL, "pwm", pwm_clk) 449 _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
@@ -518,6 +521,12 @@ int __init mx23_clocks_init(void)
518{ 521{
519 clk_misc_init(); 522 clk_misc_init();
520 523
524 clk_enable(&cpu_clk);
525 clk_enable(&hbus_clk);
526 clk_enable(&xbus_clk);
527 clk_enable(&emi_clk);
528 clk_enable(&uart_clk);
529
521 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 530 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
522 531
523 mxs_timer_init(&clk32k_clk, MX23_INT_TIMER0); 532 mxs_timer_init(&clk32k_clk, MX23_INT_TIMER0);
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 74e2103c6011..56312c092a9e 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/clkdev.h>
24 25
25#include <asm/clkdev.h> 26#include <asm/clkdev.h>
26#include <asm/div64.h> 27#include <asm/div64.h>
@@ -602,7 +603,12 @@ _DEFINE_CLOCK(fec_clk, ENET, DISABLE, &hbus_clk);
602 }, 603 },
603 604
604static struct clk_lookup lookups[] = { 605static struct clk_lookup lookups[] = {
605 _REGISTER_CLOCK("mxs-duart.0", NULL, uart_clk) 606 /* for amba bus driver */
607 _REGISTER_CLOCK("duart", "apb_pclk", xbus_clk)
608 /* for amba-pl011 driver */
609 _REGISTER_CLOCK("duart", NULL, uart_clk)
610 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
611 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
606 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 612 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
607 _REGISTER_CLOCK("rtc", NULL, rtc_clk) 613 _REGISTER_CLOCK("rtc", NULL, rtc_clk)
608 _REGISTER_CLOCK("pll2", NULL, pll2_clk) 614 _REGISTER_CLOCK("pll2", NULL, pll2_clk)
@@ -726,6 +732,12 @@ int __init mx28_clocks_init(void)
726{ 732{
727 clk_misc_init(); 733 clk_misc_init();
728 734
735 clk_enable(&cpu_clk);
736 clk_enable(&hbus_clk);
737 clk_enable(&xbus_clk);
738 clk_enable(&emi_clk);
739 clk_enable(&uart_clk);
740
729 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 741 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
730 742
731 mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0); 743 mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index d0f49fc0abb5..1256788561d0 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -11,6 +11,6 @@
11#include <mach/mx23.h> 11#include <mach/mx23.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13 13
14extern const struct mxs_duart_data mx23_duart_data __initconst; 14extern const struct amba_device mx23_duart_device __initconst;
15#define mx23_add_duart() \ 15#define mx23_add_duart() \
16 mxs_add_duart(&mx23_duart_data) 16 mxs_add_duart(&mx23_duart_device)
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 00b736c434ba..33773a6333a2 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -11,9 +11,9 @@
11#include <mach/mx28.h> 11#include <mach/mx28.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13 13
14extern const struct mxs_duart_data mx28_duart_data __initconst; 14extern const struct amba_device mx28_duart_device __initconst;
15#define mx28_add_duart() \ 15#define mx28_add_duart() \
16 mxs_add_duart(&mx28_duart_data) 16 mxs_add_duart(&mx28_duart_device)
17 17
18extern const struct mxs_fec_data mx28_fec_data[] __initconst; 18extern const struct mxs_fec_data mx28_fec_data[] __initconst;
19#define mx28_add_fec(id, pdata) \ 19#define mx28_add_fec(id, pdata) \
diff --git a/arch/arm/mach-mxs/devices.c b/arch/arm/mach-mxs/devices.c
index 6b60f02ca2e3..c20d54740b0b 100644
--- a/arch/arm/mach-mxs/devices.c
+++ b/arch/arm/mach-mxs/devices.c
@@ -19,9 +19,8 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/err.h>
23#include <linux/platform_device.h> 22#include <linux/platform_device.h>
24#include <mach/common.h> 23#include <linux/amba/bus.h>
25 24
26struct platform_device *__init mxs_add_platform_device_dmamask( 25struct platform_device *__init mxs_add_platform_device_dmamask(
27 const char *name, int id, 26 const char *name, int id,
@@ -73,3 +72,17 @@ err:
73 72
74 return pdev; 73 return pdev;
75} 74}
75
76int __init mxs_add_amba_device(const struct amba_device *dev)
77{
78 struct amba_device *adev = kmalloc(sizeof(*adev), GFP_KERNEL);
79
80 if (!adev) {
81 pr_err("%s: failed to allocate memory", __func__);
82 return -ENOMEM;
83 }
84
85 *adev = *dev;
86
87 return amba_device_register(adev, &iomem_resource);
88}
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig
index a35a2dc55395..cf7dc1ae575b 100644
--- a/arch/arm/mach-mxs/devices/Kconfig
+++ b/arch/arm/mach-mxs/devices/Kconfig
@@ -1,5 +1,6 @@
1config MXS_HAVE_PLATFORM_DUART 1config MXS_HAVE_AMBA_DUART
2 bool 2 bool
3 select ARM_AMBA
3 4
4config MXS_HAVE_PLATFORM_FEC 5config MXS_HAVE_PLATFORM_FEC
5 bool 6 bool
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
index 4b5266a3e6d9..d0a09f6934b8 100644
--- a/arch/arm/mach-mxs/devices/Makefile
+++ b/arch/arm/mach-mxs/devices/Makefile
@@ -1,2 +1,2 @@
1obj-$(CONFIG_MXS_HAVE_PLATFORM_DUART) += platform-duart.o 1obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
2obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o 2obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
diff --git a/arch/arm/mach-mxs/devices/amba-duart.c b/arch/arm/mach-mxs/devices/amba-duart.c
new file mode 100644
index 000000000000..a559db09b49c
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/amba-duart.c
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License version 2 as published by the
9 * Free Software Foundation.
10 */
11#include <asm/irq.h>
12#include <mach/mx23.h>
13#include <mach/mx28.h>
14#include <mach/devices-common.h>
15
16#define MXS_AMBA_DUART_DEVICE(name, soc) \
17const struct amba_device name##_device __initconst = { \
18 .dev = { \
19 .init_name = "duart", \
20 }, \
21 .res = { \
22 .start = soc ## _DUART_BASE_ADDR, \
23 .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \
24 .flags = IORESOURCE_MEM, \
25 }, \
26 .irq = {soc ## _INT_DUART, NO_IRQ}, \
27}
28
29#ifdef CONFIG_SOC_IMX23
30MXS_AMBA_DUART_DEVICE(mx23_duart, MX23);
31#endif
32
33#ifdef CONFIG_SOC_IMX28
34MXS_AMBA_DUART_DEVICE(mx28_duart, MX28);
35#endif
36
37int __init mxs_add_duart(const struct amba_device *dev)
38{
39 return mxs_add_amba_device(dev);
40}
diff --git a/arch/arm/mach-mxs/devices/platform-duart.c b/arch/arm/mach-mxs/devices/platform-duart.c
deleted file mode 100644
index 2fe0df5b0aad..000000000000
--- a/arch/arm/mach-mxs/devices/platform-duart.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License version 2 as published by the
9 * Free Software Foundation.
10 */
11#include <mach/mx23.h>
12#include <mach/mx28.h>
13#include <mach/devices-common.h>
14
15#define mxs_duart_data_entry(soc) \
16 { \
17 .iobase = soc ## _DUART_BASE_ADDR, \
18 .irq = soc ## _INT_DUART, \
19 }
20
21#ifdef CONFIG_SOC_IMX23
22const struct mxs_duart_data mx23_duart_data __initconst =
23 mxs_duart_data_entry(MX23);
24#endif
25
26#ifdef CONFIG_SOC_IMX28
27const struct mxs_duart_data mx28_duart_data __initconst =
28 mxs_duart_data_entry(MX28);
29#endif
30
31struct platform_device *__init mxs_add_duart(
32 const struct mxs_duart_data *data)
33{
34 struct resource res[] = {
35 {
36 .start = data->iobase,
37 .end = data->iobase + SZ_8K - 1,
38 .flags = IORESOURCE_MEM,
39 }, {
40 .start = data->irq,
41 .end = data->irq,
42 .flags = IORESOURCE_IRQ,
43 },
44 };
45
46 return mxs_add_platform_device("mxs-duart", 0, res, ARRAY_SIZE(res),
47 NULL, 0);
48}
diff --git a/arch/arm/mach-mxs/devices/platform-fec.c b/arch/arm/mach-mxs/devices/platform-fec.c
index c08168cf3dec..c42dff72b46c 100644
--- a/arch/arm/mach-mxs/devices/platform-fec.c
+++ b/arch/arm/mach-mxs/devices/platform-fec.c
@@ -45,6 +45,6 @@ struct platform_device *__init mxs_add_fec(
45 }, 45 },
46 }; 46 };
47 47
48 return mxs_add_platform_device("fec", data->id, 48 return mxs_add_platform_device("imx28-fec", data->id,
49 res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 49 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
50} 50}
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index 3da48d4d3273..6c3d1a103433 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/amba/bus.h>
12 13
13struct platform_device *mxs_add_platform_device_dmamask( 14struct platform_device *mxs_add_platform_device_dmamask(
14 const char *name, int id, 15 const char *name, int id,
@@ -24,14 +25,10 @@ static inline struct platform_device *mxs_add_platform_device(
24 name, id, res, num_resources, data, size_data, 0); 25 name, id, res, num_resources, data, size_data, 0);
25} 26}
26 27
28int __init mxs_add_amba_device(const struct amba_device *dev);
29
27/* duart */ 30/* duart */
28struct mxs_duart_data { 31int __init mxs_add_duart(const struct amba_device *dev);
29 resource_size_t iobase;
30 resource_size_t iosize;
31 resource_size_t irq;
32};
33struct platform_device *__init mxs_add_duart(
34 const struct mxs_duart_data *data);
35 32
36/* fec */ 33/* fec */
37#include <linux/fec.h> 34#include <linux/fec.h>
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index d162e95910f3..8e2c5975001e 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -57,6 +57,19 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = {
57 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 57 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
58 MX28_PAD_ENET_CLK__CLKCTRL_ENET | 58 MX28_PAD_ENET_CLK__CLKCTRL_ENET |
59 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 59 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
60 /* fec1 */
61 MX28_PAD_ENET0_CRS__ENET1_RX_EN |
62 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
63 MX28_PAD_ENET0_RXD2__ENET1_RXD0 |
64 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
65 MX28_PAD_ENET0_RXD3__ENET1_RXD1 |
66 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
67 MX28_PAD_ENET0_COL__ENET1_TX_EN |
68 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
69 MX28_PAD_ENET0_TXD2__ENET1_TXD0 |
70 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
71 MX28_PAD_ENET0_TXD3__ENET1_TXD1 |
72 (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
60 /* phy power line */ 73 /* phy power line */
61 MX28_PAD_SSP1_DATA3__GPIO_2_15 | 74 MX28_PAD_SSP1_DATA3__GPIO_2_15 |
62 (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 75 (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
@@ -106,8 +119,14 @@ static void __init mx28evk_fec_reset(void)
106 gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); 119 gpio_set_value(MX28EVK_FEC_PHY_RESET, 1);
107} 120}
108 121
109static const struct fec_platform_data mx28_fec_pdata __initconst = { 122static struct fec_platform_data mx28_fec_pdata[] = {
110 .phy = PHY_INTERFACE_MODE_RMII, 123 {
124 /* fec0 */
125 .phy = PHY_INTERFACE_MODE_RMII,
126 }, {
127 /* fec1 */
128 .phy = PHY_INTERFACE_MODE_RMII,
129 },
111}; 130};
112 131
113static void __init mx28evk_init(void) 132static void __init mx28evk_init(void)
@@ -117,7 +136,8 @@ static void __init mx28evk_init(void)
117 mx28_add_duart(); 136 mx28_add_duart();
118 137
119 mx28evk_fec_reset(); 138 mx28evk_fec_reset();
120 mx28_add_fec(0, &mx28_fec_pdata); 139 mx28_add_fec(0, &mx28_fec_pdata[0]);
140 mx28_add_fec(1, &mx28_fec_pdata[1]);
121} 141}
122 142
123static void __init mx28evk_timer_init(void) 143static void __init mx28evk_timer_init(void)
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 43da8bb4926b..29ffa750fbe6 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -88,13 +88,13 @@ netx_hif_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
88} 88}
89 89
90static int 90static int
91netx_hif_irq_type(unsigned int _irq, unsigned int type) 91netx_hif_irq_type(struct irq_data *d, unsigned int type)
92{ 92{
93 unsigned int val, irq; 93 unsigned int val, irq;
94 94
95 val = readl(NETX_DPMAS_IF_CONF1); 95 val = readl(NETX_DPMAS_IF_CONF1);
96 96
97 irq = _irq - NETX_IRQ_HIF_CHAINED(0); 97 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
98 98
99 if (type & IRQ_TYPE_EDGE_RISING) { 99 if (type & IRQ_TYPE_EDGE_RISING) {
100 DEBUG_IRQ("rising edges\n"); 100 DEBUG_IRQ("rising edges\n");
@@ -119,49 +119,49 @@ netx_hif_irq_type(unsigned int _irq, unsigned int type)
119} 119}
120 120
121static void 121static void
122netx_hif_ack_irq(unsigned int _irq) 122netx_hif_ack_irq(struct irq_data *d)
123{ 123{
124 unsigned int val, irq; 124 unsigned int val, irq;
125 125
126 irq = _irq - NETX_IRQ_HIF_CHAINED(0); 126 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
127 writel((1 << 24) << irq, NETX_DPMAS_INT_STAT); 127 writel((1 << 24) << irq, NETX_DPMAS_INT_STAT);
128 128
129 val = readl(NETX_DPMAS_INT_EN); 129 val = readl(NETX_DPMAS_INT_EN);
130 val &= ~((1 << 24) << irq); 130 val &= ~((1 << 24) << irq);
131 writel(val, NETX_DPMAS_INT_EN); 131 writel(val, NETX_DPMAS_INT_EN);
132 132
133 DEBUG_IRQ("%s: irq %d\n", __func__, _irq); 133 DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
134} 134}
135 135
136static void 136static void
137netx_hif_mask_irq(unsigned int _irq) 137netx_hif_mask_irq(struct irq_data *d)
138{ 138{
139 unsigned int val, irq; 139 unsigned int val, irq;
140 140
141 irq = _irq - NETX_IRQ_HIF_CHAINED(0); 141 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
142 val = readl(NETX_DPMAS_INT_EN); 142 val = readl(NETX_DPMAS_INT_EN);
143 val &= ~((1 << 24) << irq); 143 val &= ~((1 << 24) << irq);
144 writel(val, NETX_DPMAS_INT_EN); 144 writel(val, NETX_DPMAS_INT_EN);
145 DEBUG_IRQ("%s: irq %d\n", __func__, _irq); 145 DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
146} 146}
147 147
148static void 148static void
149netx_hif_unmask_irq(unsigned int _irq) 149netx_hif_unmask_irq(struct irq_data *d)
150{ 150{
151 unsigned int val, irq; 151 unsigned int val, irq;
152 152
153 irq = _irq - NETX_IRQ_HIF_CHAINED(0); 153 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
154 val = readl(NETX_DPMAS_INT_EN); 154 val = readl(NETX_DPMAS_INT_EN);
155 val |= (1 << 24) << irq; 155 val |= (1 << 24) << irq;
156 writel(val, NETX_DPMAS_INT_EN); 156 writel(val, NETX_DPMAS_INT_EN);
157 DEBUG_IRQ("%s: irq %d\n", __func__, _irq); 157 DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
158} 158}
159 159
160static struct irq_chip netx_hif_chip = { 160static struct irq_chip netx_hif_chip = {
161 .ack = netx_hif_ack_irq, 161 .irq_ack = netx_hif_ack_irq,
162 .mask = netx_hif_mask_irq, 162 .irq_mask = netx_hif_mask_irq,
163 .unmask = netx_hif_unmask_irq, 163 .irq_unmask = netx_hif_unmask_irq,
164 .set_type = netx_hif_irq_type, 164 .irq_set_type = netx_hif_irq_type,
165}; 165};
166 166
167void __init netx_init_irq(void) 167void __init netx_init_irq(void)
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
index b45bb3b802f1..0c0d5248c368 100644
--- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c
+++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c
@@ -37,44 +37,44 @@ void __init board_a9m9750dev_map_io(void)
37 ARRAY_SIZE(board_a9m9750dev_io_desc)); 37 ARRAY_SIZE(board_a9m9750dev_io_desc));
38} 38}
39 39
40static void a9m9750dev_fpga_ack_irq(unsigned int irq) 40static void a9m9750dev_fpga_ack_irq(struct irq_data *d)
41{ 41{
42 /* nothing */ 42 /* nothing */
43} 43}
44 44
45static void a9m9750dev_fpga_mask_irq(unsigned int irq) 45static void a9m9750dev_fpga_mask_irq(struct irq_data *d)
46{ 46{
47 u8 ier; 47 u8 ier;
48 48
49 ier = __raw_readb(FPGA_IER); 49 ier = __raw_readb(FPGA_IER);
50 50
51 ier &= ~(1 << (irq - FPGA_IRQ(0))); 51 ier &= ~(1 << (d->irq - FPGA_IRQ(0)));
52 52
53 __raw_writeb(ier, FPGA_IER); 53 __raw_writeb(ier, FPGA_IER);
54} 54}
55 55
56static void a9m9750dev_fpga_maskack_irq(unsigned int irq) 56static void a9m9750dev_fpga_maskack_irq(struct irq_data *d)
57{ 57{
58 a9m9750dev_fpga_mask_irq(irq); 58 a9m9750dev_fpga_mask_irq(d);
59 a9m9750dev_fpga_ack_irq(irq); 59 a9m9750dev_fpga_ack_irq(d);
60} 60}
61 61
62static void a9m9750dev_fpga_unmask_irq(unsigned int irq) 62static void a9m9750dev_fpga_unmask_irq(struct irq_data *d)
63{ 63{
64 u8 ier; 64 u8 ier;
65 65
66 ier = __raw_readb(FPGA_IER); 66 ier = __raw_readb(FPGA_IER);
67 67
68 ier |= 1 << (irq - FPGA_IRQ(0)); 68 ier |= 1 << (d->irq - FPGA_IRQ(0));
69 69
70 __raw_writeb(ier, FPGA_IER); 70 __raw_writeb(ier, FPGA_IER);
71} 71}
72 72
73static struct irq_chip a9m9750dev_fpga_chip = { 73static struct irq_chip a9m9750dev_fpga_chip = {
74 .ack = a9m9750dev_fpga_ack_irq, 74 .irq_ack = a9m9750dev_fpga_ack_irq,
75 .mask = a9m9750dev_fpga_mask_irq, 75 .irq_mask = a9m9750dev_fpga_mask_irq,
76 .mask_ack = a9m9750dev_fpga_maskack_irq, 76 .irq_mask_ack = a9m9750dev_fpga_maskack_irq,
77 .unmask = a9m9750dev_fpga_unmask_irq, 77 .irq_unmask = a9m9750dev_fpga_unmask_irq,
78}; 78};
79 79
80static void a9m9750dev_fpga_demux_handler(unsigned int irq, 80static void a9m9750dev_fpga_demux_handler(unsigned int irq,
@@ -82,7 +82,7 @@ static void a9m9750dev_fpga_demux_handler(unsigned int irq,
82{ 82{
83 u8 stat = __raw_readb(FPGA_ISR); 83 u8 stat = __raw_readb(FPGA_ISR);
84 84
85 desc->chip->mask_ack(irq); 85 desc->irq_data.chip->irq_mask_ack(&desc->irq_data);
86 86
87 while (stat != 0) { 87 while (stat != 0) {
88 int irqno = fls(stat) - 1; 88 int irqno = fls(stat) - 1;
@@ -92,7 +92,7 @@ static void a9m9750dev_fpga_demux_handler(unsigned int irq,
92 generic_handle_irq(FPGA_IRQ(irqno)); 92 generic_handle_irq(FPGA_IRQ(irqno));
93 } 93 }
94 94
95 desc->chip->unmask(irq); 95 desc->irq_data.chip->irq_unmask(&desc->irq_data);
96} 96}
97 97
98void __init board_a9m9750dev_init_irq(void) 98void __init board_a9m9750dev_init_irq(void)
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c
index 038f24d47023..389fa5c669de 100644
--- a/arch/arm/mach-ns9xxx/irq.c
+++ b/arch/arm/mach-ns9xxx/irq.c
@@ -22,40 +22,40 @@
22#define irq2prio(i) (i) 22#define irq2prio(i) (i)
23#define prio2irq(p) (p) 23#define prio2irq(p) (p)
24 24
25static void ns9xxx_mask_irq(unsigned int irq) 25static void ns9xxx_mask_irq(struct irq_data *d)
26{ 26{
27 /* XXX: better use cpp symbols */ 27 /* XXX: better use cpp symbols */
28 int prio = irq2prio(irq); 28 int prio = irq2prio(d->irq);
29 u32 ic = __raw_readl(SYS_IC(prio / 4)); 29 u32 ic = __raw_readl(SYS_IC(prio / 4));
30 ic &= ~(1 << (7 + 8 * (3 - (prio & 3)))); 30 ic &= ~(1 << (7 + 8 * (3 - (prio & 3))));
31 __raw_writel(ic, SYS_IC(prio / 4)); 31 __raw_writel(ic, SYS_IC(prio / 4));
32} 32}
33 33
34static void ns9xxx_ack_irq(unsigned int irq) 34static void ns9xxx_ack_irq(struct irq_data *d)
35{ 35{
36 __raw_writel(0, SYS_ISRADDR); 36 __raw_writel(0, SYS_ISRADDR);
37} 37}
38 38
39static void ns9xxx_maskack_irq(unsigned int irq) 39static void ns9xxx_maskack_irq(struct irq_data *d)
40{ 40{
41 ns9xxx_mask_irq(irq); 41 ns9xxx_mask_irq(d);
42 ns9xxx_ack_irq(irq); 42 ns9xxx_ack_irq(d);
43} 43}
44 44
45static void ns9xxx_unmask_irq(unsigned int irq) 45static void ns9xxx_unmask_irq(struct irq_data *d)
46{ 46{
47 /* XXX: better use cpp symbols */ 47 /* XXX: better use cpp symbols */
48 int prio = irq2prio(irq); 48 int prio = irq2prio(d->irq);
49 u32 ic = __raw_readl(SYS_IC(prio / 4)); 49 u32 ic = __raw_readl(SYS_IC(prio / 4));
50 ic |= 1 << (7 + 8 * (3 - (prio & 3))); 50 ic |= 1 << (7 + 8 * (3 - (prio & 3)));
51 __raw_writel(ic, SYS_IC(prio / 4)); 51 __raw_writel(ic, SYS_IC(prio / 4));
52} 52}
53 53
54static struct irq_chip ns9xxx_chip = { 54static struct irq_chip ns9xxx_chip = {
55 .ack = ns9xxx_ack_irq, 55 .irq_ack = ns9xxx_ack_irq,
56 .mask = ns9xxx_mask_irq, 56 .irq_mask = ns9xxx_mask_irq,
57 .mask_ack = ns9xxx_maskack_irq, 57 .irq_mask_ack = ns9xxx_maskack_irq,
58 .unmask = ns9xxx_unmask_irq, 58 .irq_unmask = ns9xxx_unmask_irq,
59}; 59};
60 60
61#if 0 61#if 0
@@ -92,10 +92,10 @@ static void handle_prio_irq(unsigned int irq, struct irq_desc *desc)
92 92
93 if (desc->status & IRQ_DISABLED) 93 if (desc->status & IRQ_DISABLED)
94out_mask: 94out_mask:
95 desc->chip->mask(irq); 95 desc->irq_data.chip->irq_mask(&desc->irq_data);
96 96
97 /* ack unconditionally to unmask lower prio irqs */ 97 /* ack unconditionally to unmask lower prio irqs */
98 desc->chip->ack(irq); 98 desc->irq_data.chip->irq_ack(&desc->irq_data);
99 99
100 raw_spin_unlock(&desc->lock); 100 raw_spin_unlock(&desc->lock);
101} 101}
diff --git a/arch/arm/mach-nuc93x/irq.c b/arch/arm/mach-nuc93x/irq.c
index a7a88ea4ec31..1f8a05a22834 100644
--- a/arch/arm/mach-nuc93x/irq.c
+++ b/arch/arm/mach-nuc93x/irq.c
@@ -25,9 +25,9 @@
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/regs-irq.h> 26#include <mach/regs-irq.h>
27 27
28static void nuc93x_irq_mask(unsigned int irq) 28static void nuc93x_irq_mask(struct irq_data *d)
29{ 29{
30 __raw_writel(1 << irq, REG_AIC_MDCR); 30 __raw_writel(1 << d->irq, REG_AIC_MDCR);
31} 31}
32 32
33/* 33/*
@@ -35,21 +35,21 @@ static void nuc93x_irq_mask(unsigned int irq)
35 * to REG_AIC_EOSCR for ACK 35 * to REG_AIC_EOSCR for ACK
36 */ 36 */
37 37
38static void nuc93x_irq_ack(unsigned int irq) 38static void nuc93x_irq_ack(struct irq_data *d)
39{ 39{
40 __raw_writel(0x01, REG_AIC_EOSCR); 40 __raw_writel(0x01, REG_AIC_EOSCR);
41} 41}
42 42
43static void nuc93x_irq_unmask(unsigned int irq) 43static void nuc93x_irq_unmask(struct irq_data *d)
44{ 44{
45 __raw_writel(1 << irq, REG_AIC_MECR); 45 __raw_writel(1 << d->irq, REG_AIC_MECR);
46 46
47} 47}
48 48
49static struct irq_chip nuc93x_irq_chip = { 49static struct irq_chip nuc93x_irq_chip = {
50 .ack = nuc93x_irq_ack, 50 .irq_ack = nuc93x_irq_ack,
51 .mask = nuc93x_irq_mask, 51 .irq_mask = nuc93x_irq_mask,
52 .unmask = nuc93x_irq_unmask, 52 .irq_unmask = nuc93x_irq_unmask,
53}; 53};
54 54
55void __init nuc93x_init_irq(void) 55void __init nuc93x_init_irq(void)
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c
index 6c994e2d8879..152b32c15e28 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq.c
+++ b/arch/arm/mach-omap1/ams-delta-fiq.c
@@ -49,7 +49,7 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id)
49 49
50 irq_desc = irq_to_desc(IH_GPIO_BASE); 50 irq_desc = irq_to_desc(IH_GPIO_BASE);
51 if (irq_desc) 51 if (irq_desc)
52 irq_chip = irq_desc->chip; 52 irq_chip = irq_desc->irq_data.chip;
53 53
54 /* 54 /*
55 * For each handled GPIO interrupt, keep calling its interrupt handler 55 * For each handled GPIO interrupt, keep calling its interrupt handler
@@ -62,13 +62,15 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id)
62 62
63 while (irq_counter[gpio] < fiq_count) { 63 while (irq_counter[gpio] < fiq_count) {
64 if (gpio != AMS_DELTA_GPIO_PIN_KEYBRD_CLK) { 64 if (gpio != AMS_DELTA_GPIO_PIN_KEYBRD_CLK) {
65 struct irq_data *d = irq_get_irq_data(irq_num);
66
65 /* 67 /*
66 * It looks like handle_edge_irq() that 68 * It looks like handle_edge_irq() that
67 * OMAP GPIO edge interrupts default to, 69 * OMAP GPIO edge interrupts default to,
68 * expects interrupt already unmasked. 70 * expects interrupt already unmasked.
69 */ 71 */
70 if (irq_chip && irq_chip->unmask) 72 if (irq_chip && irq_chip->irq_unmask)
71 irq_chip->unmask(irq_num); 73 irq_chip->irq_unmask(d);
72 } 74 }
73 generic_handle_irq(irq_num); 75 generic_handle_irq(irq_num);
74 76
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 8780e75cdc3d..0ace7998aaa5 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -30,9 +30,9 @@
30#include <plat/fpga.h> 30#include <plat/fpga.h>
31#include <mach/gpio.h> 31#include <mach/gpio.h>
32 32
33static void fpga_mask_irq(unsigned int irq) 33static void fpga_mask_irq(struct irq_data *d)
34{ 34{
35 irq -= OMAP_FPGA_IRQ_BASE; 35 unsigned int irq = d->irq - OMAP_FPGA_IRQ_BASE;
36 36
37 if (irq < 8) 37 if (irq < 8)
38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) 38 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO)
@@ -58,14 +58,14 @@ static inline u32 get_fpga_unmasked_irqs(void)
58} 58}
59 59
60 60
61static void fpga_ack_irq(unsigned int irq) 61static void fpga_ack_irq(struct irq_data *d)
62{ 62{
63 /* Don't need to explicitly ACK FPGA interrupts */ 63 /* Don't need to explicitly ACK FPGA interrupts */
64} 64}
65 65
66static void fpga_unmask_irq(unsigned int irq) 66static void fpga_unmask_irq(struct irq_data *d)
67{ 67{
68 irq -= OMAP_FPGA_IRQ_BASE; 68 unsigned int irq = d->irq - OMAP_FPGA_IRQ_BASE;
69 69
70 if (irq < 8) 70 if (irq < 8)
71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)), 71 __raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)),
@@ -78,10 +78,10 @@ static void fpga_unmask_irq(unsigned int irq)
78 | (1 << (irq - 16))), INNOVATOR_FPGA_IMR2); 78 | (1 << (irq - 16))), INNOVATOR_FPGA_IMR2);
79} 79}
80 80
81static void fpga_mask_ack_irq(unsigned int irq) 81static void fpga_mask_ack_irq(struct irq_data *d)
82{ 82{
83 fpga_mask_irq(irq); 83 fpga_mask_irq(d);
84 fpga_ack_irq(irq); 84 fpga_ack_irq(d);
85} 85}
86 86
87void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc) 87void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
@@ -105,17 +105,17 @@ void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
105 105
106static struct irq_chip omap_fpga_irq_ack = { 106static struct irq_chip omap_fpga_irq_ack = {
107 .name = "FPGA-ack", 107 .name = "FPGA-ack",
108 .ack = fpga_mask_ack_irq, 108 .irq_ack = fpga_mask_ack_irq,
109 .mask = fpga_mask_irq, 109 .irq_mask = fpga_mask_irq,
110 .unmask = fpga_unmask_irq, 110 .irq_unmask = fpga_unmask_irq,
111}; 111};
112 112
113 113
114static struct irq_chip omap_fpga_irq = { 114static struct irq_chip omap_fpga_irq = {
115 .name = "FPGA", 115 .name = "FPGA",
116 .ack = fpga_ack_irq, 116 .irq_ack = fpga_ack_irq,
117 .mask = fpga_mask_irq, 117 .irq_mask = fpga_mask_irq,
118 .unmask = fpga_unmask_irq, 118 .irq_unmask = fpga_unmask_irq,
119}; 119};
120 120
121/* 121/*
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 6bddbc869f4c..47701584df35 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -70,48 +70,48 @@ static inline void irq_bank_writel(unsigned long value, int bank, int offset)
70 omap_writel(value, irq_banks[bank].base_reg + offset); 70 omap_writel(value, irq_banks[bank].base_reg + offset);
71} 71}
72 72
73static void omap_ack_irq(unsigned int irq) 73static void omap_ack_irq(struct irq_data *d)
74{ 74{
75 if (irq > 31) 75 if (d->irq > 31)
76 omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG_OFFSET); 76 omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG_OFFSET);
77 77
78 omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG_OFFSET); 78 omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG_OFFSET);
79} 79}
80 80
81static void omap_mask_irq(unsigned int irq) 81static void omap_mask_irq(struct irq_data *d)
82{ 82{
83 int bank = IRQ_BANK(irq); 83 int bank = IRQ_BANK(d->irq);
84 u32 l; 84 u32 l;
85 85
86 l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); 86 l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
87 l |= 1 << IRQ_BIT(irq); 87 l |= 1 << IRQ_BIT(d->irq);
88 omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); 88 omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
89} 89}
90 90
91static void omap_unmask_irq(unsigned int irq) 91static void omap_unmask_irq(struct irq_data *d)
92{ 92{
93 int bank = IRQ_BANK(irq); 93 int bank = IRQ_BANK(d->irq);
94 u32 l; 94 u32 l;
95 95
96 l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); 96 l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
97 l &= ~(1 << IRQ_BIT(irq)); 97 l &= ~(1 << IRQ_BIT(d->irq));
98 omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET); 98 omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
99} 99}
100 100
101static void omap_mask_ack_irq(unsigned int irq) 101static void omap_mask_ack_irq(struct irq_data *d)
102{ 102{
103 omap_mask_irq(irq); 103 omap_mask_irq(d);
104 omap_ack_irq(irq); 104 omap_ack_irq(d);
105} 105}
106 106
107static int omap_wake_irq(unsigned int irq, unsigned int enable) 107static int omap_wake_irq(struct irq_data *d, unsigned int enable)
108{ 108{
109 int bank = IRQ_BANK(irq); 109 int bank = IRQ_BANK(d->irq);
110 110
111 if (enable) 111 if (enable)
112 irq_banks[bank].wake_enable |= IRQ_BIT(irq); 112 irq_banks[bank].wake_enable |= IRQ_BIT(d->irq);
113 else 113 else
114 irq_banks[bank].wake_enable &= ~IRQ_BIT(irq); 114 irq_banks[bank].wake_enable &= ~IRQ_BIT(d->irq);
115 115
116 return 0; 116 return 0;
117} 117}
@@ -168,10 +168,10 @@ static struct omap_irq_bank omap1610_irq_banks[] = {
168 168
169static struct irq_chip omap_irq_chip = { 169static struct irq_chip omap_irq_chip = {
170 .name = "MPU", 170 .name = "MPU",
171 .ack = omap_mask_ack_irq, 171 .irq_ack = omap_mask_ack_irq,
172 .mask = omap_mask_irq, 172 .irq_mask = omap_mask_irq,
173 .unmask = omap_unmask_irq, 173 .irq_unmask = omap_unmask_irq,
174 .set_wake = omap_wake_irq, 174 .irq_set_wake = omap_wake_irq,
175}; 175};
176 176
177void __init omap_init_irq(void) 177void __init omap_init_irq(void)
@@ -239,9 +239,9 @@ void __init omap_init_irq(void)
239 /* Unmask level 2 handler */ 239 /* Unmask level 2 handler */
240 240
241 if (cpu_is_omap7xx()) 241 if (cpu_is_omap7xx())
242 omap_unmask_irq(INT_7XX_IH2_IRQ); 242 omap_unmask_irq(irq_get_irq_data(INT_7XX_IH2_IRQ));
243 else if (cpu_is_omap15xx()) 243 else if (cpu_is_omap15xx())
244 omap_unmask_irq(INT_1510_IH2_IRQ); 244 omap_unmask_irq(irq_get_irq_data(INT_1510_IH2_IRQ));
245 else if (cpu_is_omap16xx()) 245 else if (cpu_is_omap16xx())
246 omap_unmask_irq(INT_1610_IH2_IRQ); 246 omap_unmask_irq(irq_get_irq_data(INT_1610_IH2_IRQ));
247} 247}
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 85bf8ca95fd3..23049c487c47 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -100,13 +100,14 @@ static int omap_check_spurious(unsigned int irq)
100} 100}
101 101
102/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 102/* XXX: FIQ and additional INTC support (only MPU at the moment) */
103static void omap_ack_irq(unsigned int irq) 103static void omap_ack_irq(struct irq_data *d)
104{ 104{
105 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL); 105 intc_bank_write_reg(0x1, &irq_banks[0], INTC_CONTROL);
106} 106}
107 107
108static void omap_mask_irq(unsigned int irq) 108static void omap_mask_irq(struct irq_data *d)
109{ 109{
110 unsigned int irq = d->irq;
110 int offset = irq & (~(IRQ_BITS_PER_REG - 1)); 111 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
111 112
112 if (cpu_is_omap34xx()) { 113 if (cpu_is_omap34xx()) {
@@ -128,8 +129,9 @@ static void omap_mask_irq(unsigned int irq)
128 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset); 129 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_SET0 + offset);
129} 130}
130 131
131static void omap_unmask_irq(unsigned int irq) 132static void omap_unmask_irq(struct irq_data *d)
132{ 133{
134 unsigned int irq = d->irq;
133 int offset = irq & (~(IRQ_BITS_PER_REG - 1)); 135 int offset = irq & (~(IRQ_BITS_PER_REG - 1));
134 136
135 irq &= (IRQ_BITS_PER_REG - 1); 137 irq &= (IRQ_BITS_PER_REG - 1);
@@ -137,17 +139,17 @@ static void omap_unmask_irq(unsigned int irq)
137 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + offset); 139 intc_bank_write_reg(1 << irq, &irq_banks[0], INTC_MIR_CLEAR0 + offset);
138} 140}
139 141
140static void omap_mask_ack_irq(unsigned int irq) 142static void omap_mask_ack_irq(struct irq_data *d)
141{ 143{
142 omap_mask_irq(irq); 144 omap_mask_irq(d);
143 omap_ack_irq(irq); 145 omap_ack_irq(d);
144} 146}
145 147
146static struct irq_chip omap_irq_chip = { 148static struct irq_chip omap_irq_chip = {
147 .name = "INTC", 149 .name = "INTC",
148 .ack = omap_mask_ack_irq, 150 .irq_ack = omap_mask_ack_irq,
149 .mask = omap_mask_irq, 151 .irq_mask = omap_mask_irq,
150 .unmask = omap_unmask_irq, 152 .irq_unmask = omap_unmask_irq,
151}; 153};
152 154
153static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) 155static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
diff --git a/arch/arm/mach-pnx4008/irq.c b/arch/arm/mach-pnx4008/irq.c
index a9ce02b4bf17..c69c180aec76 100644
--- a/arch/arm/mach-pnx4008/irq.c
+++ b/arch/arm/mach-pnx4008/irq.c
@@ -36,44 +36,44 @@
36 36
37static u8 pnx4008_irq_type[NR_IRQS] = PNX4008_IRQ_TYPES; 37static u8 pnx4008_irq_type[NR_IRQS] = PNX4008_IRQ_TYPES;
38 38
39static void pnx4008_mask_irq(unsigned int irq) 39static void pnx4008_mask_irq(struct irq_data *d)
40{ 40{
41 __raw_writel(__raw_readl(INTC_ER(irq)) & ~INTC_BIT(irq), INTC_ER(irq)); /* mask interrupt */ 41 __raw_writel(__raw_readl(INTC_ER(d->irq)) & ~INTC_BIT(d->irq), INTC_ER(d->irq)); /* mask interrupt */
42} 42}
43 43
44static void pnx4008_unmask_irq(unsigned int irq) 44static void pnx4008_unmask_irq(struct irq_data *d)
45{ 45{
46 __raw_writel(__raw_readl(INTC_ER(irq)) | INTC_BIT(irq), INTC_ER(irq)); /* unmask interrupt */ 46 __raw_writel(__raw_readl(INTC_ER(d->irq)) | INTC_BIT(d->irq), INTC_ER(d->irq)); /* unmask interrupt */
47} 47}
48 48
49static void pnx4008_mask_ack_irq(unsigned int irq) 49static void pnx4008_mask_ack_irq(struct irq_data *d)
50{ 50{
51 __raw_writel(__raw_readl(INTC_ER(irq)) & ~INTC_BIT(irq), INTC_ER(irq)); /* mask interrupt */ 51 __raw_writel(__raw_readl(INTC_ER(d->irq)) & ~INTC_BIT(d->irq), INTC_ER(d->irq)); /* mask interrupt */
52 __raw_writel(INTC_BIT(irq), INTC_SR(irq)); /* clear interrupt status */ 52 __raw_writel(INTC_BIT(d->irq), INTC_SR(d->irq)); /* clear interrupt status */
53} 53}
54 54
55static int pnx4008_set_irq_type(unsigned int irq, unsigned int type) 55static int pnx4008_set_irq_type(struct irq_data *d, unsigned int type)
56{ 56{
57 switch (type) { 57 switch (type) {
58 case IRQ_TYPE_EDGE_RISING: 58 case IRQ_TYPE_EDGE_RISING:
59 __raw_writel(__raw_readl(INTC_ATR(irq)) | INTC_BIT(irq), INTC_ATR(irq)); /*edge sensitive */ 59 __raw_writel(__raw_readl(INTC_ATR(d->irq)) | INTC_BIT(d->irq), INTC_ATR(d->irq)); /*edge sensitive */
60 __raw_writel(__raw_readl(INTC_APR(irq)) | INTC_BIT(irq), INTC_APR(irq)); /*rising edge */ 60 __raw_writel(__raw_readl(INTC_APR(d->irq)) | INTC_BIT(d->irq), INTC_APR(d->irq)); /*rising edge */
61 set_irq_handler(irq, handle_edge_irq); 61 set_irq_handler(d->irq, handle_edge_irq);
62 break; 62 break;
63 case IRQ_TYPE_EDGE_FALLING: 63 case IRQ_TYPE_EDGE_FALLING:
64 __raw_writel(__raw_readl(INTC_ATR(irq)) | INTC_BIT(irq), INTC_ATR(irq)); /*edge sensitive */ 64 __raw_writel(__raw_readl(INTC_ATR(d->irq)) | INTC_BIT(d->irq), INTC_ATR(d->irq)); /*edge sensitive */
65 __raw_writel(__raw_readl(INTC_APR(irq)) & ~INTC_BIT(irq), INTC_APR(irq)); /*falling edge */ 65 __raw_writel(__raw_readl(INTC_APR(d->irq)) & ~INTC_BIT(d->irq), INTC_APR(d->irq)); /*falling edge */
66 set_irq_handler(irq, handle_edge_irq); 66 set_irq_handler(d->irq, handle_edge_irq);
67 break; 67 break;
68 case IRQ_TYPE_LEVEL_LOW: 68 case IRQ_TYPE_LEVEL_LOW:
69 __raw_writel(__raw_readl(INTC_ATR(irq)) & ~INTC_BIT(irq), INTC_ATR(irq)); /*level sensitive */ 69 __raw_writel(__raw_readl(INTC_ATR(d->irq)) & ~INTC_BIT(d->irq), INTC_ATR(d->irq)); /*level sensitive */
70 __raw_writel(__raw_readl(INTC_APR(irq)) & ~INTC_BIT(irq), INTC_APR(irq)); /*low level */ 70 __raw_writel(__raw_readl(INTC_APR(d->irq)) & ~INTC_BIT(d->irq), INTC_APR(d->irq)); /*low level */
71 set_irq_handler(irq, handle_level_irq); 71 set_irq_handler(d->irq, handle_level_irq);
72 break; 72 break;
73 case IRQ_TYPE_LEVEL_HIGH: 73 case IRQ_TYPE_LEVEL_HIGH:
74 __raw_writel(__raw_readl(INTC_ATR(irq)) & ~INTC_BIT(irq), INTC_ATR(irq)); /*level sensitive */ 74 __raw_writel(__raw_readl(INTC_ATR(d->irq)) & ~INTC_BIT(d->irq), INTC_ATR(d->irq)); /*level sensitive */
75 __raw_writel(__raw_readl(INTC_APR(irq)) | INTC_BIT(irq), INTC_APR(irq)); /* high level */ 75 __raw_writel(__raw_readl(INTC_APR(d->irq)) | INTC_BIT(d->irq), INTC_APR(d->irq)); /* high level */
76 set_irq_handler(irq, handle_level_irq); 76 set_irq_handler(d->irq, handle_level_irq);
77 break; 77 break;
78 78
79 /* IRQ_TYPE_EDGE_BOTH is not supported */ 79 /* IRQ_TYPE_EDGE_BOTH is not supported */
@@ -85,10 +85,10 @@ static int pnx4008_set_irq_type(unsigned int irq, unsigned int type)
85} 85}
86 86
87static struct irq_chip pnx4008_irq_chip = { 87static struct irq_chip pnx4008_irq_chip = {
88 .ack = pnx4008_mask_ack_irq, 88 .irq_ack = pnx4008_mask_ack_irq,
89 .mask = pnx4008_mask_irq, 89 .irq_mask = pnx4008_mask_irq,
90 .unmask = pnx4008_unmask_irq, 90 .irq_unmask = pnx4008_unmask_irq,
91 .set_type = pnx4008_set_irq_type, 91 .irq_set_type = pnx4008_set_irq_type,
92}; 92};
93 93
94void __init pnx4008_init_irq(void) 94void __init pnx4008_init_irq(void)
@@ -99,14 +99,18 @@ void __init pnx4008_init_irq(void)
99 for (i = 0; i < NR_IRQS; i++) { 99 for (i = 0; i < NR_IRQS; i++) {
100 set_irq_flags(i, IRQF_VALID); 100 set_irq_flags(i, IRQF_VALID);
101 set_irq_chip(i, &pnx4008_irq_chip); 101 set_irq_chip(i, &pnx4008_irq_chip);
102 pnx4008_set_irq_type(i, pnx4008_irq_type[i]); 102 pnx4008_set_irq_type(irq_get_irq_data(i), pnx4008_irq_type[i]);
103 } 103 }
104 104
105 /* configure and enable IRQ 0,1,30,31 (cascade interrupts) */ 105 /* configure and enable IRQ 0,1,30,31 (cascade interrupts) */
106 pnx4008_set_irq_type(SUB1_IRQ_N, pnx4008_irq_type[SUB1_IRQ_N]); 106 pnx4008_set_irq_type(irq_get_irq_data(SUB1_IRQ_N),
107 pnx4008_set_irq_type(SUB2_IRQ_N, pnx4008_irq_type[SUB2_IRQ_N]); 107 pnx4008_irq_type[SUB1_IRQ_N]);
108 pnx4008_set_irq_type(SUB1_FIQ_N, pnx4008_irq_type[SUB1_FIQ_N]); 108 pnx4008_set_irq_type(irq_get_irq_data(SUB2_IRQ_N),
109 pnx4008_set_irq_type(SUB2_FIQ_N, pnx4008_irq_type[SUB2_FIQ_N]); 109 pnx4008_irq_type[SUB2_IRQ_N]);
110 pnx4008_set_irq_type(irq_get_irq_data(SUB1_FIQ_N),
111 pnx4008_irq_type[SUB1_FIQ_N]);
112 pnx4008_set_irq_type(irq_get_irq_data(SUB2_FIQ_N),
113 pnx4008_irq_type[SUB2_FIQ_N]);
110 114
111 /* mask all others */ 115 /* mask all others */
112 __raw_writel((1 << SUB2_FIQ_N) | (1 << SUB1_FIQ_N) | 116 __raw_writel((1 << SUB2_FIQ_N) | (1 << SUB1_FIQ_N) |
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index ccb2d0cebcc3..a134a1413e01 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -477,25 +477,25 @@ static inline void balloon3_leds_init(void) {}
477/****************************************************************************** 477/******************************************************************************
478 * FPGA IRQ 478 * FPGA IRQ
479 ******************************************************************************/ 479 ******************************************************************************/
480static void balloon3_mask_irq(unsigned int irq) 480static void balloon3_mask_irq(struct irq_data *d)
481{ 481{
482 int balloon3_irq = (irq - BALLOON3_IRQ(0)); 482 int balloon3_irq = (d->irq - BALLOON3_IRQ(0));
483 balloon3_irq_enabled &= ~(1 << balloon3_irq); 483 balloon3_irq_enabled &= ~(1 << balloon3_irq);
484 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG); 484 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
485} 485}
486 486
487static void balloon3_unmask_irq(unsigned int irq) 487static void balloon3_unmask_irq(struct irq_data *d)
488{ 488{
489 int balloon3_irq = (irq - BALLOON3_IRQ(0)); 489 int balloon3_irq = (d->irq - BALLOON3_IRQ(0));
490 balloon3_irq_enabled |= (1 << balloon3_irq); 490 balloon3_irq_enabled |= (1 << balloon3_irq);
491 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG); 491 __raw_writel(~balloon3_irq_enabled, BALLOON3_INT_CONTROL_REG);
492} 492}
493 493
494static struct irq_chip balloon3_irq_chip = { 494static struct irq_chip balloon3_irq_chip = {
495 .name = "FPGA", 495 .name = "FPGA",
496 .ack = balloon3_mask_irq, 496 .irq_ack = balloon3_mask_irq,
497 .mask = balloon3_mask_irq, 497 .irq_mask = balloon3_mask_irq,
498 .unmask = balloon3_unmask_irq, 498 .irq_unmask = balloon3_unmask_irq,
499}; 499};
500 500
501static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc) 501static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
@@ -504,8 +504,13 @@ static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc)
504 balloon3_irq_enabled; 504 balloon3_irq_enabled;
505 do { 505 do {
506 /* clear useless edge notification */ 506 /* clear useless edge notification */
507 if (desc->chip->ack) 507 if (desc->irq_data.chip->irq_ack) {
508 desc->chip->ack(BALLOON3_AUX_NIRQ); 508 struct irq_data *d;
509
510 d = irq_get_irq_data(BALLOON3_AUX_NIRQ);
511 desc->irq_data.chip->irq_ack(d);
512 }
513
509 while (pending) { 514 while (pending) {
510 irq = BALLOON3_IRQ(0) + __ffs(pending); 515 irq = BALLOON3_IRQ(0) + __ffs(pending);
511 generic_handle_irq(irq); 516 generic_handle_irq(irq);
diff --git a/arch/arm/mach-pxa/clock-pxa3xx.c b/arch/arm/mach-pxa/clock-pxa3xx.c
index 1b08a34ab234..3f864cd0bd28 100644
--- a/arch/arm/mach-pxa/clock-pxa3xx.c
+++ b/arch/arm/mach-pxa/clock-pxa3xx.c
@@ -115,7 +115,6 @@ static unsigned long clk_pxa3xx_smemc_getrate(struct clk *clk)
115{ 115{
116 unsigned long acsr = ACSR; 116 unsigned long acsr = ACSR;
117 unsigned long memclkcfg = __raw_readl(MEMCLKCFG); 117 unsigned long memclkcfg = __raw_readl(MEMCLKCFG);
118 unsigned int smcfs = (acsr >> 23) & 0x7;
119 118
120 return BASE_CLK * smcfs_mult[(acsr >> 23) & 0x7] / 119 return BASE_CLK * smcfs_mult[(acsr >> 23) & 0x7] /
121 df_clkdiv[(memclkcfg >> 16) & 0x3]; 120 df_clkdiv[(memclkcfg >> 16) & 0x3];
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index 0f3130599770..a2380cd76f80 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -59,7 +59,7 @@ void __init cmx2xx_pci_adjust_zones(unsigned long *zone_size,
59static void cmx2xx_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) 59static void cmx2xx_it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
60{ 60{
61 /* clear our parent irq */ 61 /* clear our parent irq */
62 desc->chip->ack(irq); 62 desc->irq_data.chip->irq_ack(&desc->irq_data);
63 63
64 it8152_irq_demux(irq, desc); 64 it8152_irq_demux(irq, desc);
65} 65}
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 6205dc9a2b9d..a079d8baa45a 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -9,11 +9,13 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12struct irq_data;
12struct sys_timer; 13struct sys_timer;
13 14
14extern struct sys_timer pxa_timer; 15extern struct sys_timer pxa_timer;
15extern void __init pxa_init_irq(int irq_nr, 16extern void __init pxa_init_irq(int irq_nr,
16 int (*set_wake)(unsigned int, unsigned int)); 17 int (*set_wake)(struct irq_data *,
18 unsigned int));
17extern void __init pxa25x_init_irq(void); 19extern void __init pxa25x_init_irq(void);
18#ifdef CONFIG_CPU_PXA26x 20#ifdef CONFIG_CPU_PXA26x
19extern void __init pxa26x_init_irq(void); 21extern void __init pxa26x_init_irq(void);
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 54e91c9e71c8..2693e3c3776f 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -53,37 +53,48 @@ static inline int cpu_has_ipr(void)
53 return !cpu_is_pxa25x(); 53 return !cpu_is_pxa25x();
54} 54}
55 55
56static void pxa_mask_irq(unsigned int irq) 56static inline void __iomem *irq_base(int i)
57{
58 static unsigned long phys_base[] = {
59 0x40d00000,
60 0x40d0009c,
61 0x40d00130,
62 };
63
64 return (void __iomem *)io_p2v(phys_base[i]);
65}
66
67static void pxa_mask_irq(struct irq_data *d)
57{ 68{
58 void __iomem *base = get_irq_chip_data(irq); 69 void __iomem *base = irq_data_get_irq_chip_data(d);
59 uint32_t icmr = __raw_readl(base + ICMR); 70 uint32_t icmr = __raw_readl(base + ICMR);
60 71
61 icmr &= ~(1 << IRQ_BIT(irq)); 72 icmr &= ~(1 << IRQ_BIT(d->irq));
62 __raw_writel(icmr, base + ICMR); 73 __raw_writel(icmr, base + ICMR);
63} 74}
64 75
65static void pxa_unmask_irq(unsigned int irq) 76static void pxa_unmask_irq(struct irq_data *d)
66{ 77{
67 void __iomem *base = get_irq_chip_data(irq); 78 void __iomem *base = irq_data_get_irq_chip_data(d);
68 uint32_t icmr = __raw_readl(base + ICMR); 79 uint32_t icmr = __raw_readl(base + ICMR);
69 80
70 icmr |= 1 << IRQ_BIT(irq); 81 icmr |= 1 << IRQ_BIT(d->irq);
71 __raw_writel(icmr, base + ICMR); 82 __raw_writel(icmr, base + ICMR);
72} 83}
73 84
74static struct irq_chip pxa_internal_irq_chip = { 85static struct irq_chip pxa_internal_irq_chip = {
75 .name = "SC", 86 .name = "SC",
76 .ack = pxa_mask_irq, 87 .irq_ack = pxa_mask_irq,
77 .mask = pxa_mask_irq, 88 .irq_mask = pxa_mask_irq,
78 .unmask = pxa_unmask_irq, 89 .irq_unmask = pxa_unmask_irq,
79}; 90};
80 91
81/* 92/*
82 * GPIO IRQs for GPIO 0 and 1 93 * GPIO IRQs for GPIO 0 and 1
83 */ 94 */
84static int pxa_set_low_gpio_type(unsigned int irq, unsigned int type) 95static int pxa_set_low_gpio_type(struct irq_data *d, unsigned int type)
85{ 96{
86 int gpio = irq - IRQ_GPIO0; 97 int gpio = d->irq - IRQ_GPIO0;
87 98
88 if (__gpio_is_occupied(gpio)) { 99 if (__gpio_is_occupied(gpio)) {
89 pr_err("%s failed: GPIO is configured\n", __func__); 100 pr_err("%s failed: GPIO is configured\n", __func__);
@@ -103,31 +114,17 @@ static int pxa_set_low_gpio_type(unsigned int irq, unsigned int type)
103 return 0; 114 return 0;
104} 115}
105 116
106static void pxa_ack_low_gpio(unsigned int irq) 117static void pxa_ack_low_gpio(struct irq_data *d)
107{
108 GEDR0 = (1 << (irq - IRQ_GPIO0));
109}
110
111static void pxa_mask_low_gpio(unsigned int irq)
112{
113 struct irq_desc *desc = irq_to_desc(irq);
114
115 desc->chip->mask(irq);
116}
117
118static void pxa_unmask_low_gpio(unsigned int irq)
119{ 118{
120 struct irq_desc *desc = irq_to_desc(irq); 119 GEDR0 = (1 << (d->irq - IRQ_GPIO0));
121
122 desc->chip->unmask(irq);
123} 120}
124 121
125static struct irq_chip pxa_low_gpio_chip = { 122static struct irq_chip pxa_low_gpio_chip = {
126 .name = "GPIO-l", 123 .name = "GPIO-l",
127 .ack = pxa_ack_low_gpio, 124 .irq_ack = pxa_ack_low_gpio,
128 .mask = pxa_mask_low_gpio, 125 .irq_mask = pxa_mask_irq,
129 .unmask = pxa_unmask_low_gpio, 126 .irq_unmask = pxa_unmask_irq,
130 .set_type = pxa_set_low_gpio_type, 127 .irq_set_type = pxa_set_low_gpio_type,
131}; 128};
132 129
133static void __init pxa_init_low_gpio_irq(set_wake_t fn) 130static void __init pxa_init_low_gpio_irq(set_wake_t fn)
@@ -141,22 +138,12 @@ static void __init pxa_init_low_gpio_irq(set_wake_t fn)
141 138
142 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { 139 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
143 set_irq_chip(irq, &pxa_low_gpio_chip); 140 set_irq_chip(irq, &pxa_low_gpio_chip);
141 set_irq_chip_data(irq, irq_base(0));
144 set_irq_handler(irq, handle_edge_irq); 142 set_irq_handler(irq, handle_edge_irq);
145 set_irq_flags(irq, IRQF_VALID); 143 set_irq_flags(irq, IRQF_VALID);
146 } 144 }
147 145
148 pxa_low_gpio_chip.set_wake = fn; 146 pxa_low_gpio_chip.irq_set_wake = fn;
149}
150
151static inline void __iomem *irq_base(int i)
152{
153 static unsigned long phys_base[] = {
154 0x40d00000,
155 0x40d0009c,
156 0x40d00130,
157 };
158
159 return (void __iomem *)io_p2v(phys_base[i >> 5]);
160} 147}
161 148
162void __init pxa_init_irq(int irq_nr, set_wake_t fn) 149void __init pxa_init_irq(int irq_nr, set_wake_t fn)
@@ -168,7 +155,7 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
168 pxa_internal_irq_nr = irq_nr; 155 pxa_internal_irq_nr = irq_nr;
169 156
170 for (n = 0; n < irq_nr; n += 32) { 157 for (n = 0; n < irq_nr; n += 32) {
171 void __iomem *base = irq_base(n); 158 void __iomem *base = irq_base(n >> 5);
172 159
173 __raw_writel(0, base + ICMR); /* disable all IRQs */ 160 __raw_writel(0, base + ICMR); /* disable all IRQs */
174 __raw_writel(0, base + ICLR); /* all IRQs are IRQ, not FIQ */ 161 __raw_writel(0, base + ICLR); /* all IRQs are IRQ, not FIQ */
@@ -188,7 +175,7 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
188 /* only unmasked interrupts kick us out of idle */ 175 /* only unmasked interrupts kick us out of idle */
189 __raw_writel(1, irq_base(0) + ICCR); 176 __raw_writel(1, irq_base(0) + ICCR);
190 177
191 pxa_internal_irq_chip.set_wake = fn; 178 pxa_internal_irq_chip.irq_set_wake = fn;
192 pxa_init_low_gpio_irq(fn); 179 pxa_init_low_gpio_irq(fn);
193} 180}
194 181
@@ -200,7 +187,7 @@ static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state)
200{ 187{
201 int i; 188 int i;
202 189
203 for (i = 0; i < pxa_internal_irq_nr; i += 32) { 190 for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
204 void __iomem *base = irq_base(i); 191 void __iomem *base = irq_base(i);
205 192
206 saved_icmr[i] = __raw_readl(base + ICMR); 193 saved_icmr[i] = __raw_readl(base + ICMR);
@@ -219,14 +206,14 @@ static int pxa_irq_resume(struct sys_device *dev)
219{ 206{
220 int i; 207 int i;
221 208
222 for (i = 0; i < pxa_internal_irq_nr; i += 32) { 209 for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
223 void __iomem *base = irq_base(i); 210 void __iomem *base = irq_base(i);
224 211
225 __raw_writel(saved_icmr[i], base + ICMR); 212 __raw_writel(saved_icmr[i], base + ICMR);
226 __raw_writel(0, base + ICLR); 213 __raw_writel(0, base + ICLR);
227 } 214 }
228 215
229 if (!cpu_is_pxa25x()) 216 if (cpu_has_ipr())
230 for (i = 0; i < pxa_internal_irq_nr; i++) 217 for (i = 0; i < pxa_internal_irq_nr; i++)
231 __raw_writel(saved_ipr[i], IRQ_BASE + IPR(i)); 218 __raw_writel(saved_ipr[i], IRQ_BASE + IPR(i));
232 219
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 8ab62a677807..c9a3e775c2de 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -95,9 +95,9 @@ static unsigned long lpd270_pin_config[] __initdata = {
95 95
96static unsigned int lpd270_irq_enabled; 96static unsigned int lpd270_irq_enabled;
97 97
98static void lpd270_mask_irq(unsigned int irq) 98static void lpd270_mask_irq(struct irq_data *d)
99{ 99{
100 int lpd270_irq = irq - LPD270_IRQ(0); 100 int lpd270_irq = d->irq - LPD270_IRQ(0);
101 101
102 __raw_writew(~(1 << lpd270_irq), LPD270_INT_STATUS); 102 __raw_writew(~(1 << lpd270_irq), LPD270_INT_STATUS);
103 103
@@ -105,9 +105,9 @@ static void lpd270_mask_irq(unsigned int irq)
105 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK); 105 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
106} 106}
107 107
108static void lpd270_unmask_irq(unsigned int irq) 108static void lpd270_unmask_irq(struct irq_data *d)
109{ 109{
110 int lpd270_irq = irq - LPD270_IRQ(0); 110 int lpd270_irq = d->irq - LPD270_IRQ(0);
111 111
112 lpd270_irq_enabled |= 1 << lpd270_irq; 112 lpd270_irq_enabled |= 1 << lpd270_irq;
113 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK); 113 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
@@ -115,9 +115,9 @@ static void lpd270_unmask_irq(unsigned int irq)
115 115
116static struct irq_chip lpd270_irq_chip = { 116static struct irq_chip lpd270_irq_chip = {
117 .name = "CPLD", 117 .name = "CPLD",
118 .ack = lpd270_mask_irq, 118 .irq_ack = lpd270_mask_irq,
119 .mask = lpd270_mask_irq, 119 .irq_mask = lpd270_mask_irq,
120 .unmask = lpd270_unmask_irq, 120 .irq_unmask = lpd270_unmask_irq,
121}; 121};
122 122
123static void lpd270_irq_handler(unsigned int irq, struct irq_desc *desc) 123static void lpd270_irq_handler(unsigned int irq, struct irq_desc *desc)
@@ -126,7 +126,8 @@ static void lpd270_irq_handler(unsigned int irq, struct irq_desc *desc)
126 126
127 pending = __raw_readw(LPD270_INT_STATUS) & lpd270_irq_enabled; 127 pending = __raw_readw(LPD270_INT_STATUS) & lpd270_irq_enabled;
128 do { 128 do {
129 desc->chip->ack(irq); /* clear useless edge notification */ 129 /* clear useless edge notification */
130 desc->irq_data.chip->irq_ack(&desc->irq_data);
130 if (likely(pending)) { 131 if (likely(pending)) {
131 irq = LPD270_IRQ(0) + __ffs(pending); 132 irq = LPD270_IRQ(0) + __ffs(pending);
132 generic_handle_irq(irq); 133 generic_handle_irq(irq);
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 3072dbea5c1f..dca20de306bb 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -122,15 +122,15 @@ EXPORT_SYMBOL(lubbock_set_misc_wr);
122 122
123static unsigned long lubbock_irq_enabled; 123static unsigned long lubbock_irq_enabled;
124 124
125static void lubbock_mask_irq(unsigned int irq) 125static void lubbock_mask_irq(struct irq_data *d)
126{ 126{
127 int lubbock_irq = (irq - LUBBOCK_IRQ(0)); 127 int lubbock_irq = (d->irq - LUBBOCK_IRQ(0));
128 LUB_IRQ_MASK_EN = (lubbock_irq_enabled &= ~(1 << lubbock_irq)); 128 LUB_IRQ_MASK_EN = (lubbock_irq_enabled &= ~(1 << lubbock_irq));
129} 129}
130 130
131static void lubbock_unmask_irq(unsigned int irq) 131static void lubbock_unmask_irq(struct irq_data *d)
132{ 132{
133 int lubbock_irq = (irq - LUBBOCK_IRQ(0)); 133 int lubbock_irq = (d->irq - LUBBOCK_IRQ(0));
134 /* the irq can be acknowledged only if deasserted, so it's done here */ 134 /* the irq can be acknowledged only if deasserted, so it's done here */
135 LUB_IRQ_SET_CLR &= ~(1 << lubbock_irq); 135 LUB_IRQ_SET_CLR &= ~(1 << lubbock_irq);
136 LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq)); 136 LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq));
@@ -138,16 +138,17 @@ static void lubbock_unmask_irq(unsigned int irq)
138 138
139static struct irq_chip lubbock_irq_chip = { 139static struct irq_chip lubbock_irq_chip = {
140 .name = "FPGA", 140 .name = "FPGA",
141 .ack = lubbock_mask_irq, 141 .irq_ack = lubbock_mask_irq,
142 .mask = lubbock_mask_irq, 142 .irq_mask = lubbock_mask_irq,
143 .unmask = lubbock_unmask_irq, 143 .irq_unmask = lubbock_unmask_irq,
144}; 144};
145 145
146static void lubbock_irq_handler(unsigned int irq, struct irq_desc *desc) 146static void lubbock_irq_handler(unsigned int irq, struct irq_desc *desc)
147{ 147{
148 unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled; 148 unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
149 do { 149 do {
150 desc->chip->ack(irq); /* clear our parent irq */ 150 /* clear our parent irq */
151 desc->irq_data.chip->irq_ack(&desc->irq_data);
151 if (likely(pending)) { 152 if (likely(pending)) {
152 irq = LUBBOCK_IRQ(0) + __ffs(pending); 153 irq = LUBBOCK_IRQ(0) + __ffs(pending);
153 generic_handle_irq(irq); 154 generic_handle_irq(irq);
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 740c03590e3b..d4b6f2375f2c 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -123,15 +123,15 @@ static unsigned long mainstone_pin_config[] = {
123 123
124static unsigned long mainstone_irq_enabled; 124static unsigned long mainstone_irq_enabled;
125 125
126static void mainstone_mask_irq(unsigned int irq) 126static void mainstone_mask_irq(struct irq_data *d)
127{ 127{
128 int mainstone_irq = (irq - MAINSTONE_IRQ(0)); 128 int mainstone_irq = (d->irq - MAINSTONE_IRQ(0));
129 MST_INTMSKENA = (mainstone_irq_enabled &= ~(1 << mainstone_irq)); 129 MST_INTMSKENA = (mainstone_irq_enabled &= ~(1 << mainstone_irq));
130} 130}
131 131
132static void mainstone_unmask_irq(unsigned int irq) 132static void mainstone_unmask_irq(struct irq_data *d)
133{ 133{
134 int mainstone_irq = (irq - MAINSTONE_IRQ(0)); 134 int mainstone_irq = (d->irq - MAINSTONE_IRQ(0));
135 /* the irq can be acknowledged only if deasserted, so it's done here */ 135 /* the irq can be acknowledged only if deasserted, so it's done here */
136 MST_INTSETCLR &= ~(1 << mainstone_irq); 136 MST_INTSETCLR &= ~(1 << mainstone_irq);
137 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq)); 137 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq));
@@ -139,16 +139,17 @@ static void mainstone_unmask_irq(unsigned int irq)
139 139
140static struct irq_chip mainstone_irq_chip = { 140static struct irq_chip mainstone_irq_chip = {
141 .name = "FPGA", 141 .name = "FPGA",
142 .ack = mainstone_mask_irq, 142 .irq_ack = mainstone_mask_irq,
143 .mask = mainstone_mask_irq, 143 .irq_mask = mainstone_mask_irq,
144 .unmask = mainstone_unmask_irq, 144 .irq_unmask = mainstone_unmask_irq,
145}; 145};
146 146
147static void mainstone_irq_handler(unsigned int irq, struct irq_desc *desc) 147static void mainstone_irq_handler(unsigned int irq, struct irq_desc *desc)
148{ 148{
149 unsigned long pending = MST_INTSETCLR & mainstone_irq_enabled; 149 unsigned long pending = MST_INTSETCLR & mainstone_irq_enabled;
150 do { 150 do {
151 desc->chip->ack(irq); /* clear useless edge notification */ 151 /* clear useless edge notification */
152 desc->irq_data.chip->irq_ack(&desc->irq_data);
152 if (likely(pending)) { 153 if (likely(pending)) {
153 irq = MAINSTONE_IRQ(0) + __ffs(pending); 154 irq = MAINSTONE_IRQ(0) + __ffs(pending);
154 generic_handle_irq(irq); 155 generic_handle_irq(irq);
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index f33647a8e0b7..90820faa711a 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -241,23 +241,23 @@ static struct platform_device pcm990_backlight_device = {
241 241
242static unsigned long pcm990_irq_enabled; 242static unsigned long pcm990_irq_enabled;
243 243
244static void pcm990_mask_ack_irq(unsigned int irq) 244static void pcm990_mask_ack_irq(struct irq_data *d)
245{ 245{
246 int pcm990_irq = (irq - PCM027_IRQ(0)); 246 int pcm990_irq = (d->irq - PCM027_IRQ(0));
247 PCM990_INTMSKENA = (pcm990_irq_enabled &= ~(1 << pcm990_irq)); 247 PCM990_INTMSKENA = (pcm990_irq_enabled &= ~(1 << pcm990_irq));
248} 248}
249 249
250static void pcm990_unmask_irq(unsigned int irq) 250static void pcm990_unmask_irq(struct irq_data *d)
251{ 251{
252 int pcm990_irq = (irq - PCM027_IRQ(0)); 252 int pcm990_irq = (d->irq - PCM027_IRQ(0));
253 /* the irq can be acknowledged only if deasserted, so it's done here */ 253 /* the irq can be acknowledged only if deasserted, so it's done here */
254 PCM990_INTSETCLR |= 1 << pcm990_irq; 254 PCM990_INTSETCLR |= 1 << pcm990_irq;
255 PCM990_INTMSKENA = (pcm990_irq_enabled |= (1 << pcm990_irq)); 255 PCM990_INTMSKENA = (pcm990_irq_enabled |= (1 << pcm990_irq));
256} 256}
257 257
258static struct irq_chip pcm990_irq_chip = { 258static struct irq_chip pcm990_irq_chip = {
259 .mask_ack = pcm990_mask_ack_irq, 259 .irq_mask_ack = pcm990_mask_ack_irq,
260 .unmask = pcm990_unmask_irq, 260 .irq_unmask = pcm990_unmask_irq,
261}; 261};
262 262
263static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc) 263static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc)
@@ -265,7 +265,8 @@ static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc)
265 unsigned long pending = (~PCM990_INTSETCLR) & pcm990_irq_enabled; 265 unsigned long pending = (~PCM990_INTSETCLR) & pcm990_irq_enabled;
266 266
267 do { 267 do {
268 desc->chip->ack(irq); /* clear our parent IRQ */ 268 /* clear our parent IRQ */
269 desc->irq_data.chip->irq_ack(&desc->irq_data);
269 if (likely(pending)) { 270 if (likely(pending)) {
270 irq = PCM027_IRQ(0) + __ffs(pending); 271 irq = PCM027_IRQ(0) + __ffs(pending);
271 generic_handle_irq(irq); 272 generic_handle_irq(irq);
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 3f5241c84894..fbc5b775f895 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -22,6 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/suspend.h> 23#include <linux/suspend.h>
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/irq.h>
25 26
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
@@ -282,15 +283,15 @@ static inline void pxa25x_init_pm(void) {}
282/* PXA25x: supports wakeup from GPIO0..GPIO15 and RTC alarm 283/* PXA25x: supports wakeup from GPIO0..GPIO15 and RTC alarm
283 */ 284 */
284 285
285static int pxa25x_set_wake(unsigned int irq, unsigned int on) 286static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
286{ 287{
287 int gpio = IRQ_TO_GPIO(irq); 288 int gpio = IRQ_TO_GPIO(d->irq);
288 uint32_t mask = 0; 289 uint32_t mask = 0;
289 290
290 if (gpio >= 0 && gpio < 85) 291 if (gpio >= 0 && gpio < 85)
291 return gpio_set_wake(gpio, on); 292 return gpio_set_wake(gpio, on);
292 293
293 if (irq == IRQ_RTCAlrm) { 294 if (d->irq == IRQ_RTCAlrm) {
294 mask = PWER_RTC; 295 mask = PWER_RTC;
295 goto set_pwer; 296 goto set_pwer;
296 } 297 }
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index b2130b7a7b52..987301ff4c33 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -18,6 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/irq.h>
21 22
22#include <asm/mach/map.h> 23#include <asm/mach/map.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
@@ -343,18 +344,18 @@ static inline void pxa27x_init_pm(void) {}
343/* PXA27x: Various gpios can issue wakeup events. This logic only 344/* PXA27x: Various gpios can issue wakeup events. This logic only
344 * handles the simple cases, not the WEMUX2 and WEMUX3 options 345 * handles the simple cases, not the WEMUX2 and WEMUX3 options
345 */ 346 */
346static int pxa27x_set_wake(unsigned int irq, unsigned int on) 347static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
347{ 348{
348 int gpio = IRQ_TO_GPIO(irq); 349 int gpio = IRQ_TO_GPIO(d->irq);
349 uint32_t mask; 350 uint32_t mask;
350 351
351 if (gpio >= 0 && gpio < 128) 352 if (gpio >= 0 && gpio < 128)
352 return gpio_set_wake(gpio, on); 353 return gpio_set_wake(gpio, on);
353 354
354 if (irq == IRQ_KEYPAD) 355 if (d->irq == IRQ_KEYPAD)
355 return keypad_set_wake(on); 356 return keypad_set_wake(on);
356 357
357 switch (irq) { 358 switch (d->irq) {
358 case IRQ_RTCAlrm: 359 case IRQ_RTCAlrm:
359 mask = PWER_RTC; 360 mask = PWER_RTC;
360 break; 361 break;
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index e14818f5d950..a7a19e1cd640 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -229,11 +229,11 @@ static void __init pxa3xx_init_pm(void)
229 pxa_cpu_pm_fns = &pxa3xx_cpu_pm_fns; 229 pxa_cpu_pm_fns = &pxa3xx_cpu_pm_fns;
230} 230}
231 231
232static int pxa3xx_set_wake(unsigned int irq, unsigned int on) 232static int pxa3xx_set_wake(struct irq_data *d, unsigned int on)
233{ 233{
234 unsigned long flags, mask = 0; 234 unsigned long flags, mask = 0;
235 235
236 switch (irq) { 236 switch (d->irq) {
237 case IRQ_SSP3: 237 case IRQ_SSP3:
238 mask = ADXER_MFP_WSSP3; 238 mask = ADXER_MFP_WSSP3;
239 break; 239 break;
@@ -322,40 +322,40 @@ static inline void pxa3xx_init_pm(void) {}
322#define pxa3xx_set_wake NULL 322#define pxa3xx_set_wake NULL
323#endif 323#endif
324 324
325static void pxa_ack_ext_wakeup(unsigned int irq) 325static void pxa_ack_ext_wakeup(struct irq_data *d)
326{ 326{
327 PECR |= PECR_IS(irq - IRQ_WAKEUP0); 327 PECR |= PECR_IS(d->irq - IRQ_WAKEUP0);
328} 328}
329 329
330static void pxa_mask_ext_wakeup(unsigned int irq) 330static void pxa_mask_ext_wakeup(struct irq_data *d)
331{ 331{
332 ICMR2 &= ~(1 << ((irq - PXA_IRQ(0)) & 0x1f)); 332 ICMR2 &= ~(1 << ((d->irq - PXA_IRQ(0)) & 0x1f));
333 PECR &= ~PECR_IE(irq - IRQ_WAKEUP0); 333 PECR &= ~PECR_IE(d->irq - IRQ_WAKEUP0);
334} 334}
335 335
336static void pxa_unmask_ext_wakeup(unsigned int irq) 336static void pxa_unmask_ext_wakeup(struct irq_data *d)
337{ 337{
338 ICMR2 |= 1 << ((irq - PXA_IRQ(0)) & 0x1f); 338 ICMR2 |= 1 << ((d->irq - PXA_IRQ(0)) & 0x1f);
339 PECR |= PECR_IE(irq - IRQ_WAKEUP0); 339 PECR |= PECR_IE(d->irq - IRQ_WAKEUP0);
340} 340}
341 341
342static int pxa_set_ext_wakeup_type(unsigned int irq, unsigned int flow_type) 342static int pxa_set_ext_wakeup_type(struct irq_data *d, unsigned int flow_type)
343{ 343{
344 if (flow_type & IRQ_TYPE_EDGE_RISING) 344 if (flow_type & IRQ_TYPE_EDGE_RISING)
345 PWER |= 1 << (irq - IRQ_WAKEUP0); 345 PWER |= 1 << (d->irq - IRQ_WAKEUP0);
346 346
347 if (flow_type & IRQ_TYPE_EDGE_FALLING) 347 if (flow_type & IRQ_TYPE_EDGE_FALLING)
348 PWER |= 1 << (irq - IRQ_WAKEUP0 + 2); 348 PWER |= 1 << (d->irq - IRQ_WAKEUP0 + 2);
349 349
350 return 0; 350 return 0;
351} 351}
352 352
353static struct irq_chip pxa_ext_wakeup_chip = { 353static struct irq_chip pxa_ext_wakeup_chip = {
354 .name = "WAKEUP", 354 .name = "WAKEUP",
355 .ack = pxa_ack_ext_wakeup, 355 .irq_ack = pxa_ack_ext_wakeup,
356 .mask = pxa_mask_ext_wakeup, 356 .irq_mask = pxa_mask_ext_wakeup,
357 .unmask = pxa_unmask_ext_wakeup, 357 .irq_unmask = pxa_unmask_ext_wakeup,
358 .set_type = pxa_set_ext_wakeup_type, 358 .irq_set_type = pxa_set_ext_wakeup_type,
359}; 359};
360 360
361static void __init pxa_init_ext_wakeup_irq(set_wake_t fn) 361static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
@@ -368,7 +368,7 @@ static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
368 set_irq_flags(irq, IRQF_VALID); 368 set_irq_flags(irq, IRQF_VALID);
369 } 369 }
370 370
371 pxa_ext_wakeup_chip.set_wake = fn; 371 pxa_ext_wakeup_chip.irq_set_wake = fn;
372} 372}
373 373
374void __init pxa3xx_init_irq(void) 374void __init pxa3xx_init_irq(void)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 0bc938729c4c..b49a2c21124c 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -25,6 +25,7 @@
25#include <linux/spi/corgi_lcd.h> 25#include <linux/spi/corgi_lcd.h>
26#include <linux/spi/pxa2xx_spi.h> 26#include <linux/spi/pxa2xx_spi.h>
27#include <linux/mtd/sharpsl.h> 27#include <linux/mtd/sharpsl.h>
28#include <linux/mtd/physmap.h>
28#include <linux/input/matrix_keypad.h> 29#include <linux/input/matrix_keypad.h>
29#include <linux/regulator/machine.h> 30#include <linux/regulator/machine.h>
30#include <linux/io.h> 31#include <linux/io.h>
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index de69b203afa7..49eeeab23689 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -249,9 +249,9 @@ static inline int viper_bit_to_irq(int bit)
249 return viper_isa_irqs[bit] + PXA_ISA_IRQ(0); 249 return viper_isa_irqs[bit] + PXA_ISA_IRQ(0);
250} 250}
251 251
252static void viper_ack_irq(unsigned int irq) 252static void viper_ack_irq(struct irq_data *d)
253{ 253{
254 int viper_irq = viper_irq_to_bitmask(irq); 254 int viper_irq = viper_irq_to_bitmask(d->irq);
255 255
256 if (viper_irq & 0xff) 256 if (viper_irq & 0xff)
257 VIPER_LO_IRQ_STATUS = viper_irq; 257 VIPER_LO_IRQ_STATUS = viper_irq;
@@ -259,14 +259,14 @@ static void viper_ack_irq(unsigned int irq)
259 VIPER_HI_IRQ_STATUS = (viper_irq >> 8); 259 VIPER_HI_IRQ_STATUS = (viper_irq >> 8);
260} 260}
261 261
262static void viper_mask_irq(unsigned int irq) 262static void viper_mask_irq(struct irq_data *d)
263{ 263{
264 viper_irq_enabled_mask &= ~(viper_irq_to_bitmask(irq)); 264 viper_irq_enabled_mask &= ~(viper_irq_to_bitmask(d->irq));
265} 265}
266 266
267static void viper_unmask_irq(unsigned int irq) 267static void viper_unmask_irq(struct irq_data *d)
268{ 268{
269 viper_irq_enabled_mask |= viper_irq_to_bitmask(irq); 269 viper_irq_enabled_mask |= viper_irq_to_bitmask(d->irq);
270} 270}
271 271
272static inline unsigned long viper_irq_pending(void) 272static inline unsigned long viper_irq_pending(void)
@@ -283,7 +283,7 @@ static void viper_irq_handler(unsigned int irq, struct irq_desc *desc)
283 do { 283 do {
284 /* we're in a chained irq handler, 284 /* we're in a chained irq handler,
285 * so ack the interrupt by hand */ 285 * so ack the interrupt by hand */
286 desc->chip->ack(irq); 286 desc->irq_data.chip->irq_ack(&desc->irq_data);
287 287
288 if (likely(pending)) { 288 if (likely(pending)) {
289 irq = viper_bit_to_irq(__ffs(pending)); 289 irq = viper_bit_to_irq(__ffs(pending));
@@ -294,10 +294,10 @@ static void viper_irq_handler(unsigned int irq, struct irq_desc *desc)
294} 294}
295 295
296static struct irq_chip viper_irq_chip = { 296static struct irq_chip viper_irq_chip = {
297 .name = "ISA", 297 .name = "ISA",
298 .ack = viper_ack_irq, 298 .irq_ack = viper_ack_irq,
299 .mask = viper_mask_irq, 299 .irq_mask = viper_mask_irq,
300 .unmask = viper_unmask_irq 300 .irq_unmask = viper_unmask_irq
301}; 301};
302 302
303static void __init viper_init_irq(void) 303static void __init viper_init_irq(void)
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index bf034c7670dd..f4b053b35815 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -83,19 +83,19 @@ static inline int zeus_bit_to_irq(int bit)
83 return zeus_isa_irqs[bit] + PXA_ISA_IRQ(0); 83 return zeus_isa_irqs[bit] + PXA_ISA_IRQ(0);
84} 84}
85 85
86static void zeus_ack_irq(unsigned int irq) 86static void zeus_ack_irq(struct irq_data *d)
87{ 87{
88 __raw_writew(zeus_irq_to_bitmask(irq), ZEUS_CPLD_ISA_IRQ); 88 __raw_writew(zeus_irq_to_bitmask(d->irq), ZEUS_CPLD_ISA_IRQ);
89} 89}
90 90
91static void zeus_mask_irq(unsigned int irq) 91static void zeus_mask_irq(struct irq_data *d)
92{ 92{
93 zeus_irq_enabled_mask &= ~(zeus_irq_to_bitmask(irq)); 93 zeus_irq_enabled_mask &= ~(zeus_irq_to_bitmask(d->irq));
94} 94}
95 95
96static void zeus_unmask_irq(unsigned int irq) 96static void zeus_unmask_irq(struct irq_data *d)
97{ 97{
98 zeus_irq_enabled_mask |= zeus_irq_to_bitmask(irq); 98 zeus_irq_enabled_mask |= zeus_irq_to_bitmask(d->irq);
99} 99}
100 100
101static inline unsigned long zeus_irq_pending(void) 101static inline unsigned long zeus_irq_pending(void)
@@ -111,7 +111,7 @@ static void zeus_irq_handler(unsigned int irq, struct irq_desc *desc)
111 do { 111 do {
112 /* we're in a chained irq handler, 112 /* we're in a chained irq handler,
113 * so ack the interrupt by hand */ 113 * so ack the interrupt by hand */
114 desc->chip->ack(gpio_to_irq(ZEUS_ISA_GPIO)); 114 desc->irq_data.chip->irq_ack(&desc->irq_data);
115 115
116 if (likely(pending)) { 116 if (likely(pending)) {
117 irq = zeus_bit_to_irq(__ffs(pending)); 117 irq = zeus_bit_to_irq(__ffs(pending));
@@ -122,10 +122,10 @@ static void zeus_irq_handler(unsigned int irq, struct irq_desc *desc)
122} 122}
123 123
124static struct irq_chip zeus_irq_chip = { 124static struct irq_chip zeus_irq_chip = {
125 .name = "ISA", 125 .name = "ISA",
126 .ack = zeus_ack_irq, 126 .irq_ack = zeus_ack_irq,
127 .mask = zeus_mask_irq, 127 .irq_mask = zeus_mask_irq,
128 .unmask = zeus_unmask_irq, 128 .irq_unmask = zeus_unmask_irq,
129}; 129};
130 130
131static void __init zeus_init_irq(void) 131static void __init zeus_init_irq(void)
@@ -830,8 +830,8 @@ static void __init zeus_init(void)
830 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f)); 830 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f));
831 831
832 /* Fix timings for dm9000s (CS1/CS2)*/ 832 /* Fix timings for dm9000s (CS1/CS2)*/
833 msc0 = __raw_readl(MSC0) & 0x0000ffff | (dm9000_msc << 16); 833 msc0 = (__raw_readl(MSC0) & 0x0000ffff) | (dm9000_msc << 16);
834 msc1 = __raw_readl(MSC1) & 0xffff0000 | dm9000_msc; 834 msc1 = (__raw_readl(MSC1) & 0xffff0000) | dm9000_msc;
835 __raw_writel(msc0, MSC0); 835 __raw_writel(msc0, MSC0);
836 __raw_writel(msc1, MSC1); 836 __raw_writel(msc1, MSC1);
837 837
diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c
index 9dd15d679c5d..d29cd9b737fc 100644
--- a/arch/arm/mach-rpc/irq.c
+++ b/arch/arm/mach-rpc/irq.c
@@ -6,110 +6,110 @@
6#include <asm/hardware/iomd.h> 6#include <asm/hardware/iomd.h>
7#include <asm/irq.h> 7#include <asm/irq.h>
8 8
9static void iomd_ack_irq_a(unsigned int irq) 9static void iomd_ack_irq_a(struct irq_data *d)
10{ 10{
11 unsigned int val, mask; 11 unsigned int val, mask;
12 12
13 mask = 1 << irq; 13 mask = 1 << d->irq;
14 val = iomd_readb(IOMD_IRQMASKA); 14 val = iomd_readb(IOMD_IRQMASKA);
15 iomd_writeb(val & ~mask, IOMD_IRQMASKA); 15 iomd_writeb(val & ~mask, IOMD_IRQMASKA);
16 iomd_writeb(mask, IOMD_IRQCLRA); 16 iomd_writeb(mask, IOMD_IRQCLRA);
17} 17}
18 18
19static void iomd_mask_irq_a(unsigned int irq) 19static void iomd_mask_irq_a(struct irq_data *d)
20{ 20{
21 unsigned int val, mask; 21 unsigned int val, mask;
22 22
23 mask = 1 << irq; 23 mask = 1 << d->irq;
24 val = iomd_readb(IOMD_IRQMASKA); 24 val = iomd_readb(IOMD_IRQMASKA);
25 iomd_writeb(val & ~mask, IOMD_IRQMASKA); 25 iomd_writeb(val & ~mask, IOMD_IRQMASKA);
26} 26}
27 27
28static void iomd_unmask_irq_a(unsigned int irq) 28static void iomd_unmask_irq_a(struct irq_data *d)
29{ 29{
30 unsigned int val, mask; 30 unsigned int val, mask;
31 31
32 mask = 1 << irq; 32 mask = 1 << d->irq;
33 val = iomd_readb(IOMD_IRQMASKA); 33 val = iomd_readb(IOMD_IRQMASKA);
34 iomd_writeb(val | mask, IOMD_IRQMASKA); 34 iomd_writeb(val | mask, IOMD_IRQMASKA);
35} 35}
36 36
37static struct irq_chip iomd_a_chip = { 37static struct irq_chip iomd_a_chip = {
38 .ack = iomd_ack_irq_a, 38 .irq_ack = iomd_ack_irq_a,
39 .mask = iomd_mask_irq_a, 39 .irq_mask = iomd_mask_irq_a,
40 .unmask = iomd_unmask_irq_a, 40 .irq_unmask = iomd_unmask_irq_a,
41}; 41};
42 42
43static void iomd_mask_irq_b(unsigned int irq) 43static void iomd_mask_irq_b(struct irq_data *d)
44{ 44{
45 unsigned int val, mask; 45 unsigned int val, mask;
46 46
47 mask = 1 << (irq & 7); 47 mask = 1 << (d->irq & 7);
48 val = iomd_readb(IOMD_IRQMASKB); 48 val = iomd_readb(IOMD_IRQMASKB);
49 iomd_writeb(val & ~mask, IOMD_IRQMASKB); 49 iomd_writeb(val & ~mask, IOMD_IRQMASKB);
50} 50}
51 51
52static void iomd_unmask_irq_b(unsigned int irq) 52static void iomd_unmask_irq_b(struct irq_data *d)
53{ 53{
54 unsigned int val, mask; 54 unsigned int val, mask;
55 55
56 mask = 1 << (irq & 7); 56 mask = 1 << (d->irq & 7);
57 val = iomd_readb(IOMD_IRQMASKB); 57 val = iomd_readb(IOMD_IRQMASKB);
58 iomd_writeb(val | mask, IOMD_IRQMASKB); 58 iomd_writeb(val | mask, IOMD_IRQMASKB);
59} 59}
60 60
61static struct irq_chip iomd_b_chip = { 61static struct irq_chip iomd_b_chip = {
62 .ack = iomd_mask_irq_b, 62 .irq_ack = iomd_mask_irq_b,
63 .mask = iomd_mask_irq_b, 63 .irq_mask = iomd_mask_irq_b,
64 .unmask = iomd_unmask_irq_b, 64 .irq_unmask = iomd_unmask_irq_b,
65}; 65};
66 66
67static void iomd_mask_irq_dma(unsigned int irq) 67static void iomd_mask_irq_dma(struct irq_data *d)
68{ 68{
69 unsigned int val, mask; 69 unsigned int val, mask;
70 70
71 mask = 1 << (irq & 7); 71 mask = 1 << (d->irq & 7);
72 val = iomd_readb(IOMD_DMAMASK); 72 val = iomd_readb(IOMD_DMAMASK);
73 iomd_writeb(val & ~mask, IOMD_DMAMASK); 73 iomd_writeb(val & ~mask, IOMD_DMAMASK);
74} 74}
75 75
76static void iomd_unmask_irq_dma(unsigned int irq) 76static void iomd_unmask_irq_dma(struct irq_data *d)
77{ 77{
78 unsigned int val, mask; 78 unsigned int val, mask;
79 79
80 mask = 1 << (irq & 7); 80 mask = 1 << (d->irq & 7);
81 val = iomd_readb(IOMD_DMAMASK); 81 val = iomd_readb(IOMD_DMAMASK);
82 iomd_writeb(val | mask, IOMD_DMAMASK); 82 iomd_writeb(val | mask, IOMD_DMAMASK);
83} 83}
84 84
85static struct irq_chip iomd_dma_chip = { 85static struct irq_chip iomd_dma_chip = {
86 .ack = iomd_mask_irq_dma, 86 .irq_ack = iomd_mask_irq_dma,
87 .mask = iomd_mask_irq_dma, 87 .irq_mask = iomd_mask_irq_dma,
88 .unmask = iomd_unmask_irq_dma, 88 .irq_unmask = iomd_unmask_irq_dma,
89}; 89};
90 90
91static void iomd_mask_irq_fiq(unsigned int irq) 91static void iomd_mask_irq_fiq(struct irq_data *d)
92{ 92{
93 unsigned int val, mask; 93 unsigned int val, mask;
94 94
95 mask = 1 << (irq & 7); 95 mask = 1 << (d->irq & 7);
96 val = iomd_readb(IOMD_FIQMASK); 96 val = iomd_readb(IOMD_FIQMASK);
97 iomd_writeb(val & ~mask, IOMD_FIQMASK); 97 iomd_writeb(val & ~mask, IOMD_FIQMASK);
98} 98}
99 99
100static void iomd_unmask_irq_fiq(unsigned int irq) 100static void iomd_unmask_irq_fiq(struct irq_data *d)
101{ 101{
102 unsigned int val, mask; 102 unsigned int val, mask;
103 103
104 mask = 1 << (irq & 7); 104 mask = 1 << (d->irq & 7);
105 val = iomd_readb(IOMD_FIQMASK); 105 val = iomd_readb(IOMD_FIQMASK);
106 iomd_writeb(val | mask, IOMD_FIQMASK); 106 iomd_writeb(val | mask, IOMD_FIQMASK);
107} 107}
108 108
109static struct irq_chip iomd_fiq_chip = { 109static struct irq_chip iomd_fiq_chip = {
110 .ack = iomd_mask_irq_fiq, 110 .irq_ack = iomd_mask_irq_fiq,
111 .mask = iomd_mask_irq_fiq, 111 .irq_mask = iomd_mask_irq_fiq,
112 .unmask = iomd_unmask_irq_fiq, 112 .irq_unmask = iomd_unmask_irq_fiq,
113}; 113};
114 114
115void __init rpc_init_irq(void) 115void __init rpc_init_irq(void)
diff --git a/arch/arm/mach-s3c2410/bast-irq.c b/arch/arm/mach-s3c2410/bast-irq.c
index 217b102866d0..606cb6b1cc47 100644
--- a/arch/arm/mach-s3c2410/bast-irq.c
+++ b/arch/arm/mach-s3c2410/bast-irq.c
@@ -75,38 +75,38 @@ static unsigned char bast_pc104_irqmasks[] = {
75static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 }; 75static unsigned char bast_pc104_irqs[] = { 3, 5, 7, 10 };
76 76
77static void 77static void
78bast_pc104_mask(unsigned int irqno) 78bast_pc104_mask(struct irq_data *data)
79{ 79{
80 unsigned long temp; 80 unsigned long temp;
81 81
82 temp = __raw_readb(BAST_VA_PC104_IRQMASK); 82 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
83 temp &= ~bast_pc104_irqmasks[irqno]; 83 temp &= ~bast_pc104_irqmasks[data->irq];
84 __raw_writeb(temp, BAST_VA_PC104_IRQMASK); 84 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
85} 85}
86 86
87static void 87static void
88bast_pc104_maskack(unsigned int irqno) 88bast_pc104_maskack(struct irq_data *data)
89{ 89{
90 struct irq_desc *desc = irq_desc + IRQ_ISA; 90 struct irq_desc *desc = irq_desc + IRQ_ISA;
91 91
92 bast_pc104_mask(irqno); 92 bast_pc104_mask(data);
93 desc->chip->ack(IRQ_ISA); 93 desc->irq_data.chip->irq_ack(&desc->irq_data);
94} 94}
95 95
96static void 96static void
97bast_pc104_unmask(unsigned int irqno) 97bast_pc104_unmask(struct irq_data *data)
98{ 98{
99 unsigned long temp; 99 unsigned long temp;
100 100
101 temp = __raw_readb(BAST_VA_PC104_IRQMASK); 101 temp = __raw_readb(BAST_VA_PC104_IRQMASK);
102 temp |= bast_pc104_irqmasks[irqno]; 102 temp |= bast_pc104_irqmasks[data->irq];
103 __raw_writeb(temp, BAST_VA_PC104_IRQMASK); 103 __raw_writeb(temp, BAST_VA_PC104_IRQMASK);
104} 104}
105 105
106static struct irq_chip bast_pc104_chip = { 106static struct irq_chip bast_pc104_chip = {
107 .mask = bast_pc104_mask, 107 .irq_mask = bast_pc104_mask,
108 .unmask = bast_pc104_unmask, 108 .irq_unmask = bast_pc104_unmask,
109 .ack = bast_pc104_maskack 109 .irq_ack = bast_pc104_maskack
110}; 110};
111 111
112static void 112static void
@@ -123,7 +123,7 @@ bast_irq_pc104_demux(unsigned int irq,
123 /* ack if we get an irq with nothing (ie, startup) */ 123 /* ack if we get an irq with nothing (ie, startup) */
124 124
125 desc = irq_desc + IRQ_ISA; 125 desc = irq_desc + IRQ_ISA;
126 desc->chip->ack(IRQ_ISA); 126 desc->irq_data.chip->irq_ack(&desc->irq_data);
127 } else { 127 } else {
128 /* handle the IRQ */ 128 /* handle the IRQ */
129 129
diff --git a/arch/arm/mach-s3c2410/include/mach/irqs.h b/arch/arm/mach-s3c2410/include/mach/irqs.h
index 11bb0f08fe6a..e5a68ea13113 100644
--- a/arch/arm/mach-s3c2410/include/mach/irqs.h
+++ b/arch/arm/mach-s3c2410/include/mach/irqs.h
@@ -152,8 +152,8 @@
152 152
153#define IRQ_S3C2416_HSMMC0 S3C2410_IRQ(21) /* S3C2416/S3C2450 */ 153#define IRQ_S3C2416_HSMMC0 S3C2410_IRQ(21) /* S3C2416/S3C2450 */
154 154
155#define IRQ_HSMMC0 IRQ_S3C2443_HSMMC 155#define IRQ_HSMMC0 IRQ_S3C2416_HSMMC0
156#define IRQ_HSMMC1 IRQ_S3C2416_HSMMC0 156#define IRQ_HSMMC1 IRQ_S3C2443_HSMMC
157 157
158#define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14) 158#define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14)
159#define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15) 159#define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15)
diff --git a/arch/arm/mach-s3c2410/include/mach/map.h b/arch/arm/mach-s3c2410/include/mach/map.h
index cd3983ad4160..25bbf5a942dd 100644
--- a/arch/arm/mach-s3c2410/include/mach/map.h
+++ b/arch/arm/mach-s3c2410/include/mach/map.h
@@ -112,8 +112,8 @@
112#define S3C_PA_IIC S3C2410_PA_IIC 112#define S3C_PA_IIC S3C2410_PA_IIC
113#define S3C_PA_UART S3C24XX_PA_UART 113#define S3C_PA_UART S3C24XX_PA_UART
114#define S3C_PA_USBHOST S3C2410_PA_USBHOST 114#define S3C_PA_USBHOST S3C2410_PA_USBHOST
115#define S3C_PA_HSMMC0 S3C2443_PA_HSMMC 115#define S3C_PA_HSMMC0 S3C2416_PA_HSMMC0
116#define S3C_PA_HSMMC1 S3C2416_PA_HSMMC0 116#define S3C_PA_HSMMC1 S3C2443_PA_HSMMC
117#define S3C_PA_WDT S3C2410_PA_WATCHDOG 117#define S3C_PA_WDT S3C2410_PA_WATCHDOG
118#define S3C_PA_NAND S3C24XX_PA_NAND 118#define S3C_PA_NAND S3C24XX_PA_NAND
119 119
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
index 101aeea22310..44494a56e68b 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
@@ -86,6 +86,7 @@
86#define S3C2443_HCLKCON_LCDC (1<<9) 86#define S3C2443_HCLKCON_LCDC (1<<9)
87#define S3C2443_HCLKCON_USBH (1<<11) 87#define S3C2443_HCLKCON_USBH (1<<11)
88#define S3C2443_HCLKCON_USBD (1<<12) 88#define S3C2443_HCLKCON_USBD (1<<12)
89#define S3C2416_HCLKCON_HSMMC0 (1<<15)
89#define S3C2443_HCLKCON_HSMMC (1<<16) 90#define S3C2443_HCLKCON_HSMMC (1<<16)
90#define S3C2443_HCLKCON_CFC (1<<17) 91#define S3C2443_HCLKCON_CFC (1<<17)
91#define S3C2443_HCLKCON_SSMC (1<<18) 92#define S3C2443_HCLKCON_SSMC (1<<18)
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c2412/irq.c
index 6000ca9d1815..eddb52ba5b65 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c2412/irq.c
@@ -49,9 +49,9 @@
49*/ 49*/
50 50
51static void 51static void
52s3c2412_irq_mask(unsigned int irqno) 52s3c2412_irq_mask(struct irq_data *data)
53{ 53{
54 unsigned long bitval = 1UL << (irqno - IRQ_EINT0); 54 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
55 unsigned long mask; 55 unsigned long mask;
56 56
57 mask = __raw_readl(S3C2410_INTMSK); 57 mask = __raw_readl(S3C2410_INTMSK);
@@ -62,9 +62,9 @@ s3c2412_irq_mask(unsigned int irqno)
62} 62}
63 63
64static inline void 64static inline void
65s3c2412_irq_ack(unsigned int irqno) 65s3c2412_irq_ack(struct irq_data *data)
66{ 66{
67 unsigned long bitval = 1UL << (irqno - IRQ_EINT0); 67 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
68 68
69 __raw_writel(bitval, S3C2412_EINTPEND); 69 __raw_writel(bitval, S3C2412_EINTPEND);
70 __raw_writel(bitval, S3C2410_SRCPND); 70 __raw_writel(bitval, S3C2410_SRCPND);
@@ -72,9 +72,9 @@ s3c2412_irq_ack(unsigned int irqno)
72} 72}
73 73
74static inline void 74static inline void
75s3c2412_irq_maskack(unsigned int irqno) 75s3c2412_irq_maskack(struct irq_data *data)
76{ 76{
77 unsigned long bitval = 1UL << (irqno - IRQ_EINT0); 77 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
78 unsigned long mask; 78 unsigned long mask;
79 79
80 mask = __raw_readl(S3C2410_INTMSK); 80 mask = __raw_readl(S3C2410_INTMSK);
@@ -89,9 +89,9 @@ s3c2412_irq_maskack(unsigned int irqno)
89} 89}
90 90
91static void 91static void
92s3c2412_irq_unmask(unsigned int irqno) 92s3c2412_irq_unmask(struct irq_data *data)
93{ 93{
94 unsigned long bitval = 1UL << (irqno - IRQ_EINT0); 94 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
95 unsigned long mask; 95 unsigned long mask;
96 96
97 mask = __raw_readl(S3C2412_EINTMASK); 97 mask = __raw_readl(S3C2412_EINTMASK);
@@ -102,11 +102,11 @@ s3c2412_irq_unmask(unsigned int irqno)
102} 102}
103 103
104static struct irq_chip s3c2412_irq_eint0t4 = { 104static struct irq_chip s3c2412_irq_eint0t4 = {
105 .ack = s3c2412_irq_ack, 105 .irq_ack = s3c2412_irq_ack,
106 .mask = s3c2412_irq_mask, 106 .irq_mask = s3c2412_irq_mask,
107 .unmask = s3c2412_irq_unmask, 107 .irq_unmask = s3c2412_irq_unmask,
108 .set_wake = s3c_irq_wake, 108 .irq_set_wake = s3c_irq_wake,
109 .set_type = s3c_irqext_type, 109 .irq_set_type = s3c_irqext_type,
110}; 110};
111 111
112#define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) 112#define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0)))
@@ -132,29 +132,29 @@ static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc)
132#define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) 132#define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0))
133#define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) 133#define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF)
134 134
135static void s3c2412_irq_cfsdi_mask(unsigned int irqno) 135static void s3c2412_irq_cfsdi_mask(struct irq_data *data)
136{ 136{
137 s3c_irqsub_mask(irqno, INTMSK_CFSDI, SUBMSK_CFSDI); 137 s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
138} 138}
139 139
140static void s3c2412_irq_cfsdi_unmask(unsigned int irqno) 140static void s3c2412_irq_cfsdi_unmask(struct irq_data *data)
141{ 141{
142 s3c_irqsub_unmask(irqno, INTMSK_CFSDI); 142 s3c_irqsub_unmask(data->irq, INTMSK_CFSDI);
143} 143}
144 144
145static void s3c2412_irq_cfsdi_ack(unsigned int irqno) 145static void s3c2412_irq_cfsdi_ack(struct irq_data *data)
146{ 146{
147 s3c_irqsub_maskack(irqno, INTMSK_CFSDI, SUBMSK_CFSDI); 147 s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
148} 148}
149 149
150static struct irq_chip s3c2412_irq_cfsdi = { 150static struct irq_chip s3c2412_irq_cfsdi = {
151 .name = "s3c2412-cfsdi", 151 .name = "s3c2412-cfsdi",
152 .ack = s3c2412_irq_cfsdi_ack, 152 .irq_ack = s3c2412_irq_cfsdi_ack,
153 .mask = s3c2412_irq_cfsdi_mask, 153 .irq_mask = s3c2412_irq_cfsdi_mask,
154 .unmask = s3c2412_irq_cfsdi_unmask, 154 .irq_unmask = s3c2412_irq_cfsdi_unmask,
155}; 155};
156 156
157static int s3c2412_irq_rtc_wake(unsigned int irqno, unsigned int state) 157static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state)
158{ 158{
159 unsigned long pwrcfg; 159 unsigned long pwrcfg;
160 160
@@ -165,7 +165,7 @@ static int s3c2412_irq_rtc_wake(unsigned int irqno, unsigned int state)
165 pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ; 165 pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ;
166 __raw_writel(pwrcfg, S3C2412_PWRCFG); 166 __raw_writel(pwrcfg, S3C2412_PWRCFG);
167 167
168 return s3c_irq_chip.set_wake(irqno, state); 168 return s3c_irq_chip.irq_set_wake(data, state);
169} 169}
170 170
171static struct irq_chip s3c2412_irq_rtc_chip; 171static struct irq_chip s3c2412_irq_rtc_chip;
@@ -193,7 +193,7 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
193 /* change RTC IRQ's set wake method */ 193 /* change RTC IRQ's set wake method */
194 194
195 s3c2412_irq_rtc_chip = s3c_irq_chip; 195 s3c2412_irq_rtc_chip = s3c_irq_chip;
196 s3c2412_irq_rtc_chip.set_wake = s3c2412_irq_rtc_wake; 196 s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake;
197 197
198 set_irq_chip(IRQ_RTC, &s3c2412_irq_rtc_chip); 198 set_irq_chip(IRQ_RTC, &s3c2412_irq_rtc_chip);
199 199
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig
index df8d14974c90..69b48a7d1dbd 100644
--- a/arch/arm/mach-s3c2416/Kconfig
+++ b/arch/arm/mach-s3c2416/Kconfig
@@ -31,6 +31,17 @@ config S3C2416_PM
31 help 31 help
32 Internal config node to apply S3C2416 power management 32 Internal config node to apply S3C2416 power management
33 33
34config S3C2416_SETUP_SDHCI
35 bool
36 select S3C2416_SETUP_SDHCI_GPIO
37 help
38 Internal helper functions for S3C2416 based SDHCI systems
39
40config S3C2416_SETUP_SDHCI_GPIO
41 bool
42 help
43 Common setup code for SDHCI gpio.
44
34menu "S3C2416 Machines" 45menu "S3C2416 Machines"
35 46
36config MACH_SMDK2416 47config MACH_SMDK2416
@@ -42,6 +53,7 @@ config MACH_SMDK2416
42 select S3C_DEV_HSMMC1 53 select S3C_DEV_HSMMC1
43 select S3C_DEV_NAND 54 select S3C_DEV_NAND
44 select S3C_DEV_USB_HOST 55 select S3C_DEV_USB_HOST
56 select S3C2416_SETUP_SDHCI
45 select S3C2416_PM if PM 57 select S3C2416_PM if PM
46 help 58 help
47 Say Y here if you are using an SMDK2416 59 Say Y here if you are using an SMDK2416
diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile
index ef038d62ffdb..7b805b279caf 100644
--- a/arch/arm/mach-s3c2416/Makefile
+++ b/arch/arm/mach-s3c2416/Makefile
@@ -14,6 +14,10 @@ obj-$(CONFIG_CPU_S3C2416) += irq.o
14obj-$(CONFIG_S3C2416_PM) += pm.o 14obj-$(CONFIG_S3C2416_PM) += pm.o
15#obj-$(CONFIG_S3C2416_DMA) += dma.o 15#obj-$(CONFIG_S3C2416_DMA) += dma.o
16 16
17# Device setup
18obj-$(CONFIG_S3C2416_SETUP_SDHCI) += setup-sdhci.o
19obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
20
17# Machine support 21# Machine support
18 22
19obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o 23obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
diff --git a/arch/arm/mach-s3c2416/clock.c b/arch/arm/mach-s3c2416/clock.c
index 7ccf5a2a2bfc..3b02d8506e25 100644
--- a/arch/arm/mach-s3c2416/clock.c
+++ b/arch/arm/mach-s3c2416/clock.c
@@ -38,12 +38,11 @@ static unsigned int armdiv[8] = {
38 [7] = 8, 38 [7] = 8,
39}; 39};
40 40
41/* ID to hardware numbering, 0 is HSMMC1, 1 is HSMMC0 */
42static struct clksrc_clk hsmmc_div[] = { 41static struct clksrc_clk hsmmc_div[] = {
43 [0] = { 42 [0] = {
44 .clk = { 43 .clk = {
45 .name = "hsmmc-div", 44 .name = "hsmmc-div",
46 .id = 1, 45 .id = 0,
47 .parent = &clk_esysclk.clk, 46 .parent = &clk_esysclk.clk,
48 }, 47 },
49 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 }, 48 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 },
@@ -51,7 +50,7 @@ static struct clksrc_clk hsmmc_div[] = {
51 [1] = { 50 [1] = {
52 .clk = { 51 .clk = {
53 .name = "hsmmc-div", 52 .name = "hsmmc-div",
54 .id = 0, 53 .id = 1,
55 .parent = &clk_esysclk.clk, 54 .parent = &clk_esysclk.clk,
56 }, 55 },
57 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, 56 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
@@ -61,7 +60,7 @@ static struct clksrc_clk hsmmc_div[] = {
61static struct clksrc_clk hsmmc_mux[] = { 60static struct clksrc_clk hsmmc_mux[] = {
62 [0] = { 61 [0] = {
63 .clk = { 62 .clk = {
64 .id = 1, 63 .id = 0,
65 .name = "hsmmc-if", 64 .name = "hsmmc-if",
66 .ctrlbit = (1 << 6), 65 .ctrlbit = (1 << 6),
67 .enable = s3c2443_clkcon_enable_s, 66 .enable = s3c2443_clkcon_enable_s,
@@ -77,7 +76,7 @@ static struct clksrc_clk hsmmc_mux[] = {
77 }, 76 },
78 [1] = { 77 [1] = {
79 .clk = { 78 .clk = {
80 .id = 0, 79 .id = 1,
81 .name = "hsmmc-if", 80 .name = "hsmmc-if",
82 .ctrlbit = (1 << 12), 81 .ctrlbit = (1 << 12),
83 .enable = s3c2443_clkcon_enable_s, 82 .enable = s3c2443_clkcon_enable_s,
@@ -93,6 +92,13 @@ static struct clksrc_clk hsmmc_mux[] = {
93 }, 92 },
94}; 93};
95 94
95static struct clk hsmmc0_clk = {
96 .name = "hsmmc",
97 .id = 0,
98 .parent = &clk_h,
99 .enable = s3c2443_clkcon_enable_h,
100 .ctrlbit = S3C2416_HCLKCON_HSMMC0,
101};
96 102
97static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0) 103static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0)
98{ 104{
@@ -130,6 +136,8 @@ void __init s3c2416_init_clocks(int xtal)
130 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 136 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
131 s3c_register_clksrc(clksrcs[ptr], 1); 137 s3c_register_clksrc(clksrcs[ptr], 1);
132 138
139 s3c24xx_register_clock(&hsmmc0_clk);
140
133 s3c_pwmclk_init(); 141 s3c_pwmclk_init();
134 142
135} 143}
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c
index 00174daf1526..680fe386aca5 100644
--- a/arch/arm/mach-s3c2416/irq.c
+++ b/arch/arm/mach-s3c2416/irq.c
@@ -77,28 +77,27 @@ static void s3c2416_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc)
77#define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0)) 77#define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0))
78#define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97) 78#define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97)
79 79
80static void s3c2416_irq_wdtac97_mask(unsigned int irqno) 80static void s3c2416_irq_wdtac97_mask(struct irq_data *data)
81{ 81{
82 s3c_irqsub_mask(irqno, INTMSK_WDTAC97, SUBMSK_WDTAC97); 82 s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
83} 83}
84 84
85static void s3c2416_irq_wdtac97_unmask(unsigned int irqno) 85static void s3c2416_irq_wdtac97_unmask(struct irq_data *data)
86{ 86{
87 s3c_irqsub_unmask(irqno, INTMSK_WDTAC97); 87 s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97);
88} 88}
89 89
90static void s3c2416_irq_wdtac97_ack(unsigned int irqno) 90static void s3c2416_irq_wdtac97_ack(struct irq_data *data)
91{ 91{
92 s3c_irqsub_maskack(irqno, INTMSK_WDTAC97, SUBMSK_WDTAC97); 92 s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
93} 93}
94 94
95static struct irq_chip s3c2416_irq_wdtac97 = { 95static struct irq_chip s3c2416_irq_wdtac97 = {
96 .mask = s3c2416_irq_wdtac97_mask, 96 .irq_mask = s3c2416_irq_wdtac97_mask,
97 .unmask = s3c2416_irq_wdtac97_unmask, 97 .irq_unmask = s3c2416_irq_wdtac97_unmask,
98 .ack = s3c2416_irq_wdtac97_ack, 98 .irq_ack = s3c2416_irq_wdtac97_ack,
99}; 99};
100 100
101
102/* LCD sub interrupts */ 101/* LCD sub interrupts */
103 102
104static void s3c2416_irq_demux_lcd(unsigned int irq, struct irq_desc *desc) 103static void s3c2416_irq_demux_lcd(unsigned int irq, struct irq_desc *desc)
@@ -109,28 +108,27 @@ static void s3c2416_irq_demux_lcd(unsigned int irq, struct irq_desc *desc)
109#define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0)) 108#define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0))
110#define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4) 109#define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4)
111 110
112static void s3c2416_irq_lcd_mask(unsigned int irqno) 111static void s3c2416_irq_lcd_mask(struct irq_data *data)
113{ 112{
114 s3c_irqsub_mask(irqno, INTMSK_LCD, SUBMSK_LCD); 113 s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD);
115} 114}
116 115
117static void s3c2416_irq_lcd_unmask(unsigned int irqno) 116static void s3c2416_irq_lcd_unmask(struct irq_data *data)
118{ 117{
119 s3c_irqsub_unmask(irqno, INTMSK_LCD); 118 s3c_irqsub_unmask(data->irq, INTMSK_LCD);
120} 119}
121 120
122static void s3c2416_irq_lcd_ack(unsigned int irqno) 121static void s3c2416_irq_lcd_ack(struct irq_data *data)
123{ 122{
124 s3c_irqsub_maskack(irqno, INTMSK_LCD, SUBMSK_LCD); 123 s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD);
125} 124}
126 125
127static struct irq_chip s3c2416_irq_lcd = { 126static struct irq_chip s3c2416_irq_lcd = {
128 .mask = s3c2416_irq_lcd_mask, 127 .irq_mask = s3c2416_irq_lcd_mask,
129 .unmask = s3c2416_irq_lcd_unmask, 128 .irq_unmask = s3c2416_irq_lcd_unmask,
130 .ack = s3c2416_irq_lcd_ack, 129 .irq_ack = s3c2416_irq_lcd_ack,
131}; 130};
132 131
133
134/* DMA sub interrupts */ 132/* DMA sub interrupts */
135 133
136static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc) 134static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
@@ -142,28 +140,27 @@ static void s3c2416_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
142#define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5) 140#define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5)
143 141
144 142
145static void s3c2416_irq_dma_mask(unsigned int irqno) 143static void s3c2416_irq_dma_mask(struct irq_data *data)
146{ 144{
147 s3c_irqsub_mask(irqno, INTMSK_DMA, SUBMSK_DMA); 145 s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA);
148} 146}
149 147
150static void s3c2416_irq_dma_unmask(unsigned int irqno) 148static void s3c2416_irq_dma_unmask(struct irq_data *data)
151{ 149{
152 s3c_irqsub_unmask(irqno, INTMSK_DMA); 150 s3c_irqsub_unmask(data->irq, INTMSK_DMA);
153} 151}
154 152
155static void s3c2416_irq_dma_ack(unsigned int irqno) 153static void s3c2416_irq_dma_ack(struct irq_data *data)
156{ 154{
157 s3c_irqsub_maskack(irqno, INTMSK_DMA, SUBMSK_DMA); 155 s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA);
158} 156}
159 157
160static struct irq_chip s3c2416_irq_dma = { 158static struct irq_chip s3c2416_irq_dma = {
161 .mask = s3c2416_irq_dma_mask, 159 .irq_mask = s3c2416_irq_dma_mask,
162 .unmask = s3c2416_irq_dma_unmask, 160 .irq_unmask = s3c2416_irq_dma_unmask,
163 .ack = s3c2416_irq_dma_ack, 161 .irq_ack = s3c2416_irq_dma_ack,
164}; 162};
165 163
166
167/* UART3 sub interrupts */ 164/* UART3 sub interrupts */
168 165
169static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc) 166static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc)
@@ -174,28 +171,27 @@ static void s3c2416_irq_demux_uart3(unsigned int irq, struct irq_desc *desc)
174#define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0)) 171#define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0))
175#define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0))) 172#define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0)))
176 173
177static void s3c2416_irq_uart3_mask(unsigned int irqno) 174static void s3c2416_irq_uart3_mask(struct irq_data *data)
178{ 175{
179 s3c_irqsub_mask(irqno, INTMSK_UART3, SUBMSK_UART3); 176 s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3);
180} 177}
181 178
182static void s3c2416_irq_uart3_unmask(unsigned int irqno) 179static void s3c2416_irq_uart3_unmask(struct irq_data *data)
183{ 180{
184 s3c_irqsub_unmask(irqno, INTMSK_UART3); 181 s3c_irqsub_unmask(data->irq, INTMSK_UART3);
185} 182}
186 183
187static void s3c2416_irq_uart3_ack(unsigned int irqno) 184static void s3c2416_irq_uart3_ack(struct irq_data *data)
188{ 185{
189 s3c_irqsub_maskack(irqno, INTMSK_UART3, SUBMSK_UART3); 186 s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3);
190} 187}
191 188
192static struct irq_chip s3c2416_irq_uart3 = { 189static struct irq_chip s3c2416_irq_uart3 = {
193 .mask = s3c2416_irq_uart3_mask, 190 .irq_mask = s3c2416_irq_uart3_mask,
194 .unmask = s3c2416_irq_uart3_unmask, 191 .irq_unmask = s3c2416_irq_uart3_unmask,
195 .ack = s3c2416_irq_uart3_ack, 192 .irq_ack = s3c2416_irq_uart3_ack,
196}; 193};
197 194
198
199/* IRQ initialisation code */ 195/* IRQ initialisation code */
200 196
201static int __init s3c2416_add_sub(unsigned int base, 197static int __init s3c2416_add_sub(unsigned int base,
diff --git a/arch/arm/mach-s3c2416/mach-smdk2416.c b/arch/arm/mach-s3c2416/mach-smdk2416.c
index 7fc366476d7e..3f83177246c7 100644
--- a/arch/arm/mach-s3c2416/mach-smdk2416.c
+++ b/arch/arm/mach-s3c2416/mach-smdk2416.c
@@ -46,6 +46,7 @@
46#include <plat/devs.h> 46#include <plat/devs.h>
47#include <plat/cpu.h> 47#include <plat/cpu.h>
48#include <plat/nand.h> 48#include <plat/nand.h>
49#include <plat/sdhci.h>
49 50
50#include <plat/regs-fb-v4.h> 51#include <plat/regs-fb-v4.h>
51#include <plat/fb.h> 52#include <plat/fb.h>
@@ -110,6 +111,13 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
110 .ucon = UCON, 111 .ucon = UCON,
111 .ulcon = ULCON | 0x50, 112 .ulcon = ULCON | 0x50,
112 .ufcon = UFCON, 113 .ufcon = UFCON,
114 },
115 [3] = {
116 .hwport = 3,
117 .flags = 0,
118 .ucon = UCON,
119 .ulcon = ULCON,
120 .ufcon = UFCON,
113 } 121 }
114}; 122};
115 123
@@ -159,6 +167,18 @@ static struct s3c_fb_platdata smdk2416_fb_platdata = {
159 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, 167 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
160}; 168};
161 169
170static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
171 .max_width = 4,
172 .cd_type = S3C_SDHCI_CD_GPIO,
173 .ext_cd_gpio = S3C2410_GPF(1),
174 .ext_cd_gpio_invert = 1,
175};
176
177static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
178 .max_width = 4,
179 .cd_type = S3C_SDHCI_CD_NONE,
180};
181
162static struct platform_device *smdk2416_devices[] __initdata = { 182static struct platform_device *smdk2416_devices[] __initdata = {
163 &s3c_device_fb, 183 &s3c_device_fb,
164 &s3c_device_wdt, 184 &s3c_device_wdt,
@@ -180,6 +200,9 @@ static void __init smdk2416_machine_init(void)
180 s3c_i2c0_set_platdata(NULL); 200 s3c_i2c0_set_platdata(NULL);
181 s3c_fb_set_platdata(&smdk2416_fb_platdata); 201 s3c_fb_set_platdata(&smdk2416_fb_platdata);
182 202
203 s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
204 s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
205
183 gpio_request(S3C2410_GPB(4), "USBHost Power"); 206 gpio_request(S3C2410_GPB(4), "USBHost Power");
184 gpio_direction_output(S3C2410_GPB(4), 1); 207 gpio_direction_output(S3C2410_GPB(4), 1);
185 208
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index 63f39cdc0972..ba7fd8737434 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -53,6 +53,7 @@
53#include <plat/s3c2416.h> 53#include <plat/s3c2416.h>
54#include <plat/devs.h> 54#include <plat/devs.h>
55#include <plat/cpu.h> 55#include <plat/cpu.h>
56#include <plat/sdhci.h>
56 57
57#include <plat/iic-core.h> 58#include <plat/iic-core.h>
58#include <plat/fb-core.h> 59#include <plat/fb-core.h>
@@ -115,6 +116,10 @@ void __init s3c2416_map_io(void)
115 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown; 116 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown;
116 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown; 117 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown;
117 118
119 /* initialize device information early */
120 s3c2416_default_sdhci0();
121 s3c2416_default_sdhci1();
122
118 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); 123 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
119} 124}
120 125
diff --git a/arch/arm/mach-s3c2416/setup-sdhci-gpio.c b/arch/arm/mach-s3c2416/setup-sdhci-gpio.c
new file mode 100644
index 000000000000..f65cb3ef16ce
--- /dev/null
+++ b/arch/arm/mach-s3c2416/setup-sdhci-gpio.c
@@ -0,0 +1,34 @@
1/* linux/arch/arm/plat-s3c2416/setup-sdhci-gpio.c
2 *
3 * Copyright 2010 Promwad Innovation Company
4 * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
5 *
6 * S3C2416 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
7 *
8 * Based on mach-s3c64xx/setup-sdhci-gpio.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/platform_device.h>
19#include <linux/io.h>
20#include <linux/gpio.h>
21
22#include <mach/regs-gpio.h>
23#include <plat/gpio-cfg.h>
24
25void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
26{
27 s3c_gpio_cfgrange_nopull(S3C2410_GPE(5), 2 + width, S3C_GPIO_SFN(2));
28}
29
30void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
31{
32 s3c_gpio_cfgrange_nopull(S3C2410_GPL(0), width, S3C_GPIO_SFN(2));
33 s3c_gpio_cfgrange_nopull(S3C2410_GPL(8), 2, S3C_GPIO_SFN(2));
34}
diff --git a/arch/arm/mach-s3c2416/setup-sdhci.c b/arch/arm/mach-s3c2416/setup-sdhci.c
new file mode 100644
index 000000000000..ed34fad8f2c6
--- /dev/null
+++ b/arch/arm/mach-s3c2416/setup-sdhci.c
@@ -0,0 +1,61 @@
1/* linux/arch/arm/mach-s3c2416/setup-sdhci.c
2 *
3 * Copyright 2010 Promwad Innovation Company
4 * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
5 *
6 * S3C2416 - Helper functions for settign up SDHCI device(s) (HSMMC)
7 *
8 * Based on mach-s3c64xx/setup-sdhci.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/platform_device.h>
19#include <linux/io.h>
20
21#include <linux/mmc/card.h>
22#include <linux/mmc/host.h>
23
24#include <plat/regs-sdhci.h>
25#include <plat/sdhci.h>
26
27/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
28
29char *s3c2416_hsmmc_clksrcs[4] = {
30 [0] = "hsmmc",
31 [1] = "hsmmc",
32 [2] = "hsmmc-if",
33 /* [3] = "48m", - note not successfully used yet */
34};
35
36void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev,
37 void __iomem *r,
38 struct mmc_ios *ios,
39 struct mmc_card *card)
40{
41 u32 ctrl2, ctrl3;
42
43 ctrl2 = __raw_readl(r + S3C_SDHCI_CONTROL2);
44 ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
45 ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
46 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
47 S3C_SDHCI_CTRL2_ENFBCLKRX |
48 S3C_SDHCI_CTRL2_DFCNT_NONE |
49 S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
50
51 if (ios->clock < 25 * 1000000)
52 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
53 S3C_SDHCI_CTRL3_FCSEL2 |
54 S3C_SDHCI_CTRL3_FCSEL1 |
55 S3C_SDHCI_CTRL3_FCSEL0);
56 else
57 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
58
59 __raw_writel(ctrl2, r + S3C_SDHCI_CONTROL2);
60 __raw_writel(ctrl3, r + S3C_SDHCI_CONTROL3);
61}
diff --git a/arch/arm/mach-s3c2440/irq.c b/arch/arm/mach-s3c2440/irq.c
index 0c049b95c378..acad4428bef0 100644
--- a/arch/arm/mach-s3c2440/irq.c
+++ b/arch/arm/mach-s3c2440/irq.c
@@ -69,27 +69,27 @@ static void s3c_irq_demux_wdtac97(unsigned int irq,
69#define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0)) 69#define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0))
70 70
71static void 71static void
72s3c_irq_wdtac97_mask(unsigned int irqno) 72s3c_irq_wdtac97_mask(struct irq_data *data)
73{ 73{
74 s3c_irqsub_mask(irqno, INTMSK_WDT, 3<<13); 74 s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13);
75} 75}
76 76
77static void 77static void
78s3c_irq_wdtac97_unmask(unsigned int irqno) 78s3c_irq_wdtac97_unmask(struct irq_data *data)
79{ 79{
80 s3c_irqsub_unmask(irqno, INTMSK_WDT); 80 s3c_irqsub_unmask(data->irq, INTMSK_WDT);
81} 81}
82 82
83static void 83static void
84s3c_irq_wdtac97_ack(unsigned int irqno) 84s3c_irq_wdtac97_ack(struct irq_data *data)
85{ 85{
86 s3c_irqsub_maskack(irqno, INTMSK_WDT, 3<<13); 86 s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13);
87} 87}
88 88
89static struct irq_chip s3c_irq_wdtac97 = { 89static struct irq_chip s3c_irq_wdtac97 = {
90 .mask = s3c_irq_wdtac97_mask, 90 .irq_mask = s3c_irq_wdtac97_mask,
91 .unmask = s3c_irq_wdtac97_unmask, 91 .irq_unmask = s3c_irq_wdtac97_unmask,
92 .ack = s3c_irq_wdtac97_ack, 92 .irq_ack = s3c_irq_wdtac97_ack,
93}; 93};
94 94
95static int s3c2440_irq_add(struct sys_device *sysdev) 95static int s3c2440_irq_add(struct sys_device *sysdev)
diff --git a/arch/arm/mach-s3c2440/s3c244x-irq.c b/arch/arm/mach-s3c2440/s3c244x-irq.c
index a75c0c2431ea..83daf4ece764 100644
--- a/arch/arm/mach-s3c2440/s3c244x-irq.c
+++ b/arch/arm/mach-s3c2440/s3c244x-irq.c
@@ -68,27 +68,27 @@ static void s3c_irq_demux_cam(unsigned int irq,
68#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0)) 68#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
69 69
70static void 70static void
71s3c_irq_cam_mask(unsigned int irqno) 71s3c_irq_cam_mask(struct irq_data *data)
72{ 72{
73 s3c_irqsub_mask(irqno, INTMSK_CAM, 3<<11); 73 s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11);
74} 74}
75 75
76static void 76static void
77s3c_irq_cam_unmask(unsigned int irqno) 77s3c_irq_cam_unmask(struct irq_data *data)
78{ 78{
79 s3c_irqsub_unmask(irqno, INTMSK_CAM); 79 s3c_irqsub_unmask(data->irq, INTMSK_CAM);
80} 80}
81 81
82static void 82static void
83s3c_irq_cam_ack(unsigned int irqno) 83s3c_irq_cam_ack(struct irq_data *data)
84{ 84{
85 s3c_irqsub_maskack(irqno, INTMSK_CAM, 3<<11); 85 s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11);
86} 86}
87 87
88static struct irq_chip s3c_irq_cam = { 88static struct irq_chip s3c_irq_cam = {
89 .mask = s3c_irq_cam_mask, 89 .irq_mask = s3c_irq_cam_mask,
90 .unmask = s3c_irq_cam_unmask, 90 .irq_unmask = s3c_irq_cam_unmask,
91 .ack = s3c_irq_cam_ack, 91 .irq_ack = s3c_irq_cam_ack,
92}; 92};
93 93
94static int s3c244x_irq_add(struct sys_device *sysdev) 94static int s3c244x_irq_add(struct sys_device *sysdev)
diff --git a/arch/arm/mach-s3c2443/Kconfig b/arch/arm/mach-s3c2443/Kconfig
index 31babec90cec..d8eb86823df7 100644
--- a/arch/arm/mach-s3c2443/Kconfig
+++ b/arch/arm/mach-s3c2443/Kconfig
@@ -10,6 +10,7 @@ config CPU_S3C2443
10 select CPU_LLSERIAL_S3C2440 10 select CPU_LLSERIAL_S3C2440
11 select SAMSUNG_CLKSRC 11 select SAMSUNG_CLKSRC
12 select S3C2443_CLOCK 12 select S3C2443_CLOCK
13 select S3C_GPIO_PULL_S3C2443
13 help 14 help
14 Support for the S3C2443 SoC from the S3C24XX line 15 Support for the S3C2443 SoC from the S3C24XX line
15 16
@@ -25,7 +26,7 @@ config MACH_SMDK2443
25 bool "SMDK2443" 26 bool "SMDK2443"
26 select CPU_S3C2443 27 select CPU_S3C2443
27 select MACH_SMDK 28 select MACH_SMDK
28 select S3C_DEV_HSMMC 29 select S3C_DEV_HSMMC1
29 help 30 help
30 Say Y here if you are using an SMDK2443 31 Say Y here if you are using an SMDK2443
31 32
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 0c3c0c884cd3..f4ec6d5715c8 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -196,7 +196,7 @@ static struct clksrc_clk clk_hsspi = {
196static struct clksrc_clk clk_hsmmc_div = { 196static struct clksrc_clk clk_hsmmc_div = {
197 .clk = { 197 .clk = {
198 .name = "hsmmc-div", 198 .name = "hsmmc-div",
199 .id = -1, 199 .id = 1,
200 .parent = &clk_esysclk.clk, 200 .parent = &clk_esysclk.clk,
201 }, 201 },
202 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, 202 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
@@ -231,7 +231,7 @@ static int s3c2443_enable_hsmmc(struct clk *clk, int enable)
231 231
232static struct clk clk_hsmmc = { 232static struct clk clk_hsmmc = {
233 .name = "hsmmc-if", 233 .name = "hsmmc-if",
234 .id = -1, 234 .id = 1,
235 .parent = &clk_hsmmc_div.clk, 235 .parent = &clk_hsmmc_div.clk,
236 .enable = s3c2443_enable_hsmmc, 236 .enable = s3c2443_enable_hsmmc,
237 .ops = &(struct clk_ops) { 237 .ops = &(struct clk_ops) {
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c2443/irq.c
index 893424767ce1..c7820f9c1352 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c2443/irq.c
@@ -75,28 +75,27 @@ static void s3c2443_irq_demux_wdtac97(unsigned int irq, struct irq_desc *desc)
75#define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0)) 75#define INTMSK_WDTAC97 (1UL << (IRQ_WDT - IRQ_EINT0))
76#define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97) 76#define SUBMSK_WDTAC97 INTMSK(IRQ_S3C2443_WDT, IRQ_S3C2443_AC97)
77 77
78static void s3c2443_irq_wdtac97_mask(unsigned int irqno) 78static void s3c2443_irq_wdtac97_mask(struct irq_data *data)
79{ 79{
80 s3c_irqsub_mask(irqno, INTMSK_WDTAC97, SUBMSK_WDTAC97); 80 s3c_irqsub_mask(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
81} 81}
82 82
83static void s3c2443_irq_wdtac97_unmask(unsigned int irqno) 83static void s3c2443_irq_wdtac97_unmask(struct irq_data *data)
84{ 84{
85 s3c_irqsub_unmask(irqno, INTMSK_WDTAC97); 85 s3c_irqsub_unmask(data->irq, INTMSK_WDTAC97);
86} 86}
87 87
88static void s3c2443_irq_wdtac97_ack(unsigned int irqno) 88static void s3c2443_irq_wdtac97_ack(struct irq_data *data)
89{ 89{
90 s3c_irqsub_maskack(irqno, INTMSK_WDTAC97, SUBMSK_WDTAC97); 90 s3c_irqsub_maskack(data->irq, INTMSK_WDTAC97, SUBMSK_WDTAC97);
91} 91}
92 92
93static struct irq_chip s3c2443_irq_wdtac97 = { 93static struct irq_chip s3c2443_irq_wdtac97 = {
94 .mask = s3c2443_irq_wdtac97_mask, 94 .irq_mask = s3c2443_irq_wdtac97_mask,
95 .unmask = s3c2443_irq_wdtac97_unmask, 95 .irq_unmask = s3c2443_irq_wdtac97_unmask,
96 .ack = s3c2443_irq_wdtac97_ack, 96 .irq_ack = s3c2443_irq_wdtac97_ack,
97}; 97};
98 98
99
100/* LCD sub interrupts */ 99/* LCD sub interrupts */
101 100
102static void s3c2443_irq_demux_lcd(unsigned int irq, struct irq_desc *desc) 101static void s3c2443_irq_demux_lcd(unsigned int irq, struct irq_desc *desc)
@@ -107,28 +106,27 @@ static void s3c2443_irq_demux_lcd(unsigned int irq, struct irq_desc *desc)
107#define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0)) 106#define INTMSK_LCD (1UL << (IRQ_LCD - IRQ_EINT0))
108#define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4) 107#define SUBMSK_LCD INTMSK(IRQ_S3C2443_LCD1, IRQ_S3C2443_LCD4)
109 108
110static void s3c2443_irq_lcd_mask(unsigned int irqno) 109static void s3c2443_irq_lcd_mask(struct irq_data *data)
111{ 110{
112 s3c_irqsub_mask(irqno, INTMSK_LCD, SUBMSK_LCD); 111 s3c_irqsub_mask(data->irq, INTMSK_LCD, SUBMSK_LCD);
113} 112}
114 113
115static void s3c2443_irq_lcd_unmask(unsigned int irqno) 114static void s3c2443_irq_lcd_unmask(struct irq_data *data)
116{ 115{
117 s3c_irqsub_unmask(irqno, INTMSK_LCD); 116 s3c_irqsub_unmask(data->irq, INTMSK_LCD);
118} 117}
119 118
120static void s3c2443_irq_lcd_ack(unsigned int irqno) 119static void s3c2443_irq_lcd_ack(struct irq_data *data)
121{ 120{
122 s3c_irqsub_maskack(irqno, INTMSK_LCD, SUBMSK_LCD); 121 s3c_irqsub_maskack(data->irq, INTMSK_LCD, SUBMSK_LCD);
123} 122}
124 123
125static struct irq_chip s3c2443_irq_lcd = { 124static struct irq_chip s3c2443_irq_lcd = {
126 .mask = s3c2443_irq_lcd_mask, 125 .irq_mask = s3c2443_irq_lcd_mask,
127 .unmask = s3c2443_irq_lcd_unmask, 126 .irq_unmask = s3c2443_irq_lcd_unmask,
128 .ack = s3c2443_irq_lcd_ack, 127 .irq_ack = s3c2443_irq_lcd_ack,
129}; 128};
130 129
131
132/* DMA sub interrupts */ 130/* DMA sub interrupts */
133 131
134static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc) 132static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
@@ -139,29 +137,27 @@ static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
139#define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) 137#define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0))
140#define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5) 138#define SUBMSK_DMA INTMSK(IRQ_S3C2443_DMA0, IRQ_S3C2443_DMA5)
141 139
142 140static void s3c2443_irq_dma_mask(struct irq_data *data)
143static void s3c2443_irq_dma_mask(unsigned int irqno)
144{ 141{
145 s3c_irqsub_mask(irqno, INTMSK_DMA, SUBMSK_DMA); 142 s3c_irqsub_mask(data->irq, INTMSK_DMA, SUBMSK_DMA);
146} 143}
147 144
148static void s3c2443_irq_dma_unmask(unsigned int irqno) 145static void s3c2443_irq_dma_unmask(struct irq_data *data)
149{ 146{
150 s3c_irqsub_unmask(irqno, INTMSK_DMA); 147 s3c_irqsub_unmask(data->irq, INTMSK_DMA);
151} 148}
152 149
153static void s3c2443_irq_dma_ack(unsigned int irqno) 150static void s3c2443_irq_dma_ack(struct irq_data *data)
154{ 151{
155 s3c_irqsub_maskack(irqno, INTMSK_DMA, SUBMSK_DMA); 152 s3c_irqsub_maskack(data->irq, INTMSK_DMA, SUBMSK_DMA);
156} 153}
157 154
158static struct irq_chip s3c2443_irq_dma = { 155static struct irq_chip s3c2443_irq_dma = {
159 .mask = s3c2443_irq_dma_mask, 156 .irq_mask = s3c2443_irq_dma_mask,
160 .unmask = s3c2443_irq_dma_unmask, 157 .irq_unmask = s3c2443_irq_dma_unmask,
161 .ack = s3c2443_irq_dma_ack, 158 .irq_ack = s3c2443_irq_dma_ack,
162}; 159};
163 160
164
165/* UART3 sub interrupts */ 161/* UART3 sub interrupts */
166 162
167static void s3c2443_irq_demux_uart3(unsigned int irq, struct irq_desc *desc) 163static void s3c2443_irq_demux_uart3(unsigned int irq, struct irq_desc *desc)
@@ -172,28 +168,27 @@ static void s3c2443_irq_demux_uart3(unsigned int irq, struct irq_desc *desc)
172#define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0)) 168#define INTMSK_UART3 (1UL << (IRQ_S3C2443_UART3 - IRQ_EINT0))
173#define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0))) 169#define SUBMSK_UART3 (0x7 << (IRQ_S3C2443_RX3 - S3C2410_IRQSUB(0)))
174 170
175static void s3c2443_irq_uart3_mask(unsigned int irqno) 171static void s3c2443_irq_uart3_mask(struct irq_data *data)
176{ 172{
177 s3c_irqsub_mask(irqno, INTMSK_UART3, SUBMSK_UART3); 173 s3c_irqsub_mask(data->irq, INTMSK_UART3, SUBMSK_UART3);
178} 174}
179 175
180static void s3c2443_irq_uart3_unmask(unsigned int irqno) 176static void s3c2443_irq_uart3_unmask(struct irq_data *data)
181{ 177{
182 s3c_irqsub_unmask(irqno, INTMSK_UART3); 178 s3c_irqsub_unmask(data->irq, INTMSK_UART3);
183} 179}
184 180
185static void s3c2443_irq_uart3_ack(unsigned int irqno) 181static void s3c2443_irq_uart3_ack(struct irq_data *data)
186{ 182{
187 s3c_irqsub_maskack(irqno, INTMSK_UART3, SUBMSK_UART3); 183 s3c_irqsub_maskack(data->irq, INTMSK_UART3, SUBMSK_UART3);
188} 184}
189 185
190static struct irq_chip s3c2443_irq_uart3 = { 186static struct irq_chip s3c2443_irq_uart3 = {
191 .mask = s3c2443_irq_uart3_mask, 187 .irq_mask = s3c2443_irq_uart3_mask,
192 .unmask = s3c2443_irq_uart3_unmask, 188 .irq_unmask = s3c2443_irq_uart3_unmask,
193 .ack = s3c2443_irq_uart3_ack, 189 .irq_ack = s3c2443_irq_uart3_ack,
194}; 190};
195 191
196
197/* CAM sub interrupts */ 192/* CAM sub interrupts */
198 193
199static void s3c2443_irq_demux_cam(unsigned int irq, struct irq_desc *desc) 194static void s3c2443_irq_demux_cam(unsigned int irq, struct irq_desc *desc)
@@ -204,25 +199,25 @@ static void s3c2443_irq_demux_cam(unsigned int irq, struct irq_desc *desc)
204#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0)) 199#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
205#define SUBMSK_CAM INTMSK(IRQ_S3C2440_CAM_C, IRQ_S3C2440_CAM_P) 200#define SUBMSK_CAM INTMSK(IRQ_S3C2440_CAM_C, IRQ_S3C2440_CAM_P)
206 201
207static void s3c2443_irq_cam_mask(unsigned int irqno) 202static void s3c2443_irq_cam_mask(struct irq_data *data)
208{ 203{
209 s3c_irqsub_mask(irqno, INTMSK_CAM, SUBMSK_CAM); 204 s3c_irqsub_mask(data->irq, INTMSK_CAM, SUBMSK_CAM);
210} 205}
211 206
212static void s3c2443_irq_cam_unmask(unsigned int irqno) 207static void s3c2443_irq_cam_unmask(struct irq_data *data)
213{ 208{
214 s3c_irqsub_unmask(irqno, INTMSK_CAM); 209 s3c_irqsub_unmask(data->irq, INTMSK_CAM);
215} 210}
216 211
217static void s3c2443_irq_cam_ack(unsigned int irqno) 212static void s3c2443_irq_cam_ack(struct irq_data *data)
218{ 213{
219 s3c_irqsub_maskack(irqno, INTMSK_CAM, SUBMSK_CAM); 214 s3c_irqsub_maskack(data->irq, INTMSK_CAM, SUBMSK_CAM);
220} 215}
221 216
222static struct irq_chip s3c2443_irq_cam = { 217static struct irq_chip s3c2443_irq_cam = {
223 .mask = s3c2443_irq_cam_mask, 218 .irq_mask = s3c2443_irq_cam_mask,
224 .unmask = s3c2443_irq_cam_unmask, 219 .irq_unmask = s3c2443_irq_cam_unmask,
225 .ack = s3c2443_irq_cam_ack, 220 .irq_ack = s3c2443_irq_cam_ack,
226}; 221};
227 222
228/* IRQ initialisation code */ 223/* IRQ initialisation code */
diff --git a/arch/arm/mach-s3c2443/mach-smdk2443.c b/arch/arm/mach-s3c2443/mach-smdk2443.c
index 4337f0a9960d..514275e43ca0 100644
--- a/arch/arm/mach-s3c2443/mach-smdk2443.c
+++ b/arch/arm/mach-s3c2443/mach-smdk2443.c
@@ -99,13 +99,20 @@ static struct s3c2410_uartcfg smdk2443_uartcfgs[] __initdata = {
99 .ucon = 0x3c5, 99 .ucon = 0x3c5,
100 .ulcon = 0x43, 100 .ulcon = 0x43,
101 .ufcon = 0x51, 101 .ufcon = 0x51,
102 },
103 [3] = {
104 .hwport = 3,
105 .flags = 0,
106 .ucon = 0x3c5,
107 .ulcon = 0x03,
108 .ufcon = 0x51,
102 } 109 }
103}; 110};
104 111
105static struct platform_device *smdk2443_devices[] __initdata = { 112static struct platform_device *smdk2443_devices[] __initdata = {
106 &s3c_device_wdt, 113 &s3c_device_wdt,
107 &s3c_device_i2c0, 114 &s3c_device_i2c0,
108 &s3c_device_hsmmc0, 115 &s3c_device_hsmmc1,
109#ifdef CONFIG_SND_SOC_SMDK2443_WM9710 116#ifdef CONFIG_SND_SOC_SMDK2443_WM9710
110 &s3c_device_ac97, 117 &s3c_device_ac97,
111#endif 118#endif
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index 33d18dd1ebd5..e6a28ba52c7d 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -16,6 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/gpio.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/serial_core.h> 21#include <linux/serial_core.h>
21#include <linux/sysdev.h> 22#include <linux/sysdev.h>
@@ -32,6 +33,9 @@
32#include <mach/regs-s3c2443-clock.h> 33#include <mach/regs-s3c2443-clock.h>
33#include <mach/reset.h> 34#include <mach/reset.h>
34 35
36#include <plat/gpio-core.h>
37#include <plat/gpio-cfg.h>
38#include <plat/gpio-cfg-helpers.h>
35#include <plat/s3c2443.h> 39#include <plat/s3c2443.h>
36#include <plat/devs.h> 40#include <plat/devs.h>
37#include <plat/cpu.h> 41#include <plat/cpu.h>
@@ -86,6 +90,9 @@ void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no)
86 90
87void __init s3c2443_map_io(void) 91void __init s3c2443_map_io(void)
88{ 92{
93 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_s3c2443;
94 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_s3c2443;
95
89 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); 96 iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
90} 97}
91 98
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index 1c98d2ff2ed6..dd3782064508 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -127,7 +127,7 @@ int s3c64xx_sclk_ctrl(struct clk *clk, int enable)
127 return s3c64xx_gate(S3C_SCLK_GATE, clk, enable); 127 return s3c64xx_gate(S3C_SCLK_GATE, clk, enable);
128} 128}
129 129
130static struct clk init_clocks_disable[] = { 130static struct clk init_clocks_off[] = {
131 { 131 {
132 .name = "nand", 132 .name = "nand",
133 .id = -1, 133 .id = -1,
@@ -834,10 +834,6 @@ static struct clk *clks[] __initdata = {
834void __init s3c64xx_register_clocks(unsigned long xtal, 834void __init s3c64xx_register_clocks(unsigned long xtal,
835 unsigned armclk_divlimit) 835 unsigned armclk_divlimit)
836{ 836{
837 struct clk *clkp;
838 int ret;
839 int ptr;
840
841 armclk_mask = armclk_divlimit; 837 armclk_mask = armclk_divlimit;
842 838
843 s3c24xx_register_baseclocks(xtal); 839 s3c24xx_register_baseclocks(xtal);
@@ -845,17 +841,8 @@ void __init s3c64xx_register_clocks(unsigned long xtal,
845 841
846 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 842 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
847 843
848 clkp = init_clocks_disable; 844 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
849 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 845 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
850
851 ret = s3c24xx_register_clock(clkp);
852 if (ret < 0) {
853 printk(KERN_ERR "Failed to register clock %s (%d)\n",
854 clkp->name, ret);
855 }
856
857 (clkp->enable)(clkp, 0);
858 }
859 846
860 s3c24xx_register_clocks(clks1, ARRAY_SIZE(clks1)); 847 s3c24xx_register_clocks(clks1, ARRAY_SIZE(clks1));
861 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 848 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 372ea6855454..135db1b41252 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -212,6 +212,7 @@ static int s3c64xx_dma_start(struct s3c2410_dma_chan *chan)
212 212
213 config = readl(chan->regs + PL080S_CH_CONFIG); 213 config = readl(chan->regs + PL080S_CH_CONFIG);
214 config |= PL080_CONFIG_ENABLE; 214 config |= PL080_CONFIG_ENABLE;
215 config &= ~PL080_CONFIG_HALT;
215 216
216 pr_debug("%s: writing config %08x\n", __func__, config); 217 pr_debug("%s: writing config %08x\n", __func__, config);
217 writel(config, chan->regs + PL080S_CH_CONFIG); 218 writel(config, chan->regs + PL080S_CH_CONFIG);
diff --git a/arch/arm/mach-s3c64xx/irq-eint.c b/arch/arm/mach-s3c64xx/irq-eint.c
index 5682d6a7f4af..2ead8189da74 100644
--- a/arch/arm/mach-s3c64xx/irq-eint.c
+++ b/arch/arm/mach-s3c64xx/irq-eint.c
@@ -30,41 +30,41 @@
30#include <plat/pm.h> 30#include <plat/pm.h>
31 31
32#define eint_offset(irq) ((irq) - IRQ_EINT(0)) 32#define eint_offset(irq) ((irq) - IRQ_EINT(0))
33#define eint_irq_to_bit(irq) (1 << eint_offset(irq)) 33#define eint_irq_to_bit(irq) ((u32)(1 << eint_offset(irq)))
34 34
35static inline void s3c_irq_eint_mask(unsigned int irq) 35static inline void s3c_irq_eint_mask(struct irq_data *data)
36{ 36{
37 u32 mask; 37 u32 mask;
38 38
39 mask = __raw_readl(S3C64XX_EINT0MASK); 39 mask = __raw_readl(S3C64XX_EINT0MASK);
40 mask |= eint_irq_to_bit(irq); 40 mask |= (u32)data->chip_data;
41 __raw_writel(mask, S3C64XX_EINT0MASK); 41 __raw_writel(mask, S3C64XX_EINT0MASK);
42} 42}
43 43
44static void s3c_irq_eint_unmask(unsigned int irq) 44static void s3c_irq_eint_unmask(struct irq_data *data)
45{ 45{
46 u32 mask; 46 u32 mask;
47 47
48 mask = __raw_readl(S3C64XX_EINT0MASK); 48 mask = __raw_readl(S3C64XX_EINT0MASK);
49 mask &= ~eint_irq_to_bit(irq); 49 mask &= ~((u32)data->chip_data);
50 __raw_writel(mask, S3C64XX_EINT0MASK); 50 __raw_writel(mask, S3C64XX_EINT0MASK);
51} 51}
52 52
53static inline void s3c_irq_eint_ack(unsigned int irq) 53static inline void s3c_irq_eint_ack(struct irq_data *data)
54{ 54{
55 __raw_writel(eint_irq_to_bit(irq), S3C64XX_EINT0PEND); 55 __raw_writel((u32)data->chip_data, S3C64XX_EINT0PEND);
56} 56}
57 57
58static void s3c_irq_eint_maskack(unsigned int irq) 58static void s3c_irq_eint_maskack(struct irq_data *data)
59{ 59{
60 /* compiler should in-line these */ 60 /* compiler should in-line these */
61 s3c_irq_eint_mask(irq); 61 s3c_irq_eint_mask(data);
62 s3c_irq_eint_ack(irq); 62 s3c_irq_eint_ack(data);
63} 63}
64 64
65static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type) 65static int s3c_irq_eint_set_type(struct irq_data *data, unsigned int type)
66{ 66{
67 int offs = eint_offset(irq); 67 int offs = eint_offset(data->irq);
68 int pin, pin_val; 68 int pin, pin_val;
69 int shift; 69 int shift;
70 u32 ctrl, mask; 70 u32 ctrl, mask;
@@ -140,12 +140,12 @@ static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
140 140
141static struct irq_chip s3c_irq_eint = { 141static struct irq_chip s3c_irq_eint = {
142 .name = "s3c-eint", 142 .name = "s3c-eint",
143 .mask = s3c_irq_eint_mask, 143 .irq_mask = s3c_irq_eint_mask,
144 .unmask = s3c_irq_eint_unmask, 144 .irq_unmask = s3c_irq_eint_unmask,
145 .mask_ack = s3c_irq_eint_maskack, 145 .irq_mask_ack = s3c_irq_eint_maskack,
146 .ack = s3c_irq_eint_ack, 146 .irq_ack = s3c_irq_eint_ack,
147 .set_type = s3c_irq_eint_set_type, 147 .irq_set_type = s3c_irq_eint_set_type,
148 .set_wake = s3c_irqext_wake, 148 .irq_set_wake = s3c_irqext_wake,
149}; 149};
150 150
151/* s3c_irq_demux_eint 151/* s3c_irq_demux_eint
@@ -198,6 +198,7 @@ static int __init s3c64xx_init_irq_eint(void)
198 198
199 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) { 199 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
200 set_irq_chip(irq, &s3c_irq_eint); 200 set_irq_chip(irq, &s3c_irq_eint);
201 set_irq_chip_data(irq, (void *)eint_irq_to_bit(irq));
201 set_irq_handler(irq, handle_level_irq); 202 set_irq_handler(irq, handle_level_irq);
202 set_irq_flags(irq, IRQF_VALID); 203 set_irq_flags(irq, IRQF_VALID);
203 } 204 }
diff --git a/arch/arm/mach-s5p6442/clock.c b/arch/arm/mach-s5p6442/clock.c
index 16d6e7e61b50..fbbc7bede685 100644
--- a/arch/arm/mach-s5p6442/clock.c
+++ b/arch/arm/mach-s5p6442/clock.c
@@ -340,7 +340,7 @@ void __init_or_cpufreq s5p6442_setup_clocks(void)
340 clk_pclkd1.rate = pclkd1; 340 clk_pclkd1.rate = pclkd1;
341} 341}
342 342
343static struct clk init_clocks_disable[] = { 343static struct clk init_clocks_off[] = {
344 { 344 {
345 .name = "pdma", 345 .name = "pdma",
346 .id = -1, 346 .id = -1,
@@ -408,23 +408,13 @@ static struct clk *clks[] __initdata = {
408 408
409void __init s5p6442_register_clocks(void) 409void __init s5p6442_register_clocks(void)
410{ 410{
411 struct clk *clkptr;
412 int i, ret;
413
414 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 411 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
415 412
416 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 413 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
417 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 414 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
418 415
419 clkptr = init_clocks_disable; 416 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
420 for (i = 0; i < ARRAY_SIZE(init_clocks_disable); i++, clkptr++) { 417 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
421 ret = s3c24xx_register_clock(clkptr);
422 if (ret < 0) {
423 printk(KERN_ERR "Fail to register clock %s (%d)\n",
424 clkptr->name, ret);
425 } else
426 (clkptr->enable)(clkptr, 0);
427 }
428 418
429 s3c_pwmclk_init(); 419 s3c_pwmclk_init();
430} 420}
diff --git a/arch/arm/mach-s5p6442/include/mach/map.h b/arch/arm/mach-s5p6442/include/mach/map.h
index 31fb2e68d527..203dd5a18bd5 100644
--- a/arch/arm/mach-s5p6442/include/mach/map.h
+++ b/arch/arm/mach-s5p6442/include/mach/map.h
@@ -28,6 +28,9 @@
28#define S5P6442_PA_VIC1 (0xE4100000) 28#define S5P6442_PA_VIC1 (0xE4100000)
29#define S5P6442_PA_VIC2 (0xE4200000) 29#define S5P6442_PA_VIC2 (0xE4200000)
30 30
31#define S5P6442_PA_SROMC (0xE7000000)
32#define S5P_PA_SROMC S5P6442_PA_SROMC
33
31#define S5P6442_PA_MDMA 0xE8000000 34#define S5P6442_PA_MDMA 0xE8000000
32#define S5P6442_PA_PDMA 0xE9000000 35#define S5P6442_PA_PDMA 0xE9000000
33 36
diff --git a/arch/arm/mach-s5p6442/mach-smdk6442.c b/arch/arm/mach-s5p6442/mach-smdk6442.c
index 819fd80d00af..e69f137b0a39 100644
--- a/arch/arm/mach-s5p6442/mach-smdk6442.c
+++ b/arch/arm/mach-s5p6442/mach-smdk6442.c
@@ -12,6 +12,7 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/serial_core.h> 14#include <linux/serial_core.h>
15#include <linux/i2c.h>
15 16
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
@@ -25,6 +26,7 @@
25#include <plat/s5p6442.h> 26#include <plat/s5p6442.h>
26#include <plat/devs.h> 27#include <plat/devs.h>
27#include <plat/cpu.h> 28#include <plat/cpu.h>
29#include <plat/iic.h>
28 30
29/* Following are default values for UCON, ULCON and UFCON UART registers */ 31/* Following are default values for UCON, ULCON and UFCON UART registers */
30#define SMDK6442_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 32#define SMDK6442_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -65,10 +67,15 @@ static struct s3c2410_uartcfg smdk6442_uartcfgs[] __initdata = {
65}; 67};
66 68
67static struct platform_device *smdk6442_devices[] __initdata = { 69static struct platform_device *smdk6442_devices[] __initdata = {
70 &s3c_device_i2c0,
68 &s5p6442_device_iis0, 71 &s5p6442_device_iis0,
69 &s3c_device_wdt, 72 &s3c_device_wdt,
70}; 73};
71 74
75static struct i2c_board_info smdk6442_i2c_devs0[] __initdata = {
76 { I2C_BOARD_INFO("wm8580", 0x1b), },
77};
78
72static void __init smdk6442_map_io(void) 79static void __init smdk6442_map_io(void)
73{ 80{
74 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 81 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -78,6 +85,9 @@ static void __init smdk6442_map_io(void)
78 85
79static void __init smdk6442_machine_init(void) 86static void __init smdk6442_machine_init(void)
80{ 87{
88 s3c_i2c0_set_platdata(NULL);
89 i2c_register_board_info(0, smdk6442_i2c_devs0,
90 ARRAY_SIZE(smdk6442_i2c_devs0));
81 platform_add_devices(smdk6442_devices, ARRAY_SIZE(smdk6442_devices)); 91 platform_add_devices(smdk6442_devices, ARRAY_SIZE(smdk6442_devices));
82} 92}
83 93
diff --git a/arch/arm/mach-s5p6442/setup-i2c0.c b/arch/arm/mach-s5p6442/setup-i2c0.c
index 662695dd7761..aad85656b0cc 100644
--- a/arch/arm/mach-s5p6442/setup-i2c0.c
+++ b/arch/arm/mach-s5p6442/setup-i2c0.c
@@ -14,12 +14,15 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
17 18
18struct platform_device; /* don't need the contents */ 19struct platform_device; /* don't need the contents */
19 20
21#include <plat/gpio-cfg.h>
20#include <plat/iic.h> 22#include <plat/iic.h>
21 23
22void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
23{ 25{
24 /* Will be populated later */ 26 s3c_gpio_cfgall_range(S5P6442_GPD1(0), 2,
27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
25} 28}
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index 2655829e6bf8..ae6bf6feba89 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -12,9 +12,9 @@ obj- :=
12 12
13# Core support for S5P64X0 system 13# Core support for S5P64X0 system
14 14
15obj-$(CONFIG_ARCH_S5P64X0) += cpu.o init.o clock.o dma.o 15obj-$(CONFIG_ARCH_S5P64X0) += cpu.o init.o clock.o dma.o gpiolib.o
16obj-$(CONFIG_ARCH_S5P64X0) += setup-i2c0.o 16obj-$(CONFIG_ARCH_S5P64X0) += setup-i2c0.o
17obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o gpio.o 17obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o
18obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o 18obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o
19 19
20# machine support 20# machine support
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index 409c5fc3670d..9f12c2ebf416 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -133,7 +133,7 @@ static struct clksrc_clk clk_pclk_low = {
133 * recommended to keep the following clocks disabled until the driver requests 133 * recommended to keep the following clocks disabled until the driver requests
134 * for enabling the clock. 134 * for enabling the clock.
135 */ 135 */
136static struct clk init_clocks_disable[] = { 136static struct clk init_clocks_off[] = {
137 { 137 {
138 .name = "nand", 138 .name = "nand",
139 .id = -1, 139 .id = -1,
@@ -419,7 +419,7 @@ static struct clksrc_sources clkset_audio = {
419static struct clksrc_clk clksrcs[] = { 419static struct clksrc_clk clksrcs[] = {
420 { 420 {
421 .clk = { 421 .clk = {
422 .name = "mmc_bus", 422 .name = "sclk_mmc",
423 .id = 0, 423 .id = 0,
424 .ctrlbit = (1 << 24), 424 .ctrlbit = (1 << 24),
425 .enable = s5p64x0_sclk_ctrl, 425 .enable = s5p64x0_sclk_ctrl,
@@ -429,7 +429,7 @@ static struct clksrc_clk clksrcs[] = {
429 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 }, 429 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 0, .size = 4 },
430 }, { 430 }, {
431 .clk = { 431 .clk = {
432 .name = "mmc_bus", 432 .name = "sclk_mmc",
433 .id = 1, 433 .id = 1,
434 .ctrlbit = (1 << 25), 434 .ctrlbit = (1 << 25),
435 .enable = s5p64x0_sclk_ctrl, 435 .enable = s5p64x0_sclk_ctrl,
@@ -439,7 +439,7 @@ static struct clksrc_clk clksrcs[] = {
439 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 }, 439 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 4, .size = 4 },
440 }, { 440 }, {
441 .clk = { 441 .clk = {
442 .name = "mmc_bus", 442 .name = "sclk_mmc",
443 .id = 2, 443 .id = 2,
444 .ctrlbit = (1 << 26), 444 .ctrlbit = (1 << 26),
445 .enable = s5p64x0_sclk_ctrl, 445 .enable = s5p64x0_sclk_ctrl,
@@ -602,8 +602,6 @@ static struct clk *clks[] __initdata = {
602 602
603void __init s5p6440_register_clocks(void) 603void __init s5p6440_register_clocks(void)
604{ 604{
605 struct clk *clkp;
606 int ret;
607 int ptr; 605 int ptr;
608 606
609 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 607 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
@@ -614,16 +612,8 @@ void __init s5p6440_register_clocks(void)
614 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 612 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
615 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 613 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
616 614
617 clkp = init_clocks_disable; 615 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
618 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 616 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
619
620 ret = s3c24xx_register_clock(clkp);
621 if (ret < 0) {
622 printk(KERN_ERR "Failed to register clock %s (%d)\n",
623 clkp->name, ret);
624 }
625 (clkp->enable)(clkp, 0);
626 }
627 617
628 s3c_pwmclk_init(); 618 s3c_pwmclk_init();
629} 619}
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index 7fc6abd35914..4eec457ddccc 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -181,7 +181,7 @@ static struct clksrc_clk clk_pclk_low = {
181 * recommended to keep the following clocks disabled until the driver requests 181 * recommended to keep the following clocks disabled until the driver requests
182 * for enabling the clock. 182 * for enabling the clock.
183 */ 183 */
184static struct clk init_clocks_disable[] = { 184static struct clk init_clocks_off[] = {
185 { 185 {
186 .name = "usbhost", 186 .name = "usbhost",
187 .id = -1, 187 .id = -1,
@@ -231,6 +231,12 @@ static struct clk init_clocks_disable[] = {
231 .enable = s5p64x0_pclk_ctrl, 231 .enable = s5p64x0_pclk_ctrl,
232 .ctrlbit = (1 << 5), 232 .ctrlbit = (1 << 5),
233 }, { 233 }, {
234 .name = "rtc",
235 .id = -1,
236 .parent = &clk_pclk_low.clk,
237 .enable = s5p64x0_pclk_ctrl,
238 .ctrlbit = (1 << 6),
239 }, {
234 .name = "adc", 240 .name = "adc",
235 .id = -1, 241 .id = -1,
236 .parent = &clk_pclk_low.clk, 242 .parent = &clk_pclk_low.clk,
@@ -261,6 +267,18 @@ static struct clk init_clocks_disable[] = {
261 .enable = s5p64x0_pclk_ctrl, 267 .enable = s5p64x0_pclk_ctrl,
262 .ctrlbit = (1 << 26), 268 .ctrlbit = (1 << 26),
263 }, { 269 }, {
270 .name = "iis",
271 .id = 1,
272 .parent = &clk_pclk_low.clk,
273 .enable = s5p64x0_pclk_ctrl,
274 .ctrlbit = (1 << 15),
275 }, {
276 .name = "iis",
277 .id = 2,
278 .parent = &clk_pclk_low.clk,
279 .enable = s5p64x0_pclk_ctrl,
280 .ctrlbit = (1 << 16),
281 }, {
264 .name = "i2c", 282 .name = "i2c",
265 .id = 1, 283 .id = 1,
266 .parent = &clk_pclk_low.clk, 284 .parent = &clk_pclk_low.clk,
@@ -633,8 +651,6 @@ void __init_or_cpufreq s5p6450_setup_clocks(void)
633 651
634void __init s5p6450_register_clocks(void) 652void __init s5p6450_register_clocks(void)
635{ 653{
636 struct clk *clkp;
637 int ret;
638 int ptr; 654 int ptr;
639 655
640 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 656 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
@@ -643,16 +659,8 @@ void __init s5p6450_register_clocks(void)
643 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 659 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
644 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 660 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
645 661
646 clkp = init_clocks_disable; 662 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
647 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 663 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
648
649 ret = s3c24xx_register_clock(clkp);
650 if (ret < 0) {
651 printk(KERN_ERR "Failed to register clock %s (%d)\n",
652 clkp->name, ret);
653 }
654 (clkp->enable)(clkp, 0);
655 }
656 664
657 s3c_pwmclk_init(); 665 s3c_pwmclk_init();
658} 666}
diff --git a/arch/arm/mach-s5p64x0/dev-audio.c b/arch/arm/mach-s5p64x0/dev-audio.c
index 14f89e73b8de..35f1f226dabb 100644
--- a/arch/arm/mach-s5p64x0/dev-audio.c
+++ b/arch/arm/mach-s5p64x0/dev-audio.c
@@ -24,13 +24,13 @@ static const char *rclksrc[] = {
24 [1] = "sclk_audio2", 24 [1] = "sclk_audio2",
25}; 25};
26 26
27static int s5p64x0_cfg_i2s(struct platform_device *pdev) 27static int s5p6440_cfg_i2s(struct platform_device *pdev)
28{ 28{
29 /* configure GPIO for i2s port */
30 switch (pdev->id) { 29 switch (pdev->id) {
31 case 0: 30 case 0:
32 s3c_gpio_cfgpin_range(S5P6440_GPR(4), 5, S3C_GPIO_SFN(5)); 31 s3c_gpio_cfgpin_range(S5P6440_GPC(4), 2, S3C_GPIO_SFN(5));
33 s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(5)); 32 s3c_gpio_cfgpin(S5P6440_GPC(7), S3C_GPIO_SFN(5));
33 s3c_gpio_cfgpin_range(S5P6440_GPH(6), 4, S3C_GPIO_SFN(5));
34 break; 34 break;
35 default: 35 default:
36 printk(KERN_ERR "Invalid Device %d\n", pdev->id); 36 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
@@ -40,8 +40,8 @@ static int s5p64x0_cfg_i2s(struct platform_device *pdev)
40 return 0; 40 return 0;
41} 41}
42 42
43static struct s3c_audio_pdata s5p64x0_i2s_pdata = { 43static struct s3c_audio_pdata s5p6440_i2s_pdata = {
44 .cfg_gpio = s5p64x0_cfg_i2s, 44 .cfg_gpio = s5p6440_cfg_i2s,
45 .type = { 45 .type = {
46 .i2s = { 46 .i2s = {
47 .quirks = QUIRK_PRI_6CHAN, 47 .quirks = QUIRK_PRI_6CHAN,
@@ -50,7 +50,7 @@ static struct s3c_audio_pdata s5p64x0_i2s_pdata = {
50 }, 50 },
51}; 51};
52 52
53static struct resource s5p64x0_iis0_resource[] = { 53static struct resource s5p64x0_i2s0_resource[] = {
54 [0] = { 54 [0] = {
55 .start = S5P64X0_PA_I2S, 55 .start = S5P64X0_PA_I2S,
56 .end = S5P64X0_PA_I2S + 0x100 - 1, 56 .end = S5P64X0_PA_I2S + 0x100 - 1,
@@ -71,20 +71,117 @@ static struct resource s5p64x0_iis0_resource[] = {
71struct platform_device s5p6440_device_iis = { 71struct platform_device s5p6440_device_iis = {
72 .name = "samsung-i2s", 72 .name = "samsung-i2s",
73 .id = 0, 73 .id = 0,
74 .num_resources = ARRAY_SIZE(s5p64x0_iis0_resource), 74 .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource),
75 .resource = s5p64x0_iis0_resource, 75 .resource = s5p64x0_i2s0_resource,
76 .dev = { 76 .dev = {
77 .platform_data = &s5p64x0_i2s_pdata, 77 .platform_data = &s5p6440_i2s_pdata,
78 },
79};
80
81static int s5p6450_cfg_i2s(struct platform_device *pdev)
82{
83 switch (pdev->id) {
84 case 0:
85 s3c_gpio_cfgpin_range(S5P6450_GPR(4), 5, S3C_GPIO_SFN(5));
86 s3c_gpio_cfgpin_range(S5P6450_GPR(13), 2, S3C_GPIO_SFN(5));
87 break;
88 case 1:
89 s3c_gpio_cfgpin(S5P6440_GPB(4), S3C_GPIO_SFN(5));
90 s3c_gpio_cfgpin_range(S5P6450_GPC(0), 4, S3C_GPIO_SFN(5));
91 break;
92 case 2:
93 s3c_gpio_cfgpin_range(S5P6450_GPK(0), 5, S3C_GPIO_SFN(5));
94 break;
95 default:
96 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
97 return -EINVAL;
98 }
99
100 return 0;
101}
102
103static struct s3c_audio_pdata s5p6450_i2s0_pdata = {
104 .cfg_gpio = s5p6450_cfg_i2s,
105 .type = {
106 .i2s = {
107 .quirks = QUIRK_PRI_6CHAN,
108 .src_clk = rclksrc,
109 },
78 }, 110 },
79}; 111};
80 112
81struct platform_device s5p6450_device_iis0 = { 113struct platform_device s5p6450_device_iis0 = {
82 .name = "samsung-i2s", 114 .name = "samsung-i2s",
83 .id = 0, 115 .id = 0,
84 .num_resources = ARRAY_SIZE(s5p64x0_iis0_resource), 116 .num_resources = ARRAY_SIZE(s5p64x0_i2s0_resource),
85 .resource = s5p64x0_iis0_resource, 117 .resource = s5p64x0_i2s0_resource,
118 .dev = {
119 .platform_data = &s5p6450_i2s0_pdata,
120 },
121};
122
123static struct s3c_audio_pdata s5p6450_i2s_pdata = {
124 .cfg_gpio = s5p6450_cfg_i2s,
125 .type = {
126 .i2s = {
127 .src_clk = rclksrc,
128 },
129 },
130};
131
132static struct resource s5p6450_i2s1_resource[] = {
133 [0] = {
134 .start = S5P6450_PA_I2S1,
135 .end = S5P6450_PA_I2S1 + 0x100 - 1,
136 .flags = IORESOURCE_MEM,
137 },
138 [1] = {
139 .start = DMACH_I2S1_TX,
140 .end = DMACH_I2S1_TX,
141 .flags = IORESOURCE_DMA,
142 },
143 [2] = {
144 .start = DMACH_I2S1_RX,
145 .end = DMACH_I2S1_RX,
146 .flags = IORESOURCE_DMA,
147 },
148};
149
150struct platform_device s5p6450_device_iis1 = {
151 .name = "samsung-i2s",
152 .id = 1,
153 .num_resources = ARRAY_SIZE(s5p6450_i2s1_resource),
154 .resource = s5p6450_i2s1_resource,
155 .dev = {
156 .platform_data = &s5p6450_i2s_pdata,
157 },
158};
159
160static struct resource s5p6450_i2s2_resource[] = {
161 [0] = {
162 .start = S5P6450_PA_I2S2,
163 .end = S5P6450_PA_I2S2 + 0x100 - 1,
164 .flags = IORESOURCE_MEM,
165 },
166 [1] = {
167 .start = DMACH_I2S2_TX,
168 .end = DMACH_I2S2_TX,
169 .flags = IORESOURCE_DMA,
170 },
171 [2] = {
172 .start = DMACH_I2S2_RX,
173 .end = DMACH_I2S2_RX,
174 .flags = IORESOURCE_DMA,
175 },
176};
177
178struct platform_device s5p6450_device_iis2 = {
179 .name = "samsung-i2s",
180 .id = 2,
181 .num_resources = ARRAY_SIZE(s5p6450_i2s2_resource),
182 .resource = s5p6450_i2s2_resource,
86 .dev = { 183 .dev = {
87 .platform_data = &s5p64x0_i2s_pdata, 184 .platform_data = &s5p6450_i2s_pdata,
88 }, 185 },
89}; 186};
90 187
diff --git a/arch/arm/mach-s5p64x0/gpio.c b/arch/arm/mach-s5p64x0/gpiolib.c
index 39159dd5a29a..e7fb3b004e77 100644
--- a/arch/arm/mach-s5p64x0/gpio.c
+++ b/arch/arm/mach-s5p64x0/gpiolib.c
@@ -1,4 +1,4 @@
1/* linux/arch/arm/mach-s5p64x0/gpio.c 1/* linux/arch/arm/mach-s5p64x0/gpiolib.c
2 * 2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 4 * http://www.samsung.com
@@ -17,13 +17,12 @@
17 17
18#include <mach/map.h> 18#include <mach/map.h>
19#include <mach/regs-gpio.h> 19#include <mach/regs-gpio.h>
20#include <mach/regs-clock.h>
20 21
21#include <plat/gpio-core.h> 22#include <plat/gpio-core.h>
22#include <plat/gpio-cfg.h> 23#include <plat/gpio-cfg.h>
23#include <plat/gpio-cfg-helpers.h> 24#include <plat/gpio-cfg-helpers.h>
24 25
25/* To be implemented S5P6450 GPIO */
26
27/* 26/*
28 * S5P6440 GPIO bank summary: 27 * S5P6440 GPIO bank summary:
29 * 28 *
@@ -40,6 +39,25 @@
40 * P 8 2Bit Yes 8 39 * P 8 2Bit Yes 8
41 * R 15 4Bit[2] Yes 8 40 * R 15 4Bit[2] Yes 8
42 * 41 *
42 * S5P6450 GPIO bank summary:
43 *
44 * Bank GPIOs Style SlpCon ExtInt Group
45 * A 6 4Bit Yes 1
46 * B 7 4Bit Yes 1
47 * C 8 4Bit Yes 2
48 * D 8 4Bit Yes None
49 * F 2 2Bit Yes None
50 * G 14 4Bit[2] Yes 5
51 * H 10 4Bit[2] Yes 6
52 * I 16 2Bit Yes None
53 * J 12 2Bit Yes None
54 * K 5 4Bit Yes None
55 * N 16 2Bit No IRQ_EINT
56 * P 11 2Bit Yes 8
57 * Q 14 2Bit Yes None
58 * R 15 4Bit[2] Yes None
59 * S 8 2Bit Yes None
60 *
43 * [1] BANKF pins 14,15 do not form part of the external interrupt sources 61 * [1] BANKF pins 14,15 do not form part of the external interrupt sources
44 * [2] BANK has two control registers, GPxCON0 and GPxCON1 62 * [2] BANK has two control registers, GPxCON0 and GPxCON1
45 */ 63 */
@@ -190,7 +208,7 @@ static struct s3c_gpio_cfg s5p64x0_gpio_cfgs[] = {
190 208
191static struct s3c_gpio_chip s5p6440_gpio_4bit[] = { 209static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
192 { 210 {
193 .base = S5P6440_GPA_BASE, 211 .base = S5P64X0_GPA_BASE,
194 .config = &s5p64x0_gpio_cfgs[1], 212 .config = &s5p64x0_gpio_cfgs[1],
195 .chip = { 213 .chip = {
196 .base = S5P6440_GPA(0), 214 .base = S5P6440_GPA(0),
@@ -198,7 +216,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
198 .label = "GPA", 216 .label = "GPA",
199 }, 217 },
200 }, { 218 }, {
201 .base = S5P6440_GPB_BASE, 219 .base = S5P64X0_GPB_BASE,
202 .config = &s5p64x0_gpio_cfgs[1], 220 .config = &s5p64x0_gpio_cfgs[1],
203 .chip = { 221 .chip = {
204 .base = S5P6440_GPB(0), 222 .base = S5P6440_GPB(0),
@@ -206,7 +224,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
206 .label = "GPB", 224 .label = "GPB",
207 }, 225 },
208 }, { 226 }, {
209 .base = S5P6440_GPC_BASE, 227 .base = S5P64X0_GPC_BASE,
210 .config = &s5p64x0_gpio_cfgs[1], 228 .config = &s5p64x0_gpio_cfgs[1],
211 .chip = { 229 .chip = {
212 .base = S5P6440_GPC(0), 230 .base = S5P6440_GPC(0),
@@ -214,7 +232,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
214 .label = "GPC", 232 .label = "GPC",
215 }, 233 },
216 }, { 234 }, {
217 .base = S5P6440_GPG_BASE, 235 .base = S5P64X0_GPG_BASE,
218 .config = &s5p64x0_gpio_cfgs[1], 236 .config = &s5p64x0_gpio_cfgs[1],
219 .chip = { 237 .chip = {
220 .base = S5P6440_GPG(0), 238 .base = S5P6440_GPG(0),
@@ -226,7 +244,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit[] = {
226 244
227static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = { 245static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = {
228 { 246 {
229 .base = S5P6440_GPH_BASE + 0x4, 247 .base = S5P64X0_GPH_BASE + 0x4,
230 .config = &s5p64x0_gpio_cfgs[1], 248 .config = &s5p64x0_gpio_cfgs[1],
231 .chip = { 249 .chip = {
232 .base = S5P6440_GPH(0), 250 .base = S5P6440_GPH(0),
@@ -238,7 +256,7 @@ static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = {
238 256
239static struct s3c_gpio_chip s5p6440_gpio_rbank_4bit2[] = { 257static struct s3c_gpio_chip s5p6440_gpio_rbank_4bit2[] = {
240 { 258 {
241 .base = S5P6440_GPR_BASE + 0x4, 259 .base = S5P64X0_GPR_BASE + 0x4,
242 .config = &s5p64x0_gpio_cfgs[2], 260 .config = &s5p64x0_gpio_cfgs[2],
243 .chip = { 261 .chip = {
244 .base = S5P6440_GPR(0), 262 .base = S5P6440_GPR(0),
@@ -250,7 +268,7 @@ static struct s3c_gpio_chip s5p6440_gpio_rbank_4bit2[] = {
250 268
251static struct s3c_gpio_chip s5p6440_gpio_2bit[] = { 269static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
252 { 270 {
253 .base = S5P6440_GPF_BASE, 271 .base = S5P64X0_GPF_BASE,
254 .config = &s5p64x0_gpio_cfgs[5], 272 .config = &s5p64x0_gpio_cfgs[5],
255 .chip = { 273 .chip = {
256 .base = S5P6440_GPF(0), 274 .base = S5P6440_GPF(0),
@@ -258,7 +276,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
258 .label = "GPF", 276 .label = "GPF",
259 }, 277 },
260 }, { 278 }, {
261 .base = S5P6440_GPI_BASE, 279 .base = S5P64X0_GPI_BASE,
262 .config = &s5p64x0_gpio_cfgs[3], 280 .config = &s5p64x0_gpio_cfgs[3],
263 .chip = { 281 .chip = {
264 .base = S5P6440_GPI(0), 282 .base = S5P6440_GPI(0),
@@ -266,7 +284,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
266 .label = "GPI", 284 .label = "GPI",
267 }, 285 },
268 }, { 286 }, {
269 .base = S5P6440_GPJ_BASE, 287 .base = S5P64X0_GPJ_BASE,
270 .config = &s5p64x0_gpio_cfgs[3], 288 .config = &s5p64x0_gpio_cfgs[3],
271 .chip = { 289 .chip = {
272 .base = S5P6440_GPJ(0), 290 .base = S5P6440_GPJ(0),
@@ -274,7 +292,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
274 .label = "GPJ", 292 .label = "GPJ",
275 }, 293 },
276 }, { 294 }, {
277 .base = S5P6440_GPN_BASE, 295 .base = S5P64X0_GPN_BASE,
278 .config = &s5p64x0_gpio_cfgs[4], 296 .config = &s5p64x0_gpio_cfgs[4],
279 .chip = { 297 .chip = {
280 .base = S5P6440_GPN(0), 298 .base = S5P6440_GPN(0),
@@ -282,7 +300,7 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
282 .label = "GPN", 300 .label = "GPN",
283 }, 301 },
284 }, { 302 }, {
285 .base = S5P6440_GPP_BASE, 303 .base = S5P64X0_GPP_BASE,
286 .config = &s5p64x0_gpio_cfgs[5], 304 .config = &s5p64x0_gpio_cfgs[5],
287 .chip = { 305 .chip = {
288 .base = S5P6440_GPP(0), 306 .base = S5P6440_GPP(0),
@@ -292,6 +310,142 @@ static struct s3c_gpio_chip s5p6440_gpio_2bit[] = {
292 }, 310 },
293}; 311};
294 312
313static struct s3c_gpio_chip s5p6450_gpio_4bit[] = {
314 {
315 .base = S5P64X0_GPA_BASE,
316 .config = &s5p64x0_gpio_cfgs[1],
317 .chip = {
318 .base = S5P6450_GPA(0),
319 .ngpio = S5P6450_GPIO_A_NR,
320 .label = "GPA",
321 },
322 }, {
323 .base = S5P64X0_GPB_BASE,
324 .config = &s5p64x0_gpio_cfgs[1],
325 .chip = {
326 .base = S5P6450_GPB(0),
327 .ngpio = S5P6450_GPIO_B_NR,
328 .label = "GPB",
329 },
330 }, {
331 .base = S5P64X0_GPC_BASE,
332 .config = &s5p64x0_gpio_cfgs[1],
333 .chip = {
334 .base = S5P6450_GPC(0),
335 .ngpio = S5P6450_GPIO_C_NR,
336 .label = "GPC",
337 },
338 }, {
339 .base = S5P6450_GPD_BASE,
340 .config = &s5p64x0_gpio_cfgs[1],
341 .chip = {
342 .base = S5P6450_GPD(0),
343 .ngpio = S5P6450_GPIO_D_NR,
344 .label = "GPD",
345 },
346 }, {
347 .base = S5P6450_GPK_BASE,
348 .config = &s5p64x0_gpio_cfgs[1],
349 .chip = {
350 .base = S5P6450_GPK(0),
351 .ngpio = S5P6450_GPIO_K_NR,
352 .label = "GPK",
353 },
354 },
355};
356
357static struct s3c_gpio_chip s5p6450_gpio_4bit2[] = {
358 {
359 .base = S5P64X0_GPG_BASE + 0x4,
360 .config = &s5p64x0_gpio_cfgs[1],
361 .chip = {
362 .base = S5P6450_GPG(0),
363 .ngpio = S5P6450_GPIO_G_NR,
364 .label = "GPG",
365 },
366 }, {
367 .base = S5P64X0_GPH_BASE + 0x4,
368 .config = &s5p64x0_gpio_cfgs[1],
369 .chip = {
370 .base = S5P6450_GPH(0),
371 .ngpio = S5P6450_GPIO_H_NR,
372 .label = "GPH",
373 },
374 },
375};
376
377static struct s3c_gpio_chip s5p6450_gpio_rbank_4bit2[] = {
378 {
379 .base = S5P64X0_GPR_BASE + 0x4,
380 .config = &s5p64x0_gpio_cfgs[2],
381 .chip = {
382 .base = S5P6450_GPR(0),
383 .ngpio = S5P6450_GPIO_R_NR,
384 .label = "GPR",
385 },
386 },
387};
388
389static struct s3c_gpio_chip s5p6450_gpio_2bit[] = {
390 {
391 .base = S5P64X0_GPF_BASE,
392 .config = &s5p64x0_gpio_cfgs[5],
393 .chip = {
394 .base = S5P6450_GPF(0),
395 .ngpio = S5P6450_GPIO_F_NR,
396 .label = "GPF",
397 },
398 }, {
399 .base = S5P64X0_GPI_BASE,
400 .config = &s5p64x0_gpio_cfgs[3],
401 .chip = {
402 .base = S5P6450_GPI(0),
403 .ngpio = S5P6450_GPIO_I_NR,
404 .label = "GPI",
405 },
406 }, {
407 .base = S5P64X0_GPJ_BASE,
408 .config = &s5p64x0_gpio_cfgs[3],
409 .chip = {
410 .base = S5P6450_GPJ(0),
411 .ngpio = S5P6450_GPIO_J_NR,
412 .label = "GPJ",
413 },
414 }, {
415 .base = S5P64X0_GPN_BASE,
416 .config = &s5p64x0_gpio_cfgs[4],
417 .chip = {
418 .base = S5P6450_GPN(0),
419 .ngpio = S5P6450_GPIO_N_NR,
420 .label = "GPN",
421 },
422 }, {
423 .base = S5P64X0_GPP_BASE,
424 .config = &s5p64x0_gpio_cfgs[5],
425 .chip = {
426 .base = S5P6450_GPP(0),
427 .ngpio = S5P6450_GPIO_P_NR,
428 .label = "GPP",
429 },
430 }, {
431 .base = S5P6450_GPQ_BASE,
432 .config = &s5p64x0_gpio_cfgs[4],
433 .chip = {
434 .base = S5P6450_GPQ(0),
435 .ngpio = S5P6450_GPIO_Q_NR,
436 .label = "GPQ",
437 },
438 }, {
439 .base = S5P6450_GPS_BASE,
440 .config = &s5p64x0_gpio_cfgs[5],
441 .chip = {
442 .base = S5P6450_GPS(0),
443 .ngpio = S5P6450_GPIO_S_NR,
444 .label = "GPS",
445 },
446 },
447};
448
295void __init s5p64x0_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips) 449void __init s5p64x0_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips)
296{ 450{
297 for (; nr_chips > 0; nr_chips--, chipcfg++) { 451 for (; nr_chips > 0; nr_chips--, chipcfg++) {
@@ -317,26 +471,41 @@ static void __init s5p64x0_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip,
317 } 471 }
318} 472}
319 473
320static int __init s5p6440_gpiolib_init(void) 474static int __init s5p64x0_gpiolib_init(void)
321{ 475{
322 struct s3c_gpio_chip *chips = s5p6440_gpio_2bit; 476 unsigned int chipid;
323 int nr_chips = ARRAY_SIZE(s5p6440_gpio_2bit); 477
478 chipid = __raw_readl(S5P64X0_SYS_ID);
324 479
325 s5p64x0_gpiolib_set_cfg(s5p64x0_gpio_cfgs, 480 s5p64x0_gpiolib_set_cfg(s5p64x0_gpio_cfgs,
326 ARRAY_SIZE(s5p64x0_gpio_cfgs)); 481 ARRAY_SIZE(s5p64x0_gpio_cfgs));
327 482
328 for (; nr_chips > 0; nr_chips--, chips++) 483 if ((chipid & 0xff000) == 0x50000) {
329 s3c_gpiolib_add(chips); 484 samsung_gpiolib_add_2bit_chips(s5p6450_gpio_2bit,
485 ARRAY_SIZE(s5p6450_gpio_2bit));
486
487 samsung_gpiolib_add_4bit_chips(s5p6450_gpio_4bit,
488 ARRAY_SIZE(s5p6450_gpio_4bit));
330 489
331 samsung_gpiolib_add_4bit_chips(s5p6440_gpio_4bit, 490 samsung_gpiolib_add_4bit2_chips(s5p6450_gpio_4bit2,
332 ARRAY_SIZE(s5p6440_gpio_4bit)); 491 ARRAY_SIZE(s5p6450_gpio_4bit2));
333 492
334 samsung_gpiolib_add_4bit2_chips(s5p6440_gpio_4bit2, 493 s5p64x0_gpio_add_rbank_4bit2(s5p6450_gpio_rbank_4bit2,
335 ARRAY_SIZE(s5p6440_gpio_4bit2)); 494 ARRAY_SIZE(s5p6450_gpio_rbank_4bit2));
495 } else {
496 samsung_gpiolib_add_2bit_chips(s5p6440_gpio_2bit,
497 ARRAY_SIZE(s5p6440_gpio_2bit));
336 498
337 s5p64x0_gpio_add_rbank_4bit2(s5p6440_gpio_rbank_4bit2, 499 samsung_gpiolib_add_4bit_chips(s5p6440_gpio_4bit,
338 ARRAY_SIZE(s5p6440_gpio_rbank_4bit2)); 500 ARRAY_SIZE(s5p6440_gpio_4bit));
501
502 samsung_gpiolib_add_4bit2_chips(s5p6440_gpio_4bit2,
503 ARRAY_SIZE(s5p6440_gpio_4bit2));
504
505 s5p64x0_gpio_add_rbank_4bit2(s5p6440_gpio_rbank_4bit2,
506 ARRAY_SIZE(s5p6440_gpio_rbank_4bit2));
507 }
339 508
340 return 0; 509 return 0;
341} 510}
342arch_initcall(s5p6440_gpiolib_init); 511core_initcall(s5p64x0_gpiolib_init);
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
index 31e534156e06..a9365e5ba614 100644
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ b/arch/arm/mach-s5p64x0/include/mach/map.h
@@ -29,6 +29,9 @@
29#define S5P64X0_PA_VIC0 (0xE4000000) 29#define S5P64X0_PA_VIC0 (0xE4000000)
30#define S5P64X0_PA_VIC1 (0xE4100000) 30#define S5P64X0_PA_VIC1 (0xE4100000)
31 31
32#define S5P64X0_PA_SROMC (0xE7000000)
33#define S5P_PA_SROMC S5P64X0_PA_SROMC
34
32#define S5P64X0_PA_PDMA (0xE9000000) 35#define S5P64X0_PA_PDMA (0xE9000000)
33 36
34#define S5P64X0_PA_TIMER (0xEA000000) 37#define S5P64X0_PA_TIMER (0xEA000000)
@@ -63,6 +66,8 @@
63#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) 66#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
64 67
65#define S5P64X0_PA_I2S (0xF2000000) 68#define S5P64X0_PA_I2S (0xF2000000)
69#define S5P6450_PA_I2S1 0xF2800000
70#define S5P6450_PA_I2S2 0xF2900000
66 71
67#define S5P64X0_PA_PCM (0xF2100000) 72#define S5P64X0_PA_PCM (0xF2100000)
68 73
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
index 85f448e20a8b..0953ef6b1c77 100644
--- a/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s5p64x0/include/mach/regs-gpio.h
@@ -15,48 +15,23 @@
15 15
16#include <mach/map.h> 16#include <mach/map.h>
17 17
18/* Will be implemented S5P6442 GPIOlib */
19
20/* Base addresses for each of the banks */ 18/* Base addresses for each of the banks */
21 19
22#define S5P6440_GPA_BASE (S5P_VA_GPIO + 0x0000) 20#define S5P64X0_GPA_BASE (S5P_VA_GPIO + 0x0000)
23#define S5P6440_GPB_BASE (S5P_VA_GPIO + 0x0020) 21#define S5P64X0_GPB_BASE (S5P_VA_GPIO + 0x0020)
24#define S5P6440_GPC_BASE (S5P_VA_GPIO + 0x0040) 22#define S5P64X0_GPC_BASE (S5P_VA_GPIO + 0x0040)
25#define S5P6440_GPF_BASE (S5P_VA_GPIO + 0x00A0) 23#define S5P64X0_GPF_BASE (S5P_VA_GPIO + 0x00A0)
26#define S5P6440_GPG_BASE (S5P_VA_GPIO + 0x00C0) 24#define S5P64X0_GPG_BASE (S5P_VA_GPIO + 0x00C0)
27#define S5P6440_GPH_BASE (S5P_VA_GPIO + 0x00E0) 25#define S5P64X0_GPH_BASE (S5P_VA_GPIO + 0x00E0)
28#define S5P6440_GPI_BASE (S5P_VA_GPIO + 0x0100) 26#define S5P64X0_GPI_BASE (S5P_VA_GPIO + 0x0100)
29#define S5P6440_GPJ_BASE (S5P_VA_GPIO + 0x0120) 27#define S5P64X0_GPJ_BASE (S5P_VA_GPIO + 0x0120)
30#define S5P6440_GPN_BASE (S5P_VA_GPIO + 0x0830) 28#define S5P64X0_GPN_BASE (S5P_VA_GPIO + 0x0830)
31#define S5P6440_GPP_BASE (S5P_VA_GPIO + 0x0160) 29#define S5P64X0_GPP_BASE (S5P_VA_GPIO + 0x0160)
32#define S5P6440_GPR_BASE (S5P_VA_GPIO + 0x0290) 30#define S5P64X0_GPR_BASE (S5P_VA_GPIO + 0x0290)
33 31
34#define S5P6440_EINT0CON0 (S5P_VA_GPIO + 0x900) 32#define S5P6450_GPD_BASE (S5P_VA_GPIO + 0x0060)
35#define S5P6440_EINT0FLTCON0 (S5P_VA_GPIO + 0x910) 33#define S5P6450_GPK_BASE (S5P_VA_GPIO + 0x0140)
36#define S5P6440_EINT0FLTCON1 (S5P_VA_GPIO + 0x914) 34#define S5P6450_GPQ_BASE (S5P_VA_GPIO + 0x0180)
37#define S5P6440_EINT0MASK (S5P_VA_GPIO + 0x920) 35#define S5P6450_GPS_BASE (S5P_VA_GPIO + 0x0300)
38#define S5P6440_EINT0PEND (S5P_VA_GPIO + 0x924)
39
40/* for LCD */
41
42#define S5P6440_SPCON_LCD_SEL_RGB (1 << 0)
43#define S5P6440_SPCON_LCD_SEL_MASK (3 << 0)
44
45/*
46 * These set of macros are not really useful for the
47 * GPF/GPI/GPJ/GPN/GPP, useful for others set of GPIO's (4 bit)
48 */
49
50#define S5P6440_GPIO_CONMASK(__gpio) (0xf << ((__gpio) * 4))
51#define S5P6440_GPIO_INPUT(__gpio) (0x0 << ((__gpio) * 4))
52#define S5P6440_GPIO_OUTPUT(__gpio) (0x1 << ((__gpio) * 4))
53
54/*
55 * Use these macros for GPF/GPI/GPJ/GPN/GPP set of GPIO (2 bit)
56 */
57
58#define S5P6440_GPIO2_CONMASK(__gpio) (0x3 << ((__gpio) * 2))
59#define S5P6440_GPIO2_INPUT(__gpio) (0x0 << ((__gpio) * 2))
60#define S5P6440_GPIO2_OUTPUT(__gpio) (0x1 << ((__gpio) * 2))
61 36
62#endif /* __ASM_ARCH_REGS_GPIO_H */ 37#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 87c3f03c618c..e9802755daeb 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -117,6 +117,7 @@ static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
117 117
118static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = { 118static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
119 { I2C_BOARD_INFO("24c08", 0x50), }, 119 { I2C_BOARD_INFO("24c08", 0x50), },
120 { I2C_BOARD_INFO("wm8580", 0x1b), },
120}; 121};
121 122
122static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = { 123static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index d609f5af2b98..b78f56292780 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -135,6 +135,7 @@ static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
135}; 135};
136 136
137static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = { 137static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
138 { I2C_BOARD_INFO("wm8580", 0x1b), },
138 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */ 139 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
139}; 140};
140 141
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 2d4a761a5163..0305e9b8282d 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -396,7 +396,7 @@ static int s5pc100_sclk1_ctrl(struct clk *clk, int enable)
396 * recommended to keep the following clocks disabled until the driver requests 396 * recommended to keep the following clocks disabled until the driver requests
397 * for enabling the clock. 397 * for enabling the clock.
398 */ 398 */
399static struct clk init_clocks_disable[] = { 399static struct clk init_clocks_off[] = {
400 { 400 {
401 .name = "cssys", 401 .name = "cssys",
402 .id = -1, 402 .id = -1,
@@ -1381,8 +1381,6 @@ static struct clk *clks[] __initdata = {
1381 1381
1382void __init s5pc100_register_clocks(void) 1382void __init s5pc100_register_clocks(void)
1383{ 1383{
1384 struct clk *clkp;
1385 int ret;
1386 int ptr; 1384 int ptr;
1387 1385
1388 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 1386 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
@@ -1393,16 +1391,8 @@ void __init s5pc100_register_clocks(void)
1393 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 1391 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1394 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 1392 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1395 1393
1396 clkp = init_clocks_disable; 1394 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1397 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 1395 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1398
1399 ret = s3c24xx_register_clock(clkp);
1400 if (ret < 0) {
1401 printk(KERN_ERR "Failed to register clock %s (%d)\n",
1402 clkp->name, ret);
1403 }
1404 (clkp->enable)(clkp, 0);
1405 }
1406 1396
1407 s3c_pwmclk_init(); 1397 s3c_pwmclk_init();
1408} 1398}
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
index 32e9cab5c864..328467b346aa 100644
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -55,6 +55,8 @@
55#define S5PC100_VA_VIC_OFFSET 0x10000 55#define S5PC100_VA_VIC_OFFSET 0x10000
56#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET)) 56#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET))
57 57
58#define S5PC100_PA_SROMC (0xE7000000)
59#define S5P_PA_SROMC S5PC100_PA_SROMC
58 60
59#define S5PC100_PA_ONENAND (0xE7100000) 61#define S5PC100_PA_ONENAND (0xE7100000)
60 62
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 862f239a0fdb..53aabef1e9ce 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -118,6 +118,7 @@ menu "S5PV210 Machines"
118config MACH_SMDKV210 118config MACH_SMDKV210
119 bool "SMDKV210" 119 bool "SMDKV210"
120 select CPU_S5PV210 120 select CPU_S5PV210
121 select S3C_DEV_FB
121 select S3C_DEV_HSMMC 122 select S3C_DEV_HSMMC
122 select S3C_DEV_HSMMC1 123 select S3C_DEV_HSMMC1
123 select S3C_DEV_HSMMC2 124 select S3C_DEV_HSMMC2
@@ -130,6 +131,7 @@ config MACH_SMDKV210
130 select SAMSUNG_DEV_IDE 131 select SAMSUNG_DEV_IDE
131 select SAMSUNG_DEV_KEYPAD 132 select SAMSUNG_DEV_KEYPAD
132 select SAMSUNG_DEV_TS 133 select SAMSUNG_DEV_TS
134 select S5PV210_SETUP_FB_24BPP
133 select S5PV210_SETUP_I2C1 135 select S5PV210_SETUP_I2C1
134 select S5PV210_SETUP_I2C2 136 select S5PV210_SETUP_I2C2
135 select S5PV210_SETUP_IDE 137 select S5PV210_SETUP_IDE
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index b774ff1805db..2d599499cefe 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -309,7 +309,7 @@ static struct clk_ops clk_fout_apll_ops = {
309 .get_rate = s5pv210_clk_fout_apll_get_rate, 309 .get_rate = s5pv210_clk_fout_apll_get_rate,
310}; 310};
311 311
312static struct clk init_clocks_disable[] = { 312static struct clk init_clocks_off[] = {
313 { 313 {
314 .name = "pdma", 314 .name = "pdma",
315 .id = 0, 315 .id = 0,
@@ -525,6 +525,12 @@ static struct clk init_clocks[] = {
525 .parent = &clk_pclk_psys.clk, 525 .parent = &clk_pclk_psys.clk,
526 .enable = s5pv210_clk_ip3_ctrl, 526 .enable = s5pv210_clk_ip3_ctrl,
527 .ctrlbit = (1 << 20), 527 .ctrlbit = (1 << 20),
528 }, {
529 .name = "sromc",
530 .id = -1,
531 .parent = &clk_hclk_psys.clk,
532 .enable = s5pv210_clk_ip1_ctrl,
533 .ctrlbit = (1 << 26),
528 }, 534 },
529}; 535};
530 536
@@ -1220,13 +1226,9 @@ static struct clk *clks[] __initdata = {
1220 1226
1221void __init s5pv210_register_clocks(void) 1227void __init s5pv210_register_clocks(void)
1222{ 1228{
1223 struct clk *clkp;
1224 int ret;
1225 int ptr; 1229 int ptr;
1226 1230
1227 ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 1231 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1228 if (ret > 0)
1229 printk(KERN_ERR "Failed to register %u clocks\n", ret);
1230 1232
1231 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 1233 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1232 s3c_register_clksrc(sysclks[ptr], 1); 1234 s3c_register_clksrc(sysclks[ptr], 1);
@@ -1234,15 +1236,8 @@ void __init s5pv210_register_clocks(void)
1234 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 1236 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1235 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 1237 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1236 1238
1237 clkp = init_clocks_disable; 1239 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1238 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 1240 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1239 ret = s3c24xx_register_clock(clkp);
1240 if (ret < 0) {
1241 printk(KERN_ERR "Failed to register clock %s (%d)\n",
1242 clkp->name, ret);
1243 }
1244 (clkp->enable)(clkp, 0);
1245 }
1246 1241
1247 s3c_pwmclk_init(); 1242 s3c_pwmclk_init();
1248} 1243}
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 8eb480e201b0..61e6c24b90ac 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -81,11 +81,6 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
81 .length = SZ_512K, 81 .length = SZ_512K,
82 .type = MT_DEVICE, 82 .type = MT_DEVICE,
83 }, { 83 }, {
84 .virtual = (unsigned long)S5P_VA_SROMC,
85 .pfn = __phys_to_pfn(S5PV210_PA_SROMC),
86 .length = SZ_4K,
87 .type = MT_DEVICE,
88 }, {
89 .virtual = (unsigned long)S5P_VA_DMC0, 84 .virtual = (unsigned long)S5P_VA_DMC0,
90 .pfn = __phys_to_pfn(S5PV210_PA_DMC0), 85 .pfn = __phys_to_pfn(S5PV210_PA_DMC0),
91 .length = SZ_4K, 86 .length = SZ_4K,
diff --git a/arch/arm/mach-s5pv210/include/mach/irqs.h b/arch/arm/mach-s5pv210/include/mach/irqs.h
index 119b95fdc3ce..26710b35ef87 100644
--- a/arch/arm/mach-s5pv210/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv210/include/mach/irqs.h
@@ -65,7 +65,7 @@
65#define IRQ_HSMMC0 S5P_IRQ_VIC1(26) 65#define IRQ_HSMMC0 S5P_IRQ_VIC1(26)
66#define IRQ_HSMMC1 S5P_IRQ_VIC1(27) 66#define IRQ_HSMMC1 S5P_IRQ_VIC1(27)
67#define IRQ_HSMMC2 S5P_IRQ_VIC1(28) 67#define IRQ_HSMMC2 S5P_IRQ_VIC1(28)
68#define IRQ_MIPICSI S5P_IRQ_VIC1(29) 68#define IRQ_MIPI_CSIS S5P_IRQ_VIC1(29)
69#define IRQ_MIPIDSI S5P_IRQ_VIC1(30) 69#define IRQ_MIPIDSI S5P_IRQ_VIC1(30)
70#define IRQ_ONENAND_AUDI S5P_IRQ_VIC1(31) 70#define IRQ_ONENAND_AUDI S5P_IRQ_VIC1(31)
71 71
@@ -132,5 +132,6 @@
132#define IRQ_LCD_FIFO IRQ_LCD0 132#define IRQ_LCD_FIFO IRQ_LCD0
133#define IRQ_LCD_VSYNC IRQ_LCD1 133#define IRQ_LCD_VSYNC IRQ_LCD1
134#define IRQ_LCD_SYSTEM IRQ_LCD2 134#define IRQ_LCD_SYSTEM IRQ_LCD2
135#define IRQ_MIPI_CSIS0 IRQ_MIPI_CSIS
135 136
136#endif /* ASM_ARCH_IRQS_H */ 137#endif /* ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index 861d7fe11fc9..3611492ad681 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -16,6 +16,8 @@
16#include <plat/map-base.h> 16#include <plat/map-base.h>
17#include <plat/map-s5p.h> 17#include <plat/map-s5p.h>
18 18
19#define S5PV210_PA_SROM_BANK5 (0xA8000000)
20
19#define S5PC110_PA_ONENAND (0xB0000000) 21#define S5PC110_PA_ONENAND (0xB0000000)
20#define S5P_PA_ONENAND S5PC110_PA_ONENAND 22#define S5P_PA_ONENAND S5PC110_PA_ONENAND
21 23
@@ -60,6 +62,7 @@
60#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 62#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
61 63
62#define S5PV210_PA_SROMC (0xE8000000) 64#define S5PV210_PA_SROMC (0xE8000000)
65#define S5P_PA_SROMC S5PV210_PA_SROMC
63 66
64#define S5PV210_PA_CFCON (0xE8200000) 67#define S5PV210_PA_CFCON (0xE8200000)
65 68
@@ -107,6 +110,8 @@
107#define S5PV210_PA_DMC0 (0xF0000000) 110#define S5PV210_PA_DMC0 (0xF0000000)
108#define S5PV210_PA_DMC1 (0xF1400000) 111#define S5PV210_PA_DMC1 (0xF1400000)
109 112
113#define S5PV210_PA_MIPI_CSIS 0xFA600000
114
110/* compatibiltiy defines. */ 115/* compatibiltiy defines. */
111#define S3C_PA_UART S5PV210_PA_UART 116#define S3C_PA_UART S5PV210_PA_UART
112#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0) 117#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0)
@@ -123,6 +128,7 @@
123#define S5P_PA_FIMC0 S5PV210_PA_FIMC0 128#define S5P_PA_FIMC0 S5PV210_PA_FIMC0
124#define S5P_PA_FIMC1 S5PV210_PA_FIMC1 129#define S5P_PA_FIMC1 S5PV210_PA_FIMC1
125#define S5P_PA_FIMC2 S5PV210_PA_FIMC2 130#define S5P_PA_FIMC2 S5PV210_PA_FIMC2
131#define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS
126 132
127#define SAMSUNG_PA_ADC S5PV210_PA_ADC 133#define SAMSUNG_PA_ADC S5PV210_PA_ADC
128#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON 134#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
index ebaabe021af9..4c45b74def5f 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
@@ -161,7 +161,7 @@
161#define S5P_MDNIE_SEL S5P_CLKREG(0x7008) 161#define S5P_MDNIE_SEL S5P_CLKREG(0x7008)
162#define S5P_MIPI_PHY_CON0 S5P_CLKREG(0x7200) 162#define S5P_MIPI_PHY_CON0 S5P_CLKREG(0x7200)
163#define S5P_MIPI_PHY_CON1 S5P_CLKREG(0x7204) 163#define S5P_MIPI_PHY_CON1 S5P_CLKREG(0x7204)
164#define S5P_MIPI_CONTROL S5P_CLKREG(0xE814) 164#define S5P_MIPI_DPHY_CONTROL S5P_CLKREG(0xE814)
165 165
166#define S5P_IDLE_CFG_TL_MASK (3 << 30) 166#define S5P_IDLE_CFG_TL_MASK (3 << 30)
167#define S5P_IDLE_CFG_TM_MASK (3 << 28) 167#define S5P_IDLE_CFG_TM_MASK (3 << 28)
@@ -195,9 +195,6 @@
195#define S5P_OTHERS_RET_UART (1 << 28) 195#define S5P_OTHERS_RET_UART (1 << 28)
196#define S5P_OTHERS_USB_SIG_MASK (1 << 16) 196#define S5P_OTHERS_USB_SIG_MASK (1 << 16)
197 197
198/* MIPI */
199#define S5P_MIPI_DPHY_EN (3)
200
201/* S5P_DAC_CONTROL */ 198/* S5P_DAC_CONTROL */
202#define S5P_DAC_ENABLE (1) 199#define S5P_DAC_ENABLE (1)
203#define S5P_DAC_DISABLE (0) 200#define S5P_DAC_DISABLE (0)
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index 5dd1681c069e..bb20a14da100 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -94,6 +94,7 @@ static struct platform_device *smdkc110_devices[] __initdata = {
94 94
95static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = { 95static struct i2c_board_info smdkc110_i2c_devs0[] __initdata = {
96 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */ 96 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */
97 { I2C_BOARD_INFO("wm8580", 0x1b), },
97}; 98};
98 99
99static struct i2c_board_info smdkc110_i2c_devs1[] __initdata = { 100static struct i2c_board_info smdkc110_i2c_devs1[] __initdata = {
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 1fbc45b2a432..88e45223c8af 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -14,16 +14,25 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/serial_core.h> 15#include <linux/serial_core.h>
16#include <linux/sysdev.h> 16#include <linux/sysdev.h>
17#include <linux/dm9000.h>
18#include <linux/fb.h>
19#include <linux/gpio.h>
20#include <linux/delay.h>
17 21
18#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 23#include <asm/mach/map.h>
20#include <asm/setup.h> 24#include <asm/setup.h>
21#include <asm/mach-types.h> 25#include <asm/mach-types.h>
22 26
27#include <video/platform_lcd.h>
28
23#include <mach/map.h> 29#include <mach/map.h>
24#include <mach/regs-clock.h> 30#include <mach/regs-clock.h>
31#include <mach/regs-fb.h>
25 32
26#include <plat/regs-serial.h> 33#include <plat/regs-serial.h>
34#include <plat/regs-srom.h>
35#include <plat/gpio-cfg.h>
27#include <plat/s5pv210.h> 36#include <plat/s5pv210.h>
28#include <plat/devs.h> 37#include <plat/devs.h>
29#include <plat/cpu.h> 38#include <plat/cpu.h>
@@ -33,6 +42,7 @@
33#include <plat/iic.h> 42#include <plat/iic.h>
34#include <plat/keypad.h> 43#include <plat/keypad.h>
35#include <plat/pm.h> 44#include <plat/pm.h>
45#include <plat/fb.h>
36 46
37/* Following are default values for UCON, ULCON and UFCON UART registers */ 47/* Following are default values for UCON, ULCON and UFCON UART registers */
38#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 48#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -102,12 +112,106 @@ static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
102 .cols = 8, 112 .cols = 8,
103}; 113};
104 114
115static struct resource smdkv210_dm9000_resources[] = {
116 [0] = {
117 .start = S5PV210_PA_SROM_BANK5,
118 .end = S5PV210_PA_SROM_BANK5,
119 .flags = IORESOURCE_MEM,
120 },
121 [1] = {
122 .start = S5PV210_PA_SROM_BANK5 + 2,
123 .end = S5PV210_PA_SROM_BANK5 + 2,
124 .flags = IORESOURCE_MEM,
125 },
126 [2] = {
127 .start = IRQ_EINT(9),
128 .end = IRQ_EINT(9),
129 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
130 },
131};
132
133static struct dm9000_plat_data smdkv210_dm9000_platdata = {
134 .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
135 .dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0x48 },
136};
137
138struct platform_device smdkv210_dm9000 = {
139 .name = "dm9000",
140 .id = -1,
141 .num_resources = ARRAY_SIZE(smdkv210_dm9000_resources),
142 .resource = smdkv210_dm9000_resources,
143 .dev = {
144 .platform_data = &smdkv210_dm9000_platdata,
145 },
146};
147
148static void smdkv210_lte480wv_set_power(struct plat_lcd_data *pd,
149 unsigned int power)
150{
151 if (power) {
152#if !defined(CONFIG_BACKLIGHT_PWM)
153 gpio_request(S5PV210_GPD0(3), "GPD0");
154 gpio_direction_output(S5PV210_GPD0(3), 1);
155 gpio_free(S5PV210_GPD0(3));
156#endif
157
158 /* fire nRESET on power up */
159 gpio_request(S5PV210_GPH0(6), "GPH0");
160
161 gpio_direction_output(S5PV210_GPH0(6), 1);
162
163 gpio_set_value(S5PV210_GPH0(6), 0);
164 mdelay(10);
165
166 gpio_set_value(S5PV210_GPH0(6), 1);
167 mdelay(10);
168
169 gpio_free(S5PV210_GPH0(6));
170 } else {
171#if !defined(CONFIG_BACKLIGHT_PWM)
172 gpio_request(S5PV210_GPD0(3), "GPD0");
173 gpio_direction_output(S5PV210_GPD0(3), 0);
174 gpio_free(S5PV210_GPD0(3));
175#endif
176 }
177}
178
179static struct plat_lcd_data smdkv210_lcd_lte480wv_data = {
180 .set_power = smdkv210_lte480wv_set_power,
181};
182
183static struct platform_device smdkv210_lcd_lte480wv = {
184 .name = "platform-lcd",
185 .dev.parent = &s3c_device_fb.dev,
186 .dev.platform_data = &smdkv210_lcd_lte480wv_data,
187};
188
189static struct s3c_fb_pd_win smdkv210_fb_win0 = {
190 .win_mode = {
191 .left_margin = 13,
192 .right_margin = 8,
193 .upper_margin = 7,
194 .lower_margin = 5,
195 .hsync_len = 3,
196 .vsync_len = 1,
197 .xres = 800,
198 .yres = 480,
199 },
200 .max_bpp = 32,
201 .default_bpp = 24,
202};
203
204static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
205 .win[0] = &smdkv210_fb_win0,
206 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
207 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
208 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
209};
210
105static struct platform_device *smdkv210_devices[] __initdata = { 211static struct platform_device *smdkv210_devices[] __initdata = {
106 &s5pv210_device_iis0,
107 &s5pv210_device_ac97,
108 &s5pv210_device_spdif,
109 &s3c_device_adc, 212 &s3c_device_adc,
110 &s3c_device_cfcon, 213 &s3c_device_cfcon,
214 &s3c_device_fb,
111 &s3c_device_hsmmc0, 215 &s3c_device_hsmmc0,
112 &s3c_device_hsmmc1, 216 &s3c_device_hsmmc1,
113 &s3c_device_hsmmc2, 217 &s3c_device_hsmmc2,
@@ -115,14 +219,37 @@ static struct platform_device *smdkv210_devices[] __initdata = {
115 &s3c_device_i2c0, 219 &s3c_device_i2c0,
116 &s3c_device_i2c1, 220 &s3c_device_i2c1,
117 &s3c_device_i2c2, 221 &s3c_device_i2c2,
118 &samsung_device_keypad,
119 &s3c_device_rtc, 222 &s3c_device_rtc,
120 &s3c_device_ts, 223 &s3c_device_ts,
121 &s3c_device_wdt, 224 &s3c_device_wdt,
225 &s5pv210_device_ac97,
226 &s5pv210_device_iis0,
227 &s5pv210_device_spdif,
228 &samsung_device_keypad,
229 &smdkv210_dm9000,
230 &smdkv210_lcd_lte480wv,
122}; 231};
123 232
233static void __init smdkv210_dm9000_init(void)
234{
235 unsigned int tmp;
236
237 gpio_request(S5PV210_MP01(5), "nCS5");
238 s3c_gpio_cfgpin(S5PV210_MP01(5), S3C_GPIO_SFN(2));
239 gpio_free(S5PV210_MP01(5));
240
241 tmp = (5 << S5P_SROM_BCX__TACC__SHIFT);
242 __raw_writel(tmp, S5P_SROM_BC5);
243
244 tmp = __raw_readl(S5P_SROM_BW);
245 tmp &= (S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS5__SHIFT);
246 tmp |= (1 << S5P_SROM_BW__NCS5__SHIFT);
247 __raw_writel(tmp, S5P_SROM_BW);
248}
249
124static struct i2c_board_info smdkv210_i2c_devs0[] __initdata = { 250static struct i2c_board_info smdkv210_i2c_devs0[] __initdata = {
125 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */ 251 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */
252 { I2C_BOARD_INFO("wm8580", 0x1b), },
126}; 253};
127 254
128static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = { 255static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = {
@@ -150,6 +277,8 @@ static void __init smdkv210_machine_init(void)
150{ 277{
151 s3c_pm_init(); 278 s3c_pm_init();
152 279
280 smdkv210_dm9000_init();
281
153 samsung_keypad_set_platdata(&smdkv210_keypad_data); 282 samsung_keypad_set_platdata(&smdkv210_keypad_data);
154 s3c24xx_ts_set_platdata(&s3c_ts_platform); 283 s3c24xx_ts_set_platdata(&s3c_ts_platform);
155 284
@@ -165,6 +294,8 @@ static void __init smdkv210_machine_init(void)
165 294
166 s3c_ide_set_platdata(&smdkv210_ide_pdata); 295 s3c_ide_set_platdata(&smdkv210_ide_pdata);
167 296
297 s3c_fb_set_platdata(&smdkv210_lcd0_pdata);
298
168 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices)); 299 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
169} 300}
170 301
diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index d64efe0d4c97..09c4c21b70cc 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -15,6 +15,11 @@ config CPU_S5PV310
15 help 15 help
16 Enable S5PV310 CPU support 16 Enable S5PV310 CPU support
17 17
18config S5PV310_DEV_PD
19 bool
20 help
21 Compile in platform device definitions for Power Domain
22
18config S5PV310_SETUP_I2C1 23config S5PV310_SETUP_I2C1
19 bool 24 bool
20 help 25 help
@@ -61,6 +66,11 @@ config S5PV310_SETUP_SDHCI_GPIO
61 help 66 help
62 Common setup code for SDHCI gpio. 67 Common setup code for SDHCI gpio.
63 68
69config S5PV310_DEV_SYSMMU
70 bool
71 help
72 Common setup code for SYSTEM MMU in S5PV310
73
64# machine support 74# machine support
65 75
66menu "S5PC210 Machines" 76menu "S5PC210 Machines"
@@ -70,11 +80,15 @@ config MACH_SMDKC210
70 select CPU_S5PV310 80 select CPU_S5PV310
71 select S3C_DEV_RTC 81 select S3C_DEV_RTC
72 select S3C_DEV_WDT 82 select S3C_DEV_WDT
83 select S3C_DEV_I2C1
73 select S3C_DEV_HSMMC 84 select S3C_DEV_HSMMC
74 select S3C_DEV_HSMMC1 85 select S3C_DEV_HSMMC1
75 select S3C_DEV_HSMMC2 86 select S3C_DEV_HSMMC2
76 select S3C_DEV_HSMMC3 87 select S3C_DEV_HSMMC3
88 select S5PV310_DEV_PD
89 select S5PV310_SETUP_I2C1
77 select S5PV310_SETUP_SDHCI 90 select S5PV310_SETUP_SDHCI
91 select S5PV310_DEV_SYSMMU
78 help 92 help
79 Machine support for Samsung SMDKC210 93 Machine support for Samsung SMDKC210
80 S5PC210(MCP) is one of package option of S5PV310 94 S5PC210(MCP) is one of package option of S5PV310
@@ -83,6 +97,10 @@ config MACH_UNIVERSAL_C210
83 bool "Mobile UNIVERSAL_C210 Board" 97 bool "Mobile UNIVERSAL_C210 Board"
84 select CPU_S5PV310 98 select CPU_S5PV310
85 select S5P_DEV_ONENAND 99 select S5P_DEV_ONENAND
100 select S3C_DEV_HSMMC
101 select S3C_DEV_HSMMC2
102 select S3C_DEV_HSMMC3
103 select S5PV310_SETUP_SDHCI
86 select S3C_DEV_I2C1 104 select S3C_DEV_I2C1
87 select S5PV310_SETUP_I2C1 105 select S5PV310_SETUP_I2C1
88 help 106 help
@@ -98,10 +116,13 @@ config MACH_SMDKV310
98 select CPU_S5PV310 116 select CPU_S5PV310
99 select S3C_DEV_RTC 117 select S3C_DEV_RTC
100 select S3C_DEV_WDT 118 select S3C_DEV_WDT
119 select S3C_DEV_I2C1
101 select S3C_DEV_HSMMC 120 select S3C_DEV_HSMMC
102 select S3C_DEV_HSMMC1 121 select S3C_DEV_HSMMC1
103 select S3C_DEV_HSMMC2 122 select S3C_DEV_HSMMC2
104 select S3C_DEV_HSMMC3 123 select S3C_DEV_HSMMC3
124 select S5PV310_DEV_PD
125 select S5PV310_SETUP_I2C1
105 select S5PV310_SETUP_SDHCI 126 select S5PV310_SETUP_SDHCI
106 help 127 help
107 Machine support for Samsung SMDKV310 128 Machine support for Samsung SMDKV310
diff --git a/arch/arm/mach-s5pv310/Makefile b/arch/arm/mach-s5pv310/Makefile
index 61e3cb654269..036fb383b830 100644
--- a/arch/arm/mach-s5pv310/Makefile
+++ b/arch/arm/mach-s5pv310/Makefile
@@ -14,6 +14,7 @@ obj- :=
14 14
15obj-$(CONFIG_CPU_S5PV310) += cpu.o init.o clock.o irq-combiner.o 15obj-$(CONFIG_CPU_S5PV310) += cpu.o init.o clock.o irq-combiner.o
16obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o time.o gpiolib.o irq-eint.o dma.o 16obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o time.o gpiolib.o irq-eint.o dma.o
17obj-$(CONFIG_CPU_FREQ) += cpufreq.o
17 18
18obj-$(CONFIG_SMP) += platsmp.o headsmp.o 19obj-$(CONFIG_SMP) += platsmp.o headsmp.o
19obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 20obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
@@ -27,7 +28,10 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o
27 28
28# device support 29# device support
29 30
30obj-y += dev-audio.o 31obj-y += dev-audio.o
32obj-$(CONFIG_S5PV310_DEV_PD) += dev-pd.o
33obj-$(CONFIG_S5PV310_DEV_SYSMMU) += dev-sysmmu.o
34
31obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o 35obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o
32obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o 36obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o
33obj-$(CONFIG_S5PV310_SETUP_I2C3) += setup-i2c3.o 37obj-$(CONFIG_S5PV310_SETUP_I2C3) += setup-i2c3.o
diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index 58c9d33f36fe..fc7c2f8d165e 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -244,7 +244,7 @@ static struct clksrc_clk clk_mout_corebus = {
244 .id = -1, 244 .id = -1,
245 }, 245 },
246 .sources = &clkset_mout_corebus, 246 .sources = &clkset_mout_corebus,
247 .reg_src = { .reg = S5P_CLKSRC_CORE, .shift = 4, .size = 1 }, 247 .reg_src = { .reg = S5P_CLKSRC_DMC, .shift = 4, .size = 1 },
248}; 248};
249 249
250static struct clksrc_clk clk_sclk_dmc = { 250static struct clksrc_clk clk_sclk_dmc = {
@@ -253,7 +253,7 @@ static struct clksrc_clk clk_sclk_dmc = {
253 .id = -1, 253 .id = -1,
254 .parent = &clk_mout_corebus.clk, 254 .parent = &clk_mout_corebus.clk,
255 }, 255 },
256 .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 12, .size = 3 }, 256 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 12, .size = 3 },
257}; 257};
258 258
259static struct clksrc_clk clk_aclk_cored = { 259static struct clksrc_clk clk_aclk_cored = {
@@ -262,7 +262,7 @@ static struct clksrc_clk clk_aclk_cored = {
262 .id = -1, 262 .id = -1,
263 .parent = &clk_sclk_dmc.clk, 263 .parent = &clk_sclk_dmc.clk,
264 }, 264 },
265 .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 16, .size = 3 }, 265 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 16, .size = 3 },
266}; 266};
267 267
268static struct clksrc_clk clk_aclk_corep = { 268static struct clksrc_clk clk_aclk_corep = {
@@ -271,7 +271,7 @@ static struct clksrc_clk clk_aclk_corep = {
271 .id = -1, 271 .id = -1,
272 .parent = &clk_aclk_cored.clk, 272 .parent = &clk_aclk_cored.clk,
273 }, 273 },
274 .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 20, .size = 3 }, 274 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 20, .size = 3 },
275}; 275};
276 276
277static struct clksrc_clk clk_aclk_acp = { 277static struct clksrc_clk clk_aclk_acp = {
@@ -280,7 +280,7 @@ static struct clksrc_clk clk_aclk_acp = {
280 .id = -1, 280 .id = -1,
281 .parent = &clk_mout_corebus.clk, 281 .parent = &clk_mout_corebus.clk,
282 }, 282 },
283 .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 0, .size = 3 }, 283 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 0, .size = 3 },
284}; 284};
285 285
286static struct clksrc_clk clk_pclk_acp = { 286static struct clksrc_clk clk_pclk_acp = {
@@ -289,7 +289,7 @@ static struct clksrc_clk clk_pclk_acp = {
289 .id = -1, 289 .id = -1,
290 .parent = &clk_aclk_acp.clk, 290 .parent = &clk_aclk_acp.clk,
291 }, 291 },
292 .reg_div = { .reg = S5P_CLKDIV_CORE0, .shift = 4, .size = 3 }, 292 .reg_div = { .reg = S5P_CLKDIV_DMC0, .shift = 4, .size = 3 },
293}; 293};
294 294
295/* Core list of CMU_TOP side */ 295/* Core list of CMU_TOP side */
@@ -384,7 +384,7 @@ static struct clksrc_clk clk_sclk_vpll = {
384 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 }, 384 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 8, .size = 1 },
385}; 385};
386 386
387static struct clk init_clocks_disable[] = { 387static struct clk init_clocks_off[] = {
388 { 388 {
389 .name = "timers", 389 .name = "timers",
390 .id = -1, 390 .id = -1,
@@ -467,6 +467,16 @@ static struct clk init_clocks_disable[] = {
467 .enable = s5pv310_clk_ip_fsys_ctrl, 467 .enable = s5pv310_clk_ip_fsys_ctrl,
468 .ctrlbit = (1 << 10), 468 .ctrlbit = (1 << 10),
469 }, { 469 }, {
470 .name = "pdma",
471 .id = 0,
472 .enable = s5pv310_clk_ip_fsys_ctrl,
473 .ctrlbit = (1 << 0),
474 }, {
475 .name = "pdma",
476 .id = 1,
477 .enable = s5pv310_clk_ip_fsys_ctrl,
478 .ctrlbit = (1 << 1),
479 }, {
470 .name = "adc", 480 .name = "adc",
471 .id = -1, 481 .id = -1,
472 .enable = s5pv310_clk_ip_peril_ctrl, 482 .enable = s5pv310_clk_ip_peril_ctrl,
@@ -507,6 +517,26 @@ static struct clk init_clocks_disable[] = {
507 .enable = s5pv310_clk_ip_peril_ctrl, 517 .enable = s5pv310_clk_ip_peril_ctrl,
508 .ctrlbit = (1 << 18), 518 .ctrlbit = (1 << 18),
509 }, { 519 }, {
520 .name = "iis",
521 .id = 0,
522 .enable = s5pv310_clk_ip_peril_ctrl,
523 .ctrlbit = (1 << 19),
524 }, {
525 .name = "iis",
526 .id = 1,
527 .enable = s5pv310_clk_ip_peril_ctrl,
528 .ctrlbit = (1 << 20),
529 }, {
530 .name = "iis",
531 .id = 2,
532 .enable = s5pv310_clk_ip_peril_ctrl,
533 .ctrlbit = (1 << 21),
534 }, {
535 .name = "ac97",
536 .id = -1,
537 .enable = s5pv310_clk_ip_peril_ctrl,
538 .ctrlbit = (1 << 27),
539 }, {
510 .name = "fimg2d", 540 .name = "fimg2d",
511 .id = -1, 541 .id = -1,
512 .enable = s5pv310_clk_ip_image_ctrl, 542 .enable = s5pv310_clk_ip_image_ctrl,
@@ -990,6 +1020,17 @@ static struct clksrc_clk *sysclks[] = {
990 &clk_dout_mmc4, 1020 &clk_dout_mmc4,
991}; 1021};
992 1022
1023static int xtal_rate;
1024
1025static unsigned long s5pv310_fout_apll_get_rate(struct clk *clk)
1026{
1027 return s5p_get_pll45xx(xtal_rate, __raw_readl(S5P_APLL_CON0), pll_4508);
1028}
1029
1030static struct clk_ops s5pv310_fout_apll_ops = {
1031 .get_rate = s5pv310_fout_apll_get_rate,
1032};
1033
993void __init_or_cpufreq s5pv310_setup_clocks(void) 1034void __init_or_cpufreq s5pv310_setup_clocks(void)
994{ 1035{
995 struct clk *xtal_clk; 1036 struct clk *xtal_clk;
@@ -1013,6 +1054,9 @@ void __init_or_cpufreq s5pv310_setup_clocks(void)
1013 BUG_ON(IS_ERR(xtal_clk)); 1054 BUG_ON(IS_ERR(xtal_clk));
1014 1055
1015 xtal = clk_get_rate(xtal_clk); 1056 xtal = clk_get_rate(xtal_clk);
1057
1058 xtal_rate = xtal;
1059
1016 clk_put(xtal_clk); 1060 clk_put(xtal_clk);
1017 1061
1018 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal); 1062 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
@@ -1026,7 +1070,7 @@ void __init_or_cpufreq s5pv310_setup_clocks(void)
1026 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), 1070 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1027 __raw_readl(S5P_VPLL_CON1), pll_4650); 1071 __raw_readl(S5P_VPLL_CON1), pll_4650);
1028 1072
1029 clk_fout_apll.rate = apll; 1073 clk_fout_apll.ops = &s5pv310_fout_apll_ops;
1030 clk_fout_mpll.rate = mpll; 1074 clk_fout_mpll.rate = mpll;
1031 clk_fout_epll.rate = epll; 1075 clk_fout_epll.rate = epll;
1032 clk_fout_vpll.rate = vpll; 1076 clk_fout_vpll.rate = vpll;
@@ -1061,13 +1105,9 @@ static struct clk *clks[] __initdata = {
1061 1105
1062void __init s5pv310_register_clocks(void) 1106void __init s5pv310_register_clocks(void)
1063{ 1107{
1064 struct clk *clkp;
1065 int ret;
1066 int ptr; 1108 int ptr;
1067 1109
1068 ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 1110 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
1069 if (ret > 0)
1070 printk(KERN_ERR "Failed to register %u clocks\n", ret);
1071 1111
1072 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++) 1112 for (ptr = 0; ptr < ARRAY_SIZE(sysclks); ptr++)
1073 s3c_register_clksrc(sysclks[ptr], 1); 1113 s3c_register_clksrc(sysclks[ptr], 1);
@@ -1075,15 +1115,8 @@ void __init s5pv310_register_clocks(void)
1075 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 1115 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
1076 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 1116 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
1077 1117
1078 clkp = init_clocks_disable; 1118 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1079 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { 1119 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
1080 ret = s3c24xx_register_clock(clkp);
1081 if (ret < 0) {
1082 printk(KERN_ERR "Failed to register clock %s (%d)\n",
1083 clkp->name, ret);
1084 }
1085 (clkp->enable)(clkp, 0);
1086 }
1087 1120
1088 s3c_pwmclk_init(); 1121 s3c_pwmclk_init();
1089} 1122}
diff --git a/arch/arm/mach-s5pv310/cpu.c b/arch/arm/mach-s5pv310/cpu.c
index 72ab289e7816..0db0fb65bd70 100644
--- a/arch/arm/mach-s5pv310/cpu.c
+++ b/arch/arm/mach-s5pv310/cpu.c
@@ -41,6 +41,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
41 .length = SZ_128K, 41 .length = SZ_128K,
42 .type = MT_DEVICE, 42 .type = MT_DEVICE,
43 }, { 43 }, {
44 .virtual = (unsigned long)S5P_VA_PMU,
45 .pfn = __phys_to_pfn(S5PV310_PA_PMU),
46 .length = SZ_64K,
47 .type = MT_DEVICE,
48 }, {
44 .virtual = (unsigned long)S5P_VA_COMBINER_BASE, 49 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
45 .pfn = __phys_to_pfn(S5PV310_PA_COMBINER), 50 .pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
46 .length = SZ_4K, 51 .length = SZ_4K,
@@ -71,6 +76,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
71 .length = SZ_256, 76 .length = SZ_256,
72 .type = MT_DEVICE, 77 .type = MT_DEVICE,
73 }, { 78 }, {
79 .virtual = (unsigned long)S5P_VA_DMC0,
80 .pfn = __phys_to_pfn(S5PV310_PA_DMC0),
81 .length = SZ_4K,
82 .type = MT_DEVICE,
83 }, {
74 .virtual = (unsigned long)S3C_VA_UART, 84 .virtual = (unsigned long)S3C_VA_UART,
75 .pfn = __phys_to_pfn(S3C_PA_UART), 85 .pfn = __phys_to_pfn(S3C_PA_UART),
76 .length = SZ_512K, 86 .length = SZ_512K,
@@ -123,6 +133,15 @@ void __init s5pv310_init_irq(void)
123 gic_init(0, IRQ_LOCALTIMER, S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); 133 gic_init(0, IRQ_LOCALTIMER, S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
124 134
125 for (irq = 0; irq < MAX_COMBINER_NR; irq++) { 135 for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
136
137 /*
138 * From SPI(0) to SPI(39) and SPI(51), SPI(53) are
139 * connected to the interrupt combiner. These irqs
140 * should be initialized to support cascade interrupt.
141 */
142 if ((irq >= 40) && !(irq == 51) && !(irq == 53))
143 continue;
144
126 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), 145 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
127 COMBINER_IRQ(irq, 0)); 146 COMBINER_IRQ(irq, 0));
128 combiner_cascade_irq(irq, IRQ_SPI(irq)); 147 combiner_cascade_irq(irq, IRQ_SPI(irq));
@@ -164,7 +183,7 @@ static int __init s5pv310_l2x0_cache_init(void)
164 __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN, 183 __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
165 S5P_VA_L2CC + L2X0_POWER_CTRL); 184 S5P_VA_L2CC + L2X0_POWER_CTRL);
166 185
167 l2x0_init(S5P_VA_L2CC, 0x7C070001, 0xC200ffff); 186 l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff);
168 187
169 return 0; 188 return 0;
170} 189}
diff --git a/arch/arm/mach-s5pv310/cpufreq.c b/arch/arm/mach-s5pv310/cpufreq.c
new file mode 100644
index 000000000000..b04cbc731128
--- /dev/null
+++ b/arch/arm/mach-s5pv310/cpufreq.c
@@ -0,0 +1,580 @@
1/* linux/arch/arm/mach-s5pv310/cpufreq.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - CPU frequency scaling support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/types.h>
14#include <linux/kernel.h>
15#include <linux/err.h>
16#include <linux/clk.h>
17#include <linux/io.h>
18#include <linux/slab.h>
19#include <linux/regulator/consumer.h>
20#include <linux/cpufreq.h>
21
22#include <mach/map.h>
23#include <mach/regs-clock.h>
24#include <mach/regs-mem.h>
25
26#include <plat/clock.h>
27#include <plat/pm.h>
28
29static struct clk *cpu_clk;
30static struct clk *moutcore;
31static struct clk *mout_mpll;
32static struct clk *mout_apll;
33
34#ifdef CONFIG_REGULATOR
35static struct regulator *arm_regulator;
36static struct regulator *int_regulator;
37#endif
38
39static struct cpufreq_freqs freqs;
40static unsigned int memtype;
41
42enum s5pv310_memory_type {
43 DDR2 = 4,
44 LPDDR2,
45 DDR3,
46};
47
48enum cpufreq_level_index {
49 L0, L1, L2, L3, CPUFREQ_LEVEL_END,
50};
51
52static struct cpufreq_frequency_table s5pv310_freq_table[] = {
53 {L0, 1000*1000},
54 {L1, 800*1000},
55 {L2, 400*1000},
56 {L3, 100*1000},
57 {0, CPUFREQ_TABLE_END},
58};
59
60static unsigned int clkdiv_cpu0[CPUFREQ_LEVEL_END][7] = {
61 /*
62 * Clock divider value for following
63 * { DIVCORE, DIVCOREM0, DIVCOREM1, DIVPERIPH,
64 * DIVATB, DIVPCLK_DBG, DIVAPLL }
65 */
66
67 /* ARM L0: 1000MHz */
68 { 0, 3, 7, 3, 3, 0, 1 },
69
70 /* ARM L1: 800MHz */
71 { 0, 3, 7, 3, 3, 0, 1 },
72
73 /* ARM L2: 400MHz */
74 { 0, 1, 3, 1, 3, 0, 1 },
75
76 /* ARM L3: 100MHz */
77 { 0, 0, 1, 0, 3, 1, 1 },
78};
79
80static unsigned int clkdiv_cpu1[CPUFREQ_LEVEL_END][2] = {
81 /*
82 * Clock divider value for following
83 * { DIVCOPY, DIVHPM }
84 */
85
86 /* ARM L0: 1000MHz */
87 { 3, 0 },
88
89 /* ARM L1: 800MHz */
90 { 3, 0 },
91
92 /* ARM L2: 400MHz */
93 { 3, 0 },
94
95 /* ARM L3: 100MHz */
96 { 3, 0 },
97};
98
99static unsigned int clkdiv_dmc0[CPUFREQ_LEVEL_END][8] = {
100 /*
101 * Clock divider value for following
102 * { DIVACP, DIVACP_PCLK, DIVDPHY, DIVDMC, DIVDMCD
103 * DIVDMCP, DIVCOPY2, DIVCORE_TIMERS }
104 */
105
106 /* DMC L0: 400MHz */
107 { 3, 1, 1, 1, 1, 1, 3, 1 },
108
109 /* DMC L1: 400MHz */
110 { 3, 1, 1, 1, 1, 1, 3, 1 },
111
112 /* DMC L2: 266.7MHz */
113 { 7, 1, 1, 2, 1, 1, 3, 1 },
114
115 /* DMC L3: 200MHz */
116 { 7, 1, 1, 3, 1, 1, 3, 1 },
117};
118
119static unsigned int clkdiv_top[CPUFREQ_LEVEL_END][5] = {
120 /*
121 * Clock divider value for following
122 * { DIVACLK200, DIVACLK100, DIVACLK160, DIVACLK133, DIVONENAND }
123 */
124
125 /* ACLK200 L0: 200MHz */
126 { 3, 7, 4, 5, 1 },
127
128 /* ACLK200 L1: 200MHz */
129 { 3, 7, 4, 5, 1 },
130
131 /* ACLK200 L2: 160MHz */
132 { 4, 7, 5, 7, 1 },
133
134 /* ACLK200 L3: 133.3MHz */
135 { 5, 7, 7, 7, 1 },
136};
137
138static unsigned int clkdiv_lr_bus[CPUFREQ_LEVEL_END][2] = {
139 /*
140 * Clock divider value for following
141 * { DIVGDL/R, DIVGPL/R }
142 */
143
144 /* ACLK_GDL/R L0: 200MHz */
145 { 3, 1 },
146
147 /* ACLK_GDL/R L1: 200MHz */
148 { 3, 1 },
149
150 /* ACLK_GDL/R L2: 160MHz */
151 { 4, 1 },
152
153 /* ACLK_GDL/R L3: 133.3MHz */
154 { 5, 1 },
155};
156
157struct cpufreq_voltage_table {
158 unsigned int index; /* any */
159 unsigned int arm_volt; /* uV */
160 unsigned int int_volt;
161};
162
163static struct cpufreq_voltage_table s5pv310_volt_table[CPUFREQ_LEVEL_END] = {
164 {
165 .index = L0,
166 .arm_volt = 1200000,
167 .int_volt = 1100000,
168 }, {
169 .index = L1,
170 .arm_volt = 1100000,
171 .int_volt = 1100000,
172 }, {
173 .index = L2,
174 .arm_volt = 1000000,
175 .int_volt = 1000000,
176 }, {
177 .index = L3,
178 .arm_volt = 900000,
179 .int_volt = 1000000,
180 },
181};
182
183static unsigned int s5pv310_apll_pms_table[CPUFREQ_LEVEL_END] = {
184 /* APLL FOUT L0: 1000MHz */
185 ((250 << 16) | (6 << 8) | 1),
186
187 /* APLL FOUT L1: 800MHz */
188 ((200 << 16) | (6 << 8) | 1),
189
190 /* APLL FOUT L2 : 400MHz */
191 ((200 << 16) | (6 << 8) | 2),
192
193 /* APLL FOUT L3: 100MHz */
194 ((200 << 16) | (6 << 8) | 4),
195};
196
197int s5pv310_verify_speed(struct cpufreq_policy *policy)
198{
199 return cpufreq_frequency_table_verify(policy, s5pv310_freq_table);
200}
201
202unsigned int s5pv310_getspeed(unsigned int cpu)
203{
204 return clk_get_rate(cpu_clk) / 1000;
205}
206
207void s5pv310_set_clkdiv(unsigned int div_index)
208{
209 unsigned int tmp;
210
211 /* Change Divider - CPU0 */
212
213 tmp = __raw_readl(S5P_CLKDIV_CPU);
214
215 tmp &= ~(S5P_CLKDIV_CPU0_CORE_MASK | S5P_CLKDIV_CPU0_COREM0_MASK |
216 S5P_CLKDIV_CPU0_COREM1_MASK | S5P_CLKDIV_CPU0_PERIPH_MASK |
217 S5P_CLKDIV_CPU0_ATB_MASK | S5P_CLKDIV_CPU0_PCLKDBG_MASK |
218 S5P_CLKDIV_CPU0_APLL_MASK);
219
220 tmp |= ((clkdiv_cpu0[div_index][0] << S5P_CLKDIV_CPU0_CORE_SHIFT) |
221 (clkdiv_cpu0[div_index][1] << S5P_CLKDIV_CPU0_COREM0_SHIFT) |
222 (clkdiv_cpu0[div_index][2] << S5P_CLKDIV_CPU0_COREM1_SHIFT) |
223 (clkdiv_cpu0[div_index][3] << S5P_CLKDIV_CPU0_PERIPH_SHIFT) |
224 (clkdiv_cpu0[div_index][4] << S5P_CLKDIV_CPU0_ATB_SHIFT) |
225 (clkdiv_cpu0[div_index][5] << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT) |
226 (clkdiv_cpu0[div_index][6] << S5P_CLKDIV_CPU0_APLL_SHIFT));
227
228 __raw_writel(tmp, S5P_CLKDIV_CPU);
229
230 do {
231 tmp = __raw_readl(S5P_CLKDIV_STATCPU);
232 } while (tmp & 0x1111111);
233
234 /* Change Divider - CPU1 */
235
236 tmp = __raw_readl(S5P_CLKDIV_CPU1);
237
238 tmp &= ~((0x7 << 4) | 0x7);
239
240 tmp |= ((clkdiv_cpu1[div_index][0] << 4) |
241 (clkdiv_cpu1[div_index][1] << 0));
242
243 __raw_writel(tmp, S5P_CLKDIV_CPU1);
244
245 do {
246 tmp = __raw_readl(S5P_CLKDIV_STATCPU1);
247 } while (tmp & 0x11);
248
249 /* Change Divider - DMC0 */
250
251 tmp = __raw_readl(S5P_CLKDIV_DMC0);
252
253 tmp &= ~(S5P_CLKDIV_DMC0_ACP_MASK | S5P_CLKDIV_DMC0_ACPPCLK_MASK |
254 S5P_CLKDIV_DMC0_DPHY_MASK | S5P_CLKDIV_DMC0_DMC_MASK |
255 S5P_CLKDIV_DMC0_DMCD_MASK | S5P_CLKDIV_DMC0_DMCP_MASK |
256 S5P_CLKDIV_DMC0_COPY2_MASK | S5P_CLKDIV_DMC0_CORETI_MASK);
257
258 tmp |= ((clkdiv_dmc0[div_index][0] << S5P_CLKDIV_DMC0_ACP_SHIFT) |
259 (clkdiv_dmc0[div_index][1] << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT) |
260 (clkdiv_dmc0[div_index][2] << S5P_CLKDIV_DMC0_DPHY_SHIFT) |
261 (clkdiv_dmc0[div_index][3] << S5P_CLKDIV_DMC0_DMC_SHIFT) |
262 (clkdiv_dmc0[div_index][4] << S5P_CLKDIV_DMC0_DMCD_SHIFT) |
263 (clkdiv_dmc0[div_index][5] << S5P_CLKDIV_DMC0_DMCP_SHIFT) |
264 (clkdiv_dmc0[div_index][6] << S5P_CLKDIV_DMC0_COPY2_SHIFT) |
265 (clkdiv_dmc0[div_index][7] << S5P_CLKDIV_DMC0_CORETI_SHIFT));
266
267 __raw_writel(tmp, S5P_CLKDIV_DMC0);
268
269 do {
270 tmp = __raw_readl(S5P_CLKDIV_STAT_DMC0);
271 } while (tmp & 0x11111111);
272
273 /* Change Divider - TOP */
274
275 tmp = __raw_readl(S5P_CLKDIV_TOP);
276
277 tmp &= ~(S5P_CLKDIV_TOP_ACLK200_MASK | S5P_CLKDIV_TOP_ACLK100_MASK |
278 S5P_CLKDIV_TOP_ACLK160_MASK | S5P_CLKDIV_TOP_ACLK133_MASK |
279 S5P_CLKDIV_TOP_ONENAND_MASK);
280
281 tmp |= ((clkdiv_top[div_index][0] << S5P_CLKDIV_TOP_ACLK200_SHIFT) |
282 (clkdiv_top[div_index][1] << S5P_CLKDIV_TOP_ACLK100_SHIFT) |
283 (clkdiv_top[div_index][2] << S5P_CLKDIV_TOP_ACLK160_SHIFT) |
284 (clkdiv_top[div_index][3] << S5P_CLKDIV_TOP_ACLK133_SHIFT) |
285 (clkdiv_top[div_index][4] << S5P_CLKDIV_TOP_ONENAND_SHIFT));
286
287 __raw_writel(tmp, S5P_CLKDIV_TOP);
288
289 do {
290 tmp = __raw_readl(S5P_CLKDIV_STAT_TOP);
291 } while (tmp & 0x11111);
292
293 /* Change Divider - LEFTBUS */
294
295 tmp = __raw_readl(S5P_CLKDIV_LEFTBUS);
296
297 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK);
298
299 tmp |= ((clkdiv_lr_bus[div_index][0] << S5P_CLKDIV_BUS_GDLR_SHIFT) |
300 (clkdiv_lr_bus[div_index][1] << S5P_CLKDIV_BUS_GPLR_SHIFT));
301
302 __raw_writel(tmp, S5P_CLKDIV_LEFTBUS);
303
304 do {
305 tmp = __raw_readl(S5P_CLKDIV_STAT_LEFTBUS);
306 } while (tmp & 0x11);
307
308 /* Change Divider - RIGHTBUS */
309
310 tmp = __raw_readl(S5P_CLKDIV_RIGHTBUS);
311
312 tmp &= ~(S5P_CLKDIV_BUS_GDLR_MASK | S5P_CLKDIV_BUS_GPLR_MASK);
313
314 tmp |= ((clkdiv_lr_bus[div_index][0] << S5P_CLKDIV_BUS_GDLR_SHIFT) |
315 (clkdiv_lr_bus[div_index][1] << S5P_CLKDIV_BUS_GPLR_SHIFT));
316
317 __raw_writel(tmp, S5P_CLKDIV_RIGHTBUS);
318
319 do {
320 tmp = __raw_readl(S5P_CLKDIV_STAT_RIGHTBUS);
321 } while (tmp & 0x11);
322}
323
324static void s5pv310_set_apll(unsigned int index)
325{
326 unsigned int tmp;
327
328 /* 1. MUX_CORE_SEL = MPLL, ARMCLK uses MPLL for lock time */
329 clk_set_parent(moutcore, mout_mpll);
330
331 do {
332 tmp = (__raw_readl(S5P_CLKMUX_STATCPU)
333 >> S5P_CLKSRC_CPU_MUXCORE_SHIFT);
334 tmp &= 0x7;
335 } while (tmp != 0x2);
336
337 /* 2. Set APLL Lock time */
338 __raw_writel(S5P_APLL_LOCKTIME, S5P_APLL_LOCK);
339
340 /* 3. Change PLL PMS values */
341 tmp = __raw_readl(S5P_APLL_CON0);
342 tmp &= ~((0x3ff << 16) | (0x3f << 8) | (0x7 << 0));
343 tmp |= s5pv310_apll_pms_table[index];
344 __raw_writel(tmp, S5P_APLL_CON0);
345
346 /* 4. wait_lock_time */
347 do {
348 tmp = __raw_readl(S5P_APLL_CON0);
349 } while (!(tmp & (0x1 << S5P_APLLCON0_LOCKED_SHIFT)));
350
351 /* 5. MUX_CORE_SEL = APLL */
352 clk_set_parent(moutcore, mout_apll);
353
354 do {
355 tmp = __raw_readl(S5P_CLKMUX_STATCPU);
356 tmp &= S5P_CLKMUX_STATCPU_MUXCORE_MASK;
357 } while (tmp != (0x1 << S5P_CLKSRC_CPU_MUXCORE_SHIFT));
358}
359
360static void s5pv310_set_frequency(unsigned int old_index, unsigned int new_index)
361{
362 unsigned int tmp;
363
364 if (old_index > new_index) {
365 /* The frequency changing to L0 needs to change apll */
366 if (freqs.new == s5pv310_freq_table[L0].frequency) {
367 /* 1. Change the system clock divider values */
368 s5pv310_set_clkdiv(new_index);
369
370 /* 2. Change the apll m,p,s value */
371 s5pv310_set_apll(new_index);
372 } else {
373 /* 1. Change the system clock divider values */
374 s5pv310_set_clkdiv(new_index);
375
376 /* 2. Change just s value in apll m,p,s value */
377 tmp = __raw_readl(S5P_APLL_CON0);
378 tmp &= ~(0x7 << 0);
379 tmp |= (s5pv310_apll_pms_table[new_index] & 0x7);
380 __raw_writel(tmp, S5P_APLL_CON0);
381 }
382 }
383
384 else if (old_index < new_index) {
385 /* The frequency changing from L0 needs to change apll */
386 if (freqs.old == s5pv310_freq_table[L0].frequency) {
387 /* 1. Change the apll m,p,s value */
388 s5pv310_set_apll(new_index);
389
390 /* 2. Change the system clock divider values */
391 s5pv310_set_clkdiv(new_index);
392 } else {
393 /* 1. Change just s value in apll m,p,s value */
394 tmp = __raw_readl(S5P_APLL_CON0);
395 tmp &= ~(0x7 << 0);
396 tmp |= (s5pv310_apll_pms_table[new_index] & 0x7);
397 __raw_writel(tmp, S5P_APLL_CON0);
398
399 /* 2. Change the system clock divider values */
400 s5pv310_set_clkdiv(new_index);
401 }
402 }
403}
404
405static int s5pv310_target(struct cpufreq_policy *policy,
406 unsigned int target_freq,
407 unsigned int relation)
408{
409 unsigned int index, old_index;
410 unsigned int arm_volt, int_volt;
411
412 freqs.old = s5pv310_getspeed(policy->cpu);
413
414 if (cpufreq_frequency_table_target(policy, s5pv310_freq_table,
415 freqs.old, relation, &old_index))
416 return -EINVAL;
417
418 if (cpufreq_frequency_table_target(policy, s5pv310_freq_table,
419 target_freq, relation, &index))
420 return -EINVAL;
421
422 freqs.new = s5pv310_freq_table[index].frequency;
423 freqs.cpu = policy->cpu;
424
425 if (freqs.new == freqs.old)
426 return 0;
427
428 /* get the voltage value */
429 arm_volt = s5pv310_volt_table[index].arm_volt;
430 int_volt = s5pv310_volt_table[index].int_volt;
431
432 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
433
434 /* control regulator */
435 if (freqs.new > freqs.old) {
436 /* Voltage up */
437#ifdef CONFIG_REGULATOR
438 regulator_set_voltage(arm_regulator, arm_volt, arm_volt);
439 regulator_set_voltage(int_regulator, int_volt, int_volt);
440#endif
441 }
442
443 /* Clock Configuration Procedure */
444 s5pv310_set_frequency(old_index, index);
445
446 /* control regulator */
447 if (freqs.new < freqs.old) {
448 /* Voltage down */
449#ifdef CONFIG_REGULATOR
450 regulator_set_voltage(arm_regulator, arm_volt, arm_volt);
451 regulator_set_voltage(int_regulator, int_volt, int_volt);
452#endif
453 }
454
455 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
456
457 return 0;
458}
459
460#ifdef CONFIG_PM
461static int s5pv310_cpufreq_suspend(struct cpufreq_policy *policy,
462 pm_message_t pmsg)
463{
464 return 0;
465}
466
467static int s5pv310_cpufreq_resume(struct cpufreq_policy *policy)
468{
469 return 0;
470}
471#endif
472
473static int s5pv310_cpufreq_cpu_init(struct cpufreq_policy *policy)
474{
475 policy->cur = policy->min = policy->max = s5pv310_getspeed(policy->cpu);
476
477 cpufreq_frequency_table_get_attr(s5pv310_freq_table, policy->cpu);
478
479 /* set the transition latency value */
480 policy->cpuinfo.transition_latency = 100000;
481
482 /*
483 * S5PV310 multi-core processors has 2 cores
484 * that the frequency cannot be set independently.
485 * Each cpu is bound to the same speed.
486 * So the affected cpu is all of the cpus.
487 */
488 cpumask_setall(policy->cpus);
489
490 return cpufreq_frequency_table_cpuinfo(policy, s5pv310_freq_table);
491}
492
493static struct cpufreq_driver s5pv310_driver = {
494 .flags = CPUFREQ_STICKY,
495 .verify = s5pv310_verify_speed,
496 .target = s5pv310_target,
497 .get = s5pv310_getspeed,
498 .init = s5pv310_cpufreq_cpu_init,
499 .name = "s5pv310_cpufreq",
500#ifdef CONFIG_PM
501 .suspend = s5pv310_cpufreq_suspend,
502 .resume = s5pv310_cpufreq_resume,
503#endif
504};
505
506static int __init s5pv310_cpufreq_init(void)
507{
508 cpu_clk = clk_get(NULL, "armclk");
509 if (IS_ERR(cpu_clk))
510 return PTR_ERR(cpu_clk);
511
512 moutcore = clk_get(NULL, "moutcore");
513 if (IS_ERR(moutcore))
514 goto out;
515
516 mout_mpll = clk_get(NULL, "mout_mpll");
517 if (IS_ERR(mout_mpll))
518 goto out;
519
520 mout_apll = clk_get(NULL, "mout_apll");
521 if (IS_ERR(mout_apll))
522 goto out;
523
524#ifdef CONFIG_REGULATOR
525 arm_regulator = regulator_get(NULL, "vdd_arm");
526 if (IS_ERR(arm_regulator)) {
527 printk(KERN_ERR "failed to get resource %s\n", "vdd_arm");
528 goto out;
529 }
530
531 int_regulator = regulator_get(NULL, "vdd_int");
532 if (IS_ERR(int_regulator)) {
533 printk(KERN_ERR "failed to get resource %s\n", "vdd_int");
534 goto out;
535 }
536#endif
537
538 /*
539 * Check DRAM type.
540 * Because DVFS level is different according to DRAM type.
541 */
542 memtype = __raw_readl(S5P_VA_DMC0 + S5P_DMC0_MEMCON_OFFSET);
543 memtype = (memtype >> S5P_DMC0_MEMTYPE_SHIFT);
544 memtype &= S5P_DMC0_MEMTYPE_MASK;
545
546 if ((memtype < DDR2) && (memtype > DDR3)) {
547 printk(KERN_ERR "%s: wrong memtype= 0x%x\n", __func__, memtype);
548 goto out;
549 } else {
550 printk(KERN_DEBUG "%s: memtype= 0x%x\n", __func__, memtype);
551 }
552
553 return cpufreq_register_driver(&s5pv310_driver);
554
555out:
556 if (!IS_ERR(cpu_clk))
557 clk_put(cpu_clk);
558
559 if (!IS_ERR(moutcore))
560 clk_put(moutcore);
561
562 if (!IS_ERR(mout_mpll))
563 clk_put(mout_mpll);
564
565 if (!IS_ERR(mout_apll))
566 clk_put(mout_apll);
567
568#ifdef CONFIG_REGULATOR
569 if (!IS_ERR(arm_regulator))
570 regulator_put(arm_regulator);
571
572 if (!IS_ERR(int_regulator))
573 regulator_put(int_regulator);
574#endif
575
576 printk(KERN_ERR "%s: failed initialization\n", __func__);
577
578 return -EINVAL;
579}
580late_initcall(s5pv310_cpufreq_init);
diff --git a/arch/arm/mach-s5pv310/dev-pd.c b/arch/arm/mach-s5pv310/dev-pd.c
new file mode 100644
index 000000000000..58a50c2d0b67
--- /dev/null
+++ b/arch/arm/mach-s5pv310/dev-pd.c
@@ -0,0 +1,139 @@
1/* linux/arch/arm/mach-s5pv310/dev-pd.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - Power Domain support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/io.h>
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/delay.h>
17
18#include <mach/regs-pmu.h>
19
20#include <plat/pd.h>
21
22static int s5pv310_pd_enable(struct device *dev)
23{
24 struct samsung_pd_info *pdata = dev->platform_data;
25 u32 timeout;
26
27 __raw_writel(S5P_INT_LOCAL_PWR_EN, pdata->base);
28
29 /* Wait max 1ms */
30 timeout = 10;
31 while ((__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN)
32 != S5P_INT_LOCAL_PWR_EN) {
33 if (timeout == 0) {
34 printk(KERN_ERR "Power domain %s enable failed.\n",
35 dev_name(dev));
36 return -ETIMEDOUT;
37 }
38 timeout--;
39 udelay(100);
40 }
41
42 return 0;
43}
44
45static int s5pv310_pd_disable(struct device *dev)
46{
47 struct samsung_pd_info *pdata = dev->platform_data;
48 u32 timeout;
49
50 __raw_writel(0, pdata->base);
51
52 /* Wait max 1ms */
53 timeout = 10;
54 while (__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) {
55 if (timeout == 0) {
56 printk(KERN_ERR "Power domain %s disable failed.\n",
57 dev_name(dev));
58 return -ETIMEDOUT;
59 }
60 timeout--;
61 udelay(100);
62 }
63
64 return 0;
65}
66
67struct platform_device s5pv310_device_pd[] = {
68 {
69 .name = "samsung-pd",
70 .id = 0,
71 .dev = {
72 .platform_data = &(struct samsung_pd_info) {
73 .enable = s5pv310_pd_enable,
74 .disable = s5pv310_pd_disable,
75 .base = S5P_PMU_MFC_CONF,
76 },
77 },
78 }, {
79 .name = "samsung-pd",
80 .id = 1,
81 .dev = {
82 .platform_data = &(struct samsung_pd_info) {
83 .enable = s5pv310_pd_enable,
84 .disable = s5pv310_pd_disable,
85 .base = S5P_PMU_G3D_CONF,
86 },
87 },
88 }, {
89 .name = "samsung-pd",
90 .id = 2,
91 .dev = {
92 .platform_data = &(struct samsung_pd_info) {
93 .enable = s5pv310_pd_enable,
94 .disable = s5pv310_pd_disable,
95 .base = S5P_PMU_LCD0_CONF,
96 },
97 },
98 }, {
99 .name = "samsung-pd",
100 .id = 3,
101 .dev = {
102 .platform_data = &(struct samsung_pd_info) {
103 .enable = s5pv310_pd_enable,
104 .disable = s5pv310_pd_disable,
105 .base = S5P_PMU_LCD1_CONF,
106 },
107 },
108 }, {
109 .name = "samsung-pd",
110 .id = 4,
111 .dev = {
112 .platform_data = &(struct samsung_pd_info) {
113 .enable = s5pv310_pd_enable,
114 .disable = s5pv310_pd_disable,
115 .base = S5P_PMU_TV_CONF,
116 },
117 },
118 }, {
119 .name = "samsung-pd",
120 .id = 5,
121 .dev = {
122 .platform_data = &(struct samsung_pd_info) {
123 .enable = s5pv310_pd_enable,
124 .disable = s5pv310_pd_disable,
125 .base = S5P_PMU_CAM_CONF,
126 },
127 },
128 }, {
129 .name = "samsung-pd",
130 .id = 6,
131 .dev = {
132 .platform_data = &(struct samsung_pd_info) {
133 .enable = s5pv310_pd_enable,
134 .disable = s5pv310_pd_disable,
135 .base = S5P_PMU_GPS_CONF,
136 },
137 },
138 },
139};
diff --git a/arch/arm/mach-s5pv310/dev-sysmmu.c b/arch/arm/mach-s5pv310/dev-sysmmu.c
new file mode 100644
index 000000000000..e1bb200ac0f0
--- /dev/null
+++ b/arch/arm/mach-s5pv310/dev-sysmmu.c
@@ -0,0 +1,187 @@
1/* linux/arch/arm/mach-s5pv310/dev-sysmmu.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h>
13
14#include <mach/map.h>
15#include <mach/irqs.h>
16
17static struct resource s5pv310_sysmmu_resource[] = {
18 [0] = {
19 .start = S5PV310_PA_SYSMMU_MDMA,
20 .end = S5PV310_PA_SYSMMU_MDMA + SZ_64K - 1,
21 .flags = IORESOURCE_MEM,
22 },
23 [1] = {
24 .start = IRQ_SYSMMU_MDMA0_0,
25 .end = IRQ_SYSMMU_MDMA0_0,
26 .flags = IORESOURCE_IRQ,
27 },
28 [2] = {
29 .start = S5PV310_PA_SYSMMU_SSS,
30 .end = S5PV310_PA_SYSMMU_SSS + SZ_64K - 1,
31 .flags = IORESOURCE_MEM,
32 },
33 [3] = {
34 .start = IRQ_SYSMMU_SSS_0,
35 .end = IRQ_SYSMMU_SSS_0,
36 .flags = IORESOURCE_IRQ,
37 },
38 [4] = {
39 .start = S5PV310_PA_SYSMMU_FIMC0,
40 .end = S5PV310_PA_SYSMMU_FIMC0 + SZ_64K - 1,
41 .flags = IORESOURCE_MEM,
42 },
43 [5] = {
44 .start = IRQ_SYSMMU_FIMC0_0,
45 .end = IRQ_SYSMMU_FIMC0_0,
46 .flags = IORESOURCE_IRQ,
47 },
48 [6] = {
49 .start = S5PV310_PA_SYSMMU_FIMC1,
50 .end = S5PV310_PA_SYSMMU_FIMC1 + SZ_64K - 1,
51 .flags = IORESOURCE_MEM,
52 },
53 [7] = {
54 .start = IRQ_SYSMMU_FIMC1_0,
55 .end = IRQ_SYSMMU_FIMC1_0,
56 .flags = IORESOURCE_IRQ,
57 },
58 [8] = {
59 .start = S5PV310_PA_SYSMMU_FIMC2,
60 .end = S5PV310_PA_SYSMMU_FIMC2 + SZ_64K - 1,
61 .flags = IORESOURCE_MEM,
62 },
63 [9] = {
64 .start = IRQ_SYSMMU_FIMC2_0,
65 .end = IRQ_SYSMMU_FIMC2_0,
66 .flags = IORESOURCE_IRQ,
67 },
68 [10] = {
69 .start = S5PV310_PA_SYSMMU_FIMC3,
70 .end = S5PV310_PA_SYSMMU_FIMC3 + SZ_64K - 1,
71 .flags = IORESOURCE_MEM,
72 },
73 [11] = {
74 .start = IRQ_SYSMMU_FIMC3_0,
75 .end = IRQ_SYSMMU_FIMC3_0,
76 .flags = IORESOURCE_IRQ,
77 },
78 [12] = {
79 .start = S5PV310_PA_SYSMMU_JPEG,
80 .end = S5PV310_PA_SYSMMU_JPEG + SZ_64K - 1,
81 .flags = IORESOURCE_MEM,
82 },
83 [13] = {
84 .start = IRQ_SYSMMU_JPEG_0,
85 .end = IRQ_SYSMMU_JPEG_0,
86 .flags = IORESOURCE_IRQ,
87 },
88 [14] = {
89 .start = S5PV310_PA_SYSMMU_FIMD0,
90 .end = S5PV310_PA_SYSMMU_FIMD0 + SZ_64K - 1,
91 .flags = IORESOURCE_MEM,
92 },
93 [15] = {
94 .start = IRQ_SYSMMU_LCD0_M0_0,
95 .end = IRQ_SYSMMU_LCD0_M0_0,
96 .flags = IORESOURCE_IRQ,
97 },
98 [16] = {
99 .start = S5PV310_PA_SYSMMU_FIMD1,
100 .end = S5PV310_PA_SYSMMU_FIMD1 + SZ_64K - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 [17] = {
104 .start = IRQ_SYSMMU_LCD1_M1_0,
105 .end = IRQ_SYSMMU_LCD1_M1_0,
106 .flags = IORESOURCE_IRQ,
107 },
108 [18] = {
109 .start = S5PV310_PA_SYSMMU_PCIe,
110 .end = S5PV310_PA_SYSMMU_PCIe + SZ_64K - 1,
111 .flags = IORESOURCE_MEM,
112 },
113 [19] = {
114 .start = IRQ_SYSMMU_PCIE_0,
115 .end = IRQ_SYSMMU_PCIE_0,
116 .flags = IORESOURCE_IRQ,
117 },
118 [20] = {
119 .start = S5PV310_PA_SYSMMU_G2D,
120 .end = S5PV310_PA_SYSMMU_G2D + SZ_64K - 1,
121 .flags = IORESOURCE_MEM,
122 },
123 [21] = {
124 .start = IRQ_SYSMMU_2D_0,
125 .end = IRQ_SYSMMU_2D_0,
126 .flags = IORESOURCE_IRQ,
127 },
128 [22] = {
129 .start = S5PV310_PA_SYSMMU_ROTATOR,
130 .end = S5PV310_PA_SYSMMU_ROTATOR + SZ_64K - 1,
131 .flags = IORESOURCE_MEM,
132 },
133 [23] = {
134 .start = IRQ_SYSMMU_ROTATOR_0,
135 .end = IRQ_SYSMMU_ROTATOR_0,
136 .flags = IORESOURCE_IRQ,
137 },
138 [24] = {
139 .start = S5PV310_PA_SYSMMU_MDMA2,
140 .end = S5PV310_PA_SYSMMU_MDMA2 + SZ_64K - 1,
141 .flags = IORESOURCE_MEM,
142 },
143 [25] = {
144 .start = IRQ_SYSMMU_MDMA1_0,
145 .end = IRQ_SYSMMU_MDMA1_0,
146 .flags = IORESOURCE_IRQ,
147 },
148 [26] = {
149 .start = S5PV310_PA_SYSMMU_TV,
150 .end = S5PV310_PA_SYSMMU_TV + SZ_64K - 1,
151 .flags = IORESOURCE_MEM,
152 },
153 [27] = {
154 .start = IRQ_SYSMMU_TV_M0_0,
155 .end = IRQ_SYSMMU_TV_M0_0,
156 .flags = IORESOURCE_IRQ,
157 },
158 [28] = {
159 .start = S5PV310_PA_SYSMMU_MFC_L,
160 .end = S5PV310_PA_SYSMMU_MFC_L + SZ_64K - 1,
161 .flags = IORESOURCE_MEM,
162 },
163 [29] = {
164 .start = IRQ_SYSMMU_MFC_M0_0,
165 .end = IRQ_SYSMMU_MFC_M0_0,
166 .flags = IORESOURCE_IRQ,
167 },
168 [30] = {
169 .start = S5PV310_PA_SYSMMU_MFC_R,
170 .end = S5PV310_PA_SYSMMU_MFC_R + SZ_64K - 1,
171 .flags = IORESOURCE_MEM,
172 },
173 [31] = {
174 .start = IRQ_SYSMMU_MFC_M1_0,
175 .end = IRQ_SYSMMU_MFC_M1_0,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180struct platform_device s5pv310_device_sysmmu = {
181 .name = "s5p-sysmmu",
182 .id = 32,
183 .num_resources = ARRAY_SIZE(s5pv310_sysmmu_resource),
184 .resource = s5pv310_sysmmu_resource,
185};
186
187EXPORT_SYMBOL(s5pv310_device_sysmmu);
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h b/arch/arm/mach-s5pv310/include/mach/irqs.h
index 3c05c58b5392..536b0b59fc83 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -25,6 +25,8 @@
25 25
26#define IRQ_SPI(x) S5P_IRQ(x+32) 26#define IRQ_SPI(x) S5P_IRQ(x+32)
27 27
28#define IRQ_MCT1 IRQ_SPI(35)
29
28#define IRQ_EINT0 IRQ_SPI(40) 30#define IRQ_EINT0 IRQ_SPI(40)
29#define IRQ_EINT1 IRQ_SPI(41) 31#define IRQ_EINT1 IRQ_SPI(41)
30#define IRQ_EINT2 IRQ_SPI(42) 32#define IRQ_EINT2 IRQ_SPI(42)
@@ -36,9 +38,8 @@
36#define IRQ_JPEG IRQ_SPI(48) 38#define IRQ_JPEG IRQ_SPI(48)
37#define IRQ_2D IRQ_SPI(49) 39#define IRQ_2D IRQ_SPI(49)
38#define IRQ_PCIE IRQ_SPI(50) 40#define IRQ_PCIE IRQ_SPI(50)
39#define IRQ_SYSTEM_TIMER IRQ_SPI(51) 41#define IRQ_MCT0 IRQ_SPI(51)
40#define IRQ_MFC IRQ_SPI(52) 42#define IRQ_MFC IRQ_SPI(52)
41#define IRQ_WDT IRQ_SPI(53)
42#define IRQ_AUDIO_SS IRQ_SPI(54) 43#define IRQ_AUDIO_SS IRQ_SPI(54)
43#define IRQ_AC97 IRQ_SPI(55) 44#define IRQ_AC97 IRQ_SPI(55)
44#define IRQ_SPDIF IRQ_SPI(56) 45#define IRQ_SPDIF IRQ_SPI(56)
@@ -54,6 +55,24 @@
54#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(64)) 55#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(64))
55#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y) 56#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y)
56 57
58#define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)
59#define IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)
60#define IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)
61#define IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3)
62#define IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4)
63#define IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5)
64#define IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6)
65#define IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7)
66
67#define IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0)
68#define IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1)
69#define IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2)
70#define IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3)
71#define IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4)
72#define IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5)
73#define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6)
74#define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7)
75
57#define IRQ_PDMA0 COMBINER_IRQ(21, 0) 76#define IRQ_PDMA0 COMBINER_IRQ(21, 0)
58#define IRQ_PDMA1 COMBINER_IRQ(21, 1) 77#define IRQ_PDMA1 COMBINER_IRQ(21, 1)
59 78
@@ -86,8 +105,13 @@
86#define IRQ_HSMMC2 COMBINER_IRQ(29, 2) 105#define IRQ_HSMMC2 COMBINER_IRQ(29, 2)
87#define IRQ_HSMMC3 COMBINER_IRQ(29, 3) 106#define IRQ_HSMMC3 COMBINER_IRQ(29, 3)
88 107
108#define IRQ_MIPI_CSIS0 COMBINER_IRQ(30, 0)
109#define IRQ_MIPI_CSIS1 COMBINER_IRQ(30, 1)
110
89#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0) 111#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0)
90 112
113#define IRQ_MCT_L1 COMBINER_IRQ(35, 3)
114
91#define IRQ_EINT4 COMBINER_IRQ(37, 0) 115#define IRQ_EINT4 COMBINER_IRQ(37, 0)
92#define IRQ_EINT5 COMBINER_IRQ(37, 1) 116#define IRQ_EINT5 COMBINER_IRQ(37, 1)
93#define IRQ_EINT6 COMBINER_IRQ(37, 2) 117#define IRQ_EINT6 COMBINER_IRQ(37, 2)
@@ -104,7 +128,11 @@
104 128
105#define IRQ_EINT16_31 COMBINER_IRQ(39, 0) 129#define IRQ_EINT16_31 COMBINER_IRQ(39, 0)
106 130
107#define MAX_COMBINER_NR 40 131#define IRQ_MCT_L0 COMBINER_IRQ(51, 0)
132
133#define IRQ_WDT COMBINER_IRQ(53, 0)
134
135#define MAX_COMBINER_NR 54
108 136
109#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0) 137#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0)
110 138
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h b/arch/arm/mach-s5pv310/include/mach/map.h
index 53994467605d..74d400625a23 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -39,11 +39,15 @@
39#define S5PV310_PA_SYSCON (0x10010000) 39#define S5PV310_PA_SYSCON (0x10010000)
40#define S5P_PA_SYSCON S5PV310_PA_SYSCON 40#define S5P_PA_SYSCON S5PV310_PA_SYSCON
41 41
42#define S5PV310_PA_PMU (0x10020000)
43
42#define S5PV310_PA_CMU (0x10030000) 44#define S5PV310_PA_CMU (0x10030000)
43 45
44#define S5PV310_PA_WATCHDOG (0x10060000) 46#define S5PV310_PA_WATCHDOG (0x10060000)
45#define S5PV310_PA_RTC (0x10070000) 47#define S5PV310_PA_RTC (0x10070000)
46 48
49#define S5PV310_PA_DMC0 (0x10400000)
50
47#define S5PV310_PA_COMBINER (0x10448000) 51#define S5PV310_PA_COMBINER (0x10448000)
48 52
49#define S5PV310_PA_COREPERI (0x10500000) 53#define S5PV310_PA_COREPERI (0x10500000)
@@ -61,9 +65,13 @@
61#define S5PV310_PA_GPIO2 (0x11000000) 65#define S5PV310_PA_GPIO2 (0x11000000)
62#define S5PV310_PA_GPIO3 (0x03860000) 66#define S5PV310_PA_GPIO3 (0x03860000)
63 67
68#define S5PV310_PA_MIPI_CSIS0 0x11880000
69#define S5PV310_PA_MIPI_CSIS1 0x11890000
70
64#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) 71#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
65 72
66#define S5PV310_PA_SROMC (0x12570000) 73#define S5PV310_PA_SROMC (0x12570000)
74#define S5P_PA_SROMC S5PV310_PA_SROMC
67 75
68/* S/PDIF */ 76/* S/PDIF */
69#define S5PV310_PA_SPDIF 0xE1100000 77#define S5PV310_PA_SPDIF 0xE1100000
@@ -100,6 +108,25 @@
100#define S5PV310_PA_SDRAM (0x40000000) 108#define S5PV310_PA_SDRAM (0x40000000)
101#define S5P_PA_SDRAM S5PV310_PA_SDRAM 109#define S5P_PA_SDRAM S5PV310_PA_SDRAM
102 110
111#define S5PV310_PA_SYSMMU_MDMA 0x10A40000
112#define S5PV310_PA_SYSMMU_SSS 0x10A50000
113#define S5PV310_PA_SYSMMU_FIMC0 0x11A20000
114#define S5PV310_PA_SYSMMU_FIMC1 0x11A30000
115#define S5PV310_PA_SYSMMU_FIMC2 0x11A40000
116#define S5PV310_PA_SYSMMU_FIMC3 0x11A50000
117#define S5PV310_PA_SYSMMU_JPEG 0x11A60000
118#define S5PV310_PA_SYSMMU_FIMD0 0x11E20000
119#define S5PV310_PA_SYSMMU_FIMD1 0x12220000
120#define S5PV310_PA_SYSMMU_PCIe 0x12620000
121#define S5PV310_PA_SYSMMU_G2D 0x12A20000
122#define S5PV310_PA_SYSMMU_ROTATOR 0x12A30000
123#define S5PV310_PA_SYSMMU_MDMA2 0x12A40000
124#define S5PV310_PA_SYSMMU_TV 0x12E20000
125#define S5PV310_PA_SYSMMU_MFC_L 0x13620000
126#define S5PV310_PA_SYSMMU_MFC_R 0x13630000
127#define S5PV310_SYSMMU_TOTAL_IPNUM 16
128#define S5P_SYSMMU_TOTAL_IPNUM S5PV310_SYSMMU_TOTAL_IPNUM
129
103/* compatibiltiy defines. */ 130/* compatibiltiy defines. */
104#define S3C_PA_UART S5PV310_PA_UART 131#define S3C_PA_UART S5PV310_PA_UART
105#define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0) 132#define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0)
@@ -116,5 +143,7 @@
116#define S3C_PA_IIC7 S5PV310_PA_IIC(7) 143#define S3C_PA_IIC7 S5PV310_PA_IIC(7)
117#define S3C_PA_RTC S5PV310_PA_RTC 144#define S3C_PA_RTC S5PV310_PA_RTC
118#define S3C_PA_WDT S5PV310_PA_WATCHDOG 145#define S3C_PA_WDT S5PV310_PA_WATCHDOG
146#define S5P_PA_MIPI_CSIS0 S5PV310_PA_MIPI_CSIS0
147#define S5P_PA_MIPI_CSIS1 S5PV310_PA_MIPI_CSIS1
119 148
120#endif /* __ASM_ARCH_MAP_H */ 149#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-clock.h b/arch/arm/mach-s5pv310/include/mach/regs-clock.h
index f1028cad9788..b5c4ada1cff5 100644
--- a/arch/arm/mach-s5pv310/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv310/include/mach/regs-clock.h
@@ -19,6 +19,12 @@
19 19
20#define S5P_INFORM0 S5P_CLKREG(0x800) 20#define S5P_INFORM0 S5P_CLKREG(0x800)
21 21
22#define S5P_CLKDIV_LEFTBUS S5P_CLKREG(0x04500)
23#define S5P_CLKDIV_STAT_LEFTBUS S5P_CLKREG(0x04600)
24
25#define S5P_CLKDIV_RIGHTBUS S5P_CLKREG(0x08500)
26#define S5P_CLKDIV_STAT_RIGHTBUS S5P_CLKREG(0x08600)
27
22#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110) 28#define S5P_EPLL_CON0 S5P_CLKREG(0x0C110)
23#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114) 29#define S5P_EPLL_CON1 S5P_CLKREG(0x0C114)
24#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120) 30#define S5P_VPLL_CON0 S5P_CLKREG(0x0C120)
@@ -58,6 +64,8 @@
58#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) 64#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350)
59#define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354) 65#define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354)
60 66
67#define S5P_CLKDIV_STAT_TOP S5P_CLKREG(0x0C610)
68
61#define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920) 69#define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920)
62#define S5P_CLKGATE_IP_IMAGE S5P_CLKREG(0x0C930) 70#define S5P_CLKGATE_IP_IMAGE S5P_CLKREG(0x0C930)
63#define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934) 71#define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934)
@@ -66,8 +74,9 @@
66#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) 74#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950)
67#define S5P_CLKGATE_IP_PERIR S5P_CLKREG(0x0C960) 75#define S5P_CLKGATE_IP_PERIR S5P_CLKREG(0x0C960)
68 76
69#define S5P_CLKSRC_CORE S5P_CLKREG(0x10200) 77#define S5P_CLKSRC_DMC S5P_CLKREG(0x10200)
70#define S5P_CLKDIV_CORE0 S5P_CLKREG(0x10500) 78#define S5P_CLKDIV_DMC0 S5P_CLKREG(0x10500)
79#define S5P_CLKDIV_STAT_DMC0 S5P_CLKREG(0x10600)
71 80
72#define S5P_APLL_LOCK S5P_CLKREG(0x14000) 81#define S5P_APLL_LOCK S5P_CLKREG(0x14000)
73#define S5P_MPLL_LOCK S5P_CLKREG(0x14004) 82#define S5P_MPLL_LOCK S5P_CLKREG(0x14004)
@@ -80,10 +89,77 @@
80#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400) 89#define S5P_CLKMUX_STATCPU S5P_CLKREG(0x14400)
81 90
82#define S5P_CLKDIV_CPU S5P_CLKREG(0x14500) 91#define S5P_CLKDIV_CPU S5P_CLKREG(0x14500)
92#define S5P_CLKDIV_CPU1 S5P_CLKREG(0x14504)
83#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600) 93#define S5P_CLKDIV_STATCPU S5P_CLKREG(0x14600)
94#define S5P_CLKDIV_STATCPU1 S5P_CLKREG(0x14604)
84 95
85#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) 96#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800)
86 97
98/* APLL_LOCK */
99#define S5P_APLL_LOCKTIME (0x1C20) /* 300us */
100
101/* APLL_CON0 */
102#define S5P_APLLCON0_ENABLE_SHIFT (31)
103#define S5P_APLLCON0_LOCKED_SHIFT (29)
104#define S5P_APLL_VAL_1000 ((250 << 16) | (6 << 8) | 1)
105#define S5P_APLL_VAL_800 ((200 << 16) | (6 << 8) | 1)
106
107/* CLK_SRC_CPU */
108#define S5P_CLKSRC_CPU_MUXCORE_SHIFT (16)
109#define S5P_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << S5P_CLKSRC_CPU_MUXCORE_SHIFT)
110
111/* CLKDIV_CPU0 */
112#define S5P_CLKDIV_CPU0_CORE_SHIFT (0)
113#define S5P_CLKDIV_CPU0_CORE_MASK (0x7 << S5P_CLKDIV_CPU0_CORE_SHIFT)
114#define S5P_CLKDIV_CPU0_COREM0_SHIFT (4)
115#define S5P_CLKDIV_CPU0_COREM0_MASK (0x7 << S5P_CLKDIV_CPU0_COREM0_SHIFT)
116#define S5P_CLKDIV_CPU0_COREM1_SHIFT (8)
117#define S5P_CLKDIV_CPU0_COREM1_MASK (0x7 << S5P_CLKDIV_CPU0_COREM1_SHIFT)
118#define S5P_CLKDIV_CPU0_PERIPH_SHIFT (12)
119#define S5P_CLKDIV_CPU0_PERIPH_MASK (0x7 << S5P_CLKDIV_CPU0_PERIPH_SHIFT)
120#define S5P_CLKDIV_CPU0_ATB_SHIFT (16)
121#define S5P_CLKDIV_CPU0_ATB_MASK (0x7 << S5P_CLKDIV_CPU0_ATB_SHIFT)
122#define S5P_CLKDIV_CPU0_PCLKDBG_SHIFT (20)
123#define S5P_CLKDIV_CPU0_PCLKDBG_MASK (0x7 << S5P_CLKDIV_CPU0_PCLKDBG_SHIFT)
124#define S5P_CLKDIV_CPU0_APLL_SHIFT (24)
125#define S5P_CLKDIV_CPU0_APLL_MASK (0x7 << S5P_CLKDIV_CPU0_APLL_SHIFT)
126
127/* CLKDIV_DMC0 */
128#define S5P_CLKDIV_DMC0_ACP_SHIFT (0)
129#define S5P_CLKDIV_DMC0_ACP_MASK (0x7 << S5P_CLKDIV_DMC0_ACP_SHIFT)
130#define S5P_CLKDIV_DMC0_ACPPCLK_SHIFT (4)
131#define S5P_CLKDIV_DMC0_ACPPCLK_MASK (0x7 << S5P_CLKDIV_DMC0_ACPPCLK_SHIFT)
132#define S5P_CLKDIV_DMC0_DPHY_SHIFT (8)
133#define S5P_CLKDIV_DMC0_DPHY_MASK (0x7 << S5P_CLKDIV_DMC0_DPHY_SHIFT)
134#define S5P_CLKDIV_DMC0_DMC_SHIFT (12)
135#define S5P_CLKDIV_DMC0_DMC_MASK (0x7 << S5P_CLKDIV_DMC0_DMC_SHIFT)
136#define S5P_CLKDIV_DMC0_DMCD_SHIFT (16)
137#define S5P_CLKDIV_DMC0_DMCD_MASK (0x7 << S5P_CLKDIV_DMC0_DMCD_SHIFT)
138#define S5P_CLKDIV_DMC0_DMCP_SHIFT (20)
139#define S5P_CLKDIV_DMC0_DMCP_MASK (0x7 << S5P_CLKDIV_DMC0_DMCP_SHIFT)
140#define S5P_CLKDIV_DMC0_COPY2_SHIFT (24)
141#define S5P_CLKDIV_DMC0_COPY2_MASK (0x7 << S5P_CLKDIV_DMC0_COPY2_SHIFT)
142#define S5P_CLKDIV_DMC0_CORETI_SHIFT (28)
143#define S5P_CLKDIV_DMC0_CORETI_MASK (0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT)
144
145/* CLKDIV_TOP */
146#define S5P_CLKDIV_TOP_ACLK200_SHIFT (0)
147#define S5P_CLKDIV_TOP_ACLK200_MASK (0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT)
148#define S5P_CLKDIV_TOP_ACLK100_SHIFT (4)
149#define S5P_CLKDIV_TOP_ACLK100_MASK (0xf << S5P_CLKDIV_TOP_ACLK100_SHIFT)
150#define S5P_CLKDIV_TOP_ACLK160_SHIFT (8)
151#define S5P_CLKDIV_TOP_ACLK160_MASK (0x7 << S5P_CLKDIV_TOP_ACLK160_SHIFT)
152#define S5P_CLKDIV_TOP_ACLK133_SHIFT (12)
153#define S5P_CLKDIV_TOP_ACLK133_MASK (0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT)
154#define S5P_CLKDIV_TOP_ONENAND_SHIFT (16)
155#define S5P_CLKDIV_TOP_ONENAND_MASK (0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT)
156
157/* CLKDIV_LEFTBUS / CLKDIV_RIGHTBUS*/
158#define S5P_CLKDIV_BUS_GDLR_SHIFT (0)
159#define S5P_CLKDIV_BUS_GDLR_MASK (0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT)
160#define S5P_CLKDIV_BUS_GPLR_SHIFT (4)
161#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT)
162
87/* Compatibility defines */ 163/* Compatibility defines */
88 164
89#define S5P_EPLL_CON S5P_EPLL_CON0 165#define S5P_EPLL_CON S5P_EPLL_CON0
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-mem.h b/arch/arm/mach-s5pv310/include/mach/regs-mem.h
new file mode 100644
index 000000000000..834227140eaa
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/regs-mem.h
@@ -0,0 +1,23 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-mem.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - SROMC and DMC register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_MEM_H
14#define __ASM_ARCH_REGS_MEM_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_DMC0_MEMCON_OFFSET 0x04
19
20#define S5P_DMC0_MEMTYPE_SHIFT 8
21#define S5P_DMC0_MEMTYPE_MASK 0xF
22
23#endif /* __ASM_ARCH_REGS_MEM_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-pmu.h b/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
new file mode 100644
index 000000000000..fb333d0f6073
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
@@ -0,0 +1,30 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - Power management unit definition
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_PMU_H
14#define __ASM_ARCH_REGS_PMU_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_PMUREG(x) (S5P_VA_PMU + (x))
19
20#define S5P_PMU_CAM_CONF S5P_PMUREG(0x3C00)
21#define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20)
22#define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40)
23#define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60)
24#define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80)
25#define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0)
26#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0)
27
28#define S5P_INT_LOCAL_PWR_EN 0x7
29
30#endif /* __ASM_ARCH_REGS_PMU_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-srom.h b/arch/arm/mach-s5pv310/include/mach/regs-srom.h
deleted file mode 100644
index 1898b3e10550..000000000000
--- a/arch/arm/mach-s5pv310/include/mach/regs-srom.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-srom.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - SROMC register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_SROM_H
14#define __ASM_ARCH_REGS_SROM_H __FILE__
15
16#include <mach/map.h>
17
18#define S5PV310_SROMREG(x) (S5P_VA_SROMC + (x))
19
20#define S5PV310_SROM_BW S5PV310_SROMREG(0x0)
21#define S5PV310_SROM_BC0 S5PV310_SROMREG(0x4)
22#define S5PV310_SROM_BC1 S5PV310_SROMREG(0x8)
23#define S5PV310_SROM_BC2 S5PV310_SROMREG(0xc)
24#define S5PV310_SROM_BC3 S5PV310_SROMREG(0x10)
25
26/* one register BW holds 4 x 4-bit packed settings for NCS0 - NCS3 */
27
28#define S5PV310_SROM_BW__DATAWIDTH__SHIFT 0
29#define S5PV310_SROM_BW__ADDRMODE__SHIFT 1
30#define S5PV310_SROM_BW__WAITENABLE__SHIFT 2
31#define S5PV310_SROM_BW__BYTEENABLE__SHIFT 3
32
33#define S5PV310_SROM_BW__CS_MASK 0xf
34
35#define S5PV310_SROM_BW__NCS0__SHIFT 0
36#define S5PV310_SROM_BW__NCS1__SHIFT 4
37#define S5PV310_SROM_BW__NCS2__SHIFT 8
38#define S5PV310_SROM_BW__NCS3__SHIFT 12
39
40/* applies to same to BCS0 - BCS3 */
41
42#define S5PV310_SROM_BCX__PMC__SHIFT 0
43#define S5PV310_SROM_BCX__TACP__SHIFT 4
44#define S5PV310_SROM_BCX__TCAH__SHIFT 8
45#define S5PV310_SROM_BCX__TCOH__SHIFT 12
46#define S5PV310_SROM_BCX__TACC__SHIFT 16
47#define S5PV310_SROM_BCX__TCOS__SHIFT 24
48#define S5PV310_SROM_BCX__TACS__SHIFT 28
49
50#endif /* __ASM_ARCH_REGS_SROM_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h b/arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h
new file mode 100644
index 000000000000..0b28e81a16f7
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h
@@ -0,0 +1,24 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-sysmmu.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - System MMU register
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_SYSMMU_H
14#define __ASM_ARCH_REGS_SYSMMU_H __FILE__
15
16#define S5P_MMU_CTRL 0x000
17#define S5P_MMU_CFG 0x004
18#define S5P_MMU_STATUS 0x008
19#define S5P_MMU_FLUSH 0x00C
20#define S5P_PT_BASE_ADDR 0x014
21#define S5P_INT_STATUS 0x018
22#define S5P_PAGE_FAULT_ADDR 0x024
23
24#endif /* __ASM_ARCH_REGS_SYSMMU_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/sysmmu.h b/arch/arm/mach-s5pv310/include/mach/sysmmu.h
new file mode 100644
index 000000000000..662fe85ff4d5
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/sysmmu.h
@@ -0,0 +1,119 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/sysmmu.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Samsung sysmmu driver for S5PV310
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARM_ARCH_SYSMMU_H
14#define __ASM_ARM_ARCH_SYSMMU_H __FILE__
15
16enum s5pv310_sysmmu_ips {
17 SYSMMU_MDMA,
18 SYSMMU_SSS,
19 SYSMMU_FIMC0,
20 SYSMMU_FIMC1,
21 SYSMMU_FIMC2,
22 SYSMMU_FIMC3,
23 SYSMMU_JPEG,
24 SYSMMU_FIMD0,
25 SYSMMU_FIMD1,
26 SYSMMU_PCIe,
27 SYSMMU_G2D,
28 SYSMMU_ROTATOR,
29 SYSMMU_MDMA2,
30 SYSMMU_TV,
31 SYSMMU_MFC_L,
32 SYSMMU_MFC_R,
33};
34
35static char *sysmmu_ips_name[S5P_SYSMMU_TOTAL_IPNUM] = {
36 "SYSMMU_MDMA" ,
37 "SYSMMU_SSS" ,
38 "SYSMMU_FIMC0" ,
39 "SYSMMU_FIMC1" ,
40 "SYSMMU_FIMC2" ,
41 "SYSMMU_FIMC3" ,
42 "SYSMMU_JPEG" ,
43 "SYSMMU_FIMD0" ,
44 "SYSMMU_FIMD1" ,
45 "SYSMMU_PCIe" ,
46 "SYSMMU_G2D" ,
47 "SYSMMU_ROTATOR",
48 "SYSMMU_MDMA2" ,
49 "SYSMMU_TV" ,
50 "SYSMMU_MFC_L" ,
51 "SYSMMU_MFC_R" ,
52};
53
54typedef enum s5pv310_sysmmu_ips sysmmu_ips;
55
56struct sysmmu_tt_info {
57 unsigned long *pgd;
58 unsigned long pgd_paddr;
59 unsigned long *pte;
60};
61
62struct sysmmu_controller {
63 const char *name;
64
65 /* channels registers */
66 void __iomem *regs;
67
68 /* channel irq */
69 unsigned int irq;
70
71 sysmmu_ips ips;
72
73 /* Translation Table Info. */
74 struct sysmmu_tt_info *tt_info;
75
76 struct resource *mem;
77 struct device *dev;
78
79 /* SysMMU controller enable - true : enable */
80 bool enable;
81};
82
83/**
84 * s5p_sysmmu_enable() - enable system mmu of ip
85 * @ips: The ip connected system mmu.
86 *
87 * This function enable system mmu to transfer address
88 * from virtual address to physical address
89 */
90int s5p_sysmmu_enable(sysmmu_ips ips);
91
92/**
93 * s5p_sysmmu_disable() - disable sysmmu mmu of ip
94 * @ips: The ip connected system mmu.
95 *
96 * This function disable system mmu to transfer address
97 * from virtual address to physical address
98 */
99int s5p_sysmmu_disable(sysmmu_ips ips);
100
101/**
102 * s5p_sysmmu_set_tablebase_pgd() - set page table base address to refer page table
103 * @ips: The ip connected system mmu.
104 * @pgd: The page table base address.
105 *
106 * This function set page table base address
107 * When system mmu transfer address from virtaul address to physical address,
108 * system mmu refer address information from page table
109 */
110int s5p_sysmmu_set_tablebase_pgd(sysmmu_ips ips, unsigned long pgd);
111
112/**
113 * s5p_sysmmu_tlb_invalidate() - flush all TLB entry in system mmu
114 * @ips: The ip connected system mmu.
115 *
116 * This function flush all TLB entry in system mmu
117 */
118int s5p_sysmmu_tlb_invalidate(sysmmu_ips ips);
119#endif /* __ASM_ARM_ARCH_SYSMMU_H */
diff --git a/arch/arm/mach-s5pv310/irq-combiner.c b/arch/arm/mach-s5pv310/irq-combiner.c
index c3f88c3faf6c..1ea4a9e83bbe 100644
--- a/arch/arm/mach-s5pv310/irq-combiner.c
+++ b/arch/arm/mach-s5pv310/irq-combiner.c
@@ -24,29 +24,32 @@ static DEFINE_SPINLOCK(irq_controller_lock);
24 24
25struct combiner_chip_data { 25struct combiner_chip_data {
26 unsigned int irq_offset; 26 unsigned int irq_offset;
27 unsigned int irq_mask;
27 void __iomem *base; 28 void __iomem *base;
28}; 29};
29 30
30static struct combiner_chip_data combiner_data[MAX_COMBINER_NR]; 31static struct combiner_chip_data combiner_data[MAX_COMBINER_NR];
31 32
32static inline void __iomem *combiner_base(unsigned int irq) 33static inline void __iomem *combiner_base(struct irq_data *data)
33{ 34{
34 struct combiner_chip_data *combiner_data = get_irq_chip_data(irq); 35 struct combiner_chip_data *combiner_data =
36 irq_data_get_irq_chip_data(data);
37
35 return combiner_data->base; 38 return combiner_data->base;
36} 39}
37 40
38static void combiner_mask_irq(unsigned int irq) 41static void combiner_mask_irq(struct irq_data *data)
39{ 42{
40 u32 mask = 1 << (irq % 32); 43 u32 mask = 1 << (data->irq % 32);
41 44
42 __raw_writel(mask, combiner_base(irq) + COMBINER_ENABLE_CLEAR); 45 __raw_writel(mask, combiner_base(data) + COMBINER_ENABLE_CLEAR);
43} 46}
44 47
45static void combiner_unmask_irq(unsigned int irq) 48static void combiner_unmask_irq(struct irq_data *data)
46{ 49{
47 u32 mask = 1 << (irq % 32); 50 u32 mask = 1 << (data->irq % 32);
48 51
49 __raw_writel(mask, combiner_base(irq) + COMBINER_ENABLE_SET); 52 __raw_writel(mask, combiner_base(data) + COMBINER_ENABLE_SET);
50} 53}
51 54
52static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) 55static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
@@ -57,11 +60,12 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
57 unsigned long status; 60 unsigned long status;
58 61
59 /* primary controller ack'ing */ 62 /* primary controller ack'ing */
60 chip->ack(irq); 63 chip->irq_ack(&desc->irq_data);
61 64
62 spin_lock(&irq_controller_lock); 65 spin_lock(&irq_controller_lock);
63 status = __raw_readl(chip_data->base + COMBINER_INT_STATUS); 66 status = __raw_readl(chip_data->base + COMBINER_INT_STATUS);
64 spin_unlock(&irq_controller_lock); 67 spin_unlock(&irq_controller_lock);
68 status &= chip_data->irq_mask;
65 69
66 if (status == 0) 70 if (status == 0)
67 goto out; 71 goto out;
@@ -76,13 +80,13 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
76 80
77 out: 81 out:
78 /* primary controller unmasking */ 82 /* primary controller unmasking */
79 chip->unmask(irq); 83 chip->irq_unmask(&desc->irq_data);
80} 84}
81 85
82static struct irq_chip combiner_chip = { 86static struct irq_chip combiner_chip = {
83 .name = "COMBINER", 87 .name = "COMBINER",
84 .mask = combiner_mask_irq, 88 .irq_mask = combiner_mask_irq,
85 .unmask = combiner_unmask_irq, 89 .irq_unmask = combiner_unmask_irq,
86}; 90};
87 91
88void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq) 92void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq)
@@ -104,10 +108,12 @@ void __init combiner_init(unsigned int combiner_nr, void __iomem *base,
104 108
105 combiner_data[combiner_nr].base = base; 109 combiner_data[combiner_nr].base = base;
106 combiner_data[combiner_nr].irq_offset = irq_start; 110 combiner_data[combiner_nr].irq_offset = irq_start;
111 combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3);
107 112
108 /* Disable all interrupts */ 113 /* Disable all interrupts */
109 114
110 __raw_writel(0xffffffff, base + COMBINER_ENABLE_CLEAR); 115 __raw_writel(combiner_data[combiner_nr].irq_mask,
116 base + COMBINER_ENABLE_CLEAR);
111 117
112 /* Setup the Linux IRQ subsystem */ 118 /* Setup the Linux IRQ subsystem */
113 119
diff --git a/arch/arm/mach-s5pv310/irq-eint.c b/arch/arm/mach-s5pv310/irq-eint.c
index 5877503e92c3..477bd9e97f0f 100644
--- a/arch/arm/mach-s5pv310/irq-eint.c
+++ b/arch/arm/mach-s5pv310/irq-eint.c
@@ -48,42 +48,43 @@ static unsigned int s5pv310_get_irq_nr(unsigned int number)
48 return ret; 48 return ret;
49} 49}
50 50
51static inline void s5pv310_irq_eint_mask(unsigned int irq) 51static inline void s5pv310_irq_eint_mask(struct irq_data *data)
52{ 52{
53 u32 mask; 53 u32 mask;
54 54
55 spin_lock(&eint_lock); 55 spin_lock(&eint_lock);
56 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(irq))); 56 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
57 mask |= eint_irq_to_bit(irq); 57 mask |= eint_irq_to_bit(data->irq);
58 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(irq))); 58 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
59 spin_unlock(&eint_lock); 59 spin_unlock(&eint_lock);
60} 60}
61 61
62static void s5pv310_irq_eint_unmask(unsigned int irq) 62static void s5pv310_irq_eint_unmask(struct irq_data *data)
63{ 63{
64 u32 mask; 64 u32 mask;
65 65
66 spin_lock(&eint_lock); 66 spin_lock(&eint_lock);
67 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(irq))); 67 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
68 mask &= ~(eint_irq_to_bit(irq)); 68 mask &= ~(eint_irq_to_bit(data->irq));
69 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(irq))); 69 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
70 spin_unlock(&eint_lock); 70 spin_unlock(&eint_lock);
71} 71}
72 72
73static inline void s5pv310_irq_eint_ack(unsigned int irq) 73static inline void s5pv310_irq_eint_ack(struct irq_data *data)
74{ 74{
75 __raw_writel(eint_irq_to_bit(irq), S5P_EINT_PEND(EINT_REG_NR(irq))); 75 __raw_writel(eint_irq_to_bit(data->irq),
76 S5P_EINT_PEND(EINT_REG_NR(data->irq)));
76} 77}
77 78
78static void s5pv310_irq_eint_maskack(unsigned int irq) 79static void s5pv310_irq_eint_maskack(struct irq_data *data)
79{ 80{
80 s5pv310_irq_eint_mask(irq); 81 s5pv310_irq_eint_mask(data);
81 s5pv310_irq_eint_ack(irq); 82 s5pv310_irq_eint_ack(data);
82} 83}
83 84
84static int s5pv310_irq_eint_set_type(unsigned int irq, unsigned int type) 85static int s5pv310_irq_eint_set_type(struct irq_data *data, unsigned int type)
85{ 86{
86 int offs = EINT_OFFSET(irq); 87 int offs = EINT_OFFSET(data->irq);
87 int shift; 88 int shift;
88 u32 ctrl, mask; 89 u32 ctrl, mask;
89 u32 newvalue = 0; 90 u32 newvalue = 0;
@@ -118,10 +119,10 @@ static int s5pv310_irq_eint_set_type(unsigned int irq, unsigned int type)
118 mask = 0x7 << shift; 119 mask = 0x7 << shift;
119 120
120 spin_lock(&eint_lock); 121 spin_lock(&eint_lock);
121 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(irq))); 122 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq)));
122 ctrl &= ~mask; 123 ctrl &= ~mask;
123 ctrl |= newvalue << shift; 124 ctrl |= newvalue << shift;
124 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(irq))); 125 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq)));
125 spin_unlock(&eint_lock); 126 spin_unlock(&eint_lock);
126 127
127 switch (offs) { 128 switch (offs) {
@@ -146,13 +147,13 @@ static int s5pv310_irq_eint_set_type(unsigned int irq, unsigned int type)
146 147
147static struct irq_chip s5pv310_irq_eint = { 148static struct irq_chip s5pv310_irq_eint = {
148 .name = "s5pv310-eint", 149 .name = "s5pv310-eint",
149 .mask = s5pv310_irq_eint_mask, 150 .irq_mask = s5pv310_irq_eint_mask,
150 .unmask = s5pv310_irq_eint_unmask, 151 .irq_unmask = s5pv310_irq_eint_unmask,
151 .mask_ack = s5pv310_irq_eint_maskack, 152 .irq_mask_ack = s5pv310_irq_eint_maskack,
152 .ack = s5pv310_irq_eint_ack, 153 .irq_ack = s5pv310_irq_eint_ack,
153 .set_type = s5pv310_irq_eint_set_type, 154 .irq_set_type = s5pv310_irq_eint_set_type,
154#ifdef CONFIG_PM 155#ifdef CONFIG_PM
155 .set_wake = s3c_irqext_wake, 156 .irq_set_wake = s3c_irqext_wake,
156#endif 157#endif
157}; 158};
158 159
@@ -192,14 +193,14 @@ static void s5pv310_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
192 u32 *irq_data = get_irq_data(irq); 193 u32 *irq_data = get_irq_data(irq);
193 struct irq_chip *chip = get_irq_chip(irq); 194 struct irq_chip *chip = get_irq_chip(irq);
194 195
195 chip->mask(irq); 196 chip->irq_mask(&desc->irq_data);
196 197
197 if (chip->ack) 198 if (chip->irq_ack)
198 chip->ack(irq); 199 chip->irq_ack(&desc->irq_data);
199 200
200 generic_handle_irq(*irq_data); 201 generic_handle_irq(*irq_data);
201 202
202 chip->unmask(irq); 203 chip->irq_unmask(&desc->irq_data);
203} 204}
204 205
205int __init s5pv310_init_irq_eint(void) 206int __init s5pv310_init_irq_eint(void)
diff --git a/arch/arm/mach-s5pv310/mach-smdkc210.c b/arch/arm/mach-s5pv310/mach-smdkc210.c
index 2b8d4fc52d7c..2d49273c0a26 100644
--- a/arch/arm/mach-s5pv310/mach-smdkc210.c
+++ b/arch/arm/mach-s5pv310/mach-smdkc210.c
@@ -14,18 +14,21 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/smsc911x.h> 15#include <linux/smsc911x.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/i2c.h>
17 18
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20 21
21#include <plat/regs-serial.h> 22#include <plat/regs-serial.h>
23#include <plat/regs-srom.h>
22#include <plat/s5pv310.h> 24#include <plat/s5pv310.h>
23#include <plat/cpu.h> 25#include <plat/cpu.h>
24#include <plat/devs.h> 26#include <plat/devs.h>
25#include <plat/sdhci.h> 27#include <plat/sdhci.h>
28#include <plat/iic.h>
29#include <plat/pd.h>
26 30
27#include <mach/map.h> 31#include <mach/map.h>
28#include <mach/regs-srom.h>
29 32
30/* Following are default values for UCON, ULCON and UFCON UART registers */ 33/* Following are default values for UCON, ULCON and UFCON UART registers */
31#define SMDKC210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 34#define SMDKC210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -139,14 +142,29 @@ static struct platform_device smdkc210_smsc911x = {
139 }, 142 },
140}; 143};
141 144
145static struct i2c_board_info i2c_devs1[] __initdata = {
146 {I2C_BOARD_INFO("wm8994", 0x1a),},
147};
148
142static struct platform_device *smdkc210_devices[] __initdata = { 149static struct platform_device *smdkc210_devices[] __initdata = {
143 &s3c_device_hsmmc0, 150 &s3c_device_hsmmc0,
144 &s3c_device_hsmmc1, 151 &s3c_device_hsmmc1,
145 &s3c_device_hsmmc2, 152 &s3c_device_hsmmc2,
146 &s3c_device_hsmmc3, 153 &s3c_device_hsmmc3,
154 &s3c_device_i2c1,
147 &s3c_device_rtc, 155 &s3c_device_rtc,
148 &s3c_device_wdt, 156 &s3c_device_wdt,
157 &s5pv310_device_ac97,
158 &s5pv310_device_i2s0,
159 &s5pv310_device_pd[PD_MFC],
160 &s5pv310_device_pd[PD_G3D],
161 &s5pv310_device_pd[PD_LCD0],
162 &s5pv310_device_pd[PD_LCD1],
163 &s5pv310_device_pd[PD_CAM],
164 &s5pv310_device_pd[PD_TV],
165 &s5pv310_device_pd[PD_GPS],
149 &smdkc210_smsc911x, 166 &smdkc210_smsc911x,
167 &s5pv310_device_sysmmu,
150}; 168};
151 169
152static void __init smdkc210_smsc911x_init(void) 170static void __init smdkc210_smsc911x_init(void)
@@ -154,23 +172,22 @@ static void __init smdkc210_smsc911x_init(void)
154 u32 cs1; 172 u32 cs1;
155 173
156 /* configure nCS1 width to 16 bits */ 174 /* configure nCS1 width to 16 bits */
157 cs1 = __raw_readl(S5PV310_SROM_BW) & 175 cs1 = __raw_readl(S5P_SROM_BW) &
158 ~(S5PV310_SROM_BW__CS_MASK << 176 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
159 S5PV310_SROM_BW__NCS1__SHIFT); 177 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
160 cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) | 178 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
161 (1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) | 179 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
162 (1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) << 180 S5P_SROM_BW__NCS1__SHIFT;
163 S5PV310_SROM_BW__NCS1__SHIFT; 181 __raw_writel(cs1, S5P_SROM_BW);
164 __raw_writel(cs1, S5PV310_SROM_BW);
165 182
166 /* set timing for nCS1 suitable for ethernet chip */ 183 /* set timing for nCS1 suitable for ethernet chip */
167 __raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) | 184 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
168 (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) | 185 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
169 (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) | 186 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
170 (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) | 187 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
171 (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) | 188 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
172 (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) | 189 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
173 (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1); 190 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
174} 191}
175 192
176static void __init smdkc210_map_io(void) 193static void __init smdkc210_map_io(void)
@@ -182,6 +199,9 @@ static void __init smdkc210_map_io(void)
182 199
183static void __init smdkc210_machine_init(void) 200static void __init smdkc210_machine_init(void)
184{ 201{
202 s3c_i2c1_set_platdata(NULL);
203 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
204
185 smdkc210_smsc911x_init(); 205 smdkc210_smsc911x_init();
186 206
187 s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata); 207 s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
diff --git a/arch/arm/mach-s5pv310/mach-smdkv310.c b/arch/arm/mach-s5pv310/mach-smdkv310.c
index 35826d66632c..28680cf9a72c 100644
--- a/arch/arm/mach-s5pv310/mach-smdkv310.c
+++ b/arch/arm/mach-s5pv310/mach-smdkv310.c
@@ -14,18 +14,21 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/smsc911x.h> 15#include <linux/smsc911x.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/i2c.h>
17 18
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20 21
21#include <plat/regs-serial.h> 22#include <plat/regs-serial.h>
23#include <plat/regs-srom.h>
22#include <plat/s5pv310.h> 24#include <plat/s5pv310.h>
23#include <plat/cpu.h> 25#include <plat/cpu.h>
24#include <plat/devs.h> 26#include <plat/devs.h>
25#include <plat/sdhci.h> 27#include <plat/sdhci.h>
28#include <plat/iic.h>
29#include <plat/pd.h>
26 30
27#include <mach/map.h> 31#include <mach/map.h>
28#include <mach/regs-srom.h>
29 32
30/* Following are default values for UCON, ULCON and UFCON UART registers */ 33/* Following are default values for UCON, ULCON and UFCON UART registers */
31#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 34#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -139,14 +142,29 @@ static struct platform_device smdkv310_smsc911x = {
139 }, 142 },
140}; 143};
141 144
145static struct i2c_board_info i2c_devs1[] __initdata = {
146 {I2C_BOARD_INFO("wm8994", 0x1a),},
147};
148
142static struct platform_device *smdkv310_devices[] __initdata = { 149static struct platform_device *smdkv310_devices[] __initdata = {
143 &s3c_device_hsmmc0, 150 &s3c_device_hsmmc0,
144 &s3c_device_hsmmc1, 151 &s3c_device_hsmmc1,
145 &s3c_device_hsmmc2, 152 &s3c_device_hsmmc2,
146 &s3c_device_hsmmc3, 153 &s3c_device_hsmmc3,
154 &s3c_device_i2c1,
147 &s3c_device_rtc, 155 &s3c_device_rtc,
148 &s3c_device_wdt, 156 &s3c_device_wdt,
157 &s5pv310_device_ac97,
158 &s5pv310_device_i2s0,
159 &s5pv310_device_pd[PD_MFC],
160 &s5pv310_device_pd[PD_G3D],
161 &s5pv310_device_pd[PD_LCD0],
162 &s5pv310_device_pd[PD_LCD1],
163 &s5pv310_device_pd[PD_CAM],
164 &s5pv310_device_pd[PD_TV],
165 &s5pv310_device_pd[PD_GPS],
149 &smdkv310_smsc911x, 166 &smdkv310_smsc911x,
167 &s5pv310_device_sysmmu,
150}; 168};
151 169
152static void __init smdkv310_smsc911x_init(void) 170static void __init smdkv310_smsc911x_init(void)
@@ -154,23 +172,22 @@ static void __init smdkv310_smsc911x_init(void)
154 u32 cs1; 172 u32 cs1;
155 173
156 /* configure nCS1 width to 16 bits */ 174 /* configure nCS1 width to 16 bits */
157 cs1 = __raw_readl(S5PV310_SROM_BW) & 175 cs1 = __raw_readl(S5P_SROM_BW) &
158 ~(S5PV310_SROM_BW__CS_MASK << 176 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
159 S5PV310_SROM_BW__NCS1__SHIFT); 177 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
160 cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) | 178 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
161 (1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) | 179 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
162 (1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) << 180 S5P_SROM_BW__NCS1__SHIFT;
163 S5PV310_SROM_BW__NCS1__SHIFT; 181 __raw_writel(cs1, S5P_SROM_BW);
164 __raw_writel(cs1, S5PV310_SROM_BW);
165 182
166 /* set timing for nCS1 suitable for ethernet chip */ 183 /* set timing for nCS1 suitable for ethernet chip */
167 __raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) | 184 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
168 (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) | 185 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
169 (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) | 186 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
170 (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) | 187 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
171 (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) | 188 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
172 (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) | 189 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
173 (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1); 190 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
174} 191}
175 192
176static void __init smdkv310_map_io(void) 193static void __init smdkv310_map_io(void)
@@ -182,6 +199,9 @@ static void __init smdkv310_map_io(void)
182 199
183static void __init smdkv310_machine_init(void) 200static void __init smdkv310_machine_init(void)
184{ 201{
202 s3c_i2c1_set_platdata(NULL);
203 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
204
185 smdkv310_smsc911x_init(); 205 smdkv310_smsc911x_init();
186 206
187 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata); 207 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c b/arch/arm/mach-s5pv310/mach-universal_c210.c
index 16d8fc00cafd..36bc3cf825e3 100644
--- a/arch/arm/mach-s5pv310/mach-universal_c210.c
+++ b/arch/arm/mach-s5pv310/mach-universal_c210.c
@@ -13,6 +13,9 @@
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/gpio_keys.h> 14#include <linux/gpio_keys.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/regulator/machine.h>
17#include <linux/regulator/fixed.h>
18#include <linux/mmc/host.h>
16 19
17#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
18#include <asm/mach-types.h> 21#include <asm/mach-types.h>
@@ -21,6 +24,7 @@
21#include <plat/s5pv310.h> 24#include <plat/s5pv310.h>
22#include <plat/cpu.h> 25#include <plat/cpu.h>
23#include <plat/devs.h> 26#include <plat/devs.h>
27#include <plat/sdhci.h>
24 28
25#include <mach/map.h> 29#include <mach/map.h>
26 30
@@ -116,6 +120,73 @@ static struct platform_device universal_gpio_keys = {
116 }, 120 },
117}; 121};
118 122
123/* eMMC */
124static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
125 .max_width = 8,
126 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
127 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
128 MMC_CAP_DISABLE),
129 .cd_type = S3C_SDHCI_CD_PERMANENT,
130 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
131};
132
133static struct regulator_consumer_supply mmc0_supplies[] = {
134 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
135};
136
137static struct regulator_init_data mmc0_fixed_voltage_init_data = {
138 .constraints = {
139 .name = "VMEM_VDD_2.8V",
140 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
141 },
142 .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
143 .consumer_supplies = mmc0_supplies,
144};
145
146static struct fixed_voltage_config mmc0_fixed_voltage_config = {
147 .supply_name = "MASSMEMORY_EN",
148 .microvolts = 2800000,
149 .gpio = S5PV310_GPE1(3),
150 .enable_high = true,
151 .init_data = &mmc0_fixed_voltage_init_data,
152};
153
154static struct platform_device mmc0_fixed_voltage = {
155 .name = "reg-fixed-voltage",
156 .id = 0,
157 .dev = {
158 .platform_data = &mmc0_fixed_voltage_config,
159 },
160};
161
162/* SD */
163static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
164 .max_width = 4,
165 .host_caps = MMC_CAP_4_BIT_DATA |
166 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
167 MMC_CAP_DISABLE,
168 .ext_cd_gpio = S5PV310_GPX3(4), /* XEINT_28 */
169 .ext_cd_gpio_invert = 1,
170 .cd_type = S3C_SDHCI_CD_GPIO,
171 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
172};
173
174/* WiFi */
175static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
176 .max_width = 4,
177 .host_caps = MMC_CAP_4_BIT_DATA |
178 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
179 MMC_CAP_DISABLE,
180 .cd_type = S3C_SDHCI_CD_EXTERNAL,
181};
182
183static void __init universal_sdhci_init(void)
184{
185 s3c_sdhci0_set_platdata(&universal_hsmmc0_data);
186 s3c_sdhci2_set_platdata(&universal_hsmmc2_data);
187 s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
188}
189
119/* I2C0 */ 190/* I2C0 */
120static struct i2c_board_info i2c0_devs[] __initdata = { 191static struct i2c_board_info i2c0_devs[] __initdata = {
121 /* Camera, To be updated */ 192 /* Camera, To be updated */
@@ -127,6 +198,13 @@ static struct i2c_board_info i2c1_devs[] __initdata = {
127}; 198};
128 199
129static struct platform_device *universal_devices[] __initdata = { 200static struct platform_device *universal_devices[] __initdata = {
201 /* Samsung Platform Devices */
202 &mmc0_fixed_voltage,
203 &s3c_device_hsmmc0,
204 &s3c_device_hsmmc2,
205 &s3c_device_hsmmc3,
206
207 /* Universal Devices */
130 &universal_gpio_keys, 208 &universal_gpio_keys,
131 &s5p_device_onenand, 209 &s5p_device_onenand,
132}; 210};
@@ -140,6 +218,8 @@ static void __init universal_map_io(void)
140 218
141static void __init universal_machine_init(void) 219static void __init universal_machine_init(void)
142{ 220{
221 universal_sdhci_init();
222
143 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs)); 223 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
144 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); 224 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
145 225
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 3093d46a9c6f..3d85dfad9c1f 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -37,14 +37,14 @@ static int GPIO_IRQ_mask = (1 << 11) - 1;
37#define GPIO_11_27_IRQ(i) ((i) - 21) 37#define GPIO_11_27_IRQ(i) ((i) - 21)
38#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq)) 38#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq))
39 39
40static int sa1100_gpio_type(unsigned int irq, unsigned int type) 40static int sa1100_gpio_type(struct irq_data *d, unsigned int type)
41{ 41{
42 unsigned int mask; 42 unsigned int mask;
43 43
44 if (irq <= 10) 44 if (d->irq <= 10)
45 mask = 1 << irq; 45 mask = 1 << d->irq;
46 else 46 else
47 mask = GPIO11_27_MASK(irq); 47 mask = GPIO11_27_MASK(d->irq);
48 48
49 if (type == IRQ_TYPE_PROBE) { 49 if (type == IRQ_TYPE_PROBE) {
50 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask) 50 if ((GPIO_IRQ_rising_edge | GPIO_IRQ_falling_edge) & mask)
@@ -70,37 +70,37 @@ static int sa1100_gpio_type(unsigned int irq, unsigned int type)
70/* 70/*
71 * GPIO IRQs must be acknowledged. This is for IRQs from 0 to 10. 71 * GPIO IRQs must be acknowledged. This is for IRQs from 0 to 10.
72 */ 72 */
73static void sa1100_low_gpio_ack(unsigned int irq) 73static void sa1100_low_gpio_ack(struct irq_data *d)
74{ 74{
75 GEDR = (1 << irq); 75 GEDR = (1 << d->irq);
76} 76}
77 77
78static void sa1100_low_gpio_mask(unsigned int irq) 78static void sa1100_low_gpio_mask(struct irq_data *d)
79{ 79{
80 ICMR &= ~(1 << irq); 80 ICMR &= ~(1 << d->irq);
81} 81}
82 82
83static void sa1100_low_gpio_unmask(unsigned int irq) 83static void sa1100_low_gpio_unmask(struct irq_data *d)
84{ 84{
85 ICMR |= 1 << irq; 85 ICMR |= 1 << d->irq;
86} 86}
87 87
88static int sa1100_low_gpio_wake(unsigned int irq, unsigned int on) 88static int sa1100_low_gpio_wake(struct irq_data *d, unsigned int on)
89{ 89{
90 if (on) 90 if (on)
91 PWER |= 1 << irq; 91 PWER |= 1 << d->irq;
92 else 92 else
93 PWER &= ~(1 << irq); 93 PWER &= ~(1 << d->irq);
94 return 0; 94 return 0;
95} 95}
96 96
97static struct irq_chip sa1100_low_gpio_chip = { 97static struct irq_chip sa1100_low_gpio_chip = {
98 .name = "GPIO-l", 98 .name = "GPIO-l",
99 .ack = sa1100_low_gpio_ack, 99 .irq_ack = sa1100_low_gpio_ack,
100 .mask = sa1100_low_gpio_mask, 100 .irq_mask = sa1100_low_gpio_mask,
101 .unmask = sa1100_low_gpio_unmask, 101 .irq_unmask = sa1100_low_gpio_unmask,
102 .set_type = sa1100_gpio_type, 102 .irq_set_type = sa1100_gpio_type,
103 .set_wake = sa1100_low_gpio_wake, 103 .irq_set_wake = sa1100_low_gpio_wake,
104}; 104};
105 105
106/* 106/*
@@ -139,16 +139,16 @@ sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)
139 * In addition, the IRQs are all collected up into one bit in the 139 * In addition, the IRQs are all collected up into one bit in the
140 * interrupt controller registers. 140 * interrupt controller registers.
141 */ 141 */
142static void sa1100_high_gpio_ack(unsigned int irq) 142static void sa1100_high_gpio_ack(struct irq_data *d)
143{ 143{
144 unsigned int mask = GPIO11_27_MASK(irq); 144 unsigned int mask = GPIO11_27_MASK(d->irq);
145 145
146 GEDR = mask; 146 GEDR = mask;
147} 147}
148 148
149static void sa1100_high_gpio_mask(unsigned int irq) 149static void sa1100_high_gpio_mask(struct irq_data *d)
150{ 150{
151 unsigned int mask = GPIO11_27_MASK(irq); 151 unsigned int mask = GPIO11_27_MASK(d->irq);
152 152
153 GPIO_IRQ_mask &= ~mask; 153 GPIO_IRQ_mask &= ~mask;
154 154
@@ -156,9 +156,9 @@ static void sa1100_high_gpio_mask(unsigned int irq)
156 GFER &= ~mask; 156 GFER &= ~mask;
157} 157}
158 158
159static void sa1100_high_gpio_unmask(unsigned int irq) 159static void sa1100_high_gpio_unmask(struct irq_data *d)
160{ 160{
161 unsigned int mask = GPIO11_27_MASK(irq); 161 unsigned int mask = GPIO11_27_MASK(d->irq);
162 162
163 GPIO_IRQ_mask |= mask; 163 GPIO_IRQ_mask |= mask;
164 164
@@ -166,44 +166,44 @@ static void sa1100_high_gpio_unmask(unsigned int irq)
166 GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; 166 GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask;
167} 167}
168 168
169static int sa1100_high_gpio_wake(unsigned int irq, unsigned int on) 169static int sa1100_high_gpio_wake(struct irq_data *d, unsigned int on)
170{ 170{
171 if (on) 171 if (on)
172 PWER |= GPIO11_27_MASK(irq); 172 PWER |= GPIO11_27_MASK(d->irq);
173 else 173 else
174 PWER &= ~GPIO11_27_MASK(irq); 174 PWER &= ~GPIO11_27_MASK(d->irq);
175 return 0; 175 return 0;
176} 176}
177 177
178static struct irq_chip sa1100_high_gpio_chip = { 178static struct irq_chip sa1100_high_gpio_chip = {
179 .name = "GPIO-h", 179 .name = "GPIO-h",
180 .ack = sa1100_high_gpio_ack, 180 .irq_ack = sa1100_high_gpio_ack,
181 .mask = sa1100_high_gpio_mask, 181 .irq_mask = sa1100_high_gpio_mask,
182 .unmask = sa1100_high_gpio_unmask, 182 .irq_unmask = sa1100_high_gpio_unmask,
183 .set_type = sa1100_gpio_type, 183 .irq_set_type = sa1100_gpio_type,
184 .set_wake = sa1100_high_gpio_wake, 184 .irq_set_wake = sa1100_high_gpio_wake,
185}; 185};
186 186
187/* 187/*
188 * We don't need to ACK IRQs on the SA1100 unless they're GPIOs 188 * We don't need to ACK IRQs on the SA1100 unless they're GPIOs
189 * this is for internal IRQs i.e. from 11 to 31. 189 * this is for internal IRQs i.e. from 11 to 31.
190 */ 190 */
191static void sa1100_mask_irq(unsigned int irq) 191static void sa1100_mask_irq(struct irq_data *d)
192{ 192{
193 ICMR &= ~(1 << irq); 193 ICMR &= ~(1 << d->irq);
194} 194}
195 195
196static void sa1100_unmask_irq(unsigned int irq) 196static void sa1100_unmask_irq(struct irq_data *d)
197{ 197{
198 ICMR |= (1 << irq); 198 ICMR |= (1 << d->irq);
199} 199}
200 200
201/* 201/*
202 * Apart form GPIOs, only the RTC alarm can be a wakeup event. 202 * Apart form GPIOs, only the RTC alarm can be a wakeup event.
203 */ 203 */
204static int sa1100_set_wake(unsigned int irq, unsigned int on) 204static int sa1100_set_wake(struct irq_data *d, unsigned int on)
205{ 205{
206 if (irq == IRQ_RTCAlrm) { 206 if (d->irq == IRQ_RTCAlrm) {
207 if (on) 207 if (on)
208 PWER |= PWER_RTC; 208 PWER |= PWER_RTC;
209 else 209 else
@@ -215,10 +215,10 @@ static int sa1100_set_wake(unsigned int irq, unsigned int on)
215 215
216static struct irq_chip sa1100_normal_chip = { 216static struct irq_chip sa1100_normal_chip = {
217 .name = "SC", 217 .name = "SC",
218 .ack = sa1100_mask_irq, 218 .irq_ack = sa1100_mask_irq,
219 .mask = sa1100_mask_irq, 219 .irq_mask = sa1100_mask_irq,
220 .unmask = sa1100_unmask_irq, 220 .irq_unmask = sa1100_unmask_irq,
221 .set_wake = sa1100_set_wake, 221 .irq_set_wake = sa1100_set_wake,
222}; 222};
223 223
224static struct resource irq_resource = { 224static struct resource irq_resource = {
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index c601a75a333d..4aad01f73660 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -35,7 +35,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
35 /* 35 /*
36 * Acknowledge the parent IRQ. 36 * Acknowledge the parent IRQ.
37 */ 37 */
38 desc->chip->ack(irq); 38 desc->irq_data.chip->irq_ack(&desc->irq_data);
39 39
40 /* 40 /*
41 * Read the interrupt reason register. Let's have all 41 * Read the interrupt reason register. Let's have all
@@ -53,7 +53,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
53 * recheck the register for any pending IRQs. 53 * recheck the register for any pending IRQs.
54 */ 54 */
55 if (irr & (IRR_ETHERNET | IRR_USAR)) { 55 if (irr & (IRR_ETHERNET | IRR_USAR)) {
56 desc->chip->mask(irq); 56 desc->irq_data.chip->irq_mask(&desc->irq_data);
57 57
58 /* 58 /*
59 * Ack the interrupt now to prevent re-entering 59 * Ack the interrupt now to prevent re-entering
@@ -61,7 +61,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
61 * since we'll check the IRR register prior to 61 * since we'll check the IRR register prior to
62 * leaving. 62 * leaving.
63 */ 63 */
64 desc->chip->ack(irq); 64 desc->irq_data.chip->irq_ack(&desc->irq_data);
65 65
66 if (irr & IRR_ETHERNET) { 66 if (irr & IRR_ETHERNET) {
67 generic_handle_irq(IRQ_NEPONSET_SMC9196); 67 generic_handle_irq(IRQ_NEPONSET_SMC9196);
@@ -71,7 +71,7 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
71 generic_handle_irq(IRQ_NEPONSET_USAR); 71 generic_handle_irq(IRQ_NEPONSET_USAR);
72 } 72 }
73 73
74 desc->chip->unmask(irq); 74 desc->irq_data.chip->irq_unmask(&desc->irq_data);
75 } 75 }
76 76
77 if (irr & IRR_SA1111) { 77 if (irr & IRR_SA1111) {
diff --git a/arch/arm/mach-shark/irq.c b/arch/arm/mach-shark/irq.c
index c04eb6a1e2be..831fc66dfa4d 100644
--- a/arch/arm/mach-shark/irq.c
+++ b/arch/arm/mach-shark/irq.c
@@ -30,35 +30,35 @@ static unsigned char cached_irq_mask[2] = { 0xfb, 0xff };
30 * These have to be protected by the irq controller spinlock 30 * These have to be protected by the irq controller spinlock
31 * before being called. 31 * before being called.
32 */ 32 */
33static void shark_disable_8259A_irq(unsigned int irq) 33static void shark_disable_8259A_irq(struct irq_data *d)
34{ 34{
35 unsigned int mask; 35 unsigned int mask;
36 if (irq<8) { 36 if (d->irq<8) {
37 mask = 1 << irq; 37 mask = 1 << d->irq;
38 cached_irq_mask[0] |= mask; 38 cached_irq_mask[0] |= mask;
39 outb(cached_irq_mask[1],0xA1); 39 outb(cached_irq_mask[1],0xA1);
40 } else { 40 } else {
41 mask = 1 << (irq-8); 41 mask = 1 << (d->irq-8);
42 cached_irq_mask[1] |= mask; 42 cached_irq_mask[1] |= mask;
43 outb(cached_irq_mask[0],0x21); 43 outb(cached_irq_mask[0],0x21);
44 } 44 }
45} 45}
46 46
47static void shark_enable_8259A_irq(unsigned int irq) 47static void shark_enable_8259A_irq(struct irq_data *d)
48{ 48{
49 unsigned int mask; 49 unsigned int mask;
50 if (irq<8) { 50 if (d->irq<8) {
51 mask = ~(1 << irq); 51 mask = ~(1 << d->irq);
52 cached_irq_mask[0] &= mask; 52 cached_irq_mask[0] &= mask;
53 outb(cached_irq_mask[0],0x21); 53 outb(cached_irq_mask[0],0x21);
54 } else { 54 } else {
55 mask = ~(1 << (irq-8)); 55 mask = ~(1 << (d->irq-8));
56 cached_irq_mask[1] &= mask; 56 cached_irq_mask[1] &= mask;
57 outb(cached_irq_mask[1],0xA1); 57 outb(cached_irq_mask[1],0xA1);
58 } 58 }
59} 59}
60 60
61static void shark_ack_8259A_irq(unsigned int irq){} 61static void shark_ack_8259A_irq(struct irq_data *d){}
62 62
63static irqreturn_t bogus_int(int irq, void *dev_id) 63static irqreturn_t bogus_int(int irq, void *dev_id)
64{ 64{
@@ -69,10 +69,10 @@ static irqreturn_t bogus_int(int irq, void *dev_id)
69static struct irqaction cascade; 69static struct irqaction cascade;
70 70
71static struct irq_chip fb_chip = { 71static struct irq_chip fb_chip = {
72 .name = "XT-PIC", 72 .name = "XT-PIC",
73 .ack = shark_ack_8259A_irq, 73 .irq_ack = shark_ack_8259A_irq,
74 .mask = shark_disable_8259A_irq, 74 .irq_mask = shark_disable_8259A_irq,
75 .unmask = shark_enable_8259A_irq, 75 .irq_unmask = shark_enable_8259A_irq,
76}; 76};
77 77
78void __init shark_init_irq(void) 78void __init shark_init_irq(void)
diff --git a/arch/arm/mach-stmp378x/stmp378x.c b/arch/arm/mach-stmp378x/stmp378x.c
index ddd49a760fd4..c2f9fe04c112 100644
--- a/arch/arm/mach-stmp378x/stmp378x.c
+++ b/arch/arm/mach-stmp378x/stmp378x.c
@@ -47,7 +47,7 @@
47/* 47/*
48 * IRQ handling 48 * IRQ handling
49 */ 49 */
50static void stmp378x_ack_irq(unsigned int irq) 50static void stmp378x_ack_irq(struct irq_data *d)
51{ 51{
52 /* Tell ICOLL to release IRQ line */ 52 /* Tell ICOLL to release IRQ line */
53 __raw_writel(0, REGS_ICOLL_BASE + HW_ICOLL_VECTOR); 53 __raw_writel(0, REGS_ICOLL_BASE + HW_ICOLL_VECTOR);
@@ -60,24 +60,24 @@ static void stmp378x_ack_irq(unsigned int irq)
60 (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT); 60 (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT);
61} 61}
62 62
63static void stmp378x_mask_irq(unsigned int irq) 63static void stmp378x_mask_irq(struct irq_data *d)
64{ 64{
65 /* IRQ disable */ 65 /* IRQ disable */
66 stmp3xxx_clearl(BM_ICOLL_INTERRUPTn_ENABLE, 66 stmp3xxx_clearl(BM_ICOLL_INTERRUPTn_ENABLE,
67 REGS_ICOLL_BASE + HW_ICOLL_INTERRUPTn + irq * 0x10); 67 REGS_ICOLL_BASE + HW_ICOLL_INTERRUPTn + d->irq * 0x10);
68} 68}
69 69
70static void stmp378x_unmask_irq(unsigned int irq) 70static void stmp378x_unmask_irq(struct irq_data *d)
71{ 71{
72 /* IRQ enable */ 72 /* IRQ enable */
73 stmp3xxx_setl(BM_ICOLL_INTERRUPTn_ENABLE, 73 stmp3xxx_setl(BM_ICOLL_INTERRUPTn_ENABLE,
74 REGS_ICOLL_BASE + HW_ICOLL_INTERRUPTn + irq * 0x10); 74 REGS_ICOLL_BASE + HW_ICOLL_INTERRUPTn + d->irq * 0x10);
75} 75}
76 76
77static struct irq_chip stmp378x_chip = { 77static struct irq_chip stmp378x_chip = {
78 .ack = stmp378x_ack_irq, 78 .irq_ack = stmp378x_ack_irq,
79 .mask = stmp378x_mask_irq, 79 .irq_mask = stmp378x_mask_irq,
80 .unmask = stmp378x_unmask_irq, 80 .irq_unmask = stmp378x_unmask_irq,
81}; 81};
82 82
83void __init stmp378x_init_irq(void) 83void __init stmp378x_init_irq(void)
diff --git a/arch/arm/mach-stmp37xx/stmp37xx.c b/arch/arm/mach-stmp37xx/stmp37xx.c
index 8c7d6fb191a3..a9aed06ff376 100644
--- a/arch/arm/mach-stmp37xx/stmp37xx.c
+++ b/arch/arm/mach-stmp37xx/stmp37xx.c
@@ -43,11 +43,11 @@
43/* 43/*
44 * IRQ handling 44 * IRQ handling
45 */ 45 */
46static void stmp37xx_ack_irq(unsigned int irq) 46static void stmp37xx_ack_irq(struct irq_data *d)
47{ 47{
48 /* Disable IRQ */ 48 /* Disable IRQ */
49 stmp3xxx_clearl(0x04 << ((irq % 4) * 8), 49 stmp3xxx_clearl(0x04 << ((d->irq % 4) * 8),
50 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + irq / 4 * 0x10); 50 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + d->irq / 4 * 0x10);
51 51
52 /* ACK current interrupt */ 52 /* ACK current interrupt */
53 __raw_writel(1, REGS_ICOLL_BASE + HW_ICOLL_LEVELACK); 53 __raw_writel(1, REGS_ICOLL_BASE + HW_ICOLL_LEVELACK);
@@ -56,24 +56,24 @@ static void stmp37xx_ack_irq(unsigned int irq)
56 (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT); 56 (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT);
57} 57}
58 58
59static void stmp37xx_mask_irq(unsigned int irq) 59static void stmp37xx_mask_irq(struct irq_data *d)
60{ 60{
61 /* IRQ disable */ 61 /* IRQ disable */
62 stmp3xxx_clearl(0x04 << ((irq % 4) * 8), 62 stmp3xxx_clearl(0x04 << ((d->irq % 4) * 8),
63 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + irq / 4 * 0x10); 63 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + d->irq / 4 * 0x10);
64} 64}
65 65
66static void stmp37xx_unmask_irq(unsigned int irq) 66static void stmp37xx_unmask_irq(struct irq_data *d)
67{ 67{
68 /* IRQ enable */ 68 /* IRQ enable */
69 stmp3xxx_setl(0x04 << ((irq % 4) * 8), 69 stmp3xxx_setl(0x04 << ((d->irq % 4) * 8),
70 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + irq / 4 * 0x10); 70 REGS_ICOLL_BASE + HW_ICOLL_PRIORITYn + d->irq / 4 * 0x10);
71} 71}
72 72
73static struct irq_chip stmp37xx_chip = { 73static struct irq_chip stmp37xx_chip = {
74 .ack = stmp37xx_ack_irq, 74 .irq_ack = stmp37xx_ack_irq,
75 .mask = stmp37xx_mask_irq, 75 .irq_mask = stmp37xx_mask_irq,
76 .unmask = stmp37xx_unmask_irq, 76 .irq_unmask = stmp37xx_unmask_irq,
77}; 77};
78 78
79void __init stmp37xx_init_irq(void) 79void __init stmp37xx_init_irq(void)
diff --git a/arch/arm/mach-tcc8k/irq.c b/arch/arm/mach-tcc8k/irq.c
index 34575c4963f0..aa9231f4fc6e 100644
--- a/arch/arm/mach-tcc8k/irq.c
+++ b/arch/arm/mach-tcc8k/irq.c
@@ -18,65 +18,65 @@
18#include "common.h" 18#include "common.h"
19 19
20/* Disable IRQ */ 20/* Disable IRQ */
21static void tcc8000_mask_ack_irq0(unsigned int irq) 21static void tcc8000_mask_ack_irq0(struct irq_data *d)
22{ 22{
23 PIC0_IEN &= ~(1 << irq); 23 PIC0_IEN &= ~(1 << d->irq);
24 PIC0_CREQ |= (1 << irq); 24 PIC0_CREQ |= (1 << d->irq);
25} 25}
26 26
27static void tcc8000_mask_ack_irq1(unsigned int irq) 27static void tcc8000_mask_ack_irq1(struct irq_data *d)
28{ 28{
29 PIC1_IEN &= ~(1 << (irq - 32)); 29 PIC1_IEN &= ~(1 << (d->irq - 32));
30 PIC1_CREQ |= (1 << (irq - 32)); 30 PIC1_CREQ |= (1 << (d->irq - 32));
31} 31}
32 32
33static void tcc8000_mask_irq0(unsigned int irq) 33static void tcc8000_mask_irq0(struct irq_data *d)
34{ 34{
35 PIC0_IEN &= ~(1 << irq); 35 PIC0_IEN &= ~(1 << d->irq);
36} 36}
37 37
38static void tcc8000_mask_irq1(unsigned int irq) 38static void tcc8000_mask_irq1(struct irq_data *d)
39{ 39{
40 PIC1_IEN &= ~(1 << (irq - 32)); 40 PIC1_IEN &= ~(1 << (d->irq - 32));
41} 41}
42 42
43static void tcc8000_ack_irq0(unsigned int irq) 43static void tcc8000_ack_irq0(struct irq_data *d)
44{ 44{
45 PIC0_CREQ |= (1 << irq); 45 PIC0_CREQ |= (1 << d->irq);
46} 46}
47 47
48static void tcc8000_ack_irq1(unsigned int irq) 48static void tcc8000_ack_irq1(struct irq_data *d)
49{ 49{
50 PIC1_CREQ |= (1 << (irq - 32)); 50 PIC1_CREQ |= (1 << (d->irq - 32));
51} 51}
52 52
53/* Enable IRQ */ 53/* Enable IRQ */
54static void tcc8000_unmask_irq0(unsigned int irq) 54static void tcc8000_unmask_irq0(struct irq_data *d)
55{ 55{
56 PIC0_IEN |= (1 << irq); 56 PIC0_IEN |= (1 << d->irq);
57 PIC0_INTOEN |= (1 << irq); 57 PIC0_INTOEN |= (1 << d->irq);
58} 58}
59 59
60static void tcc8000_unmask_irq1(unsigned int irq) 60static void tcc8000_unmask_irq1(struct irq_data *d)
61{ 61{
62 PIC1_IEN |= (1 << (irq - 32)); 62 PIC1_IEN |= (1 << (d->irq - 32));
63 PIC1_INTOEN |= (1 << (irq - 32)); 63 PIC1_INTOEN |= (1 << (d->irq - 32));
64} 64}
65 65
66static struct irq_chip tcc8000_irq_chip0 = { 66static struct irq_chip tcc8000_irq_chip0 = {
67 .name = "tcc_irq0", 67 .name = "tcc_irq0",
68 .mask = tcc8000_mask_irq0, 68 .irq_mask = tcc8000_mask_irq0,
69 .ack = tcc8000_ack_irq0, 69 .irq_ack = tcc8000_ack_irq0,
70 .mask_ack = tcc8000_mask_ack_irq0, 70 .irq_mask_ack = tcc8000_mask_ack_irq0,
71 .unmask = tcc8000_unmask_irq0, 71 .irq_unmask = tcc8000_unmask_irq0,
72}; 72};
73 73
74static struct irq_chip tcc8000_irq_chip1 = { 74static struct irq_chip tcc8000_irq_chip1 = {
75 .name = "tcc_irq1", 75 .name = "tcc_irq1",
76 .mask = tcc8000_mask_irq1, 76 .irq_mask = tcc8000_mask_irq1,
77 .ack = tcc8000_ack_irq1, 77 .irq_ack = tcc8000_ack_irq1,
78 .mask_ack = tcc8000_mask_ack_irq1, 78 .irq_mask_ack = tcc8000_mask_ack_irq1,
79 .unmask = tcc8000_unmask_irq1, 79 .irq_unmask = tcc8000_unmask_irq1,
80}; 80};
81 81
82void __init tcc8k_init_irq(void) 82void __init tcc8k_init_irq(void)
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 0775265e69f5..bd066206e110 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -142,31 +142,31 @@ static struct gpio_chip tegra_gpio_chip = {
142 .ngpio = TEGRA_NR_GPIOS, 142 .ngpio = TEGRA_NR_GPIOS,
143}; 143};
144 144
145static void tegra_gpio_irq_ack(unsigned int irq) 145static void tegra_gpio_irq_ack(struct irq_data *d)
146{ 146{
147 int gpio = irq - INT_GPIO_BASE; 147 int gpio = d->irq - INT_GPIO_BASE;
148 148
149 __raw_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio)); 149 __raw_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio));
150} 150}
151 151
152static void tegra_gpio_irq_mask(unsigned int irq) 152static void tegra_gpio_irq_mask(struct irq_data *d)
153{ 153{
154 int gpio = irq - INT_GPIO_BASE; 154 int gpio = d->irq - INT_GPIO_BASE;
155 155
156 tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0); 156 tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0);
157} 157}
158 158
159static void tegra_gpio_irq_unmask(unsigned int irq) 159static void tegra_gpio_irq_unmask(struct irq_data *d)
160{ 160{
161 int gpio = irq - INT_GPIO_BASE; 161 int gpio = d->irq - INT_GPIO_BASE;
162 162
163 tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1); 163 tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1);
164} 164}
165 165
166static int tegra_gpio_irq_set_type(unsigned int irq, unsigned int type) 166static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type)
167{ 167{
168 int gpio = irq - INT_GPIO_BASE; 168 int gpio = d->irq - INT_GPIO_BASE;
169 struct tegra_gpio_bank *bank = get_irq_chip_data(irq); 169 struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d);
170 int port = GPIO_PORT(gpio); 170 int port = GPIO_PORT(gpio);
171 int lvl_type; 171 int lvl_type;
172 int val; 172 int val;
@@ -221,7 +221,7 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
221 int pin; 221 int pin;
222 int unmasked = 0; 222 int unmasked = 0;
223 223
224 desc->chip->ack(irq); 224 desc->irq_data.chip->irq_ack(&desc->irq_data);
225 225
226 bank = get_irq_data(irq); 226 bank = get_irq_data(irq);
227 227
@@ -240,7 +240,7 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
240 */ 240 */
241 if (lvl & (0x100 << pin)) { 241 if (lvl & (0x100 << pin)) {
242 unmasked = 1; 242 unmasked = 1;
243 desc->chip->unmask(irq); 243 desc->irq_data.chip->irq_unmask(&desc->irq_data);
244 } 244 }
245 245
246 generic_handle_irq(gpio_to_irq(gpio + pin)); 246 generic_handle_irq(gpio_to_irq(gpio + pin));
@@ -248,7 +248,7 @@ static void tegra_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
248 } 248 }
249 249
250 if (!unmasked) 250 if (!unmasked)
251 desc->chip->unmask(irq); 251 desc->irq_data.chip->irq_unmask(&desc->irq_data);
252 252
253} 253}
254 254
@@ -316,21 +316,21 @@ void tegra_gpio_suspend(void)
316 local_irq_restore(flags); 316 local_irq_restore(flags);
317} 317}
318 318
319static int tegra_gpio_wake_enable(unsigned int irq, unsigned int enable) 319static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable)
320{ 320{
321 struct tegra_gpio_bank *bank = get_irq_chip_data(irq); 321 struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d);
322 return set_irq_wake(bank->irq, enable); 322 return set_irq_wake(bank->irq, enable);
323} 323}
324#endif 324#endif
325 325
326static struct irq_chip tegra_gpio_irq_chip = { 326static struct irq_chip tegra_gpio_irq_chip = {
327 .name = "GPIO", 327 .name = "GPIO",
328 .ack = tegra_gpio_irq_ack, 328 .irq_ack = tegra_gpio_irq_ack,
329 .mask = tegra_gpio_irq_mask, 329 .irq_mask = tegra_gpio_irq_mask,
330 .unmask = tegra_gpio_irq_unmask, 330 .irq_unmask = tegra_gpio_irq_unmask,
331 .set_type = tegra_gpio_irq_set_type, 331 .irq_set_type = tegra_gpio_irq_set_type,
332#ifdef CONFIG_PM 332#ifdef CONFIG_PM
333 .set_wake = tegra_gpio_wake_enable, 333 .irq_set_wake = tegra_gpio_wake_enable,
334#endif 334#endif
335}; 335};
336 336
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c
index 5407de01abf0..de7dfad6f769 100644
--- a/arch/arm/mach-tegra/irq.c
+++ b/arch/arm/mach-tegra/irq.c
@@ -46,30 +46,30 @@
46#define ICTLR_COP_IER_CLR 0x38 46#define ICTLR_COP_IER_CLR 0x38
47#define ICTLR_COP_IEP_CLASS 0x3c 47#define ICTLR_COP_IEP_CLASS 0x3c
48 48
49static void (*gic_mask_irq)(unsigned int irq); 49static void (*gic_mask_irq)(struct irq_data *d);
50static void (*gic_unmask_irq)(unsigned int irq); 50static void (*gic_unmask_irq)(struct irq_data *d);
51 51
52#define irq_to_ictlr(irq) (((irq)-32) >> 5) 52#define irq_to_ictlr(irq) (((irq)-32) >> 5)
53static void __iomem *tegra_ictlr_base = IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE); 53static void __iomem *tegra_ictlr_base = IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE);
54#define ictlr_to_virt(ictlr) (tegra_ictlr_base + (ictlr)*0x100) 54#define ictlr_to_virt(ictlr) (tegra_ictlr_base + (ictlr)*0x100)
55 55
56static void tegra_mask(unsigned int irq) 56static void tegra_mask(struct irq_data *d)
57{ 57{
58 void __iomem *addr = ictlr_to_virt(irq_to_ictlr(irq)); 58 void __iomem *addr = ictlr_to_virt(irq_to_ictlr(d->irq));
59 gic_mask_irq(irq); 59 gic_mask_irq(d);
60 writel(1<<(irq&31), addr+ICTLR_CPU_IER_CLR); 60 writel(1<<(d->irq&31), addr+ICTLR_CPU_IER_CLR);
61} 61}
62 62
63static void tegra_unmask(unsigned int irq) 63static void tegra_unmask(struct irq_data *d)
64{ 64{
65 void __iomem *addr = ictlr_to_virt(irq_to_ictlr(irq)); 65 void __iomem *addr = ictlr_to_virt(irq_to_ictlr(d->irq));
66 gic_unmask_irq(irq); 66 gic_unmask_irq(d);
67 writel(1<<(irq&31), addr+ICTLR_CPU_IER_SET); 67 writel(1<<(d->irq&31), addr+ICTLR_CPU_IER_SET);
68} 68}
69 69
70#ifdef CONFIG_PM 70#ifdef CONFIG_PM
71 71
72static int tegra_set_wake(unsigned int irq, unsigned int on) 72static int tegra_set_wake(struct irq_data *d, unsigned int on)
73{ 73{
74 return 0; 74 return 0;
75} 75}
@@ -77,10 +77,10 @@ static int tegra_set_wake(unsigned int irq, unsigned int on)
77 77
78static struct irq_chip tegra_irq = { 78static struct irq_chip tegra_irq = {
79 .name = "PPI", 79 .name = "PPI",
80 .mask = tegra_mask, 80 .irq_mask = tegra_mask,
81 .unmask = tegra_unmask, 81 .irq_unmask = tegra_unmask,
82#ifdef CONFIG_PM 82#ifdef CONFIG_PM
83 .set_wake = tegra_set_wake, 83 .irq_set_wake = tegra_set_wake,
84#endif 84#endif
85}; 85};
86 86
@@ -98,11 +98,11 @@ void __init tegra_init_irq(void)
98 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); 98 IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100));
99 99
100 gic = get_irq_chip(29); 100 gic = get_irq_chip(29);
101 gic_unmask_irq = gic->unmask; 101 gic_unmask_irq = gic->irq_unmask;
102 gic_mask_irq = gic->mask; 102 gic_mask_irq = gic->irq_mask;
103 tegra_irq.ack = gic->ack; 103 tegra_irq.irq_ack = gic->irq_ack;
104#ifdef CONFIG_SMP 104#ifdef CONFIG_SMP
105 tegra_irq.set_affinity = gic->set_affinity; 105 tegra_irq.irq_set_affinity = gic->irq_set_affinity;
106#endif 106#endif
107 107
108 for (i = INT_PRI_BASE; i < INT_GPIO_BASE; i++) { 108 for (i = INT_PRI_BASE; i < INT_GPIO_BASE; i++) {
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 13a83e45a33b..136c32e7ed8e 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -63,23 +63,25 @@
63#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) 63#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
64#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) 64#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
65 65
66static void sic_mask_irq(unsigned int irq) 66static void sic_mask_irq(struct irq_data *d)
67{ 67{
68 irq -= IRQ_SIC_START; 68 unsigned int irq = d->irq - IRQ_SIC_START;
69
69 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 70 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
70} 71}
71 72
72static void sic_unmask_irq(unsigned int irq) 73static void sic_unmask_irq(struct irq_data *d)
73{ 74{
74 irq -= IRQ_SIC_START; 75 unsigned int irq = d->irq - IRQ_SIC_START;
76
75 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_SET); 77 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_SET);
76} 78}
77 79
78static struct irq_chip sic_chip = { 80static struct irq_chip sic_chip = {
79 .name = "SIC", 81 .name = "SIC",
80 .ack = sic_mask_irq, 82 .irq_ack = sic_mask_irq,
81 .mask = sic_mask_irq, 83 .irq_mask = sic_mask_irq,
82 .unmask = sic_unmask_irq, 84 .irq_unmask = sic_unmask_irq,
83}; 85};
84 86
85static void 87static void
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index 0ce9d8e867eb..9c350103dcda 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -92,15 +92,15 @@ static void nuc900_group_enable(struct group_irq *gpirq, int enable)
92 __raw_writel(regval, REG_AIC_GEN); 92 __raw_writel(regval, REG_AIC_GEN);
93} 93}
94 94
95static void nuc900_irq_mask(unsigned int irq) 95static void nuc900_irq_mask(struct irq_data *d)
96{ 96{
97 struct group_irq *group_irq; 97 struct group_irq *group_irq;
98 98
99 group_irq = NULL; 99 group_irq = NULL;
100 100
101 __raw_writel(1 << irq, REG_AIC_MDCR); 101 __raw_writel(1 << d->irq, REG_AIC_MDCR);
102 102
103 switch (irq) { 103 switch (d->irq) {
104 case IRQ_GROUP0: 104 case IRQ_GROUP0:
105 group_irq = &group_nirq0; 105 group_irq = &group_nirq0;
106 break; 106 break;
@@ -143,20 +143,20 @@ static void nuc900_irq_mask(unsigned int irq)
143 * to REG_AIC_EOSCR for ACK 143 * to REG_AIC_EOSCR for ACK
144 */ 144 */
145 145
146static void nuc900_irq_ack(unsigned int irq) 146static void nuc900_irq_ack(struct irq_data *d)
147{ 147{
148 __raw_writel(0x01, REG_AIC_EOSCR); 148 __raw_writel(0x01, REG_AIC_EOSCR);
149} 149}
150 150
151static void nuc900_irq_unmask(unsigned int irq) 151static void nuc900_irq_unmask(struct irq_data *d)
152{ 152{
153 struct group_irq *group_irq; 153 struct group_irq *group_irq;
154 154
155 group_irq = NULL; 155 group_irq = NULL;
156 156
157 __raw_writel(1 << irq, REG_AIC_MECR); 157 __raw_writel(1 << d->irq, REG_AIC_MECR);
158 158
159 switch (irq) { 159 switch (d->irq) {
160 case IRQ_GROUP0: 160 case IRQ_GROUP0:
161 group_irq = &group_nirq0; 161 group_irq = &group_nirq0;
162 break; 162 break;
@@ -195,9 +195,9 @@ static void nuc900_irq_unmask(unsigned int irq)
195} 195}
196 196
197static struct irq_chip nuc900_irq_chip = { 197static struct irq_chip nuc900_irq_chip = {
198 .ack = nuc900_irq_ack, 198 .irq_ack = nuc900_irq_ack,
199 .mask = nuc900_irq_mask, 199 .irq_mask = nuc900_irq_mask,
200 .unmask = nuc900_irq_unmask, 200 .irq_unmask = nuc900_irq_unmask,
201}; 201};
202 202
203void __init nuc900_init_irq(void) 203void __init nuc900_init_irq(void)
diff --git a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c
index 639c54a07992..c856fa397606 100644
--- a/arch/arm/plat-mxc/3ds_debugboard.c
+++ b/arch/arm/plat-mxc/3ds_debugboard.c
@@ -60,7 +60,6 @@
60#define EXPIO_INT_BUTTON_B (MXC_BOARD_IRQ_START + 4) 60#define EXPIO_INT_BUTTON_B (MXC_BOARD_IRQ_START + 4)
61 61
62static void __iomem *brd_io; 62static void __iomem *brd_io;
63static void expio_ack_irq(u32 irq);
64 63
65static struct resource smsc911x_resources[] = { 64static struct resource smsc911x_resources[] = {
66 { 65 {
@@ -93,7 +92,8 @@ static void mxc_expio_irq_handler(u32 irq, struct irq_desc *desc)
93 u32 int_valid; 92 u32 int_valid;
94 u32 expio_irq; 93 u32 expio_irq;
95 94
96 desc->chip->mask(irq); /* irq = gpio irq number */ 95 /* irq = gpio irq number */
96 desc->irq_data.chip->irq_mask(&desc->irq_data);
97 97
98 imr_val = __raw_readw(brd_io + INTR_MASK_REG); 98 imr_val = __raw_readw(brd_io + INTR_MASK_REG);
99 int_valid = __raw_readw(brd_io + INTR_STATUS_REG) & ~imr_val; 99 int_valid = __raw_readw(brd_io + INTR_STATUS_REG) & ~imr_val;
@@ -110,37 +110,37 @@ static void mxc_expio_irq_handler(u32 irq, struct irq_desc *desc)
110 d->handle_irq(expio_irq, d); 110 d->handle_irq(expio_irq, d);
111 } 111 }
112 112
113 desc->chip->ack(irq); 113 desc->irq_data.chip->irq_ack(&desc->irq_data);
114 desc->chip->unmask(irq); 114 desc->irq_data.chip->irq_unmask(&desc->irq_data);
115} 115}
116 116
117/* 117/*
118 * Disable an expio pin's interrupt by setting the bit in the imr. 118 * Disable an expio pin's interrupt by setting the bit in the imr.
119 * Irq is an expio virtual irq number 119 * Irq is an expio virtual irq number
120 */ 120 */
121static void expio_mask_irq(u32 irq) 121static void expio_mask_irq(struct irq_data *d)
122{ 122{
123 u16 reg; 123 u16 reg;
124 u32 expio = MXC_IRQ_TO_EXPIO(irq); 124 u32 expio = MXC_IRQ_TO_EXPIO(d->irq);
125 125
126 reg = __raw_readw(brd_io + INTR_MASK_REG); 126 reg = __raw_readw(brd_io + INTR_MASK_REG);
127 reg |= (1 << expio); 127 reg |= (1 << expio);
128 __raw_writew(reg, brd_io + INTR_MASK_REG); 128 __raw_writew(reg, brd_io + INTR_MASK_REG);
129} 129}
130 130
131static void expio_ack_irq(u32 irq) 131static void expio_ack_irq(struct irq_data *d)
132{ 132{
133 u32 expio = MXC_IRQ_TO_EXPIO(irq); 133 u32 expio = MXC_IRQ_TO_EXPIO(d->irq);
134 134
135 __raw_writew(1 << expio, brd_io + INTR_RESET_REG); 135 __raw_writew(1 << expio, brd_io + INTR_RESET_REG);
136 __raw_writew(0, brd_io + INTR_RESET_REG); 136 __raw_writew(0, brd_io + INTR_RESET_REG);
137 expio_mask_irq(irq); 137 expio_mask_irq(d);
138} 138}
139 139
140static void expio_unmask_irq(u32 irq) 140static void expio_unmask_irq(struct irq_data *d)
141{ 141{
142 u16 reg; 142 u16 reg;
143 u32 expio = MXC_IRQ_TO_EXPIO(irq); 143 u32 expio = MXC_IRQ_TO_EXPIO(d->irq);
144 144
145 reg = __raw_readw(brd_io + INTR_MASK_REG); 145 reg = __raw_readw(brd_io + INTR_MASK_REG);
146 reg &= ~(1 << expio); 146 reg &= ~(1 << expio);
@@ -148,9 +148,9 @@ static void expio_unmask_irq(u32 irq)
148} 148}
149 149
150static struct irq_chip expio_irq_chip = { 150static struct irq_chip expio_irq_chip = {
151 .ack = expio_ack_irq, 151 .irq_ack = expio_ack_irq,
152 .mask = expio_mask_irq, 152 .irq_mask = expio_mask_irq,
153 .unmask = expio_unmask_irq, 153 .irq_unmask = expio_unmask_irq,
154}; 154};
155 155
156int __init mxc_expio_init(u32 base, u32 p_irq) 156int __init mxc_expio_init(u32 base, u32 p_irq)
diff --git a/arch/arm/plat-mxc/avic.c b/arch/arm/plat-mxc/avic.c
index 9a4e8a22dd0a..deb284bc7c4b 100644
--- a/arch/arm/plat-mxc/avic.c
+++ b/arch/arm/plat-mxc/avic.c
@@ -89,22 +89,22 @@ static int avic_set_irq_fiq(unsigned int irq, unsigned int type)
89#endif /* CONFIG_FIQ */ 89#endif /* CONFIG_FIQ */
90 90
91/* Disable interrupt number "irq" in the AVIC */ 91/* Disable interrupt number "irq" in the AVIC */
92static void mxc_mask_irq(unsigned int irq) 92static void mxc_mask_irq(struct irq_data *d)
93{ 93{
94 __raw_writel(irq, avic_base + AVIC_INTDISNUM); 94 __raw_writel(d->irq, avic_base + AVIC_INTDISNUM);
95} 95}
96 96
97/* Enable interrupt number "irq" in the AVIC */ 97/* Enable interrupt number "irq" in the AVIC */
98static void mxc_unmask_irq(unsigned int irq) 98static void mxc_unmask_irq(struct irq_data *d)
99{ 99{
100 __raw_writel(irq, avic_base + AVIC_INTENNUM); 100 __raw_writel(d->irq, avic_base + AVIC_INTENNUM);
101} 101}
102 102
103static struct mxc_irq_chip mxc_avic_chip = { 103static struct mxc_irq_chip mxc_avic_chip = {
104 .base = { 104 .base = {
105 .ack = mxc_mask_irq, 105 .irq_ack = mxc_mask_irq,
106 .mask = mxc_mask_irq, 106 .irq_mask = mxc_mask_irq,
107 .unmask = mxc_unmask_irq, 107 .irq_unmask = mxc_unmask_irq,
108 }, 108 },
109#ifdef CONFIG_MXC_IRQ_PRIOR 109#ifdef CONFIG_MXC_IRQ_PRIOR
110 .set_priority = avic_irq_set_priority, 110 .set_priority = avic_irq_set_priority,
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 2537166468ac..b9ab1d58b5e7 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -1,6 +1,6 @@
1config IMX_HAVE_PLATFORM_FEC 1config IMX_HAVE_PLATFORM_FEC
2 bool 2 bool
3 default y if ARCH_MX25 || SOC_IMX27 || SOC_IMX35 || SOC_IMX51 3 default y if ARCH_MX25 || SOC_IMX27 || SOC_IMX35 || SOC_IMX51 || SOC_IMX53
4 4
5config IMX_HAVE_PLATFORM_FLEXCAN 5config IMX_HAVE_PLATFORM_FLEXCAN
6 select HAVE_CAN_FLEXCAN if CAN 6 select HAVE_CAN_FLEXCAN if CAN
diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c
index 269ec78aba77..b50c3517d083 100644
--- a/arch/arm/plat-mxc/devices/platform-fec.c
+++ b/arch/arm/plat-mxc/devices/platform-fec.c
@@ -36,6 +36,11 @@ const struct imx_fec_data imx51_fec_data __initconst =
36 imx_fec_data_entry_single(MX51); 36 imx_fec_data_entry_single(MX51);
37#endif 37#endif
38 38
39#ifdef CONFIG_SOC_IMX53
40const struct imx_fec_data imx53_fec_data __initconst =
41 imx_fec_data_entry_single(MX53);
42#endif
43
39struct platform_device *__init imx_add_fec( 44struct platform_device *__init imx_add_fec(
40 const struct imx_fec_data *data, 45 const struct imx_fec_data *data,
41 const struct fec_platform_data *pdata) 46 const struct fec_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
index 72ba880c75af..7ba94e1bbda3 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -78,6 +78,15 @@ const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
78}; 78};
79#endif /* ifdef CONFIG_SOC_IMX51 */ 79#endif /* ifdef CONFIG_SOC_IMX51 */
80 80
81#ifdef CONFIG_SOC_IMX53
82const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
83#define imx53_imx_i2c_data_entry(_id, _hwid) \
84 imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K)
85 imx53_imx_i2c_data_entry(0, 1),
86 imx53_imx_i2c_data_entry(1, 2),
87};
88#endif /* ifdef CONFIG_SOC_IMX51 */
89
81struct platform_device *__init imx_add_imx_i2c( 90struct platform_device *__init imx_add_imx_i2c(
82 const struct imx_imx_i2c_data *data, 91 const struct imx_imx_i2c_data *data,
83 const struct imxi2c_platform_data *pdata) 92 const struct imxi2c_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-imx-keypad.c b/arch/arm/plat-mxc/devices/platform-imx-keypad.c
index 40238f0b8643..26366114b021 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-keypad.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-keypad.c
@@ -41,6 +41,11 @@ const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
41 imx_imx_keypad_data_entry_single(MX35, SZ_16); 41 imx_imx_keypad_data_entry_single(MX35, SZ_16);
42#endif /* ifdef CONFIG_SOC_IMX35 */ 42#endif /* ifdef CONFIG_SOC_IMX35 */
43 43
44#ifdef CONFIG_SOC_IMX51
45const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
46 imx_imx_keypad_data_entry_single(MX51, SZ_16);
47#endif /* ifdef CONFIG_SOC_IMX51 */
48
44struct platform_device *__init imx_add_imx_keypad( 49struct platform_device *__init imx_add_imx_keypad(
45 const struct imx_imx_keypad_data *data, 50 const struct imx_imx_keypad_data *data,
46 const struct matrix_keymap_data *pdata) 51 const struct matrix_keymap_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
index 3d8ebdba38ee..b0c4ae298111 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c
@@ -40,6 +40,15 @@ const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst =
40 imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K); 40 imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K);
41#endif /* ifdef CONFIG_SOC_IMX27 */ 41#endif /* ifdef CONFIG_SOC_IMX27 */
42 42
43#ifdef CONFIG_SOC_IMX51
44const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
45#define imx51_mxc_pwm_data_entry(_id, _hwid) \
46 imx_mxc_pwm_data_entry(MX51, _id, _hwid, SZ_16K)
47 imx51_mxc_pwm_data_entry(0, 1),
48 imx51_mxc_pwm_data_entry(1, 2),
49};
50#endif /* ifdef CONFIG_SOC_IMX51 */
51
43struct platform_device *__init imx_add_mxc_pwm( 52struct platform_device *__init imx_add_mxc_pwm(
44 const struct imx_mxc_pwm_data *data) 53 const struct imx_mxc_pwm_data *data)
45{ 54{
diff --git a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c b/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
index b3525648a01d..6b2940b93d94 100644
--- a/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c
@@ -53,6 +53,18 @@ imx51_sdhci_esdhc_imx_data[] __initconst = {
53}; 53};
54#endif /* ifdef CONFIG_SOC_IMX51 */ 54#endif /* ifdef CONFIG_SOC_IMX51 */
55 55
56#ifdef CONFIG_SOC_IMX53
57const struct imx_sdhci_esdhc_imx_data
58imx53_sdhci_esdhc_imx_data[] __initconst = {
59#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \
60 imx_sdhci_esdhc_imx_data_entry(MX53, _id, _hwid)
61 imx53_sdhci_esdhc_imx_data_entry(0, 1),
62 imx53_sdhci_esdhc_imx_data_entry(1, 2),
63 imx53_sdhci_esdhc_imx_data_entry(2, 3),
64 imx53_sdhci_esdhc_imx_data_entry(3, 4),
65};
66#endif /* ifdef CONFIG_SOC_IMX53 */
67
56struct platform_device *__init imx_add_sdhci_esdhc_imx( 68struct platform_device *__init imx_add_sdhci_esdhc_imx(
57 const struct imx_sdhci_esdhc_imx_data *data, 69 const struct imx_sdhci_esdhc_imx_data *data,
58 const struct esdhc_platform_data *pdata) 70 const struct esdhc_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-spi_imx.c b/arch/arm/plat-mxc/devices/platform-spi_imx.c
index 8ea49adcdfc1..013c85f20b58 100644
--- a/arch/arm/plat-mxc/devices/platform-spi_imx.c
+++ b/arch/arm/plat-mxc/devices/platform-spi_imx.c
@@ -81,6 +81,18 @@ const struct imx_spi_imx_data imx51_ecspi_data[] __initconst = {
81}; 81};
82#endif /* ifdef CONFIG_SOC_IMX51 */ 82#endif /* ifdef CONFIG_SOC_IMX51 */
83 83
84#ifdef CONFIG_SOC_IMX53
85const struct imx_spi_imx_data imx53_cspi_data __initconst =
86 imx_spi_imx_data_entry_single(MX53, CSPI, "imx53-cspi", 0, , SZ_4K);
87
88const struct imx_spi_imx_data imx53_ecspi_data[] __initconst = {
89#define imx53_ecspi_data_entry(_id, _hwid) \
90 imx_spi_imx_data_entry(MX53, ECSPI, "imx53-ecspi", _id, _hwid, SZ_4K)
91 imx53_ecspi_data_entry(0, 1),
92 imx53_ecspi_data_entry(1, 2),
93};
94#endif /* ifdef CONFIG_SOC_IMX53 */
95
84struct platform_device *__init imx_add_spi_imx( 96struct platform_device *__init imx_add_spi_imx(
85 const struct imx_spi_imx_data *data, 97 const struct imx_spi_imx_data *data,
86 const struct spi_imx_master *pdata) 98 const struct spi_imx_master *pdata)
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index bc2c7bc6f10a..d17b3c996b84 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -63,29 +63,29 @@ static void _set_gpio_irqenable(struct mxc_gpio_port *port, u32 index,
63 __raw_writel(l, port->base + GPIO_IMR); 63 __raw_writel(l, port->base + GPIO_IMR);
64} 64}
65 65
66static void gpio_ack_irq(u32 irq) 66static void gpio_ack_irq(struct irq_data *d)
67{ 67{
68 u32 gpio = irq_to_gpio(irq); 68 u32 gpio = irq_to_gpio(d->irq);
69 _clear_gpio_irqstatus(&mxc_gpio_ports[gpio / 32], gpio & 0x1f); 69 _clear_gpio_irqstatus(&mxc_gpio_ports[gpio / 32], gpio & 0x1f);
70} 70}
71 71
72static void gpio_mask_irq(u32 irq) 72static void gpio_mask_irq(struct irq_data *d)
73{ 73{
74 u32 gpio = irq_to_gpio(irq); 74 u32 gpio = irq_to_gpio(d->irq);
75 _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 0); 75 _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 0);
76} 76}
77 77
78static void gpio_unmask_irq(u32 irq) 78static void gpio_unmask_irq(struct irq_data *d)
79{ 79{
80 u32 gpio = irq_to_gpio(irq); 80 u32 gpio = irq_to_gpio(d->irq);
81 _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 1); 81 _set_gpio_irqenable(&mxc_gpio_ports[gpio / 32], gpio & 0x1f, 1);
82} 82}
83 83
84static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset); 84static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset);
85 85
86static int gpio_set_irq_type(u32 irq, u32 type) 86static int gpio_set_irq_type(struct irq_data *d, u32 type)
87{ 87{
88 u32 gpio = irq_to_gpio(irq); 88 u32 gpio = irq_to_gpio(d->irq);
89 struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; 89 struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32];
90 u32 bit, val; 90 u32 bit, val;
91 int edge; 91 int edge;
@@ -211,9 +211,9 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
211 * @param enable enable as wake-up if equal to non-zero 211 * @param enable enable as wake-up if equal to non-zero
212 * @return This function returns 0 on success. 212 * @return This function returns 0 on success.
213 */ 213 */
214static int gpio_set_wake_irq(u32 irq, u32 enable) 214static int gpio_set_wake_irq(struct irq_data *d, u32 enable)
215{ 215{
216 u32 gpio = irq_to_gpio(irq); 216 u32 gpio = irq_to_gpio(d->irq);
217 u32 gpio_idx = gpio & 0x1F; 217 u32 gpio_idx = gpio & 0x1F;
218 struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32]; 218 struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32];
219 219
@@ -233,11 +233,11 @@ static int gpio_set_wake_irq(u32 irq, u32 enable)
233} 233}
234 234
235static struct irq_chip gpio_irq_chip = { 235static struct irq_chip gpio_irq_chip = {
236 .ack = gpio_ack_irq, 236 .irq_ack = gpio_ack_irq,
237 .mask = gpio_mask_irq, 237 .irq_mask = gpio_mask_irq,
238 .unmask = gpio_unmask_irq, 238 .irq_unmask = gpio_unmask_irq,
239 .set_type = gpio_set_irq_type, 239 .irq_set_type = gpio_set_irq_type,
240 .set_wake = gpio_set_wake_irq, 240 .irq_set_wake = gpio_set_wake_irq,
241}; 241};
242 242
243static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, 243static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx53.h b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
index 5deee019c29e..68e11d7ab79d 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx53.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
@@ -34,7 +34,6 @@ typedef enum iomux_config {
34 IOMUX_CONFIG_ALT6, 34 IOMUX_CONFIG_ALT6,
35 IOMUX_CONFIG_ALT7, 35 IOMUX_CONFIG_ALT7,
36 IOMUX_CONFIG_GPIO, /* added to help user use GPIO mode */ 36 IOMUX_CONFIG_GPIO, /* added to help user use GPIO mode */
37 IOMUX_CONFIG_SION = 0x1 << 4, /* LOOPBACK:MUX SION bit */
38} iomux_pin_cfg_t; 37} iomux_pin_cfg_t;
39 38
40/* These 2 defines are for pins that may not have a mux register, but could 39/* These 2 defines are for pins that may not have a mux register, but could
@@ -135,6 +134,9 @@ typedef enum iomux_config {
135#define MX53_PAD_EIM_D16__GPIO_3_16 IOMUX_PAD(0x460, 0x118,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL) 134#define MX53_PAD_EIM_D16__GPIO_3_16 IOMUX_PAD(0x460, 0x118,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL)
136#define MX53_PAD_EIM_D17__GPIO_3_17 IOMUX_PAD(0x464, 0x11C,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL) 135#define MX53_PAD_EIM_D17__GPIO_3_17 IOMUX_PAD(0x464, 0x11C,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL)
137#define MX53_PAD_EIM_D18__GPIO_3_18 IOMUX_PAD(0x468, 0x120,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL) 136#define MX53_PAD_EIM_D18__GPIO_3_18 IOMUX_PAD(0x468, 0x120,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL)
137#define MX53_PAD_EIM_D16__CSPI1_SCLK IOMUX_PAD(0x460, 0x118,IOMUX_CONFIG_ALT4, 0x79c, 3, NO_PAD_CTRL)
138#define MX53_PAD_EIM_D17__CSPI1_MISO IOMUX_PAD(0x464, 0x11C,IOMUX_CONFIG_ALT4, 0x7a0, 3, NO_PAD_CTRL)
139#define MX53_PAD_EIM_D18__CSPI1_MOSI IOMUX_PAD(0x468, 0x120,IOMUX_CONFIG_ALT4, 0x7a4, 3, NO_PAD_CTRL)
138#define MX53_PAD_EIM_D19__GPIO_3_19 IOMUX_PAD(0x46C, 0x124,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL) 140#define MX53_PAD_EIM_D19__GPIO_3_19 IOMUX_PAD(0x46C, 0x124,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL)
139#define MX53_PAD_EIM_D20__GPIO_3_20 IOMUX_PAD(0x470, 0x128,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL) 141#define MX53_PAD_EIM_D20__GPIO_3_20 IOMUX_PAD(0x470, 0x128,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL)
140#define MX53_PAD_EIM_D21__GPIO_3_21 IOMUX_PAD(0x474, 0x12C,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL) 142#define MX53_PAD_EIM_D21__GPIO_3_21 IOMUX_PAD(0x474, 0x12C,IOMUX_CONFIG_ALT1, 0x0, 0, NO_PAD_CTRL)
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h
index 2277b01c855d..82620af1922f 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h
@@ -105,6 +105,7 @@ typedef u64 iomux_v3_cfg_t;
105#define PAD_CTL_SRE_FAST (1 << 0) 105#define PAD_CTL_SRE_FAST (1 << 0)
106#define PAD_CTL_SRE_SLOW (0 << 0) 106#define PAD_CTL_SRE_SLOW (0 << 0)
107 107
108#define IOMUX_CONFIG_SION (0x1 << 4)
108 109
109#define MX51_NUM_GPIO_PORT 4 110#define MX51_NUM_GPIO_PORT 4
110 111
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h
index 873807f96d70..1eb339e6c857 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/plat-mxc/include/mach/mx51.h
@@ -301,8 +301,8 @@
301#define MX51_MXC_INT_GPIO4_HIGH 57 301#define MX51_MXC_INT_GPIO4_HIGH 57
302#define MX51_MXC_INT_WDOG1 58 302#define MX51_MXC_INT_WDOG1 58
303#define MX51_MXC_INT_WDOG2 59 303#define MX51_MXC_INT_WDOG2 59
304#define MX51_MXC_INT_KPP 60 304#define MX51_INT_KPP 60
305#define MX51_MXC_INT_PWM1 61 305#define MX51_INT_PWM1 61
306#define MX51_INT_I2C1 62 306#define MX51_INT_I2C1 62
307#define MX51_INT_I2C2 63 307#define MX51_INT_I2C2 63
308#define MX51_MXC_INT_HS_I2C 64 308#define MX51_MXC_INT_HS_I2C 64
@@ -335,7 +335,7 @@
335#define MX51_MXC_INT_SPDIF 91 335#define MX51_MXC_INT_SPDIF 91
336#define MX51_MXC_INT_TVE 92 336#define MX51_MXC_INT_TVE 92
337#define MX51_MXC_INT_FIRI 93 337#define MX51_MXC_INT_FIRI 93
338#define MX51_MXC_INT_PWM2 94 338#define MX51_INT_PWM2 94
339#define MX51_MXC_INT_SLIM_EXP 95 339#define MX51_MXC_INT_SLIM_EXP 95
340#define MX51_INT_SSI3 96 340#define MX51_INT_SSI3 96
341#define MX51_MXC_INT_EMI_BOOT 97 341#define MX51_MXC_INT_EMI_BOOT 97
diff --git a/arch/arm/plat-mxc/include/mach/mx53.h b/arch/arm/plat-mxc/include/mach/mx53.h
index 9577cdbf7fad..d7a8e52181ea 100644
--- a/arch/arm/plat-mxc/include/mach/mx53.h
+++ b/arch/arm/plat-mxc/include/mach/mx53.h
@@ -53,13 +53,13 @@
53#define MX53_SPBA0_BASE_ADDR 0x50000000 53#define MX53_SPBA0_BASE_ADDR 0x50000000
54#define MX53_SPBA0_SIZE SZ_1M 54#define MX53_SPBA0_SIZE SZ_1M
55 55
56#define MX53_MMC_SDHC1_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00004000) 56#define MX53_ESDHC1_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00004000)
57#define MX53_MMC_SDHC2_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00008000) 57#define MX53_ESDHC2_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00008000)
58#define MX53_UART3_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0000C000) 58#define MX53_UART3_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0000C000)
59#define MX53_CSPI1_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00010000) 59#define MX53_ECSPI1_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00010000)
60#define MX53_SSI2_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00014000) 60#define MX53_SSI2_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00014000)
61#define MX53_MMC_SDHC3_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00020000) 61#define MX53_ESDHC3_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00020000)
62#define MX53_MMC_SDHC4_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00024000) 62#define MX53_ESDHC4_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00024000)
63#define MX53_SPDIF_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00028000) 63#define MX53_SPDIF_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00028000)
64#define MX53_ASRC_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0002C000) 64#define MX53_ASRC_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x0002C000)
65#define MX53_ATA_DMA_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00030000) 65#define MX53_ATA_DMA_BASE_ADDR (MX53_SPBA0_BASE_ADDR + 0x00030000)
@@ -117,12 +117,12 @@
117#define MX53_ARM_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A0000) 117#define MX53_ARM_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A0000)
118#define MX53_OWIRE_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A4000) 118#define MX53_OWIRE_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A4000)
119#define MX53_FIRI_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A8000) 119#define MX53_FIRI_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000A8000)
120#define MX53_CSPI2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000AC000) 120#define MX53_ECSPI2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000AC000)
121#define MX53_SDMA_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B0000) 121#define MX53_SDMA_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B0000)
122#define MX53_SCC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B4000) 122#define MX53_SCC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B4000)
123#define MX53_ROMCP_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B8000) 123#define MX53_ROMCP_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000B8000)
124#define MX53_RTIC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000BC000) 124#define MX53_RTIC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000BC000)
125#define MX53_CSPI3_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C0000) 125#define MX53_CSPI_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C0000)
126#define MX53_I2C2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C4000) 126#define MX53_I2C2_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C4000)
127#define MX53_I2C1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C8000) 127#define MX53_I2C1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000C8000)
128#define MX53_SSI1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000CC000) 128#define MX53_SSI1_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000CC000)
@@ -136,7 +136,7 @@
136#define MX53_MIPI_HSC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000DC000) 136#define MX53_MIPI_HSC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000DC000)
137#define MX53_MLB_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000E4000) 137#define MX53_MLB_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000E4000)
138#define MX53_SSI3_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000E8000) 138#define MX53_SSI3_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000E8000)
139#define MX53_MXC_FEC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000EC000) 139#define MX53_FEC_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000EC000)
140#define MX53_TVE_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F0000) 140#define MX53_TVE_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F0000)
141#define MX53_VPU_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F4000) 141#define MX53_VPU_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F4000)
142#define MX53_SAHARA_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F8000) 142#define MX53_SAHARA_BASE_ADDR (MX53_AIPS2_BASE_ADDR + 0x000F8000)
@@ -229,10 +229,10 @@
229 * Interrupt numbers 229 * Interrupt numbers
230 */ 230 */
231#define MX53_INT_RESV0 0 231#define MX53_INT_RESV0 0
232#define MX53_INT_MMC_SDHC1 1 232#define MX53_INT_ESDHC1 1
233#define MX53_INT_MMC_SDHC2 2 233#define MX53_INT_ESDHC2 2
234#define MX53_INT_MMC_SDHC3 3 234#define MX53_INT_ESDHC3 3
235#define MX53_INT_MMC_SDHC4 4 235#define MX53_INT_ESDHC4 4
236#define MX53_INT_RESV5 5 236#define MX53_INT_RESV5 5
237#define MX53_INT_SDMA 6 237#define MX53_INT_SDMA 6
238#define MX53_INT_IOMUX 7 238#define MX53_INT_IOMUX 7
@@ -264,8 +264,8 @@
264#define MX53_INT_UART3 33 264#define MX53_INT_UART3 33
265#define MX53_INT_RESV34 34 265#define MX53_INT_RESV34 34
266#define MX53_INT_RESV35 35 266#define MX53_INT_RESV35 35
267#define MX53_INT_CSPI1 36 267#define MX53_INT_ECSPI1 36
268#define MX53_INT_CSPI2 37 268#define MX53_INT_ECSPI2 37
269#define MX53_INT_CSPI 38 269#define MX53_INT_CSPI 38
270#define MX53_INT_GPT 39 270#define MX53_INT_GPT 39
271#define MX53_INT_EPIT1 40 271#define MX53_INT_EPIT1 40
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index c36f2630ed93..7a61ef8f471a 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -57,7 +57,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
57 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) 57 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
58 return -EINVAL; 58 return -EINVAL;
59 59
60 if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { 60 if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
61 unsigned long long c; 61 unsigned long long c;
62 unsigned long period_cycles, duty_cycles, prescale; 62 unsigned long period_cycles, duty_cycles, prescale;
63 u32 cr; 63 u32 cr;
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
index e69ed8a8c203..bc3a6be8a27f 100644
--- a/arch/arm/plat-mxc/tzic.c
+++ b/arch/arm/plat-mxc/tzic.c
@@ -69,50 +69,50 @@ static int tzic_set_irq_fiq(unsigned int irq, unsigned int type)
69#endif 69#endif
70 70
71/** 71/**
72 * tzic_mask_irq() - Disable interrupt number "irq" in the TZIC 72 * tzic_mask_irq() - Disable interrupt source "d" in the TZIC
73 * 73 *
74 * @param irq interrupt source number 74 * @param d interrupt source
75 */ 75 */
76static void tzic_mask_irq(unsigned int irq) 76static void tzic_mask_irq(struct irq_data *d)
77{ 77{
78 int index, off; 78 int index, off;
79 79
80 index = irq >> 5; 80 index = d->irq >> 5;
81 off = irq & 0x1F; 81 off = d->irq & 0x1F;
82 __raw_writel(1 << off, tzic_base + TZIC_ENCLEAR0(index)); 82 __raw_writel(1 << off, tzic_base + TZIC_ENCLEAR0(index));
83} 83}
84 84
85/** 85/**
86 * tzic_unmask_irq() - Enable interrupt number "irq" in the TZIC 86 * tzic_unmask_irq() - Enable interrupt source "d" in the TZIC
87 * 87 *
88 * @param irq interrupt source number 88 * @param d interrupt source
89 */ 89 */
90static void tzic_unmask_irq(unsigned int irq) 90static void tzic_unmask_irq(struct irq_data *d)
91{ 91{
92 int index, off; 92 int index, off;
93 93
94 index = irq >> 5; 94 index = d->irq >> 5;
95 off = irq & 0x1F; 95 off = d->irq & 0x1F;
96 __raw_writel(1 << off, tzic_base + TZIC_ENSET0(index)); 96 __raw_writel(1 << off, tzic_base + TZIC_ENSET0(index));
97} 97}
98 98
99static unsigned int wakeup_intr[4]; 99static unsigned int wakeup_intr[4];
100 100
101/** 101/**
102 * tzic_set_wake_irq() - Set interrupt number "irq" in the TZIC as a wake-up source. 102 * tzic_set_wake_irq() - Set interrupt source "d" in the TZIC as a wake-up source.
103 * 103 *
104 * @param irq interrupt source number 104 * @param d interrupt source
105 * @param enable enable as wake-up if equal to non-zero 105 * @param enable enable as wake-up if equal to non-zero
106 * disble as wake-up if equal to zero 106 * disble as wake-up if equal to zero
107 * 107 *
108 * @return This function returns 0 on success. 108 * @return This function returns 0 on success.
109 */ 109 */
110static int tzic_set_wake_irq(unsigned int irq, unsigned int enable) 110static int tzic_set_wake_irq(struct irq_data *d, unsigned int enable)
111{ 111{
112 unsigned int index, off; 112 unsigned int index, off;
113 113
114 index = irq >> 5; 114 index = d->irq >> 5;
115 off = irq & 0x1F; 115 off = d->irq & 0x1F;
116 116
117 if (index > 3) 117 if (index > 3)
118 return -EINVAL; 118 return -EINVAL;
@@ -128,10 +128,10 @@ static int tzic_set_wake_irq(unsigned int irq, unsigned int enable)
128static struct mxc_irq_chip mxc_tzic_chip = { 128static struct mxc_irq_chip mxc_tzic_chip = {
129 .base = { 129 .base = {
130 .name = "MXC_TZIC", 130 .name = "MXC_TZIC",
131 .ack = tzic_mask_irq, 131 .irq_ack = tzic_mask_irq,
132 .mask = tzic_mask_irq, 132 .irq_mask = tzic_mask_irq,
133 .unmask = tzic_unmask_irq, 133 .irq_unmask = tzic_unmask_irq,
134 .set_wake = tzic_set_wake_irq, 134 .irq_set_wake = tzic_set_wake_irq,
135 }, 135 },
136#ifdef CONFIG_FIQ 136#ifdef CONFIG_FIQ
137 .set_irq_fiq = tzic_set_irq_fiq, 137 .set_irq_fiq = tzic_set_irq_fiq,
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index eda4e3a11a3d..1e88ecb846d1 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -356,13 +356,13 @@ static inline int nmk_gpio_get_bitmask(int gpio)
356 return 1 << (gpio % 32); 356 return 1 << (gpio % 32);
357} 357}
358 358
359static void nmk_gpio_irq_ack(unsigned int irq) 359static void nmk_gpio_irq_ack(struct irq_data *d)
360{ 360{
361 int gpio; 361 int gpio;
362 struct nmk_gpio_chip *nmk_chip; 362 struct nmk_gpio_chip *nmk_chip;
363 363
364 gpio = NOMADIK_IRQ_TO_GPIO(irq); 364 gpio = NOMADIK_IRQ_TO_GPIO(d->irq);
365 nmk_chip = get_irq_chip_data(irq); 365 nmk_chip = irq_data_get_irq_chip_data(d);
366 if (!nmk_chip) 366 if (!nmk_chip)
367 return; 367 return;
368 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC); 368 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC);
@@ -401,7 +401,7 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
401 } 401 }
402} 402}
403 403
404static int nmk_gpio_irq_modify(unsigned int irq, enum nmk_gpio_irq_type which, 404static int nmk_gpio_irq_modify(struct irq_data *d, enum nmk_gpio_irq_type which,
405 bool enable) 405 bool enable)
406{ 406{
407 int gpio; 407 int gpio;
@@ -409,8 +409,8 @@ static int nmk_gpio_irq_modify(unsigned int irq, enum nmk_gpio_irq_type which,
409 unsigned long flags; 409 unsigned long flags;
410 u32 bitmask; 410 u32 bitmask;
411 411
412 gpio = NOMADIK_IRQ_TO_GPIO(irq); 412 gpio = NOMADIK_IRQ_TO_GPIO(d->irq);
413 nmk_chip = get_irq_chip_data(irq); 413 nmk_chip = irq_data_get_irq_chip_data(d);
414 bitmask = nmk_gpio_get_bitmask(gpio); 414 bitmask = nmk_gpio_get_bitmask(gpio);
415 if (!nmk_chip) 415 if (!nmk_chip)
416 return -EINVAL; 416 return -EINVAL;
@@ -422,24 +422,24 @@ static int nmk_gpio_irq_modify(unsigned int irq, enum nmk_gpio_irq_type which,
422 return 0; 422 return 0;
423} 423}
424 424
425static void nmk_gpio_irq_mask(unsigned int irq) 425static void nmk_gpio_irq_mask(struct irq_data *d)
426{ 426{
427 nmk_gpio_irq_modify(irq, NORMAL, false); 427 nmk_gpio_irq_modify(d, NORMAL, false);
428} 428}
429 429
430static void nmk_gpio_irq_unmask(unsigned int irq) 430static void nmk_gpio_irq_unmask(struct irq_data *d)
431{ 431{
432 nmk_gpio_irq_modify(irq, NORMAL, true); 432 nmk_gpio_irq_modify(d, NORMAL, true);
433} 433}
434 434
435static int nmk_gpio_irq_set_wake(unsigned int irq, unsigned int on) 435static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on)
436{ 436{
437 struct nmk_gpio_chip *nmk_chip; 437 struct nmk_gpio_chip *nmk_chip;
438 unsigned long flags; 438 unsigned long flags;
439 int gpio; 439 int gpio;
440 440
441 gpio = NOMADIK_IRQ_TO_GPIO(irq); 441 gpio = NOMADIK_IRQ_TO_GPIO(d->irq);
442 nmk_chip = get_irq_chip_data(irq); 442 nmk_chip = irq_data_get_irq_chip_data(d);
443 if (!nmk_chip) 443 if (!nmk_chip)
444 return -EINVAL; 444 return -EINVAL;
445 445
@@ -457,9 +457,9 @@ static int nmk_gpio_irq_set_wake(unsigned int irq, unsigned int on)
457 return 0; 457 return 0;
458} 458}
459 459
460static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type) 460static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type)
461{ 461{
462 struct irq_desc *desc = irq_to_desc(irq); 462 struct irq_desc *desc = irq_to_desc(d->irq);
463 bool enabled = !(desc->status & IRQ_DISABLED); 463 bool enabled = !(desc->status & IRQ_DISABLED);
464 bool wake = desc->wake_depth; 464 bool wake = desc->wake_depth;
465 int gpio; 465 int gpio;
@@ -467,8 +467,8 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
467 unsigned long flags; 467 unsigned long flags;
468 u32 bitmask; 468 u32 bitmask;
469 469
470 gpio = NOMADIK_IRQ_TO_GPIO(irq); 470 gpio = NOMADIK_IRQ_TO_GPIO(d->irq);
471 nmk_chip = get_irq_chip_data(irq); 471 nmk_chip = irq_data_get_irq_chip_data(d);
472 bitmask = nmk_gpio_get_bitmask(gpio); 472 bitmask = nmk_gpio_get_bitmask(gpio);
473 if (!nmk_chip) 473 if (!nmk_chip)
474 return -EINVAL; 474 return -EINVAL;
@@ -507,11 +507,11 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
507 507
508static struct irq_chip nmk_gpio_irq_chip = { 508static struct irq_chip nmk_gpio_irq_chip = {
509 .name = "Nomadik-GPIO", 509 .name = "Nomadik-GPIO",
510 .ack = nmk_gpio_irq_ack, 510 .irq_ack = nmk_gpio_irq_ack,
511 .mask = nmk_gpio_irq_mask, 511 .irq_mask = nmk_gpio_irq_mask,
512 .unmask = nmk_gpio_irq_unmask, 512 .irq_unmask = nmk_gpio_irq_unmask,
513 .set_type = nmk_gpio_irq_set_type, 513 .irq_set_type = nmk_gpio_irq_set_type,
514 .set_wake = nmk_gpio_irq_set_wake, 514 .irq_set_wake = nmk_gpio_irq_set_wake,
515}; 515};
516 516
517static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 517static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
@@ -522,12 +522,12 @@ static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
522 u32 pending; 522 u32 pending;
523 unsigned int first_irq; 523 unsigned int first_irq;
524 524
525 if (host_chip->mask_ack) 525 if (host_chip->irq_mask_ack)
526 host_chip->mask_ack(irq); 526 host_chip->irq_mask_ack(&desc->irq_data);
527 else { 527 else {
528 host_chip->mask(irq); 528 host_chip->irq_mask(&desc->irq_data);
529 if (host_chip->ack) 529 if (host_chip->irq_ack)
530 host_chip->ack(irq); 530 host_chip->irq_ack(&desc->irq_data);
531 } 531 }
532 532
533 nmk_chip = get_irq_data(irq); 533 nmk_chip = get_irq_data(irq);
@@ -537,7 +537,7 @@ static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
537 generic_handle_irq(gpio_irq); 537 generic_handle_irq(gpio_irq);
538 } 538 }
539 539
540 host_chip->unmask(irq); 540 host_chip->irq_unmask(&desc->irq_data);
541} 541}
542 542
543static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip) 543static int nmk_gpio_init_irq(struct nmk_gpio_chip *nmk_chip)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index ccf2660f4151..971d18636942 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -729,17 +729,17 @@ bad:
729 return -EINVAL; 729 return -EINVAL;
730} 730}
731 731
732static int gpio_irq_type(unsigned irq, unsigned type) 732static int gpio_irq_type(struct irq_data *d, unsigned type)
733{ 733{
734 struct gpio_bank *bank; 734 struct gpio_bank *bank;
735 unsigned gpio; 735 unsigned gpio;
736 int retval; 736 int retval;
737 unsigned long flags; 737 unsigned long flags;
738 738
739 if (!cpu_class_is_omap2() && irq > IH_MPUIO_BASE) 739 if (!cpu_class_is_omap2() && d->irq > IH_MPUIO_BASE)
740 gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); 740 gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
741 else 741 else
742 gpio = irq - IH_GPIO_BASE; 742 gpio = d->irq - IH_GPIO_BASE;
743 743
744 if (check_gpio(gpio) < 0) 744 if (check_gpio(gpio) < 0)
745 return -EINVAL; 745 return -EINVAL;
@@ -752,21 +752,21 @@ static int gpio_irq_type(unsigned irq, unsigned type)
752 && (type & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))) 752 && (type & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH)))
753 return -EINVAL; 753 return -EINVAL;
754 754
755 bank = get_irq_chip_data(irq); 755 bank = irq_data_get_irq_chip_data(d);
756 spin_lock_irqsave(&bank->lock, flags); 756 spin_lock_irqsave(&bank->lock, flags);
757 retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type); 757 retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type);
758 if (retval == 0) { 758 if (retval == 0) {
759 struct irq_desc *d = irq_to_desc(irq); 759 struct irq_desc *desc = irq_to_desc(d->irq);
760 760
761 d->status &= ~IRQ_TYPE_SENSE_MASK; 761 desc->status &= ~IRQ_TYPE_SENSE_MASK;
762 d->status |= type; 762 desc->status |= type;
763 } 763 }
764 spin_unlock_irqrestore(&bank->lock, flags); 764 spin_unlock_irqrestore(&bank->lock, flags);
765 765
766 if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) 766 if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
767 __set_irq_handler_unlocked(irq, handle_level_irq); 767 __set_irq_handler_unlocked(d->irq, handle_level_irq);
768 else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 768 else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
769 __set_irq_handler_unlocked(irq, handle_edge_irq); 769 __set_irq_handler_unlocked(d->irq, handle_edge_irq);
770 770
771 return retval; 771 return retval;
772} 772}
@@ -1023,15 +1023,15 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio)
1023} 1023}
1024 1024
1025/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ 1025/* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
1026static int gpio_wake_enable(unsigned int irq, unsigned int enable) 1026static int gpio_wake_enable(struct irq_data *d, unsigned int enable)
1027{ 1027{
1028 unsigned int gpio = irq - IH_GPIO_BASE; 1028 unsigned int gpio = d->irq - IH_GPIO_BASE;
1029 struct gpio_bank *bank; 1029 struct gpio_bank *bank;
1030 int retval; 1030 int retval;
1031 1031
1032 if (check_gpio(gpio) < 0) 1032 if (check_gpio(gpio) < 0)
1033 return -ENODEV; 1033 return -ENODEV;
1034 bank = get_irq_chip_data(irq); 1034 bank = irq_data_get_irq_chip_data(d);
1035 retval = _set_gpio_wakeup(bank, get_gpio_index(gpio), enable); 1035 retval = _set_gpio_wakeup(bank, get_gpio_index(gpio), enable);
1036 1036
1037 return retval; 1037 return retval;
@@ -1144,7 +1144,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1144 u32 retrigger = 0; 1144 u32 retrigger = 0;
1145 int unmasked = 0; 1145 int unmasked = 0;
1146 1146
1147 desc->chip->ack(irq); 1147 desc->irq_data.chip->irq_ack(&desc->irq_data);
1148 1148
1149 bank = get_irq_data(irq); 1149 bank = get_irq_data(irq);
1150#ifdef CONFIG_ARCH_OMAP1 1150#ifdef CONFIG_ARCH_OMAP1
@@ -1201,7 +1201,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1201 configured, we could unmask GPIO bank interrupt immediately */ 1201 configured, we could unmask GPIO bank interrupt immediately */
1202 if (!level_mask && !unmasked) { 1202 if (!level_mask && !unmasked) {
1203 unmasked = 1; 1203 unmasked = 1;
1204 desc->chip->unmask(irq); 1204 desc->irq_data.chip->irq_unmask(&desc->irq_data);
1205 } 1205 }
1206 1206
1207 isr |= retrigger; 1207 isr |= retrigger;
@@ -1237,41 +1237,40 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1237 interrupt */ 1237 interrupt */
1238exit: 1238exit:
1239 if (!unmasked) 1239 if (!unmasked)
1240 desc->chip->unmask(irq); 1240 desc->irq_data.chip->irq_unmask(&desc->irq_data);
1241
1242} 1241}
1243 1242
1244static void gpio_irq_shutdown(unsigned int irq) 1243static void gpio_irq_shutdown(struct irq_data *d)
1245{ 1244{
1246 unsigned int gpio = irq - IH_GPIO_BASE; 1245 unsigned int gpio = d->irq - IH_GPIO_BASE;
1247 struct gpio_bank *bank = get_irq_chip_data(irq); 1246 struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
1248 1247
1249 _reset_gpio(bank, gpio); 1248 _reset_gpio(bank, gpio);
1250} 1249}
1251 1250
1252static void gpio_ack_irq(unsigned int irq) 1251static void gpio_ack_irq(struct irq_data *d)
1253{ 1252{
1254 unsigned int gpio = irq - IH_GPIO_BASE; 1253 unsigned int gpio = d->irq - IH_GPIO_BASE;
1255 struct gpio_bank *bank = get_irq_chip_data(irq); 1254 struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
1256 1255
1257 _clear_gpio_irqstatus(bank, gpio); 1256 _clear_gpio_irqstatus(bank, gpio);
1258} 1257}
1259 1258
1260static void gpio_mask_irq(unsigned int irq) 1259static void gpio_mask_irq(struct irq_data *d)
1261{ 1260{
1262 unsigned int gpio = irq - IH_GPIO_BASE; 1261 unsigned int gpio = d->irq - IH_GPIO_BASE;
1263 struct gpio_bank *bank = get_irq_chip_data(irq); 1262 struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
1264 1263
1265 _set_gpio_irqenable(bank, gpio, 0); 1264 _set_gpio_irqenable(bank, gpio, 0);
1266 _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); 1265 _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE);
1267} 1266}
1268 1267
1269static void gpio_unmask_irq(unsigned int irq) 1268static void gpio_unmask_irq(struct irq_data *d)
1270{ 1269{
1271 unsigned int gpio = irq - IH_GPIO_BASE; 1270 unsigned int gpio = d->irq - IH_GPIO_BASE;
1272 struct gpio_bank *bank = get_irq_chip_data(irq); 1271 struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
1273 unsigned int irq_mask = 1 << get_gpio_index(gpio); 1272 unsigned int irq_mask = 1 << get_gpio_index(gpio);
1274 struct irq_desc *desc = irq_to_desc(irq); 1273 struct irq_desc *desc = irq_to_desc(d->irq);
1275 u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK; 1274 u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK;
1276 1275
1277 if (trigger) 1276 if (trigger)
@@ -1289,12 +1288,12 @@ static void gpio_unmask_irq(unsigned int irq)
1289 1288
1290static struct irq_chip gpio_irq_chip = { 1289static struct irq_chip gpio_irq_chip = {
1291 .name = "GPIO", 1290 .name = "GPIO",
1292 .shutdown = gpio_irq_shutdown, 1291 .irq_shutdown = gpio_irq_shutdown,
1293 .ack = gpio_ack_irq, 1292 .irq_ack = gpio_ack_irq,
1294 .mask = gpio_mask_irq, 1293 .irq_mask = gpio_mask_irq,
1295 .unmask = gpio_unmask_irq, 1294 .irq_unmask = gpio_unmask_irq,
1296 .set_type = gpio_irq_type, 1295 .irq_set_type = gpio_irq_type,
1297 .set_wake = gpio_wake_enable, 1296 .irq_set_wake = gpio_wake_enable,
1298}; 1297};
1299 1298
1300/*---------------------------------------------------------------------*/ 1299/*---------------------------------------------------------------------*/
@@ -1303,36 +1302,36 @@ static struct irq_chip gpio_irq_chip = {
1303 1302
1304/* MPUIO uses the always-on 32k clock */ 1303/* MPUIO uses the always-on 32k clock */
1305 1304
1306static void mpuio_ack_irq(unsigned int irq) 1305static void mpuio_ack_irq(struct irq_data *d)
1307{ 1306{
1308 /* The ISR is reset automatically, so do nothing here. */ 1307 /* The ISR is reset automatically, so do nothing here. */
1309} 1308}
1310 1309
1311static void mpuio_mask_irq(unsigned int irq) 1310static void mpuio_mask_irq(struct irq_data *d)
1312{ 1311{
1313 unsigned int gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); 1312 unsigned int gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
1314 struct gpio_bank *bank = get_irq_chip_data(irq); 1313 struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
1315 1314
1316 _set_gpio_irqenable(bank, gpio, 0); 1315 _set_gpio_irqenable(bank, gpio, 0);
1317} 1316}
1318 1317
1319static void mpuio_unmask_irq(unsigned int irq) 1318static void mpuio_unmask_irq(struct irq_data *d)
1320{ 1319{
1321 unsigned int gpio = OMAP_MPUIO(irq - IH_MPUIO_BASE); 1320 unsigned int gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
1322 struct gpio_bank *bank = get_irq_chip_data(irq); 1321 struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
1323 1322
1324 _set_gpio_irqenable(bank, gpio, 1); 1323 _set_gpio_irqenable(bank, gpio, 1);
1325} 1324}
1326 1325
1327static struct irq_chip mpuio_irq_chip = { 1326static struct irq_chip mpuio_irq_chip = {
1328 .name = "MPUIO", 1327 .name = "MPUIO",
1329 .ack = mpuio_ack_irq, 1328 .irq_ack = mpuio_ack_irq,
1330 .mask = mpuio_mask_irq, 1329 .irq_mask = mpuio_mask_irq,
1331 .unmask = mpuio_unmask_irq, 1330 .irq_unmask = mpuio_unmask_irq,
1332 .set_type = gpio_irq_type, 1331 .irq_set_type = gpio_irq_type,
1333#ifdef CONFIG_ARCH_OMAP16XX 1332#ifdef CONFIG_ARCH_OMAP16XX
1334 /* REVISIT: assuming only 16xx supports MPUIO wake events */ 1333 /* REVISIT: assuming only 16xx supports MPUIO wake events */
1335 .set_wake = gpio_wake_enable, 1334 .irq_set_wake = gpio_wake_enable,
1336#endif 1335#endif
1337}; 1336};
1338 1337
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index e814803d4741..5f3522314815 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -232,20 +232,19 @@ EXPORT_SYMBOL(orion_gpio_set_blink);
232 * polarity LEVEL mask 232 * polarity LEVEL mask
233 * 233 *
234 ****************************************************************************/ 234 ****************************************************************************/
235 235static void gpio_irq_ack(struct irq_data *d)
236static void gpio_irq_ack(u32 irq)
237{ 236{
238 int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK; 237 int type = irq_desc[d->irq].status & IRQ_TYPE_SENSE_MASK;
239 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) { 238 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
240 int pin = irq_to_gpio(irq); 239 int pin = irq_to_gpio(d->irq);
241 writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin)); 240 writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin));
242 } 241 }
243} 242}
244 243
245static void gpio_irq_mask(u32 irq) 244static void gpio_irq_mask(struct irq_data *d)
246{ 245{
247 int pin = irq_to_gpio(irq); 246 int pin = irq_to_gpio(d->irq);
248 int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK; 247 int type = irq_desc[d->irq].status & IRQ_TYPE_SENSE_MASK;
249 u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ? 248 u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ?
250 GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin); 249 GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin);
251 u32 u = readl(reg); 250 u32 u = readl(reg);
@@ -253,10 +252,10 @@ static void gpio_irq_mask(u32 irq)
253 writel(u, reg); 252 writel(u, reg);
254} 253}
255 254
256static void gpio_irq_unmask(u32 irq) 255static void gpio_irq_unmask(struct irq_data *d)
257{ 256{
258 int pin = irq_to_gpio(irq); 257 int pin = irq_to_gpio(d->irq);
259 int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK; 258 int type = irq_desc[d->irq].status & IRQ_TYPE_SENSE_MASK;
260 u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ? 259 u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ?
261 GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin); 260 GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin);
262 u32 u = readl(reg); 261 u32 u = readl(reg);
@@ -264,20 +263,20 @@ static void gpio_irq_unmask(u32 irq)
264 writel(u, reg); 263 writel(u, reg);
265} 264}
266 265
267static int gpio_irq_set_type(u32 irq, u32 type) 266static int gpio_irq_set_type(struct irq_data *d, u32 type)
268{ 267{
269 int pin = irq_to_gpio(irq); 268 int pin = irq_to_gpio(d->irq);
270 struct irq_desc *desc; 269 struct irq_desc *desc;
271 u32 u; 270 u32 u;
272 271
273 u = readl(GPIO_IO_CONF(pin)) & (1 << (pin & 31)); 272 u = readl(GPIO_IO_CONF(pin)) & (1 << (pin & 31));
274 if (!u) { 273 if (!u) {
275 printk(KERN_ERR "orion gpio_irq_set_type failed " 274 printk(KERN_ERR "orion gpio_irq_set_type failed "
276 "(irq %d, pin %d).\n", irq, pin); 275 "(irq %d, pin %d).\n", d->irq, pin);
277 return -EINVAL; 276 return -EINVAL;
278 } 277 }
279 278
280 desc = irq_desc + irq; 279 desc = irq_desc + d->irq;
281 280
282 /* 281 /*
283 * Set edge/level type. 282 * Set edge/level type.
@@ -287,7 +286,7 @@ static int gpio_irq_set_type(u32 irq, u32 type)
287 } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 286 } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
288 desc->handle_irq = handle_level_irq; 287 desc->handle_irq = handle_level_irq;
289 } else { 288 } else {
290 printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type); 289 printk(KERN_ERR "failed to set irq=%d (type=%d)\n", d->irq, type);
291 return -EINVAL; 290 return -EINVAL;
292 } 291 }
293 292
@@ -325,10 +324,10 @@ static int gpio_irq_set_type(u32 irq, u32 type)
325 324
326struct irq_chip orion_gpio_irq_chip = { 325struct irq_chip orion_gpio_irq_chip = {
327 .name = "orion_gpio_irq", 326 .name = "orion_gpio_irq",
328 .ack = gpio_irq_ack, 327 .irq_ack = gpio_irq_ack,
329 .mask = gpio_irq_mask, 328 .irq_mask = gpio_irq_mask,
330 .unmask = gpio_irq_unmask, 329 .irq_unmask = gpio_irq_unmask,
331 .set_type = gpio_irq_set_type, 330 .irq_set_type = gpio_irq_set_type,
332}; 331};
333 332
334void orion_gpio_irq_handler(int pinoff) 333void orion_gpio_irq_handler(int pinoff)
diff --git a/arch/arm/plat-orion/irq.c b/arch/arm/plat-orion/irq.c
index 3f9d34fc738c..7d0c7eb59f09 100644
--- a/arch/arm/plat-orion/irq.c
+++ b/arch/arm/plat-orion/irq.c
@@ -14,31 +14,31 @@
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(u32 irq) 17static void orion_irq_mask(struct irq_data *d)
18{ 18{
19 void __iomem *maskaddr = get_irq_chip_data(irq); 19 void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
20 u32 mask; 20 u32 mask;
21 21
22 mask = readl(maskaddr); 22 mask = readl(maskaddr);
23 mask &= ~(1 << (irq & 31)); 23 mask &= ~(1 << (d->irq & 31));
24 writel(mask, maskaddr); 24 writel(mask, maskaddr);
25} 25}
26 26
27static void orion_irq_unmask(u32 irq) 27static void orion_irq_unmask(struct irq_data *d)
28{ 28{
29 void __iomem *maskaddr = get_irq_chip_data(irq); 29 void __iomem *maskaddr = irq_data_get_irq_chip_data(d);
30 u32 mask; 30 u32 mask;
31 31
32 mask = readl(maskaddr); 32 mask = readl(maskaddr);
33 mask |= 1 << (irq & 31); 33 mask |= 1 << (d->irq & 31);
34 writel(mask, maskaddr); 34 writel(mask, maskaddr);
35} 35}
36 36
37static struct irq_chip orion_irq_chip = { 37static struct irq_chip orion_irq_chip = {
38 .name = "orion_irq", 38 .name = "orion_irq",
39 .mask = orion_irq_mask, 39 .irq_mask = orion_irq_mask,
40 .mask_ack = orion_irq_mask, 40 .irq_mask_ack = orion_irq_mask,
41 .unmask = orion_irq_unmask, 41 .irq_unmask = orion_irq_unmask,
42}; 42};
43 43
44void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr) 44void __init orion_irq_init(unsigned int irq_start, void __iomem *maskaddr)
diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
index 98548c6903a0..e7de6ae2a1e8 100644
--- a/arch/arm/plat-pxa/gpio.c
+++ b/arch/arm/plat-pxa/gpio.c
@@ -155,10 +155,10 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c)
155 __raw_writel(gfer, c->regbase + GFER_OFFSET); 155 __raw_writel(gfer, c->regbase + GFER_OFFSET);
156} 156}
157 157
158static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) 158static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
159{ 159{
160 struct pxa_gpio_chip *c; 160 struct pxa_gpio_chip *c;
161 int gpio = irq_to_gpio(irq); 161 int gpio = irq_to_gpio(d->irq);
162 unsigned long gpdr, mask = GPIO_bit(gpio); 162 unsigned long gpdr, mask = GPIO_bit(gpio);
163 163
164 c = gpio_to_chip(gpio); 164 c = gpio_to_chip(gpio);
@@ -195,7 +195,7 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
195 195
196 update_edge_detect(c); 196 update_edge_detect(c);
197 197
198 pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, irq, gpio, 198 pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, d->irq, gpio,
199 ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""), 199 ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""),
200 ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : "")); 200 ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : ""));
201 return 0; 201 return 0;
@@ -227,17 +227,17 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
227 } while (loop); 227 } while (loop);
228} 228}
229 229
230static void pxa_ack_muxed_gpio(unsigned int irq) 230static void pxa_ack_muxed_gpio(struct irq_data *d)
231{ 231{
232 int gpio = irq_to_gpio(irq); 232 int gpio = irq_to_gpio(d->irq);
233 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 233 struct pxa_gpio_chip *c = gpio_to_chip(gpio);
234 234
235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); 235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
236} 236}
237 237
238static void pxa_mask_muxed_gpio(unsigned int irq) 238static void pxa_mask_muxed_gpio(struct irq_data *d)
239{ 239{
240 int gpio = irq_to_gpio(irq); 240 int gpio = irq_to_gpio(d->irq);
241 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 241 struct pxa_gpio_chip *c = gpio_to_chip(gpio);
242 uint32_t grer, gfer; 242 uint32_t grer, gfer;
243 243
@@ -249,9 +249,9 @@ static void pxa_mask_muxed_gpio(unsigned int irq)
249 __raw_writel(gfer, c->regbase + GFER_OFFSET); 249 __raw_writel(gfer, c->regbase + GFER_OFFSET);
250} 250}
251 251
252static void pxa_unmask_muxed_gpio(unsigned int irq) 252static void pxa_unmask_muxed_gpio(struct irq_data *d)
253{ 253{
254 int gpio = irq_to_gpio(irq); 254 int gpio = irq_to_gpio(d->irq);
255 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 255 struct pxa_gpio_chip *c = gpio_to_chip(gpio);
256 256
257 c->irq_mask |= GPIO_bit(gpio); 257 c->irq_mask |= GPIO_bit(gpio);
@@ -260,10 +260,10 @@ static void pxa_unmask_muxed_gpio(unsigned int irq)
260 260
261static struct irq_chip pxa_muxed_gpio_chip = { 261static struct irq_chip pxa_muxed_gpio_chip = {
262 .name = "GPIO", 262 .name = "GPIO",
263 .ack = pxa_ack_muxed_gpio, 263 .irq_ack = pxa_ack_muxed_gpio,
264 .mask = pxa_mask_muxed_gpio, 264 .irq_mask = pxa_mask_muxed_gpio,
265 .unmask = pxa_unmask_muxed_gpio, 265 .irq_unmask = pxa_unmask_muxed_gpio,
266 .set_type = pxa_gpio_irq_type, 266 .irq_set_type = pxa_gpio_irq_type,
267}; 267};
268 268
269void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn) 269void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
@@ -291,7 +291,7 @@ void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
291 291
292 /* Install handler for GPIO>=2 edge detect interrupts */ 292 /* Install handler for GPIO>=2 edge detect interrupts */
293 set_irq_chained_handler(mux_irq, pxa_gpio_demux_handler); 293 set_irq_chained_handler(mux_irq, pxa_gpio_demux_handler);
294 pxa_muxed_gpio_chip.set_wake = fn; 294 pxa_muxed_gpio_chip.irq_set_wake = fn;
295} 295}
296 296
297#ifdef CONFIG_PM 297#ifdef CONFIG_PM
diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
index 44248cb926a5..1ddd2b97a729 100644
--- a/arch/arm/plat-pxa/include/plat/gpio.h
+++ b/arch/arm/plat-pxa/include/plat/gpio.h
@@ -1,6 +1,8 @@
1#ifndef __PLAT_GPIO_H 1#ifndef __PLAT_GPIO_H
2#define __PLAT_GPIO_H 2#define __PLAT_GPIO_H
3 3
4struct irq_data;
5
4/* 6/*
5 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with 7 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
6 * one set of registers. The register offsets are organized below: 8 * one set of registers. The register offsets are organized below:
@@ -56,7 +58,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
56 */ 58 */
57extern int pxa_last_gpio; 59extern int pxa_last_gpio;
58 60
59typedef int (*set_wake_t)(unsigned int irq, unsigned int on); 61typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
60 62
61extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn); 63extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
62#endif /* __PLAT_GPIO_H */ 64#endif /* __PLAT_GPIO_H */
diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c
index 8a42bc48dbf0..268f3ed0a105 100644
--- a/arch/arm/plat-s3c24xx/devs.c
+++ b/arch/arm/plat-s3c24xx/devs.c
@@ -194,7 +194,6 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_
194 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info)); 194 memcpy(&s3c2410ts_info, hard_s3c2410ts_info, sizeof(struct s3c2410_ts_mach_info));
195 s3c_device_ts.dev.platform_data = &s3c2410ts_info; 195 s3c_device_ts.dev.platform_data = &s3c2410ts_info;
196} 196}
197EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
198 197
199/* USB Device (Gadget)*/ 198/* USB Device (Gadget)*/
200 199
diff --git a/arch/arm/plat-s3c24xx/include/plat/irq.h b/arch/arm/plat-s3c24xx/include/plat/irq.h
index 69e1be8bec35..ec087d6054b1 100644
--- a/arch/arm/plat-s3c24xx/include/plat/irq.h
+++ b/arch/arm/plat-s3c24xx/include/plat/irq.h
@@ -107,9 +107,9 @@ s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
107/* exported for use in arch/arm/mach-s3c2410 */ 107/* exported for use in arch/arm/mach-s3c2410 */
108 108
109#ifdef CONFIG_PM 109#ifdef CONFIG_PM
110extern int s3c_irq_wake(unsigned int irqno, unsigned int state); 110extern int s3c_irq_wake(struct irq_data *data, unsigned int state);
111#else 111#else
112#define s3c_irq_wake NULL 112#define s3c_irq_wake NULL
113#endif 113#endif
114 114
115extern int s3c_irqext_type(unsigned int irq, unsigned int type); 115extern int s3c_irqext_type(struct irq_data *d, unsigned int type);
diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
index ea8dea3339a4..c3624d898630 100644
--- a/arch/arm/plat-s3c24xx/irq-pm.c
+++ b/arch/arm/plat-s3c24xx/irq-pm.c
@@ -15,11 +15,14 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/sysdev.h> 17#include <linux/sysdev.h>
18#include <linux/irq.h>
18 19
19#include <plat/cpu.h> 20#include <plat/cpu.h>
20#include <plat/pm.h> 21#include <plat/pm.h>
21#include <plat/irq.h> 22#include <plat/irq.h>
22 23
24#include <asm/irq.h>
25
23/* state for IRQs over sleep */ 26/* state for IRQs over sleep */
24 27
25/* default is to allow for EINT0..EINT15, and IRQ_RTC as wakeup sources 28/* default is to allow for EINT0..EINT15, and IRQ_RTC as wakeup sources
@@ -30,15 +33,15 @@
30unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL; 33unsigned long s3c_irqwake_intallow = 1L << (IRQ_RTC - IRQ_EINT0) | 0xfL;
31unsigned long s3c_irqwake_eintallow = 0x0000fff0L; 34unsigned long s3c_irqwake_eintallow = 0x0000fff0L;
32 35
33int s3c_irq_wake(unsigned int irqno, unsigned int state) 36int s3c_irq_wake(struct irq_data *data, unsigned int state)
34{ 37{
35 unsigned long irqbit = 1 << (irqno - IRQ_EINT0); 38 unsigned long irqbit = 1 << (data->irq - IRQ_EINT0);
36 39
37 if (!(s3c_irqwake_intallow & irqbit)) 40 if (!(s3c_irqwake_intallow & irqbit))
38 return -ENOENT; 41 return -ENOENT;
39 42
40 printk(KERN_INFO "wake %s for irq %d\n", 43 printk(KERN_INFO "wake %s for irq %d\n",
41 state ? "enabled" : "disabled", irqno); 44 state ? "enabled" : "disabled", data->irq);
42 45
43 if (!state) 46 if (!state)
44 s3c_irqwake_intmask |= irqbit; 47 s3c_irqwake_intmask |= irqbit;
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index ad0d44ef1f93..4434cb56bd9a 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -34,30 +34,29 @@
34#include <plat/irq.h> 34#include <plat/irq.h>
35 35
36static void 36static void
37s3c_irq_mask(unsigned int irqno) 37s3c_irq_mask(struct irq_data *data)
38{ 38{
39 unsigned int irqno = data->irq - IRQ_EINT0;
39 unsigned long mask; 40 unsigned long mask;
40 41
41 irqno -= IRQ_EINT0;
42
43 mask = __raw_readl(S3C2410_INTMSK); 42 mask = __raw_readl(S3C2410_INTMSK);
44 mask |= 1UL << irqno; 43 mask |= 1UL << irqno;
45 __raw_writel(mask, S3C2410_INTMSK); 44 __raw_writel(mask, S3C2410_INTMSK);
46} 45}
47 46
48static inline void 47static inline void
49s3c_irq_ack(unsigned int irqno) 48s3c_irq_ack(struct irq_data *data)
50{ 49{
51 unsigned long bitval = 1UL << (irqno - IRQ_EINT0); 50 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
52 51
53 __raw_writel(bitval, S3C2410_SRCPND); 52 __raw_writel(bitval, S3C2410_SRCPND);
54 __raw_writel(bitval, S3C2410_INTPND); 53 __raw_writel(bitval, S3C2410_INTPND);
55} 54}
56 55
57static inline void 56static inline void
58s3c_irq_maskack(unsigned int irqno) 57s3c_irq_maskack(struct irq_data *data)
59{ 58{
60 unsigned long bitval = 1UL << (irqno - IRQ_EINT0); 59 unsigned long bitval = 1UL << (data->irq - IRQ_EINT0);
61 unsigned long mask; 60 unsigned long mask;
62 61
63 mask = __raw_readl(S3C2410_INTMSK); 62 mask = __raw_readl(S3C2410_INTMSK);
@@ -69,8 +68,9 @@ s3c_irq_maskack(unsigned int irqno)
69 68
70 69
71static void 70static void
72s3c_irq_unmask(unsigned int irqno) 71s3c_irq_unmask(struct irq_data *data)
73{ 72{
73 unsigned int irqno = data->irq;
74 unsigned long mask; 74 unsigned long mask;
75 75
76 if (irqno != IRQ_TIMER4 && irqno != IRQ_EINT8t23) 76 if (irqno != IRQ_TIMER4 && irqno != IRQ_EINT8t23)
@@ -85,40 +85,39 @@ s3c_irq_unmask(unsigned int irqno)
85 85
86struct irq_chip s3c_irq_level_chip = { 86struct irq_chip s3c_irq_level_chip = {
87 .name = "s3c-level", 87 .name = "s3c-level",
88 .ack = s3c_irq_maskack, 88 .irq_ack = s3c_irq_maskack,
89 .mask = s3c_irq_mask, 89 .irq_mask = s3c_irq_mask,
90 .unmask = s3c_irq_unmask, 90 .irq_unmask = s3c_irq_unmask,
91 .set_wake = s3c_irq_wake 91 .irq_set_wake = s3c_irq_wake
92}; 92};
93 93
94struct irq_chip s3c_irq_chip = { 94struct irq_chip s3c_irq_chip = {
95 .name = "s3c", 95 .name = "s3c",
96 .ack = s3c_irq_ack, 96 .irq_ack = s3c_irq_ack,
97 .mask = s3c_irq_mask, 97 .irq_mask = s3c_irq_mask,
98 .unmask = s3c_irq_unmask, 98 .irq_unmask = s3c_irq_unmask,
99 .set_wake = s3c_irq_wake 99 .irq_set_wake = s3c_irq_wake
100}; 100};
101 101
102static void 102static void
103s3c_irqext_mask(unsigned int irqno) 103s3c_irqext_mask(struct irq_data *data)
104{ 104{
105 unsigned int irqno = data->irq - EXTINT_OFF;
105 unsigned long mask; 106 unsigned long mask;
106 107
107 irqno -= EXTINT_OFF;
108
109 mask = __raw_readl(S3C24XX_EINTMASK); 108 mask = __raw_readl(S3C24XX_EINTMASK);
110 mask |= ( 1UL << irqno); 109 mask |= ( 1UL << irqno);
111 __raw_writel(mask, S3C24XX_EINTMASK); 110 __raw_writel(mask, S3C24XX_EINTMASK);
112} 111}
113 112
114static void 113static void
115s3c_irqext_ack(unsigned int irqno) 114s3c_irqext_ack(struct irq_data *data)
116{ 115{
117 unsigned long req; 116 unsigned long req;
118 unsigned long bit; 117 unsigned long bit;
119 unsigned long mask; 118 unsigned long mask;
120 119
121 bit = 1UL << (irqno - EXTINT_OFF); 120 bit = 1UL << (data->irq - EXTINT_OFF);
122 121
123 mask = __raw_readl(S3C24XX_EINTMASK); 122 mask = __raw_readl(S3C24XX_EINTMASK);
124 123
@@ -129,64 +128,57 @@ s3c_irqext_ack(unsigned int irqno)
129 128
130 /* not sure if we should be acking the parent irq... */ 129 /* not sure if we should be acking the parent irq... */
131 130
132 if (irqno <= IRQ_EINT7 ) { 131 if (data->irq <= IRQ_EINT7) {
133 if ((req & 0xf0) == 0) 132 if ((req & 0xf0) == 0)
134 s3c_irq_ack(IRQ_EINT4t7); 133 s3c_irq_ack(irq_get_irq_data(IRQ_EINT4t7));
135 } else { 134 } else {
136 if ((req >> 8) == 0) 135 if ((req >> 8) == 0)
137 s3c_irq_ack(IRQ_EINT8t23); 136 s3c_irq_ack(irq_get_irq_data(IRQ_EINT8t23));
138 } 137 }
139} 138}
140 139
141static void 140static void
142s3c_irqext_unmask(unsigned int irqno) 141s3c_irqext_unmask(struct irq_data *data)
143{ 142{
143 unsigned int irqno = data->irq - EXTINT_OFF;
144 unsigned long mask; 144 unsigned long mask;
145 145
146 irqno -= EXTINT_OFF;
147
148 mask = __raw_readl(S3C24XX_EINTMASK); 146 mask = __raw_readl(S3C24XX_EINTMASK);
149 mask &= ~( 1UL << irqno); 147 mask &= ~(1UL << irqno);
150 __raw_writel(mask, S3C24XX_EINTMASK); 148 __raw_writel(mask, S3C24XX_EINTMASK);
151} 149}
152 150
153int 151int
154s3c_irqext_type(unsigned int irq, unsigned int type) 152s3c_irqext_type(struct irq_data *data, unsigned int type)
155{ 153{
156 void __iomem *extint_reg; 154 void __iomem *extint_reg;
157 void __iomem *gpcon_reg; 155 void __iomem *gpcon_reg;
158 unsigned long gpcon_offset, extint_offset; 156 unsigned long gpcon_offset, extint_offset;
159 unsigned long newvalue = 0, value; 157 unsigned long newvalue = 0, value;
160 158
161 if ((irq >= IRQ_EINT0) && (irq <= IRQ_EINT3)) 159 if ((data->irq >= IRQ_EINT0) && (data->irq <= IRQ_EINT3)) {
162 {
163 gpcon_reg = S3C2410_GPFCON; 160 gpcon_reg = S3C2410_GPFCON;
164 extint_reg = S3C24XX_EXTINT0; 161 extint_reg = S3C24XX_EXTINT0;
165 gpcon_offset = (irq - IRQ_EINT0) * 2; 162 gpcon_offset = (data->irq - IRQ_EINT0) * 2;
166 extint_offset = (irq - IRQ_EINT0) * 4; 163 extint_offset = (data->irq - IRQ_EINT0) * 4;
167 } 164 } else if ((data->irq >= IRQ_EINT4) && (data->irq <= IRQ_EINT7)) {
168 else if ((irq >= IRQ_EINT4) && (irq <= IRQ_EINT7))
169 {
170 gpcon_reg = S3C2410_GPFCON; 165 gpcon_reg = S3C2410_GPFCON;
171 extint_reg = S3C24XX_EXTINT0; 166 extint_reg = S3C24XX_EXTINT0;
172 gpcon_offset = (irq - (EXTINT_OFF)) * 2; 167 gpcon_offset = (data->irq - (EXTINT_OFF)) * 2;
173 extint_offset = (irq - (EXTINT_OFF)) * 4; 168 extint_offset = (data->irq - (EXTINT_OFF)) * 4;
174 } 169 } else if ((data->irq >= IRQ_EINT8) && (data->irq <= IRQ_EINT15)) {
175 else if ((irq >= IRQ_EINT8) && (irq <= IRQ_EINT15))
176 {
177 gpcon_reg = S3C2410_GPGCON; 170 gpcon_reg = S3C2410_GPGCON;
178 extint_reg = S3C24XX_EXTINT1; 171 extint_reg = S3C24XX_EXTINT1;
179 gpcon_offset = (irq - IRQ_EINT8) * 2; 172 gpcon_offset = (data->irq - IRQ_EINT8) * 2;
180 extint_offset = (irq - IRQ_EINT8) * 4; 173 extint_offset = (data->irq - IRQ_EINT8) * 4;
181 } 174 } else if ((data->irq >= IRQ_EINT16) && (data->irq <= IRQ_EINT23)) {
182 else if ((irq >= IRQ_EINT16) && (irq <= IRQ_EINT23))
183 {
184 gpcon_reg = S3C2410_GPGCON; 175 gpcon_reg = S3C2410_GPGCON;
185 extint_reg = S3C24XX_EXTINT2; 176 extint_reg = S3C24XX_EXTINT2;
186 gpcon_offset = (irq - IRQ_EINT8) * 2; 177 gpcon_offset = (data->irq - IRQ_EINT8) * 2;
187 extint_offset = (irq - IRQ_EINT16) * 4; 178 extint_offset = (data->irq - IRQ_EINT16) * 4;
188 } else 179 } else {
189 return -1; 180 return -1;
181 }
190 182
191 /* Set the GPIO to external interrupt mode */ 183 /* Set the GPIO to external interrupt mode */
192 value = __raw_readl(gpcon_reg); 184 value = __raw_readl(gpcon_reg);
@@ -234,20 +226,20 @@ s3c_irqext_type(unsigned int irq, unsigned int type)
234 226
235static struct irq_chip s3c_irqext_chip = { 227static struct irq_chip s3c_irqext_chip = {
236 .name = "s3c-ext", 228 .name = "s3c-ext",
237 .mask = s3c_irqext_mask, 229 .irq_mask = s3c_irqext_mask,
238 .unmask = s3c_irqext_unmask, 230 .irq_unmask = s3c_irqext_unmask,
239 .ack = s3c_irqext_ack, 231 .irq_ack = s3c_irqext_ack,
240 .set_type = s3c_irqext_type, 232 .irq_set_type = s3c_irqext_type,
241 .set_wake = s3c_irqext_wake 233 .irq_set_wake = s3c_irqext_wake
242}; 234};
243 235
244static struct irq_chip s3c_irq_eint0t4 = { 236static struct irq_chip s3c_irq_eint0t4 = {
245 .name = "s3c-ext0", 237 .name = "s3c-ext0",
246 .ack = s3c_irq_ack, 238 .irq_ack = s3c_irq_ack,
247 .mask = s3c_irq_mask, 239 .irq_mask = s3c_irq_mask,
248 .unmask = s3c_irq_unmask, 240 .irq_unmask = s3c_irq_unmask,
249 .set_wake = s3c_irq_wake, 241 .irq_set_wake = s3c_irq_wake,
250 .set_type = s3c_irqext_type, 242 .irq_set_type = s3c_irqext_type,
251}; 243};
252 244
253/* mask values for the parent registers for each of the interrupt types */ 245/* mask values for the parent registers for each of the interrupt types */
@@ -261,109 +253,109 @@ static struct irq_chip s3c_irq_eint0t4 = {
261/* UART0 */ 253/* UART0 */
262 254
263static void 255static void
264s3c_irq_uart0_mask(unsigned int irqno) 256s3c_irq_uart0_mask(struct irq_data *data)
265{ 257{
266 s3c_irqsub_mask(irqno, INTMSK_UART0, 7); 258 s3c_irqsub_mask(data->irq, INTMSK_UART0, 7);
267} 259}
268 260
269static void 261static void
270s3c_irq_uart0_unmask(unsigned int irqno) 262s3c_irq_uart0_unmask(struct irq_data *data)
271{ 263{
272 s3c_irqsub_unmask(irqno, INTMSK_UART0); 264 s3c_irqsub_unmask(data->irq, INTMSK_UART0);
273} 265}
274 266
275static void 267static void
276s3c_irq_uart0_ack(unsigned int irqno) 268s3c_irq_uart0_ack(struct irq_data *data)
277{ 269{
278 s3c_irqsub_maskack(irqno, INTMSK_UART0, 7); 270 s3c_irqsub_maskack(data->irq, INTMSK_UART0, 7);
279} 271}
280 272
281static struct irq_chip s3c_irq_uart0 = { 273static struct irq_chip s3c_irq_uart0 = {
282 .name = "s3c-uart0", 274 .name = "s3c-uart0",
283 .mask = s3c_irq_uart0_mask, 275 .irq_mask = s3c_irq_uart0_mask,
284 .unmask = s3c_irq_uart0_unmask, 276 .irq_unmask = s3c_irq_uart0_unmask,
285 .ack = s3c_irq_uart0_ack, 277 .irq_ack = s3c_irq_uart0_ack,
286}; 278};
287 279
288/* UART1 */ 280/* UART1 */
289 281
290static void 282static void
291s3c_irq_uart1_mask(unsigned int irqno) 283s3c_irq_uart1_mask(struct irq_data *data)
292{ 284{
293 s3c_irqsub_mask(irqno, INTMSK_UART1, 7 << 3); 285 s3c_irqsub_mask(data->irq, INTMSK_UART1, 7 << 3);
294} 286}
295 287
296static void 288static void
297s3c_irq_uart1_unmask(unsigned int irqno) 289s3c_irq_uart1_unmask(struct irq_data *data)
298{ 290{
299 s3c_irqsub_unmask(irqno, INTMSK_UART1); 291 s3c_irqsub_unmask(data->irq, INTMSK_UART1);
300} 292}
301 293
302static void 294static void
303s3c_irq_uart1_ack(unsigned int irqno) 295s3c_irq_uart1_ack(struct irq_data *data)
304{ 296{
305 s3c_irqsub_maskack(irqno, INTMSK_UART1, 7 << 3); 297 s3c_irqsub_maskack(data->irq, INTMSK_UART1, 7 << 3);
306} 298}
307 299
308static struct irq_chip s3c_irq_uart1 = { 300static struct irq_chip s3c_irq_uart1 = {
309 .name = "s3c-uart1", 301 .name = "s3c-uart1",
310 .mask = s3c_irq_uart1_mask, 302 .irq_mask = s3c_irq_uart1_mask,
311 .unmask = s3c_irq_uart1_unmask, 303 .irq_unmask = s3c_irq_uart1_unmask,
312 .ack = s3c_irq_uart1_ack, 304 .irq_ack = s3c_irq_uart1_ack,
313}; 305};
314 306
315/* UART2 */ 307/* UART2 */
316 308
317static void 309static void
318s3c_irq_uart2_mask(unsigned int irqno) 310s3c_irq_uart2_mask(struct irq_data *data)
319{ 311{
320 s3c_irqsub_mask(irqno, INTMSK_UART2, 7 << 6); 312 s3c_irqsub_mask(data->irq, INTMSK_UART2, 7 << 6);
321} 313}
322 314
323static void 315static void
324s3c_irq_uart2_unmask(unsigned int irqno) 316s3c_irq_uart2_unmask(struct irq_data *data)
325{ 317{
326 s3c_irqsub_unmask(irqno, INTMSK_UART2); 318 s3c_irqsub_unmask(data->irq, INTMSK_UART2);
327} 319}
328 320
329static void 321static void
330s3c_irq_uart2_ack(unsigned int irqno) 322s3c_irq_uart2_ack(struct irq_data *data)
331{ 323{
332 s3c_irqsub_maskack(irqno, INTMSK_UART2, 7 << 6); 324 s3c_irqsub_maskack(data->irq, INTMSK_UART2, 7 << 6);
333} 325}
334 326
335static struct irq_chip s3c_irq_uart2 = { 327static struct irq_chip s3c_irq_uart2 = {
336 .name = "s3c-uart2", 328 .name = "s3c-uart2",
337 .mask = s3c_irq_uart2_mask, 329 .irq_mask = s3c_irq_uart2_mask,
338 .unmask = s3c_irq_uart2_unmask, 330 .irq_unmask = s3c_irq_uart2_unmask,
339 .ack = s3c_irq_uart2_ack, 331 .irq_ack = s3c_irq_uart2_ack,
340}; 332};
341 333
342/* ADC and Touchscreen */ 334/* ADC and Touchscreen */
343 335
344static void 336static void
345s3c_irq_adc_mask(unsigned int irqno) 337s3c_irq_adc_mask(struct irq_data *d)
346{ 338{
347 s3c_irqsub_mask(irqno, INTMSK_ADCPARENT, 3 << 9); 339 s3c_irqsub_mask(d->irq, INTMSK_ADCPARENT, 3 << 9);
348} 340}
349 341
350static void 342static void
351s3c_irq_adc_unmask(unsigned int irqno) 343s3c_irq_adc_unmask(struct irq_data *d)
352{ 344{
353 s3c_irqsub_unmask(irqno, INTMSK_ADCPARENT); 345 s3c_irqsub_unmask(d->irq, INTMSK_ADCPARENT);
354} 346}
355 347
356static void 348static void
357s3c_irq_adc_ack(unsigned int irqno) 349s3c_irq_adc_ack(struct irq_data *d)
358{ 350{
359 s3c_irqsub_ack(irqno, INTMSK_ADCPARENT, 3 << 9); 351 s3c_irqsub_ack(d->irq, INTMSK_ADCPARENT, 3 << 9);
360} 352}
361 353
362static struct irq_chip s3c_irq_adc = { 354static struct irq_chip s3c_irq_adc = {
363 .name = "s3c-adc", 355 .name = "s3c-adc",
364 .mask = s3c_irq_adc_mask, 356 .irq_mask = s3c_irq_adc_mask,
365 .unmask = s3c_irq_adc_unmask, 357 .irq_unmask = s3c_irq_adc_unmask,
366 .ack = s3c_irq_adc_ack, 358 .irq_ack = s3c_irq_adc_ack,
367}; 359};
368 360
369/* irq demux for adc */ 361/* irq demux for adc */
diff --git a/arch/arm/plat-s3c24xx/s3c2443-clock.c b/arch/arm/plat-s3c24xx/s3c2443-clock.c
index 461f070eb62d..82f2d4a39291 100644
--- a/arch/arm/plat-s3c24xx/s3c2443-clock.c
+++ b/arch/arm/plat-s3c24xx/s3c2443-clock.c
@@ -271,7 +271,7 @@ static struct clk init_clocks[] = {
271 .ctrlbit = S3C2443_HCLKCON_DMA5, 271 .ctrlbit = S3C2443_HCLKCON_DMA5,
272 }, { 272 }, {
273 .name = "hsmmc", 273 .name = "hsmmc",
274 .id = 0, 274 .id = 1,
275 .parent = &clk_h, 275 .parent = &clk_h,
276 .enable = s3c2443_clkcon_enable_h, 276 .enable = s3c2443_clkcon_enable_h,
277 .ctrlbit = S3C2443_HCLKCON_HSMMC, 277 .ctrlbit = S3C2443_HCLKCON_HSMMC,
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 65dbfa8e0a86..deb39951a22e 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -56,3 +56,29 @@ config S5P_DEV_ONENAND
56 bool 56 bool
57 help 57 help
58 Compile in platform device definition for OneNAND controller 58 Compile in platform device definition for OneNAND controller
59
60config S5P_DEV_CSIS0
61 bool
62 help
63 Compile in platform device definitions for MIPI-CSIS channel 0
64
65config S5P_DEV_CSIS1
66 bool
67 help
68 Compile in platform device definitions for MIPI-CSIS channel 1
69
70menuconfig S5P_SYSMMU
71 bool "SYSMMU support"
72 depends on ARCH_S5PV310
73 help
74 This is a System MMU driver for Samsung ARM based Soc.
75
76if S5P_SYSMMU
77
78config S5P_SYSMMU_DEBUG
79 bool "Enables debug messages"
80 depends on S5P_SYSMMU
81 help
82 This enables SYSMMU driver debug massages.
83
84endif
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index de65238a7aef..92efe1adcfd6 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -28,3 +28,6 @@ obj-$(CONFIG_S5P_DEV_FIMC0) += dev-fimc0.o
28obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o 28obj-$(CONFIG_S5P_DEV_FIMC1) += dev-fimc1.o
29obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o 29obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o
30obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o 30obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o
31obj-$(CONFIG_S5P_DEV_CSIS0) += dev-csis0.o
32obj-$(CONFIG_S5P_DEV_CSIS1) += dev-csis1.o
33obj-$(CONFIG_S5P_SYSMMU) += sysmmu.o
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c
index 74f7f5a5446c..047d31c1bbd8 100644
--- a/arch/arm/plat-s5p/cpu.c
+++ b/arch/arm/plat-s5p/cpu.c
@@ -108,6 +108,11 @@ static struct map_desc s5p_iodesc[] __initdata = {
108 .pfn = __phys_to_pfn(S3C_PA_WDT), 108 .pfn = __phys_to_pfn(S3C_PA_WDT),
109 .length = SZ_4K, 109 .length = SZ_4K,
110 .type = MT_DEVICE, 110 .type = MT_DEVICE,
111 }, {
112 .virtual = (unsigned long)S5P_VA_SROMC,
113 .pfn = __phys_to_pfn(S5P_PA_SROMC),
114 .length = SZ_4K,
115 .type = MT_DEVICE,
111 }, 116 },
112}; 117};
113 118
diff --git a/arch/arm/plat-s5p/dev-csis0.c b/arch/arm/plat-s5p/dev-csis0.c
new file mode 100644
index 000000000000..dfab1c85f54f
--- /dev/null
+++ b/arch/arm/plat-s5p/dev-csis0.c
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2010 Samsung Electronics
3 *
4 * S5P series device definition for MIPI-CSIS channel 0
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/interrupt.h>
13#include <linux/platform_device.h>
14#include <mach/map.h>
15
16static struct resource s5p_mipi_csis0_resource[] = {
17 [0] = {
18 .start = S5P_PA_MIPI_CSIS0,
19 .end = S5P_PA_MIPI_CSIS0 + SZ_4K - 1,
20 .flags = IORESOURCE_MEM,
21 },
22 [1] = {
23 .start = IRQ_MIPI_CSIS0,
24 .end = IRQ_MIPI_CSIS0,
25 .flags = IORESOURCE_IRQ,
26 }
27};
28
29struct platform_device s5p_device_mipi_csis0 = {
30 .name = "s5p-mipi-csis",
31 .id = 0,
32 .num_resources = ARRAY_SIZE(s5p_mipi_csis0_resource),
33 .resource = s5p_mipi_csis0_resource,
34};
diff --git a/arch/arm/plat-s5p/dev-csis1.c b/arch/arm/plat-s5p/dev-csis1.c
new file mode 100644
index 000000000000..e3053f27fbbf
--- /dev/null
+++ b/arch/arm/plat-s5p/dev-csis1.c
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2010 Samsung Electronics
3 *
4 * S5P series device definition for MIPI-CSIS channel 1
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/kernel.h>
12#include <linux/interrupt.h>
13#include <linux/platform_device.h>
14#include <mach/map.h>
15
16static struct resource s5p_mipi_csis1_resource[] = {
17 [0] = {
18 .start = S5P_PA_MIPI_CSIS1,
19 .end = S5P_PA_MIPI_CSIS1 + SZ_4K - 1,
20 .flags = IORESOURCE_MEM,
21 },
22 [1] = {
23 .start = IRQ_MIPI_CSIS1,
24 .end = IRQ_MIPI_CSIS1,
25 .flags = IORESOURCE_IRQ,
26 },
27};
28
29struct platform_device s5p_device_mipi_csis1 = {
30 .name = "s5p-mipi-csis",
31 .id = 1,
32 .num_resources = ARRAY_SIZE(s5p_mipi_csis1_resource),
33 .resource = s5p_mipi_csis1_resource,
34};
diff --git a/arch/arm/plat-s5p/include/plat/csis.h b/arch/arm/plat-s5p/include/plat/csis.h
new file mode 100644
index 000000000000..51e308c7981d
--- /dev/null
+++ b/arch/arm/plat-s5p/include/plat/csis.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2010 Samsung Electronics
3 *
4 * S5P series MIPI CSI slave device support
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef PLAT_S5P_CSIS_H_
12#define PLAT_S5P_CSIS_H_ __FILE__
13
14/**
15 * struct s5p_platform_mipi_csis - platform data for MIPI-CSIS
16 * @clk_rate: bus clock frequency
17 * @lanes: number of data lanes used
18 * @alignment: data alignment in bits
19 * @hs_settle: HS-RX settle time
20 */
21struct s5p_platform_mipi_csis {
22 unsigned long clk_rate;
23 u8 lanes;
24 u8 alignment;
25 u8 hs_settle;
26};
27
28#endif /* PLAT_S5P_CSIS_H_ */
diff --git a/arch/arm/plat-s5p/include/plat/map-s5p.h b/arch/arm/plat-s5p/include/plat/map-s5p.h
index fef353d44513..d973d39666a3 100644
--- a/arch/arm/plat-s5p/include/plat/map-s5p.h
+++ b/arch/arm/plat-s5p/include/plat/map-s5p.h
@@ -15,6 +15,7 @@
15 15
16#define S5P_VA_CHIPID S3C_ADDR(0x02000000) 16#define S5P_VA_CHIPID S3C_ADDR(0x02000000)
17#define S5P_VA_CMU S3C_ADDR(0x02100000) 17#define S5P_VA_CMU S3C_ADDR(0x02100000)
18#define S5P_VA_PMU S3C_ADDR(0x02180000)
18#define S5P_VA_GPIO S3C_ADDR(0x02200000) 19#define S5P_VA_GPIO S3C_ADDR(0x02200000)
19#define S5P_VA_GPIO1 S5P_VA_GPIO 20#define S5P_VA_GPIO1 S5P_VA_GPIO
20#define S5P_VA_GPIO2 S3C_ADDR(0x02240000) 21#define S5P_VA_GPIO2 S3C_ADDR(0x02240000)
diff --git a/arch/arm/plat-s5p/include/plat/regs-srom.h b/arch/arm/plat-s5p/include/plat/regs-srom.h
new file mode 100644
index 000000000000..f121ab5e76cb
--- /dev/null
+++ b/arch/arm/plat-s5p/include/plat/regs-srom.h
@@ -0,0 +1,54 @@
1/* linux/arch/arm/plat-s5p/include/plat/regs-srom.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P SROMC register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_S5P_REGS_SROM_H
14#define __ASM_PLAT_S5P_REGS_SROM_H __FILE__
15
16#include <mach/map.h>
17
18#define S5P_SROMREG(x) (S5P_VA_SROMC + (x))
19
20#define S5P_SROM_BW S5P_SROMREG(0x0)
21#define S5P_SROM_BC0 S5P_SROMREG(0x4)
22#define S5P_SROM_BC1 S5P_SROMREG(0x8)
23#define S5P_SROM_BC2 S5P_SROMREG(0xc)
24#define S5P_SROM_BC3 S5P_SROMREG(0x10)
25#define S5P_SROM_BC4 S5P_SROMREG(0x14)
26#define S5P_SROM_BC5 S5P_SROMREG(0x18)
27
28/* one register BW holds 4 x 4-bit packed settings for NCS0 - NCS3 */
29
30#define S5P_SROM_BW__DATAWIDTH__SHIFT 0
31#define S5P_SROM_BW__ADDRMODE__SHIFT 1
32#define S5P_SROM_BW__WAITENABLE__SHIFT 2
33#define S5P_SROM_BW__BYTEENABLE__SHIFT 3
34
35#define S5P_SROM_BW__CS_MASK 0xf
36
37#define S5P_SROM_BW__NCS0__SHIFT 0
38#define S5P_SROM_BW__NCS1__SHIFT 4
39#define S5P_SROM_BW__NCS2__SHIFT 8
40#define S5P_SROM_BW__NCS3__SHIFT 12
41#define S5P_SROM_BW__NCS4__SHIFT 16
42#define S5P_SROM_BW__NCS5__SHIFT 20
43
44/* applies to same to BCS0 - BCS3 */
45
46#define S5P_SROM_BCX__PMC__SHIFT 0
47#define S5P_SROM_BCX__TACP__SHIFT 4
48#define S5P_SROM_BCX__TCAH__SHIFT 8
49#define S5P_SROM_BCX__TCOH__SHIFT 12
50#define S5P_SROM_BCX__TACC__SHIFT 16
51#define S5P_SROM_BCX__TCOS__SHIFT 24
52#define S5P_SROM_BCX__TACS__SHIFT 28
53
54#endif /* __ASM_PLAT_S5P_REGS_SROM_H */
diff --git a/arch/arm/plat-s5p/include/plat/sysmmu.h b/arch/arm/plat-s5p/include/plat/sysmmu.h
new file mode 100644
index 000000000000..db298fc5438a
--- /dev/null
+++ b/arch/arm/plat-s5p/include/plat/sysmmu.h
@@ -0,0 +1,23 @@
1/* linux/arch/arm/plat-s5p/include/plat/sysmmu.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Samsung sysmmu driver
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_S5P_SYSMMU_H
14#define __ASM_PLAT_S5P_SYSMMU_H __FILE__
15
16/* debug macro */
17#ifdef CONFIG_S5P_SYSMMU_DEBUG
18#define sysmmu_debug(fmt, arg...) printk(KERN_INFO "[%s] " fmt, __func__, ## arg)
19#else
20#define sysmmu_debug(fmt, arg...) do { } while (0)
21#endif
22
23#endif /* __ASM_PLAT_S5P_SYSMMU_H */
diff --git a/arch/arm/plat-s5p/irq-eint.c b/arch/arm/plat-s5p/irq-eint.c
index 752f1a645f9d..225aa25405db 100644
--- a/arch/arm/plat-s5p/irq-eint.c
+++ b/arch/arm/plat-s5p/irq-eint.c
@@ -28,39 +28,40 @@
28#include <plat/gpio-cfg.h> 28#include <plat/gpio-cfg.h>
29#include <mach/regs-gpio.h> 29#include <mach/regs-gpio.h>
30 30
31static inline void s5p_irq_eint_mask(unsigned int irq) 31static inline void s5p_irq_eint_mask(struct irq_data *data)
32{ 32{
33 u32 mask; 33 u32 mask;
34 34
35 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(irq))); 35 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
36 mask |= eint_irq_to_bit(irq); 36 mask |= eint_irq_to_bit(data->irq);
37 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(irq))); 37 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
38} 38}
39 39
40static void s5p_irq_eint_unmask(unsigned int irq) 40static void s5p_irq_eint_unmask(struct irq_data *data)
41{ 41{
42 u32 mask; 42 u32 mask;
43 43
44 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(irq))); 44 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq)));
45 mask &= ~(eint_irq_to_bit(irq)); 45 mask &= ~(eint_irq_to_bit(data->irq));
46 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(irq))); 46 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq)));
47} 47}
48 48
49static inline void s5p_irq_eint_ack(unsigned int irq) 49static inline void s5p_irq_eint_ack(struct irq_data *data)
50{ 50{
51 __raw_writel(eint_irq_to_bit(irq), S5P_EINT_PEND(EINT_REG_NR(irq))); 51 __raw_writel(eint_irq_to_bit(data->irq),
52 S5P_EINT_PEND(EINT_REG_NR(data->irq)));
52} 53}
53 54
54static void s5p_irq_eint_maskack(unsigned int irq) 55static void s5p_irq_eint_maskack(struct irq_data *data)
55{ 56{
56 /* compiler should in-line these */ 57 /* compiler should in-line these */
57 s5p_irq_eint_mask(irq); 58 s5p_irq_eint_mask(data);
58 s5p_irq_eint_ack(irq); 59 s5p_irq_eint_ack(data);
59} 60}
60 61
61static int s5p_irq_eint_set_type(unsigned int irq, unsigned int type) 62static int s5p_irq_eint_set_type(struct irq_data *data, unsigned int type)
62{ 63{
63 int offs = EINT_OFFSET(irq); 64 int offs = EINT_OFFSET(data->irq);
64 int shift; 65 int shift;
65 u32 ctrl, mask; 66 u32 ctrl, mask;
66 u32 newvalue = 0; 67 u32 newvalue = 0;
@@ -94,10 +95,10 @@ static int s5p_irq_eint_set_type(unsigned int irq, unsigned int type)
94 shift = (offs & 0x7) * 4; 95 shift = (offs & 0x7) * 4;
95 mask = 0x7 << shift; 96 mask = 0x7 << shift;
96 97
97 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(irq))); 98 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq)));
98 ctrl &= ~mask; 99 ctrl &= ~mask;
99 ctrl |= newvalue << shift; 100 ctrl |= newvalue << shift;
100 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(irq))); 101 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq)));
101 102
102 if ((0 <= offs) && (offs < 8)) 103 if ((0 <= offs) && (offs < 8))
103 s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE); 104 s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE);
@@ -119,13 +120,13 @@ static int s5p_irq_eint_set_type(unsigned int irq, unsigned int type)
119 120
120static struct irq_chip s5p_irq_eint = { 121static struct irq_chip s5p_irq_eint = {
121 .name = "s5p-eint", 122 .name = "s5p-eint",
122 .mask = s5p_irq_eint_mask, 123 .irq_mask = s5p_irq_eint_mask,
123 .unmask = s5p_irq_eint_unmask, 124 .irq_unmask = s5p_irq_eint_unmask,
124 .mask_ack = s5p_irq_eint_maskack, 125 .irq_mask_ack = s5p_irq_eint_maskack,
125 .ack = s5p_irq_eint_ack, 126 .irq_ack = s5p_irq_eint_ack,
126 .set_type = s5p_irq_eint_set_type, 127 .irq_set_type = s5p_irq_eint_set_type,
127#ifdef CONFIG_PM 128#ifdef CONFIG_PM
128 .set_wake = s3c_irqext_wake, 129 .irq_set_wake = s3c_irqext_wake,
129#endif 130#endif
130}; 131};
131 132
@@ -159,42 +160,43 @@ static void s5p_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
159 s5p_irq_demux_eint(IRQ_EINT(24)); 160 s5p_irq_demux_eint(IRQ_EINT(24));
160} 161}
161 162
162static inline void s5p_irq_vic_eint_mask(unsigned int irq) 163static inline void s5p_irq_vic_eint_mask(struct irq_data *data)
163{ 164{
164 void __iomem *base = get_irq_chip_data(irq); 165 void __iomem *base = irq_data_get_irq_chip_data(data);
165 166
166 s5p_irq_eint_mask(irq); 167 s5p_irq_eint_mask(data);
167 writel(1 << EINT_OFFSET(irq), base + VIC_INT_ENABLE_CLEAR); 168 writel(1 << EINT_OFFSET(data->irq), base + VIC_INT_ENABLE_CLEAR);
168} 169}
169 170
170static void s5p_irq_vic_eint_unmask(unsigned int irq) 171static void s5p_irq_vic_eint_unmask(struct irq_data *data)
171{ 172{
172 void __iomem *base = get_irq_chip_data(irq); 173 void __iomem *base = irq_data_get_irq_chip_data(data);
173 174
174 s5p_irq_eint_unmask(irq); 175 s5p_irq_eint_unmask(data);
175 writel(1 << EINT_OFFSET(irq), base + VIC_INT_ENABLE); 176 writel(1 << EINT_OFFSET(data->irq), base + VIC_INT_ENABLE);
176} 177}
177 178
178static inline void s5p_irq_vic_eint_ack(unsigned int irq) 179static inline void s5p_irq_vic_eint_ack(struct irq_data *data)
179{ 180{
180 __raw_writel(eint_irq_to_bit(irq), S5P_EINT_PEND(EINT_REG_NR(irq))); 181 __raw_writel(eint_irq_to_bit(data->irq),
182 S5P_EINT_PEND(EINT_REG_NR(data->irq)));
181} 183}
182 184
183static void s5p_irq_vic_eint_maskack(unsigned int irq) 185static void s5p_irq_vic_eint_maskack(struct irq_data *data)
184{ 186{
185 s5p_irq_vic_eint_mask(irq); 187 s5p_irq_vic_eint_mask(data);
186 s5p_irq_vic_eint_ack(irq); 188 s5p_irq_vic_eint_ack(data);
187} 189}
188 190
189static struct irq_chip s5p_irq_vic_eint = { 191static struct irq_chip s5p_irq_vic_eint = {
190 .name = "s5p_vic_eint", 192 .name = "s5p_vic_eint",
191 .mask = s5p_irq_vic_eint_mask, 193 .irq_mask = s5p_irq_vic_eint_mask,
192 .unmask = s5p_irq_vic_eint_unmask, 194 .irq_unmask = s5p_irq_vic_eint_unmask,
193 .mask_ack = s5p_irq_vic_eint_maskack, 195 .irq_mask_ack = s5p_irq_vic_eint_maskack,
194 .ack = s5p_irq_vic_eint_ack, 196 .irq_ack = s5p_irq_vic_eint_ack,
195 .set_type = s5p_irq_eint_set_type, 197 .irq_set_type = s5p_irq_eint_set_type,
196#ifdef CONFIG_PM 198#ifdef CONFIG_PM
197 .set_wake = s3c_irqext_wake, 199 .irq_set_wake = s3c_irqext_wake,
198#endif 200#endif
199}; 201};
200 202
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index 0e5dc8cbf5e3..3b6bf89d1739 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -30,9 +30,9 @@
30 30
31static struct s3c_gpio_chip *irq_chips[S5P_GPIOINT_GROUP_MAXNR]; 31static struct s3c_gpio_chip *irq_chips[S5P_GPIOINT_GROUP_MAXNR];
32 32
33static int s5p_gpioint_get_group(unsigned int irq) 33static int s5p_gpioint_get_group(struct irq_data *data)
34{ 34{
35 struct gpio_chip *chip = get_irq_data(irq); 35 struct gpio_chip *chip = irq_data_get_irq_data(data);
36 struct s3c_gpio_chip *s3c_chip = container_of(chip, 36 struct s3c_gpio_chip *s3c_chip = container_of(chip,
37 struct s3c_gpio_chip, chip); 37 struct s3c_gpio_chip, chip);
38 int group; 38 int group;
@@ -44,22 +44,22 @@ static int s5p_gpioint_get_group(unsigned int irq)
44 return group; 44 return group;
45} 45}
46 46
47static int s5p_gpioint_get_offset(unsigned int irq) 47static int s5p_gpioint_get_offset(struct irq_data *data)
48{ 48{
49 struct gpio_chip *chip = get_irq_data(irq); 49 struct gpio_chip *chip = irq_data_get_irq_data(data);
50 struct s3c_gpio_chip *s3c_chip = container_of(chip, 50 struct s3c_gpio_chip *s3c_chip = container_of(chip,
51 struct s3c_gpio_chip, chip); 51 struct s3c_gpio_chip, chip);
52 52
53 return irq - s3c_chip->irq_base; 53 return data->irq - s3c_chip->irq_base;
54} 54}
55 55
56static void s5p_gpioint_ack(unsigned int irq) 56static void s5p_gpioint_ack(struct irq_data *data)
57{ 57{
58 int group, offset, pend_offset; 58 int group, offset, pend_offset;
59 unsigned int value; 59 unsigned int value;
60 60
61 group = s5p_gpioint_get_group(irq); 61 group = s5p_gpioint_get_group(data);
62 offset = s5p_gpioint_get_offset(irq); 62 offset = s5p_gpioint_get_offset(data);
63 pend_offset = group << 2; 63 pend_offset = group << 2;
64 64
65 value = __raw_readl(S5P_GPIOREG(GPIOINT_PEND_OFFSET) + pend_offset); 65 value = __raw_readl(S5P_GPIOREG(GPIOINT_PEND_OFFSET) + pend_offset);
@@ -67,13 +67,13 @@ static void s5p_gpioint_ack(unsigned int irq)
67 __raw_writel(value, S5P_GPIOREG(GPIOINT_PEND_OFFSET) + pend_offset); 67 __raw_writel(value, S5P_GPIOREG(GPIOINT_PEND_OFFSET) + pend_offset);
68} 68}
69 69
70static void s5p_gpioint_mask(unsigned int irq) 70static void s5p_gpioint_mask(struct irq_data *data)
71{ 71{
72 int group, offset, mask_offset; 72 int group, offset, mask_offset;
73 unsigned int value; 73 unsigned int value;
74 74
75 group = s5p_gpioint_get_group(irq); 75 group = s5p_gpioint_get_group(data);
76 offset = s5p_gpioint_get_offset(irq); 76 offset = s5p_gpioint_get_offset(data);
77 mask_offset = group << 2; 77 mask_offset = group << 2;
78 78
79 value = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset); 79 value = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
@@ -81,13 +81,13 @@ static void s5p_gpioint_mask(unsigned int irq)
81 __raw_writel(value, S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset); 81 __raw_writel(value, S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
82} 82}
83 83
84static void s5p_gpioint_unmask(unsigned int irq) 84static void s5p_gpioint_unmask(struct irq_data *data)
85{ 85{
86 int group, offset, mask_offset; 86 int group, offset, mask_offset;
87 unsigned int value; 87 unsigned int value;
88 88
89 group = s5p_gpioint_get_group(irq); 89 group = s5p_gpioint_get_group(data);
90 offset = s5p_gpioint_get_offset(irq); 90 offset = s5p_gpioint_get_offset(data);
91 mask_offset = group << 2; 91 mask_offset = group << 2;
92 92
93 value = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset); 93 value = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
@@ -95,19 +95,19 @@ static void s5p_gpioint_unmask(unsigned int irq)
95 __raw_writel(value, S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset); 95 __raw_writel(value, S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
96} 96}
97 97
98static void s5p_gpioint_mask_ack(unsigned int irq) 98static void s5p_gpioint_mask_ack(struct irq_data *data)
99{ 99{
100 s5p_gpioint_mask(irq); 100 s5p_gpioint_mask(data);
101 s5p_gpioint_ack(irq); 101 s5p_gpioint_ack(data);
102} 102}
103 103
104static int s5p_gpioint_set_type(unsigned int irq, unsigned int type) 104static int s5p_gpioint_set_type(struct irq_data *data, unsigned int type)
105{ 105{
106 int group, offset, con_offset; 106 int group, offset, con_offset;
107 unsigned int value; 107 unsigned int value;
108 108
109 group = s5p_gpioint_get_group(irq); 109 group = s5p_gpioint_get_group(data);
110 offset = s5p_gpioint_get_offset(irq); 110 offset = s5p_gpioint_get_offset(data);
111 con_offset = group << 2; 111 con_offset = group << 2;
112 112
113 switch (type) { 113 switch (type) {
@@ -142,11 +142,11 @@ static int s5p_gpioint_set_type(unsigned int irq, unsigned int type)
142 142
143struct irq_chip s5p_gpioint = { 143struct irq_chip s5p_gpioint = {
144 .name = "s5p_gpioint", 144 .name = "s5p_gpioint",
145 .ack = s5p_gpioint_ack, 145 .irq_ack = s5p_gpioint_ack,
146 .mask = s5p_gpioint_mask, 146 .irq_mask = s5p_gpioint_mask,
147 .mask_ack = s5p_gpioint_mask_ack, 147 .irq_mask_ack = s5p_gpioint_mask_ack,
148 .unmask = s5p_gpioint_unmask, 148 .irq_unmask = s5p_gpioint_unmask,
149 .set_type = s5p_gpioint_set_type, 149 .irq_set_type = s5p_gpioint_set_type,
150}; 150};
151 151
152static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc) 152static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/plat-s5p/irq-pm.c b/arch/arm/plat-s5p/irq-pm.c
index dc33b9ecda45..5259ad458bc8 100644
--- a/arch/arm/plat-s5p/irq-pm.c
+++ b/arch/arm/plat-s5p/irq-pm.c
@@ -37,14 +37,14 @@
37unsigned long s3c_irqwake_intallow = 0x00000006L; 37unsigned long s3c_irqwake_intallow = 0x00000006L;
38unsigned long s3c_irqwake_eintallow = 0xffffffffL; 38unsigned long s3c_irqwake_eintallow = 0xffffffffL;
39 39
40int s3c_irq_wake(unsigned int irqno, unsigned int state) 40int s3c_irq_wake(struct irq_data *data, unsigned int state)
41{ 41{
42 unsigned long irqbit; 42 unsigned long irqbit;
43 43
44 switch (irqno) { 44 switch (data->irq) {
45 case IRQ_RTC_TIC: 45 case IRQ_RTC_TIC:
46 case IRQ_RTC_ALARM: 46 case IRQ_RTC_ALARM:
47 irqbit = 1 << (irqno + 1 - IRQ_RTC_ALARM); 47 irqbit = 1 << (data->irq + 1 - IRQ_RTC_ALARM);
48 if (!state) 48 if (!state)
49 s3c_irqwake_intmask |= irqbit; 49 s3c_irqwake_intmask |= irqbit;
50 else 50 else
diff --git a/arch/arm/plat-s5p/sysmmu.c b/arch/arm/plat-s5p/sysmmu.c
new file mode 100644
index 000000000000..d804914dc2e2
--- /dev/null
+++ b/arch/arm/plat-s5p/sysmmu.c
@@ -0,0 +1,328 @@
1/* linux/arch/arm/plat-s5p/sysmmu.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/io.h>
12#include <linux/interrupt.h>
13#include <linux/platform_device.h>
14
15#include <mach/map.h>
16#include <mach/regs-sysmmu.h>
17#include <mach/sysmmu.h>
18
19#include <plat/sysmmu.h>
20
21struct sysmmu_controller s5p_sysmmu_cntlrs[S5P_SYSMMU_TOTAL_IPNUM];
22
23void s5p_sysmmu_register(struct sysmmu_controller *sysmmuconp)
24{
25 unsigned int reg_mmu_ctrl;
26 unsigned int reg_mmu_status;
27 unsigned int reg_pt_base_addr;
28 unsigned int reg_int_status;
29 unsigned int reg_page_ft_addr;
30
31 reg_int_status = __raw_readl(sysmmuconp->regs + S5P_INT_STATUS);
32 reg_mmu_ctrl = __raw_readl(sysmmuconp->regs + S5P_MMU_CTRL);
33 reg_mmu_status = __raw_readl(sysmmuconp->regs + S5P_MMU_STATUS);
34 reg_pt_base_addr = __raw_readl(sysmmuconp->regs + S5P_PT_BASE_ADDR);
35 reg_page_ft_addr = __raw_readl(sysmmuconp->regs + S5P_PAGE_FAULT_ADDR);
36
37 printk(KERN_INFO "%s: ips:%s\n", __func__, sysmmuconp->name);
38 printk(KERN_INFO "%s: MMU_CTRL:0x%X, ", __func__, reg_mmu_ctrl);
39 printk(KERN_INFO "MMU_STATUS:0x%X, PT_BASE_ADDR:0x%X\n", reg_mmu_status, reg_pt_base_addr);
40 printk(KERN_INFO "%s: INT_STATUS:0x%X, PAGE_FAULT_ADDR:0x%X\n", __func__, reg_int_status, reg_page_ft_addr);
41
42 switch (reg_int_status & 0xFF) {
43 case 0x1:
44 printk(KERN_INFO "%s: Page fault\n", __func__);
45 printk(KERN_INFO "%s: Virtual address causing last page fault or bus error : 0x%x\n", __func__ , reg_page_ft_addr);
46 break;
47 case 0x2:
48 printk(KERN_INFO "%s: AR multi-hit fault\n", __func__);
49 break;
50 case 0x4:
51 printk(KERN_INFO "%s: AW multi-hit fault\n", __func__);
52 break;
53 case 0x8:
54 printk(KERN_INFO "%s: Bus error\n", __func__);
55 break;
56 case 0x10:
57 printk(KERN_INFO "%s: AR Security protection fault\n", __func__);
58 break;
59 case 0x20:
60 printk(KERN_INFO "%s: AR Access protection fault\n", __func__);
61 break;
62 case 0x40:
63 printk(KERN_INFO "%s: AW Security protection fault\n", __func__);
64 break;
65 case 0x80:
66 printk(KERN_INFO "%s: AW Access protection fault\n", __func__);
67 break;
68 }
69}
70
71static irqreturn_t s5p_sysmmu_irq(int irq, void *dev_id)
72{
73 unsigned int i;
74 unsigned int reg_int_status;
75 struct sysmmu_controller *sysmmuconp;
76
77 for (i = 0; i < S5P_SYSMMU_TOTAL_IPNUM; i++) {
78 sysmmuconp = &s5p_sysmmu_cntlrs[i];
79
80 if (sysmmuconp->enable == true) {
81 reg_int_status = __raw_readl(sysmmuconp->regs + S5P_INT_STATUS);
82
83 if (reg_int_status & 0xFF)
84 s5p_sysmmu_register(sysmmuconp);
85 }
86 }
87 return IRQ_HANDLED;
88}
89
90int s5p_sysmmu_set_tablebase_pgd(sysmmu_ips ips, unsigned long pgd)
91{
92 struct sysmmu_controller *sysmmuconp = NULL;
93
94 sysmmuconp = &s5p_sysmmu_cntlrs[ips];
95
96 if (sysmmuconp == NULL) {
97 printk(KERN_ERR "failed to get ip's sysmmu info\n");
98 return 1;
99 }
100
101 /* Set sysmmu page table base address */
102 __raw_writel(pgd, sysmmuconp->regs + S5P_PT_BASE_ADDR);
103
104 if (s5p_sysmmu_tlb_invalidate(ips) != 0)
105 printk(KERN_ERR "failed s5p_sysmmu_tlb_invalidate\n");
106
107 return 0;
108}
109
110static int s5p_sysmmu_set_tablebase(sysmmu_ips ips)
111{
112 unsigned int pg;
113 struct sysmmu_controller *sysmmuconp;
114
115 sysmmuconp = &s5p_sysmmu_cntlrs[ips];
116
117 if (sysmmuconp == NULL) {
118 printk(KERN_ERR "failed to get ip's sysmmu info\n");
119 return 1;
120 }
121
122 __asm__("mrc p15, 0, %0, c2, c0, 0" \
123 : "=r" (pg) : : "cc"); \
124 pg &= ~0x3fff;
125
126 sysmmu_debug("CP15 TTBR0 : 0x%x\n", pg);
127
128 /* Set sysmmu page table base address */
129 __raw_writel(pg, sysmmuconp->regs + S5P_PT_BASE_ADDR);
130
131 return 0;
132}
133
134int s5p_sysmmu_enable(sysmmu_ips ips)
135{
136 unsigned int reg;
137
138 struct sysmmu_controller *sysmmuconp;
139
140 sysmmuconp = &s5p_sysmmu_cntlrs[ips];
141
142 if (sysmmuconp == NULL) {
143 printk(KERN_ERR "failed to get ip's sysmmu info\n");
144 return 1;
145 }
146
147 s5p_sysmmu_set_tablebase(ips);
148
149 /* replacement policy : LRU */
150 reg = __raw_readl(sysmmuconp->regs + S5P_MMU_CFG);
151 reg |= 0x1;
152 __raw_writel(reg, sysmmuconp->regs + S5P_MMU_CFG);
153
154 /* Enable interrupt, Enable MMU */
155 reg = __raw_readl(sysmmuconp->regs + S5P_MMU_CTRL);
156 reg |= (0x1 << 2) | (0x1 << 0);
157
158 __raw_writel(reg, sysmmuconp->regs + S5P_MMU_CTRL);
159
160 sysmmuconp->enable = true;
161
162 return 0;
163}
164
165int s5p_sysmmu_disable(sysmmu_ips ips)
166{
167 unsigned int reg;
168
169 struct sysmmu_controller *sysmmuconp = NULL;
170
171 if (ips > S5P_SYSMMU_TOTAL_IPNUM)
172 printk(KERN_ERR "failed to get ips parameter\n");
173
174 sysmmuconp = &s5p_sysmmu_cntlrs[ips];
175
176 if (sysmmuconp == NULL) {
177 printk(KERN_ERR "failed to get ip's sysmmu info\n");
178 return 1;
179 }
180
181 reg = __raw_readl(sysmmuconp->regs + S5P_MMU_CFG);
182
183 /* replacement policy : LRU */
184 reg |= 0x1;
185 __raw_writel(reg, sysmmuconp->regs + S5P_MMU_CFG);
186
187 reg = __raw_readl(sysmmuconp->regs + S5P_MMU_CTRL);
188
189 /* Disable MMU */
190 reg &= ~0x1;
191 __raw_writel(reg, sysmmuconp->regs + S5P_MMU_CTRL);
192
193 sysmmuconp->enable = false;
194
195 return 0;
196}
197
198int s5p_sysmmu_tlb_invalidate(sysmmu_ips ips)
199{
200 unsigned int reg;
201 struct sysmmu_controller *sysmmuconp = NULL;
202
203 sysmmuconp = &s5p_sysmmu_cntlrs[ips];
204
205 if (sysmmuconp == NULL) {
206 printk(KERN_ERR "failed to get ip's sysmmu info\n");
207 return 1;
208 }
209
210 /* set Block MMU for flush TLB */
211 reg = __raw_readl(sysmmuconp->regs + S5P_MMU_CTRL);
212 reg |= 0x1 << 1;
213 __raw_writel(reg, sysmmuconp->regs + S5P_MMU_CTRL);
214
215 /* flush all TLB entry */
216 __raw_writel(0x1, sysmmuconp->regs + S5P_MMU_FLUSH);
217
218 /* set Un-block MMU after flush TLB */
219 reg = __raw_readl(sysmmuconp->regs + S5P_MMU_CTRL);
220 reg &= ~(0x1 << 1);
221 __raw_writel(reg, sysmmuconp->regs + S5P_MMU_CTRL);
222
223 return 0;
224}
225
226static int s5p_sysmmu_probe(struct platform_device *pdev)
227{
228 int i;
229 int ret;
230 struct resource *res;
231 struct sysmmu_controller *sysmmuconp;
232 sysmmu_ips ips;
233
234 for (i = 0; i < S5P_SYSMMU_TOTAL_IPNUM; i++) {
235 sysmmuconp = &s5p_sysmmu_cntlrs[i];
236 if (sysmmuconp == NULL) {
237 printk(KERN_ERR "failed to get ip's sysmmu info\n");
238 ret = -ENOENT;
239 goto err_res;
240 }
241
242 sysmmuconp->name = sysmmu_ips_name[i];
243
244 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
245 if (!res) {
246 printk(KERN_ERR "failed to get sysmmu resource\n");
247 ret = -ENODEV;
248 goto err_res;
249 }
250
251 sysmmuconp->mem = request_mem_region(res->start,
252 ((res->end) - (res->start)) + 1, pdev->name);
253 if (!sysmmuconp->mem) {
254 pr_err("failed to request sysmmu memory region\n");
255 ret = -EBUSY;
256 goto err_res;
257 }
258
259 sysmmuconp->regs = ioremap(res->start, res->end - res->start + 1);
260 if (!sysmmuconp->regs) {
261 pr_err("failed to sysmmu ioremap\n");
262 ret = -ENXIO;
263 goto err_reg;
264 }
265
266 sysmmuconp->irq = platform_get_irq(pdev, i);
267 if (sysmmuconp->irq <= 0) {
268 pr_err("failed to get sysmmu irq resource\n");
269 ret = -ENOENT;
270 goto err_map;
271 }
272
273 ret = request_irq(sysmmuconp->irq, s5p_sysmmu_irq, IRQF_DISABLED, pdev->name, sysmmuconp);
274 if (ret) {
275 pr_err("failed to request irq\n");
276 ret = -ENOENT;
277 goto err_map;
278 }
279
280 ips = (sysmmu_ips)i;
281
282 sysmmuconp->ips = ips;
283 }
284
285 return 0;
286
287err_reg:
288 release_mem_region((resource_size_t)sysmmuconp->mem, (resource_size_t)((res->end) - (res->start) + 1));
289err_map:
290 iounmap(sysmmuconp->regs);
291err_res:
292 return ret;
293}
294
295static int s5p_sysmmu_remove(struct platform_device *pdev)
296{
297 return 0;
298}
299int s5p_sysmmu_runtime_suspend(struct device *dev)
300{
301 return 0;
302}
303
304int s5p_sysmmu_runtime_resume(struct device *dev)
305{
306 return 0;
307}
308
309const struct dev_pm_ops s5p_sysmmu_pm_ops = {
310 .runtime_suspend = s5p_sysmmu_runtime_suspend,
311 .runtime_resume = s5p_sysmmu_runtime_resume,
312};
313
314static struct platform_driver s5p_sysmmu_driver = {
315 .probe = s5p_sysmmu_probe,
316 .remove = s5p_sysmmu_remove,
317 .driver = {
318 .owner = THIS_MODULE,
319 .name = "s5p-sysmmu",
320 .pm = &s5p_sysmmu_pm_ops,
321 }
322};
323
324static int __init s5p_sysmmu_init(void)
325{
326 return platform_driver_register(&s5p_sysmmu_driver);
327}
328arch_initcall(s5p_sysmmu_init);
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index dcd6eff4ee53..32be05cf82a3 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -95,6 +95,12 @@ config S3C_GPIO_PULL_UPDOWN
95 help 95 help
96 Internal configuration to enable the correct GPIO pull helper 96 Internal configuration to enable the correct GPIO pull helper
97 97
98config S3C_GPIO_PULL_S3C2443
99 bool
100 select S3C_GPIO_PULL_UPDOWN
101 help
102 Internal configuration to enable the correct GPIO pull helper for S3C2443-style GPIO
103
98config S3C_GPIO_PULL_DOWN 104config S3C_GPIO_PULL_DOWN
99 bool 105 bool
100 help 106 help
@@ -333,4 +339,12 @@ config SAMSUNG_WAKEMASK
333 and above. This code allows a set of interrupt to wakeup-mask 339 and above. This code allows a set of interrupt to wakeup-mask
334 mappings. See <plat/wakeup-mask.h> 340 mappings. See <plat/wakeup-mask.h>
335 341
342comment "Power Domain"
343
344config SAMSUNG_PD
345 bool "Samsung Power Domain"
346 depends on PM_RUNTIME
347 help
348 Say Y here if you want to control Power Domain by Runtime PM.
349
336endif 350endif
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 19d8a16c3066..29932f88a8d6 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -74,6 +74,10 @@ obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
74 74
75obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o 75obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
76 76
77# PD support
78
79obj-$(CONFIG_SAMSUNG_PD) += pd.o
80
77# PWM support 81# PWM support
78 82
79obj-$(CONFIG_HAVE_PWM) += pwm.o 83obj-$(CONFIG_HAVE_PWM) += pwm.o
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index e8d20b0bc50e..772892826ffc 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -39,6 +39,9 @@
39#include <linux/clk.h> 39#include <linux/clk.h>
40#include <linux/spinlock.h> 40#include <linux/spinlock.h>
41#include <linux/io.h> 41#include <linux/io.h>
42#if defined(CONFIG_DEBUG_FS)
43#include <linux/debugfs.h>
44#endif
42 45
43#include <mach/hardware.h> 46#include <mach/hardware.h>
44#include <asm/irq.h> 47#include <asm/irq.h>
@@ -447,3 +450,92 @@ int __init s3c24xx_register_baseclocks(unsigned long xtal)
447 return 0; 450 return 0;
448} 451}
449 452
453#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
454/* debugfs support to trace clock tree hierarchy and attributes */
455
456static struct dentry *clk_debugfs_root;
457
458static int clk_debugfs_register_one(struct clk *c)
459{
460 int err;
461 struct dentry *d, *child, *child_tmp;
462 struct clk *pa = c->parent;
463 char s[255];
464 char *p = s;
465
466 p += sprintf(p, "%s", c->name);
467
468 if (c->id >= 0)
469 sprintf(p, ":%d", c->id);
470
471 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
472 if (!d)
473 return -ENOMEM;
474
475 c->dent = d;
476
477 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usage);
478 if (!d) {
479 err = -ENOMEM;
480 goto err_out;
481 }
482
483 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
484 if (!d) {
485 err = -ENOMEM;
486 goto err_out;
487 }
488 return 0;
489
490err_out:
491 d = c->dent;
492 list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
493 debugfs_remove(child);
494 debugfs_remove(c->dent);
495 return err;
496}
497
498static int clk_debugfs_register(struct clk *c)
499{
500 int err;
501 struct clk *pa = c->parent;
502
503 if (pa && !pa->dent) {
504 err = clk_debugfs_register(pa);
505 if (err)
506 return err;
507 }
508
509 if (!c->dent) {
510 err = clk_debugfs_register_one(c);
511 if (err)
512 return err;
513 }
514 return 0;
515}
516
517static int __init clk_debugfs_init(void)
518{
519 struct clk *c;
520 struct dentry *d;
521 int err;
522
523 d = debugfs_create_dir("clock", NULL);
524 if (!d)
525 return -ENOMEM;
526 clk_debugfs_root = d;
527
528 list_for_each_entry(c, &clocks, list) {
529 err = clk_debugfs_register(c);
530 if (err)
531 goto err_out;
532 }
533 return 0;
534
535err_out:
536 debugfs_remove_recursive(clk_debugfs_root);
537 return err;
538}
539late_initcall(clk_debugfs_init);
540
541#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-samsung/dev-nand.c b/arch/arm/plat-samsung/dev-nand.c
index 3a7b8891ba4f..6927ae8fd118 100644
--- a/arch/arm/plat-samsung/dev-nand.c
+++ b/arch/arm/plat-samsung/dev-nand.c
@@ -126,5 +126,3 @@ void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
126 126
127 s3c_device_nand.dev.platform_data = npd; 127 s3c_device_nand.dev.platform_data = npd;
128} 128}
129
130EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index 0aa32f242ee4..1c0b0401594b 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -278,6 +278,48 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip,
278 pup &= 0x3; 278 pup &= 0x3;
279 return (__force s3c_gpio_pull_t)pup; 279 return (__force s3c_gpio_pull_t)pup;
280} 280}
281
282#ifdef CONFIG_S3C_GPIO_PULL_S3C2443
283int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
284 unsigned int off, s3c_gpio_pull_t pull)
285{
286 switch (pull) {
287 case S3C_GPIO_PULL_NONE:
288 pull = 0x01;
289 break;
290 case S3C_GPIO_PULL_UP:
291 pull = 0x00;
292 break;
293 case S3C_GPIO_PULL_DOWN:
294 pull = 0x02;
295 break;
296 }
297 return s3c_gpio_setpull_updown(chip, off, pull);
298}
299
300s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip,
301 unsigned int off)
302{
303 s3c_gpio_pull_t pull;
304
305 pull = s3c_gpio_getpull_updown(chip, off);
306
307 switch (pull) {
308 case 0x00:
309 pull = S3C_GPIO_PULL_UP;
310 break;
311 case 0x01:
312 case 0x03:
313 pull = S3C_GPIO_PULL_NONE;
314 break;
315 case 0x02:
316 pull = S3C_GPIO_PULL_DOWN;
317 break;
318 }
319
320 return pull;
321}
322#endif
281#endif 323#endif
282 324
283#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN) 325#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN)
diff --git a/arch/arm/plat-samsung/gpiolib.c b/arch/arm/plat-samsung/gpiolib.c
index c354089254fc..ea37c0461788 100644
--- a/arch/arm/plat-samsung/gpiolib.c
+++ b/arch/arm/plat-samsung/gpiolib.c
@@ -197,3 +197,10 @@ void __init samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
197 s3c_gpiolib_add(chip); 197 s3c_gpiolib_add(chip);
198 } 198 }
199} 199}
200
201void __init samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip,
202 int nr_chips)
203{
204 for (; nr_chips > 0; nr_chips--, chip++)
205 s3c_gpiolib_add(chip);
206}
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 0fbcd0effd8e..9a82b8874918 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -47,6 +47,9 @@ struct clk {
47 47
48 struct clk_ops *ops; 48 struct clk_ops *ops;
49 int (*enable)(struct clk *, int enable); 49 int (*enable)(struct clk *, int enable);
50#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
51 struct dentry *dent; /* For visible tree hierarchy */
52#endif
50}; 53};
51 54
52/* other clocks which may be registered by board support */ 55/* other clocks which may be registered by board support */
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index e9e3b6e3ec74..b4d208b42957 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -104,6 +104,7 @@ extern struct platform_device s5pv310_device_i2s0;
104extern struct platform_device s5pv310_device_i2s1; 104extern struct platform_device s5pv310_device_i2s1;
105extern struct platform_device s5pv310_device_i2s2; 105extern struct platform_device s5pv310_device_i2s2;
106extern struct platform_device s5pv310_device_spdif; 106extern struct platform_device s5pv310_device_spdif;
107extern struct platform_device s5pv310_device_pd[];
107 108
108extern struct platform_device s5p6442_device_pcm0; 109extern struct platform_device s5p6442_device_pcm0;
109extern struct platform_device s5p6442_device_pcm1; 110extern struct platform_device s5p6442_device_pcm1;
@@ -115,6 +116,8 @@ extern struct platform_device s5p6440_device_pcm;
115extern struct platform_device s5p6440_device_iis; 116extern struct platform_device s5p6440_device_iis;
116 117
117extern struct platform_device s5p6450_device_iis0; 118extern struct platform_device s5p6450_device_iis0;
119extern struct platform_device s5p6450_device_iis1;
120extern struct platform_device s5p6450_device_iis2;
118extern struct platform_device s5p6450_device_pcm0; 121extern struct platform_device s5p6450_device_pcm0;
119 122
120extern struct platform_device s5pc100_device_ac97; 123extern struct platform_device s5pc100_device_ac97;
@@ -131,6 +134,11 @@ extern struct platform_device s5p_device_fimc0;
131extern struct platform_device s5p_device_fimc1; 134extern struct platform_device s5p_device_fimc1;
132extern struct platform_device s5p_device_fimc2; 135extern struct platform_device s5p_device_fimc2;
133 136
137extern struct platform_device s5p_device_mipi_csis0;
138extern struct platform_device s5p_device_mipi_csis1;
139
140extern struct platform_device s5pv310_device_sysmmu;
141
134/* s3c2440 specific devices */ 142/* s3c2440 specific devices */
135 143
136#ifdef CONFIG_CPU_S3C2440 144#ifdef CONFIG_CPU_S3C2440
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 0d2c5703f1ee..5603db0b79bc 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
@@ -244,7 +244,7 @@ extern int s3c_gpio_setpull_s3c2443(struct s3c_gpio_chip *chip,
244 * This helper function reads the state of the pull-{up,down} resistor for the 244 * This helper function reads the state of the pull-{up,down} resistor for the
245 * given GPIO in the same case as s3c_gpio_setpull_upown. 245 * given GPIO in the same case as s3c_gpio_setpull_upown.
246*/ 246*/
247extern s3c_gpio_pull_t s3c_gpio_getpull_s3c24xx(struct s3c_gpio_chip *chip, 247extern s3c_gpio_pull_t s3c_gpio_getpull_s3c2443(struct s3c_gpio_chip *chip,
248 unsigned int off); 248 unsigned int off);
249 249
250#endif /* __PLAT_GPIO_CFG_HELPERS_H */ 250#endif /* __PLAT_GPIO_CFG_HELPERS_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index 13a22b8861ef..dac35d0a711d 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -118,6 +118,8 @@ extern void samsung_gpiolib_add_4bit_chips(struct s3c_gpio_chip *chip,
118 int nr_chips); 118 int nr_chips);
119extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip, 119extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
120 int nr_chips); 120 int nr_chips);
121extern void samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip,
122 int nr_chips);
121 123
122extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); 124extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
123extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); 125extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
diff --git a/arch/arm/plat-samsung/include/plat/pd.h b/arch/arm/plat-samsung/include/plat/pd.h
new file mode 100644
index 000000000000..5f0ad85783db
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/pd.h
@@ -0,0 +1,30 @@
1/* linux/arch/arm/plat-samsung/include/plat/pd.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __ASM_PLAT_SAMSUNG_PD_H
12#define __ASM_PLAT_SAMSUNG_PD_H __FILE__
13
14struct samsung_pd_info {
15 int (*enable)(struct device *dev);
16 int (*disable)(struct device *dev);
17 void __iomem *base;
18};
19
20enum s5pv310_pd_block {
21 PD_MFC,
22 PD_G3D,
23 PD_LCD0,
24 PD_LCD1,
25 PD_TV,
26 PD_CAM,
27 PD_GPS
28};
29
30#endif /* __ASM_PLAT_SAMSUNG_PD_H */
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index 245836d91931..d9025e377675 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -15,6 +15,8 @@
15 * management 15 * management
16*/ 16*/
17 17
18#include <linux/irq.h>
19
18#ifdef CONFIG_PM 20#ifdef CONFIG_PM
19 21
20extern __init int s3c_pm_init(void); 22extern __init int s3c_pm_init(void);
@@ -100,7 +102,7 @@ extern void s3c_pm_do_restore(struct sleep_save *ptr, int count);
100extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count); 102extern void s3c_pm_do_restore_core(struct sleep_save *ptr, int count);
101 103
102#ifdef CONFIG_PM 104#ifdef CONFIG_PM
103extern int s3c_irqext_wake(unsigned int irqno, unsigned int state); 105extern int s3c_irqext_wake(struct irq_data *data, unsigned int state);
104extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state); 106extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
105extern int s3c24xx_irq_resume(struct sys_device *dev); 107extern int s3c24xx_irq_resume(struct sys_device *dev);
106#else 108#else
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 85853f8c4c5d..5a41a0b69eec 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -107,6 +107,8 @@ extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
107 107
108/* Helper function availablity */ 108/* Helper function availablity */
109 109
110extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
110extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 112extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 113extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
112extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 114extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
@@ -122,6 +124,39 @@ extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
122extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 124extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
123extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w); 125extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
124 126
127/* S3C2416 SDHCI setup */
128
129#ifdef CONFIG_S3C2416_SETUP_SDHCI
130extern char *s3c2416_hsmmc_clksrcs[4];
131
132extern void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev,
133 void __iomem *r,
134 struct mmc_ios *ios,
135 struct mmc_card *card);
136
137static inline void s3c2416_default_sdhci0(void)
138{
139#ifdef CONFIG_S3C_DEV_HSMMC
140 s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
141 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
142 s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
143#endif /* CONFIG_S3C_DEV_HSMMC */
144}
145
146static inline void s3c2416_default_sdhci1(void)
147{
148#ifdef CONFIG_S3C_DEV_HSMMC1
149 s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
150 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
151 s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
152#endif /* CONFIG_S3C_DEV_HSMMC1 */
153}
154
155#else
156static inline void s3c2416_default_sdhci0(void) { }
157static inline void s3c2416_default_sdhci1(void) { }
158
159#endif /* CONFIG_S3C2416_SETUP_SDHCI */
125/* S3C64XX SDHCI setup */ 160/* S3C64XX SDHCI setup */
126 161
127#ifdef CONFIG_S3C64XX_SETUP_SDHCI 162#ifdef CONFIG_S3C64XX_SETUP_SDHCI
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
index 4f8c102674ae..4e770355ccbc 100644
--- a/arch/arm/plat-samsung/irq-uart.c
+++ b/arch/arm/plat-samsung/irq-uart.c
@@ -28,9 +28,9 @@
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 30
31static inline void __iomem *s3c_irq_uart_base(unsigned int irq) 31static inline void __iomem *s3c_irq_uart_base(struct irq_data *data)
32{ 32{
33 struct s3c_uart_irq *uirq = get_irq_chip_data(irq); 33 struct s3c_uart_irq *uirq = irq_data_get_irq_chip_data(data);
34 return uirq->regs; 34 return uirq->regs;
35} 35}
36 36
@@ -39,10 +39,10 @@ static inline unsigned int s3c_irq_uart_bit(unsigned int irq)
39 return irq & 3; 39 return irq & 3;
40} 40}
41 41
42static void s3c_irq_uart_mask(unsigned int irq) 42static void s3c_irq_uart_mask(struct irq_data *data)
43{ 43{
44 void __iomem *regs = s3c_irq_uart_base(irq); 44 void __iomem *regs = s3c_irq_uart_base(data);
45 unsigned int bit = s3c_irq_uart_bit(irq); 45 unsigned int bit = s3c_irq_uart_bit(data->irq);
46 u32 reg; 46 u32 reg;
47 47
48 reg = __raw_readl(regs + S3C64XX_UINTM); 48 reg = __raw_readl(regs + S3C64XX_UINTM);
@@ -50,10 +50,10 @@ static void s3c_irq_uart_mask(unsigned int irq)
50 __raw_writel(reg, regs + S3C64XX_UINTM); 50 __raw_writel(reg, regs + S3C64XX_UINTM);
51} 51}
52 52
53static void s3c_irq_uart_maskack(unsigned int irq) 53static void s3c_irq_uart_maskack(struct irq_data *data)
54{ 54{
55 void __iomem *regs = s3c_irq_uart_base(irq); 55 void __iomem *regs = s3c_irq_uart_base(data);
56 unsigned int bit = s3c_irq_uart_bit(irq); 56 unsigned int bit = s3c_irq_uart_bit(data->irq);
57 u32 reg; 57 u32 reg;
58 58
59 reg = __raw_readl(regs + S3C64XX_UINTM); 59 reg = __raw_readl(regs + S3C64XX_UINTM);
@@ -62,10 +62,10 @@ static void s3c_irq_uart_maskack(unsigned int irq)
62 __raw_writel(1 << bit, regs + S3C64XX_UINTP); 62 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
63} 63}
64 64
65static void s3c_irq_uart_unmask(unsigned int irq) 65static void s3c_irq_uart_unmask(struct irq_data *data)
66{ 66{
67 void __iomem *regs = s3c_irq_uart_base(irq); 67 void __iomem *regs = s3c_irq_uart_base(data);
68 unsigned int bit = s3c_irq_uart_bit(irq); 68 unsigned int bit = s3c_irq_uart_bit(data->irq);
69 u32 reg; 69 u32 reg;
70 70
71 reg = __raw_readl(regs + S3C64XX_UINTM); 71 reg = __raw_readl(regs + S3C64XX_UINTM);
@@ -73,17 +73,17 @@ static void s3c_irq_uart_unmask(unsigned int irq)
73 __raw_writel(reg, regs + S3C64XX_UINTM); 73 __raw_writel(reg, regs + S3C64XX_UINTM);
74} 74}
75 75
76static void s3c_irq_uart_ack(unsigned int irq) 76static void s3c_irq_uart_ack(struct irq_data *data)
77{ 77{
78 void __iomem *regs = s3c_irq_uart_base(irq); 78 void __iomem *regs = s3c_irq_uart_base(data);
79 unsigned int bit = s3c_irq_uart_bit(irq); 79 unsigned int bit = s3c_irq_uart_bit(data->irq);
80 80
81 __raw_writel(1 << bit, regs + S3C64XX_UINTP); 81 __raw_writel(1 << bit, regs + S3C64XX_UINTP);
82} 82}
83 83
84static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc) 84static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
85{ 85{
86 struct s3c_uart_irq *uirq = desc->handler_data; 86 struct s3c_uart_irq *uirq = desc->irq_data.handler_data;
87 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP); 87 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
88 int base = uirq->base_irq; 88 int base = uirq->base_irq;
89 89
@@ -99,10 +99,10 @@ static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
99 99
100static struct irq_chip s3c_irq_uart = { 100static struct irq_chip s3c_irq_uart = {
101 .name = "s3c-uart", 101 .name = "s3c-uart",
102 .mask = s3c_irq_uart_mask, 102 .irq_mask = s3c_irq_uart_mask,
103 .unmask = s3c_irq_uart_unmask, 103 .irq_unmask = s3c_irq_uart_unmask,
104 .mask_ack = s3c_irq_uart_maskack, 104 .irq_mask_ack = s3c_irq_uart_maskack,
105 .ack = s3c_irq_uart_ack, 105 .irq_ack = s3c_irq_uart_ack,
106}; 106};
107 107
108static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq) 108static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
@@ -124,7 +124,7 @@ static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
124 set_irq_flags(irq, IRQF_VALID); 124 set_irq_flags(irq, IRQF_VALID);
125 } 125 }
126 126
127 desc->handler_data = uirq; 127 desc->irq_data.handler_data = uirq;
128 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart); 128 set_irq_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
129} 129}
130 130
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index 0270519fcabc..dd8692ae5c4c 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -24,43 +24,46 @@
24 24
25static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc) 25static void s3c_irq_demux_vic_timer(unsigned int irq, struct irq_desc *desc)
26{ 26{
27 generic_handle_irq((int)desc->handler_data); 27 generic_handle_irq((int)desc->irq_data.handler_data);
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 31
32static void s3c_irq_timer_mask(unsigned int irq) 32static void s3c_irq_timer_mask(struct irq_data *data)
33{ 33{
34 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 34 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
35 u32 mask = (u32)data->chip_data;
35 36
36 reg &= 0x1f; /* mask out pending interrupts */ 37 reg &= 0x1f; /* mask out pending interrupts */
37 reg &= ~(1 << (irq - IRQ_TIMER0)); 38 reg &= ~mask;
38 __raw_writel(reg, S3C64XX_TINT_CSTAT); 39 __raw_writel(reg, S3C64XX_TINT_CSTAT);
39} 40}
40 41
41static void s3c_irq_timer_unmask(unsigned int irq) 42static void s3c_irq_timer_unmask(struct irq_data *data)
42{ 43{
43 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 44 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
45 u32 mask = (u32)data->chip_data;
44 46
45 reg &= 0x1f; /* mask out pending interrupts */ 47 reg &= 0x1f; /* mask out pending interrupts */
46 reg |= 1 << (irq - IRQ_TIMER0); 48 reg |= mask;
47 __raw_writel(reg, S3C64XX_TINT_CSTAT); 49 __raw_writel(reg, S3C64XX_TINT_CSTAT);
48} 50}
49 51
50static void s3c_irq_timer_ack(unsigned int irq) 52static void s3c_irq_timer_ack(struct irq_data *data)
51{ 53{
52 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT); 54 u32 reg = __raw_readl(S3C64XX_TINT_CSTAT);
55 u32 mask = (u32)data->chip_data;
53 56
54 reg &= 0x1f; 57 reg &= 0x1f;
55 reg |= (1 << 5) << (irq - IRQ_TIMER0); 58 reg |= mask << 5;
56 __raw_writel(reg, S3C64XX_TINT_CSTAT); 59 __raw_writel(reg, S3C64XX_TINT_CSTAT);
57} 60}
58 61
59static struct irq_chip s3c_irq_timer = { 62static struct irq_chip s3c_irq_timer = {
60 .name = "s3c-timer", 63 .name = "s3c-timer",
61 .mask = s3c_irq_timer_mask, 64 .irq_mask = s3c_irq_timer_mask,
62 .unmask = s3c_irq_timer_unmask, 65 .irq_unmask = s3c_irq_timer_unmask,
63 .ack = s3c_irq_timer_ack, 66 .irq_ack = s3c_irq_timer_ack,
64}; 67};
65 68
66/** 69/**
@@ -79,8 +82,9 @@ void __init s3c_init_vic_timer_irq(unsigned int parent_irq,
79 set_irq_chained_handler(parent_irq, s3c_irq_demux_vic_timer); 82 set_irq_chained_handler(parent_irq, s3c_irq_demux_vic_timer);
80 83
81 set_irq_chip(timer_irq, &s3c_irq_timer); 84 set_irq_chip(timer_irq, &s3c_irq_timer);
85 set_irq_chip_data(timer_irq, (void *)(1 << (timer_irq - IRQ_TIMER0)));
82 set_irq_handler(timer_irq, handle_level_irq); 86 set_irq_handler(timer_irq, handle_level_irq);
83 set_irq_flags(timer_irq, IRQF_VALID); 87 set_irq_flags(timer_irq, IRQF_VALID);
84 88
85 desc->handler_data = (void *)timer_irq; 89 desc->irq_data.handler_data = (void *)timer_irq;
86} 90}
diff --git a/arch/arm/plat-samsung/pd.c b/arch/arm/plat-samsung/pd.c
new file mode 100644
index 000000000000..efe1d564473e
--- /dev/null
+++ b/arch/arm/plat-samsung/pd.c
@@ -0,0 +1,95 @@
1/* linux/arch/arm/plat-samsung/pd.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Samsung Power domain support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/err.h>
17#include <linux/pm_runtime.h>
18
19#include <plat/pd.h>
20
21static int samsung_pd_probe(struct platform_device *pdev)
22{
23 struct samsung_pd_info *pdata = pdev->dev.platform_data;
24 struct device *dev = &pdev->dev;
25
26 if (!pdata) {
27 dev_err(dev, "no device data specified\n");
28 return -ENOENT;
29 }
30
31 pm_runtime_set_active(dev);
32 pm_runtime_enable(dev);
33
34 dev_info(dev, "power domain registered\n");
35 return 0;
36}
37
38static int __devexit samsung_pd_remove(struct platform_device *pdev)
39{
40 struct device *dev = &pdev->dev;
41
42 pm_runtime_disable(dev);
43 return 0;
44}
45
46static int samsung_pd_runtime_suspend(struct device *dev)
47{
48 struct samsung_pd_info *pdata = dev->platform_data;
49 int ret = 0;
50
51 if (pdata->disable)
52 ret = pdata->disable(dev);
53
54 dev_dbg(dev, "suspended\n");
55 return ret;
56}
57
58static int samsung_pd_runtime_resume(struct device *dev)
59{
60 struct samsung_pd_info *pdata = dev->platform_data;
61 int ret = 0;
62
63 if (pdata->enable)
64 ret = pdata->enable(dev);
65
66 dev_dbg(dev, "resumed\n");
67 return ret;
68}
69
70static const struct dev_pm_ops samsung_pd_pm_ops = {
71 .runtime_suspend = samsung_pd_runtime_suspend,
72 .runtime_resume = samsung_pd_runtime_resume,
73};
74
75static struct platform_driver samsung_pd_driver = {
76 .driver = {
77 .name = "samsung-pd",
78 .owner = THIS_MODULE,
79 .pm = &samsung_pd_pm_ops,
80 },
81 .probe = samsung_pd_probe,
82 .remove = __devexit_p(samsung_pd_remove),
83};
84
85static int __init samsung_pd_init(void)
86{
87 int ret;
88
89 ret = platform_driver_register(&samsung_pd_driver);
90 if (ret)
91 printk(KERN_ERR "%s: failed to add PD driver\n", __func__);
92
93 return ret;
94}
95arch_initcall(samsung_pd_init);
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 5bf3f2f09e74..02d531fb3f81 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -136,15 +136,15 @@ static void s3c_pm_restore_uarts(void) { }
136unsigned long s3c_irqwake_intmask = 0xffffffffL; 136unsigned long s3c_irqwake_intmask = 0xffffffffL;
137unsigned long s3c_irqwake_eintmask = 0xffffffffL; 137unsigned long s3c_irqwake_eintmask = 0xffffffffL;
138 138
139int s3c_irqext_wake(unsigned int irqno, unsigned int state) 139int s3c_irqext_wake(struct irq_data *data, unsigned int state)
140{ 140{
141 unsigned long bit = 1L << IRQ_EINT_BIT(irqno); 141 unsigned long bit = 1L << IRQ_EINT_BIT(data->irq);
142 142
143 if (!(s3c_irqwake_eintallow & bit)) 143 if (!(s3c_irqwake_eintallow & bit))
144 return -ENOENT; 144 return -ENOENT;
145 145
146 printk(KERN_INFO "wake %s for irq %d\n", 146 printk(KERN_INFO "wake %s for irq %d\n",
147 state ? "enabled" : "disabled", irqno); 147 state ? "enabled" : "disabled", data->irq);
148 148
149 if (!state) 149 if (!state)
150 s3c_irqwake_eintmask |= bit; 150 s3c_irqwake_eintmask |= bit;
diff --git a/arch/arm/plat-spear/shirq.c b/arch/arm/plat-spear/shirq.c
index 2172d6946aea..78189035e7f1 100644
--- a/arch/arm/plat-spear/shirq.c
+++ b/arch/arm/plat-spear/shirq.c
@@ -20,10 +20,10 @@
20struct spear_shirq *shirq; 20struct spear_shirq *shirq;
21static DEFINE_SPINLOCK(lock); 21static DEFINE_SPINLOCK(lock);
22 22
23static void shirq_irq_mask(unsigned irq) 23static void shirq_irq_mask(struct irq_data *d)
24{ 24{
25 struct spear_shirq *shirq = get_irq_chip_data(irq); 25 struct spear_shirq *shirq = irq_data_get_irq_chip_data(d);
26 u32 val, id = irq - shirq->dev_config[0].virq; 26 u32 val, id = d->irq - shirq->dev_config[0].virq;
27 unsigned long flags; 27 unsigned long flags;
28 28
29 if ((shirq->regs.enb_reg == -1) || shirq->dev_config[id].enb_mask == -1) 29 if ((shirq->regs.enb_reg == -1) || shirq->dev_config[id].enb_mask == -1)
@@ -39,10 +39,10 @@ static void shirq_irq_mask(unsigned irq)
39 spin_unlock_irqrestore(&lock, flags); 39 spin_unlock_irqrestore(&lock, flags);
40} 40}
41 41
42static void shirq_irq_unmask(unsigned irq) 42static void shirq_irq_unmask(struct irq_data *d)
43{ 43{
44 struct spear_shirq *shirq = get_irq_chip_data(irq); 44 struct spear_shirq *shirq = irq_data_get_irq_chip_data(d);
45 u32 val, id = irq - shirq->dev_config[0].virq; 45 u32 val, id = d->irq - shirq->dev_config[0].virq;
46 unsigned long flags; 46 unsigned long flags;
47 47
48 if ((shirq->regs.enb_reg == -1) || shirq->dev_config[id].enb_mask == -1) 48 if ((shirq->regs.enb_reg == -1) || shirq->dev_config[id].enb_mask == -1)
@@ -60,9 +60,9 @@ static void shirq_irq_unmask(unsigned irq)
60 60
61static struct irq_chip shirq_chip = { 61static struct irq_chip shirq_chip = {
62 .name = "spear_shirq", 62 .name = "spear_shirq",
63 .ack = shirq_irq_mask, 63 .irq_ack = shirq_irq_mask,
64 .mask = shirq_irq_mask, 64 .irq_mask = shirq_irq_mask,
65 .unmask = shirq_irq_unmask, 65 .irq_unmask = shirq_irq_unmask,
66}; 66};
67 67
68static void shirq_handler(unsigned irq, struct irq_desc *desc) 68static void shirq_handler(unsigned irq, struct irq_desc *desc)
@@ -70,7 +70,7 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc)
70 u32 i, val, mask; 70 u32 i, val, mask;
71 struct spear_shirq *shirq = get_irq_data(irq); 71 struct spear_shirq *shirq = get_irq_data(irq);
72 72
73 desc->chip->ack(irq); 73 desc->irq_data.chip->irq_ack(&desc->irq_data);
74 while ((val = readl(shirq->regs.base + shirq->regs.status_reg) & 74 while ((val = readl(shirq->regs.base + shirq->regs.status_reg) &
75 shirq->regs.status_reg_mask)) { 75 shirq->regs.status_reg_mask)) {
76 for (i = 0; (i < shirq->dev_count) && val; i++) { 76 for (i = 0; (i < shirq->dev_count) && val; i++) {
@@ -92,7 +92,7 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc)
92 writel(mask, shirq->regs.base + shirq->regs.clear_reg); 92 writel(mask, shirq->regs.base + shirq->regs.clear_reg);
93 } 93 }
94 } 94 }
95 desc->chip->unmask(irq); 95 desc->irq_data.chip->irq_unmask(&desc->irq_data);
96} 96}
97 97
98int spear_shirq_register(struct spear_shirq *shirq) 98int spear_shirq_register(struct spear_shirq *shirq)
diff --git a/arch/arm/plat-stmp3xxx/irq.c b/arch/arm/plat-stmp3xxx/irq.c
index 20de4e0401ef..aaa168683d4e 100644
--- a/arch/arm/plat-stmp3xxx/irq.c
+++ b/arch/arm/plat-stmp3xxx/irq.c
@@ -34,7 +34,7 @@ void __init stmp3xxx_init_irq(struct irq_chip *chip)
34 34
35 /* Disable all interrupts initially */ 35 /* Disable all interrupts initially */
36 for (i = 0; i < NR_REAL_IRQS; i++) { 36 for (i = 0; i < NR_REAL_IRQS; i++) {
37 chip->mask(i); 37 chip->irq_mask(irq_get_irq_data(i));
38 set_irq_chip(i, chip); 38 set_irq_chip(i, chip);
39 set_irq_handler(i, handle_level_irq); 39 set_irq_handler(i, handle_level_irq);
40 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 40 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
diff --git a/arch/arm/plat-stmp3xxx/pinmux.c b/arch/arm/plat-stmp3xxx/pinmux.c
index 6d6b1a468eda..66d5bac3ace2 100644
--- a/arch/arm/plat-stmp3xxx/pinmux.c
+++ b/arch/arm/plat-stmp3xxx/pinmux.c
@@ -351,27 +351,27 @@ void stmp3xxx_release_pin_group(struct pin_group *pin_group, const char *label)
351} 351}
352EXPORT_SYMBOL(stmp3xxx_release_pin_group); 352EXPORT_SYMBOL(stmp3xxx_release_pin_group);
353 353
354static int stmp3xxx_irq_to_gpio(int irq, 354static int stmp3xxx_irq_data_to_gpio(struct irq_data *d,
355 struct stmp3xxx_pinmux_bank **bank, unsigned *gpio) 355 struct stmp3xxx_pinmux_bank **bank, unsigned *gpio)
356{ 356{
357 struct stmp3xxx_pinmux_bank *pm; 357 struct stmp3xxx_pinmux_bank *pm;
358 358
359 for (pm = pinmux_banks; pm < pinmux_banks + NR_BANKS; pm++) 359 for (pm = pinmux_banks; pm < pinmux_banks + NR_BANKS; pm++)
360 if (pm->virq <= irq && irq < pm->virq + 32) { 360 if (pm->virq <= d->irq && d->irq < pm->virq + 32) {
361 *bank = pm; 361 *bank = pm;
362 *gpio = irq - pm->virq; 362 *gpio = d->irq - pm->virq;
363 return 0; 363 return 0;
364 } 364 }
365 return -ENOENT; 365 return -ENOENT;
366} 366}
367 367
368static int stmp3xxx_set_irqtype(unsigned irq, unsigned type) 368static int stmp3xxx_set_irqtype(struct irq_data *d, unsigned type)
369{ 369{
370 struct stmp3xxx_pinmux_bank *pm; 370 struct stmp3xxx_pinmux_bank *pm;
371 unsigned gpio; 371 unsigned gpio;
372 int l, p; 372 int l, p;
373 373
374 stmp3xxx_irq_to_gpio(irq, &pm, &gpio); 374 stmp3xxx_irq_data_to_gpio(d, &pm, &gpio);
375 switch (type) { 375 switch (type) {
376 case IRQ_TYPE_EDGE_RISING: 376 case IRQ_TYPE_EDGE_RISING:
377 l = 0; p = 1; break; 377 l = 0; p = 1; break;
@@ -398,33 +398,33 @@ static int stmp3xxx_set_irqtype(unsigned irq, unsigned type)
398 return 0; 398 return 0;
399} 399}
400 400
401static void stmp3xxx_pin_ack_irq(unsigned irq) 401static void stmp3xxx_pin_ack_irq(struct irq_data *d)
402{ 402{
403 u32 stat; 403 u32 stat;
404 struct stmp3xxx_pinmux_bank *pm; 404 struct stmp3xxx_pinmux_bank *pm;
405 unsigned gpio; 405 unsigned gpio;
406 406
407 stmp3xxx_irq_to_gpio(irq, &pm, &gpio); 407 stmp3xxx_irq_data_to_gpio(d, &pm, &gpio);
408 stat = __raw_readl(pm->irqstat) & (1 << gpio); 408 stat = __raw_readl(pm->irqstat) & (1 << gpio);
409 stmp3xxx_clearl(stat, pm->irqstat); 409 stmp3xxx_clearl(stat, pm->irqstat);
410} 410}
411 411
412static void stmp3xxx_pin_mask_irq(unsigned irq) 412static void stmp3xxx_pin_mask_irq(struct irq_data *d)
413{ 413{
414 struct stmp3xxx_pinmux_bank *pm; 414 struct stmp3xxx_pinmux_bank *pm;
415 unsigned gpio; 415 unsigned gpio;
416 416
417 stmp3xxx_irq_to_gpio(irq, &pm, &gpio); 417 stmp3xxx_irq_data_to_gpio(d, &pm, &gpio);
418 stmp3xxx_clearl(1 << gpio, pm->irqen); 418 stmp3xxx_clearl(1 << gpio, pm->irqen);
419 stmp3xxx_clearl(1 << gpio, pm->pin2irq); 419 stmp3xxx_clearl(1 << gpio, pm->pin2irq);
420} 420}
421 421
422static void stmp3xxx_pin_unmask_irq(unsigned irq) 422static void stmp3xxx_pin_unmask_irq(struct irq_data *d)
423{ 423{
424 struct stmp3xxx_pinmux_bank *pm; 424 struct stmp3xxx_pinmux_bank *pm;
425 unsigned gpio; 425 unsigned gpio;
426 426
427 stmp3xxx_irq_to_gpio(irq, &pm, &gpio); 427 stmp3xxx_irq_data_to_gpio(d, &pm, &gpio);
428 stmp3xxx_setl(1 << gpio, pm->irqen); 428 stmp3xxx_setl(1 << gpio, pm->irqen);
429 stmp3xxx_setl(1 << gpio, pm->pin2irq); 429 stmp3xxx_setl(1 << gpio, pm->pin2irq);
430} 430}
@@ -503,10 +503,10 @@ static void stmp3xxx_gpio_irq(u32 irq, struct irq_desc *desc)
503} 503}
504 504
505static struct irq_chip gpio_irq_chip = { 505static struct irq_chip gpio_irq_chip = {
506 .ack = stmp3xxx_pin_ack_irq, 506 .irq_ack = stmp3xxx_pin_ack_irq,
507 .mask = stmp3xxx_pin_mask_irq, 507 .irq_mask = stmp3xxx_pin_mask_irq,
508 .unmask = stmp3xxx_pin_unmask_irq, 508 .irq_unmask = stmp3xxx_pin_unmask_irq,
509 .set_type = stmp3xxx_set_irqtype, 509 .irq_set_type = stmp3xxx_set_irqtype,
510}; 510};
511 511
512int __init stmp3xxx_pinmux_init(int virtual_irq_start) 512int __init stmp3xxx_pinmux_init(int virtual_irq_start)
@@ -533,7 +533,7 @@ int __init stmp3xxx_pinmux_init(int virtual_irq_start)
533 pm->virq = virtual_irq_start + b * 32; 533 pm->virq = virtual_irq_start + b * 32;
534 534
535 for (virq = pm->virq; virq < pm->virq; virq++) { 535 for (virq = pm->virq; virq < pm->virq; virq++) {
536 gpio_irq_chip.mask(virq); 536 gpio_irq_chip.irq_mask(irq_get_irq_data(virq));
537 set_irq_chip(virq, &gpio_irq_chip); 537 set_irq_chip(virq, &gpio_irq_chip);
538 set_irq_handler(virq, handle_level_irq); 538 set_irq_handler(virq, handle_level_irq);
539 set_irq_flags(virq, IRQF_VALID); 539 set_irq_flags(virq, IRQF_VALID);