aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-10-21 10:46:26 -0400
committerArnd Bergmann <arnd@arndb.de>2011-10-21 10:46:26 -0400
commit335332770c68649ffeaf5dc2b58d9cd40041e295 (patch)
treea48e86b9f9a80913399a182a152b4c580a9c3836
parent3b3c281073288ebdc6161108bdc4c9f1b08bdee3 (diff)
parentf55be1bf52aad524dc1bf556ae26c90262c87825 (diff)
Merge branch 'depends/rmk/gpio' into next/board
Conflicts: arch/arm/mach-at91/board-usb-a9260.c arch/arm/mach-at91/board-usb-a9263.c arch/arm/mach-tegra/board-paz00.h arch/arm/mach-tegra/board-seaboard.h
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/common/scoop.c2
-rw-r--r--arch/arm/include/asm/gpio.h19
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-gpio.h2
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c2
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c2
-rw-r--r--arch/arm/mach-at91/board-1arm.c2
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c2
-rw-r--r--arch/arm/mach-at91/board-cam60.c2
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c2
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c2
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c2
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-eb9200.c2
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-neocore926.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c2
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c2
-rw-r--r--arch/arm/mach-at91/gpio.c4
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h5
-rw-r--r--arch/arm/mach-at91/leds.c2
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-davinci/Makefile3
-rw-r--r--arch/arm/mach-davinci/da830.c3
-rw-r--r--arch/arm/mach-davinci/da850.c3
-rw-r--r--arch/arm/mach-davinci/dm355.c2
-rw-r--r--arch/arm/mach-davinci/dm365.c3
-rw-r--r--arch/arm/mach-davinci/dm644x.c2
-rw-r--r--arch/arm/mach-davinci/dm646x.c2
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio-davinci.h91
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h79
-rw-r--r--arch/arm/mach-davinci/tnetv107x.c3
-rw-r--r--arch/arm/mach-ep93xx/core.c1
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h (renamed from arch/arm/mach-ep93xx/include/mach/gpio.h)28
-rw-r--r--arch/arm/mach-ep93xx/simone.c2
-rw-r--r--arch/arm/mach-ep93xx/snappercl15.c2
-rw-r--r--arch/arm/mach-exynos4/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-gemini/include/mach/gpio.h5
-rw-r--r--arch/arm/mach-imx/iomux-imx31.c3
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c3
-rw-r--r--arch/arm/mach-ixp2000/core.c4
-rw-r--r--arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h (renamed from arch/arm/mach-ixp2000/include/mach/gpio.h)4
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c4
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/irq.c3
-rw-r--r--arch/arm/mach-kirkwood/mpp.c3
-rw-r--r--arch/arm/mach-ks8695/Makefile2
-rw-r--r--arch/arm/mach-ks8695/board-acs5k.c4
-rw-r--r--arch/arm/mach-ks8695/board-dsm320.c4
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c4
-rw-r--r--arch/arm/mach-ks8695/devices.c1
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio-ks8695.h39
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio.h38
-rw-r--r--arch/arm/mach-ks8695/leds.c4
-rw-r--r--arch/arm/mach-lpc32xx/Makefile2
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h50
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio.h74
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c1
-rw-r--r--arch/arm/mach-mmp/aspenite.c4
-rw-r--r--arch/arm/mach-mmp/brownstone.c1
-rw-r--r--arch/arm/mach-mmp/gplugd.c2
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio-pxa.h30
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio.h23
-rw-r--r--arch/arm/mach-mmp/jasper.c1
-rw-r--r--arch/arm/mach-mmp/mmp2.c3
-rw-r--r--arch/arm/mach-mmp/pxa168.c3
-rw-r--r--arch/arm/mach-mmp/pxa910.c3
-rw-r--r--arch/arm/mach-mmp/tavorevb.c4
-rw-r--r--arch/arm/mach-msm/board-msm7x27.c3
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c3
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c3
-rw-r--r--arch/arm/mach-msm/board-sapphire.c3
-rw-r--r--arch/arm/mach-msm/board-trout-mmc.c3
-rw-r--r--arch/arm/mach-msm/board-trout-panel.c3
-rw-r--r--arch/arm/mach-msm/include/mach/gpio.h27
-rw-r--r--arch/arm/mach-mv78xx0/irq.c3
-rw-r--r--arch/arm/mach-mv78xx0/mpp.c3
-rw-r--r--arch/arm/mach-mxs/include/mach/gpio.h8
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c1
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c2
-rw-r--r--arch/arm/mach-nomadik/i2c-8815nhk.c2
-rw-r--r--arch/arm/mach-nomadik/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c3
-rw-r--r--arch/arm/mach-omap1/board-fsample.c3
-rw-r--r--arch/arm/mach-omap1/board-generic.c3
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h2.c3
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c3
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c3
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c3
-rw-r--r--arch/arm/mach-omap1/board-osk.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c3
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c2
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c2
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c3
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c2
-rw-r--r--arch/arm/mach-omap1/board-sx1.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-omap1/devices.c2
-rw-r--r--arch/arm/mach-omap1/fpga.c2
-rw-r--r--arch/arm/mach-omap1/irq.c3
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c2
-rw-r--r--arch/arm/mach-omap1/leds-osk.c3
-rw-r--r--arch/arm/mach-omap1/leds.c2
-rw-r--r--arch/arm/mach-omap1/serial.c3
-rw-r--r--arch/arm/mach-omap2/board-generic.c3
-rw-r--r--arch/arm/mach-omap2/board-h4.c3
-rw-r--r--arch/arm/mach-omap2/board-ldp.c3
-rw-r--r--arch/arm/mach-omap2/devices.c3
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c3
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c3
-rw-r--r--arch/arm/mach-orion5x/irq.c3
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c3
-rw-r--r--arch/arm/mach-orion5x/mv2120-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c3
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c3
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c3
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c3
-rw-r--r--arch/arm/mach-pnx4008/gpio.c3
-rw-r--r--arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h (renamed from arch/arm/mach-pnx4008/include/mach/gpio.h)2
-rw-r--r--arch/arm/mach-pnx4008/serial.c3
-rw-r--r--arch/arm/mach-pxa/cm-x255.c1
-rw-r--r--arch/arm/mach-pxa/generic.c2
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio-pxa.h133
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h110
-rw-r--r--arch/arm/mach-pxa/include/mach/littleton.h2
-rw-r--r--arch/arm/mach-pxa/irq.c3
-rw-r--r--arch/arm/mach-pxa/lpd270.c3
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-pxa/mainstone.c3
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c4
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c3
-rw-r--r--arch/arm/mach-pxa/pxa25x.c3
-rw-r--r--arch/arm/mach-pxa/pxa27x.c3
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c3
-rw-r--r--arch/arm/mach-pxa/pxa95x.c3
-rw-r--r--arch/arm/mach-pxa/saarb.c4
-rw-r--r--arch/arm/mach-realview/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h2
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s5pv210/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-sa1100/Makefile2
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/gpio.h4
-rw-r--r--arch/arm/mach-shmobile/include/mach/gpio.h24
-rw-r--r--arch/arm/mach-tegra/board-harmony-pcie.c10
-rw-r--r--arch/arm/mach-tegra/board-harmony.h3
-rw-r--r--arch/arm/mach-tegra/board-paz00.c2
-rw-r--r--arch/arm/mach-tegra/board-paz00.h16
-rw-r--r--arch/arm/mach-tegra/board-seaboard.h2
-rw-r--r--arch/arm/mach-tegra/board-trimslice-pinmux.c3
-rw-r--r--arch/arm/mach-tegra/board-trimslice.c1
-rw-r--r--arch/arm/mach-tegra/board-trimslice.h2
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio-tegra.h39
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio.h60
-rw-r--r--arch/arm/mach-tegra/usb_phy.c1
-rw-r--r--arch/arm/mach-u300/Kconfig1
-rw-r--r--arch/arm/mach-u300/core.c31
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h150
-rw-r--r--arch/arm/mach-u300/include/mach/gpio.h294
-rw-r--r--arch/arm/mach-u300/include/mach/irqs.h25
-rw-r--r--arch/arm/mach-u300/mmc.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500-u8500uib.c3
-rw-r--r--arch/arm/mach-ux500/board-mop500.c1
-rw-r--r--arch/arm/mach-ux500/board-u5500-sdi.c2
-rw-r--r--arch/arm/mach-ux500/board-u5500.c2
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c2
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c2
-rw-r--r--arch/arm/mach-ux500/devices-common.c2
-rw-r--r--arch/arm/mach-ux500/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-versatile/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-vt8500/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-w90x900/include/mach/gpio.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/gpio.h6
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio-nomadik.h (renamed from arch/arm/plat-nomadik/include/plat/gpio.h)17
-rw-r--r--arch/arm/plat-omap/debug-devices.c3
-rw-r--r--arch/arm/plat-omap/debug-leds.c3
-rw-r--r--arch/arm/plat-omap/devices.c3
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h20
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h10
-rw-r--r--arch/arm/plat-pxa/Makefile1
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio-pxa.h44
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio.h40
-rw-r--r--arch/arm/plat-spear/include/plat/gpio.h25
-rw-r--r--drivers/ata/pata_at91.c2
-rw-r--r--drivers/gpio/Kconfig9
-rw-r--r--drivers/gpio/Makefile7
-rw-r--r--drivers/gpio/gpio-davinci.c (renamed from arch/arm/mach-davinci/gpio.c)7
-rw-r--r--drivers/gpio/gpio-ep93xx.c22
-rw-r--r--drivers/gpio/gpio-ks8695.c (renamed from arch/arm/mach-ks8695/gpio.c)4
-rw-r--r--drivers/gpio/gpio-lpc32xx.c (renamed from arch/arm/mach-lpc32xx/gpiolib.c)2
-rw-r--r--drivers/gpio/gpio-nomadik.c3
-rw-r--r--drivers/gpio/gpio-omap.c2
-rw-r--r--drivers/gpio/gpio-pxa.c (renamed from arch/arm/plat-pxa/gpio.c)4
-rw-r--r--drivers/gpio/gpio-sa1100.c (renamed from arch/arm/mach-sa1100/gpio.c)4
-rw-r--r--drivers/gpio/gpio-tegra.c23
-rw-r--r--drivers/gpio/gpio-tnetv107x.c (renamed from arch/arm/mach-davinci/gpio-tnetv107x.c)0
-rw-r--r--drivers/gpio/gpio-u300.c1190
-rw-r--r--drivers/i2c/busses/i2c-ixp2000.c2
-rw-r--r--drivers/ide/at91_ide.c2
-rw-r--r--drivers/input/keyboard/omap-keypad.c2
-rw-r--r--drivers/mfd/menelaus.c2
-rw-r--r--drivers/mmc/host/omap.c2
-rw-r--r--drivers/mmc/host/sdhci-tegra.c4
-rw-r--r--drivers/mtd/nand/ams-delta.c2
-rw-r--r--drivers/mtd/onenand/omap2.c2
-rw-r--r--drivers/net/arm/at91_ether.c2
-rw-r--r--drivers/pcmcia/pxa2xx_vpac270.c2
-rw-r--r--drivers/spi/spi-atmel.c2
-rw-r--r--drivers/tty/serial/atmel_serial.c2
-rw-r--r--drivers/usb/host/ohci-pnx4008.c2
-rw-r--r--drivers/usb/musb/davinci.c2
-rw-r--r--drivers/video/atmel_lcdfb.c2
-rw-r--r--drivers/video/omap/lcd_apollon.c2
-rw-r--r--drivers/video/omap/lcd_h3.c2
-rw-r--r--drivers/video/omap/lcd_inn1610.c2
-rw-r--r--drivers/video/omap/lcd_ldp.c2
-rw-r--r--drivers/video/omap/lcd_osk.c2
-rw-r--r--drivers/video/omap/lcd_overo.c2
-rw-r--r--drivers/video/omap/lcd_palmtt.c2
-rw-r--r--drivers/video/pnx4008/sdum.c2
257 files changed, 1665 insertions, 1742 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3146ed3f6eca..4792d2928fa3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -835,6 +835,7 @@ config ARCH_U300
835 select CLKDEV_LOOKUP 835 select CLKDEV_LOOKUP
836 select HAVE_MACH_CLKDEV 836 select HAVE_MACH_CLKDEV
837 select GENERIC_GPIO 837 select GENERIC_GPIO
838 select ARCH_REQUIRE_GPIOLIB
838 help 839 help
839 Support for ST-Ericsson U300 series mobile platforms. 840 Support for ST-Ericsson U300 series mobile platforms.
840 841
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a07b0e763a80..1cde34a080d7 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -12,11 +12,11 @@
12 */ 12 */
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/gpio.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <asm/gpio.h>
20#include <asm/hardware/scoop.h> 20#include <asm/hardware/scoop.h>
21 21
22/* PCMCIA to Scoop linkage 22/* PCMCIA to Scoop linkage
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 166a7a3e2840..11ad0bfbb0ad 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -4,4 +4,23 @@
4/* not all ARM platforms necessarily support this API ... */ 4/* not all ARM platforms necessarily support this API ... */
5#include <mach/gpio.h> 5#include <mach/gpio.h>
6 6
7#ifndef __ARM_GPIOLIB_COMPLEX
8/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
9#include <asm-generic/gpio.h>
10
11/* The trivial gpiolib dispatchers */
12#define gpio_get_value __gpio_get_value
13#define gpio_set_value __gpio_set_value
14#define gpio_cansleep __gpio_cansleep
15#endif
16
17/*
18 * Provide a default gpio_to_irq() which should satisfy every case.
19 * However, some platforms want to do this differently, so allow them
20 * to override it.
21 */
22#ifndef gpio_to_irq
23#define gpio_to_irq __gpio_to_irq
24#endif
25
7#endif /* _ARCH_ARM_GPIO_H */ 26#endif /* _ARCH_ARM_GPIO_H */
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
index b69d972b1f7d..9eda7dc92ad8 100644
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ b/arch/arm/include/asm/hardware/iop3xx-gpio.h
@@ -28,6 +28,8 @@
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <asm-generic/gpio.h> 29#include <asm-generic/gpio.h>
30 30
31#define __ARM_GPIOLIB_COMPLEX
32
31#define IOP3XX_N_GPIOS 8 33#define IOP3XX_N_GPIOS 8
32 34
33static inline int gpio_get_value(unsigned gpio) 35static inline int gpio_get_value(unsigned gpio)
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index dba0d8d8a4bd..f87f5040e78e 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -16,6 +16,7 @@
16#include <asm/mach/irq.h> 16#include <asm/mach/irq.h>
17 17
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <linux/gpio.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/i2c-gpio.h> 21#include <linux/i2c-gpio.h>
21 22
@@ -23,7 +24,6 @@
23 24
24#include <mach/board.h> 25#include <mach/board.h>
25#include <mach/cpu.h> 26#include <mach/cpu.h>
26#include <mach/gpio.h>
27#include <mach/at91cap9.h> 27#include <mach/at91cap9.h>
28#include <mach/at91cap9_matrix.h> 28#include <mach/at91cap9_matrix.h>
29#include <mach/at91sam9_smc.h> 29#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 7227755ffec6..978be950035a 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -14,11 +14,11 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/gpio.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
19 20
20#include <mach/board.h> 21#include <mach/board.h>
21#include <mach/gpio.h>
22#include <mach/at91rm9200.h> 22#include <mach/at91rm9200.h>
23#include <mach/at91rm9200_mc.h> 23#include <mach/at91rm9200_mc.h>
24 24
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 39f81f47b4ba..a53b3de9daa2 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -13,11 +13,11 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18 19
19#include <mach/board.h> 20#include <mach/board.h>
20#include <mach/gpio.h>
21#include <mach/cpu.h> 21#include <mach/cpu.h>
22#include <mach/at91sam9260.h> 22#include <mach/at91sam9260.h>
23#include <mach/at91sam9260_matrix.h> 23#include <mach/at91sam9260_matrix.h>
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0f917928eeb7..4e647b653339 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -14,6 +14,7 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/gpio.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
19 20
@@ -21,7 +22,6 @@
21#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
22 23
23#include <mach/board.h> 24#include <mach/board.h>
24#include <mach/gpio.h>
25#include <mach/at91sam9261.h> 25#include <mach/at91sam9261.h>
26#include <mach/at91sam9261_matrix.h> 26#include <mach/at91sam9261_matrix.h>
27#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index a050f41fc860..dd7662bc395f 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18 19
@@ -20,7 +21,6 @@
20#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
21 22
22#include <mach/board.h> 23#include <mach/board.h>
23#include <mach/gpio.h>
24#include <mach/at91sam9263.h> 24#include <mach/at91sam9263.h>
25#include <mach/at91sam9263_matrix.h> 25#include <mach/at91sam9263_matrix.h>
26#include <mach/at91sam9_smc.h> 26#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 600bffb01edb..c3dfb1b3b1e3 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18#include <linux/atmel-mci.h> 19#include <linux/atmel-mci.h>
@@ -21,7 +22,6 @@
21#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
22 23
23#include <mach/board.h> 24#include <mach/board.h>
24#include <mach/gpio.h>
25#include <mach/at91sam9g45.h> 25#include <mach/at91sam9g45.h>
26#include <mach/at91sam9g45_matrix.h> 26#include <mach/at91sam9g45_matrix.h>
27#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index aacb19dc9225..305a851b5bff 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -10,6 +10,7 @@
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/i2c-gpio.h> 15#include <linux/i2c-gpio.h>
15 16
@@ -17,7 +18,6 @@
17#include <video/atmel_lcdc.h> 18#include <video/atmel_lcdc.h>
18 19
19#include <mach/board.h> 20#include <mach/board.h>
20#include <mach/gpio.h>
21#include <mach/at91sam9rl.h> 21#include <mach/at91sam9rl.h>
22#include <mach/at91sam9rl_matrix.h> 22#include <mach/at91sam9rl_matrix.h>
23#include <mach/at91sam9_smc.h> 23#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 5aa58851eb39..367d5cd5e362 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -34,7 +35,6 @@
34#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
35 36
36#include <mach/board.h> 37#include <mach/board.h>
37#include <mach/gpio.h>
38#include <mach/cpu.h> 38#include <mach/cpu.h>
39 39
40#include "generic.h" 40#include "generic.h"
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index b0c796d42e49..0487ea10c2d6 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -25,6 +25,7 @@
25 */ 25 */
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/gpio.h>
28#include <linux/init.h> 29#include <linux/init.h>
29#include <linux/mm.h> 30#include <linux/mm.h>
30#include <linux/module.h> 31#include <linux/module.h>
@@ -43,7 +44,6 @@
43#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
44 45
45#include <mach/board.h> 46#include <mach/board.h>
46#include <mach/gpio.h>
47 47
48#include "generic.h" 48#include "generic.h"
49 49
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index d1abd5898e85..747b2eaa9737 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -38,7 +39,6 @@
38#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
39 40
40#include <mach/board.h> 41#include <mach/board.h>
41#include <mach/gpio.h>
42#include <mach/at91sam9_smc.h> 42#include <mach/at91sam9_smc.h>
43 43
44#include "sam9_smc.h" 44#include "sam9_smc.h"
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 679b0b743e92..062670351a6a 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -41,7 +42,6 @@
41#include <asm/mach/map.h> 42#include <asm/mach/map.h>
42 43
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91cap9_matrix.h> 45#include <mach/at91cap9_matrix.h>
46#include <mach/at91sam9_smc.h> 46#include <mach/at91sam9_smc.h>
47#include <mach/system_rev.h> 47#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index c578c5d90728..774c87fcbd5b 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -35,7 +36,6 @@
35 36
36#include <mach/hardware.h> 37#include <mach/hardware.h>
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index f4da8a16d5dc..fc885a4ce243 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -40,7 +41,6 @@
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/board.h> 43#include <mach/board.h>
43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
45#include <mach/at91sam9260_matrix.h> 45#include <mach/at91sam9260_matrix.h>
46 46
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2d919f5a4f57..d35e65b08ccd 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -36,7 +37,6 @@
36#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
37 38
38#include <mach/board.h> 39#include <mach/board.h>
39#include <mach/gpio.h>
40#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41#include <mach/cpu.h> 41#include <mach/cpu.h>
42 42
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 17654d5e94e6..c3936665e645 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -38,7 +39,6 @@
38 39
39#include <mach/hardware.h> 40#include <mach/hardware.h>
40#include <mach/board.h> 41#include <mach/board.h>
41#include <mach/gpio.h>
42 42
43#include "generic.h" 43#include "generic.h"
44 44
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 72b55674616c..586100e2acbb 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/gpio.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
@@ -35,7 +36,6 @@
35 36
36#include <mach/hardware.h> 37#include <mach/hardware.h>
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 01170a2766a8..45db7a3dbef0 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -35,7 +36,6 @@
35#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
36 37
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 7c0313c51f26..2f9c16d29212 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38 39
39#include <mach/board.h> 40#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/cpu.h> 41#include <mach/cpu.h>
42 42
43#include "generic.h" 43#include "generic.h"
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 4a170890b3b1..3bae73e63633 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -34,7 +35,6 @@
34#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
35 36
36#include <mach/board.h> 37#include <mach/board.h>
37#include <mach/gpio.h>
38#include <mach/cpu.h> 38#include <mach/cpu.h>
39 39
40#include "generic.h" 40#include "generic.h"
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 9dc8d496ead1..15a3f1a87ab0 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -35,7 +36,6 @@
35#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
36 37
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39#include <mach/cpu.h> 39#include <mach/cpu.h>
40#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41 41
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 9bc6ab32e0ac..6094496f7edb 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -44,7 +45,6 @@
44 45
45#include <mach/hardware.h> 46#include <mach/hardware.h>
46#include <mach/board.h> 47#include <mach/board.h>
47#include <mach/gpio.h>
48#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49 49
50#include "sam9_smc.h" 50#include "sam9_smc.h"
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index b7b8390e8a00..0a8fe6a1b7c8 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38 39
39#include <mach/board.h> 40#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/at91rm9200_mc.h> 41#include <mach/at91rm9200_mc.h>
42 42
43#include "generic.h" 43#include "generic.h"
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 81f911033681..938cc390bea3 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -40,7 +41,6 @@
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/board.h> 43#include <mach/board.h>
43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
45#include <mach/at91_shdwc.h> 45#include <mach/at91_shdwc.h>
46 46
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 6f08faadb474..b4ac30e38a9e 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -39,7 +40,6 @@
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <mach/board.h> 42#include <mach/board.h>
42#include <mach/gpio.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44 44
45#include "generic.h" 45#include "generic.h"
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 85bcccd7b9e4..99fd7f8aee0e 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -39,7 +40,6 @@
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <mach/board.h> 42#include <mach/board.h>
42#include <mach/gpio.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44 44
45#include "generic.h" 45#include "generic.h"
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 4d3a02f1289e..2a21e790250e 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38 39
39#include <mach/board.h> 40#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/at91sam9_smc.h> 41#include <mach/at91sam9_smc.h>
42 42
43#include "sam9_smc.h" 43#include "sam9_smc.h"
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 8a50c3e67186..89c8b579bfda 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -41,7 +42,6 @@
41 42
42#include <mach/hardware.h> 43#include <mach/hardware.h>
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91sam9_smc.h> 45#include <mach/at91sam9_smc.h>
46#include <mach/at91_shdwc.h> 46#include <mach/at91_shdwc.h>
47#include <mach/system_rev.h> 47#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 5096a0ec50c1..3741f43cdae9 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -45,7 +46,6 @@
45 46
46#include <mach/hardware.h> 47#include <mach/hardware.h>
47#include <mach/board.h> 48#include <mach/board.h>
48#include <mach/gpio.h>
49#include <mach/at91sam9_smc.h> 49#include <mach/at91sam9_smc.h>
50#include <mach/at91_shdwc.h> 50#include <mach/at91_shdwc.h>
51#include <mach/system_rev.h> 51#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index ea8f185d3b9d..a580dd451a41 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -44,7 +45,6 @@
44 45
45#include <mach/hardware.h> 46#include <mach/hardware.h>
46#include <mach/board.h> 47#include <mach/board.h>
47#include <mach/gpio.h>
48#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49#include <mach/at91_shdwc.h> 49#include <mach/at91_shdwc.h>
50#include <mach/system_rev.h> 50#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 817f59d7251b..8d77c2ff96b2 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/gpio.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/mm.h> 23#include <linux/mm.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -41,7 +42,6 @@
41#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
42 43
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91sam9_smc.h> 45#include <mach/at91sam9_smc.h>
46#include <mach/system_rev.h> 46#include <mach/system_rev.h>
47 47
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ad234ccbf57e..2d6203ac1a42 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19#include <linux/module.h> 20#include <linux/module.h>
@@ -38,7 +39,6 @@
38#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
39 40
40#include <mach/board.h> 41#include <mach/board.h>
41#include <mach/gpio.h>
42#include <mach/at91sam9_smc.h> 42#include <mach/at91sam9_smc.h>
43#include <mach/at91_shdwc.h> 43#include <mach/at91_shdwc.h>
44#include <mach/system_rev.h> 44#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 4f14b54b93a8..39a28effc3df 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/gpio.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
13#include <linux/module.h> 14#include <linux/module.h>
@@ -30,7 +31,6 @@
30 31
31#include <mach/hardware.h> 32#include <mach/hardware.h>
32#include <mach/board.h> 33#include <mach/board.h>
33#include <mach/gpio.h>
34#include <mach/at91sam9_smc.h> 34#include <mach/at91sam9_smc.h>
35#include <mach/at91_shdwc.h> 35#include <mach/at91_shdwc.h>
36 36
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index 260260b81992..5852d3d9890c 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -28,6 +28,7 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/gpio.h>
31#include <linux/input.h> 32#include <linux/input.h>
32#include <linux/spi/mmc_spi.h> 33#include <linux/spi/mmc_spi.h>
33 34
@@ -41,7 +42,6 @@
41 42
42#include <mach/hardware.h> 43#include <mach/hardware.h>
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91sam9_smc.h> 45#include <mach/at91sam9_smc.h>
46#include <mach/at91_shdwc.h> 46#include <mach/at91_shdwc.h>
47 47
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 95edcbd2aec6..3c288b396fc4 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -43,7 +44,6 @@
43 44
44#include <mach/hardware.h> 45#include <mach/hardware.h>
45#include <mach/board.h> 46#include <mach/board.h>
46#include <mach/gpio.h>
47#include <mach/at91rm9200_mc.h> 47#include <mach/at91rm9200_mc.h>
48#include <mach/cpu.h> 48#include <mach/cpu.h>
49 49
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 4615528205c8..224e9e2f8674 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/gpio.h>
14#include <linux/interrupt.h> 15#include <linux/interrupt.h>
15#include <linux/irq.h> 16#include <linux/irq.h>
16#include <linux/debugfs.h> 17#include <linux/debugfs.h>
@@ -22,9 +23,6 @@
22 23
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <mach/at91_pio.h> 25#include <mach/at91_pio.h>
25#include <mach/gpio.h>
26
27#include <asm/gpio.h>
28 26
29#include "generic.h" 27#include "generic.h"
30 28
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index 056dc6674b6b..2b9a1f51210f 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -214,11 +214,6 @@ extern void at91_gpio_resume(void);
214 */ 214 */
215 215
216#include <asm/errno.h> 216#include <asm/errno.h>
217#include <asm-generic/gpio.h> /* cansleep wrappers */
218
219#define gpio_get_value __gpio_get_value
220#define gpio_set_value __gpio_set_value
221#define gpio_cansleep __gpio_cansleep
222 217
223#define gpio_to_irq(gpio) (gpio) 218#define gpio_to_irq(gpio) (gpio)
224#define irq_to_gpio(irq) (irq) 219#define irq_to_gpio(irq) (irq)
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 0415a839e1ad..8dfafe76ffe6 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -9,13 +9,13 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10*/ 10*/
11 11
12#include <linux/gpio.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
17#include <mach/board.h> 18#include <mach/board.h>
18#include <mach/gpio.h>
19 19
20 20
21/* ------------------------------------------------------------------------- */ 21/* ------------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 4159eca78945..7046158109d7 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -10,6 +10,7 @@
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/gpio.h>
13#include <linux/suspend.h> 14#include <linux/suspend.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
@@ -25,7 +26,6 @@
25#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
26 27
27#include <mach/at91_pmc.h> 28#include <mach/at91_pmc.h>
28#include <mach/gpio.h>
29#include <mach/cpu.h> 29#include <mach/cpu.h>
30 30
31#include "generic.h" 31#include "generic.h"
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 0b87a1ca2bb3..495e31306fc0 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -5,7 +5,7 @@
5 5
6# Common objects 6# Common objects
7obj-y := time.o clock.o serial.o io.o psc.o \ 7obj-y := time.o clock.o serial.o io.o psc.o \
8 gpio.o dma.o usb.o common.o sram.o aemif.o 8 dma.o usb.o common.o sram.o aemif.o
9 9
10obj-$(CONFIG_DAVINCI_MUX) += mux.o 10obj-$(CONFIG_DAVINCI_MUX) += mux.o
11 11
@@ -17,7 +17,6 @@ obj-$(CONFIG_ARCH_DAVINCI_DM365) += dm365.o devices.o
17obj-$(CONFIG_ARCH_DAVINCI_DA830) += da830.o devices-da8xx.o 17obj-$(CONFIG_ARCH_DAVINCI_DA830) += da830.o devices-da8xx.o
18obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.o devices-da8xx.o 18obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.o devices-da8xx.o
19obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += tnetv107x.o devices-tnetv107x.o 19obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += tnetv107x.o devices-tnetv107x.o
20obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += gpio-tnetv107x.o
21 20
22obj-$(CONFIG_AINTC) += irq.o 21obj-$(CONFIG_AINTC) += irq.o
23obj-$(CONFIG_CP_INTC) += cp_intc.o 22obj-$(CONFIG_CP_INTC) += cp_intc.o
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 2ed2f822fc40..a6bf5dcaef13 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -8,6 +8,7 @@
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
10 */ 10 */
11#include <linux/gpio.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/clk.h> 13#include <linux/clk.h>
13 14
@@ -19,7 +20,7 @@
19#include <mach/common.h> 20#include <mach/common.h>
20#include <mach/time.h> 21#include <mach/time.h>
21#include <mach/da8xx.h> 22#include <mach/da8xx.h>
22#include <mach/gpio.h> 23#include <mach/gpio-davinci.h>
23 24
24#include "clock.h" 25#include "clock.h"
25#include "mux.h" 26#include "mux.h"
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 935dbed5c541..4aae01576aab 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -11,6 +11,7 @@
11 * is licensed "as is" without any warranty of any kind, whether express 11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied. 12 * or implied.
13 */ 13 */
14#include <linux/gpio.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -27,7 +28,7 @@
27#include <mach/da8xx.h> 28#include <mach/da8xx.h>
28#include <mach/cpufreq.h> 29#include <mach/cpufreq.h>
29#include <mach/pm.h> 30#include <mach/pm.h>
30#include <mach/gpio.h> 31#include <mach/gpio-davinci.h>
31 32
32#include "clock.h" 33#include "clock.h"
33#include "mux.h" 34#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a3a94e9c9378..c143f43addcc 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -13,7 +13,6 @@
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17 16
18#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
19 18
@@ -30,6 +29,7 @@
30#include <mach/common.h> 29#include <mach/common.h>
31#include <mach/asp.h> 30#include <mach/asp.h>
32#include <mach/spi.h> 31#include <mach/spi.h>
32#include <mach/gpio-davinci.h>
33 33
34#include "clock.h" 34#include "clock.h"
35#include "mux.h" 35#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 4604e72d7d99..679e168dce34 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -17,7 +17,6 @@
17#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20#include <linux/gpio.h>
21#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
22 21
23#include <asm/mach/map.h> 22#include <asm/mach/map.h>
@@ -34,7 +33,7 @@
34#include <mach/asp.h> 33#include <mach/asp.h>
35#include <mach/keyscan.h> 34#include <mach/keyscan.h>
36#include <mach/spi.h> 35#include <mach/spi.h>
37 36#include <mach/gpio-davinci.h>
38 37
39#include "clock.h" 38#include "clock.h"
40#include "mux.h" 39#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 4c82c2716293..9a274665edc5 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -12,7 +12,6 @@
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/gpio.h>
16 15
17#include <asm/mach/map.h> 16#include <asm/mach/map.h>
18 17
@@ -26,6 +25,7 @@
26#include <mach/serial.h> 25#include <mach/serial.h>
27#include <mach/common.h> 26#include <mach/common.h>
28#include <mach/asp.h> 27#include <mach/asp.h>
28#include <mach/gpio-davinci.h>
29 29
30#include "clock.h" 30#include "clock.h"
31#include "mux.h" 31#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 1802e711a2b8..03e5f4931b42 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -13,7 +13,6 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17 16
18#include <asm/mach/map.h> 17#include <asm/mach/map.h>
19 18
@@ -27,6 +26,7 @@
27#include <mach/serial.h> 26#include <mach/serial.h>
28#include <mach/common.h> 27#include <mach/common.h>
29#include <mach/asp.h> 28#include <mach/asp.h>
29#include <mach/gpio-davinci.h>
30 30
31#include "clock.h" 31#include "clock.h"
32#include "mux.h" 32#include "mux.h"
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
new file mode 100644
index 000000000000..1fdd1fd35448
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
@@ -0,0 +1,91 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
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
13#ifndef __DAVINCI_DAVINCI_GPIO_H
14#define __DAVINCI_DAVINCI_GPIO_H
15
16#include <linux/io.h>
17#include <linux/spinlock.h>
18
19#include <asm-generic/gpio.h>
20
21#include <mach/irqs.h>
22#include <mach/common.h>
23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
29};
30
31/*
32 * basic gpio routines
33 *
34 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
35 * initializing banks together) rather than boot loaders; kexec() won't
36 * go through boot loaders.
37 *
38 * the gpio clock will be turned on when gpios are used, and you may also
39 * need to pay attention to PINMUX registers to be sure those pins are
40 * used as gpios, not with other peripherals.
41 *
42 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
43 * and maybe for later updates, code may write GPIO(N). These may be
44 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
45 * may not support all the GPIOs in that range.
46 *
47 * GPIOs can also be on external chips, numbered after the ones built-in
48 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
49 */
50#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
51
52/* Convert GPIO signal to GPIO pin number */
53#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
54
55struct davinci_gpio_controller {
56 struct gpio_chip chip;
57 int irq_base;
58 spinlock_t lock;
59 void __iomem *regs;
60 void __iomem *set_data;
61 void __iomem *clr_data;
62 void __iomem *in_data;
63};
64
65/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
66 * with constant parameters; or in outlined code they execute at runtime.
67 *
68 * You'd access the controller directly when reading or writing more than
69 * one gpio value at a time, and to support wired logic where the value
70 * being driven by the cpu need not match the value read back.
71 *
72 * These are NOT part of the cross-platform GPIO interface
73 */
74static inline struct davinci_gpio_controller *
75__gpio_to_controller(unsigned gpio)
76{
77 struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
78 int index = gpio / 32;
79
80 if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
81 return NULL;
82
83 return ctlrs + index;
84}
85
86static inline u32 __gpio_mask(unsigned gpio)
87{
88 return 1 << (gpio % 32);
89}
90
91#endif /* __DAVINCI_DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index fbece126c2bf..fbaae4772b91 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -13,80 +13,10 @@
13#ifndef __DAVINCI_GPIO_H 13#ifndef __DAVINCI_GPIO_H
14#define __DAVINCI_GPIO_H 14#define __DAVINCI_GPIO_H
15 15
16#include <linux/io.h>
17#include <linux/spinlock.h>
18
19#include <asm-generic/gpio.h> 16#include <asm-generic/gpio.h>
20 17
21#include <mach/irqs.h> 18/* The inline versions use the static inlines in the driver header */
22#include <mach/common.h> 19#include "gpio-davinci.h"
23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
29};
30
31/*
32 * basic gpio routines
33 *
34 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
35 * initializing banks together) rather than boot loaders; kexec() won't
36 * go through boot loaders.
37 *
38 * the gpio clock will be turned on when gpios are used, and you may also
39 * need to pay attention to PINMUX registers to be sure those pins are
40 * used as gpios, not with other peripherals.
41 *
42 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
43 * and maybe for later updates, code may write GPIO(N). These may be
44 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
45 * may not support all the GPIOs in that range.
46 *
47 * GPIOs can also be on external chips, numbered after the ones built-in
48 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
49 */
50#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
51
52/* Convert GPIO signal to GPIO pin number */
53#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
54
55struct davinci_gpio_controller {
56 struct gpio_chip chip;
57 int irq_base;
58 spinlock_t lock;
59 void __iomem *regs;
60 void __iomem *set_data;
61 void __iomem *clr_data;
62 void __iomem *in_data;
63};
64
65/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
66 * with constant parameters; or in outlined code they execute at runtime.
67 *
68 * You'd access the controller directly when reading or writing more than
69 * one gpio value at a time, and to support wired logic where the value
70 * being driven by the cpu need not match the value read back.
71 *
72 * These are NOT part of the cross-platform GPIO interface
73 */
74static inline struct davinci_gpio_controller *
75__gpio_to_controller(unsigned gpio)
76{
77 struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
78 int index = gpio / 32;
79
80 if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
81 return NULL;
82
83 return ctlrs + index;
84}
85
86static inline u32 __gpio_mask(unsigned gpio)
87{
88 return 1 << (gpio % 32);
89}
90 20
91/* 21/*
92 * The get/set/clear functions will inline when called with constant 22 * The get/set/clear functions will inline when called with constant
@@ -147,11 +77,6 @@ static inline int gpio_cansleep(unsigned gpio)
147 return __gpio_cansleep(gpio); 77 return __gpio_cansleep(gpio);
148} 78}
149 79
150static inline int gpio_to_irq(unsigned gpio)
151{
152 return __gpio_to_irq(gpio);
153}
154
155static inline int irq_to_gpio(unsigned irq) 80static inline int irq_to_gpio(unsigned irq)
156{ 81{
157 /* don't support the reverse mapping */ 82 /* don't support the reverse mapping */
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index 1b28fdd892a6..409bb869c7c7 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -12,6 +12,7 @@
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 */ 14 */
15#include <linux/gpio.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/clk.h> 18#include <linux/clk.h>
@@ -27,9 +28,9 @@
27#include <mach/psc.h> 28#include <mach/psc.h>
28#include <mach/cp_intc.h> 29#include <mach/cp_intc.h>
29#include <mach/irqs.h> 30#include <mach/irqs.h>
30#include <mach/gpio.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/tnetv107x.h> 32#include <mach/tnetv107x.h>
33#include <mach/gpio-davinci.h>
33 34
34#include "clock.h" 35#include "clock.h"
35#include "mux.h" 36#include "mux.h"
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index c60f081e930b..94c78bc66275 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -38,6 +38,7 @@
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <mach/ep93xx_keypad.h> 39#include <mach/ep93xx_keypad.h>
40#include <mach/ep93xx_spi.h> 40#include <mach/ep93xx_spi.h>
41#include <mach/gpio-ep93xx.h>
41 42
42#include <asm/mach/map.h> 43#include <asm/mach/map.h>
43#include <asm/mach/time.h> 44#include <asm/mach/time.h>
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 9969bb115f60..3f320c6477bf 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -37,6 +37,7 @@
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <mach/ep93xx_spi.h> 39#include <mach/ep93xx_spi.h>
40#include <mach/gpio-ep93xx.h>
40 41
41#include <asm/mach-types.h> 42#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
index c57152c231f1..8aff2ea35877 100644
--- a/arch/arm/mach-ep93xx/include/mach/gpio.h
+++ b/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
@@ -1,9 +1,7 @@
1/* 1/* Include file for the EP93XX GPIO controller machine specifics */
2 * arch/arm/mach-ep93xx/include/mach/gpio.h
3 */
4 2
5#ifndef __ASM_ARCH_GPIO_H 3#ifndef __GPIO_EP93XX_H
6#define __ASM_ARCH_GPIO_H 4#define __GPIO_EP93XX_H
7 5
8/* GPIO port A. */ 6/* GPIO port A. */
9#define EP93XX_GPIO_LINE_A(x) ((x) + 0) 7#define EP93XX_GPIO_LINE_A(x) ((x) + 0)
@@ -99,22 +97,4 @@
99/* maximum value for irq capable line identifiers */ 97/* maximum value for irq capable line identifiers */
100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) 98#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
101 99
102/* new generic GPIO API - see Documentation/gpio.txt */ 100#endif /* __GPIO_EP93XX_H */
103
104#include <asm-generic/gpio.h>
105
106#define gpio_get_value __gpio_get_value
107#define gpio_set_value __gpio_set_value
108#define gpio_cansleep __gpio_cansleep
109
110/*
111 * Map GPIO A0..A7 (0..7) to irq 64..71,
112 * B0..B7 (7..15) to irq 72..79, and
113 * F0..F7 (16..24) to irq 80..87.
114 */
115#define gpio_to_irq(gpio) \
116 (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL)
117
118#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
119
120#endif
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index 8392e95d7cea..1a472ff12cce 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -18,12 +18,12 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/gpio.h>
22#include <linux/i2c.h> 21#include <linux/i2c.h>
23#include <linux/i2c-gpio.h> 22#include <linux/i2c-gpio.h>
24 23
25#include <mach/hardware.h> 24#include <mach/hardware.h>
26#include <mach/fb.h> 25#include <mach/fb.h>
26#include <mach/gpio-ep93xx.h>
27 27
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c
index 2e9c614757e4..4f4b0b2c4c31 100644
--- a/arch/arm/mach-ep93xx/snappercl15.c
+++ b/arch/arm/mach-ep93xx/snappercl15.c
@@ -20,7 +20,6 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/gpio.h>
24#include <linux/i2c.h> 23#include <linux/i2c.h>
25#include <linux/i2c-gpio.h> 24#include <linux/i2c-gpio.h>
26#include <linux/fb.h> 25#include <linux/fb.h>
@@ -30,6 +29,7 @@
30 29
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32#include <mach/fb.h> 31#include <mach/fb.h>
32#include <mach/gpio-ep93xx.h>
33 33
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-exynos4/include/mach/gpio.h b/arch/arm/mach-exynos4/include/mach/gpio.h
index be9266b10fdb..80523ca9bb49 100644
--- a/arch/arm/mach-exynos4/include/mach/gpio.h
+++ b/arch/arm/mach-exynos4/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#ifndef __ASM_ARCH_GPIO_H 13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 14#define __ASM_ARCH_GPIO_H __FILE__
15 15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* Practically, GPIO banks up to GPZ are the configurable gpio banks */ 16/* Practically, GPIO banks up to GPZ are the configurable gpio banks */
22 17
23/* GPIO bank sizes */ 18/* GPIO bank sizes */
@@ -151,6 +146,4 @@ enum s5p_gpio_number {
151#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ 146#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \
152 CONFIG_SAMSUNG_GPIO_EXTRA + 1) 147 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
153 148
154#include <asm-generic/gpio.h>
155
156#endif /* __ASM_ARCH_GPIO_H */ 149#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-gemini/include/mach/gpio.h b/arch/arm/mach-gemini/include/mach/gpio.h
index 3bc2c70f2989..40a0527bada7 100644
--- a/arch/arm/mach-gemini/include/mach/gpio.h
+++ b/arch/arm/mach-gemini/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#define __MACH_GPIO_H__ 13#define __MACH_GPIO_H__
14 14
15#include <mach/irqs.h> 15#include <mach/irqs.h>
16#include <asm-generic/gpio.h>
17
18#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value
20#define gpio_cansleep __gpio_cansleep
21 16
22#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE) 17#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
23#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE) 18#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index cf8f8099ebd7..82bd4403b450 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -17,13 +17,12 @@
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA. 18 * MA 02110-1301, USA.
19 */ 19 */
20 20#include <linux/gpio.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/gpio.h>
27#include <mach/iomux-mx3.h> 26#include <mach/iomux-mx3.h>
28 27
29/* 28/*
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index fc26ed71b9ed..e1addc1a5813 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -13,7 +13,7 @@
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
@@ -27,7 +27,6 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <mach/gpio.h>
31#include <mach/iomux-mx27.h> 30#include <mach/iomux-mx27.h>
32 31
33#include "devices-imx27.h" 32#include "devices-imx27.h"
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 4068166c8993..59a512672bb9 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -13,7 +13,7 @@
13 * License version 2. This program is licensed "as is" without any 13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied. 14 * warranty of any kind, whether express or implied.
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
@@ -39,7 +39,7 @@
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <mach/gpio.h> 42#include <mach/gpio-ixp2000.h>
43 43
44static DEFINE_SPINLOCK(ixp2000_slowport_lock); 44static DEFINE_SPINLOCK(ixp2000_slowport_lock);
45static unsigned long ixp2000_slowport_irq_flags; 45static unsigned long ixp2000_slowport_irq_flags;
diff --git a/arch/arm/mach-ixp2000/include/mach/gpio.h b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
index 4a88d2c33dac..af836c76c3f1 100644
--- a/arch/arm/mach-ixp2000/include/mach/gpio.h
+++ b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2002 Intel Corporation. 4 * Copyright (C) 2002 Intel Corporation.
5 * 5 *
6 * This program is free software, you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
@@ -11,7 +11,7 @@
11/* 11/*
12 * IXP2000 GPIO in/out, edge/level detection for IRQs: 12 * IXP2000 GPIO in/out, edge/level detection for IRQs:
13 * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High 13 * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
14 * or both Falling-edge and Rising-edge. 14 * or both Falling-edge and Rising-edge.
15 * This must be called *before* the corresponding IRQ is registerd. 15 * This must be called *before* the corresponding IRQ is registerd.
16 * Use this instead of directly setting the GPIO registers. 16 * Use this instead of directly setting the GPIO registers.
17 * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb) 17 * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index 235638f800e5..634b6c852f68 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -14,6 +14,7 @@
14 * Free Software Foundation; either version 2 of the License, or (at your 14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. 15 * option) any later version.
16 */ 16 */
17#include <linux/gpio.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/mm.h> 20#include <linux/mm.h>
@@ -40,8 +41,7 @@
40#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
41#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
42 43
43#include <mach/gpio.h> 44#include <mach/gpio-ixp2000.h>
44
45 45
46/************************************************************************* 46/*************************************************************************
47 * IXDP2x00 IRQ Initialization 47 * IXDP2x00 IRQ Initialization
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 03e54515e8b3..96e378345801 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -16,7 +16,7 @@
16 * Author: Rod Whitby <rod@whitby.id.au> 16 * Author: Rod Whitby <rod@whitby.id.au>
17 * Maintainers: http://www.nslu2-linux.org/ 17 * Maintainers: http://www.nslu2-linux.org/
18 */ 18 */
19 19#include <linux/gpio.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/jiffies.h> 21#include <linux/jiffies.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
@@ -31,7 +31,6 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/gpio.h>
35 34
36#define DSMG600_SDA_PIN 5 35#define DSMG600_SDA_PIN 5
37#define DSMG600_SCL_PIN 4 36#define DSMG600_SCL_PIN 4
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 23a8b3614568..72333a039431 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -14,7 +14,7 @@
14 * Maintainers: http://www.nslu2-linux.org/ 14 * Maintainers: http://www.nslu2-linux.org/
15 * 15 *
16 */ 16 */
17 17#include <linux/gpio.h>
18#include <linux/if_ether.h> 18#include <linux/if_ether.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/serial.h> 20#include <linux/serial.h>
@@ -27,7 +27,6 @@
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/gpio.h>
31 30
32#define FSG_SDA_PIN 12 31#define FSG_SDA_PIN 12
33#define FSG_SCL_PIN 13 32#define FSG_SCL_PIN 13
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index a5f87ded2f28..83d6b4ed60bb 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -28,6 +28,8 @@
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30 30
31#define __ARM_GPIOLIB_COMPLEX
32
31static inline int gpio_request(unsigned gpio, const char *label) 33static inline int gpio_request(unsigned gpio, const char *label)
32{ 34{
33 return 0; 35 return 0;
@@ -70,6 +72,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
70#include <asm-generic/gpio.h> /* cansleep wrappers */ 72#include <asm-generic/gpio.h> /* cansleep wrappers */
71 73
72extern int gpio_to_irq(int gpio); 74extern int gpio_to_irq(int gpio);
75#define gpio_to_irq gpio_to_irq
73extern int irq_to_gpio(unsigned int irq); 76extern int irq_to_gpio(unsigned int irq);
74 77
75#endif 78#endif
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index afb51879d9a4..b752fa4d6927 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -17,7 +17,7 @@
17 * Maintainers: http://www.nslu2-linux.org/ 17 * Maintainers: http://www.nslu2-linux.org/
18 * 18 *
19 */ 19 */
20 20#include <linux/gpio.h>
21#include <linux/if_ether.h> 21#include <linux/if_ether.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
@@ -32,7 +32,6 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
35#include <asm/gpio.h>
36 35
37#define NAS100D_SDA_PIN 5 36#define NAS100D_SDA_PIN 5
38#define NAS100D_SCL_PIN 6 37#define NAS100D_SCL_PIN 6
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 69e40f2cf092..0411a0a01071 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -16,7 +16,7 @@
16 * Maintainers: http://www.nslu2-linux.org/ 16 * Maintainers: http://www.nslu2-linux.org/
17 * 17 *
18 */ 18 */
19 19#include <linux/gpio.h>
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/serial.h> 22#include <linux/serial.h>
@@ -30,7 +30,6 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/gpio.h>
34 33
35#define NSLU2_SDA_PIN 7 34#define NSLU2_SDA_PIN 7
36#define NSLU2_SCL_PIN 6 35#define NSLU2_SCL_PIN 6
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index 05d193a25b25..c4c68e5b94f1 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -7,14 +7,13 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <mach/bridge-regs.h> 15#include <mach/bridge-regs.h>
16#include <plat/irq.h> 16#include <plat/irq.h>
17#include <asm/gpio.h>
18#include "common.h" 17#include "common.h"
19 18
20static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 19static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index b0a7d979a8ed..cc431fa22ccb 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -7,12 +7,11 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/gpio.h>
16#include <mach/hardware.h> 15#include <mach/hardware.h>
17#include <plat/mpp.h> 16#include <plat/mpp.h>
18#include "common.h" 17#include "common.h"
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index 7e3e8160ed30..853efd9133c6 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -3,7 +3,7 @@
3# Makefile for KS8695 architecture support 3# Makefile for KS8695 architecture support
4# 4#
5 5
6obj-y := cpu.o irq.o time.o gpio.o devices.o 6obj-y := cpu.o irq.o time.o devices.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/mach-ks8695/board-acs5k.c b/arch/arm/mach-ks8695/board-acs5k.c
index 3ca4f8e6f54f..3d7d11436aa5 100644
--- a/arch/arm/mach-ks8695/board-acs5k.c
+++ b/arch/arm/mach-ks8695/board-acs5k.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -34,7 +34,7 @@
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35 35
36#include <mach/devices.h> 36#include <mach/devices.h>
37#include <mach/gpio.h> 37#include <mach/gpio-ks8695.h>
38 38
39#include "generic.h" 39#include "generic.h"
40 40
diff --git a/arch/arm/mach-ks8695/board-dsm320.c b/arch/arm/mach-ks8695/board-dsm320.c
index 1338cb3e9827..c3c867ac4155 100644
--- a/arch/arm/mach-ks8695/board-dsm320.c
+++ b/arch/arm/mach-ks8695/board-dsm320.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -29,7 +29,7 @@
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <mach/devices.h> 31#include <mach/devices.h>
32#include <mach/gpio.h> 32#include <mach/gpio-ks8695.h>
33 33
34#include "generic.h" 34#include "generic.h"
35 35
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index e2e3cba8dcdb..9b9c47cc6471 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -5,7 +5,7 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8#include <linux/gpio.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
@@ -18,7 +18,7 @@
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/mach/irq.h> 19#include <asm/mach/irq.h>
20 20
21#include <mach/gpio.h> 21#include <mach/gpio-ks8695.h>
22#include <mach/devices.h> 22#include <mach/devices.h>
23 23
24#include "generic.h" 24#include "generic.h"
diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
index b89fb6d46ccc..73bd63812878 100644
--- a/arch/arm/mach-ks8695/devices.c
+++ b/arch/arm/mach-ks8695/devices.c
@@ -20,6 +20,7 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/map.h> 21#include <asm/mach/map.h>
22 22
23#include <linux/gpio.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24 25
25#include <mach/irqs.h> 26#include <mach/irqs.h>
diff --git a/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h b/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h
new file mode 100644
index 000000000000..6eb034d60325
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2006 Andrew Victor
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_KS8659_GPIO_H
10#define __MACH_KS8659_GPIO_H
11
12#include <linux/kernel.h>
13
14#define KS8695_GPIO_0 0
15#define KS8695_GPIO_1 1
16#define KS8695_GPIO_2 2
17#define KS8695_GPIO_3 3
18#define KS8695_GPIO_4 4
19#define KS8695_GPIO_5 5
20#define KS8695_GPIO_6 6
21#define KS8695_GPIO_7 7
22#define KS8695_GPIO_8 8
23#define KS8695_GPIO_9 9
24#define KS8695_GPIO_10 10
25#define KS8695_GPIO_11 11
26#define KS8695_GPIO_12 12
27#define KS8695_GPIO_13 13
28#define KS8695_GPIO_14 14
29#define KS8695_GPIO_15 15
30
31/*
32 * Configure GPIO pin as external interrupt source.
33 */
34extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
35
36/* Register the GPIOs */
37extern void ks8695_register_gpios(void);
38
39#endif /* __MACH_KS8659_GPIO_H */
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
index 86312d476bc6..f5fda36e4512 100644
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -11,47 +11,9 @@
11#ifndef __ASM_ARCH_GPIO_H_ 11#ifndef __ASM_ARCH_GPIO_H_
12#define __ASM_ARCH_GPIO_H_ 12#define __ASM_ARCH_GPIO_H_
13 13
14#include <linux/kernel.h>
15
16#define KS8695_GPIO_0 0
17#define KS8695_GPIO_1 1
18#define KS8695_GPIO_2 2
19#define KS8695_GPIO_3 3
20#define KS8695_GPIO_4 4
21#define KS8695_GPIO_5 5
22#define KS8695_GPIO_6 6
23#define KS8695_GPIO_7 7
24#define KS8695_GPIO_8 8
25#define KS8695_GPIO_9 9
26#define KS8695_GPIO_10 10
27#define KS8695_GPIO_11 11
28#define KS8695_GPIO_12 12
29#define KS8695_GPIO_13 13
30#define KS8695_GPIO_14 14
31#define KS8695_GPIO_15 15
32
33/*
34 * Configure GPIO pin as external interrupt source.
35 */
36extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
37
38/* 14/*
39 * Map IRQ number to GPIO line. 15 * Map IRQ number to GPIO line.
40 */ 16 */
41extern int irq_to_gpio(unsigned int irq); 17extern int irq_to_gpio(unsigned int irq);
42 18
43#include <asm-generic/gpio.h>
44
45/* If it turns out that we need to optimise GPIO access for the
46 * Micrel's GPIOs, then these can be changed to check their argument
47 * directly as static inlines. However for now it's probably not
48 * worthwhile.
49 */
50#define gpio_get_value __gpio_get_value
51#define gpio_set_value __gpio_set_value
52#define gpio_to_irq __gpio_to_irq
53
54/* Register the GPIOs */
55extern void ks8695_register_gpios(void);
56
57#endif 19#endif
diff --git a/arch/arm/mach-ks8695/leds.c b/arch/arm/mach-ks8695/leds.c
index 184ef74e4bee..d6f6502ac9b5 100644
--- a/arch/arm/mach-ks8695/leds.c
+++ b/arch/arm/mach-ks8695/leds.c
@@ -7,14 +7,14 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/gpio.h>
14 15
15#include <asm/leds.h> 16#include <asm/leds.h>
16#include <mach/devices.h> 17#include <mach/devices.h>
17#include <mach/gpio.h>
18 18
19 19
20static inline void ks8695_led_on(unsigned int led) 20static inline void ks8695_led_on(unsigned int led)
diff --git a/arch/arm/mach-lpc32xx/Makefile b/arch/arm/mach-lpc32xx/Makefile
index a5fc5d0eeaeb..f5db805ab958 100644
--- a/arch/arm/mach-lpc32xx/Makefile
+++ b/arch/arm/mach-lpc32xx/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5obj-y := timer.o irq.o common.o serial.o clock.o 5obj-y := timer.o irq.o common.o serial.o clock.o
6obj-y += gpiolib.o pm.o suspend.o 6obj-y += pm.o suspend.o
7obj-y += phy3250.o 7obj-y += phy3250.o
8 8
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
new file mode 100644
index 000000000000..1816e22a3479
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
@@ -0,0 +1,50 @@
1/*
2 * Author: Kevin Wells <kevin.wells@nxp.com>
3 *
4 * Copyright (C) 2010 NXP Semiconductors
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
17#ifndef __MACH_GPIO_LPC32XX_H
18#define __MACH_GPIO_LPC32XX_H
19
20/*
21 * Note!
22 * Muxed GP pins need to be setup to the GP state in the board level
23 * code prior to using this driver.
24 * GPI pins : 28xP3 group
25 * GPO pins : 24xP3 group
26 * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
27 */
28
29#define LPC32XX_GPIO_P0_MAX 8
30#define LPC32XX_GPIO_P1_MAX 24
31#define LPC32XX_GPIO_P2_MAX 13
32#define LPC32XX_GPIO_P3_MAX 6
33#define LPC32XX_GPI_P3_MAX 28
34#define LPC32XX_GPO_P3_MAX 24
35
36#define LPC32XX_GPIO_P0_GRP 0
37#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
38#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
39#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
40#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
41#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
42
43/*
44 * A specific GPIO can be selected with this macro
45 * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
46 * See the LPC32x0 User's guide for GPIO group numbers
47 */
48#define LPC32XX_GPIO(x, y) ((x) + (y))
49
50#endif /* __MACH_GPIO_LPC32XX_H */
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio.h b/arch/arm/mach-lpc32xx/include/mach/gpio.h
index 67d03da1eee9..e69de29bb2d1 100644
--- a/arch/arm/mach-lpc32xx/include/mach/gpio.h
+++ b/arch/arm/mach-lpc32xx/include/mach/gpio.h
@@ -1,74 +0,0 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/gpio.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __ASM_ARCH_GPIO_H
20#define __ASM_ARCH_GPIO_H
21
22#include <asm-generic/gpio.h>
23
24/*
25 * Note!
26 * Muxed GP pins need to be setup to the GP state in the board level
27 * code prior to using this driver.
28 * GPI pins : 28xP3 group
29 * GPO pins : 24xP3 group
30 * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
31 */
32
33#define LPC32XX_GPIO_P0_MAX 8
34#define LPC32XX_GPIO_P1_MAX 24
35#define LPC32XX_GPIO_P2_MAX 13
36#define LPC32XX_GPIO_P3_MAX 6
37#define LPC32XX_GPI_P3_MAX 28
38#define LPC32XX_GPO_P3_MAX 24
39
40#define LPC32XX_GPIO_P0_GRP 0
41#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
42#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
43#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
44#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
45#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
46
47/*
48 * A specific GPIO can be selected with this macro
49 * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
50 * See the LPC32x0 User's guide for GPIO group numbers
51 */
52#define LPC32XX_GPIO(x, y) ((x) + (y))
53
54static inline int gpio_get_value(unsigned gpio)
55{
56 return __gpio_get_value(gpio);
57}
58
59static inline void gpio_set_value(unsigned gpio, int value)
60{
61 __gpio_set_value(gpio, value);
62}
63
64static inline int gpio_cansleep(unsigned gpio)
65{
66 return __gpio_cansleep(gpio);
67}
68
69static inline int gpio_to_irq(unsigned gpio)
70{
71 return __gpio_to_irq(gpio);
72}
73
74#endif
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 7993b096778e..c3a22fd736aa 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -37,6 +37,7 @@
37 37
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/platform.h> 39#include <mach/platform.h>
40#include <mach/gpio-lpc32xx.h>
40#include "common.h" 41#include "common.h"
41 42
42/* 43/*
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 06b5fa853c93..833c3a2784aa 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -8,7 +8,7 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * publishhed by the Free Software Foundation. 9 * publishhed by the Free Software Foundation.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -17,13 +17,13 @@
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/gpio.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
23#include <mach/addr-map.h> 24#include <mach/addr-map.h>
24#include <mach/mfp-pxa168.h> 25#include <mach/mfp-pxa168.h>
25#include <mach/pxa168.h> 26#include <mach/pxa168.h>
26#include <mach/gpio.h>
27#include <video/pxa168fb.h> 27#include <video/pxa168fb.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <plat/pxa27x_keypad.h> 29#include <plat/pxa27x_keypad.h>
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index c79162a50f28..e411252e3d39 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/gpio.h>
18#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
19#include <linux/regulator/max8649.h> 18#include <linux/regulator/max8649.h>
20#include <linux/regulator/fixed.h> 19#include <linux/regulator/fixed.h>
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index 98e25d9aaab6..32776f3739f1 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -9,11 +9,11 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/gpio.h>
12 13
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach-types.h> 15#include <asm/mach-types.h>
15 16
16#include <mach/gpio.h>
17#include <mach/pxa168.h> 17#include <mach/pxa168.h>
18#include <mach/mfp-pxa168.h> 18#include <mach/mfp-pxa168.h>
19 19
diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
new file mode 100644
index 000000000000..c017a983eced
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_MACH_GPIO_PXA_H
2#define __ASM_MACH_GPIO_PXA_H
3
4#include <mach/addr-map.h>
5#include <mach/irqs.h>
6
7#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
8
9#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
10#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
11
12#define NR_BUILTIN_GPIO IRQ_GPIO_NUM
13
14#define gpio_to_bank(gpio) ((gpio) >> 5)
15
16/* NOTE: these macros are defined here to make optimization of
17 * gpio_{get,set}_value() to work when 'gpio' is a constant.
18 * Usage of these macros otherwise is no longer recommended,
19 * use generic GPIO API whenever possible.
20 */
21#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
22
23#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
24#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
25#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
26#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
27
28#include <plat/gpio-pxa.h>
29
30#endif /* __ASM_MACH_GPIO_PXA_H */
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
index 7bfb827f3fe3..681262359d1c 100644
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ b/arch/arm/mach-mmp/include/mach/gpio.h
@@ -1,36 +1,13 @@
1#ifndef __ASM_MACH_GPIO_H 1#ifndef __ASM_MACH_GPIO_H
2#define __ASM_MACH_GPIO_H 2#define __ASM_MACH_GPIO_H
3 3
4#include <mach/addr-map.h>
5#include <mach/irqs.h>
6#include <asm-generic/gpio.h> 4#include <asm-generic/gpio.h>
7 5
8#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
9
10#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
11#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
12
13#define NR_BUILTIN_GPIO IRQ_GPIO_NUM
14
15#define gpio_to_bank(gpio) ((gpio) >> 5)
16#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) 6#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
17#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START) 7#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
18 8
19
20#define __gpio_is_inverted(gpio) (0) 9#define __gpio_is_inverted(gpio) (0)
21#define __gpio_is_occupied(gpio) (0) 10#define __gpio_is_occupied(gpio) (0)
22 11
23/* NOTE: these macros are defined here to make optimization of
24 * gpio_{get,set}_value() to work when 'gpio' is a constant.
25 * Usage of these macros otherwise is no longer recommended,
26 * use generic GPIO API whenever possible.
27 */
28#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
29
30#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
31#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
32#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
33#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
34
35#include <plat/gpio.h> 12#include <plat/gpio.h>
36#endif /* __ASM_MACH_GPIO_H */ 13#endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c
index 5d6421d63254..8bfac6612623 100644
--- a/arch/arm/mach-mmp/jasper.c
+++ b/arch/arm/mach-mmp/jasper.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/gpio.h>
18#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
19#include <linux/regulator/max8649.h> 18#include <linux/regulator/max8649.h>
20#include <linux/mfd/max8925.h> 19#include <linux/mfd/max8925.h>
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index 079c18861d5c..65d8689e40c9 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -25,7 +24,7 @@
25#include <mach/irqs.h> 24#include <mach/irqs.h>
26#include <mach/dma.h> 25#include <mach/dma.h>
27#include <mach/mfp.h> 26#include <mach/mfp.h>
28#include <mach/gpio.h> 27#include <mach/gpio-pxa.h>
29#include <mach/devices.h> 28#include <mach/devices.h>
30#include <mach/mmp2.h> 29#include <mach/mmp2.h>
31 30
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 0156f535dae7..50c1763911ff 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -7,7 +7,6 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#include <linux/module.h> 10#include <linux/module.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/init.h> 12#include <linux/init.h>
@@ -21,7 +20,7 @@
21#include <mach/regs-apbc.h> 20#include <mach/regs-apbc.h>
22#include <mach/regs-apmu.h> 21#include <mach/regs-apmu.h>
23#include <mach/irqs.h> 22#include <mach/irqs.h>
24#include <mach/gpio.h> 23#include <mach/gpio-pxa.h>
25#include <mach/dma.h> 24#include <mach/dma.h>
26#include <mach/devices.h> 25#include <mach/devices.h>
27#include <mach/mfp.h> 26#include <mach/mfp.h>
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 1464607aa60d..4ebbfbba39fc 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -7,7 +7,6 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#include <linux/module.h> 10#include <linux/module.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/init.h> 12#include <linux/init.h>
@@ -20,7 +19,7 @@
20#include <mach/regs-apmu.h> 19#include <mach/regs-apmu.h>
21#include <mach/cputype.h> 20#include <mach/cputype.h>
22#include <mach/irqs.h> 21#include <mach/irqs.h>
23#include <mach/gpio.h> 22#include <mach/gpio-pxa.h>
24#include <mach/dma.h> 23#include <mach/dma.h>
25#include <mach/mfp.h> 24#include <mach/mfp.h>
26#include <mach/devices.h> 25#include <mach/devices.h>
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index c296b75c4453..eb5be879fd8c 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -7,18 +7,18 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * publishhed by the Free Software Foundation. 8 * publishhed by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/smc91x.h> 14#include <linux/smc91x.h>
15#include <linux/gpio.h>
15 16
16#include <asm/mach-types.h> 17#include <asm/mach-types.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <mach/addr-map.h> 19#include <mach/addr-map.h>
19#include <mach/mfp-pxa910.h> 20#include <mach/mfp-pxa910.h>
20#include <mach/pxa910.h> 21#include <mach/pxa910.h>
21#include <mach/gpio.h>
22 22
23#include "common.h" 23#include "common.h"
24 24
diff --git a/arch/arm/mach-msm/board-msm7x27.c b/arch/arm/mach-msm/board-msm7x27.c
index c03f269e2e4b..1a313e10c68a 100644
--- a/arch/arm/mach-msm/board-msm7x27.c
+++ b/arch/arm/mach-msm/board-msm7x27.c
@@ -13,7 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
@@ -34,7 +34,6 @@
34 34
35#include <mach/vreg.h> 35#include <mach/vreg.h>
36#include <mach/mpp.h> 36#include <mach/mpp.h>
37#include <mach/gpio.h>
38#include <mach/board.h> 37#include <mach/board.h>
39#include <mach/msm_iomap.h> 38#include <mach/msm_iomap.h>
40 39
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index b7a84966b711..92afaf6583ea 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -14,7 +14,7 @@
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA. 15 * 02110-1301, USA.
16 */ 16 */
17 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
@@ -30,7 +30,6 @@
30#include <asm/memory.h> 30#include <asm/memory.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32 32
33#include <mach/gpio.h>
34#include <mach/board.h> 33#include <mach/board.h>
35#include <mach/msm_iomap.h> 34#include <mach/msm_iomap.h>
36#include <mach/dma.h> 35#include <mach/dma.h>
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 6a96911b0ad5..24e9b89738ef 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -14,7 +14,7 @@
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA. 15 * 02110-1301, USA.
16 */ 16 */
17 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
@@ -32,7 +32,6 @@
32#include <mach/board.h> 32#include <mach/board.h>
33#include <mach/irqs.h> 33#include <mach/irqs.h>
34#include <mach/sirc.h> 34#include <mach/sirc.h>
35#include <mach/gpio.h>
36#include <mach/vreg.h> 35#include <mach/vreg.h>
37#include <mach/mmc.h> 36#include <mach/mmc.h>
38 37
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index 68f930f07d77..863394c59e86 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -11,7 +11,7 @@
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13*/ 13*/
14 14#include <linux/gpio.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -22,7 +22,6 @@
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24 24
25#include <asm/gpio.h>
26#include <mach/hardware.h> 25#include <mach/hardware.h>
27#include <asm/mach-types.h> 26#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index f7a9724788b0..8650342b7493 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-msm/board-trout-mmc.c 1/* linux/arch/arm/mach-msm/board-trout-mmc.c
2** Author: Brian Swetland <swetland@google.com> 2** Author: Brian Swetland <swetland@google.com>
3*/ 3*/
4 4#include <linux/gpio.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
@@ -11,7 +11,6 @@
11#include <linux/err.h> 11#include <linux/err.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13 13
14#include <asm/gpio.h>
15#include <asm/io.h> 14#include <asm/io.h>
16 15
17#include <mach/vreg.h> 16#include <mach/vreg.h>
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index 729bb49a44ca..25105c1027fe 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-msm/board-trout-mddi.c 1/* linux/arch/arm/mach-msm/board-trout-mddi.c
2** Author: Brian Swetland <swetland@google.com> 2** Author: Brian Swetland <swetland@google.com>
3*/ 3*/
4 4#include <linux/gpio.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
@@ -11,7 +11,6 @@
11#include <linux/err.h> 11#include <linux/err.h>
12 12
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/gpio.h>
15#include <asm/mach-types.h> 14#include <asm/mach-types.h>
16 15
17#include <mach/msm_fb.h> 16#include <mach/msm_fb.h>
diff --git a/arch/arm/mach-msm/include/mach/gpio.h b/arch/arm/mach-msm/include/mach/gpio.h
index 36ad50d3bfaa..40a8c178f10d 100644
--- a/arch/arm/mach-msm/include/mach/gpio.h
+++ b/arch/arm/mach-msm/include/mach/gpio.h
@@ -1,26 +1 @@
1/* /* empty */
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
4 * Author: Mike Lockwood <lockwood@android.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16#ifndef __ASM_ARCH_MSM_GPIO_H
17#define __ASM_ARCH_MSM_GPIO_H
18
19#include <asm-generic/gpio.h>
20
21#define gpio_get_value __gpio_get_value
22#define gpio_set_value __gpio_set_value
23#define gpio_cansleep __gpio_cansleep
24#define gpio_to_irq __gpio_to_irq
25
26#endif /* __ASM_ARCH_MSM_GPIO_H */
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index 3e24431bb5ea..e421b701663b 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -7,12 +7,11 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <asm/gpio.h>
16#include <mach/bridge-regs.h> 15#include <mach/bridge-regs.h>
17#include <plat/irq.h> 16#include <plat/irq.h>
18#include "common.h" 17#include "common.h"
diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
index 59b7686b9209..cf4e494d44bf 100644
--- a/arch/arm/mach-mv78xx0/mpp.c
+++ b/arch/arm/mach-mv78xx0/mpp.c
@@ -7,13 +7,12 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <plat/mpp.h> 15#include <plat/mpp.h>
16#include <asm/gpio.h>
17#include <mach/hardware.h> 16#include <mach/hardware.h>
18#include "common.h" 17#include "common.h"
19#include "mpp.h" 18#include "mpp.h"
diff --git a/arch/arm/mach-mxs/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h
index 828ccccb6aad..bb11e63261e4 100644
--- a/arch/arm/mach-mxs/include/mach/gpio.h
+++ b/arch/arm/mach-mxs/include/mach/gpio.h
@@ -20,16 +20,8 @@
20#ifndef __MACH_MXS_GPIO_H__ 20#ifndef __MACH_MXS_GPIO_H__
21#define __MACH_MXS_GPIO_H__ 21#define __MACH_MXS_GPIO_H__
22 22
23#include <asm-generic/gpio.h>
24
25#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr)) 23#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
26 24
27/* use gpiolib dispatchers */
28#define gpio_get_value __gpio_get_value
29#define gpio_set_value __gpio_set_value
30#define gpio_cansleep __gpio_cansleep
31#define gpio_to_irq __gpio_to_irq
32
33#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) 25#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
34 26
35#endif /* __MACH_MXS_GPIO_H__ */ 27#endif /* __MACH_MXS_GPIO_H__ */
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 139930350d93..97d7186484ca 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -27,6 +27,7 @@
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29 29
30#include <plat/gpio-nomadik.h>
30#include <plat/mtu.h> 31#include <plat/mtu.h>
31 32
32#include <mach/setup.h> 33#include <mach/setup.h>
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index ac58e3b03b1a..dc67717db6f0 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -21,8 +21,8 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/amba/bus.h> 22#include <linux/amba/bus.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/gpio.h>
25 24
25#include <plat/gpio-nomadik.h>
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c
index abfe25a08d6b..0fc2f6f1cc97 100644
--- a/arch/arm/mach-nomadik/i2c-8815nhk.c
+++ b/arch/arm/mach-nomadik/i2c-8815nhk.c
@@ -3,8 +3,8 @@
3#include <linux/i2c.h> 3#include <linux/i2c.h>
4#include <linux/i2c-algo-bit.h> 4#include <linux/i2c-algo-bit.h>
5#include <linux/i2c-gpio.h> 5#include <linux/i2c-gpio.h>
6#include <linux/gpio.h>
7#include <linux/platform_device.h> 6#include <linux/platform_device.h>
7#include <plat/gpio-nomadik.h>
8 8
9/* 9/*
10 * There are two busses in the 8815NHK. 10 * There are two busses in the 8815NHK.
diff --git a/arch/arm/mach-nomadik/include/mach/gpio.h b/arch/arm/mach-nomadik/include/mach/gpio.h
index 7a81a0420343..efdde0ae0a4f 100644
--- a/arch/arm/mach-nomadik/include/mach/gpio.h
+++ b/arch/arm/mach-nomadik/include/mach/gpio.h
@@ -1,6 +1,4 @@
1#ifndef __ASM_ARCH_GPIO_H 1#ifndef __ASM_ARCH_GPIO_H
2#define __ASM_ARCH_GPIO_H 2#define __ASM_ARCH_GPIO_H
3 3
4#include <plat/gpio.h>
5
6#endif /* __ASM_ARCH_GPIO_H */ 4#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 312ea6b0409d..d86e9af2822b 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -11,7 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/input.h> 17#include <linux/input.h>
@@ -30,7 +30,6 @@
30 30
31#include <plat/io.h> 31#include <plat/io.h>
32#include <plat/board-ams-delta.h> 32#include <plat/board-ams-delta.h>
33#include <mach/gpio.h>
34#include <plat/keypad.h> 33#include <plat/keypad.h>
35#include <plat/mux.h> 34#include <plat/mux.h>
36#include <plat/usb.h> 35#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index a6b1bea50371..dd814b33cdd5 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -28,7 +28,6 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <plat/tc.h> 30#include <plat/tc.h>
31#include <mach/gpio.h>
32#include <plat/mux.h> 31#include <plat/mux.h>
33#include <plat/flash.h> 32#include <plat/flash.h>
34#include <plat/fpga.h> 33#include <plat/fpga.h>
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 04fc356c40fa..8f7d11581482 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -12,7 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -22,7 +22,6 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <mach/gpio.h>
26#include <plat/mux.h> 25#include <plat/mux.h>
27#include <plat/usb.h> 26#include <plat/usb.h>
28#include <plat/board.h> 27#include <plat/board.h>
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index f2fc43d8382b..da0e37d40823 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -11,13 +11,12 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h> 19#include <plat/mmc.h>
20#include <mach/gpio.h>
21 20
22#include "board-h2.h" 21#include "board-h2.h"
23 22
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index cb7fb1aa3dca..0796ad7e24b5 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -18,7 +18,7 @@
18 * it under the terms of the GNU General Public License version 2 as 18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation. 19 * published by the Free Software Foundation.
20 */ 20 */
21 21#include <linux/gpio.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
@@ -32,7 +32,6 @@
32#include <linux/smc91x.h> 32#include <linux/smc91x.h>
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <asm/gpio.h>
36 35
37#include <asm/mach-types.h> 36#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index 2098525e7cc5..f8242aa9b763 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -11,13 +11,12 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h> 19#include <plat/mmc.h>
20#include <mach/gpio.h>
21 20
22#include "board-h3.h" 21#include "board-h3.h"
23 22
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 31f34875ffad..fe1814c5e748 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -13,7 +13,7 @@
13 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/major.h> 19#include <linux/major.h>
@@ -34,7 +34,6 @@
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/page.h> 35#include <asm/page.h>
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <asm/gpio.h>
38 37
39#include <asm/mach-types.h> 38#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 36e06ea7ec65..4af7bfa40e4a 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -23,7 +23,6 @@
23 * 02110-1301, USA. 23 * 02110-1301, USA.
24 * 24 *
25 */ 25 */
26
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/platform_device.h> 28#include <linux/platform_device.h>
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 0b1ba462d388..e603e5eb32a8 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -15,7 +15,7 @@
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18#include <linux/gpio.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -34,7 +34,6 @@
34#include <plat/mux.h> 34#include <plat/mux.h>
35#include <plat/flash.h> 35#include <plat/flash.h>
36#include <plat/fpga.h> 36#include <plat/fpga.h>
37#include <mach/gpio.h>
38#include <plat/tc.h> 37#include <plat/tc.h>
39#include <plat/usb.h> 38#include <plat/usb.h>
40#include <plat/keypad.h> 39#include <plat/keypad.h>
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 5469ce247ffe..8420535fe51d 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
@@ -26,7 +26,6 @@
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <mach/gpio.h>
30#include <plat/mux.h> 29#include <plat/mux.h>
31#include <plat/usb.h> 30#include <plat/usb.h>
32#include <plat/board.h> 31#include <plat/board.h>
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index b08a21380772..bf1ebe5b2442 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -25,7 +25,7 @@
25 * with this program; if not, write to the Free Software Foundation, Inc., 25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA. 26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28 28#include <linux/gpio.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
@@ -42,7 +42,6 @@
42#include <linux/i2c/tps65010.h> 42#include <linux/i2c/tps65010.h>
43 43
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45#include <asm/gpio.h>
46 45
47#include <asm/mach-types.h> 46#include <asm/mach-types.h>
48#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 459cb6bfed55..45596b5acf09 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -16,7 +16,7 @@
16 * it under the terms of the GNU General Public License version 2 as 16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18 */ 18 */
19 19#include <linux/gpio.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/input.h> 22#include <linux/input.h>
@@ -33,7 +33,6 @@
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <mach/gpio.h>
37#include <plat/flash.h> 36#include <plat/flash.h>
38#include <plat/mux.h> 37#include <plat/mux.h>
39#include <plat/usb.h> 38#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index b214f45f646c..f942221f6e71 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/gpio.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -30,7 +31,6 @@
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31 32
32#include <plat/led.h> 33#include <plat/led.h>
33#include <mach/gpio.h>
34#include <plat/flash.h> 34#include <plat/flash.h>
35#include <plat/mux.h> 35#include <plat/mux.h>
36#include <plat/usb.h> 36#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 9b0ea48d35fd..2b912d46ceec 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/gpio.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -32,7 +33,6 @@
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34 35
35#include <mach/gpio.h>
36#include <plat/flash.h> 36#include <plat/flash.h>
37#include <plat/mux.h> 37#include <plat/mux.h>
38#include <plat/usb.h> 38#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 67acd4142639..7e2efe52cc35 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -28,7 +28,6 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <plat/tc.h> 30#include <plat/tc.h>
31#include <mach/gpio.h>
32#include <plat/mux.h> 31#include <plat/mux.h>
33#include <plat/fpga.h> 32#include <plat/fpga.h>
34#include <plat/flash.h> 33#include <plat/flash.h>
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index e8ddd86e3fda..b59f78850e69 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -12,11 +12,11 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/gpio.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
17#include <mach/hardware.h> 18#include <mach/hardware.h>
18#include <plat/mmc.h> 19#include <plat/mmc.h>
19#include <mach/gpio.h>
20#include <plat/board-sx1.h> 20#include <plat/board-sx1.h>
21 21
22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 9c3b7c52d9cf..172a28f9a344 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -14,7 +14,7 @@
14* it under the terms of the GNU General Public License version 2 as 14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation. 15* published by the Free Software Foundation.
16*/ 16*/
17 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h> 20#include <linux/input.h>
@@ -32,7 +32,6 @@
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <mach/gpio.h>
36#include <plat/flash.h> 35#include <plat/flash.h>
37#include <plat/mux.h> 36#include <plat/mux.h>
38#include <plat/dma.h> 37#include <plat/dma.h>
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 036edc0ee9b6..236b7ded0cf8 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/irq.h> 19#include <linux/irq.h>
@@ -33,7 +34,6 @@
33 34
34#include <plat/board-voiceblue.h> 35#include <plat/board-voiceblue.h>
35#include <plat/common.h> 36#include <plat/common.h>
36#include <mach/gpio.h>
37#include <plat/flash.h> 37#include <plat/flash.h>
38#include <plat/mux.h> 38#include <plat/mux.h>
39#include <plat/tc.h> 39#include <plat/tc.h>
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 36f26c3fa25e..7c50ecf68123 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -24,7 +25,6 @@
24#include <plat/tc.h> 25#include <plat/tc.h>
25#include <plat/board.h> 26#include <plat/board.h>
26#include <plat/mux.h> 27#include <plat/mux.h>
27#include <mach/gpio.h>
28#include <plat/mmc.h> 28#include <plat/mmc.h>
29#include <plat/omap7xx.h> 29#include <plat/omap7xx.h>
30#include <plat/mcbsp.h> 30#include <plat/mcbsp.h>
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index cddbf8b089ce..0a17a1a7e00d 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/gpio.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/device.h> 23#include <linux/device.h>
@@ -28,7 +29,6 @@
28#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
29 30
30#include <plat/fpga.h> 31#include <plat/fpga.h>
31#include <mach/gpio.h>
32 32
33static void fpga_mask_irq(struct irq_data *d) 33static void fpga_mask_irq(struct irq_data *d)
34{ 34{
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index e2b9c901ab67..e5b104b7fce6 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -35,7 +35,7 @@
35 * with this program; if not, write to the Free Software Foundation, Inc., 35 * with this program; if not, write to the Free Software Foundation, Inc.,
36 * 675 Mass Ave, Cambridge, MA 02139, USA. 36 * 675 Mass Ave, Cambridge, MA 02139, USA.
37 */ 37 */
38 38#include <linux/gpio.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/sched.h> 41#include <linux/sched.h>
@@ -45,7 +45,6 @@
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/mach/irq.h> 47#include <asm/mach/irq.h>
48#include <mach/gpio.h>
49#include <plat/cpu.h> 48#include <plat/cpu.h>
50 49
51#define IRQ_BANK(irq) ((irq) >> 5) 50#define IRQ_BANK(irq) ((irq) >> 5)
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index b4f9be52e1e8..4b818eb9f911 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -9,6 +9,7 @@
9 * The "surfer" expansion board and H2 sample board also have two-color 9 * The "surfer" expansion board and H2 sample board also have two-color
10 * green+red LEDs (in parallel), used here for timer and idle indicators. 10 * green+red LEDs (in parallel), used here for timer and idle indicators.
11 */ 11 */
12#include <linux/gpio.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
@@ -20,7 +21,6 @@
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21 22
22#include <plat/fpga.h> 23#include <plat/fpga.h>
23#include <mach/gpio.h>
24 24
25#include "leds.h" 25#include "leds.h"
26 26
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 499d7ad8697d..da09f4364979 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -3,14 +3,13 @@
3 * 3 *
4 * LED driver for OSK with optional Mistral QVGA board 4 * LED driver for OSK with optional Mistral QVGA board
5 */ 5 */
6#include <linux/gpio.h>
6#include <linux/init.h> 7#include <linux/init.h>
7 8
8#include <mach/hardware.h> 9#include <mach/hardware.h>
9#include <asm/leds.h> 10#include <asm/leds.h>
10#include <asm/system.h> 11#include <asm/system.h>
11 12
12#include <mach/gpio.h>
13
14#include "leds.h" 13#include "leds.h"
15 14
16 15
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
index 22eb11dde9e7..ae6dd93b8ddc 100644
--- a/arch/arm/mach-omap1/leds.c
+++ b/arch/arm/mach-omap1/leds.c
@@ -3,13 +3,13 @@
3 * 3 *
4 * OMAP LEDs dispatcher 4 * OMAP LEDs dispatcher
5 */ 5 */
6#include <linux/gpio.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7#include <linux/init.h> 8#include <linux/init.h>
8 9
9#include <asm/leds.h> 10#include <asm/leds.h>
10#include <asm/mach-types.h> 11#include <asm/mach-types.h>
11 12
12#include <mach/gpio.h>
13#include <plat/mux.h> 13#include <plat/mux.h>
14 14
15#include "leds.h" 15#include "leds.h"
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 550ca9d9991d..93ae8f29727e 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
@@ -24,7 +24,6 @@
24 24
25#include <plat/board.h> 25#include <plat/board.h>
26#include <plat/mux.h> 26#include <plat/mux.h>
27#include <mach/gpio.h>
28#include <plat/fpga.h> 27#include <plat/fpga.h>
29 28
30#include "pm.h" 29#include "pm.h"
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 54db41a84a9b..bb4af05c7f0a 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,7 +15,7 @@
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18#include <linux/gpio.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/device.h> 21#include <linux/device.h>
@@ -25,7 +25,6 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <mach/gpio.h>
29#include <plat/usb.h> 28#include <plat/usb.h>
30#include <plat/board.h> 29#include <plat/board.h>
31#include <plat/common.h> 30#include <plat/common.h>
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 45de2b319ec9..95319e761802 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -31,7 +31,6 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/gpio.h>
35#include <plat/usb.h> 34#include <plat/usb.h>
36#include <plat/board.h> 35#include <plat/board.h>
37#include <plat/common.h> 36#include <plat/common.h>
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 218764c9377e..ddff45c1688c 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -34,7 +34,6 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <plat/mcspi.h> 36#include <plat/mcspi.h>
37#include <mach/gpio.h>
38#include <plat/board.h> 37#include <plat/board.h>
39#include <plat/common.h> 38#include <plat/common.h>
40#include <plat/gpmc.h> 39#include <plat/gpmc.h>
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1077ad663f93..5391079c8689 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -8,7 +8,7 @@
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -26,7 +26,6 @@
26#include <plat/tc.h> 26#include <plat/tc.h>
27#include <plat/board.h> 27#include <plat/board.h>
28#include <plat/mcbsp.h> 28#include <plat/mcbsp.h>
29#include <mach/gpio.h>
30#include <plat/mmc.h> 29#include <plat/mmc.h>
31#include <plat/dma.h> 30#include <plat/dma.h>
32#include <plat/omap_hwmod.h> 31#include <plat/omap_hwmod.h>
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index a3e3e9e5e328..6d771cbf06a4 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -9,7 +9,7 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -21,7 +21,6 @@
21#include <linux/mv643xx_eth.h> 21#include <linux/mv643xx_eth.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
27#include <mach/orion5x.h> 26#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index c105556a0ee1..6fb4908e998b 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -13,7 +13,7 @@
13 * License, or (at your option) any later version. 13 * License, or (at your option) any later version.
14 * 14 *
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
@@ -30,7 +30,6 @@
30#include <linux/phy.h> 30#include <linux/phy.h>
31#include <linux/marvell_phy.h> 31#include <linux/marvell_phy.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/gpio.h>
34#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
35#include <asm/mach/pci.h> 34#include <asm/mach/pci.h>
36#include <mach/orion5x.h> 35#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 43cf8bc9767b..b1b45fff776e 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -9,12 +9,11 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <asm/gpio.h>
18#include <mach/bridge-regs.h> 17#include <mach/bridge-regs.h>
19#include <plat/irq.h> 18#include <plat/irq.h>
20#include "common.h" 19#include "common.h"
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 00381249d766..f88f54bb7562 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -21,7 +21,6 @@
21#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
22#include <linux/ata_platform.h> 22#include <linux/ata_platform.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
27#include <mach/orion5x.h> 26#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
index 63ff10c3c464..525eb1286859 100644
--- a/arch/arm/mach-orion5x/mv2120-setup.c
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -7,7 +7,7 @@
7 * published by the Free Software Foundation; either version 2 of the 7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version. 8 * License, or (at your option) any later version.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/ata_platform.h> 21#include <linux/ata_platform.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <mach/orion5x.h> 24#include <mach/orion5x.h>
26#include "common.h" 25#include "common.h"
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 291d22bf44c9..50aae6f571b8 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -18,7 +18,6 @@
18#include <linux/ethtool.h> 18#include <linux/ethtool.h>
19#include <net/dsa.h> 19#include <net/dsa.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/gpio.h>
22#include <asm/leds.h> 21#include <asm/leds.h>
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
24#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index 3f02362e1632..35f106ac593a 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -19,7 +19,6 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <net/dsa.h> 20#include <net/dsa.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/gpio.h>
23#include <asm/leds.h> 22#include <asm/leds.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 27fd38e658bd..9bb2b8bafbfd 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -9,7 +9,7 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/leds.h> 23#include <asm/leds.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
index ad2eba9286ad..1d00df9ad464 100644
--- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -21,7 +21,6 @@
21#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <net/dsa.h> 22#include <net/dsa.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/leds.h> 24#include <asm/leds.h>
26#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
27#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index a34e4fac72b0..c9dd31d34866 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -8,7 +8,7 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <mach/orion5x.h> 25#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index c9831614e355..764307b8abfc 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -8,7 +8,7 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -23,7 +23,6 @@
23#include <linux/serial_reg.h> 23#include <linux/serial_reg.h>
24#include <linux/ata_platform.h> 24#include <linux/ata_platform.h>
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/gpio.h>
27#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
28#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
29#include <mach/orion5x.h> 28#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index cc33b2222bad..0572dd1c8aaa 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -11,7 +11,7 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -25,7 +25,6 @@
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/serial_reg.h> 26#include <linux/serial_reg.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/gpio.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30#include <asm/mach/pci.h> 29#include <asm/mach/pci.h>
31#include <mach/orion5x.h> 30#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 2653595f901c..cdad50bd4891 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -5,7 +5,7 @@
5 * License version 2. This program is licensed "as is" without any 5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8#include <linux/gpio.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
@@ -17,7 +17,6 @@
17#include <linux/ethtool.h> 17#include <linux/ethtool.h>
18#include <net/dsa.h> 18#include <net/dsa.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/gpio.h>
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
23#include <mach/orion5x.h> 22#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 251ef1543e53..8f10ffd77ec3 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -5,7 +5,7 @@
5 * License version 2. This program is licensed "as is" without any 5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8#include <linux/gpio.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/input.h> 20#include <linux/input.h>
21#include <net/dsa.h> 21#include <net/dsa.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <mach/orion5x.h> 25#include <mach/orion5x.h>
diff --git a/arch/arm/mach-pnx4008/gpio.c b/arch/arm/mach-pnx4008/gpio.c
index f219914f5b29..d3e71d3847b4 100644
--- a/arch/arm/mach-pnx4008/gpio.c
+++ b/arch/arm/mach-pnx4008/gpio.c
@@ -13,14 +13,13 @@
13 * is licensed "as is" without any warranty of any kind, whether express 13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied. 14 * or implied.
15 */ 15 */
16
17#include <linux/types.h> 16#include <linux/types.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/io.h> 19#include <linux/io.h>
21#include <mach/hardware.h> 20#include <mach/hardware.h>
22#include <mach/platform.h> 21#include <mach/platform.h>
23#include <mach/gpio.h> 22#include <mach/gpio-pnx4008.h>
24 23
25/* register definitions */ 24/* register definitions */
26#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE) 25#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE)
diff --git a/arch/arm/mach-pnx4008/include/mach/gpio.h b/arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
index 9591467eb9ec..41027dd7cf74 100644
--- a/arch/arm/mach-pnx4008/include/mach/gpio.h
+++ b/arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-pnx4008/include/mach/gpio.h 2 * arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
3 * 3 *
4 * PNX4008 GPIO driver - header file 4 * PNX4008 GPIO driver - header file
5 * 5 *
diff --git a/arch/arm/mach-pnx4008/serial.c b/arch/arm/mach-pnx4008/serial.c
index f40961e51914..374c138ac1ac 100644
--- a/arch/arm/mach-pnx4008/serial.c
+++ b/arch/arm/mach-pnx4008/serial.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/types.h> 13#include <linux/types.h>
15#include <linux/io.h> 14#include <linux/io.h>
@@ -19,8 +18,8 @@
19 18
20#include <linux/serial_core.h> 19#include <linux/serial_core.h>
21#include <linux/serial_reg.h> 20#include <linux/serial_reg.h>
22#include <mach/gpio.h>
23 21
22#include <mach/gpio-pnx4008.h>
24#include <mach/clock.h> 23#include <mach/clock.h>
25 24
26#define UART_3 0 25#define UART_3 0
diff --git a/arch/arm/mach-pxa/cm-x255.c b/arch/arm/mach-pxa/cm-x255.c
index 93f59f877fc6..be751470d37b 100644
--- a/arch/arm/mach-pxa/cm-x255.c
+++ b/arch/arm/mach-pxa/cm-x255.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/gpio.h>
15#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
16#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand-gpio.h> 16#include <linux/mtd/nand-gpio.h>
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index f5d91efc2965..5432ecb15def 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -16,6 +16,7 @@
16 * initialization stuff for PXA machines which can be overridden later if 16 * initialization stuff for PXA machines which can be overridden later if
17 * need be. 17 * need be.
18 */ 18 */
19#include <linux/gpio.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
@@ -26,7 +27,6 @@
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27 28
28#include <mach/reset.h> 29#include <mach/reset.h>
29#include <mach/gpio.h>
30#include <mach/smemc.h> 30#include <mach/smemc.h>
31#include <mach/pxa3xx-regs.h> 31#include <mach/pxa3xx-regs.h>
32 32
diff --git a/arch/arm/mach-pxa/include/mach/gpio-pxa.h b/arch/arm/mach-pxa/include/mach/gpio-pxa.h
new file mode 100644
index 000000000000..41b4c93a96c2
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/gpio-pxa.h
@@ -0,0 +1,133 @@
1/*
2 * Written by Philipp Zabel <philipp.zabel@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19#ifndef __MACH_PXA_GPIO_PXA_H
20#define __MACH_PXA_GPIO_PXA_H
21
22#include <mach/irqs.h>
23#include <mach/hardware.h>
24
25#define GPIO_REGS_VIRT io_p2v(0x40E00000)
26
27#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
28#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
29
30/* GPIO Pin Level Registers */
31#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
32#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
33#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
34#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
35
36/* GPIO Pin Direction Registers */
37#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
38#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
39#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
40#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
41
42/* GPIO Pin Output Set Registers */
43#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
44#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
45#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
46#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
47
48/* GPIO Pin Output Clear Registers */
49#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
50#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
51#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
52#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
53
54/* GPIO Rising Edge Detect Registers */
55#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
56#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
57#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
58#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
59
60/* GPIO Falling Edge Detect Registers */
61#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
62#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
63#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
64#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
65
66/* GPIO Edge Detect Status Registers */
67#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
68#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
69#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
70#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
71
72/* GPIO Alternate Function Select Registers */
73#define GAFR0_L GPIO_REG(0x0054)
74#define GAFR0_U GPIO_REG(0x0058)
75#define GAFR1_L GPIO_REG(0x005C)
76#define GAFR1_U GPIO_REG(0x0060)
77#define GAFR2_L GPIO_REG(0x0064)
78#define GAFR2_U GPIO_REG(0x0068)
79#define GAFR3_L GPIO_REG(0x006C)
80#define GAFR3_U GPIO_REG(0x0070)
81
82/* More handy macros. The argument is a literal GPIO number. */
83
84#define GPIO_bit(x) (1 << ((x) & 0x1f))
85
86#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
87#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
88#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
89#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
90#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
91#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
92#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
93#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
94
95
96#define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
97
98#define gpio_to_bank(gpio) ((gpio) >> 5)
99
100#ifdef CONFIG_CPU_PXA26x
101/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
102 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
103 */
104static inline int __gpio_is_inverted(unsigned gpio)
105{
106 return cpu_is_pxa25x() && gpio > 85;
107}
108#else
109static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
110#endif
111
112/*
113 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
114 * function of a GPIO, and GPDRx cannot be altered once configured. It
115 * is attributed as "occupied" here (I know this terminology isn't
116 * accurate, you are welcome to propose a better one :-)
117 */
118static inline int __gpio_is_occupied(unsigned gpio)
119{
120 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
121 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
122 int dir = GPDR(gpio) & GPIO_bit(gpio);
123
124 if (__gpio_is_inverted(gpio))
125 return af != 1 || dir == 0;
126 else
127 return af != 0 || dir != 0;
128 } else
129 return GPDR(gpio) & GPIO_bit(gpio);
130}
131
132#include <plat/gpio-pxa.h>
133#endif /* __MACH_PXA_GPIO_PXA_H */
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index c4639502efca..004cade7bb13 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -24,84 +24,10 @@
24#ifndef __ASM_ARCH_PXA_GPIO_H 24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H 25#define __ASM_ARCH_PXA_GPIO_H
26 26
27#include <mach/irqs.h>
28#include <mach/hardware.h>
29#include <asm-generic/gpio.h> 27#include <asm-generic/gpio.h>
28/* The defines for the driver are needed for the accelerated accessors */
29#include "gpio-pxa.h"
30 30
31#define GPIO_REGS_VIRT io_p2v(0x40E00000)
32
33#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
34#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
35
36/* GPIO Pin Level Registers */
37#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
38#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
39#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
40#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
41
42/* GPIO Pin Direction Registers */
43#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
44#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
45#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
46#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
47
48/* GPIO Pin Output Set Registers */
49#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
50#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
51#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
52#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
53
54/* GPIO Pin Output Clear Registers */
55#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
56#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
57#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
58#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
59
60/* GPIO Rising Edge Detect Registers */
61#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
62#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
63#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
64#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
65
66/* GPIO Falling Edge Detect Registers */
67#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
68#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
69#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
70#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
71
72/* GPIO Edge Detect Status Registers */
73#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
74#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
75#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
76#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
77
78/* GPIO Alternate Function Select Registers */
79#define GAFR0_L GPIO_REG(0x0054)
80#define GAFR0_U GPIO_REG(0x0058)
81#define GAFR1_L GPIO_REG(0x005C)
82#define GAFR1_U GPIO_REG(0x0060)
83#define GAFR2_L GPIO_REG(0x0064)
84#define GAFR2_U GPIO_REG(0x0068)
85#define GAFR3_L GPIO_REG(0x006C)
86#define GAFR3_U GPIO_REG(0x0070)
87
88/* More handy macros. The argument is a literal GPIO number. */
89
90#define GPIO_bit(x) (1 << ((x) & 0x1f))
91
92#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
93#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
94#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
95#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
96#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
97#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
98#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
99#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
100
101
102#define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
103
104#define gpio_to_bank(gpio) ((gpio) >> 5)
105#define gpio_to_irq(gpio) IRQ_GPIO(gpio) 31#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
106 32
107static inline int irq_to_gpio(unsigned int irq) 33static inline int irq_to_gpio(unsigned int irq)
@@ -118,37 +44,5 @@ static inline int irq_to_gpio(unsigned int irq)
118 return -1; 44 return -1;
119} 45}
120 46
121#ifdef CONFIG_CPU_PXA26x
122/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
123 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
124 */
125static inline int __gpio_is_inverted(unsigned gpio)
126{
127 return cpu_is_pxa25x() && gpio > 85;
128}
129#else
130static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
131#endif
132
133/*
134 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
135 * function of a GPIO, and GPDRx cannot be altered once configured. It
136 * is attributed as "occupied" here (I know this terminology isn't
137 * accurate, you are welcome to propose a better one :-)
138 */
139static inline int __gpio_is_occupied(unsigned gpio)
140{
141 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
142 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
143 int dir = GPDR(gpio) & GPIO_bit(gpio);
144
145 if (__gpio_is_inverted(gpio))
146 return af != 1 || dir == 0;
147 else
148 return af != 0 || dir != 0;
149 } else
150 return GPDR(gpio) & GPIO_bit(gpio);
151}
152
153#include <plat/gpio.h> 47#include <plat/gpio.h>
154#endif 48#endif
diff --git a/arch/arm/mach-pxa/include/mach/littleton.h b/arch/arm/mach-pxa/include/mach/littleton.h
index 2a5726c15e0e..b6238cbd8aea 100644
--- a/arch/arm/mach-pxa/include/mach/littleton.h
+++ b/arch/arm/mach-pxa/include/mach/littleton.h
@@ -1,7 +1,7 @@
1#ifndef __ASM_ARCH_LITTLETON_H 1#ifndef __ASM_ARCH_LITTLETON_H
2#define __ASM_ARCH_LITTLETON_H 2#define __ASM_ARCH_LITTLETON_H
3 3
4#include <mach/gpio.h> 4#include <mach/gpio-pxa.h>
5 5
6#define LITTLETON_ETH_PHYS 0x30000000 6#define LITTLETON_ETH_PHYS 0x30000000
7 7
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index b09e848eb6c6..d493a230addf 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -11,7 +11,6 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -21,7 +20,7 @@
21 20
22#include <mach/hardware.h> 21#include <mach/hardware.h>
23#include <mach/irqs.h> 22#include <mach/irqs.h>
24#include <mach/gpio.h> 23#include <mach/gpio-pxa.h>
25 24
26#include "generic.h" 25#include "generic.h"
27 26
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index c171d6ebee49..a3acd968b44d 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -12,7 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/syscore_ops.h> 18#include <linux/syscore_ops.h>
@@ -39,7 +39,6 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include <mach/pxa27x.h> 41#include <mach/pxa27x.h>
42#include <mach/gpio.h>
43#include <mach/lpd270.h> 42#include <mach/lpd270.h>
44#include <mach/audio.h> 43#include <mach/audio.h>
45#include <mach/pxafb.h> 44#include <mach/pxafb.h>
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index a8c696bfc132..c48ce6da9184 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -11,6 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -42,7 +43,6 @@
42#include <asm/hardware/sa1111.h> 43#include <asm/hardware/sa1111.h>
43 44
44#include <mach/pxa25x.h> 45#include <mach/pxa25x.h>
45#include <mach/gpio.h>
46#include <mach/audio.h> 46#include <mach/audio.h>
47#include <mach/lubbock.h> 47#include <mach/lubbock.h>
48#include <mach/udc.h> 48#include <mach/udc.h>
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 4622eb78ef25..6bc784bb3696 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -12,7 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/syscore_ops.h> 18#include <linux/syscore_ops.h>
@@ -43,7 +43,6 @@
43#include <asm/mach/flash.h> 43#include <asm/mach/flash.h>
44 44
45#include <mach/pxa27x.h> 45#include <mach/pxa27x.h>
46#include <mach/gpio.h>
47#include <mach/mainstone.h> 46#include <mach/mainstone.h>
48#include <mach/audio.h> 47#include <mach/audio.h>
49#include <mach/pxafb.h> 48#include <mach/pxafb.h>
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index b27544bcafcb..43a5f6861ca3 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -12,15 +12,15 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/syscore_ops.h> 19#include <linux/syscore_ops.h>
20 20
21#include <mach/gpio.h>
22#include <mach/pxa2xx-regs.h> 21#include <mach/pxa2xx-regs.h>
23#include <mach/mfp-pxa2xx.h> 22#include <mach/mfp-pxa2xx.h>
23#include <mach/gpio-pxa.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 6d5b7e062124..9a9c539f6c01 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -19,7 +19,7 @@
19 * it under the terms of the GNU General Public License version 2 as 19 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation. 20 * published by the Free Software Foundation.
21 */ 21 */
22 22#include <linux/gpio.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
@@ -28,7 +28,6 @@
28 28
29#include <media/soc_camera.h> 29#include <media/soc_camera.h>
30 30
31#include <asm/gpio.h>
32#include <mach/camera.h> 31#include <mach/camera.h>
33#include <asm/mach/map.h> 32#include <asm/mach/map.h>
34#include <mach/pxa27x.h> 33#include <mach/pxa27x.h>
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 9c434d21a271..8746e1090b6e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -16,6 +16,7 @@
16 * initialization stuff for PXA machines which can be overridden later if 16 * initialization stuff for PXA machines which can be overridden later if
17 * need be. 17 * need be.
18 */ 18 */
19#include <linux/gpio.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
@@ -23,12 +24,12 @@
23#include <linux/suspend.h> 24#include <linux/suspend.h>
24#include <linux/syscore_ops.h> 25#include <linux/syscore_ops.h>
25#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/gpio.h>
26 28
27#include <asm/mach/map.h> 29#include <asm/mach/map.h>
28#include <asm/suspend.h> 30#include <asm/suspend.h>
29#include <mach/hardware.h> 31#include <mach/hardware.h>
30#include <mach/irqs.h> 32#include <mach/irqs.h>
31#include <mach/gpio.h>
32#include <mach/pxa25x.h> 33#include <mach/pxa25x.h>
33#include <mach/reset.h> 34#include <mach/reset.h>
34#include <mach/pm.h> 35#include <mach/pm.h>
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 9d2400b5f503..2bb5cf8ba6ec 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -11,6 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -20,13 +21,13 @@
20#include <linux/io.h> 21#include <linux/io.h>
21#include <linux/irq.h> 22#include <linux/irq.h>
22#include <linux/i2c/pxa-i2c.h> 23#include <linux/i2c/pxa-i2c.h>
24#include <linux/gpio.h>
23 25
24#include <asm/mach/map.h> 26#include <asm/mach/map.h>
25#include <mach/hardware.h> 27#include <mach/hardware.h>
26#include <asm/irq.h> 28#include <asm/irq.h>
27#include <asm/suspend.h> 29#include <asm/suspend.h>
28#include <mach/irqs.h> 30#include <mach/irqs.h>
29#include <mach/gpio.h>
30#include <mach/pxa27x.h> 31#include <mach/pxa27x.h>
31#include <mach/reset.h> 32#include <mach/reset.h>
32#include <mach/ohci.h> 33#include <mach/ohci.h>
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index b5cd9e5aba31..f940a1345531 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -12,7 +12,6 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/init.h> 17#include <linux/init.h>
@@ -26,7 +25,7 @@
26#include <asm/mach/map.h> 25#include <asm/mach/map.h>
27#include <asm/suspend.h> 26#include <asm/suspend.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29#include <mach/gpio.h> 28#include <mach/gpio-pxa.h>
30#include <mach/pxa3xx-regs.h> 29#include <mach/pxa3xx-regs.h>
31#include <mach/reset.h> 30#include <mach/reset.h>
32#include <mach/ohci.h> 31#include <mach/ohci.h>
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
index 0ee166b61f81..51371b39d2a3 100644
--- a/arch/arm/mach-pxa/pxa95x.c
+++ b/arch/arm/mach-pxa/pxa95x.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -21,7 +20,7 @@
21#include <linux/syscore_ops.h> 20#include <linux/syscore_ops.h>
22 21
23#include <mach/hardware.h> 22#include <mach/hardware.h>
24#include <mach/gpio.h> 23#include <mach/gpio-pxa.h>
25#include <mach/pxa3xx-regs.h> 24#include <mach/pxa3xx-regs.h>
26#include <mach/pxa930.h> 25#include <mach/pxa930.h>
27#include <mach/reset.h> 26#include <mach/reset.h>
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index ebd6379c4969..eb6a10d85b03 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -9,12 +9,13 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * publishhed by the Free Software Foundation. 10 * publishhed by the Free Software Foundation.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/i2c/pxa-i2c.h> 16#include <linux/i2c/pxa-i2c.h>
17#include <linux/mfd/88pm860x.h> 17#include <linux/mfd/88pm860x.h>
18#include <linux/gpio.h>
18 19
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
@@ -23,7 +24,6 @@
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <mach/mfp.h> 25#include <mach/mfp.h>
25#include <mach/mfp-pxa930.h> 26#include <mach/mfp-pxa930.h>
26#include <mach/gpio.h>
27 27
28#include "generic.h" 28#include "generic.h"
29 29
diff --git a/arch/arm/mach-realview/include/mach/gpio.h b/arch/arm/mach-realview/include/mach/gpio.h
index 94ff27678a46..40a8c178f10d 100644
--- a/arch/arm/mach-realview/include/mach/gpio.h
+++ b/arch/arm/mach-realview/include/mach/gpio.h
@@ -1,6 +1 @@
1#include <asm-generic/gpio.h> /* empty */
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h
index f7f6b07df30e..6fac70f3484e 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
@@ -11,11 +11,6 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14#define gpio_get_value __gpio_get_value
15#define gpio_set_value __gpio_set_value
16#define gpio_cansleep __gpio_cansleep
17#define gpio_to_irq __gpio_to_irq
18
19/* some boards require extra gpio capacity to support external 14/* some boards require extra gpio capacity to support external
20 * devices that need GPIO. 15 * devices that need GPIO.
21 */ 16 */
@@ -28,7 +23,6 @@
28#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) 23#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)
29#endif 24#endif
30 25
31#include <asm-generic/gpio.h>
32#include <mach/gpio-nrs.h> 26#include <mach/gpio-nrs.h>
33#include <mach/gpio-fns.h> 27#include <mach/gpio-fns.h>
34 28
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index 97e42bfce81e..fc897d3a056c 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -14,7 +14,7 @@
14#ifndef __ASM_ARCH_H1940_LATCH_H 14#ifndef __ASM_ARCH_H1940_LATCH_H
15#define __ASM_ARCH_H1940_LATCH_H 15#define __ASM_ARCH_H1940_LATCH_H
16 16
17#include <mach/gpio.h> 17#include <asm/gpio.h>
18 18
19#define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x)) 19#define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x))
20 20
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio.h b/arch/arm/mach-s3c64xx/include/mach/gpio.h
index 0d46e994048a..6e34c2f6e670 100644
--- a/arch/arm/mach-s3c64xx/include/mach/gpio.h
+++ b/arch/arm/mach-s3c64xx/include/mach/gpio.h
@@ -12,11 +12,6 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13*/ 13*/
14 14
15#define gpio_get_value __gpio_get_value
16#define gpio_set_value __gpio_set_value
17#define gpio_cansleep __gpio_cansleep
18#define gpio_to_irq __gpio_to_irq
19
20/* GPIO bank sizes */ 15/* GPIO bank sizes */
21#define S3C64XX_GPIO_A_NR (8) 16#define S3C64XX_GPIO_A_NR (8)
22#define S3C64XX_GPIO_B_NR (7) 17#define S3C64XX_GPIO_B_NR (7)
@@ -96,5 +91,3 @@ enum s3c_gpio_number {
96#define BOARD_NR_GPIOS 16 91#define BOARD_NR_GPIOS 16
97 92
98#define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS) 93#define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS)
99
100#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h
index adb5f298ead8..06cd3c9b16ac 100644
--- a/arch/arm/mach-s5p64x0/include/mach/gpio.h
+++ b/arch/arm/mach-s5p64x0/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#ifndef __ASM_ARCH_GPIO_H 13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 14#define __ASM_ARCH_GPIO_H __FILE__
15 15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* GPIO bank sizes */ 16/* GPIO bank sizes */
22 17
23#define S5P6440_GPIO_A_NR (6) 18#define S5P6440_GPIO_A_NR (6)
@@ -134,6 +129,4 @@ enum s5p6450_gpio_number {
134 129
135#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA) 130#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
136 131
137#include <asm-generic/gpio.h>
138
139#endif /* __ASM_ARCH_GPIO_H */ 132#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
index 29a8a12d9b4f..5e1a924b595f 100644
--- a/arch/arm/mach-s5pc100/include/mach/gpio.h
+++ b/arch/arm/mach-s5pc100/include/mach/gpio.h
@@ -15,11 +15,6 @@
15#ifndef __ASM_ARCH_GPIO_H 15#ifndef __ASM_ARCH_GPIO_H
16#define __ASM_ARCH_GPIO_H __FILE__ 16#define __ASM_ARCH_GPIO_H __FILE__
17 17
18#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value
20#define gpio_cansleep __gpio_cansleep
21#define gpio_to_irq __gpio_to_irq
22
23/* GPIO bank sizes */ 18/* GPIO bank sizes */
24#define S5PC100_GPIO_A0_NR (8) 19#define S5PC100_GPIO_A0_NR (8)
25#define S5PC100_GPIO_A1_NR (5) 20#define S5PC100_GPIO_A1_NR (5)
@@ -146,6 +141,4 @@ enum s5p_gpio_number {
146/* define the number of gpios we need to the one after the MP04() range */ 141/* define the number of gpios we need to the one after the MP04() range */
147#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1) 142#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
148 143
149#include <asm-generic/gpio.h>
150
151#endif /* __ASM_ARCH_GPIO_H */ 144#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio.h
index a5a1e331f8ed..6c8b903c02e4 100644
--- a/arch/arm/mach-s5pv210/include/mach/gpio.h
+++ b/arch/arm/mach-s5pv210/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#ifndef __ASM_ARCH_GPIO_H 13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 14#define __ASM_ARCH_GPIO_H __FILE__
15 15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* Practically, GPIO banks up to MP03 are the configurable gpio banks */ 16/* Practically, GPIO banks up to MP03 are the configurable gpio banks */
22 17
23/* GPIO bank sizes */ 18/* GPIO bank sizes */
@@ -142,6 +137,4 @@ enum s5p_gpio_number {
142#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \ 137#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \
143 CONFIG_SAMSUNG_GPIO_EXTRA + 1) 138 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
144 139
145#include <asm-generic/gpio.h>
146
147#endif /* __ASM_ARCH_GPIO_H */ 140#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 41252d22e659..73a5c6431792 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o 6obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index e21f3470eece..5fa5ae1f39e1 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -9,6 +9,7 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#include <linux/gpio.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/init.h> 15#include <linux/init.h>
@@ -24,7 +25,6 @@
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
26#include <asm/irq.h> 27#include <asm/irq.h>
27#include <asm/gpio.h>
28 28
29#include "generic.h" 29#include "generic.h"
30 30
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
index 7befc104e9a9..703631887c94 100644
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -28,6 +28,8 @@
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm-generic/gpio.h> 29#include <asm-generic/gpio.h>
30 30
31#define __ARM_GPIOLIB_COMPLEX
32
31static inline int gpio_get_value(unsigned gpio) 33static inline int gpio_get_value(unsigned gpio)
32{ 34{
33 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) 35 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
@@ -51,7 +53,5 @@ static inline void gpio_set_value(unsigned gpio, int value)
51 53
52#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \ 54#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
53 (IRQ_GPIO11 - 11 + gpio)) 55 (IRQ_GPIO11 - 11 + gpio))
54#define irq_to_gpio(irq) ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
55 (irq - IRQ_GPIO11 + 11))
56 56
57#endif 57#endif
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index 2b1bb9e43dda..7bf0890e16ba 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -18,31 +18,15 @@
18 18
19#ifdef CONFIG_GPIOLIB 19#ifdef CONFIG_GPIOLIB
20 20
21static inline int gpio_get_value(unsigned gpio)
22{
23 return __gpio_get_value(gpio);
24}
25
26static inline void gpio_set_value(unsigned gpio, int value)
27{
28 __gpio_set_value(gpio, value);
29}
30
31static inline int gpio_cansleep(unsigned gpio)
32{
33 return __gpio_cansleep(gpio);
34}
35
36static inline int gpio_to_irq(unsigned gpio)
37{
38 return __gpio_to_irq(gpio);
39}
40
41static inline int irq_to_gpio(unsigned int irq) 21static inline int irq_to_gpio(unsigned int irq)
42{ 22{
43 return -ENOSYS; 23 return -ENOSYS;
44} 24}
45 25
26#else
27
28#define __ARM_GPIOLIB_COMPLEX
29
46#endif /* CONFIG_GPIOLIB */ 30#endif /* CONFIG_GPIOLIB */
47 31
48#endif /* __ASM_ARCH_GPIO_H */ 32#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c
index 9c27b95b8d86..6db7d699ef1c 100644
--- a/arch/arm/mach-tegra/board-harmony-pcie.c
+++ b/arch/arm/mach-tegra/board-harmony-pcie.c
@@ -24,12 +24,10 @@
24 24
25#include <mach/pinmux.h> 25#include <mach/pinmux.h>
26#include "board.h" 26#include "board.h"
27#include "board-harmony.h"
27 28
28#ifdef CONFIG_TEGRA_PCI 29#ifdef CONFIG_TEGRA_PCI
29 30
30/* GPIO 3 of the PMIC */
31#define EN_VDD_1V05_GPIO (TEGRA_NR_GPIOS + 2)
32
33static int __init harmony_pcie_init(void) 31static int __init harmony_pcie_init(void)
34{ 32{
35 struct regulator *regulator = NULL; 33 struct regulator *regulator = NULL;
@@ -38,11 +36,11 @@ static int __init harmony_pcie_init(void)
38 if (!machine_is_harmony()) 36 if (!machine_is_harmony())
39 return 0; 37 return 0;
40 38
41 err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05"); 39 err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
42 if (err) 40 if (err)
43 return err; 41 return err;
44 42
45 gpio_direction_output(EN_VDD_1V05_GPIO, 1); 43 gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1);
46 44
47 regulator = regulator_get(NULL, "pex_clk"); 45 regulator = regulator_get(NULL, "pex_clk");
48 if (IS_ERR_OR_NULL(regulator)) 46 if (IS_ERR_OR_NULL(regulator))
@@ -68,7 +66,7 @@ err_pcie:
68 regulator_disable(regulator); 66 regulator_disable(regulator);
69 regulator_put(regulator); 67 regulator_put(regulator);
70err_reg: 68err_reg:
71 gpio_free(EN_VDD_1V05_GPIO); 69 gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
72 70
73 return err; 71 return err;
74} 72}
diff --git a/arch/arm/mach-tegra/board-harmony.h b/arch/arm/mach-tegra/board-harmony.h
index d85142edaf6b..139d96c93843 100644
--- a/arch/arm/mach-tegra/board-harmony.h
+++ b/arch/arm/mach-tegra/board-harmony.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_HARMONY_H 17#ifndef _MACH_TEGRA_BOARD_HARMONY_H
18#define _MACH_TEGRA_BOARD_HARMONY_H 18#define _MACH_TEGRA_BOARD_HARMONY_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define HARMONY_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_)) 22#define HARMONY_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_))
21#define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_)) 23#define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_))
22 24
@@ -31,6 +33,7 @@
31#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2 33#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2
32#define TEGRA_GPIO_INT_MIC_EN TEGRA_GPIO_PX0 34#define TEGRA_GPIO_INT_MIC_EN TEGRA_GPIO_PX0
33#define TEGRA_GPIO_EXT_MIC_EN TEGRA_GPIO_PX1 35#define TEGRA_GPIO_EXT_MIC_EN TEGRA_GPIO_PX1
36#define TEGRA_GPIO_EN_VDD_1V05_GPIO HARMONY_GPIO_TPS6586X(2)
34 37
35void harmony_pinmux_init(void); 38void harmony_pinmux_init(void);
36int harmony_regulator_init(void); 39int harmony_regulator_init(void);
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index d161590c99c2..ac809b6e3def 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -26,6 +26,7 @@
26#include <linux/pda_power.h> 26#include <linux/pda_power.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/gpio.h>
29#include <linux/rfkill-gpio.h> 30#include <linux/rfkill-gpio.h>
30 31
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -36,7 +37,6 @@
36#include <mach/iomap.h> 37#include <mach/iomap.h>
37#include <mach/irqs.h> 38#include <mach/irqs.h>
38#include <mach/sdhci.h> 39#include <mach/sdhci.h>
39#include <mach/gpio.h>
40 40
41#include "board.h" 41#include "board.h"
42#include "board-paz00.h" 42#include "board-paz00.h"
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
index 86057c3fb9a0..8aff06eb58c3 100644
--- a/arch/arm/mach-tegra/board-paz00.h
+++ b/arch/arm/mach-tegra/board-paz00.h
@@ -17,18 +17,20 @@
17#ifndef _MACH_TEGRA_BOARD_PAZ00_H 17#ifndef _MACH_TEGRA_BOARD_PAZ00_H
18#define _MACH_TEGRA_BOARD_PAZ00_H 18#define _MACH_TEGRA_BOARD_PAZ00_H
19 19
20#include <mach/gpio-tegra.h>
21
20/* SDCARD */ 22/* SDCARD */
21#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5 23#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5
22#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1 24#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1
23#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3 25#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3
24 26
25/* ULPI */ 27/* ULPI */
26#define TEGRA_ULPI_RST TEGRA_GPIO_PV0 28#define TEGRA_ULPI_RST TEGRA_GPIO_PV0
27 29
28/* WIFI */ 30/* WIFI */
29#define TEGRA_WIFI_PWRN TEGRA_GPIO_PK5 31#define TEGRA_WIFI_PWRN TEGRA_GPIO_PK5
30#define TEGRA_WIFI_RST TEGRA_GPIO_PD1 32#define TEGRA_WIFI_RST TEGRA_GPIO_PD1
31#define TEGRA_WIFI_LED TEGRA_GPIO_PD0 33#define TEGRA_WIFI_LED TEGRA_GPIO_PD0
32 34
33void paz00_pinmux_init(void); 35void paz00_pinmux_init(void);
34 36
diff --git a/arch/arm/mach-tegra/board-seaboard.h b/arch/arm/mach-tegra/board-seaboard.h
index d06c3342e2c4..4c45d4ca3c49 100644
--- a/arch/arm/mach-tegra/board-seaboard.h
+++ b/arch/arm/mach-tegra/board-seaboard.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_SEABOARD_H 17#ifndef _MACH_TEGRA_BOARD_SEABOARD_H
18#define _MACH_TEGRA_BOARD_SEABOARD_H 18#define _MACH_TEGRA_BOARD_SEABOARD_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define SEABOARD_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_)) 22#define SEABOARD_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_))
21#define SEABOARD_GPIO_WM8903(_x_) (SEABOARD_GPIO_TPS6586X(4) + (_x_)) 23#define SEABOARD_GPIO_WM8903(_x_) (SEABOARD_GPIO_TPS6586X(4) + (_x_))
22 24
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c
index 47c596cdbf32..bcb1916e68b9 100644
--- a/arch/arm/mach-tegra/board-trimslice-pinmux.c
+++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c
@@ -13,12 +13,11 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20#include <mach/pinmux.h> 20#include <mach/pinmux.h>
21#include <mach/gpio.h>
22 21
23#include "gpio-names.h" 22#include "gpio-names.h"
24#include "board-trimslice.h" 23#include "board-trimslice.h"
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index 91875b975563..c3aff9fdffd3 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -32,7 +32,6 @@
32 32
33#include <mach/iomap.h> 33#include <mach/iomap.h>
34#include <mach/sdhci.h> 34#include <mach/sdhci.h>
35#include <mach/gpio.h>
36 35
37#include "board.h" 36#include "board.h"
38#include "clock.h" 37#include "clock.h"
diff --git a/arch/arm/mach-tegra/board-trimslice.h b/arch/arm/mach-tegra/board-trimslice.h
index 7a7dee86b4da..50f128d87779 100644
--- a/arch/arm/mach-tegra/board-trimslice.h
+++ b/arch/arm/mach-tegra/board-trimslice.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H 17#ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H
18#define _MACH_TEGRA_BOARD_TRIMSLICE_H 18#define _MACH_TEGRA_BOARD_TRIMSLICE_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define TRIMSLICE_GPIO_SD4_CD TEGRA_GPIO_PP1 /* mmc4 cd */ 22#define TRIMSLICE_GPIO_SD4_CD TEGRA_GPIO_PP1 /* mmc4 cd */
21#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */ 23#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */
22 24
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
new file mode 100644
index 000000000000..87d37fdf5084
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-tegra/include/mach/gpio.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Erik Gilling <konkers@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef __MACH_TEGRA_GPIO_TEGRA_H
21#define __MACH_TEGRA_GPIO_TEGRA_H
22
23#include <linux/types.h>
24#include <mach/irqs.h>
25
26#define TEGRA_NR_GPIOS INT_GPIO_NR
27
28#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
29
30struct tegra_gpio_table {
31 int gpio; /* GPIO number */
32 bool enable; /* Enable for GPIO at init? */
33};
34
35void tegra_gpio_config(struct tegra_gpio_table *table, int num);
36void tegra_gpio_enable(int gpio);
37void tegra_gpio_disable(int gpio);
38
39#endif
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index 196f114dc241..e69de29bb2d1 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -1,60 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/gpio.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Erik Gilling <konkers@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef __MACH_TEGRA_GPIO_H
21#define __MACH_TEGRA_GPIO_H
22
23#include <linux/init.h>
24#include <mach/irqs.h>
25
26#define TEGRA_NR_GPIOS INT_GPIO_NR
27
28#include <asm-generic/gpio.h>
29
30#define gpio_get_value __gpio_get_value
31#define gpio_set_value __gpio_set_value
32#define gpio_cansleep __gpio_cansleep
33
34#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
35#define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE)
36
37static inline int gpio_to_irq(unsigned int gpio)
38{
39 if (gpio < TEGRA_NR_GPIOS)
40 return INT_GPIO_BASE + gpio;
41 return -EINVAL;
42}
43
44static inline int irq_to_gpio(unsigned int irq)
45{
46 if ((irq >= INT_GPIO_BASE) && (irq < INT_GPIO_BASE + INT_GPIO_NR))
47 return irq - INT_GPIO_BASE;
48 return -EINVAL;
49}
50
51struct tegra_gpio_table {
52 int gpio; /* GPIO number */
53 bool enable; /* Enable for GPIO at init? */
54};
55
56void tegra_gpio_config(struct tegra_gpio_table *table, int num);
57void tegra_gpio_enable(int gpio);
58void tegra_gpio_disable(int gpio);
59
60#endif
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index 88081bb3ec52..37576a721aeb 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -28,6 +28,7 @@
28#include <linux/usb/otg.h> 28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h> 29#include <linux/usb/ulpi.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <mach/gpio-tegra.h>
31#include <mach/usb_phy.h> 32#include <mach/usb_phy.h>
32#include <mach/iomap.h> 33#include <mach/iomap.h>
33 34
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index 32a7b0f7e9f7..7b5c229dc7ea 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -6,6 +6,7 @@ comment "ST-Ericsson Mobile Platform Products"
6 6
7config MACH_U300 7config MACH_U300
8 bool "U300" 8 bool "U300"
9 select GPIO_U300
9 10
10comment "ST-Ericsson U300/U330/U335/U365 Feature Selections" 11comment "ST-Ericsson U300/U330/U335/U365 Feature Selections"
11 12
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 399c89f14dfb..fd435f44098b 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -37,6 +37,7 @@
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/syscon.h> 38#include <mach/syscon.h>
39#include <mach/dma_channels.h> 39#include <mach/dma_channels.h>
40#include <mach/gpio-u300.h>
40 41
41#include "clock.h" 42#include "clock.h"
42#include "mmc.h" 43#include "mmc.h"
@@ -239,7 +240,7 @@ static struct resource gpio_resources[] = {
239 .end = IRQ_U300_GPIO_PORT2, 240 .end = IRQ_U300_GPIO_PORT2,
240 .flags = IORESOURCE_IRQ, 241 .flags = IORESOURCE_IRQ,
241 }, 242 },
242#ifdef U300_COH901571_3 243#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
243 { 244 {
244 .name = "gpio3", 245 .name = "gpio3",
245 .start = IRQ_U300_GPIO_PORT3, 246 .start = IRQ_U300_GPIO_PORT3,
@@ -252,6 +253,7 @@ static struct resource gpio_resources[] = {
252 .end = IRQ_U300_GPIO_PORT4, 253 .end = IRQ_U300_GPIO_PORT4,
253 .flags = IORESOURCE_IRQ, 254 .flags = IORESOURCE_IRQ,
254 }, 255 },
256#endif
255#ifdef CONFIG_MACH_U300_BS335 257#ifdef CONFIG_MACH_U300_BS335
256 { 258 {
257 .name = "gpio5", 259 .name = "gpio5",
@@ -266,7 +268,6 @@ static struct resource gpio_resources[] = {
266 .flags = IORESOURCE_IRQ, 268 .flags = IORESOURCE_IRQ,
267 }, 269 },
268#endif /* CONFIG_MACH_U300_BS335 */ 270#endif /* CONFIG_MACH_U300_BS335 */
269#endif /* U300_COH901571_3 */
270}; 271};
271 272
272static struct resource keypad_resources[] = { 273static struct resource keypad_resources[] = {
@@ -1556,11 +1557,35 @@ static struct platform_device i2c1_device = {
1556 .resource = i2c1_resources, 1557 .resource = i2c1_resources,
1557}; 1558};
1558 1559
1560/*
1561 * The different variants have a few different versions of the
1562 * GPIO block, with different number of ports.
1563 */
1564static struct u300_gpio_platform u300_gpio_plat = {
1565#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
1566 .variant = U300_GPIO_COH901335,
1567 .ports = 3,
1568#endif
1569#ifdef CONFIG_MACH_U300_BS335
1570 .variant = U300_GPIO_COH901571_3_BS335,
1571 .ports = 7,
1572#endif
1573#ifdef CONFIG_MACH_U300_BS365
1574 .variant = U300_GPIO_COH901571_3_BS365,
1575 .ports = 5,
1576#endif
1577 .gpio_base = 0,
1578 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1579};
1580
1559static struct platform_device gpio_device = { 1581static struct platform_device gpio_device = {
1560 .name = "u300-gpio", 1582 .name = "u300-gpio",
1561 .id = -1, 1583 .id = -1,
1562 .num_resources = ARRAY_SIZE(gpio_resources), 1584 .num_resources = ARRAY_SIZE(gpio_resources),
1563 .resource = gpio_resources, 1585 .resource = gpio_resources,
1586 .dev = {
1587 .platform_data = &u300_gpio_plat,
1588 },
1564}; 1589};
1565 1590
1566static struct platform_device keypad_device = { 1591static struct platform_device keypad_device = {
@@ -1666,7 +1691,7 @@ void __init u300_init_irq(void)
1666 BUG_ON(IS_ERR(clk)); 1691 BUG_ON(IS_ERR(clk));
1667 clk_enable(clk); 1692 clk_enable(clk);
1668 1693
1669 for (i = 0; i < NR_IRQS; i++) 1694 for (i = 0; i < U300_VIC_IRQS_END; i++)
1670 set_bit(i, (unsigned long *) &mask[0]); 1695 set_bit(i, (unsigned long *) &mask[0]);
1671 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]); 1696 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
1672 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]); 1697 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
new file mode 100644
index 000000000000..0c2b2021951a
--- /dev/null
+++ b/arch/arm/mach-u300/include/mach/gpio-u300.h
@@ -0,0 +1,150 @@
1/*
2 * Copyright (C) 2007-2011 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * GPIO block resgister definitions and inline macros for
5 * U300 GPIO COH 901 335 or COH 901 571/3
6 * Author: Linus Walleij <linus.walleij@stericsson.com>
7 */
8
9#ifndef __MACH_U300_GPIO_U300_H
10#define __MACH_U300_GPIO_U300_H
11
12/*
13 * Individual pin assignments for the B26/S26. Notice that the
14 * actual usage of these pins depends on the PAD MUX settings, that
15 * is why the same number can potentially appear several times.
16 * In the reference design each pin is only used for one purpose.
17 * These were determined by inspecting the B26/S26 schematic:
18 * 2/1911-ROA 128 1603
19 */
20#ifdef CONFIG_MACH_U300_BS2X
21#define U300_GPIO_PIN_UART_RX 0
22#define U300_GPIO_PIN_UART_TX 1
23#define U300_GPIO_PIN_GPIO02 2 /* Unrouted */
24#define U300_GPIO_PIN_GPIO03 3 /* Unrouted */
25#define U300_GPIO_PIN_CAM_SLEEP 4
26#define U300_GPIO_PIN_CAM_REG_EN 5
27#define U300_GPIO_PIN_GPIO06 6 /* Unrouted */
28#define U300_GPIO_PIN_GPIO07 7 /* Unrouted */
29
30#define U300_GPIO_PIN_GPIO08 8 /* Service point SP2321 */
31#define U300_GPIO_PIN_GPIO09 9 /* Service point SP2322 */
32#define U300_GPIO_PIN_PHFSENSE 10 /* Headphone jack sensing */
33#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
34#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
35#define U300_GPIO_PIN_FLIPSENSE 13 /* Mechanical flip sensing */
36#define U300_GPIO_PIN_GPIO14 14 /* DSP JTAG Port RTCK */
37#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
38
39#define U300_GPIO_PIN_GPIO16 16 /* Unrouted */
40#define U300_GPIO_PIN_GPIO17 17 /* Unrouted */
41#define U300_GPIO_PIN_GPIO18 18 /* Unrouted */
42#define U300_GPIO_PIN_GPIO19 19 /* Unrouted */
43#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
44#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
45#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
46#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
47#endif
48
49/*
50 * Individual pin assignments for the B330/S330 and B365/S365.
51 * Notice that the actual usage of these pins depends on the
52 * PAD MUX settings, that is why the same number can potentially
53 * appear several times. In the reference design each pin is only
54 * used for one purpose. These were determined by inspecting the
55 * S365 schematic.
56 */
57#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
58 defined(CONFIG_MACH_U300_BS335)
59#define U300_GPIO_PIN_UART_RX 0
60#define U300_GPIO_PIN_UART_TX 1
61#define U300_GPIO_PIN_UART_CTS 2
62#define U300_GPIO_PIN_UART_RTS 3
63#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
64#define U300_GPIO_PIN_GPIO05 5 /* Unrouted */
65#define U300_GPIO_PIN_MS_CD 6 /* Memory Stick Card insertion */
66#define U300_GPIO_PIN_GPIO07 7 /* Test point TP2430 */
67
68#define U300_GPIO_PIN_GPIO08 8 /* Test point TP2437 */
69#define U300_GPIO_PIN_GPIO09 9 /* Test point TP2431 */
70#define U300_GPIO_PIN_GPIO10 10 /* Test point TP2432 */
71#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
72#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
73#define U300_GPIO_PIN_CAM_SUB_STANDBY 13 /* Camera SUB standby */
74#define U300_GPIO_PIN_GPIO14 14 /* Test point TP2436 */
75#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
76
77#define U300_GPIO_PIN_GPIO16 16 /* Test point TP2438 */
78#define U300_GPIO_PIN_PHFSENSE 17 /* Headphone jack sensing */
79#define U300_GPIO_PIN_GPIO18 18 /* Test point TP2439 */
80#define U300_GPIO_PIN_GPIO19 19 /* Routed somewhere */
81#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
82#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
83#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
84#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
85
86#define U300_GPIO_PIN_GPIO24 24 /* Unrouted */
87#define U300_GPIO_PIN_GPIO25 25 /* Unrouted */
88#define U300_GPIO_PIN_GPIO26 26 /* Unrouted */
89#define U300_GPIO_PIN_GPIO27 27 /* Unrouted */
90#define U300_GPIO_PIN_GPIO28 28 /* Unrouted */
91#define U300_GPIO_PIN_GPIO29 29 /* Unrouted */
92#define U300_GPIO_PIN_GPIO30 30 /* Unrouted */
93#define U300_GPIO_PIN_GPIO31 31 /* Unrouted */
94
95#define U300_GPIO_PIN_GPIO32 32 /* Unrouted */
96#define U300_GPIO_PIN_GPIO33 33 /* Unrouted */
97#define U300_GPIO_PIN_GPIO34 34 /* Unrouted */
98#define U300_GPIO_PIN_GPIO35 35 /* Unrouted */
99#define U300_GPIO_PIN_GPIO36 36 /* Unrouted */
100#define U300_GPIO_PIN_GPIO37 37 /* Unrouted */
101#define U300_GPIO_PIN_GPIO38 38 /* Unrouted */
102#define U300_GPIO_PIN_GPIO39 39 /* Unrouted */
103
104#ifdef CONFIG_MACH_U300_BS335
105
106#define U300_GPIO_PIN_GPIO40 40 /* Unrouted */
107#define U300_GPIO_PIN_GPIO41 41 /* Unrouted */
108#define U300_GPIO_PIN_GPIO42 42 /* Unrouted */
109#define U300_GPIO_PIN_GPIO43 43 /* Unrouted */
110#define U300_GPIO_PIN_GPIO44 44 /* Unrouted */
111#define U300_GPIO_PIN_GPIO45 45 /* Unrouted */
112#define U300_GPIO_PIN_GPIO46 46 /* Unrouted */
113#define U300_GPIO_PIN_GPIO47 47 /* Unrouted */
114
115#define U300_GPIO_PIN_GPIO48 48 /* Unrouted */
116#define U300_GPIO_PIN_GPIO49 49 /* Unrouted */
117#define U300_GPIO_PIN_GPIO50 50 /* Unrouted */
118#define U300_GPIO_PIN_GPIO51 51 /* Unrouted */
119#define U300_GPIO_PIN_GPIO52 52 /* Unrouted */
120#define U300_GPIO_PIN_GPIO53 53 /* Unrouted */
121#define U300_GPIO_PIN_GPIO54 54 /* Unrouted */
122#define U300_GPIO_PIN_GPIO55 55 /* Unrouted */
123#endif
124
125#endif
126
127/**
128 * enum u300_gpio_variant - the type of U300 GPIO employed
129 */
130enum u300_gpio_variant {
131 U300_GPIO_COH901335,
132 U300_GPIO_COH901571_3_BS335,
133 U300_GPIO_COH901571_3_BS365,
134};
135
136/**
137 * struct u300_gpio_platform - U300 GPIO platform data
138 * @variant: IP block variant
139 * @ports: number of GPIO block ports
140 * @gpio_base: first GPIO number for this block (use a free range)
141 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
142 */
143struct u300_gpio_platform {
144 enum u300_gpio_variant variant;
145 u8 ports;
146 int gpio_base;
147 int gpio_irq_base;
148};
149
150#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/arch/arm/mach-u300/include/mach/gpio.h b/arch/arm/mach-u300/include/mach/gpio.h
index d5a71abcbaea..e69de29bb2d1 100644
--- a/arch/arm/mach-u300/include/mach/gpio.h
+++ b/arch/arm/mach-u300/include/mach/gpio.h
@@ -1,294 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/gpio.h
4 *
5 *
6 * Copyright (C) 2007-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * GPIO block resgister definitions and inline macros for
9 * U300 GPIO COH 901 335 or COH 901 571/3
10 * Author: Linus Walleij <linus.walleij@stericsson.com>
11 */
12
13#ifndef __MACH_U300_GPIO_H
14#define __MACH_U300_GPIO_H
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <mach/hardware.h>
19#include <asm/irq.h>
20
21/* Switch type depending on platform/chip variant */
22#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
23#define U300_COH901335
24#endif
25#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
26#define U300_COH901571_3
27#endif
28
29/* Get base address for regs here */
30#include "u300-regs.h"
31/* IRQ numbers */
32#include "irqs.h"
33
34/*
35 * This is the GPIO block definitions. GPIO (General Purpose I/O) can be
36 * used for anything, and often is. The event/enable etc figures are for
37 * the lowermost pin (pin 0 on each port), shift this left to match your
38 * pin if you're gonna use these values.
39 */
40#ifdef U300_COH901335
41#define U300_GPIO_PORTX_SPACING (0x1C)
42/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
43#define U300_GPIO_PXPDIR (0x00)
44#define U300_GPIO_PXPDOR (0x00)
45/* Port X Pin Config Register 32bit (R/W) */
46#define U300_GPIO_PXPCR (0x04)
47#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL)
48#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL)
49#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL)
50#define U300_GPIO_PXPCR_PIN_MODE_INPUT (0x00000000UL)
51#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL)
52#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL)
53#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL)
54/* Port X Interrupt Event Register 32bit (R/W) */
55#define U300_GPIO_PXIEV (0x08)
56#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK (0x000000FFUL)
57#define U300_GPIO_PXIEV_IRQ_EVENT (0x00000001UL)
58/* Port X Interrupt Enable Register 32bit (R/W) */
59#define U300_GPIO_PXIEN (0x0C)
60#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK (0x000000FFUL)
61#define U300_GPIO_PXIEN_IRQ_ENABLE (0x00000001UL)
62/* Port X Interrupt Force Register 32bit (R/W) */
63#define U300_GPIO_PXIFR (0x10)
64#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK (0x000000FFUL)
65#define U300_GPIO_PXIFR_IRQ_FORCE (0x00000001UL)
66/* Port X Interrupt Config Register 32bit (R/W) */
67#define U300_GPIO_PXICR (0x14)
68#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL)
69#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL)
70#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL)
71#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL)
72/* Port X Pull-up Enable Register 32bit (R/W) */
73#define U300_GPIO_PXPER (0x18)
74#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
75#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
76/* Control Register 32bit (R/W) */
77#define U300_GPIO_CR (0x54)
78#define U300_GPIO_CR_BLOCK_CLOCK_ENABLE (0x00000001UL)
79/* three ports of 8 bits each = GPIO pins 0..23 */
80#define U300_GPIO_NUM_PORTS 3
81#define U300_GPIO_PINS_PER_PORT 8
82#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
83#endif
84
85#ifdef U300_COH901571_3
86/*
87 * Control Register 32bit (R/W)
88 * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
89 * gives the number of GPIO pins.
90 * bit 8-2 (mask 0x000001FC) contains the core version ID.
91 */
92#define U300_GPIO_CR (0x00)
93#define U300_GPIO_CR_SYNC_SEL_ENABLE (0x00000002UL)
94#define U300_GPIO_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL)
95#define U300_GPIO_PORTX_SPACING (0x30)
96/* Port X Pin Data INPUT Register 32bit (R/W) */
97#define U300_GPIO_PXPDIR (0x04)
98/* Port X Pin Data OUTPUT Register 32bit (R/W) */
99#define U300_GPIO_PXPDOR (0x08)
100/* Port X Pin Config Register 32bit (R/W) */
101#define U300_GPIO_PXPCR (0x0C)
102#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL)
103#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL)
104#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL)
105#define U300_GPIO_PXPCR_PIN_MODE_INPUT (0x00000000UL)
106#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL)
107#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL)
108#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL)
109/* Port X Pull-up Enable Register 32bit (R/W) */
110#define U300_GPIO_PXPER (0x10)
111#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
112#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
113/* Port X Interrupt Event Register 32bit (R/W) */
114#define U300_GPIO_PXIEV (0x14)
115#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK (0x000000FFUL)
116#define U300_GPIO_PXIEV_IRQ_EVENT (0x00000001UL)
117/* Port X Interrupt Enable Register 32bit (R/W) */
118#define U300_GPIO_PXIEN (0x18)
119#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK (0x000000FFUL)
120#define U300_GPIO_PXIEN_IRQ_ENABLE (0x00000001UL)
121/* Port X Interrupt Force Register 32bit (R/W) */
122#define U300_GPIO_PXIFR (0x1C)
123#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK (0x000000FFUL)
124#define U300_GPIO_PXIFR_IRQ_FORCE (0x00000001UL)
125/* Port X Interrupt Config Register 32bit (R/W) */
126#define U300_GPIO_PXICR (0x20)
127#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL)
128#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL)
129#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL)
130#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL)
131#ifdef CONFIG_MACH_U300_BS335
132/* seven ports of 8 bits each = GPIO pins 0..55 */
133#define U300_GPIO_NUM_PORTS 7
134#else
135/* five ports of 8 bits each = GPIO pins 0..39 */
136#define U300_GPIO_NUM_PORTS 5
137#endif
138#define U300_GPIO_PINS_PER_PORT 8
139#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
140#endif
141
142/*
143 * Individual pin assignments for the B26/S26. Notice that the
144 * actual usage of these pins depends on the PAD MUX settings, that
145 * is why the same number can potentially appear several times.
146 * In the reference design each pin is only used for one purpose.
147 * These were determined by inspecting the B26/S26 schematic:
148 * 2/1911-ROA 128 1603
149 */
150#ifdef CONFIG_MACH_U300_BS2X
151#define U300_GPIO_PIN_UART_RX 0
152#define U300_GPIO_PIN_UART_TX 1
153#define U300_GPIO_PIN_GPIO02 2 /* Unrouted */
154#define U300_GPIO_PIN_GPIO03 3 /* Unrouted */
155#define U300_GPIO_PIN_CAM_SLEEP 4
156#define U300_GPIO_PIN_CAM_REG_EN 5
157#define U300_GPIO_PIN_GPIO06 6 /* Unrouted */
158#define U300_GPIO_PIN_GPIO07 7 /* Unrouted */
159
160#define U300_GPIO_PIN_GPIO08 8 /* Service point SP2321 */
161#define U300_GPIO_PIN_GPIO09 9 /* Service point SP2322 */
162#define U300_GPIO_PIN_PHFSENSE 10 /* Headphone jack sensing */
163#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
164#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
165#define U300_GPIO_PIN_FLIPSENSE 13 /* Mechanical flip sensing */
166#define U300_GPIO_PIN_GPIO14 14 /* DSP JTAG Port RTCK */
167#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
168
169#define U300_GPIO_PIN_GPIO16 16 /* Unrouted */
170#define U300_GPIO_PIN_GPIO17 17 /* Unrouted */
171#define U300_GPIO_PIN_GPIO18 18 /* Unrouted */
172#define U300_GPIO_PIN_GPIO19 19 /* Unrouted */
173#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
174#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
175#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
176#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
177#endif
178
179/*
180 * Individual pin assignments for the B330/S330 and B365/S365.
181 * Notice that the actual usage of these pins depends on the
182 * PAD MUX settings, that is why the same number can potentially
183 * appear several times. In the reference design each pin is only
184 * used for one purpose. These were determined by inspecting the
185 * S365 schematic.
186 */
187#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
188 defined(CONFIG_MACH_U300_BS335)
189#define U300_GPIO_PIN_UART_RX 0
190#define U300_GPIO_PIN_UART_TX 1
191#define U300_GPIO_PIN_UART_CTS 2
192#define U300_GPIO_PIN_UART_RTS 3
193#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
194#define U300_GPIO_PIN_GPIO05 5 /* Unrouted */
195#define U300_GPIO_PIN_MS_CD 6 /* Memory Stick Card insertion */
196#define U300_GPIO_PIN_GPIO07 7 /* Test point TP2430 */
197
198#define U300_GPIO_PIN_GPIO08 8 /* Test point TP2437 */
199#define U300_GPIO_PIN_GPIO09 9 /* Test point TP2431 */
200#define U300_GPIO_PIN_GPIO10 10 /* Test point TP2432 */
201#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
202#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
203#define U300_GPIO_PIN_CAM_SUB_STANDBY 13 /* Camera SUB standby */
204#define U300_GPIO_PIN_GPIO14 14 /* Test point TP2436 */
205#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
206
207#define U300_GPIO_PIN_GPIO16 16 /* Test point TP2438 */
208#define U300_GPIO_PIN_PHFSENSE 17 /* Headphone jack sensing */
209#define U300_GPIO_PIN_GPIO18 18 /* Test point TP2439 */
210#define U300_GPIO_PIN_GPIO19 19 /* Routed somewhere */
211#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
212#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
213#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
214#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
215
216#define U300_GPIO_PIN_GPIO24 24 /* Unrouted */
217#define U300_GPIO_PIN_GPIO25 25 /* Unrouted */
218#define U300_GPIO_PIN_GPIO26 26 /* Unrouted */
219#define U300_GPIO_PIN_GPIO27 27 /* Unrouted */
220#define U300_GPIO_PIN_GPIO28 28 /* Unrouted */
221#define U300_GPIO_PIN_GPIO29 29 /* Unrouted */
222#define U300_GPIO_PIN_GPIO30 30 /* Unrouted */
223#define U300_GPIO_PIN_GPIO31 31 /* Unrouted */
224
225#define U300_GPIO_PIN_GPIO32 32 /* Unrouted */
226#define U300_GPIO_PIN_GPIO33 33 /* Unrouted */
227#define U300_GPIO_PIN_GPIO34 34 /* Unrouted */
228#define U300_GPIO_PIN_GPIO35 35 /* Unrouted */
229#define U300_GPIO_PIN_GPIO36 36 /* Unrouted */
230#define U300_GPIO_PIN_GPIO37 37 /* Unrouted */
231#define U300_GPIO_PIN_GPIO38 38 /* Unrouted */
232#define U300_GPIO_PIN_GPIO39 39 /* Unrouted */
233
234#ifdef CONFIG_MACH_U300_BS335
235
236#define U300_GPIO_PIN_GPIO40 40 /* Unrouted */
237#define U300_GPIO_PIN_GPIO41 41 /* Unrouted */
238#define U300_GPIO_PIN_GPIO42 42 /* Unrouted */
239#define U300_GPIO_PIN_GPIO43 43 /* Unrouted */
240#define U300_GPIO_PIN_GPIO44 44 /* Unrouted */
241#define U300_GPIO_PIN_GPIO45 45 /* Unrouted */
242#define U300_GPIO_PIN_GPIO46 46 /* Unrouted */
243#define U300_GPIO_PIN_GPIO47 47 /* Unrouted */
244
245#define U300_GPIO_PIN_GPIO48 48 /* Unrouted */
246#define U300_GPIO_PIN_GPIO49 49 /* Unrouted */
247#define U300_GPIO_PIN_GPIO50 50 /* Unrouted */
248#define U300_GPIO_PIN_GPIO51 51 /* Unrouted */
249#define U300_GPIO_PIN_GPIO52 52 /* Unrouted */
250#define U300_GPIO_PIN_GPIO53 53 /* Unrouted */
251#define U300_GPIO_PIN_GPIO54 54 /* Unrouted */
252#define U300_GPIO_PIN_GPIO55 55 /* Unrouted */
253#endif
254
255#endif
256
257/* translates a pin number to a port number */
258#define PIN_TO_PORT(val) (val >> 3)
259
260/* These can be found in arch/arm/mach-u300/gpio.c */
261extern int gpio_is_valid(int number);
262extern int gpio_request(unsigned gpio, const char *label);
263extern void gpio_free(unsigned gpio);
264extern int gpio_direction_input(unsigned gpio);
265extern int gpio_direction_output(unsigned gpio, int value);
266extern int gpio_register_callback(unsigned gpio,
267 int (*func)(void *arg),
268 void *);
269extern int gpio_unregister_callback(unsigned gpio);
270extern void enable_irq_on_gpio_pin(unsigned gpio, int edge);
271extern void disable_irq_on_gpio_pin(unsigned gpio);
272extern void gpio_pullup(unsigned gpio, int value);
273extern int gpio_get_value(unsigned gpio);
274extern void gpio_set_value(unsigned gpio, int value);
275
276#define gpio_get_value_cansleep gpio_get_value
277#define gpio_set_value_cansleep gpio_set_value
278
279/* wrappers to sleep-enable the previous two functions */
280static inline unsigned gpio_to_irq(unsigned gpio)
281{
282 return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0;
283}
284
285static inline unsigned irq_to_gpio(unsigned irq)
286{
287 /*
288 * FIXME: This is no 1-1 mapping at all, it points to the
289 * whole block of 8 pins.
290 */
291 return (irq - IRQ_U300_GPIO_PORT0) << 3;
292}
293
294#endif
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h
index 09b1b28fa8fd..d270fea32926 100644
--- a/arch/arm/mach-u300/include/mach/irqs.h
+++ b/arch/arm/mach-u300/include/mach/irqs.h
@@ -72,7 +72,7 @@
72 72
73/* DB3150 and DB3200 have only 45 IRQs */ 73/* DB3150 and DB3200 have only 45 IRQs */
74#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) 74#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
75#define U300_NR_IRQS 45 75#define U300_VIC_IRQS_END 45
76#endif 76#endif
77 77
78/* The DB3350-specific interrupt lines */ 78/* The DB3350-specific interrupt lines */
@@ -88,7 +88,7 @@
88#define IRQ_U300_GPIO_PORT4 53 88#define IRQ_U300_GPIO_PORT4 53
89#define IRQ_U300_GPIO_PORT5 54 89#define IRQ_U300_GPIO_PORT5 54
90#define IRQ_U300_GPIO_PORT6 55 90#define IRQ_U300_GPIO_PORT6 55
91#define U300_NR_IRQS 56 91#define U300_VIC_IRQS_END 56
92#endif 92#endif
93 93
94/* The DB3210-specific interrupt lines */ 94/* The DB3210-specific interrupt lines */
@@ -106,16 +106,25 @@
106#define IRQ_U300_NFIF 45 106#define IRQ_U300_NFIF 45
107#define IRQ_U300_NFIF2 46 107#define IRQ_U300_NFIF2 46
108#define IRQ_U300_SYSCON_PLL_LOCK 47 108#define IRQ_U300_SYSCON_PLL_LOCK 47
109#define U300_NR_IRQS 48 109#define U300_VIC_IRQS_END 48
110#endif 110#endif
111 111
112#ifdef CONFIG_AB3550_CORE 112/* Maximum 8*7 GPIO lines */
113#define IRQ_AB3550_BASE (U300_NR_IRQS) 113#ifdef CONFIG_GPIO_U300
114#define IRQ_AB3550_END (IRQ_AB3550_BASE + 37) 114#define IRQ_U300_GPIO_BASE (U300_VIC_IRQS_END)
115#define IRQ_U300_GPIO_END (IRQ_U300_GPIO_BASE + 56)
116#else
117#define IRQ_U300_GPIO_END (U300_VIC_IRQS_END)
118#endif
115 119
116#define NR_IRQS (IRQ_AB3550_END + 1) 120/* Optional AB3550 mixsig chip */
121#ifdef CONFIG_AB3550_CORE
122#define IRQ_AB3550_BASE (IRQ_U300_GPIO_END)
123#define IRQ_AB3550_END (IRQ_AB3550_BASE + 38)
117#else 124#else
118#define NR_IRQS U300_NR_IRQS 125#define IRQ_AB3550_END (IRQ_U300_GPIO_END)
119#endif 126#endif
120 127
128#define NR_IRQS (IRQ_AB3550_END)
129
121#endif 130#endif
diff --git a/arch/arm/mach-u300/mmc.c b/arch/arm/mach-u300/mmc.c
index 677ccef5cd32..d9a5c92db74a 100644
--- a/arch/arm/mach-u300/mmc.c
+++ b/arch/arm/mach-u300/mmc.c
@@ -13,12 +13,12 @@
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
16#include <linux/gpio.h>
17#include <linux/dmaengine.h> 16#include <linux/dmaengine.h>
18#include <linux/amba/mmci.h> 17#include <linux/amba/mmci.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <mach/coh901318.h> 19#include <mach/coh901318.h>
21#include <mach/dma_channels.h> 20#include <mach/dma_channels.h>
21#include <mach/gpio-u300.h>
22 22
23#include "mmc.h" 23#include "mmc.h"
24#include "padmux.h" 24#include "padmux.h"
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index f26fd76f72b4..15b23e4bd488 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -6,10 +6,10 @@
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/gpio.h>
10 9
11#include <asm/mach-types.h> 10#include <asm/mach-types.h>
12#include <plat/pincfg.h> 11#include <plat/pincfg.h>
12#include <plat/gpio-nomadik.h>
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14 14
15#include "pins-db8500.h" 15#include "pins-db8500.h"
diff --git a/arch/arm/mach-ux500/board-mop500-u8500uib.c b/arch/arm/mach-ux500/board-mop500-u8500uib.c
index 8ce46c0fdfd5..feb5744d98b7 100644
--- a/arch/arm/mach-ux500/board-mop500-u8500uib.c
+++ b/arch/arm/mach-ux500/board-mop500-u8500uib.c
@@ -4,7 +4,7 @@
4 * Board data for the U8500 UIB, also known as the New UIB 4 * Board data for the U8500 UIB, also known as the New UIB
5 * License terms: GNU General Public License (GPL), version 2 5 * License terms: GNU General Public License (GPL), version 2
6 */ 6 */
7 7#include <linux/gpio.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/i2c.h> 10#include <linux/i2c.h>
@@ -13,7 +13,6 @@
13#include <linux/mfd/tc3589x.h> 13#include <linux/mfd/tc3589x.h>
14#include <linux/input/matrix_keypad.h> 14#include <linux/input/matrix_keypad.h>
15 15
16#include <mach/gpio.h>
17#include <mach/irqs.h> 16#include <mach/irqs.h>
18 17
19#include "board-mop500.h" 18#include "board-mop500.h"
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index cd54abaccd96..537ab63c1dc9 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -37,6 +37,7 @@
37#include <plat/i2c.h> 37#include <plat/i2c.h>
38#include <plat/ste_dma40.h> 38#include <plat/ste_dma40.h>
39#include <plat/pincfg.h> 39#include <plat/pincfg.h>
40#include <plat/gpio-nomadik.h>
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/setup.h> 43#include <mach/setup.h>
diff --git a/arch/arm/mach-ux500/board-u5500-sdi.c b/arch/arm/mach-ux500/board-u5500-sdi.c
index 739fb4c5b160..63c3f8058ffc 100644
--- a/arch/arm/mach-ux500/board-u5500-sdi.c
+++ b/arch/arm/mach-ux500/board-u5500-sdi.c
@@ -7,9 +7,9 @@
7 7
8#include <linux/amba/mmci.h> 8#include <linux/amba/mmci.h>
9#include <linux/mmc/host.h> 9#include <linux/mmc/host.h>
10#include <linux/gpio.h>
11 10
12#include <plat/pincfg.h> 11#include <plat/pincfg.h>
12#include <plat/gpio-nomadik.h>
13#include <mach/db5500-regs.h> 13#include <mach/db5500-regs.h>
14#include <plat/ste_dma40.h> 14#include <plat/ste_dma40.h>
15 15
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index e58f0f562426..2d9e191bd30a 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -8,7 +8,6 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/amba/bus.h> 10#include <linux/amba/bus.h>
11#include <linux/gpio.h>
12#include <linux/irq.h> 11#include <linux/irq.h>
13#include <linux/i2c.h> 12#include <linux/i2c.h>
14 13
@@ -17,6 +16,7 @@
17 16
18#include <plat/pincfg.h> 17#include <plat/pincfg.h>
19#include <plat/i2c.h> 18#include <plat/i2c.h>
19#include <plat/gpio-nomadik.h>
20 20
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/devices.h> 22#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index 22705d246fc7..9de1af008094 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -13,7 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14#include <asm/pmu.h> 14#include <asm/pmu.h>
15 15
16#include <plat/gpio.h> 16#include <plat/gpio-nomadik.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <mach/devices.h> 19#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 4598b06c8c55..13e8890a8b8a 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -14,12 +14,12 @@
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/gpio.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
19#include <linux/io.h> 18#include <linux/io.h>
20 19
21#include <asm/mach/map.h> 20#include <asm/mach/map.h>
22#include <asm/pmu.h> 21#include <asm/pmu.h>
22#include <plat/gpio-nomadik.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/setup.h> 24#include <mach/setup.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 13a4ce046ae5..c563e5418d80 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -13,7 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15 15
16#include <plat/gpio.h> 16#include <plat/gpio-nomadik.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
diff --git a/arch/arm/mach-ux500/include/mach/gpio.h b/arch/arm/mach-ux500/include/mach/gpio.h
index 3c4cd31ad9f7..7389df911b1a 100644
--- a/arch/arm/mach-ux500/include/mach/gpio.h
+++ b/arch/arm/mach-ux500/include/mach/gpio.h
@@ -7,6 +7,4 @@
7 */ 7 */
8#define ARCH_NR_GPIOS 350 8#define ARCH_NR_GPIOS 350
9 9
10#include <plat/gpio.h>
11
12#endif /* __ASM_ARCH_GPIO_H */ 10#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-versatile/include/mach/gpio.h b/arch/arm/mach-versatile/include/mach/gpio.h
index 94ff27678a46..40a8c178f10d 100644
--- a/arch/arm/mach-versatile/include/mach/gpio.h
+++ b/arch/arm/mach-versatile/include/mach/gpio.h
@@ -1,6 +1 @@
1#include <asm-generic/gpio.h> /* empty */
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-vt8500/include/mach/gpio.h b/arch/arm/mach-vt8500/include/mach/gpio.h
index 94ff27678a46..40a8c178f10d 100644
--- a/arch/arm/mach-vt8500/include/mach/gpio.h
+++ b/arch/arm/mach-vt8500/include/mach/gpio.h
@@ -1,6 +1 @@
1#include <asm-generic/gpio.h> /* empty */
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h
index 034da3e390c9..5385a4203277 100644
--- a/arch/arm/mach-w90x900/include/mach/gpio.h
+++ b/arch/arm/mach-w90x900/include/mach/gpio.h
@@ -15,16 +15,12 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <asm/irq.h> 17#include <asm/irq.h>
18#include <asm-generic/gpio.h>
19
20#define gpio_get_value __gpio_get_value
21#define gpio_set_value __gpio_set_value
22#define gpio_cansleep __gpio_cansleep
23 18
24static inline int gpio_to_irq(unsigned gpio) 19static inline int gpio_to_irq(unsigned gpio)
25{ 20{
26 return gpio; 21 return gpio;
27} 22}
23#define gpio_to_irq gpio_to_irq
28 24
29static inline int irq_to_gpio(unsigned irq) 25static inline int irq_to_gpio(unsigned irq)
30{ 26{
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 31c820c1b796..3e1ffc8b8f0c 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -21,18 +21,12 @@
21 21
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <asm-generic/gpio.h>
25 24
26 25
27/* There's a off-by-one betweem the gpio bank number and the gpiochip */ 26/* There's a off-by-one betweem the gpio bank number and the gpiochip */
28/* range e.g. GPIO_1_5 is gpio 5 under linux */ 27/* range e.g. GPIO_1_5 is gpio 5 under linux */
29#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr)) 28#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr))
30 29
31/* use gpiolib dispatchers */
32#define gpio_get_value __gpio_get_value
33#define gpio_set_value __gpio_set_value
34#define gpio_cansleep __gpio_cansleep
35
36#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio)) 30#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
37#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) 31#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
38 32
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
index d5d7e651269c..3ba4d8f8073b 100644
--- a/arch/arm/plat-nomadik/include/plat/gpio.h
+++ b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
@@ -9,20 +9,9 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#ifndef __ASM_PLAT_GPIO_H
13#define __ASM_PLAT_GPIO_H
14 12
15#include <asm-generic/gpio.h> 13#ifndef __PLAT_NOMADIK_GPIO
16 14#define __PLAT_NOMADIK_GPIO
17/*
18 * These currently cause a function call to happen, they may be optimized
19 * if needed by adding cpu-specific defines to identify blocks
20 * (see mach-pxa/include/mach/gpio.h as an example using GPLR etc)
21 */
22#define gpio_get_value __gpio_get_value
23#define gpio_set_value __gpio_set_value
24#define gpio_cansleep __gpio_cansleep
25#define gpio_to_irq __gpio_to_irq
26 15
27/* 16/*
28 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving 17 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
@@ -93,4 +82,4 @@ struct nmk_gpio_platform_data {
93 bool supports_sleepmode; 82 bool supports_sleepmode;
94}; 83};
95 84
96#endif /* __ASM_PLAT_GPIO_H */ 85#endif /* __PLAT_NOMADIK_GPIO */
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index 923c9621096b..caa1f7b6cc21 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -8,7 +8,7 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -18,7 +18,6 @@
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
20#include <plat/board.h> 20#include <plat/board.h>
21#include <mach/gpio.h>
22 21
23 22
24/* Many OMAP development platforms reuse the same "debug board"; these 23/* Many OMAP development platforms reuse the same "debug board"; these
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index fc05b1022602..61a1ec2a6af4 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/leds.h> 13#include <linux/leds.h>
@@ -19,7 +19,6 @@
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20 20
21#include <plat/fpga.h> 21#include <plat/fpga.h>
22#include <mach/gpio.h>
23 22
24 23
25/* Many OMAP development platforms reuse the same "debug board"; these 24/* Many OMAP development platforms reuse the same "debug board"; these
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index ea28f98d5d6a..64c3bd4aa54e 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -8,7 +8,7 @@
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
@@ -24,7 +24,6 @@
24#include <plat/tc.h> 24#include <plat/tc.h>
25#include <plat/board.h> 25#include <plat/board.h>
26#include <plat/mmc.h> 26#include <plat/mmc.h>
27#include <mach/gpio.h>
28#include <plat/menelaus.h> 27#include <plat/menelaus.h>
29#include <plat/mcbsp.h> 28#include <plat/mcbsp.h>
30#include <plat/omap44xx.h> 29#include <plat/omap44xx.h>
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 91e8de3db085..9e86ee0aed0a 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -222,26 +222,6 @@ extern void omap_gpio_restore_context(void);
222#include <linux/errno.h> 222#include <linux/errno.h>
223#include <asm-generic/gpio.h> 223#include <asm-generic/gpio.h>
224 224
225static inline int gpio_get_value(unsigned gpio)
226{
227 return __gpio_get_value(gpio);
228}
229
230static inline void gpio_set_value(unsigned gpio, int value)
231{
232 __gpio_set_value(gpio, value);
233}
234
235static inline int gpio_cansleep(unsigned gpio)
236{
237 return __gpio_cansleep(gpio);
238}
239
240static inline int gpio_to_irq(unsigned gpio)
241{
242 return __gpio_to_irq(gpio);
243}
244
245static inline int irq_to_gpio(unsigned irq) 225static inline int irq_to_gpio(unsigned irq)
246{ 226{
247 int tmp; 227 int tmp;
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 3075b9fdde83..3abf30428bee 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -12,15 +12,7 @@
12#define __PLAT_GPIO_H 12#define __PLAT_GPIO_H
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm-generic/gpio.h> 15#include <linux/types.h>
16
17/*
18 * GENERIC_GPIO primitives.
19 */
20#define gpio_get_value __gpio_get_value
21#define gpio_set_value __gpio_set_value
22#define gpio_cansleep __gpio_cansleep
23#define gpio_to_irq __gpio_to_irq
24 16
25/* 17/*
26 * Orion-specific GPIO API extensions. 18 * Orion-specific GPIO API extensions.
diff --git a/arch/arm/plat-pxa/Makefile b/arch/arm/plat-pxa/Makefile
index 3aca5ba0f876..f302d048392d 100644
--- a/arch/arm/plat-pxa/Makefile
+++ b/arch/arm/plat-pxa/Makefile
@@ -4,7 +4,6 @@
4 4
5obj-y := dma.o 5obj-y := dma.o
6 6
7obj-$(CONFIG_GENERIC_GPIO) += gpio.o
8obj-$(CONFIG_PXA3xx) += mfp.o 7obj-$(CONFIG_PXA3xx) += mfp.o
9obj-$(CONFIG_PXA95x) += mfp.o 8obj-$(CONFIG_PXA95x) += mfp.o
10obj-$(CONFIG_ARCH_MMP) += mfp.o 9obj-$(CONFIG_ARCH_MMP) += mfp.o
diff --git a/arch/arm/plat-pxa/include/plat/gpio-pxa.h b/arch/arm/plat-pxa/include/plat/gpio-pxa.h
new file mode 100644
index 000000000000..b6390beff323
--- /dev/null
+++ b/arch/arm/plat-pxa/include/plat/gpio-pxa.h
@@ -0,0 +1,44 @@
1#ifndef __PLAT_PXA_GPIO_H
2#define __PLAT_PXA_GPIO_H
3
4struct irq_data;
5
6/*
7 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
8 * one set of registers. The register offsets are organized below:
9 *
10 * GPLR GPDR GPSR GPCR GRER GFER GEDR
11 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
12 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
13 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
14 *
15 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
16 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
17 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
18 *
19 * NOTE:
20 * BANK 3 is only available on PXA27x and later processors.
21 * BANK 4 and 5 are only available on PXA935
22 */
23
24#define GPIO_BANK(n) (GPIO_REGS_VIRT + BANK_OFF(n))
25
26#define GPLR_OFFSET 0x00
27#define GPDR_OFFSET 0x0C
28#define GPSR_OFFSET 0x18
29#define GPCR_OFFSET 0x24
30#define GRER_OFFSET 0x30
31#define GFER_OFFSET 0x3C
32#define GEDR_OFFSET 0x48
33
34/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
35 * Those cases currently cause holes in the GPIO number space, the
36 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
37 */
38extern int pxa_last_gpio;
39
40typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
41
42extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
43
44#endif /* __PLAT_PXA_GPIO_H */
diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
index 1ddd2b97a729..258f77210b02 100644
--- a/arch/arm/plat-pxa/include/plat/gpio.h
+++ b/arch/arm/plat-pxa/include/plat/gpio.h
@@ -1,35 +1,10 @@
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; 4#define __ARM_GPIOLIB_COMPLEX
5 5
6/* 6/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
7 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with 7#include <mach/gpio-pxa.h>
8 * one set of registers. The register offsets are organized below:
9 *
10 * GPLR GPDR GPSR GPCR GRER GFER GEDR
11 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
12 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
13 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
14 *
15 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
16 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
17 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
18 *
19 * NOTE:
20 * BANK 3 is only available on PXA27x and later processors.
21 * BANK 4 and 5 are only available on PXA935
22 */
23
24#define GPIO_BANK(n) (GPIO_REGS_VIRT + BANK_OFF(n))
25
26#define GPLR_OFFSET 0x00
27#define GPDR_OFFSET 0x0C
28#define GPSR_OFFSET 0x18
29#define GPCR_OFFSET 0x24
30#define GRER_OFFSET 0x30
31#define GFER_OFFSET 0x3C
32#define GEDR_OFFSET 0x48
33 8
34static inline int gpio_get_value(unsigned gpio) 9static inline int gpio_get_value(unsigned gpio)
35{ 10{
@@ -52,13 +27,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
52 27
53#define gpio_cansleep __gpio_cansleep 28#define gpio_cansleep __gpio_cansleep
54 29
55/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
56 * Those cases currently cause holes in the GPIO number space, the
57 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
58 */
59extern int pxa_last_gpio;
60
61typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
62
63extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
64#endif /* __PLAT_GPIO_H */ 30#endif /* __PLAT_GPIO_H */
diff --git a/arch/arm/plat-spear/include/plat/gpio.h b/arch/arm/plat-spear/include/plat/gpio.h
index b857c91257dd..40a8c178f10d 100644
--- a/arch/arm/plat-spear/include/plat/gpio.h
+++ b/arch/arm/plat-spear/include/plat/gpio.h
@@ -1,24 +1 @@
1/* /* empty */
2 * arch/arm/plat-spear/include/plat/gpio.h
3 *
4 * GPIO macros for SPEAr platform
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_GPIO_H
15#define __PLAT_GPIO_H
16
17#include <asm-generic/gpio.h>
18
19#define gpio_get_value __gpio_get_value
20#define gpio_set_value __gpio_set_value
21#define gpio_cansleep __gpio_cansleep
22#define gpio_to_irq __gpio_to_irq
23
24#endif /* __PLAT_GPIO_H */
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
index 960c72571395..3f4c2613b3df 100644
--- a/drivers/ata/pata_at91.c
+++ b/drivers/ata/pata_at91.c
@@ -30,7 +30,7 @@
30 30
31#include <mach/at91sam9_smc.h> 31#include <mach/at91sam9_smc.h>
32#include <mach/board.h> 32#include <mach/board.h>
33#include <mach/gpio.h> 33#include <asm/gpio.h>
34 34
35#define DRV_NAME "pata_at91" 35#define DRV_NAME "pata_at91"
36#define DRV_VERSION "0.3" 36#define DRV_VERSION "0.3"
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d539efd96d4b..4caa3d37bbde 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -178,6 +178,15 @@ config GPIO_SCH
178 The Intel Tunnel Creek processor has 5 GPIOs powered by the 178 The Intel Tunnel Creek processor has 5 GPIOs powered by the
179 core power rail and 9 from suspend power supply. 179 core power rail and 9 from suspend power supply.
180 180
181config GPIO_U300
182 bool "ST-Ericsson U300 COH 901 335/571 GPIO"
183 depends on GPIOLIB && ARCH_U300
184 help
185 Say yes here to support GPIO interface on ST-Ericsson U300.
186 The names of the two IP block variants supported are
187 COH 901 335 and COH 901 571/3. They contain 3, 5 or 7
188 ports of 8 GPIO pins each.
189
181config GPIO_VX855 190config GPIO_VX855
182 tristate "VIA VX855/VX875 GPIO" 191 tristate "VIA VX855/VX875 GPIO"
183 depends on MFD_SUPPORT && PCI 192 depends on MFD_SUPPORT && PCI
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 9588948c96f0..19c5d27b6d2e 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -14,11 +14,14 @@ obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o
14obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o 14obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o
15obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o 15obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o
16obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o 16obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o
17obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o
17obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o 18obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o
18obj-$(CONFIG_GPIO_EXYNOS4) += gpio-exynos4.o 19obj-$(CONFIG_GPIO_EXYNOS4) += gpio-exynos4.o
19obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o 20obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o
20obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o 21obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
22obj-$(CONFIG_MACH_KS8695) += gpio-ks8695.o
21obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o 23obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o
24obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
22obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o 25obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o
23obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o 26obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o
24obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o 27obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o
@@ -37,18 +40,20 @@ obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o
37obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o 40obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o
38obj-$(CONFIG_GPIO_PCH) += gpio-pch.o 41obj-$(CONFIG_GPIO_PCH) += gpio-pch.o
39obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o 42obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
43obj-$(CONFIG_PLAT_PXA) += gpio-pxa.o
40obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o 44obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
41 45
42obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o 46obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o
43obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o 47obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o
44obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o 48obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o
45 49obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
46obj-$(CONFIG_GPIO_SCH) += gpio-sch.o 50obj-$(CONFIG_GPIO_SCH) += gpio-sch.o
47obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o 51obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
48obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o 52obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o
49obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o 53obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o
50obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o 54obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o
51obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o 55obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.o
56obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += gpio-tnetv107x.o
52obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o 57obj-$(CONFIG_GPIO_TPS65910) += gpio-tps65910.o
53obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o 58obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o
54obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o 59obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o
diff --git a/arch/arm/mach-davinci/gpio.c b/drivers/gpio/gpio-davinci.c
index cafbe13a82a5..df0d59570a84 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -9,15 +9,13 @@
9 * the Free Software Foundation; either version 2 of the License, or 9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include <mach/gpio.h>
20
21#include <asm/mach/irq.h> 19#include <asm/mach/irq.h>
22 20
23struct davinci_gpio_regs { 21struct davinci_gpio_regs {
@@ -232,9 +230,6 @@ static void gpio_irq_enable(struct irq_data *d)
232 230
233static int gpio_irq_type(struct irq_data *d, unsigned trigger) 231static int gpio_irq_type(struct irq_data *d, unsigned trigger)
234{ 232{
235 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
236 u32 mask = (u32) irq_data_get_irq_handler_data(d);
237
238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 233 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
239 return -EINVAL; 234 return -EINVAL;
240 235
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c
index 72fb9c665320..7aafbb437339 100644
--- a/drivers/gpio/gpio-ep93xx.c
+++ b/drivers/gpio/gpio-ep93xx.c
@@ -23,6 +23,9 @@
23#include <linux/basic_mmio_gpio.h> 23#include <linux/basic_mmio_gpio.h>
24 24
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/gpio-ep93xx.h>
27
28#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
26 29
27struct ep93xx_gpio { 30struct ep93xx_gpio {
28 void __iomem *mmio_base; 31 void __iomem *mmio_base;
@@ -307,6 +310,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
307 return 0; 310 return 0;
308} 311}
309 312
313/*
314 * Map GPIO A0..A7 (0..7) to irq 64..71,
315 * B0..B7 (7..15) to irq 72..79, and
316 * F0..F7 (16..24) to irq 80..87.
317 */
318static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
319{
320 int gpio = chip->base + offset;
321
322 if (gpio > EP93XX_GPIO_LINE_MAX_IRQ)
323 return -EINVAL;
324
325 return 64 + gpio;
326}
327
310static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev, 328static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
311 void __iomem *mmio_base, struct ep93xx_gpio_bank *bank) 329 void __iomem *mmio_base, struct ep93xx_gpio_bank *bank)
312{ 330{
@@ -321,8 +339,10 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
321 bgc->gc.label = bank->label; 339 bgc->gc.label = bank->label;
322 bgc->gc.base = bank->base; 340 bgc->gc.base = bank->base;
323 341
324 if (bank->has_debounce) 342 if (bank->has_debounce) {
325 bgc->gc.set_debounce = ep93xx_gpio_set_debounce; 343 bgc->gc.set_debounce = ep93xx_gpio_set_debounce;
344 bgc->gc.to_irq = ep93xx_gpio_to_irq;
345 }
326 346
327 return gpiochip_add(&bgc->gc); 347 return gpiochip_add(&bgc->gc);
328} 348}
diff --git a/arch/arm/mach-ks8695/gpio.c b/drivers/gpio/gpio-ks8695.c
index 31e456508a6f..a3ac66ea364b 100644
--- a/arch/arm/mach-ks8695/gpio.c
+++ b/drivers/gpio/gpio-ks8695.c
@@ -18,7 +18,7 @@
18 * along with this program; if not, write to the Free Software 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 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21#include <linux/gpio.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/init.h> 24#include <linux/init.h>
@@ -31,7 +31,7 @@
31#include <asm/mach/irq.h> 31#include <asm/mach/irq.h>
32 32
33#include <mach/regs-gpio.h> 33#include <mach/regs-gpio.h>
34#include <mach/gpio.h> 34#include <mach/gpio-ks8695.h>
35 35
36/* 36/*
37 * Configure a GPIO line for either GPIO function, or its internal 37 * Configure a GPIO line for either GPIO function, or its internal
diff --git a/arch/arm/mach-lpc32xx/gpiolib.c b/drivers/gpio/gpio-lpc32xx.c
index 69061ea8997a..5b6948081f8f 100644
--- a/arch/arm/mach-lpc32xx/gpiolib.c
+++ b/drivers/gpio/gpio-lpc32xx.c
@@ -24,7 +24,7 @@
24 24
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/platform.h> 26#include <mach/platform.h>
27#include "common.h" 27#include <mach/gpio-lpc32xx.h>
28 28
29#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) 29#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000)
30#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) 30#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004)
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index 2c212c732d76..740caed2b278 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -27,8 +27,9 @@
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28 28
29#include <plat/pincfg.h> 29#include <plat/pincfg.h>
30#include <plat/gpio-nomadik.h>
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31#include <mach/gpio.h> 32#include <asm/gpio.h>
32 33
33/* 34/*
34 * The GPIO module in the Nomadik family of Systems-on-Chip is an 35 * The GPIO module in the Nomadik family of Systems-on-Chip is an
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 0599854e2217..9c27244fd680 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -25,7 +25,7 @@
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28#include <mach/gpio.h> 28#include <asm/gpio.h>
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31struct gpio_bank { 31struct gpio_bank {
diff --git a/arch/arm/plat-pxa/gpio.c b/drivers/gpio/gpio-pxa.c
index a11dc3670505..9052925c6fa2 100644
--- a/arch/arm/plat-pxa/gpio.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -11,14 +11,14 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/syscore_ops.h> 18#include <linux/syscore_ops.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20 20
21#include <mach/gpio.h> 21#include <mach/gpio-pxa.h>
22 22
23int pxa_last_gpio; 23int pxa_last_gpio;
24 24
diff --git a/arch/arm/mach-sa1100/gpio.c b/drivers/gpio/gpio-sa1100.c
index 0d3829a8c2c1..b6c1f6d80649 100644
--- a/arch/arm/mach-sa1100/gpio.c
+++ b/drivers/gpio/gpio-sa1100.c
@@ -7,13 +7,11 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/module.h> 12#include <linux/module.h>
13 13
14#include <asm/gpio.h>
15#include <mach/hardware.h> 14#include <mach/hardware.h>
16#include "generic.h"
17 15
18static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset) 16static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
19{ 17{
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 747eb40e8afe..6b65207c8106 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -27,6 +27,7 @@
27 27
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <mach/gpio-tegra.h>
30#include <mach/iomap.h> 31#include <mach/iomap.h>
31#include <mach/suspend.h> 32#include <mach/suspend.h>
32 33
@@ -134,7 +135,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
134 return 0; 135 return 0;
135} 136}
136 137
137 138static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
139{
140 return TEGRA_GPIO_TO_IRQ(offset);
141}
138 142
139static struct gpio_chip tegra_gpio_chip = { 143static struct gpio_chip tegra_gpio_chip = {
140 .label = "tegra-gpio", 144 .label = "tegra-gpio",
@@ -142,6 +146,7 @@ static struct gpio_chip tegra_gpio_chip = {
142 .get = tegra_gpio_get, 146 .get = tegra_gpio_get,
143 .direction_output = tegra_gpio_direction_output, 147 .direction_output = tegra_gpio_direction_output,
144 .set = tegra_gpio_set, 148 .set = tegra_gpio_set,
149 .to_irq = tegra_gpio_to_irq,
145 .base = 0, 150 .base = 0,
146 .ngpio = TEGRA_NR_GPIOS, 151 .ngpio = TEGRA_NR_GPIOS,
147}; 152};
@@ -331,6 +336,7 @@ static struct lock_class_key gpio_lock_class;
331static int __init tegra_gpio_init(void) 336static int __init tegra_gpio_init(void)
332{ 337{
333 struct tegra_gpio_bank *bank; 338 struct tegra_gpio_bank *bank;
339 int gpio;
334 int i; 340 int i;
335 int j; 341 int j;
336 342
@@ -352,14 +358,17 @@ static int __init tegra_gpio_init(void)
352 358
353 gpiochip_add(&tegra_gpio_chip); 359 gpiochip_add(&tegra_gpio_chip);
354 360
355 for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) { 361 for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
356 bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))]; 362 int irq = TEGRA_GPIO_TO_IRQ(gpio);
363 /* No validity check; all Tegra GPIOs are valid IRQs */
364
365 bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
357 366
358 irq_set_lockdep_class(i, &gpio_lock_class); 367 irq_set_lockdep_class(irq, &gpio_lock_class);
359 irq_set_chip_data(i, bank); 368 irq_set_chip_data(irq, bank);
360 irq_set_chip_and_handler(i, &tegra_gpio_irq_chip, 369 irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
361 handle_simple_irq); 370 handle_simple_irq);
362 set_irq_flags(i, IRQF_VALID); 371 set_irq_flags(irq, IRQF_VALID);
363 } 372 }
364 373
365 for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { 374 for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
diff --git a/arch/arm/mach-davinci/gpio-tnetv107x.c b/drivers/gpio/gpio-tnetv107x.c
index 3fa3e2867e19..3fa3e2867e19 100644
--- a/arch/arm/mach-davinci/gpio-tnetv107x.c
+++ b/drivers/gpio/gpio-tnetv107x.c
diff --git a/drivers/gpio/gpio-u300.c b/drivers/gpio/gpio-u300.c
index 53e8255cb0ba..4035778852b0 100644
--- a/drivers/gpio/gpio-u300.c
+++ b/drivers/gpio/gpio-u300.c
@@ -1,18 +1,17 @@
1/* 1/*
2 * U300 GPIO module. 2 * U300 GPIO module.
3 * 3 *
4 * Copyright (C) 2007-2009 ST-Ericsson AB 4 * Copyright (C) 2007-2011 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
6 * This can driver either of the two basic GPIO cores 6 * This can driver either of the two basic GPIO cores
7 * available in the U300 platforms: 7 * available in the U300 platforms:
8 * COH 901 335 - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0) 8 * COH 901 335 - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0)
9 * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0) 9 * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0)
10 * Notice that you also have inline macros in <asm-arch/gpio.h> 10 * Author: Linus Walleij <linus.walleij@linaro.org>
11 * Author: Linus Walleij <linus.walleij@stericsson.com>
12 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> 11 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
13 *
14 */ 12 */
15#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/irq.h>
16#include <linux/interrupt.h> 15#include <linux/interrupt.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
@@ -21,677 +20,898 @@
21#include <linux/err.h> 20#include <linux/err.h>
22#include <linux/platform_device.h> 21#include <linux/platform_device.h>
23#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/list.h>
24#include <linux/slab.h>
25#include <mach/gpio-u300.h>
24 26
25/* Reference to GPIO block clock */ 27/*
26static struct clk *clk; 28 * Bias modes for U300 GPIOs
29 *
30 * GPIO_U300_CONFIG_BIAS_UNKNOWN: this bias mode is not known to us
31 * GPIO_U300_CONFIG_BIAS_FLOAT: no specific bias, the GPIO will float or state
32 * is not controlled by software
33 * GPIO_U300_CONFIG_BIAS_PULL_UP: the GPIO will be pulled up (usually with high
34 * impedance to VDD)
35 */
36#define GPIO_U300_CONFIG_BIAS_UNKNOWN 0x1000
37#define GPIO_U300_CONFIG_BIAS_FLOAT 0x1001
38#define GPIO_U300_CONFIG_BIAS_PULL_UP 0x1002
27 39
28/* Memory resource */ 40/*
29static struct resource *memres; 41 * Drive modes for U300 GPIOs (output)
30static void __iomem *virtbase; 42 *
31static struct device *gpiodev; 43 * GPIO_U300_CONFIG_DRIVE_PUSH_PULL: the GPIO will be driven actively high and
44 * low, this is the most typical case and is typically achieved with two
45 * active transistors on the output
46 * GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: the GPIO will be driven with open drain
47 * (open collector) which means it is usually wired with other output
48 * ports which are then pulled up with an external resistor
49 * GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: the GPIO will be driven with open drain
50 * (open emitter) which is the same as open drain mutatis mutandis but
51 * pulled to ground
52 */
53#define GPIO_U300_CONFIG_DRIVE_PUSH_PULL 0x2000
54#define GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN 0x2001
55#define GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE 0x2002
56
57/*
58 * Register definitions for COH 901 335 variant
59 */
60#define U300_335_PORT_STRIDE (0x1C)
61/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
62#define U300_335_PXPDIR (0x00)
63#define U300_335_PXPDOR (0x00)
64/* Port X Pin Config Register 32bit (R/W) */
65#define U300_335_PXPCR (0x04)
66/* This register layout is the same in both blocks */
67#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL)
68#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL)
69#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL)
70#define U300_GPIO_PXPCR_PIN_MODE_INPUT (0x00000000UL)
71#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL)
72#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL)
73#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL)
74/* Port X Interrupt Event Register 32bit (R/W) */
75#define U300_335_PXIEV (0x08)
76/* Port X Interrupt Enable Register 32bit (R/W) */
77#define U300_335_PXIEN (0x0C)
78/* Port X Interrupt Force Register 32bit (R/W) */
79#define U300_335_PXIFR (0x10)
80/* Port X Interrupt Config Register 32bit (R/W) */
81#define U300_335_PXICR (0x14)
82/* This register layout is the same in both blocks */
83#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL)
84#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL)
85#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL)
86#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL)
87/* Port X Pull-up Enable Register 32bit (R/W) */
88#define U300_335_PXPER (0x18)
89/* This register layout is the same in both blocks */
90#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
91#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
92/* Control Register 32bit (R/W) */
93#define U300_335_CR (0x54)
94#define U300_335_CR_BLOCK_CLOCK_ENABLE (0x00000001UL)
95
96/*
97 * Register definitions for COH 901 571 / 3 variant
98 */
99#define U300_571_PORT_STRIDE (0x30)
100/*
101 * Control Register 32bit (R/W)
102 * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
103 * gives the number of GPIO pins.
104 * bit 8-2 (mask 0x000001FC) contains the core version ID.
105 */
106#define U300_571_CR (0x00)
107#define U300_571_CR_SYNC_SEL_ENABLE (0x00000002UL)
108#define U300_571_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL)
109/*
110 * These registers have the same layout and function as the corresponding
111 * COH 901 335 registers, just at different offset.
112 */
113#define U300_571_PXPDIR (0x04)
114#define U300_571_PXPDOR (0x08)
115#define U300_571_PXPCR (0x0C)
116#define U300_571_PXPER (0x10)
117#define U300_571_PXIEV (0x14)
118#define U300_571_PXIEN (0x18)
119#define U300_571_PXIFR (0x1C)
120#define U300_571_PXICR (0x20)
121
122/* 8 bits per port, no version has more than 7 ports */
123#define U300_GPIO_PINS_PER_PORT 8
124#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * 7)
125
126struct u300_gpio {
127 struct gpio_chip chip;
128 struct list_head port_list;
129 struct clk *clk;
130 struct resource *memres;
131 void __iomem *base;
132 struct device *dev;
133 int irq_base;
134 u32 stride;
135 /* Register offsets */
136 u32 pcr;
137 u32 dor;
138 u32 dir;
139 u32 per;
140 u32 icr;
141 u32 ien;
142 u32 iev;
143};
32 144
33struct u300_gpio_port { 145struct u300_gpio_port {
34 const char *name; 146 struct list_head node;
147 struct u300_gpio *gpio;
148 char name[8];
35 int irq; 149 int irq;
36 int number; 150 int number;
151 u8 toggle_edge_mode;
37}; 152};
38 153
154/*
155 * Macro to expand to read a specific register found in the "gpio"
156 * struct. It requires the struct u300_gpio *gpio variable to exist in
157 * its context. It calculates the port offset from the given pin
158 * offset, muliplies by the port stride and adds the register offset
159 * so it provides a pointer to the desired register.
160 */
161#define U300_PIN_REG(pin, reg) \
162 (gpio->base + (pin >> 3) * gpio->stride + gpio->reg)
39 163
40static struct u300_gpio_port gpio_ports[] = { 164/*
41 { 165 * Provides a bitmask for a specific gpio pin inside an 8-bit GPIO
42 .name = "gpio0", 166 * register.
43 .number = 0, 167 */
44 }, 168#define U300_PIN_BIT(pin) \
45 { 169 (1 << (pin & 0x07))
46 .name = "gpio1",
47 .number = 1,
48 },
49 {
50 .name = "gpio2",
51 .number = 2,
52 },
53#ifdef U300_COH901571_3
54 {
55 .name = "gpio3",
56 .number = 3,
57 },
58 {
59 .name = "gpio4",
60 .number = 4,
61 },
62#ifdef CONFIG_MACH_U300_BS335
63 {
64 .name = "gpio5",
65 .number = 5,
66 },
67 {
68 .name = "gpio6",
69 .number = 6,
70 },
71#endif
72#endif
73 170
171struct u300_gpio_confdata {
172 u16 bias_mode;
173 bool output;
174 int outval;
74}; 175};
75 176
177/* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */
178#define BS335_GPIO_NUM_PORTS 7
179/* BS365 has five ports of 8 bits each = GPIO pins 0..39 */
180#define BS365_GPIO_NUM_PORTS 5
76 181
77#ifdef U300_COH901571_3 182#define U300_FLOATING_INPUT { \
183 .bias_mode = GPIO_U300_CONFIG_BIAS_FLOAT, \
184 .output = false, \
185}
78 186
79/* Default input value */ 187#define U300_PULL_UP_INPUT { \
80#define DEFAULT_OUTPUT_LOW 0 188 .bias_mode = GPIO_U300_CONFIG_BIAS_PULL_UP, \
81#define DEFAULT_OUTPUT_HIGH 1 189 .output = false, \
190}
82 191
83/* GPIO Pull-Up status */ 192#define U300_OUTPUT_LOW { \
84#define DISABLE_PULL_UP 0 193 .output = true, \
85#define ENABLE_PULL_UP 1 194 .outval = 0, \
195}
86 196
87#define GPIO_NOT_USED 0 197#define U300_OUTPUT_HIGH { \
88#define GPIO_IN 1 198 .output = true, \
89#define GPIO_OUT 2 199 .outval = 1, \
200}
90 201
91struct u300_gpio_configuration_data {
92 unsigned char pin_usage;
93 unsigned char default_output_value;
94 unsigned char pull_up;
95};
96 202
97/* Initial configuration */ 203/* Initial configuration */
98const struct u300_gpio_configuration_data 204static const struct __initdata u300_gpio_confdata
99u300_gpio_config[U300_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { 205bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
100#ifdef CONFIG_MACH_U300_BS335
101 /* Port 0, pins 0-7 */ 206 /* Port 0, pins 0-7 */
102 { 207 {
103 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 208 U300_FLOATING_INPUT,
104 {GPIO_OUT, DEFAULT_OUTPUT_HIGH, DISABLE_PULL_UP}, 209 U300_OUTPUT_HIGH,
105 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 210 U300_FLOATING_INPUT,
106 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 211 U300_OUTPUT_LOW,
107 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 212 U300_OUTPUT_LOW,
108 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 213 U300_OUTPUT_LOW,
109 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 214 U300_OUTPUT_LOW,
110 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 215 U300_OUTPUT_LOW,
111 }, 216 },
112 /* Port 1, pins 0-7 */ 217 /* Port 1, pins 0-7 */
113 { 218 {
114 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 219 U300_OUTPUT_LOW,
115 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 220 U300_OUTPUT_LOW,
116 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 221 U300_OUTPUT_LOW,
117 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 222 U300_PULL_UP_INPUT,
118 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 223 U300_FLOATING_INPUT,
119 {GPIO_OUT, DEFAULT_OUTPUT_HIGH, DISABLE_PULL_UP}, 224 U300_OUTPUT_HIGH,
120 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 225 U300_OUTPUT_LOW,
121 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 226 U300_OUTPUT_LOW,
122 }, 227 },
123 /* Port 2, pins 0-7 */ 228 /* Port 2, pins 0-7 */
124 { 229 {
125 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 230 U300_FLOATING_INPUT,
126 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 231 U300_FLOATING_INPUT,
127 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 232 U300_FLOATING_INPUT,
128 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 233 U300_FLOATING_INPUT,
129 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 234 U300_OUTPUT_LOW,
130 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 235 U300_PULL_UP_INPUT,
131 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 236 U300_OUTPUT_LOW,
132 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} 237 U300_PULL_UP_INPUT,
133 }, 238 },
134 /* Port 3, pins 0-7 */ 239 /* Port 3, pins 0-7 */
135 { 240 {
136 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 241 U300_PULL_UP_INPUT,
137 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 242 U300_OUTPUT_LOW,
138 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 243 U300_FLOATING_INPUT,
139 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 244 U300_FLOATING_INPUT,
140 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 245 U300_FLOATING_INPUT,
141 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 246 U300_FLOATING_INPUT,
142 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 247 U300_FLOATING_INPUT,
143 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 248 U300_FLOATING_INPUT,
144 }, 249 },
145 /* Port 4, pins 0-7 */ 250 /* Port 4, pins 0-7 */
146 { 251 {
147 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 252 U300_FLOATING_INPUT,
148 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 253 U300_FLOATING_INPUT,
149 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 254 U300_FLOATING_INPUT,
150 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 255 U300_FLOATING_INPUT,
151 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 256 U300_FLOATING_INPUT,
152 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 257 U300_FLOATING_INPUT,
153 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 258 U300_FLOATING_INPUT,
154 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 259 U300_FLOATING_INPUT,
155 }, 260 },
156 /* Port 5, pins 0-7 */ 261 /* Port 5, pins 0-7 */
157 { 262 {
158 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 263 U300_FLOATING_INPUT,
159 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 264 U300_FLOATING_INPUT,
160 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 265 U300_FLOATING_INPUT,
161 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 266 U300_FLOATING_INPUT,
162 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 267 U300_FLOATING_INPUT,
163 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 268 U300_FLOATING_INPUT,
164 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 269 U300_FLOATING_INPUT,
165 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 270 U300_FLOATING_INPUT,
166 }, 271 },
167 /* Port 6, pind 0-7 */ 272 /* Port 6, pind 0-7 */
168 { 273 {
169 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 274 U300_FLOATING_INPUT,
170 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 275 U300_FLOATING_INPUT,
171 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 276 U300_FLOATING_INPUT,
172 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 277 U300_FLOATING_INPUT,
173 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 278 U300_FLOATING_INPUT,
174 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 279 U300_FLOATING_INPUT,
175 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 280 U300_FLOATING_INPUT,
176 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 281 U300_FLOATING_INPUT,
177 } 282 }
178#endif 283};
179 284
180#ifdef CONFIG_MACH_U300_BS365 285static const struct __initdata u300_gpio_confdata
286bs365_gpio_config[BS365_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
181 /* Port 0, pins 0-7 */ 287 /* Port 0, pins 0-7 */
182 { 288 {
183 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 289 U300_FLOATING_INPUT,
184 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 290 U300_OUTPUT_LOW,
185 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 291 U300_FLOATING_INPUT,
186 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 292 U300_OUTPUT_LOW,
187 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 293 U300_OUTPUT_LOW,
188 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 294 U300_OUTPUT_LOW,
189 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 295 U300_PULL_UP_INPUT,
190 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 296 U300_FLOATING_INPUT,
191 }, 297 },
192 /* Port 1, pins 0-7 */ 298 /* Port 1, pins 0-7 */
193 { 299 {
194 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 300 U300_OUTPUT_LOW,
195 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 301 U300_FLOATING_INPUT,
196 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 302 U300_OUTPUT_LOW,
197 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 303 U300_FLOATING_INPUT,
198 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 304 U300_FLOATING_INPUT,
199 {GPIO_OUT, DEFAULT_OUTPUT_HIGH, DISABLE_PULL_UP}, 305 U300_OUTPUT_HIGH,
200 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 306 U300_OUTPUT_LOW,
201 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 307 U300_OUTPUT_LOW,
202 }, 308 },
203 /* Port 2, pins 0-7 */ 309 /* Port 2, pins 0-7 */
204 { 310 {
205 {GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 311 U300_FLOATING_INPUT,
206 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 312 U300_PULL_UP_INPUT,
207 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 313 U300_OUTPUT_LOW,
208 {GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, 314 U300_OUTPUT_LOW,
209 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 315 U300_PULL_UP_INPUT,
210 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 316 U300_PULL_UP_INPUT,
211 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 317 U300_PULL_UP_INPUT,
212 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} 318 U300_PULL_UP_INPUT,
213 }, 319 },
214 /* Port 3, pins 0-7 */ 320 /* Port 3, pins 0-7 */
215 { 321 {
216 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 322 U300_PULL_UP_INPUT,
217 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 323 U300_PULL_UP_INPUT,
218 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 324 U300_PULL_UP_INPUT,
219 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 325 U300_PULL_UP_INPUT,
220 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 326 U300_PULL_UP_INPUT,
221 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 327 U300_PULL_UP_INPUT,
222 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 328 U300_PULL_UP_INPUT,
223 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} 329 U300_PULL_UP_INPUT,
224 }, 330 },
225 /* Port 4, pins 0-7 */ 331 /* Port 4, pins 0-7 */
226 { 332 {
227 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 333 U300_PULL_UP_INPUT,
228 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 334 U300_PULL_UP_INPUT,
229 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 335 U300_PULL_UP_INPUT,
230 {GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 336 U300_PULL_UP_INPUT,
231 /* These 4 pins doesn't exist on DB3210 */ 337 /* These 4 pins doesn't exist on DB3210 */
232 {GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 338 U300_OUTPUT_LOW,
233 {GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 339 U300_OUTPUT_LOW,
234 {GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, 340 U300_OUTPUT_LOW,
235 {GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} 341 U300_OUTPUT_LOW,
236 } 342 }
237#endif
238}; 343};
239#endif
240 344
241 345/**
242/* No users == we can power down GPIO */ 346 * to_u300_gpio() - get the pointer to u300_gpio
243static int gpio_users; 347 * @chip: the gpio chip member of the structure u300_gpio
244
245struct gpio_struct {
246 int (*callback)(void *);
247 void *data;
248 int users;
249};
250
251static struct gpio_struct gpio_pin[U300_GPIO_MAX];
252
253/*
254 * Let drivers register callback in order to get notified when there is
255 * an interrupt on the gpio pin
256 */ 348 */
257int gpio_register_callback(unsigned gpio, int (*func)(void *arg), void *data) 349static inline struct u300_gpio *to_u300_gpio(struct gpio_chip *chip)
258{ 350{
259 if (gpio_pin[gpio].callback) 351 return container_of(chip, struct u300_gpio, chip);
260 dev_warn(gpiodev, "%s: WARNING: callback already "
261 "registered for gpio pin#%d\n", __func__, gpio);
262 gpio_pin[gpio].callback = func;
263 gpio_pin[gpio].data = data;
264
265 return 0;
266} 352}
267EXPORT_SYMBOL(gpio_register_callback);
268 353
269int gpio_unregister_callback(unsigned gpio) 354static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
270{ 355{
271 if (!gpio_pin[gpio].callback) 356 struct u300_gpio *gpio = to_u300_gpio(chip);
272 dev_warn(gpiodev, "%s: WARNING: callback already "
273 "unregistered for gpio pin#%d\n", __func__, gpio);
274 gpio_pin[gpio].callback = NULL;
275 gpio_pin[gpio].data = NULL;
276 357
277 return 0; 358 return readl(U300_PIN_REG(offset, dir)) & U300_PIN_BIT(offset);
278} 359}
279EXPORT_SYMBOL(gpio_unregister_callback);
280 360
281/* Non-zero means valid */ 361static void u300_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
282int gpio_is_valid(int number)
283{ 362{
284 if (number >= 0 && 363 struct u300_gpio *gpio = to_u300_gpio(chip);
285 number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT)) 364 unsigned long flags;
286 return 1; 365 u32 val;
287 return 0;
288}
289EXPORT_SYMBOL(gpio_is_valid);
290 366
291int gpio_request(unsigned gpio, const char *label) 367 local_irq_save(flags);
292{
293 if (gpio_pin[gpio].users)
294 return -EINVAL;
295 else
296 gpio_pin[gpio].users++;
297 368
298 gpio_users++; 369 val = readl(U300_PIN_REG(offset, dor));
370 if (value)
371 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
372 else
373 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
299 374
300 return 0; 375 local_irq_restore(flags);
301} 376}
302EXPORT_SYMBOL(gpio_request);
303 377
304void gpio_free(unsigned gpio) 378static int u300_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
305{ 379{
306 gpio_users--; 380 struct u300_gpio *gpio = to_u300_gpio(chip);
307 gpio_pin[gpio].users--; 381 unsigned long flags;
308 if (unlikely(gpio_pin[gpio].users < 0)) { 382 u32 val;
309 dev_warn(gpiodev, "warning: gpio#%d release mismatch\n",
310 gpio);
311 gpio_pin[gpio].users = 0;
312 }
313
314 return;
315}
316EXPORT_SYMBOL(gpio_free);
317 383
318/* This returns zero or nonzero */ 384 local_irq_save(flags);
319int gpio_get_value(unsigned gpio) 385 val = readl(U300_PIN_REG(offset, pcr));
320{ 386 /* Mask out this pin, note 2 bits per setting */
321 return readl(virtbase + U300_GPIO_PXPDIR + 387 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1));
322 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) & (1 << (gpio & 0x07)); 388 writel(val, U300_PIN_REG(offset, pcr));
389 local_irq_restore(flags);
390 return 0;
323} 391}
324EXPORT_SYMBOL(gpio_get_value);
325 392
326/* 393static int u300_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
327 * We hope that the compiler will optimize away the unused branch 394 int value)
328 * in case "value" is a constant
329 */
330void gpio_set_value(unsigned gpio, int value)
331{ 395{
332 u32 val; 396 struct u300_gpio *gpio = to_u300_gpio(chip);
333 unsigned long flags; 397 unsigned long flags;
398 u32 oldmode;
399 u32 val;
334 400
335 local_irq_save(flags); 401 local_irq_save(flags);
336 if (value) { 402 val = readl(U300_PIN_REG(offset, pcr));
337 /* set */ 403 /*
338 val = readl(virtbase + U300_GPIO_PXPDOR + 404 * Drive mode must be set by the special mode set function, set
339 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) 405 * push/pull mode by default if no mode has been selected.
340 & (1 << (gpio & 0x07)); 406 */
341 writel(val | (1 << (gpio & 0x07)), virtbase + 407 oldmode = val & (U300_GPIO_PXPCR_PIN_MODE_MASK <<
342 U300_GPIO_PXPDOR + 408 ((offset & 0x07) << 1));
343 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING); 409 /* mode = 0 means input, else some mode is already set */
344 } else { 410 if (oldmode == 0) {
345 /* clear */ 411 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK <<
346 val = readl(virtbase + U300_GPIO_PXPDOR + 412 ((offset & 0x07) << 1));
347 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) 413 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
348 & (1 << (gpio & 0x07)); 414 << ((offset & 0x07) << 1));
349 writel(val & ~(1 << (gpio & 0x07)), virtbase + 415 writel(val, U300_PIN_REG(offset, pcr));
350 U300_GPIO_PXPDOR +
351 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
352 } 416 }
417 u300_gpio_set(chip, offset, value);
353 local_irq_restore(flags); 418 local_irq_restore(flags);
419 return 0;
354} 420}
355EXPORT_SYMBOL(gpio_set_value);
356 421
357int gpio_direction_input(unsigned gpio) 422static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
358{ 423{
424 struct u300_gpio *gpio = to_u300_gpio(chip);
425 int retirq = gpio->irq_base + offset;
426
427 dev_dbg(gpio->dev, "request IRQ for GPIO %d, return %d\n", offset,
428 retirq);
429 return retirq;
430}
431
432static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
433 u16 param, unsigned long *data)
434{
435 struct u300_gpio *gpio = to_u300_gpio(chip);
359 unsigned long flags; 436 unsigned long flags;
360 u32 val; 437 u32 val;
361 438
362 if (gpio > U300_GPIO_MAX)
363 return -EINVAL;
364
365 local_irq_save(flags); 439 local_irq_save(flags);
366 val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * 440 switch (param) {
367 U300_GPIO_PORTX_SPACING); 441 case GPIO_U300_CONFIG_BIAS_UNKNOWN:
368 /* Mask out this pin*/ 442 case GPIO_U300_CONFIG_BIAS_FLOAT:
369 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1)); 443 val = readl(U300_PIN_REG(offset, per));
370 /* This is not needed since it sets the bits to zero.*/ 444 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
371 /* val |= (U300_GPIO_PXPCR_PIN_MODE_INPUT << (gpio*2)); */ 445 break;
372 writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * 446 case GPIO_U300_CONFIG_BIAS_PULL_UP:
373 U300_GPIO_PORTX_SPACING); 447 val = readl(U300_PIN_REG(offset, per));
448 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
449 break;
450 case GPIO_U300_CONFIG_DRIVE_PUSH_PULL:
451 val = readl(U300_PIN_REG(offset, pcr));
452 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
453 << ((offset & 0x07) << 1));
454 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
455 << ((offset & 0x07) << 1));
456 writel(val, U300_PIN_REG(offset, pcr));
457 break;
458 case GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN:
459 val = readl(U300_PIN_REG(offset, pcr));
460 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
461 << ((offset & 0x07) << 1));
462 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN
463 << ((offset & 0x07) << 1));
464 writel(val, U300_PIN_REG(offset, pcr));
465 break;
466 case GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE:
467 val = readl(U300_PIN_REG(offset, pcr));
468 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
469 << ((offset & 0x07) << 1));
470 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE
471 << ((offset & 0x07) << 1));
472 writel(val, U300_PIN_REG(offset, pcr));
473 break;
474 default:
475 local_irq_restore(flags);
476 dev_err(gpio->dev, "illegal configuration requested\n");
477 return -EINVAL;
478 }
374 local_irq_restore(flags); 479 local_irq_restore(flags);
375 return 0; 480 return 0;
376} 481}
377EXPORT_SYMBOL(gpio_direction_input);
378 482
379int gpio_direction_output(unsigned gpio, int value) 483static struct gpio_chip u300_gpio_chip = {
484 .label = "u300-gpio-chip",
485 .owner = THIS_MODULE,
486 .get = u300_gpio_get,
487 .set = u300_gpio_set,
488 .direction_input = u300_gpio_direction_input,
489 .direction_output = u300_gpio_direction_output,
490 .to_irq = u300_gpio_to_irq,
491};
492
493static void u300_toggle_trigger(struct u300_gpio *gpio, unsigned offset)
380{ 494{
381 unsigned long flags;
382 u32 val; 495 u32 val;
383 496
384 if (gpio > U300_GPIO_MAX) 497 val = readl(U300_PIN_REG(offset, icr));
385 return -EINVAL; 498 /* Set mode depending on state */
386 499 if (u300_gpio_get(&gpio->chip, offset)) {
387 local_irq_save(flags); 500 /* High now, let's trigger on falling edge next then */
388 val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * 501 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
389 U300_GPIO_PORTX_SPACING); 502 dev_dbg(gpio->dev, "next IRQ on falling edge on pin %d\n",
390 /* Mask out this pin */ 503 offset);
391 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1)); 504 } else {
392 /* 505 /* Low now, let's trigger on rising edge next then */
393 * FIXME: configure for push/pull, open drain or open source per pin 506 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
394 * in setup. The current driver will only support push/pull. 507 dev_dbg(gpio->dev, "next IRQ on rising edge on pin %d\n",
395 */ 508 offset);
396 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL 509 }
397 << ((gpio & 0x07) << 1));
398 writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
399 U300_GPIO_PORTX_SPACING);
400 gpio_set_value(gpio, value);
401 local_irq_restore(flags);
402 return 0;
403} 510}
404EXPORT_SYMBOL(gpio_direction_output);
405 511
406/* 512static int u300_gpio_irq_type(struct irq_data *d, unsigned trigger)
407 * Enable an IRQ, edge is rising edge (!= 0) or falling edge (==0).
408 */
409void enable_irq_on_gpio_pin(unsigned gpio, int edge)
410{ 513{
514 struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
515 struct u300_gpio *gpio = port->gpio;
516 int offset = d->irq - gpio->irq_base;
411 u32 val; 517 u32 val;
412 unsigned long flags;
413 local_irq_save(flags);
414 518
415 val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) * 519 if ((trigger & IRQF_TRIGGER_RISING) &&
416 U300_GPIO_PORTX_SPACING); 520 (trigger & IRQF_TRIGGER_FALLING)) {
417 val |= (1 << (gpio & 0x07)); 521 /*
418 writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) * 522 * The GPIO block can only trigger on falling OR rising edges,
419 U300_GPIO_PORTX_SPACING); 523 * not both. So we need to toggle the mode whenever the pin
420 val = readl(virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) * 524 * goes from one state to the other with a special state flag
421 U300_GPIO_PORTX_SPACING); 525 */
422 if (edge) 526 dev_dbg(gpio->dev,
423 val |= (1 << (gpio & 0x07)); 527 "trigger on both rising and falling edge on pin %d\n",
424 else 528 offset);
425 val &= ~(1 << (gpio & 0x07)); 529 port->toggle_edge_mode |= U300_PIN_BIT(offset);
426 writel(val, virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) * 530 u300_toggle_trigger(gpio, offset);
427 U300_GPIO_PORTX_SPACING); 531 } else if (trigger & IRQF_TRIGGER_RISING) {
428 local_irq_restore(flags); 532 dev_dbg(gpio->dev, "trigger on rising edge on pin %d\n",
533 offset);
534 val = readl(U300_PIN_REG(offset, icr));
535 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
536 port->toggle_edge_mode &= ~U300_PIN_BIT(offset);
537 } else if (trigger & IRQF_TRIGGER_FALLING) {
538 dev_dbg(gpio->dev, "trigger on falling edge on pin %d\n",
539 offset);
540 val = readl(U300_PIN_REG(offset, icr));
541 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
542 port->toggle_edge_mode &= ~U300_PIN_BIT(offset);
543 }
544
545 return 0;
429} 546}
430EXPORT_SYMBOL(enable_irq_on_gpio_pin);
431 547
432void disable_irq_on_gpio_pin(unsigned gpio) 548static void u300_gpio_irq_enable(struct irq_data *d)
433{ 549{
550 struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
551 struct u300_gpio *gpio = port->gpio;
552 int offset = d->irq - gpio->irq_base;
434 u32 val; 553 u32 val;
435 unsigned long flags; 554 unsigned long flags;
436 555
437 local_irq_save(flags); 556 local_irq_save(flags);
438 val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) * 557 val = readl(U300_PIN_REG(offset, ien));
439 U300_GPIO_PORTX_SPACING); 558 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
440 val &= ~(1 << (gpio & 0x07));
441 writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
442 U300_GPIO_PORTX_SPACING);
443 local_irq_restore(flags); 559 local_irq_restore(flags);
444} 560}
445EXPORT_SYMBOL(disable_irq_on_gpio_pin);
446 561
447/* Enable (value == 0) or disable (value == 1) internal pullup */ 562static void u300_gpio_irq_disable(struct irq_data *d)
448void gpio_pullup(unsigned gpio, int value)
449{ 563{
564 struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
565 struct u300_gpio *gpio = port->gpio;
566 int offset = d->irq - gpio->irq_base;
450 u32 val; 567 u32 val;
451 unsigned long flags; 568 unsigned long flags;
452 569
453 local_irq_save(flags); 570 local_irq_save(flags);
454 if (value) { 571 val = readl(U300_PIN_REG(offset, ien));
455 val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) * 572 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
456 U300_GPIO_PORTX_SPACING);
457 writel(val | (1 << (gpio & 0x07)), virtbase + U300_GPIO_PXPER +
458 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
459 } else {
460 val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) *
461 U300_GPIO_PORTX_SPACING);
462 writel(val & ~(1 << (gpio & 0x07)), virtbase + U300_GPIO_PXPER +
463 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
464 }
465 local_irq_restore(flags); 573 local_irq_restore(flags);
466} 574}
467EXPORT_SYMBOL(gpio_pullup);
468 575
469static irqreturn_t gpio_irq_handler(int irq, void *dev_id) 576static struct irq_chip u300_gpio_irqchip = {
577 .name = "u300-gpio-irqchip",
578 .irq_enable = u300_gpio_irq_enable,
579 .irq_disable = u300_gpio_irq_disable,
580 .irq_set_type = u300_gpio_irq_type,
581
582};
583
584static void u300_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
470{ 585{
471 struct u300_gpio_port *port = dev_id; 586 struct u300_gpio_port *port = irq_get_handler_data(irq);
472 u32 val; 587 struct u300_gpio *gpio = port->gpio;
473 int pin; 588 int pinoffset = port->number << 3; /* get the right stride */
589 unsigned long val;
474 590
591 desc->irq_data.chip->irq_ack(&desc->irq_data);
475 /* Read event register */ 592 /* Read event register */
476 val = readl(virtbase + U300_GPIO_PXIEV + port->number * 593 val = readl(U300_PIN_REG(pinoffset, iev));
477 U300_GPIO_PORTX_SPACING);
478 /* Mask with enable register */
479 val &= readl(virtbase + U300_GPIO_PXIEV + port->number *
480 U300_GPIO_PORTX_SPACING);
481 /* Mask relevant bits */ 594 /* Mask relevant bits */
482 val &= U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK; 595 val &= 0xFFU; /* 8 bits per port */
483 /* ACK IRQ (clear event) */ 596 /* ACK IRQ (clear event) */
484 writel(val, virtbase + U300_GPIO_PXIEV + port->number * 597 writel(val, U300_PIN_REG(pinoffset, iev));
485 U300_GPIO_PORTX_SPACING); 598
486 /* Print message */ 599 /* Call IRQ handler */
487 while (val != 0) { 600 if (val != 0) {
488 unsigned gpio; 601 int irqoffset;
489 602
490 pin = __ffs(val); 603 for_each_set_bit(irqoffset, &val, U300_GPIO_PINS_PER_PORT) {
491 /* mask off this pin */ 604 int pin_irq = gpio->irq_base + (port->number << 3)
492 val &= ~(1 << pin); 605 + irqoffset;
493 gpio = (port->number << 3) + pin; 606 int offset = pinoffset + irqoffset;
494 607
495 if (gpio_pin[gpio].callback) 608 dev_dbg(gpio->dev, "GPIO IRQ %d on pin %d\n",
496 (void)gpio_pin[gpio].callback(gpio_pin[gpio].data); 609 pin_irq, offset);
497 else 610 generic_handle_irq(pin_irq);
498 dev_dbg(gpiodev, "stray GPIO IRQ on line %d\n", 611 /*
499 gpio); 612 * Triggering IRQ on both rising and falling edge
613 * needs mockery
614 */
615 if (port->toggle_edge_mode & U300_PIN_BIT(offset))
616 u300_toggle_trigger(gpio, offset);
617 }
500 } 618 }
501 return IRQ_HANDLED; 619
620 desc->irq_data.chip->irq_unmask(&desc->irq_data);
502} 621}
503 622
504static void gpio_set_initial_values(void) 623static void __init u300_gpio_init_pin(struct u300_gpio *gpio,
624 int offset,
625 const struct u300_gpio_confdata *conf)
505{ 626{
506#ifdef U300_COH901571_3 627 /* Set mode: input or output */
507 int i, j; 628 if (conf->output) {
508 unsigned long flags; 629 u300_gpio_direction_output(&gpio->chip, offset, conf->outval);
509 u32 val;
510 630
511 /* Write default values to all pins */ 631 /* Deactivate bias mode for output */
512 for (i = 0; i < U300_GPIO_NUM_PORTS; i++) { 632 u300_gpio_config(&gpio->chip, offset,
513 val = 0; 633 GPIO_U300_CONFIG_BIAS_FLOAT,
514 for (j = 0; j < 8; j++) 634 NULL);
515 val |= (u32) (u300_gpio_config[i][j].default_output_value != DEFAULT_OUTPUT_LOW) << j; 635
516 local_irq_save(flags); 636 /* Set drive mode for output */
517 writel(val, virtbase + U300_GPIO_PXPDOR + i * U300_GPIO_PORTX_SPACING); 637 u300_gpio_config(&gpio->chip, offset,
518 local_irq_restore(flags); 638 GPIO_U300_CONFIG_DRIVE_PUSH_PULL, NULL);
639
640 dev_dbg(gpio->dev, "set up pin %d as output, value: %d\n",
641 offset, conf->outval);
642 } else {
643 u300_gpio_direction_input(&gpio->chip, offset);
644
645 /* Always set output low on input pins */
646 u300_gpio_set(&gpio->chip, offset, 0);
647
648 /* Set bias mode for input */
649 u300_gpio_config(&gpio->chip, offset, conf->bias_mode, NULL);
650
651 dev_dbg(gpio->dev, "set up pin %d as input, bias: %04x\n",
652 offset, conf->bias_mode);
519 } 653 }
654}
520 655
521 /* 656static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio,
522 * Put all pins that are set to either 'GPIO_OUT' or 'GPIO_NOT_USED' 657 struct u300_gpio_platform *plat)
523 * to output and 'GPIO_IN' to input for each port. And initialize 658{
524 * default value on outputs. 659 int i, j;
525 */ 660
526 for (i = 0; i < U300_GPIO_NUM_PORTS; i++) { 661 /* Write default config and values to all pins */
527 for (j = 0; j < U300_GPIO_PINS_PER_PORT; j++) { 662 for (i = 0; i < plat->ports; i++) {
528 local_irq_save(flags); 663 for (j = 0; j < 8; j++) {
529 val = readl(virtbase + U300_GPIO_PXPCR + 664 const struct u300_gpio_confdata *conf;
530 i * U300_GPIO_PORTX_SPACING); 665 int offset = (i*8) + j;
531 /* Mask out this pin */ 666
532 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << (j << 1)); 667 if (plat->variant == U300_GPIO_COH901571_3_BS335)
533 668 conf = &bs335_gpio_config[i][j];
534 if (u300_gpio_config[i][j].pin_usage != GPIO_IN) 669 else if (plat->variant == U300_GPIO_COH901571_3_BS365)
535 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL << (j << 1)); 670 conf = &bs365_gpio_config[i][j];
536 writel(val, virtbase + U300_GPIO_PXPCR + 671 else
537 i * U300_GPIO_PORTX_SPACING); 672 break;
538 local_irq_restore(flags); 673
674 u300_gpio_init_pin(gpio, offset, conf);
539 } 675 }
540 } 676 }
677}
541 678
542 /* Enable or disable the internal pull-ups in the GPIO ASIC block */ 679static inline void u300_gpio_free_ports(struct u300_gpio *gpio)
543 for (i = 0; i < U300_GPIO_MAX; i++) { 680{
544 val = 0; 681 struct u300_gpio_port *port;
545 for (j = 0; j < 8; j++) 682 struct list_head *p, *n;
546 val |= (u32)((u300_gpio_config[i][j].pull_up == DISABLE_PULL_UP) << j); 683
547 local_irq_save(flags); 684 list_for_each_safe(p, n, &gpio->port_list) {
548 writel(val, virtbase + U300_GPIO_PXPER + i * U300_GPIO_PORTX_SPACING); 685 port = list_entry(p, struct u300_gpio_port, node);
549 local_irq_restore(flags); 686 list_del(&port->node);
687 free_irq(port->irq, port);
688 kfree(port);
550 } 689 }
551#endif
552} 690}
553 691
554static int __init gpio_probe(struct platform_device *pdev) 692static int __init u300_gpio_probe(struct platform_device *pdev)
555{ 693{
556 u32 val; 694 struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
695 struct u300_gpio *gpio;
557 int err = 0; 696 int err = 0;
697 int portno;
698 u32 val;
699 u32 ifr;
558 int i; 700 int i;
559 int num_irqs;
560 701
561 gpiodev = &pdev->dev; 702 gpio = kzalloc(sizeof(struct u300_gpio), GFP_KERNEL);
562 memset(gpio_pin, 0, sizeof(gpio_pin)); 703 if (gpio == NULL) {
704 dev_err(&pdev->dev, "failed to allocate memory\n");
705 return -ENOMEM;
706 }
707
708 gpio->chip = u300_gpio_chip;
709 gpio->chip.ngpio = plat->ports * U300_GPIO_PINS_PER_PORT;
710 gpio->irq_base = plat->gpio_irq_base;
711 gpio->chip.dev = &pdev->dev;
712 gpio->chip.base = plat->gpio_base;
713 gpio->dev = &pdev->dev;
563 714
564 /* Get GPIO clock */ 715 /* Get GPIO clock */
565 clk = clk_get(&pdev->dev, NULL); 716 gpio->clk = clk_get(gpio->dev, NULL);
566 if (IS_ERR(clk)) { 717 if (IS_ERR(gpio->clk)) {
567 err = PTR_ERR(clk); 718 err = PTR_ERR(gpio->clk);
568 dev_err(gpiodev, "could not get GPIO clock\n"); 719 dev_err(gpio->dev, "could not get GPIO clock\n");
569 goto err_no_clk; 720 goto err_no_clk;
570 } 721 }
571 err = clk_enable(clk); 722 err = clk_enable(gpio->clk);
572 if (err) { 723 if (err) {
573 dev_err(gpiodev, "could not enable GPIO clock\n"); 724 dev_err(gpio->dev, "could not enable GPIO clock\n");
574 goto err_no_clk_enable; 725 goto err_no_clk_enable;
575 } 726 }
576 727
577 memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); 728 gpio->memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
578 if (!memres) 729 if (!gpio->memres) {
730 dev_err(gpio->dev, "could not get GPIO memory resource\n");
731 err = -ENODEV;
579 goto err_no_resource; 732 goto err_no_resource;
733 }
580 734
581 if (!request_mem_region(memres->start, resource_size(memres), 735 if (!request_mem_region(gpio->memres->start,
736 resource_size(gpio->memres),
582 "GPIO Controller")) { 737 "GPIO Controller")) {
583 err = -ENODEV; 738 err = -ENODEV;
584 goto err_no_ioregion; 739 goto err_no_ioregion;
585 } 740 }
586 741
587 virtbase = ioremap(memres->start, resource_size(memres)); 742 gpio->base = ioremap(gpio->memres->start, resource_size(gpio->memres));
588 if (!virtbase) { 743 if (!gpio->base) {
589 err = -ENOMEM; 744 err = -ENOMEM;
590 goto err_no_ioremap; 745 goto err_no_ioremap;
591 } 746 }
592 dev_info(gpiodev, "remapped 0x%08x to %p\n", 747
593 memres->start, virtbase); 748 if (plat->variant == U300_GPIO_COH901335) {
594 749 dev_info(gpio->dev,
595#ifdef U300_COH901335 750 "initializing GPIO Controller COH 901 335\n");
596 dev_info(gpiodev, "initializing GPIO Controller COH 901 335\n"); 751 gpio->stride = U300_335_PORT_STRIDE;
597 /* Turn on the GPIO block */ 752 gpio->pcr = U300_335_PXPCR;
598 writel(U300_GPIO_CR_BLOCK_CLOCK_ENABLE, virtbase + U300_GPIO_CR); 753 gpio->dor = U300_335_PXPDOR;
599#endif 754 gpio->dir = U300_335_PXPDIR;
600 755 gpio->per = U300_335_PXPER;
601#ifdef U300_COH901571_3 756 gpio->icr = U300_335_PXICR;
602 dev_info(gpiodev, "initializing GPIO Controller COH 901 571/3\n"); 757 gpio->ien = U300_335_PXIEN;
603 val = readl(virtbase + U300_GPIO_CR); 758 gpio->iev = U300_335_PXIEV;
604 dev_info(gpiodev, "COH901571/3 block version: %d, " \ 759 ifr = U300_335_PXIFR;
605 "number of cores: %d\n", 760
606 ((val & 0x0000FE00) >> 9), 761 /* Turn on the GPIO block */
607 ((val & 0x000001FC) >> 2)); 762 writel(U300_335_CR_BLOCK_CLOCK_ENABLE,
608 writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE, virtbase + U300_GPIO_CR); 763 gpio->base + U300_335_CR);
609#endif 764 } else if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
610 765 plat->variant == U300_GPIO_COH901571_3_BS365) {
611 gpio_set_initial_values(); 766 dev_info(gpio->dev,
612 767 "initializing GPIO Controller COH 901 571/3\n");
613 for (num_irqs = 0 ; num_irqs < U300_GPIO_NUM_PORTS; num_irqs++) { 768 gpio->stride = U300_571_PORT_STRIDE;
614 769 gpio->pcr = U300_571_PXPCR;
615 gpio_ports[num_irqs].irq = 770 gpio->dor = U300_571_PXPDOR;
616 platform_get_irq_byname(pdev, 771 gpio->dir = U300_571_PXPDIR;
617 gpio_ports[num_irqs].name); 772 gpio->per = U300_571_PXPER;
618 773 gpio->icr = U300_571_PXICR;
619 err = request_irq(gpio_ports[num_irqs].irq, 774 gpio->ien = U300_571_PXIEN;
620 gpio_irq_handler, IRQF_DISABLED, 775 gpio->iev = U300_571_PXIEV;
621 gpio_ports[num_irqs].name, 776 ifr = U300_571_PXIFR;
622 &gpio_ports[num_irqs]); 777
623 if (err) { 778 val = readl(gpio->base + U300_571_CR);
624 dev_err(gpiodev, "cannot allocate IRQ for %s!\n", 779 dev_info(gpio->dev, "COH901571/3 block version: %d, " \
625 gpio_ports[num_irqs].name); 780 "number of cores: %d totalling %d pins\n",
626 goto err_no_irq; 781 ((val & 0x000001FC) >> 2),
782 ((val & 0x0000FE00) >> 9),
783 ((val & 0x0000FE00) >> 9) * 8);
784 writel(U300_571_CR_BLOCK_CLKRQ_ENABLE,
785 gpio->base + U300_571_CR);
786 u300_gpio_init_coh901571(gpio, plat);
787 } else {
788 dev_err(gpio->dev, "unknown block variant\n");
789 err = -ENODEV;
790 goto err_unknown_variant;
791 }
792
793 /* Add each port with its IRQ separately */
794 INIT_LIST_HEAD(&gpio->port_list);
795 for (portno = 0 ; portno < plat->ports; portno++) {
796 struct u300_gpio_port *port =
797 kmalloc(sizeof(struct u300_gpio_port), GFP_KERNEL);
798
799 if (!port) {
800 dev_err(gpio->dev, "out of memory\n");
801 err = -ENOMEM;
802 goto err_no_port;
627 } 803 }
628 /* Turns off PortX_irq_force */ 804
629 writel(0x0, virtbase + U300_GPIO_PXIFR + 805 snprintf(port->name, 8, "gpio%d", portno);
630 num_irqs * U300_GPIO_PORTX_SPACING); 806 port->number = portno;
807 port->gpio = gpio;
808
809 port->irq = platform_get_irq_byname(pdev,
810 port->name);
811
812 dev_dbg(gpio->dev, "register IRQ %d for %s\n", port->irq,
813 port->name);
814
815 irq_set_chained_handler(port->irq, u300_gpio_irq_handler);
816 irq_set_handler_data(port->irq, port);
817
818 /* For each GPIO pin set the unique IRQ handler */
819 for (i = 0; i < U300_GPIO_PINS_PER_PORT; i++) {
820 int irqno = gpio->irq_base + (portno << 3) + i;
821
822 dev_dbg(gpio->dev, "handler for IRQ %d on %s\n",
823 irqno, port->name);
824 irq_set_chip_and_handler(irqno, &u300_gpio_irqchip,
825 handle_simple_irq);
826 set_irq_flags(irqno, IRQF_VALID);
827 irq_set_chip_data(irqno, port);
828 }
829
830 /* Turns off irq force (test register) for this port */
831 writel(0x0, gpio->base + portno * gpio->stride + ifr);
832
833 list_add_tail(&port->node, &gpio->port_list);
631 } 834 }
835 dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno);
836
837 err = gpiochip_add(&gpio->chip);
838 if (err) {
839 dev_err(gpio->dev, "unable to add gpiochip: %d\n", err);
840 goto err_no_chip;
841 }
842
843 platform_set_drvdata(pdev, gpio);
632 844
633 return 0; 845 return 0;
634 846
635 err_no_irq: 847err_no_chip:
636 for (i = 0; i < num_irqs; i++) 848err_no_port:
637 free_irq(gpio_ports[i].irq, &gpio_ports[i]); 849 u300_gpio_free_ports(gpio);
638 iounmap(virtbase); 850err_unknown_variant:
639 err_no_ioremap: 851 iounmap(gpio->base);
640 release_mem_region(memres->start, resource_size(memres)); 852err_no_ioremap:
641 err_no_ioregion: 853 release_mem_region(gpio->memres->start, resource_size(gpio->memres));
642 err_no_resource: 854err_no_ioregion:
643 clk_disable(clk); 855err_no_resource:
644 err_no_clk_enable: 856 clk_disable(gpio->clk);
645 clk_put(clk); 857err_no_clk_enable:
646 err_no_clk: 858 clk_put(gpio->clk);
647 dev_info(gpiodev, "module ERROR:%d\n", err); 859err_no_clk:
860 kfree(gpio);
861 dev_info(&pdev->dev, "module ERROR:%d\n", err);
648 return err; 862 return err;
649} 863}
650 864
651static int __exit gpio_remove(struct platform_device *pdev) 865static int __exit u300_gpio_remove(struct platform_device *pdev)
652{ 866{
653 int i; 867 struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
868 struct u300_gpio *gpio = platform_get_drvdata(pdev);
869 int err;
654 870
655 /* Turn off the GPIO block */ 871 /* Turn off the GPIO block */
656 writel(0x00000000U, virtbase + U300_GPIO_CR); 872 if (plat->variant == U300_GPIO_COH901335)
657 for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++) 873 writel(0x00000000U, gpio->base + U300_335_CR);
658 free_irq(gpio_ports[i].irq, &gpio_ports[i]); 874 if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
659 iounmap(virtbase); 875 plat->variant == U300_GPIO_COH901571_3_BS365)
660 release_mem_region(memres->start, resource_size(memres)); 876 writel(0x00000000U, gpio->base + U300_571_CR);
661 clk_disable(clk); 877
662 clk_put(clk); 878 err = gpiochip_remove(&gpio->chip);
879 if (err < 0) {
880 dev_err(gpio->dev, "unable to remove gpiochip: %d\n", err);
881 return err;
882 }
883 u300_gpio_free_ports(gpio);
884 iounmap(gpio->base);
885 release_mem_region(gpio->memres->start,
886 resource_size(gpio->memres));
887 clk_disable(gpio->clk);
888 clk_put(gpio->clk);
889 platform_set_drvdata(pdev, NULL);
890 kfree(gpio);
663 return 0; 891 return 0;
664} 892}
665 893
666static struct platform_driver gpio_driver = { 894static struct platform_driver u300_gpio_driver = {
667 .driver = { 895 .driver = {
668 .name = "u300-gpio", 896 .name = "u300-gpio",
669 }, 897 },
670 .remove = __exit_p(gpio_remove), 898 .remove = __exit_p(u300_gpio_remove),
671}; 899};
672 900
673 901
674static int __init u300_gpio_init(void) 902static int __init u300_gpio_init(void)
675{ 903{
676 return platform_driver_probe(&gpio_driver, gpio_probe); 904 return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe);
677} 905}
678 906
679static void __exit u300_gpio_exit(void) 907static void __exit u300_gpio_exit(void)
680{ 908{
681 platform_driver_unregister(&gpio_driver); 909 platform_driver_unregister(&u300_gpio_driver);
682} 910}
683 911
684arch_initcall(u300_gpio_init); 912arch_initcall(u300_gpio_init);
685module_exit(u300_gpio_exit); 913module_exit(u300_gpio_exit);
686 914
687MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); 915MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
688 916MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335/COH 901 571/3 GPIO driver");
689#ifdef U300_COH901571_3
690MODULE_DESCRIPTION("ST-Ericsson AB COH 901 571/3 GPIO driver");
691#endif
692
693#ifdef U300_COH901335
694MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335 GPIO driver");
695#endif
696
697MODULE_LICENSE("GPL"); 917MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
index 5d8aed5ec21b..c01e9519f6c1 100644
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -35,7 +35,7 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36 36
37#include <mach/hardware.h> /* Pick up IXP2000-specific bits */ 37#include <mach/hardware.h> /* Pick up IXP2000-specific bits */
38#include <mach/gpio.h> 38#include <mach/gpio-ixp2000.h>
39 39
40static inline int ixp2000_scl_pin(void *data) 40static inline int ixp2000_scl_pin(void *data)
41{ 41{
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index 000a78e5246c..6dede8f366c5 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -28,7 +28,7 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29 29
30#include <mach/board.h> 30#include <mach/board.h>
31#include <mach/gpio.h> 31#include <asm/gpio.h>
32#include <mach/at91sam9_smc.h> 32#include <mach/at91sam9_smc.h>
33 33
34#define DRV_NAME "at91_ide" 34#define DRV_NAME "at91_ide"
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 33d0bdc837c0..323bcdfff248 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -35,7 +35,7 @@
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <mach/gpio.h> 38#include <asm/gpio.h>
39#include <plat/keypad.h> 39#include <plat/keypad.h>
40#include <plat/menelaus.h> 40#include <plat/menelaus.h>
41#include <asm/irq.h> 41#include <asm/irq.h>
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index 9cee8e7f0bcb..af5d9d061371 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -44,7 +44,7 @@
44 44
45#include <asm/mach/irq.h> 45#include <asm/mach/irq.h>
46 46
47#include <mach/gpio.h> 47#include <asm/gpio.h>
48#include <plat/menelaus.h> 48#include <plat/menelaus.h>
49 49
50#define DRIVER_NAME "menelaus" 50#define DRIVER_NAME "menelaus"
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index a6c329040140..2dba999caf2c 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -33,7 +33,7 @@
33 33
34#include <plat/board.h> 34#include <plat/board.h>
35#include <plat/mmc.h> 35#include <plat/mmc.h>
36#include <mach/gpio.h> 36#include <asm/gpio.h>
37#include <plat/dma.h> 37#include <plat/dma.h>
38#include <plat/mux.h> 38#include <plat/mux.h>
39#include <plat/fpga.h> 39#include <plat/fpga.h>
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 18b0bd31de78..21b00cefae63 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -21,7 +21,9 @@
21#include <linux/mmc/card.h> 21#include <linux/mmc/card.h>
22#include <linux/mmc/host.h> 22#include <linux/mmc/host.h>
23 23
24#include <mach/gpio.h> 24#include <asm/gpio.h>
25
26#include <mach/gpio-tegra.h>
25#include <mach/sdhci.h> 27#include <mach/sdhci.h>
26 28
27#include "sdhci-pltfm.h" 29#include "sdhci-pltfm.h"
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 78017eb9318e..9e6b498c9beb 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -26,7 +26,7 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
29#include <mach/gpio.h> 29#include <asm/gpio.h>
30#include <plat/board-ams-delta.h> 30#include <plat/board-ams-delta.h>
31 31
32/* 32/*
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index a916dec29215..6a1d6d9a2df9 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -40,7 +40,7 @@
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41#include <plat/gpmc.h> 41#include <plat/gpmc.h>
42#include <plat/onenand.h> 42#include <plat/onenand.h>
43#include <mach/gpio.h> 43#include <asm/gpio.h>
44 44
45#include <plat/dma.h> 45#include <plat/dma.h>
46 46
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c
index 29dc43523cec..48b4ec121f7f 100644
--- a/drivers/net/arm/at91_ether.c
+++ b/drivers/net/arm/at91_ether.c
@@ -35,7 +35,7 @@
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36 36
37#include <mach/at91rm9200_emac.h> 37#include <mach/at91rm9200_emac.h>
38#include <mach/gpio.h> 38#include <asm/gpio.h>
39#include <mach/board.h> 39#include <mach/board.h>
40 40
41#include "at91_ether.h" 41#include "at91_ether.h"
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
index e956f659089a..66ab92cf3105 100644
--- a/drivers/pcmcia/pxa2xx_vpac270.c
+++ b/drivers/pcmcia/pxa2xx_vpac270.c
@@ -17,7 +17,7 @@
17 17
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19 19
20#include <mach/gpio.h> 20#include <asm/gpio.h>
21#include <mach/vpac270.h> 21#include <mach/vpac270.h>
22 22
23#include "soc_common.h" 23#include "soc_common.h"
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 82dee9a6c0de..d3bff424286f 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -22,7 +22,7 @@
22 22
23#include <asm/io.h> 23#include <asm/io.h>
24#include <mach/board.h> 24#include <mach/board.h>
25#include <mach/gpio.h> 25#include <asm/gpio.h>
26#include <mach/cpu.h> 26#include <mach/cpu.h>
27 27
28/* SPI register offsets */ 28/* SPI register offsets */
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index b922f5d2e61e..caba6730a943 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -46,7 +46,7 @@
46 46
47#ifdef CONFIG_ARM 47#ifdef CONFIG_ARM
48#include <mach/cpu.h> 48#include <mach/cpu.h>
49#include <mach/gpio.h> 49#include <asm/gpio.h>
50#endif 50#endif
51 51
52#define PDC_BUFFER_SIZE 512 52#define PDC_BUFFER_SIZE 512
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 653d6a60edb5..d1b41933199e 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -26,7 +26,7 @@
26 26
27#include <mach/platform.h> 27#include <mach/platform.h>
28#include <mach/irqs.h> 28#include <mach/irqs.h>
29#include <mach/gpio.h> 29#include <asm/gpio.h>
30 30
31#define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64) 31#define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64)
32 32
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 8bdf25a8b023..f9a3f62a83b5 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -35,7 +35,7 @@
35 35
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <mach/memory.h> 37#include <mach/memory.h>
38#include <mach/gpio.h> 38#include <asm/gpio.h>
39#include <mach/cputype.h> 39#include <mach/cputype.h>
40 40
41#include <asm/mach-types.h> 41#include <asm/mach-types.h>
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 817ab60f7537..dda920623c6a 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -21,7 +21,7 @@
21 21
22#include <mach/board.h> 22#include <mach/board.h>
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24#include <mach/gpio.h> 24#include <asm/gpio.h>
25 25
26#include <video/atmel_lcdc.h> 26#include <video/atmel_lcdc.h>
27 27
diff --git a/drivers/video/omap/lcd_apollon.c b/drivers/video/omap/lcd_apollon.c
index 10459d8bd9a0..4b24f549f9b9 100644
--- a/drivers/video/omap/lcd_apollon.c
+++ b/drivers/video/omap/lcd_apollon.c
@@ -24,7 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26 26
27#include <mach/gpio.h> 27#include <asm/gpio.h>
28 28
29#include "omapfb.h" 29#include "omapfb.h"
30 30
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
index 8df688748b5a..622ad839fd9d 100644
--- a/drivers/video/omap/lcd_h3.c
+++ b/drivers/video/omap/lcd_h3.c
@@ -23,7 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/i2c/tps65010.h> 24#include <linux/i2c/tps65010.h>
25 25
26#include <mach/gpio.h> 26#include <asm/gpio.h>
27#include "omapfb.h" 27#include "omapfb.h"
28 28
29#define MODULE_NAME "omapfb-lcd_h3" 29#define MODULE_NAME "omapfb-lcd_h3"
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index 9fff86f67bde..12cc52a70f96 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -22,7 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25#include <mach/gpio.h> 25#include <asm/gpio.h>
26#include "omapfb.h" 26#include "omapfb.h"
27 27
28#define MODULE_NAME "omapfb-lcd_h3" 28#define MODULE_NAME "omapfb-lcd_h3"
diff --git a/drivers/video/omap/lcd_ldp.c b/drivers/video/omap/lcd_ldp.c
index 0f5952cae85e..062466402c0e 100644
--- a/drivers/video/omap/lcd_ldp.c
+++ b/drivers/video/omap/lcd_ldp.c
@@ -26,7 +26,7 @@
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/i2c/twl.h> 27#include <linux/i2c/twl.h>
28 28
29#include <mach/gpio.h> 29#include <asm/gpio.h>
30#include <plat/mux.h> 30#include <plat/mux.h>
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32 32
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
index b87e8b83f29c..6f8d13c41202 100644
--- a/drivers/video/omap/lcd_osk.c
+++ b/drivers/video/omap/lcd_osk.c
@@ -23,7 +23,7 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26#include <mach/gpio.h> 26#include <asm/gpio.h>
27#include <plat/mux.h> 27#include <plat/mux.h>
28#include "omapfb.h" 28#include "omapfb.h"
29 29
diff --git a/drivers/video/omap/lcd_overo.c b/drivers/video/omap/lcd_overo.c
index 564933ffac6e..b8fd5b2ec29c 100644
--- a/drivers/video/omap/lcd_overo.c
+++ b/drivers/video/omap/lcd_overo.c
@@ -23,7 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/i2c/twl.h> 24#include <linux/i2c/twl.h>
25 25
26#include <mach/gpio.h> 26#include <asm/gpio.h>
27#include <plat/mux.h> 27#include <plat/mux.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29 29
diff --git a/drivers/video/omap/lcd_palmtt.c b/drivers/video/omap/lcd_palmtt.c
index ff0e6d7ab3a2..b51b332e5a2b 100644
--- a/drivers/video/omap/lcd_palmtt.c
+++ b/drivers/video/omap/lcd_palmtt.c
@@ -29,7 +29,7 @@ GPIO13 - screen blanking
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/io.h> 30#include <linux/io.h>
31 31
32#include <mach/gpio.h> 32#include <asm/gpio.h>
33#include "omapfb.h" 33#include "omapfb.h"
34 34
35static int palmtt_panel_init(struct lcd_panel *panel, 35static int palmtt_panel_init(struct lcd_panel *panel,
diff --git a/drivers/video/pnx4008/sdum.c b/drivers/video/pnx4008/sdum.c
index 5ec4f2d439c9..50e00395240f 100644
--- a/drivers/video/pnx4008/sdum.c
+++ b/drivers/video/pnx4008/sdum.c
@@ -30,7 +30,7 @@
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/gfp.h> 31#include <linux/gfp.h>
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <mach/gpio.h> 33#include <asm/gpio.h>
34 34
35#include "sdum.h" 35#include "sdum.h"
36#include "fbcommon.h" 36#include "fbcommon.h"