]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'depends/rmk/gpio' into next/fixes
authorArnd Bergmann <arnd@arndb.de>
Mon, 31 Oct 2011 21:44:18 +0000 (22:44 +0100)
committerArnd Bergmann <arnd@arndb.de>
Mon, 31 Oct 2011 21:44:18 +0000 (22:44 +0100)
This sorts out merge conflicts with the arm/gpio branch that
already got merged into mainline Linux.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
256 files changed:
arch/arm/Kconfig
arch/arm/common/scoop.c
arch/arm/include/asm/gpio.h
arch/arm/include/asm/hardware/iop3xx-gpio.h
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91rm9200_devices.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
arch/arm/mach-at91/board-1arm.c
arch/arm/mach-at91/board-afeb-9260v1.c
arch/arm/mach-at91/board-cam60.c
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-carmeva.c
arch/arm/mach-at91/board-cpu9krea.c
arch/arm/mach-at91/board-cpuat91.c
arch/arm/mach-at91/board-csb337.c
arch/arm/mach-at91/board-csb637.c
arch/arm/mach-at91/board-eb9200.c
arch/arm/mach-at91/board-ecbat91.c
arch/arm/mach-at91/board-kafa.c
arch/arm/mach-at91/board-kb9202.c
arch/arm/mach-at91/board-neocore926.c
arch/arm/mach-at91/board-picotux200.c
arch/arm/mach-at91/board-qil-a9260.c
arch/arm/mach-at91/board-rm9200dk.c
arch/arm/mach-at91/board-rm9200ek.c
arch/arm/mach-at91/board-sam9-l9260.c
arch/arm/mach-at91/board-sam9260ek.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9g20ek.c
arch/arm/mach-at91/board-sam9m10g45ek.c
arch/arm/mach-at91/board-sam9rlek.c
arch/arm/mach-at91/board-usb-a9260.c
arch/arm/mach-at91/board-usb-a9263.c
arch/arm/mach-at91/board-yl-9200.c
arch/arm/mach-at91/gpio.c
arch/arm/mach-at91/include/mach/gpio.h
arch/arm/mach-at91/leds.c
arch/arm/mach-at91/pm.c
arch/arm/mach-davinci/Makefile
arch/arm/mach-davinci/da830.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/include/mach/gpio-davinci.h [new file with mode: 0644]
arch/arm/mach-davinci/include/mach/gpio.h
arch/arm/mach-davinci/tnetv107x.c
arch/arm/mach-ep93xx/core.c
arch/arm/mach-ep93xx/edb93xx.c
arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h [moved from arch/arm/mach-ep93xx/include/mach/gpio.h with 87% similarity]
arch/arm/mach-ep93xx/simone.c
arch/arm/mach-ep93xx/snappercl15.c
arch/arm/mach-exynos4/include/mach/gpio.h
arch/arm/mach-gemini/include/mach/gpio.h
arch/arm/mach-imx/iomux-imx31.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-ixp2000/core.c
arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h [moved from arch/arm/mach-ixp2000/include/mach/gpio.h with 95% similarity]
arch/arm/mach-ixp2000/ixdp2x00.c
arch/arm/mach-ixp4xx/dsmg600-setup.c
arch/arm/mach-ixp4xx/fsg-setup.c
arch/arm/mach-ixp4xx/include/mach/gpio.h
arch/arm/mach-ixp4xx/nas100d-setup.c
arch/arm/mach-ixp4xx/nslu2-setup.c
arch/arm/mach-kirkwood/irq.c
arch/arm/mach-kirkwood/mpp.c
arch/arm/mach-ks8695/Makefile
arch/arm/mach-ks8695/board-acs5k.c
arch/arm/mach-ks8695/board-dsm320.c
arch/arm/mach-ks8695/board-micrel.c
arch/arm/mach-ks8695/devices.c
arch/arm/mach-ks8695/include/mach/gpio-ks8695.h [new file with mode: 0644]
arch/arm/mach-ks8695/include/mach/gpio.h
arch/arm/mach-ks8695/leds.c
arch/arm/mach-lpc32xx/Makefile
arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h [new file with mode: 0644]
arch/arm/mach-lpc32xx/include/mach/gpio.h
arch/arm/mach-lpc32xx/phy3250.c
arch/arm/mach-mmp/aspenite.c
arch/arm/mach-mmp/brownstone.c
arch/arm/mach-mmp/gplugd.c
arch/arm/mach-mmp/include/mach/gpio-pxa.h [new file with mode: 0644]
arch/arm/mach-mmp/include/mach/gpio.h
arch/arm/mach-mmp/jasper.c
arch/arm/mach-mmp/mmp2.c
arch/arm/mach-mmp/pxa168.c
arch/arm/mach-mmp/pxa910.c
arch/arm/mach-mmp/tavorevb.c
arch/arm/mach-msm/board-msm7x27.c
arch/arm/mach-msm/board-msm7x30.c
arch/arm/mach-msm/board-qsd8x50.c
arch/arm/mach-msm/board-sapphire.c
arch/arm/mach-msm/board-trout-mmc.c
arch/arm/mach-msm/board-trout-panel.c
arch/arm/mach-msm/include/mach/gpio.h
arch/arm/mach-mv78xx0/irq.c
arch/arm/mach-mv78xx0/mpp.c
arch/arm/mach-mxs/include/mach/gpio.h
arch/arm/mach-nomadik/board-nhk8815.c
arch/arm/mach-nomadik/cpu-8815.c
arch/arm/mach-nomadik/i2c-8815nhk.c
arch/arm/mach-nomadik/include/mach/gpio.h
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-fsample.c
arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2-mmc.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3-mmc.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-htcherald.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmtt.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap1/board-sx1-mmc.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap1/devices.c
arch/arm/mach-omap1/fpga.c
arch/arm/mach-omap1/irq.c
arch/arm/mach-omap1/leds-h2p2-debug.c
arch/arm/mach-omap1/leds-osk.c
arch/arm/mach-omap1/leds.c
arch/arm/mach-omap1/serial.c
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/board-ldp.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-orion5x/db88f5281-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/irq.c
arch/arm/mach-orion5x/kurobox_pro-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/rd88f5182-setup.c
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
arch/arm/mach-orion5x/terastation_pro2-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-pnx4008/gpio.c
arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h [moved from arch/arm/mach-pnx4008/include/mach/gpio.h with 99% similarity]
arch/arm/mach-pnx4008/serial.c
arch/arm/mach-pxa/cm-x255.c
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/include/mach/gpio-pxa.h [new file with mode: 0644]
arch/arm/mach-pxa/include/mach/gpio.h
arch/arm/mach-pxa/include/mach/littleton.h
arch/arm/mach-pxa/irq.c
arch/arm/mach-pxa/lpd270.c
arch/arm/mach-pxa/lubbock.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/mfp-pxa2xx.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa3xx.c
arch/arm/mach-pxa/pxa95x.c
arch/arm/mach-pxa/saarb.c
arch/arm/mach-realview/include/mach/gpio.h
arch/arm/mach-s3c2410/include/mach/gpio.h
arch/arm/mach-s3c2410/include/mach/h1940-latch.h
arch/arm/mach-s3c64xx/include/mach/gpio.h
arch/arm/mach-s5p64x0/include/mach/gpio.h
arch/arm/mach-s5pc100/include/mach/gpio.h
arch/arm/mach-s5pv210/include/mach/gpio.h
arch/arm/mach-sa1100/Makefile
arch/arm/mach-sa1100/generic.c
arch/arm/mach-sa1100/include/mach/gpio.h
arch/arm/mach-shmobile/include/mach/gpio.h
arch/arm/mach-tegra/board-harmony-pcie.c
arch/arm/mach-tegra/board-harmony.h
arch/arm/mach-tegra/board-paz00.h
arch/arm/mach-tegra/board-seaboard.h
arch/arm/mach-tegra/board-trimslice-pinmux.c
arch/arm/mach-tegra/board-trimslice.h
arch/arm/mach-tegra/include/mach/gpio-tegra.h [new file with mode: 0644]
arch/arm/mach-tegra/include/mach/gpio.h
arch/arm/mach-tegra/usb_phy.c
arch/arm/mach-u300/Kconfig
arch/arm/mach-u300/core.c
arch/arm/mach-u300/include/mach/gpio-u300.h [new file with mode: 0644]
arch/arm/mach-u300/include/mach/gpio.h
arch/arm/mach-u300/include/mach/irqs.h
arch/arm/mach-u300/mmc.c
arch/arm/mach-ux500/board-mop500-pins.c
arch/arm/mach-ux500/board-mop500-u8500uib.c
arch/arm/mach-ux500/board-mop500.c
arch/arm/mach-ux500/board-u5500-sdi.c
arch/arm/mach-ux500/board-u5500.c
arch/arm/mach-ux500/cpu-db5500.c
arch/arm/mach-ux500/cpu-db8500.c
arch/arm/mach-ux500/devices-common.c
arch/arm/mach-ux500/include/mach/gpio.h
arch/arm/mach-versatile/include/mach/gpio.h
arch/arm/mach-vt8500/include/mach/gpio.h
arch/arm/mach-w90x900/include/mach/gpio.h
arch/arm/plat-mxc/include/mach/gpio.h
arch/arm/plat-nomadik/include/plat/gpio-nomadik.h [moved from arch/arm/plat-nomadik/include/plat/gpio.h with 82% similarity]
arch/arm/plat-omap/debug-devices.c
arch/arm/plat-omap/debug-leds.c
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/include/plat/gpio.h
arch/arm/plat-orion/include/plat/gpio.h
arch/arm/plat-pxa/Makefile
arch/arm/plat-pxa/include/plat/gpio-pxa.h [new file with mode: 0644]
arch/arm/plat-pxa/include/plat/gpio.h
arch/arm/plat-spear/include/plat/gpio.h
drivers/ata/pata_at91.c
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-davinci.c [moved from arch/arm/mach-davinci/gpio.c with 98% similarity]
drivers/gpio/gpio-ep93xx.c
drivers/gpio/gpio-ks8695.c [moved from arch/arm/mach-ks8695/gpio.c with 99% similarity]
drivers/gpio/gpio-lpc32xx.c [moved from arch/arm/mach-lpc32xx/gpiolib.c with 99% similarity]
drivers/gpio/gpio-nomadik.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-pxa.c [moved from arch/arm/plat-pxa/gpio.c with 99% similarity]
drivers/gpio/gpio-sa1100.c [moved from arch/arm/mach-sa1100/gpio.c with 96% similarity]
drivers/gpio/gpio-tegra.c
drivers/gpio/gpio-tnetv107x.c [moved from arch/arm/mach-davinci/gpio-tnetv107x.c with 100% similarity]
drivers/gpio/gpio-u300.c
drivers/i2c/busses/i2c-ixp2000.c
drivers/ide/at91_ide.c
drivers/input/keyboard/omap-keypad.c
drivers/mfd/menelaus.c
drivers/mmc/host/omap.c
drivers/mmc/host/sdhci-tegra.c
drivers/mtd/nand/ams-delta.c
drivers/mtd/onenand/omap2.c
drivers/net/arm/at91_ether.c
drivers/pcmcia/pxa2xx_vpac270.c
drivers/spi/spi-atmel.c
drivers/tty/serial/atmel_serial.c
drivers/usb/host/ohci-pnx4008.c
drivers/usb/musb/davinci.c
drivers/video/atmel_lcdfb.c
drivers/video/omap/lcd_apollon.c
drivers/video/omap/lcd_h3.c
drivers/video/omap/lcd_inn1610.c
drivers/video/omap/lcd_ldp.c
drivers/video/omap/lcd_osk.c
drivers/video/omap/lcd_overo.c
drivers/video/omap/lcd_palmtt.c
drivers/video/pnx4008/sdum.c

index e1050a766a01c9db93a5f122468c21e15fae7ff1..cbb18264cdce6b39b4e25829ae362218902185c6 100644 (file)
@@ -835,6 +835,7 @@ config ARCH_U300
        select CLKDEV_LOOKUP
        select HAVE_MACH_CLKDEV
        select GENERIC_GPIO
+       select ARCH_REQUIRE_GPIOLIB
        help
          Support for ST-Ericsson U300 series mobile platforms.
 
index a07b0e763a805109c007161d46efd6df5f45d6b6..1cde34a080d7e688efbf019aae2e55f8e20895c2 100644 (file)
  */
 
 #include <linux/device.h>
+#include <linux/gpio.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <asm/gpio.h>
 #include <asm/hardware/scoop.h>
 
 /* PCMCIA to Scoop linkage
index 166a7a3e28400db64062715a53bdb2f31d4e9df4..11ad0bfbb0ad67ca3c3865d25a216b22a13c10f5 100644 (file)
@@ -4,4 +4,23 @@
 /* not all ARM platforms necessarily support this API ... */
 #include <mach/gpio.h>
 
+#ifndef __ARM_GPIOLIB_COMPLEX
+/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
+#include <asm-generic/gpio.h>
+
+/* The trivial gpiolib dispatchers */
+#define gpio_get_value  __gpio_get_value
+#define gpio_set_value  __gpio_set_value
+#define gpio_cansleep   __gpio_cansleep
+#endif
+
+/*
+ * Provide a default gpio_to_irq() which should satisfy every case.
+ * However, some platforms want to do this differently, so allow them
+ * to override it.
+ */
+#ifndef gpio_to_irq
+#define gpio_to_irq    __gpio_to_irq
+#endif
+
 #endif /* _ARCH_ARM_GPIO_H */
index b69d972b1f7d21987c2ca86c7119cb101767f75d..9eda7dc92ad8d79c2214ac1ba472fa9e29c2357f 100644 (file)
@@ -28,6 +28,8 @@
 #include <mach/hardware.h>
 #include <asm-generic/gpio.h>
 
+#define __ARM_GPIOLIB_COMPLEX
+
 #define IOP3XX_N_GPIOS 8
 
 static inline int gpio_get_value(unsigned gpio)
index dba0d8d8a4bd185dd96054cbc466b9a2a6c825d7..f87f5040e78ef18d7e2fca5b355684e9b121bc3e 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/mach/irq.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -23,7 +24,6 @@
 
 #include <mach/board.h>
 #include <mach/cpu.h>
-#include <mach/gpio.h>
 #include <mach/at91cap9.h>
 #include <mach/at91cap9_matrix.h>
 #include <mach/at91sam9_smc.h>
index 7227755ffec643fae52b92ebd71844581fb1ed92..978be950035acb0f9fd4b21c19a3f6e6f11521af 100644 (file)
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200.h>
 #include <mach/at91rm9200_mc.h>
 
index 39f81f47b4ba4d4fe12c02e852cae1afb97b661b..a53b3de9daa2ca33a9086af7e9dd43429da35557 100644 (file)
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 #include <mach/at91sam9260.h>
 #include <mach/at91sam9260_matrix.h>
index 0f917928eeb7782510f7b590d8e627a8b319795a..4e647b653339d4dc64f31302078036ffe85310cb 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -21,7 +22,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9261.h>
 #include <mach/at91sam9261_matrix.h>
 #include <mach/at91sam9_smc.h>
index a050f41fc860d7698b2a8ba83b29221f14805d22..dd7662bc395f5b319be704007262ece04ab715b7 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -20,7 +21,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9263.h>
 #include <mach/at91sam9263_matrix.h>
 #include <mach/at91sam9_smc.h>
index 600bffb01edb9b056f0e45cdb0bbf5960f1cea6a..c3dfb1b3b1e3a6032e554c273f05bf81699579a8 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 #include <linux/atmel-mci.h>
@@ -21,7 +22,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9g45.h>
 #include <mach/at91sam9g45_matrix.h>
 #include <mach/at91sam9_smc.h>
index aacb19dc9225a7c90554ee6e03e7610d90df57cb..305a851b5bff950f60b374fc5ab709f51bbebdaf 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/mach/map.h>
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/i2c-gpio.h>
 
@@ -17,7 +18,6 @@
 #include <video/atmel_lcdc.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9rl.h>
 #include <mach/at91sam9rl_matrix.h>
 #include <mach/at91sam9_smc.h>
index 5aa58851eb394b43c1c0f972465e766d5bab4a38..367d5cd5e36288c1c5395aedc6eaec91e2138ccf 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -34,7 +35,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index b0c796d42e495bf1158da2d19fda3c8cb0bf90dc..0487ea10c2d68bce193eb29c83058e34f3d55550 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -43,7 +44,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index d1abd5898e85bb53c8f48b9c703f393a9f86776c..747b2eaa9737c134ffcb81006b9b5a807087a3d3 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -38,7 +39,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #include "sam9_smc.h"
index 679b0b743e9277d1e7994c314359f5db6a844603..062670351a6a11b9f82551378cdb00dc2675de44 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -41,7 +42,6 @@
 #include <asm/mach/map.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91cap9_matrix.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/system_rev.h>
index c578c5d9072887334e3a4e354de5d80b0fa18c8d..774c87fcbd5b8f0ee355bf7b9d7c84822eb95ac9 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -35,7 +36,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index f4da8a16d5dc14fa0c558bb2b66e2392a2d150e7..fc885a4ce243fbedce8461435cf966c859f68886 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -40,7 +41,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91sam9260_matrix.h>
 
index 2d919f5a4f571cfcfcf884c13d8a4465cfd88e02..d35e65b08ccde481aeac88978fd83d7ca1a329c1 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -36,7 +37,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 #include <mach/cpu.h>
 
index 17654d5e94e6fd3aefe8055227246e9222878c3c..c3936665e6457715dedaccb0a8b0be0e0fc5f936 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -38,7 +39,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index 72b55674616c30d0ab08b0f465e5fc891744d94c..586100e2acbbb5b54c3820b0acd34dafc14f23df 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/types.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -35,7 +36,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index 01170a2766a82e5169b0ef35ae8dacc94867a9ae..45db7a3dbef01b960caa77ff7495a3096a9308bd 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -35,7 +36,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 #include "generic.h"
 
index 7c0313c51f2673f8491ebb97e681c1b21a2cef35..2f9c16d29212332f195c85ae7e6e7bc7b3e814c2 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -37,7 +38,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index 4a170890b3b1c9976036d4e527c91c9370550ac9..3bae73e636332fc5ccfef18b6e02c09915728b2d 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -34,7 +35,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index 9dc8d496ead1bfa6c796c8fc445c23c76f944a28..15a3f1a87ab05f9253dce15afc1bdb4746180665 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -35,7 +36,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 #include <mach/at91rm9200_mc.h>
 
index 9bc6ab32e0acd2bb9b7d3f60ebd8c0a77d8980b3..6094496f7edb3344843cc32b88ff28acdbefde97 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -44,7 +45,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #include "sam9_smc.h"
index b7b8390e8a00b732f882fefd3b64673880de285d..0a8fe6a1b7c8a8a606241f46d8a0a2ff133a75e7 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -37,7 +38,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
index 81f911033681004be055a80a84ded42874644af5..938cc390bea3099c59f67a8988fc3fddfe7c9925 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -40,7 +41,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 6f08faadb4742b8faef2de1f84e90cb5ca137454..b4ac30e38a9e396102a7a466cd8fb25fc2d05cee 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -39,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
index 85bcccd7b9e40118b7c8a72eb12c64609d38c287..99fd7f8aee0e0f378583365575d3be4bd9127bfe 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -39,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
index 4d3a02f1289e87fd9c025170240364d4ef2f7a44..2a21e790250e5bcb9baeb2a0588ce37ed68c526a 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -37,7 +38,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #include "sam9_smc.h"
index 8a50c3e67186f1e8b8d4b0a962ab245aac6d51d6..89c8b579bfda2949cc47c43b7bec46e5bb1efbcc 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -41,7 +42,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index 5096a0ec50c13c8a64ab041b064e960c5f4aa0d4..3741f43cdae908c9fca1836c48215a812bd07555 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -45,7 +46,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index ea8f185d3b9d342b7cdcf19e1c8bff5e54af0574..a580dd451a41549be5dce7ecfa584da7f2ec5081 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -44,7 +45,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index 817f59d7251bcc9dfc8ab9dbae37c18b85f840d2..8d77c2ff96b2bc3351bd3dc0c237e7e8397fa176 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -41,7 +42,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/system_rev.h>
 
index ad234ccbf57e5214d8e0ebb0eec63a00fa80ef68..2d6203ac1a42f87c0bb4b8a3c5774ed7e11e0be1 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -38,7 +39,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 #include <mach/system_rev.h>
index 4f14b54b93a88278bef0ad5ab854d3bd497cce92..39a28effc3df9d2443211e769c7d7de72508957d 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -30,7 +31,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 8c4c1a02c4bebb45e8b11bb22905a744975f0f75..bac9b65cf5518427e32a624f3735f3d2fc26261a 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -40,7 +41,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 25e793782a4e94c3ac49f9f9bc1c3a71a7c60d22..5bd735787d6d6b15c1a7b8a82ab0427f324b1271 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -39,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91sam9_smc.h>
 #include <mach/at91_shdwc.h>
 
index 95edcbd2aec64c0107e8dab5ca233706af65ca76..3c288b396fc4333caca5d1b0710ec9037ffca464 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/module.h>
@@ -43,7 +44,6 @@
 
 #include <mach/hardware.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
 #include <mach/cpu.h>
 
index 4615528205c8329522b360b3b95e4fee4e89279c..224e9e2f867453bd85b08b371edf888f961d6e6e 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/clk.h>
 #include <linux/errno.h>
+#include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/debugfs.h>
@@ -22,9 +23,6 @@
 
 #include <mach/hardware.h>
 #include <mach/at91_pio.h>
-#include <mach/gpio.h>
-
-#include <asm/gpio.h>
 
 #include "generic.h"
 
index 056dc6674b6bf74c649cabe60204ebbf01ff9a03..2b9a1f51210f0cc048048410bd9e801883e04bc9 100644 (file)
@@ -214,11 +214,6 @@ extern void at91_gpio_resume(void);
  */
 
 #include <asm/errno.h>
-#include <asm-generic/gpio.h>          /* cansleep wrappers */
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
 
 #define gpio_to_irq(gpio) (gpio)
 #define irq_to_gpio(irq)  (irq)
index 0415a839e1ad9319944a662b409799015f9fde3d..8dfafe76ffe6298f822ad2b4d3ea64ebf0243337 100644 (file)
@@ -9,13 +9,13 @@
  * 2 of the License, or (at your option) any later version.
 */
 
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
 
 
 /* ------------------------------------------------------------------------- */
index 4159eca78945360b8b9a4fc5630ba5ddab7e07a8..7046158109d7cd581776466798becc3abbe83f47 100644 (file)
@@ -10,6 +10,7 @@
  * (at your option) any later version.
  */
 
+#include <linux/gpio.h>
 #include <linux/suspend.h>
 #include <linux/sched.h>
 #include <linux/proc_fs.h>
@@ -25,7 +26,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/at91_pmc.h>
-#include <mach/gpio.h>
 #include <mach/cpu.h>
 
 #include "generic.h"
index 0b87a1ca2bb3a187c78a6b20b68f7c8bb66c2288..495e31306fc00a213f3084daf20894bfa94c53bd 100644 (file)
@@ -5,7 +5,7 @@
 
 # Common objects
 obj-y                  := time.o clock.o serial.o io.o psc.o \
-                          gpio.o dma.o usb.o common.o sram.o aemif.o
+                          dma.o usb.o common.o sram.o aemif.o
 
 obj-$(CONFIG_DAVINCI_MUX)              += mux.o
 
@@ -17,7 +17,6 @@ obj-$(CONFIG_ARCH_DAVINCI_DM365)      += dm365.o devices.o
 obj-$(CONFIG_ARCH_DAVINCI_DA830)        += da830.o devices-da8xx.o
 obj-$(CONFIG_ARCH_DAVINCI_DA850)        += da850.o devices-da8xx.o
 obj-$(CONFIG_ARCH_DAVINCI_TNETV107X)    += tnetv107x.o devices-tnetv107x.o
-obj-$(CONFIG_ARCH_DAVINCI_TNETV107X)    += gpio-tnetv107x.o
 
 obj-$(CONFIG_AINTC)                    += irq.o
 obj-$(CONFIG_CP_INTC)                  += cp_intc.o
index 2ed2f822fc40ca1e79448038c279b3910fe14ab7..a6bf5dcaef1341863d614412fe3bc29275f44a47 100644 (file)
@@ -8,6 +8,7 @@
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/clk.h>
 
@@ -19,7 +20,7 @@
 #include <mach/common.h>
 #include <mach/time.h>
 #include <mach/da8xx.h>
-#include <mach/gpio.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 935dbed5c541ccea2e1d4bbe5e059dfd6295ac03..4aae01576aaba3bdfa667e2ee63db759933b3f64 100644 (file)
@@ -11,6 +11,7 @@
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/clk.h>
 #include <linux/platform_device.h>
@@ -27,7 +28,7 @@
 #include <mach/da8xx.h>
 #include <mach/cpufreq.h>
 #include <mach/pm.h>
-#include <mach/gpio.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index a3a94e9c93784b10a6d98c3b379a680def7641e2..c143f43addccc2590f5f7cc384ab487425312459 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/gpio.h>
 
 #include <linux/spi/spi.h>
 
@@ -30,6 +29,7 @@
 #include <mach/common.h>
 #include <mach/asp.h>
 #include <mach/spi.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 4604e72d7d9947bce4263d7c52b72e66e7620018..679e168dce34e55f4c711d12c01eab4300174bac 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/gpio.h>
 #include <linux/spi/spi.h>
 
 #include <asm/mach/map.h>
@@ -34,7 +33,7 @@
 #include <mach/asp.h>
 #include <mach/keyscan.h>
 #include <mach/spi.h>
-
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 4c82c2716293a6e750f242c128fb14e66c2ce636..9a274665edc520527476fd6cb1425b7dbb8f485c 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/clk.h>
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 
@@ -26,6 +25,7 @@
 #include <mach/serial.h>
 #include <mach/common.h>
 #include <mach/asp.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index 1802e711a2b8f7218131613365f19e4361ff04e2..03e5f4931b423d4612c4f479d1f2cfe2df5acc51 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/clk.h>
 #include <linux/serial_8250.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 
@@ -27,6 +26,7 @@
 #include <mach/serial.h>
 #include <mach/common.h>
 #include <mach/asp.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #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 (file)
index 0000000..1fdd1fd
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * TI DaVinci GPIO Support
+ *
+ * Copyright (c) 2006 David Brownell
+ * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef        __DAVINCI_DAVINCI_GPIO_H
+#define        __DAVINCI_DAVINCI_GPIO_H
+
+#include <linux/io.h>
+#include <linux/spinlock.h>
+
+#include <asm-generic/gpio.h>
+
+#include <mach/irqs.h>
+#include <mach/common.h>
+
+#define DAVINCI_GPIO_BASE 0x01C67000
+
+enum davinci_gpio_type {
+       GPIO_TYPE_DAVINCI = 0,
+       GPIO_TYPE_TNETV107X,
+};
+
+/*
+ * basic gpio routines
+ *
+ * board-specific init should be done by arch/.../.../board-XXX.c (maybe
+ * initializing banks together) rather than boot loaders; kexec() won't
+ * go through boot loaders.
+ *
+ * the gpio clock will be turned on when gpios are used, and you may also
+ * need to pay attention to PINMUX registers to be sure those pins are
+ * used as gpios, not with other peripherals.
+ *
+ * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1).  For documentation,
+ * and maybe for later updates, code may write GPIO(N).  These may be
+ * all 1.8V signals, all 3.3V ones, or a mix of the two.  A given chip
+ * may not support all the GPIOs in that range.
+ *
+ * GPIOs can also be on external chips, numbered after the ones built-in
+ * to the DaVinci chip.  For now, they won't be usable as IRQ sources.
+ */
+#define        GPIO(X)         (X)             /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
+
+/* Convert GPIO signal to GPIO pin number */
+#define GPIO_TO_PIN(bank, gpio)        (16 * (bank) + (gpio))
+
+struct davinci_gpio_controller {
+       struct gpio_chip        chip;
+       int                     irq_base;
+       spinlock_t              lock;
+       void __iomem            *regs;
+       void __iomem            *set_data;
+       void __iomem            *clr_data;
+       void __iomem            *in_data;
+};
+
+/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
+ * with constant parameters; or in outlined code they execute at runtime.
+ *
+ * You'd access the controller directly when reading or writing more than
+ * one gpio value at a time, and to support wired logic where the value
+ * being driven by the cpu need not match the value read back.
+ *
+ * These are NOT part of the cross-platform GPIO interface
+ */
+static inline struct davinci_gpio_controller *
+__gpio_to_controller(unsigned gpio)
+{
+       struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
+       int index = gpio / 32;
+
+       if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
+               return NULL;
+
+       return ctlrs + index;
+}
+
+static inline u32 __gpio_mask(unsigned gpio)
+{
+       return 1 << (gpio % 32);
+}
+
+#endif /* __DAVINCI_DAVINCI_GPIO_H */
index fbece126c2bf2f451a5983207273525be2a9d12a..fbaae4772b91c6237b2a1499b28af7a79eb2de19 100644 (file)
 #ifndef        __DAVINCI_GPIO_H
 #define        __DAVINCI_GPIO_H
 
-#include <linux/io.h>
-#include <linux/spinlock.h>
-
 #include <asm-generic/gpio.h>
 
-#include <mach/irqs.h>
-#include <mach/common.h>
-
-#define DAVINCI_GPIO_BASE 0x01C67000
-
-enum davinci_gpio_type {
-       GPIO_TYPE_DAVINCI = 0,
-       GPIO_TYPE_TNETV107X,
-};
-
-/*
- * basic gpio routines
- *
- * board-specific init should be done by arch/.../.../board-XXX.c (maybe
- * initializing banks together) rather than boot loaders; kexec() won't
- * go through boot loaders.
- *
- * the gpio clock will be turned on when gpios are used, and you may also
- * need to pay attention to PINMUX registers to be sure those pins are
- * used as gpios, not with other peripherals.
- *
- * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1).  For documentation,
- * and maybe for later updates, code may write GPIO(N).  These may be
- * all 1.8V signals, all 3.3V ones, or a mix of the two.  A given chip
- * may not support all the GPIOs in that range.
- *
- * GPIOs can also be on external chips, numbered after the ones built-in
- * to the DaVinci chip.  For now, they won't be usable as IRQ sources.
- */
-#define        GPIO(X)         (X)             /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
-
-/* Convert GPIO signal to GPIO pin number */
-#define GPIO_TO_PIN(bank, gpio)        (16 * (bank) + (gpio))
-
-struct davinci_gpio_controller {
-       struct gpio_chip        chip;
-       int                     irq_base;
-       spinlock_t              lock;
-       void __iomem            *regs;
-       void __iomem            *set_data;
-       void __iomem            *clr_data;
-       void __iomem            *in_data;
-};
-
-/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
- * with constant parameters; or in outlined code they execute at runtime.
- *
- * You'd access the controller directly when reading or writing more than
- * one gpio value at a time, and to support wired logic where the value
- * being driven by the cpu need not match the value read back.
- *
- * These are NOT part of the cross-platform GPIO interface
- */
-static inline struct davinci_gpio_controller *
-__gpio_to_controller(unsigned gpio)
-{
-       struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
-       int index = gpio / 32;
-
-       if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
-               return NULL;
-
-       return ctlrs + index;
-}
-
-static inline u32 __gpio_mask(unsigned gpio)
-{
-       return 1 << (gpio % 32);
-}
+/* The inline versions use the static inlines in the driver header */
+#include "gpio-davinci.h"
 
 /*
  * The get/set/clear functions will inline when called with constant
@@ -147,11 +77,6 @@ static inline int gpio_cansleep(unsigned gpio)
                return __gpio_cansleep(gpio);
 }
 
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
 static inline int irq_to_gpio(unsigned irq)
 {
        /* don't support the reverse mapping */
index 1b28fdd892a64aac8a1f7a430982d36104aa433f..409bb869c7c766c071bf9838375b2df1410b14f3 100644 (file)
@@ -12,6 +12,7 @@
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/clk.h>
@@ -27,9 +28,9 @@
 #include <mach/psc.h>
 #include <mach/cp_intc.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
 #include <mach/hardware.h>
 #include <mach/tnetv107x.h>
+#include <mach/gpio-davinci.h>
 
 #include "clock.h"
 #include "mux.h"
index c60f081e930bb8cea0567ad9675008c1add1a49f..94c78bc662753d54e18a4f819d9992fa2763fd66 100644 (file)
@@ -38,6 +38,7 @@
 #include <mach/fb.h>
 #include <mach/ep93xx_keypad.h>
 #include <mach/ep93xx_spi.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
index 9969bb115f602d915330b0ebdca3c683862d7269..3f320c6477bf6c74365b7d5566729cd83b8c968a 100644 (file)
@@ -37,6 +37,7 @@
 #include <mach/hardware.h>
 #include <mach/fb.h>
 #include <mach/ep93xx_spi.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
similarity index 87%
rename from arch/arm/mach-ep93xx/include/mach/gpio.h
rename to arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
index c57152c231f16a474442c0d65cefc2e9de8342cb..8aff2ea35877876bfb99e31f433df5bc867e3cb3 100644 (file)
@@ -1,9 +1,7 @@
-/*
- * arch/arm/mach-ep93xx/include/mach/gpio.h
- */
+/* Include file for the EP93XX GPIO controller machine specifics */
 
-#ifndef __ASM_ARCH_GPIO_H
-#define __ASM_ARCH_GPIO_H
+#ifndef __GPIO_EP93XX_H
+#define __GPIO_EP93XX_H
 
 /* GPIO port A.  */
 #define EP93XX_GPIO_LINE_A(x)          ((x) + 0)
 /* maximum value for irq capable line identifiers */
 #define EP93XX_GPIO_LINE_MAX_IRQ       EP93XX_GPIO_LINE_F(7)
 
-/* new generic GPIO API - see Documentation/gpio.txt */
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-
-/*
- * Map GPIO A0..A7  (0..7)  to irq 64..71,
- *          B0..B7  (7..15) to irq 72..79, and
- *          F0..F7 (16..24) to irq 80..87.
- */
-#define gpio_to_irq(gpio)      \
-       (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL)
-
-#define irq_to_gpio(irq)       ((irq) - gpio_to_irq(0))
-
-#endif
+#endif /* __GPIO_EP93XX_H */
index 8392e95d7cea69ef8729570712ba88380f240b37..1a472ff12cce9f37aa2ffc8a7aae1c33fafa0cb0 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
 
 #include <mach/hardware.h>
 #include <mach/fb.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 2e9c614757e40f08e44e3e6e90073bd45b7f64a9..4f4b0b2c4c313d8277a52611f2f9d1f1e8beb89f 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
 #include <linux/fb.h>
@@ -30,6 +29,7 @@
 
 #include <mach/hardware.h>
 #include <mach/fb.h>
+#include <mach/gpio-ep93xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index be9266b10fdb66b2a5e0deb6896e8d1b50328fcc..80523ca9bb49b87030220b9725e3c58b4922ed53 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* Practically, GPIO banks up to GPZ are the configurable gpio banks */
 
 /* GPIO bank sizes */
@@ -151,6 +146,4 @@ enum s5p_gpio_number {
 #define ARCH_NR_GPIOS          (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) +       \
                                 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 3bc2c70f298934a85bcb10b858e5e90e758ceb16..40a0527bada7a969d1bb366fe5bf7e150ace2256 100644 (file)
 #define __MACH_GPIO_H__
 
 #include <mach/irqs.h>
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
 
 #define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
 #define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
index cf8f8099ebd78abb3b92676b170fa0df81874005..82bd4403b450a915ac2a8b83a627ddf00642a6fa 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA 02110-1301, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
 #include <mach/iomux-mx3.h>
 
 /*
index fc26ed71b9edf56cafa4426668b3a52d523b9fb1..e1addc1a5813428a9e11fbe1bd535bcb4cd54c34 100644 (file)
@@ -13,7 +13,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
@@ -27,7 +27,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
-#include <mach/gpio.h>
 #include <mach/iomux-mx27.h>
 
 #include "devices-imx27.h"
index 4068166c899384903206e2f4325049639712a480..59a512672bb9de9035b6e695c7e1e914bc7eb3c4 100644 (file)
@@ -13,7 +13,7 @@
  * License version 2. This program is licensed "as is" without any 
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
@@ -39,7 +39,7 @@
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 
-#include <mach/gpio.h>
+#include <mach/gpio-ixp2000.h>
 
 static DEFINE_SPINLOCK(ixp2000_slowport_lock);
 static unsigned long ixp2000_slowport_irq_flags;
similarity index 95%
rename from arch/arm/mach-ixp2000/include/mach/gpio.h
rename to arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
index 4a88d2c33dacb6a4640b998c824465c9561d3e23..af836c76c3f1a2e142d38a1106e46fa75fa20693 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2002 Intel Corporation.
  *
- * This program is free software, you can redistribute it and/or modify 
+ * This program is free software, you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
@@ -11,7 +11,7 @@
 /*
  * IXP2000 GPIO in/out, edge/level detection for IRQs:
  * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
- * or both Falling-edge and Rising-edge.  
+ * or both Falling-edge and Rising-edge.
  * This must be called *before* the corresponding IRQ is registerd.
  * Use this instead of directly setting the GPIO registers.
  * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
index 235638f800e55795629597f1de58d82ed1456715..634b6c852f68f58d0d8cf368e45cf0946b0987a7 100644 (file)
@@ -14,6 +14,7 @@
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mm.h>
@@ -40,8 +41,7 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/arch.h>
 
-#include <mach/gpio.h>
-
+#include <mach/gpio-ixp2000.h>
 
 /*************************************************************************
  * IXDP2x00 IRQ Initialization
index 03e54515e8b3c58b9c3cd02dd70176f6b6588830..96e378345801ba88a5f052b3bb54df6836dac420 100644 (file)
@@ -16,7 +16,7 @@
  * Author: Rod Whitby <rod@whitby.id.au>
  * Maintainers: http://www.nslu2-linux.org/
  */
-
+#include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/jiffies.h>
 #include <linux/timer.h>
@@ -31,7 +31,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
-#include <asm/gpio.h>
 
 #define DSMG600_SDA_PIN                5
 #define DSMG600_SCL_PIN                4
index 23a8b3614568157f1aa9921fc8ce00c615107078..72333a0394312eff6ba5d1a5b6e041ba37320dbd 100644 (file)
@@ -14,7 +14,7 @@
  * Maintainers: http://www.nslu2-linux.org/
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/if_ether.h>
 #include <linux/irq.h>
 #include <linux/serial.h>
@@ -27,7 +27,6 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
-#include <asm/gpio.h>
 
 #define FSG_SDA_PIN            12
 #define FSG_SCL_PIN            13
index a5f87ded2f28bd8e039d8c09ac04db6e8fc43d50..83d6b4ed60bbd42f3e912d68611205d720ad98a1 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/kernel.h>
 #include <mach/hardware.h>
 
+#define __ARM_GPIOLIB_COMPLEX
+
 static inline int gpio_request(unsigned gpio, const char *label)
 {
        return 0;
@@ -70,6 +72,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
 #include <asm-generic/gpio.h>                  /* cansleep wrappers */
 
 extern int gpio_to_irq(int gpio);
+#define gpio_to_irq gpio_to_irq
 extern int irq_to_gpio(unsigned int irq);
 
 #endif
index afb51879d9a4d1dbac46472ce07543166fdc0120..b752fa4d692763690d8e969a4b4add897fbcd48c 100644 (file)
@@ -17,7 +17,7 @@
  * Maintainers: http://www.nslu2-linux.org/
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/if_ether.h>
 #include <linux/irq.h>
 #include <linux/jiffies.h>
@@ -32,7 +32,6 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
-#include <asm/gpio.h>
 
 #define NAS100D_SDA_PIN                5
 #define NAS100D_SCL_PIN                6
index 69e40f2cf09217caab9f7d7c5c0d3569c3807134..0411a0a01071bd49f3b3e16ff940e20e2482b697 100644 (file)
@@ -16,7 +16,7 @@
  * Maintainers: http://www.nslu2-linux.org/
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/if_ether.h>
 #include <linux/irq.h>
 #include <linux/serial.h>
@@ -30,7 +30,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
-#include <asm/gpio.h>
 
 #define NSLU2_SDA_PIN          7
 #define NSLU2_SCL_PIN          6
index 05d193a25b250d73c90830c52050e106e70eddca..c4c68e5b94f145cf1a3d36c4a7b4e281d40d92ba 100644 (file)
@@ -7,14 +7,13 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <mach/bridge-regs.h>
 #include <plat/irq.h>
-#include <asm/gpio.h>
 #include "common.h"
 
 static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
index b0a7d979a8ed98e9fa35abed1d49577e0ec66b63..cc431fa22ccb6538f85bb1c98d366ba0d57e5532 100644 (file)
@@ -7,12 +7,11 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
-#include <asm/gpio.h>
 #include <mach/hardware.h>
 #include <plat/mpp.h>
 #include "common.h"
index 7e3e8160ed30fe1874dc9540f9b2178f8f4b0eea..853efd9133c6a8f91ed7e1bef24158f562006942 100644 (file)
@@ -3,7 +3,7 @@
 # Makefile for KS8695 architecture support
 #
 
-obj-y                          := cpu.o irq.o time.o gpio.o devices.o
+obj-y                          := cpu.o irq.o time.o devices.o
 obj-m                          :=
 obj-n                          :=
 obj-                           :=
index 3ca4f8e6f54fd1cd1fb56f08723aa7b0668de44a..3d7d11436aa533e85762b1d08a1b5849156e25ff 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -34,7 +34,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/devices.h>
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 
 #include "generic.h"
 
index 1338cb3e98274641557667e5be5b808be22e009b..c3c867ac41559d70846041eb53fa5ccfd12ea629 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -29,7 +29,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/devices.h>
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 
 #include "generic.h"
 
index e2e3cba8dcdb437f04aa19e9b7091f09386b4989..9b9c47cc647190c01a00bd726fcaa63b03092cc4 100644 (file)
@@ -5,7 +5,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -18,7 +18,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 #include <mach/devices.h>
 
 #include "generic.h"
index b89fb6d46cccc9efc5ed9f112875ef039da17595..73bd63812878548fcd1e7526ff3c5c22592a2664 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #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 (file)
index 0000000..6eb034d
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2006 Andrew Victor
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MACH_KS8659_GPIO_H
+#define __MACH_KS8659_GPIO_H
+
+#include <linux/kernel.h>
+
+#define KS8695_GPIO_0          0
+#define KS8695_GPIO_1          1
+#define KS8695_GPIO_2          2
+#define KS8695_GPIO_3          3
+#define KS8695_GPIO_4          4
+#define KS8695_GPIO_5          5
+#define KS8695_GPIO_6          6
+#define KS8695_GPIO_7          7
+#define KS8695_GPIO_8          8
+#define KS8695_GPIO_9          9
+#define KS8695_GPIO_10         10
+#define KS8695_GPIO_11         11
+#define KS8695_GPIO_12         12
+#define KS8695_GPIO_13         13
+#define KS8695_GPIO_14         14
+#define KS8695_GPIO_15         15
+
+/*
+ * Configure GPIO pin as external interrupt source.
+ */
+extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
+
+/* Register the GPIOs */
+extern void ks8695_register_gpios(void);
+
+#endif /* __MACH_KS8659_GPIO_H */
index 86312d476bc69525317641b63fe46ff53021342d..f5fda36e4512632e24d74ef05f8acdb119b6e801 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H_
 #define __ASM_ARCH_GPIO_H_
 
-#include <linux/kernel.h>
-
-#define KS8695_GPIO_0          0
-#define KS8695_GPIO_1          1
-#define KS8695_GPIO_2          2
-#define KS8695_GPIO_3          3
-#define KS8695_GPIO_4          4
-#define KS8695_GPIO_5          5
-#define KS8695_GPIO_6          6
-#define KS8695_GPIO_7          7
-#define KS8695_GPIO_8          8
-#define KS8695_GPIO_9          9
-#define KS8695_GPIO_10         10
-#define KS8695_GPIO_11         11
-#define KS8695_GPIO_12         12
-#define KS8695_GPIO_13         13
-#define KS8695_GPIO_14         14
-#define KS8695_GPIO_15         15
-
-/*
- * Configure GPIO pin as external interrupt source.
- */
-extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
-
 /*
  * Map IRQ number to GPIO line.
  */
 extern int irq_to_gpio(unsigned int irq);
 
-#include <asm-generic/gpio.h>
-
-/* If it turns out that we need to optimise GPIO access for the
- * Micrel's GPIOs, then these can be changed to check their argument
- * directly as static inlines. However for now it's probably not
- * worthwhile.
- */
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_to_irq __gpio_to_irq
-
-/* Register the GPIOs */
-extern void ks8695_register_gpios(void);
-
 #endif
index 184ef74e4bee53151666d7d26396964d7c36bcb6..d6f6502ac9b59c1722a0ea09b6938933a15e62e9 100644 (file)
@@ -7,14 +7,14 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 
 #include <asm/leds.h>
 #include <mach/devices.h>
-#include <mach/gpio.h>
 
 
 static inline void ks8695_led_on(unsigned int led)
index a5fc5d0eeaeba093b6669833cffccf65d62034a0..f5db805ab95872bb38838a5129324ccbbedb1529 100644 (file)
@@ -3,6 +3,6 @@
 #
 
 obj-y  := timer.o irq.o common.o serial.o clock.o
-obj-y  += gpiolib.o pm.o suspend.o
+obj-y  += pm.o suspend.o
 obj-y  += phy3250.o
 
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 (file)
index 0000000..1816e22
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Author: Kevin Wells <kevin.wells@nxp.com>
+ *
+ * Copyright (C) 2010 NXP Semiconductors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MACH_GPIO_LPC32XX_H
+#define __MACH_GPIO_LPC32XX_H
+
+/*
+ * Note!
+ * Muxed GP pins need to be setup to the GP state in the board level
+ * code prior to using this driver.
+ * GPI pins : 28xP3 group
+ * GPO pins : 24xP3 group
+ * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
+ */
+
+#define LPC32XX_GPIO_P0_MAX 8
+#define LPC32XX_GPIO_P1_MAX 24
+#define LPC32XX_GPIO_P2_MAX 13
+#define LPC32XX_GPIO_P3_MAX 6
+#define LPC32XX_GPI_P3_MAX 28
+#define LPC32XX_GPO_P3_MAX 24
+
+#define LPC32XX_GPIO_P0_GRP 0
+#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
+#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
+#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
+#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
+#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
+
+/*
+ * A specific GPIO can be selected with this macro
+ * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
+ * See the LPC32x0 User's guide for GPIO group numbers
+ */
+#define LPC32XX_GPIO(x, y) ((x) + (y))
+
+#endif /* __MACH_GPIO_LPC32XX_H */
index 67d03da1eee94049a3fa459ff0ac57b1e6ee16e3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,74 +0,0 @@
-/*
- * arch/arm/mach-lpc32xx/include/mach/gpio.h
- *
- * Author: Kevin Wells <kevin.wells@nxp.com>
- *
- * Copyright (C) 2010 NXP Semiconductors
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ASM_ARCH_GPIO_H
-#define __ASM_ARCH_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-/*
- * Note!
- * Muxed GP pins need to be setup to the GP state in the board level
- * code prior to using this driver.
- * GPI pins : 28xP3 group
- * GPO pins : 24xP3 group
- * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
- */
-
-#define LPC32XX_GPIO_P0_MAX 8
-#define LPC32XX_GPIO_P1_MAX 24
-#define LPC32XX_GPIO_P2_MAX 13
-#define LPC32XX_GPIO_P3_MAX 6
-#define LPC32XX_GPI_P3_MAX 28
-#define LPC32XX_GPO_P3_MAX 24
-
-#define LPC32XX_GPIO_P0_GRP 0
-#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
-#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
-#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
-#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
-#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
-
-/*
- * A specific GPIO can be selected with this macro
- * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
- * See the LPC32x0 User's guide for GPIO group numbers
- */
-#define LPC32XX_GPIO(x, y) ((x) + (y))
-
-static inline int gpio_get_value(unsigned gpio)
-{
-       return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       __gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-       return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
-#endif
index 7993b096778e1f49c9d44d3e2762dd58b4233678..c3a22fd736aa401da040802690c029fb08101975 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
+#include <mach/gpio-lpc32xx.h>
 #include "common.h"
 
 /*
index 06b5fa853c9325b81548378a7978a29cbe898a88..833c3a2784aa782066f308a9c5afd03fdd76bdd8 100644 (file)
@@ -8,7 +8,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  publishhed by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/interrupt.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa168.h>
 #include <mach/pxa168.h>
-#include <mach/gpio.h>
 #include <video/pxa168fb.h>
 #include <linux/input.h>
 #include <plat/pxa27x_keypad.h>
index c79162a50f28720016c1f03119840d4cc5322bee..e411252e3d397b000066d9fe04c96bb516ab043d 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/max8649.h>
 #include <linux/regulator/fixed.h>
index 2d2c0ad60d8d833a86e1d78eaed38a8b6bd0aa6e..69156568bc41f95891df3c17ca06836a9c3bf5bb 100644 (file)
@@ -9,11 +9,11 @@
  */
 
 #include <linux/init.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
-#include <mach/gpio.h>
 #include <mach/pxa168.h>
 #include <mach/mfp-pxa168.h>
 
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 (file)
index 0000000..d14eeaf
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __ASM_MACH_GPIO_PXA_H
+#define __ASM_MACH_GPIO_PXA_H
+
+#include <mach/addr-map.h>
+#include <mach/irqs.h>
+
+#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
+
+#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define GPIO_REG(x)    (GPIO_REGS_VIRT + (x))
+
+#define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
+
+#define gpio_to_bank(gpio)     ((gpio) >> 5)
+
+/* NOTE: these macros are defined here to make optimization of
+ * gpio_{get,set}_value() to work when 'gpio' is a constant.
+ * Usage of these macros otherwise is no longer recommended,
+ * use generic GPIO API whenever possible.
+ */
+#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
+
+#define GPLR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
+#define GPDR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
+#define GPSR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
+#define GPCR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
+
+#include <plat/gpio-pxa.h>
+
+#endif /* __ASM_MACH_GPIO_PXA_H */
index 7bfb827f3fe36a8d71fc874b1a45e446be1d3bac..681262359d1c28cfc30b26e4f093fc43930c17a5 100644 (file)
@@ -1,36 +1,13 @@
 #ifndef __ASM_MACH_GPIO_H
 #define __ASM_MACH_GPIO_H
 
-#include <mach/addr-map.h>
-#include <mach/irqs.h>
 #include <asm-generic/gpio.h>
 
-#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
-
-#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-#define GPIO_REG(x)    (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
-
-#define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
-
-#define gpio_to_bank(gpio)     ((gpio) >> 5)
 #define gpio_to_irq(gpio)      (IRQ_GPIO_START + (gpio))
 #define irq_to_gpio(irq)       ((irq) - IRQ_GPIO_START)
 
-
 #define __gpio_is_inverted(gpio)       (0)
 #define __gpio_is_occupied(gpio)       (0)
 
-/* NOTE: these macros are defined here to make optimization of
- * gpio_{get,set}_value() to work when 'gpio' is a constant.
- * Usage of these macros otherwise is no longer recommended,
- * use generic GPIO API whenever possible.
- */
-#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
-
-#define GPLR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
-#define GPDR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
-#define GPSR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
-#define GPCR(x)                GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
-
 #include <plat/gpio.h>
 #endif /* __ASM_MACH_GPIO_H */
index 5d6421d63254c39b7fb0f7a23dbc846e831fb771..8bfac66126234df28995cbc630311cebbf482818 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
-#include <linux/gpio.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/max8649.h>
 #include <linux/mfd/max8925.h>
index a80cbea40496937fa9667de3646e72c5755d8bdb..7a7e8e4dde410be822953f186318972f4b51c35e 100644 (file)
@@ -9,7 +9,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -25,7 +24,7 @@
 #include <mach/irqs.h>
 #include <mach/dma.h>
 #include <mach/mfp.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/devices.h>
 #include <mach/mmp2.h>
 
index 0156f535dae76facab7e23bd5eb58580e208a207..50c1763911ffbf1a0e4cf517bc681962f75be666 100644 (file)
@@ -7,7 +7,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -21,7 +20,7 @@
 #include <mach/regs-apbc.h>
 #include <mach/regs-apmu.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/dma.h>
 #include <mach/devices.h>
 #include <mach/mfp.h>
index 1464607aa60db76632ce72b0008cfa4333178b13..4ebbfbba39fcf3bb54e3da76891918c14f66ea50 100644 (file)
@@ -7,7 +7,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -20,7 +19,7 @@
 #include <mach/regs-apmu.h>
 #include <mach/cputype.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/dma.h>
 #include <mach/mfp.h>
 #include <mach/devices.h>
index c296b75c4453de76f0757329baffb677b56dda5c..eb5be879fd8cd76748d109546c77d34eb9914116 100644 (file)
@@ -7,18 +7,18 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  publishhed by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
-#include <mach/gpio.h>
 
 #include "common.h"
 
index c03f269e2e4bdaa29b29d9dc940ab4fab60a1c19..1a313e10c68aa6884dd310f391787c6ccb6e95c5 100644 (file)
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -34,7 +34,6 @@
 
 #include <mach/vreg.h>
 #include <mach/mpp.h>
-#include <mach/gpio.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 
index b7a84966b711bcc9658595ecfdcc789bd9e1fe70..92afaf6583ea747de18eb7c2a3e8b34d1ad69a59 100644 (file)
@@ -14,7 +14,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
@@ -30,7 +30,6 @@
 #include <asm/memory.h>
 #include <asm/setup.h>
 
-#include <mach/gpio.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 #include <mach/dma.h>
index 6a96911b0ad508cdde70e79359a8e3480ce10c16..24e9b89738efe08226534653dcd77a9f52c6593f 100644 (file)
@@ -14,7 +14,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  * 02110-1301, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
 #include <linux/gpio.h>
@@ -32,7 +32,6 @@
 #include <mach/board.h>
 #include <mach/irqs.h>
 #include <mach/sirc.h>
-#include <mach/gpio.h>
 #include <mach/vreg.h>
 #include <mach/mmc.h>
 
index 68f930f07d77c2bb86192e329036db861ccedafc..863394c59e862e5b8eba4d53925110efa64a1ba3 100644 (file)
@@ -11,7 +11,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -22,7 +22,6 @@
 
 #include <linux/delay.h>
 
-#include <asm/gpio.h>
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index f7a9724788b0f54fe7dc7e239d895d9ed6162ffa..8650342b7493e00e4828ffd1bf057c81979efee3 100644 (file)
@@ -1,7 +1,7 @@
 /* linux/arch/arm/mach-msm/board-trout-mmc.c
 ** Author: Brian Swetland <swetland@google.com>
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -11,7 +11,6 @@
 #include <linux/err.h>
 #include <linux/debugfs.h>
 
-#include <asm/gpio.h>
 #include <asm/io.h>
 
 #include <mach/vreg.h>
index 729bb49a44caf6bbd2b38557304d155bea242cf3..25105c1027fe44c1862b94605ca8d6fd520ff3c1 100644 (file)
@@ -1,7 +1,7 @@
 /* linux/arch/arm/mach-msm/board-trout-mddi.c
 ** Author: Brian Swetland <swetland@google.com>
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -11,7 +11,6 @@
 #include <linux/err.h>
 
 #include <asm/io.h>
-#include <asm/gpio.h>
 #include <asm/mach-types.h>
 
 #include <mach/msm_fb.h>
index 36ad50d3bfaa8e03e9f0333c05ed655d9ebf4adb..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,26 +1 @@
-/*
- * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
- * Author: Mike Lockwood <lockwood@android.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-#ifndef __ASM_ARCH_MSM_GPIO_H
-#define __ASM_ARCH_MSM_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#define gpio_to_irq     __gpio_to_irq
-
-#endif /* __ASM_ARCH_MSM_GPIO_H */
+/* empty */
index 3e24431bb5eaf929c28ed46cd77b62286711c512..e421b701663b8bfda904ca151727b7d2456452bc 100644 (file)
@@ -7,12 +7,11 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
-#include <asm/gpio.h>
 #include <mach/bridge-regs.h>
 #include <plat/irq.h>
 #include "common.h"
index 59b7686b92097f30f36175ccfeb8ead5f12d42c3..cf4e494d44bf98a62bfee8cbd67baee13d87a1e3 100644 (file)
@@ -7,13 +7,12 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
 #include <plat/mpp.h>
-#include <asm/gpio.h>
 #include <mach/hardware.h>
 #include "common.h"
 #include "mpp.h"
index 828ccccb6aad68dcb7b0e407f898b6d8147b2f98..bb11e63261e491fb36c750787487c23bce2dc313 100644 (file)
 #ifndef __MACH_MXS_GPIO_H__
 #define __MACH_MXS_GPIO_H__
 
-#include <asm-generic/gpio.h>
-
 #define MXS_GPIO_NR(bank, nr)  ((bank) * 32 + (nr))
 
-/* use gpiolib dispatchers */
-#define gpio_get_value         __gpio_get_value
-#define gpio_set_value         __gpio_set_value
-#define gpio_cansleep          __gpio_cansleep
-#define gpio_to_irq            __gpio_to_irq
-
 #define irq_to_gpio(irq)       ((irq) - MXS_GPIO_IRQ_START)
 
 #endif /* __MACH_MXS_GPIO_H__ */
index 139930350d939289c729fdde62339873aa2989bd..97d7186484caf363502fc9f4907310bd839b3086 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/flash.h>
 
+#include <plat/gpio-nomadik.h>
 #include <plat/mtu.h>
 
 #include <mach/setup.h>
index ac58e3b03b1a5516e87379450ccffcd9dd4a1fb7..dc67717db6f078db7975adc873bf6efe2a64eaef 100644 (file)
@@ -21,8 +21,8 @@
 #include <linux/device.h>
 #include <linux/amba/bus.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 #include <asm/mach/map.h>
index abfe25a08d6b6e15f336048395013669efc06595..0fc2f6f1cc979097cf83de13a924c7fb05a105f1 100644 (file)
@@ -3,8 +3,8 @@
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 #include <linux/i2c-gpio.h>
-#include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <plat/gpio-nomadik.h>
 
 /*
  * There are two busses in the 8815NHK.
index 7a81a042034333b65b1e4553504f9bac3df413aa..efdde0ae0a4f28408a791fede322f4b8d3ef5aa5 100644 (file)
@@ -1,6 +1,4 @@
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H
 
-#include <plat/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 312ea6b0409dcd5e93464e3fef1fe4334d63ddfe..d86e9af2822ba71b59997ed516953c1f4280c0a6 100644 (file)
@@ -11,7 +11,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -30,7 +30,6 @@
 
 #include <plat/io.h>
 #include <plat/board-ams-delta.h>
-#include <mach/gpio.h>
 #include <plat/keypad.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index a6b1bea50371e7144492af17f4d9163116d1ac0d..dd814b33cdd5c44f7b66fd69875043859c84a222 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -28,7 +28,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/tc.h>
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/flash.h>
 #include <plat/fpga.h>
index 04fc356c40fa9c0fd8ea8f7c69b4afa64852716e..8f7d11581482f1417c2a9de4eb5505fe2763bb75 100644 (file)
@@ -12,7 +12,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -22,7 +22,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
 #include <plat/board.h>
index f2fc43d8382b36c5e19e18e371abfce8e9595a74..da0e37d408237076ae8dda8255fa00e085f325e5 100644 (file)
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <linux/i2c/tps65010.h>
 
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 
 #include "board-h2.h"
 
index cb7fb1aa3dca5e832374971add929ec1fdd49845..0796ad7e24b5b946397f4b02c8c16a6cff19f057 100644 (file)
@@ -18,7 +18,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
@@ -32,7 +32,6 @@
 #include <linux/smc91x.h>
 
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 2098525e7cc5dcd1de834fd8dd0a642077ee9ddf..f8242aa9b76321229f400ccf2b0bcb4a3f28c1f0 100644 (file)
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <linux/i2c/tps65010.h>
 
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 
 #include "board-h3.h"
 
index 31f34875ffad370fc1da66e3d930731687185200..fe1814c5e748123ea0659d5e3cb502bdafa7eb33 100644 (file)
@@ -13,7 +13,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/major.h>
@@ -34,7 +34,6 @@
 #include <asm/setup.h>
 #include <asm/page.h>
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 36e06ea7ec65c728e927cbdf27f07085c67d40fc..4af7bfa40e4a03ba3b2d3778aa99747e9b8291b3 100644 (file)
@@ -23,7 +23,6 @@
  * 02110-1301, USA.
  *
  */
-
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
index 0b1ba462d3885824561ebb3ea0b6047b6f0efe35..e603e5eb32a89e5a2b0e0258d6aaef64541af5a7 100644 (file)
@@ -15,7 +15,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -34,7 +34,6 @@
 #include <plat/mux.h>
 #include <plat/flash.h>
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 #include <plat/tc.h>
 #include <plat/usb.h>
 #include <plat/keypad.h>
index 5469ce247ffe913a31e7a61d82a4a94aafc59362..8420535fe51df3de67ed80ad3d98ab992794e18a 100644 (file)
@@ -7,7 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mutex.h>
@@ -26,7 +26,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
 #include <plat/board.h>
index b08a213807724d6027eb304fe3296a32cfdb31a1..bf1ebe5b244213ac8557b8e2ad8d60d4c6894b9c 100644 (file)
@@ -25,7 +25,7 @@
  * with this program; if not, write  to the Free Software Foundation, Inc.,
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -42,7 +42,6 @@
 #include <linux/i2c/tps65010.h>
 
 #include <mach/hardware.h>
-#include <asm/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 459cb6bfed55aa36e3e2dd8a6cdccf53ee355fb7..45596b5acf09c09221a3e1e10bdcdb1906d8573c 100644 (file)
@@ -16,7 +16,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -33,7 +33,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index b214f45f646c558dcf18b65c0483dafed2940df6..f942221f6e712a882a5c46a3a6031709c90fd116 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -30,7 +31,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/led.h>
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index 9b0ea48d35fd873b2c981e78466de4195319281a..2b912d46ceec902ee0057aca73f9dbf3f6b958a2 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -32,7 +33,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/usb.h>
index 67acd4142639a56a88cbe6a9601b45a06652b099..7e2efe52cc3546d0126794042071b2784481e5f9 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -28,7 +28,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/tc.h>
-#include <mach/gpio.h>
 #include <plat/mux.h>
 #include <plat/fpga.h>
 #include <plat/flash.h>
index e8ddd86e3fda698f2227a86f78774f0603d89dd9..b59f78850e691d5933d1821d22b8f7fd630613b0 100644 (file)
  * published by the Free Software Foundation.
  */
 
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 
 #include <mach/hardware.h>
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 #include <plat/board-sx1.h>
 
 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
index 9c3b7c52d9cf60b4ed0b1ec45b62eaba08f8c668..172a28f9a34480e21265fc993c5722adb722b571 100644 (file)
@@ -14,7 +14,7 @@
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/input.h>
@@ -32,7 +32,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/dma.h>
index 036edc0ee9b6e8d41f74f0eb16023f9caafeee8d..236b7ded0cf8db98571cd5abc9a0836346fa1d6a 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -33,7 +34,6 @@
 
 #include <plat/board-voiceblue.h>
 #include <plat/common.h>
-#include <mach/gpio.h>
 #include <plat/flash.h>
 #include <plat/mux.h>
 #include <plat/tc.h>
index 36f26c3fa25ee5dc83291012718e8f2f5ea53aae..7c50ecf68123b645a3d506f9f9110c6ebadb496d 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +25,6 @@
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mux.h>
-#include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/omap7xx.h>
 #include <plat/mcbsp.h>
index cddbf8b089cef4c08e2d9138e886b7cd0f086e06..0a17a1a7e00d106aa80f169e3db59191ab5dbd65 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
@@ -28,7 +29,6 @@
 #include <asm/mach/irq.h>
 
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 
 static void fpga_mask_irq(struct irq_data *d)
 {
index e2b9c901ab67c4d07a274e34def39bb5ace47644..e5b104b7fce65e1ca7e6ad1db216950905024ddd 100644 (file)
@@ -35,7 +35,7 @@
  * with this program; if not, write  to the Free Software Foundation, Inc.,
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -45,7 +45,6 @@
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
-#include <mach/gpio.h>
 #include <plat/cpu.h>
 
 #define IRQ_BANK(irq) ((irq) >> 5)
index b4f9be52e1e841cbf7d4e697299f779c964438ec..4b818eb9f911111bc18134a1617041c07ddf29bc 100644 (file)
@@ -9,6 +9,7 @@
  * The "surfer" expansion board and H2 sample board also have two-color
  * green+red LEDs (in parallel), used here for timer and idle indicators.
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel_stat.h>
 #include <linux/sched.h>
@@ -20,7 +21,6 @@
 #include <asm/mach-types.h>
 
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 
 #include "leds.h"
 
index 499d7ad8697d175847a21fbf133a6cb772526429..da09f4364979808421b2f482b68a32ea84ec898c 100644 (file)
@@ -3,14 +3,13 @@
  *
  * LED driver for OSK with optional Mistral QVGA board
  */
+#include <linux/gpio.h>
 #include <linux/init.h>
 
 #include <mach/hardware.h>
 #include <asm/leds.h>
 #include <asm/system.h>
 
-#include <mach/gpio.h>
-
 #include "leds.h"
 
 
index 22eb11dde9e7ac5408c5d8353614e66c8f147dcd..ae6dd93b8ddce87e755e954695092555c4514083 100644 (file)
@@ -3,13 +3,13 @@
  *
  * OMAP LEDs dispatcher
  */
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 
-#include <mach/gpio.h>
 #include <plat/mux.h>
 
 #include "leds.h"
index 550ca9d9991d5b1fe1994ddd3c8871c800ae918c..93ae8f29727e61a002bcf705a6d2492f4772023a 100644 (file)
@@ -7,7 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +24,6 @@
 
 #include <plat/board.h>
 #include <plat/mux.h>
-#include <mach/gpio.h>
 #include <plat/fpga.h>
 
 #include "pm.h"
index 54db41a84a9bc71b07c44b874b0c58a1fad91a1a..bb4af05c7f0af4769431d2a9947b68d984bfbc0b 100644 (file)
@@ -15,7 +15,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
@@ -25,7 +25,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/usb.h>
 #include <plat/board.h>
 #include <plat/common.h>
index 45de2b319ec9b631d968c5c5fe8454f640121da8..95319e761802e1c63c901fd3631a7b08db24991f 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -31,7 +31,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <mach/gpio.h>
 #include <plat/usb.h>
 #include <plat/board.h>
 #include <plat/common.h>
index 218764c9377ee4c8dfd1c6500af1c1f84f586a8f..ddff45c1688c132efb4bffa18dc4caf8dfca9d8b 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -34,7 +34,6 @@
 #include <asm/mach/map.h>
 
 #include <plat/mcspi.h>
-#include <mach/gpio.h>
 #include <plat/board.h>
 #include <plat/common.h>
 #include <plat/gpmc.h>
index 1077ad663f936e5174f0f3c7a137bee3f57a2972..5391079c868981ad10adfbf22471aa021c1460f6 100644 (file)
@@ -8,7 +8,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -26,7 +26,6 @@
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mcbsp.h>
-#include <mach/gpio.h>
 #include <plat/mmc.h>
 #include <plat/dma.h>
 #include <plat/omap_hwmod.h>
index a3e3e9e5e328c7534ac2c1e753e52be7afaeb067..6d771cbf06a49028394ecd97b0a0b85b6ceef546 100644 (file)
@@ -9,7 +9,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -21,7 +21,6 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/i2c.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index c105556a0ee1a9ab158742e8d3b417eae7a8646b..6fb4908e998bbb5dac260d5d1c5804717ccb9a6f 100644 (file)
@@ -13,7 +13,7 @@
  * License, or (at your option) any later version.
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -30,7 +30,6 @@
 #include <linux/phy.h>
 #include <linux/marvell_phy.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 43cf8bc9767bbe8cb5fab72f06b11da74c804d8d..b1b45fff776e614f68ed1058e1313361e03b487b 100644 (file)
@@ -9,12 +9,11 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
-#include <asm/gpio.h>
 #include <mach/bridge-regs.h>
 #include <plat/irq.h>
 #include "common.h"
index 00381249d7665ef6fea66d57f53cc2127d09814b..f88f54bb7562c4918dfcca24a8040d2c35268657 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -21,7 +21,6 @@
 #include <linux/serial_reg.h>
 #include <linux/ata_platform.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 63ff10c3c46481cf4b24c6de55ba04598e2efd21..525eb1286859e979b08c5d9b80673acefed08715 100644 (file)
@@ -7,7 +7,7 @@
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/i2c.h>
 #include <linux/ata_platform.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <mach/orion5x.h>
 #include "common.h"
index 291d22bf44c9bf8d4a91b0d00b2e5c0ecbe63828..50aae6f571b8356be6858081580ecc9b9e39ec79 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -18,7 +18,6 @@
 #include <linux/ethtool.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index 3f02362e1632bdfca2b4679557f899e1def14464..35f106ac593ad74479a24bce0c475204ac220027 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -19,7 +19,6 @@
 #include <linux/i2c.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index 27fd38e658bd882f620999f80bd702ec32feff30..9bb2b8bafbfd3316f9f65bc95d20aa642337ac36 100644 (file)
@@ -9,7 +9,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/ata_platform.h>
 #include <linux/i2c.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index ad2eba9286adf3a1af1b9fa157fb297d68d48735..1d00df9ad4642eb7ce9661621fd3b8f5abe38365 100644 (file)
@@ -7,7 +7,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -21,7 +21,6 @@
 #include <linux/ethtool.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/leds.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
index a34e4fac72b00993ac60ab69b1f0822810157a52..c9dd31d34866c11aab4766e8e11169d5508d13dd 100644 (file)
@@ -8,7 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/i2c.h>
 #include <linux/serial_reg.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index c9831614e355c9dcc22090766bc8136972a8d71e..764307b8abfce454a013cc2ee21bdf1baea6ab5b 100644 (file)
@@ -8,7 +8,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -23,7 +23,6 @@
 #include <linux/serial_reg.h>
 #include <linux/ata_platform.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index cc33b2222bad74858444466a9c939113876ac461..0572dd1c8aaa4fb2ddb3714b9272172a0cfd3f32 100644 (file)
@@ -11,7 +11,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -25,7 +25,6 @@
 #include <linux/i2c.h>
 #include <linux/serial_reg.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 2653595f901c598e012f6e5ae77f97a03d201157..cdad50bd489106c94e49d9a862f82caef8929577 100644 (file)
@@ -5,7 +5,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -17,7 +17,6 @@
 #include <linux/ethtool.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index 251ef1543e53d3f0c2e3742a76183bf839204954..8f10ffd77ec33ed7a52ca485c9154f61f5ca13c2 100644 (file)
@@ -5,7 +5,7 @@
  * License version 2.  This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -20,7 +20,6 @@
 #include <linux/input.h>
 #include <net/dsa.h>
 #include <asm/mach-types.h>
-#include <asm/gpio.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/orion5x.h>
index f219914f5b291efdb9fdbe9391a26ac6c7307932..d3e71d3847b41fee6e4ef5dd2ff42b5ab259b1ab 100644 (file)
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
-
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pnx4008.h>
 
 /* register definitions */
 #define PIO_VA_BASE    IO_ADDRESS(PNX4008_PIO_BASE)
similarity index 99%
rename from arch/arm/mach-pnx4008/include/mach/gpio.h
rename to arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
index 9591467eb9ec709b9bc1b895367e10b976553f28..41027dd7cf7423641c996909a7c328f28d9f406a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * arch/arm/mach-pnx4008/include/mach/gpio.h
+ * arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
  *
  * PNX4008 GPIO driver - header file
  *
index f40961e519146d88ea39f92ca352dd9799a97211..374c138ac1ac2efe8ec6a099cab37e2f4d85be0c 100644 (file)
@@ -9,7 +9,6 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/io.h>
@@ -19,8 +18,8 @@
 
 #include <linux/serial_core.h>
 #include <linux/serial_reg.h>
-#include <mach/gpio.h>
 
+#include <mach/gpio-pnx4008.h>
 #include <mach/clock.h>
 
 #define UART_3         0
index 93f59f877fc602887435fca577780a8420bedba8..be751470d37b01dc1ec1800ec9eda365edb80bfa 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <linux/platform_device.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/nand-gpio.h>
index f5d91efc2965a81053ad87573b4fe49a8c423bb9..5432ecb15defb2c0acd61068636aa78b24ccc949 100644 (file)
@@ -16,6 +16,7 @@
  * initialization stuff for PXA machines which can be overridden later if
  * need be.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -26,7 +27,6 @@
 #include <asm/mach-types.h>
 
 #include <mach/reset.h>
-#include <mach/gpio.h>
 #include <mach/smemc.h>
 #include <mach/pxa3xx-regs.h>
 
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 (file)
index 0000000..576868f
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Written by Philipp Zabel <philipp.zabel@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __MACH_PXA_GPIO_PXA_H
+#define __MACH_PXA_GPIO_PXA_H
+
+#include <mach/irqs.h>
+#include <mach/hardware.h>
+
+#define GPIO_REGS_VIRT io_p2v(0x40E00000)
+
+#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define GPIO_REG(x)    (GPIO_REGS_VIRT + (x))
+
+/* GPIO Pin Level Registers */
+#define GPLR0          GPIO_REG(BANK_OFF(0) + 0x00)
+#define GPLR1          GPIO_REG(BANK_OFF(1) + 0x00)
+#define GPLR2          GPIO_REG(BANK_OFF(2) + 0x00)
+#define GPLR3          GPIO_REG(BANK_OFF(3) + 0x00)
+
+/* GPIO Pin Direction Registers */
+#define GPDR0          GPIO_REG(BANK_OFF(0) + 0x0c)
+#define GPDR1          GPIO_REG(BANK_OFF(1) + 0x0c)
+#define GPDR2          GPIO_REG(BANK_OFF(2) + 0x0c)
+#define GPDR3          GPIO_REG(BANK_OFF(3) + 0x0c)
+
+/* GPIO Pin Output Set Registers */
+#define GPSR0          GPIO_REG(BANK_OFF(0) + 0x18)
+#define GPSR1          GPIO_REG(BANK_OFF(1) + 0x18)
+#define GPSR2          GPIO_REG(BANK_OFF(2) + 0x18)
+#define GPSR3          GPIO_REG(BANK_OFF(3) + 0x18)
+
+/* GPIO Pin Output Clear Registers */
+#define GPCR0          GPIO_REG(BANK_OFF(0) + 0x24)
+#define GPCR1          GPIO_REG(BANK_OFF(1) + 0x24)
+#define GPCR2          GPIO_REG(BANK_OFF(2) + 0x24)
+#define GPCR3          GPIO_REG(BANK_OFF(3) + 0x24)
+
+/* GPIO Rising Edge Detect Registers */
+#define GRER0          GPIO_REG(BANK_OFF(0) + 0x30)
+#define GRER1          GPIO_REG(BANK_OFF(1) + 0x30)
+#define GRER2          GPIO_REG(BANK_OFF(2) + 0x30)
+#define GRER3          GPIO_REG(BANK_OFF(3) + 0x30)
+
+/* GPIO Falling Edge Detect Registers */
+#define GFER0          GPIO_REG(BANK_OFF(0) + 0x3c)
+#define GFER1          GPIO_REG(BANK_OFF(1) + 0x3c)
+#define GFER2          GPIO_REG(BANK_OFF(2) + 0x3c)
+#define GFER3          GPIO_REG(BANK_OFF(3) + 0x3c)
+
+/* GPIO Edge Detect Status Registers */
+#define GEDR0          GPIO_REG(BANK_OFF(0) + 0x48)
+#define GEDR1          GPIO_REG(BANK_OFF(1) + 0x48)
+#define GEDR2          GPIO_REG(BANK_OFF(2) + 0x48)
+#define GEDR3          GPIO_REG(BANK_OFF(3) + 0x48)
+
+/* GPIO Alternate Function Select Registers */
+#define GAFR0_L                GPIO_REG(0x0054)
+#define GAFR0_U                GPIO_REG(0x0058)
+#define GAFR1_L                GPIO_REG(0x005C)
+#define GAFR1_U                GPIO_REG(0x0060)
+#define GAFR2_L                GPIO_REG(0x0064)
+#define GAFR2_U                GPIO_REG(0x0068)
+#define GAFR3_L                GPIO_REG(0x006C)
+#define GAFR3_U                GPIO_REG(0x0070)
+
+/* More handy macros.  The argument is a literal GPIO number. */
+
+#define GPIO_bit(x)    (1 << ((x) & 0x1f))
+
+#define GPLR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
+#define GPDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
+#define GPSR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
+#define GPCR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
+#define GRER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
+#define GFER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
+#define GEDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
+#define GAFR(x)                GPIO_REG(0x54 + (((x) & 0x70) >> 2))
+
+
+#define NR_BUILTIN_GPIO                PXA_GPIO_IRQ_NUM
+
+#define gpio_to_bank(gpio)     ((gpio) >> 5)
+
+#ifdef CONFIG_CPU_PXA26x
+/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
+ * as well as their Alternate Function value being '1' for GPIO in GAFRx.
+ */
+static inline int __gpio_is_inverted(unsigned gpio)
+{
+       return cpu_is_pxa25x() && gpio > 85;
+}
+#else
+static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
+#endif
+
+/*
+ * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
+ * function of a GPIO, and GPDRx cannot be altered once configured. It
+ * is attributed as "occupied" here (I know this terminology isn't
+ * accurate, you are welcome to propose a better one :-)
+ */
+static inline int __gpio_is_occupied(unsigned gpio)
+{
+       if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
+               int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
+               int dir = GPDR(gpio) & GPIO_bit(gpio);
+
+               if (__gpio_is_inverted(gpio))
+                       return af != 1 || dir == 0;
+               else
+                       return af != 0 || dir != 0;
+       } else
+               return GPDR(gpio) & GPIO_bit(gpio);
+}
+
+#include <plat/gpio-pxa.h>
+#endif /* __MACH_PXA_GPIO_PXA_H */
index c4639502efcac4d236f5752172bfe2f29f7af27f..004cade7bb13b4c24ad642272f75388ebc101ef1 100644 (file)
 #ifndef __ASM_ARCH_PXA_GPIO_H
 #define __ASM_ARCH_PXA_GPIO_H
 
-#include <mach/irqs.h>
-#include <mach/hardware.h>
 #include <asm-generic/gpio.h>
+/* The defines for the driver are needed for the accelerated accessors */
+#include "gpio-pxa.h"
 
-#define GPIO_REGS_VIRT io_p2v(0x40E00000)
-
-#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
-
-/* GPIO Pin Level Registers */
-#define GPLR0          GPIO_REG(BANK_OFF(0) + 0x00)
-#define GPLR1          GPIO_REG(BANK_OFF(1) + 0x00)
-#define GPLR2          GPIO_REG(BANK_OFF(2) + 0x00)
-#define GPLR3          GPIO_REG(BANK_OFF(3) + 0x00)
-
-/* GPIO Pin Direction Registers */
-#define GPDR0          GPIO_REG(BANK_OFF(0) + 0x0c)
-#define GPDR1          GPIO_REG(BANK_OFF(1) + 0x0c)
-#define GPDR2          GPIO_REG(BANK_OFF(2) + 0x0c)
-#define GPDR3          GPIO_REG(BANK_OFF(3) + 0x0c)
-
-/* GPIO Pin Output Set Registers */
-#define GPSR0          GPIO_REG(BANK_OFF(0) + 0x18)
-#define GPSR1          GPIO_REG(BANK_OFF(1) + 0x18)
-#define GPSR2          GPIO_REG(BANK_OFF(2) + 0x18)
-#define GPSR3          GPIO_REG(BANK_OFF(3) + 0x18)
-
-/* GPIO Pin Output Clear Registers */
-#define GPCR0          GPIO_REG(BANK_OFF(0) + 0x24)
-#define GPCR1          GPIO_REG(BANK_OFF(1) + 0x24)
-#define GPCR2          GPIO_REG(BANK_OFF(2) + 0x24)
-#define GPCR3          GPIO_REG(BANK_OFF(3) + 0x24)
-
-/* GPIO Rising Edge Detect Registers */
-#define GRER0          GPIO_REG(BANK_OFF(0) + 0x30)
-#define GRER1          GPIO_REG(BANK_OFF(1) + 0x30)
-#define GRER2          GPIO_REG(BANK_OFF(2) + 0x30)
-#define GRER3          GPIO_REG(BANK_OFF(3) + 0x30)
-
-/* GPIO Falling Edge Detect Registers */
-#define GFER0          GPIO_REG(BANK_OFF(0) + 0x3c)
-#define GFER1          GPIO_REG(BANK_OFF(1) + 0x3c)
-#define GFER2          GPIO_REG(BANK_OFF(2) + 0x3c)
-#define GFER3          GPIO_REG(BANK_OFF(3) + 0x3c)
-
-/* GPIO Edge Detect Status Registers */
-#define GEDR0          GPIO_REG(BANK_OFF(0) + 0x48)
-#define GEDR1          GPIO_REG(BANK_OFF(1) + 0x48)
-#define GEDR2          GPIO_REG(BANK_OFF(2) + 0x48)
-#define GEDR3          GPIO_REG(BANK_OFF(3) + 0x48)
-
-/* GPIO Alternate Function Select Registers */
-#define GAFR0_L                GPIO_REG(0x0054)
-#define GAFR0_U                GPIO_REG(0x0058)
-#define GAFR1_L                GPIO_REG(0x005C)
-#define GAFR1_U                GPIO_REG(0x0060)
-#define GAFR2_L                GPIO_REG(0x0064)
-#define GAFR2_U                GPIO_REG(0x0068)
-#define GAFR3_L                GPIO_REG(0x006C)
-#define GAFR3_U                GPIO_REG(0x0070)
-
-/* More handy macros.  The argument is a literal GPIO number. */
-
-#define GPIO_bit(x)    (1 << ((x) & 0x1f))
-
-#define GPLR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
-#define GPDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
-#define GPSR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
-#define GPCR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
-#define GRER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
-#define GFER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
-#define GEDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
-#define GAFR(x)                GPIO_REG(0x54 + (((x) & 0x70) >> 2))
-
-
-#define NR_BUILTIN_GPIO                PXA_GPIO_IRQ_NUM
-
-#define gpio_to_bank(gpio)     ((gpio) >> 5)
 #define gpio_to_irq(gpio)      IRQ_GPIO(gpio)
 
 static inline int irq_to_gpio(unsigned int irq)
@@ -118,37 +44,5 @@ static inline int irq_to_gpio(unsigned int irq)
        return -1;
 }
 
-#ifdef CONFIG_CPU_PXA26x
-/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
- * as well as their Alternate Function value being '1' for GPIO in GAFRx.
- */
-static inline int __gpio_is_inverted(unsigned gpio)
-{
-       return cpu_is_pxa25x() && gpio > 85;
-}
-#else
-static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
-#endif
-
-/*
- * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
- * function of a GPIO, and GPDRx cannot be altered once configured. It
- * is attributed as "occupied" here (I know this terminology isn't
- * accurate, you are welcome to propose a better one :-)
- */
-static inline int __gpio_is_occupied(unsigned gpio)
-{
-       if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
-               int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
-               int dir = GPDR(gpio) & GPIO_bit(gpio);
-
-               if (__gpio_is_inverted(gpio))
-                       return af != 1 || dir == 0;
-               else
-                       return af != 0 || dir != 0;
-       } else
-               return GPDR(gpio) & GPIO_bit(gpio);
-}
-
 #include <plat/gpio.h>
 #endif
index 2a5726c15e0e446f855f857d4e773a6785ba8486..b6238cbd8aeab1da22f6da03655a93e8bfb8b8e6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __ASM_ARCH_LITTLETON_H
 #define __ASM_ARCH_LITTLETON_H
 
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 
 #define LITTLETON_ETH_PHYS     0x30000000
 
index fead5c779a23292aed89509d3aecd760262532ab..25f29adf51144918425cceef2e7d202861c9dba2 100644 (file)
@@ -11,7 +11,6 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -21,7 +20,7 @@
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 
 #include "generic.h"
 
index e30cdc8780862eb917ed544798b43950e4450bf8..2a76751aa4f441c3b27dab93795ad0295de5fd1a 100644 (file)
@@ -12,7 +12,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
@@ -39,7 +39,6 @@
 #include <asm/mach/flash.h>
 
 #include <mach/pxa27x.h>
-#include <mach/gpio.h>
 #include <mach/lpd270.h>
 #include <mach/audio.h>
 #include <mach/pxafb.h>
index a8c696bfc132929bb6256851b6790ec7e11a4afa..c48ce6da9184f6d338e15ef729f8f043d66b8e77 100644 (file)
@@ -11,6 +11,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -42,7 +43,6 @@
 #include <asm/hardware/sa1111.h>
 
 #include <mach/pxa25x.h>
-#include <mach/gpio.h>
 #include <mach/audio.h>
 #include <mach/lubbock.h>
 #include <mach/udc.h>
index 4622eb78ef25172be578f29671476c2840012e50..6bc784bb3696e29028ff65e160808c48323ca742 100644 (file)
@@ -12,7 +12,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
@@ -43,7 +43,6 @@
 #include <asm/mach/flash.h>
 
 #include <mach/pxa27x.h>
-#include <mach/gpio.h>
 #include <mach/mainstone.h>
 #include <mach/audio.h>
 #include <mach/pxafb.h>
index b27544bcafcb5c68b384d850ea522da8f8712afe..43a5f6861ca3f8209c79bd311cac9e0d87781e11 100644 (file)
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/syscore_ops.h>
 
-#include <mach/gpio.h>
 #include <mach/pxa2xx-regs.h>
 #include <mach/mfp-pxa2xx.h>
+#include <mach/gpio-pxa.h>
 
 #include "generic.h"
 
index 6d5b7e0621248d50dcb4dd90c0f876c6ec7471f5..9a9c539f6c015b51b2c6eb45a5c483786b12338e 100644 (file)
@@ -19,7 +19,7 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
@@ -28,7 +28,6 @@
 
 #include <media/soc_camera.h>
 
-#include <asm/gpio.h>
 #include <mach/camera.h>
 #include <asm/mach/map.h>
 #include <mach/pxa27x.h>
index 6c49c7c22f98cb4db25fab14d197be1be9c95be4..f05f9486b0cbfadb8f41f3ac269fc7e1e329604b 100644 (file)
@@ -16,6 +16,7 @@
  * initialization stuff for PXA machines which can be overridden later if
  * need be.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/irq.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
 #include <mach/hardware.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
 #include <mach/pxa25x.h>
 #include <mach/reset.h>
 #include <mach/pm.h>
index 729af54991cb027ddc8782c72cc9963c7b0263c0..bc5a98ebaa72872033ab49c7e535f4d5bc1317f7 100644 (file)
@@ -11,6 +11,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/i2c/pxa-i2c.h>
+#include <linux/gpio.h>
 
 #include <asm/mach/map.h>
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/suspend.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
 #include <mach/pxa27x.h>
 #include <mach/reset.h>
 #include <mach/ohci.h>
index b2479cb9467b7e9db466c1646709a1f3dbb82c81..0737c59b88ae4b571cef1e907f841c2dc9d1184b 100644 (file)
@@ -12,7 +12,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -26,7 +25,7 @@
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/reset.h>
 #include <mach/ohci.h>
index 0ee166b61f81399448d48c119f101829b1a85158..51371b39d2a315b8880a2d2d03ca5a061a00baa8 100644 (file)
@@ -9,7 +9,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -21,7 +20,7 @@
 #include <linux/syscore_ops.h>
 
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/pxa930.h>
 #include <mach/reset.h>
index aebd5d9243c3956c51a1aeac8744ef7122ec1d2e..46682176666130a284f5bb75efe42dafb5bea460 100644 (file)
@@ -9,19 +9,21 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  publishhed by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/mfd/88pm860x.h>
+#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
 #include <mach/irqs.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <mach/mfp.h>
+#include <mach/mfp-pxa930.h>
 #include <mach/pxa95x.h>
 
 #include "generic.h"
index 94ff27678a46ff9492f9e3e172e75e818049bdb2..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,6 +1 @@
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
+/* empty */
index f7f6b07df30eaa956acb0c08da276f44c08f8888..6fac70f3484e5b7f1733eb889916e20c69bda9a9 100644 (file)
  * published by the Free Software Foundation.
 */
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* some boards require extra gpio capacity to support external
  * devices that need GPIO.
  */
@@ -28,7 +23,6 @@
 #define ARCH_NR_GPIOS  (256 + CONFIG_S3C24XX_GPIO_EXTRA)
 #endif
 
-#include <asm-generic/gpio.h>
 #include <mach/gpio-nrs.h>
 #include <mach/gpio-fns.h>
 
index 97e42bfce81e4e675ac9d6eb8b90735e54696226..fc897d3a056cfc1d1c52c3f89dc8ed09f378187a 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef __ASM_ARCH_H1940_LATCH_H
 #define __ASM_ARCH_H1940_LATCH_H
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #define H1940_LATCH_GPIO(x)            (S3C_GPIO_END + (x))
 
index 0d46e994048a5ed1cb4bd4fba7be64ee864cbd38..6e34c2f6e670394ac6437662af481af2bfaa7e79 100644 (file)
  * published by the Free Software Foundation.
 */
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* GPIO bank sizes */
 #define S3C64XX_GPIO_A_NR      (8)
 #define S3C64XX_GPIO_B_NR      (7)
@@ -96,5 +91,3 @@ enum s3c_gpio_number {
 #define BOARD_NR_GPIOS 16
 
 #define ARCH_NR_GPIOS  (GPIO_BOARD_START + BOARD_NR_GPIOS)
-
-#include <asm-generic/gpio.h>
index adb5f298ead895a65db824705c7c8a7f38459ea6..06cd3c9b16ac14708831cffaf516f8d430b0a80b 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* GPIO bank sizes */
 
 #define S5P6440_GPIO_A_NR      (6)
@@ -134,6 +129,4 @@ enum s5p6450_gpio_number {
 
 #define ARCH_NR_GPIOS          (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 29a8a12d9b4f9046a4cce984917329b74683bf2b..5e1a924b595f4ca5db5c5901c2111f8ba0af3c3d 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* GPIO bank sizes */
 #define S5PC100_GPIO_A0_NR     (8)
 #define S5PC100_GPIO_A1_NR     (5)
@@ -146,6 +141,4 @@ enum s5p_gpio_number {
 /* define the number of gpios we need to the one after the MP04() range */
 #define ARCH_NR_GPIOS          (S5PC100_GPIO_END + 1)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index a5a1e331f8ed2214f27ada9fa702cbab55c50813..6c8b903c02e422f7017a2573c270f413469f2b6f 100644 (file)
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H __FILE__
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
 /* Practically, GPIO banks up to MP03 are the configurable gpio banks */
 
 /* GPIO bank sizes */
@@ -142,6 +137,4 @@ enum s5p_gpio_number {
 #define ARCH_NR_GPIOS          (S5PV210_MP05(S5PV210_GPIO_MP05_NR) +   \
                                 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
 
-#include <asm-generic/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 41252d22e6591d437e274d967126ed86dee0112a..73a5c643179209e3192ffe65dd4a5bcf6c1c21e7 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o
+obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o
 obj-m :=
 obj-n :=
 obj-  :=
index e21f3470eeceeb0d40a89e856400c40fc3a9b104..5fa5ae1f39e1164f6745704ed23f7825f16c17b6 100644 (file)
@@ -9,6 +9,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +25,6 @@
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 #include <asm/irq.h>
-#include <asm/gpio.h>
 
 #include "generic.h"
 
index 7befc104e9a97a2fef34fae884b32a8cb2d54d38..703631887c94ae0de4bb66ada4913ce7e05ea4a4 100644 (file)
@@ -28,6 +28,8 @@
 #include <asm/irq.h>
 #include <asm-generic/gpio.h>
 
+#define __ARM_GPIOLIB_COMPLEX
+
 static inline int gpio_get_value(unsigned gpio)
 {
        if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
@@ -51,7 +53,5 @@ static inline void gpio_set_value(unsigned gpio, int value)
 
 #define gpio_to_irq(gpio)      ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
                                        (IRQ_GPIO11 - 11 + gpio))
-#define irq_to_gpio(irq)       ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
-                                       (irq - IRQ_GPIO11 + 11))
 
 #endif
index 2b1bb9e43ddadc8b83505b021c5ca7ae4f4704c5..7bf0890e16ba43963171bf5dea4b3345c27e25d8 100644 (file)
 
 #ifdef CONFIG_GPIOLIB
 
-static inline int gpio_get_value(unsigned gpio)
-{
-       return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       __gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-       return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
 static inline int irq_to_gpio(unsigned int irq)
 {
        return -ENOSYS;
 }
 
+#else
+
+#define __ARM_GPIOLIB_COMPLEX
+
 #endif /* CONFIG_GPIOLIB */
 
 #endif /* __ASM_ARCH_GPIO_H */
index 9c27b95b8d869f975ae382c2eb076c6671034ba1..6db7d699ef1ca1e83a4a828d073b36ec4b0da790 100644 (file)
 
 #include <mach/pinmux.h>
 #include "board.h"
+#include "board-harmony.h"
 
 #ifdef CONFIG_TEGRA_PCI
 
-/* GPIO 3 of the PMIC */
-#define EN_VDD_1V05_GPIO       (TEGRA_NR_GPIOS + 2)
-
 static int __init harmony_pcie_init(void)
 {
        struct regulator *regulator = NULL;
@@ -38,11 +36,11 @@ static int __init harmony_pcie_init(void)
        if (!machine_is_harmony())
                return 0;
 
-       err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
+       err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
        if (err)
                return err;
 
-       gpio_direction_output(EN_VDD_1V05_GPIO, 1);
+       gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1);
 
        regulator = regulator_get(NULL, "pex_clk");
        if (IS_ERR_OR_NULL(regulator))
@@ -68,7 +66,7 @@ err_pcie:
        regulator_disable(regulator);
        regulator_put(regulator);
 err_reg:
-       gpio_free(EN_VDD_1V05_GPIO);
+       gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
 
        return err;
 }
index d85142edaf6bc0eebc7d66b385e457d91fc5a100..139d96c93843f6b94ad120789497fb4ecfde18c9 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_HARMONY_H
 #define _MACH_TEGRA_BOARD_HARMONY_H
 
+#include <mach/gpio-tegra.h>
+
 #define HARMONY_GPIO_TPS6586X(_x_)     (TEGRA_NR_GPIOS + (_x_))
 #define HARMONY_GPIO_WM8903(_x_)       (HARMONY_GPIO_TPS6586X(4) + (_x_))
 
@@ -31,6 +33,7 @@
 #define TEGRA_GPIO_HP_DET              TEGRA_GPIO_PW2
 #define TEGRA_GPIO_INT_MIC_EN          TEGRA_GPIO_PX0
 #define TEGRA_GPIO_EXT_MIC_EN          TEGRA_GPIO_PX1
+#define TEGRA_GPIO_EN_VDD_1V05_GPIO    HARMONY_GPIO_TPS6586X(2)
 
 void harmony_pinmux_init(void);
 int harmony_regulator_init(void);
index d4ff39ddaeb3e4fffbbdf62e2183e68a2013f9de..42ce8639b90cc38ef5a1c79e053d089ed86dcd0b 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_PAZ00_H
 #define _MACH_TEGRA_BOARD_PAZ00_H
 
+#include <mach/gpio-tegra.h>
+
 #define TEGRA_GPIO_SD1_CD              TEGRA_GPIO_PV5
 #define TEGRA_GPIO_SD1_WP              TEGRA_GPIO_PH1
 #define TEGRA_GPIO_SD1_POWER           TEGRA_GPIO_PT3
index d8415e1a8434f21e61eace90c0585fb00268ee94..15b6c57361bed412bf43e4de17ced72e4c0a5f60 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_SEABOARD_H
 #define _MACH_TEGRA_BOARD_SEABOARD_H
 
+#include <mach/gpio-tegra.h>
+
 #define TEGRA_GPIO_SD2_CD              TEGRA_GPIO_PI5
 #define TEGRA_GPIO_SD2_WP              TEGRA_GPIO_PH1
 #define TEGRA_GPIO_SD2_POWER           TEGRA_GPIO_PI6
index 47c596cdbf32e4012d003574388cd935099c54a0..bcb1916e68b99d1ffd9167065d4d82fcc662eb7f 100644 (file)
  * GNU General Public License for more details.
  *
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 
 #include <mach/pinmux.h>
-#include <mach/gpio.h>
 
 #include "gpio-names.h"
 #include "board-trimslice.h"
index 7a7dee86b4da717a3ac00982f31674754c50c924..50f128d87779d2ef3888cca009883c036ea09015 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H
 #define _MACH_TEGRA_BOARD_TRIMSLICE_H
 
+#include <mach/gpio-tegra.h>
+
 #define TRIMSLICE_GPIO_SD4_CD  TEGRA_GPIO_PP1  /* mmc4 cd */
 #define TRIMSLICE_GPIO_SD4_WP  TEGRA_GPIO_PP2  /* mmc4 wp */
 
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 (file)
index 0000000..87d37fd
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * arch/arm/mach-tegra/include/mach/gpio.h
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * Author:
+ *     Erik Gilling <konkers@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_TEGRA_GPIO_TEGRA_H
+#define __MACH_TEGRA_GPIO_TEGRA_H
+
+#include <linux/types.h>
+#include <mach/irqs.h>
+
+#define TEGRA_NR_GPIOS         INT_GPIO_NR
+
+#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
+
+struct tegra_gpio_table {
+       int     gpio;   /* GPIO number */
+       bool    enable; /* Enable for GPIO at init? */
+};
+
+void tegra_gpio_config(struct tegra_gpio_table *table, int num);
+void tegra_gpio_enable(int gpio);
+void tegra_gpio_disable(int gpio);
+
+#endif
index 196f114dc241fa704f9972f478cc42afbc5331c9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,60 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/gpio.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * Author:
- *     Erik Gilling <konkers@google.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MACH_TEGRA_GPIO_H
-#define __MACH_TEGRA_GPIO_H
-
-#include <linux/init.h>
-#include <mach/irqs.h>
-
-#define TEGRA_NR_GPIOS         INT_GPIO_NR
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value         __gpio_get_value
-#define gpio_set_value         __gpio_set_value
-#define gpio_cansleep          __gpio_cansleep
-
-#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
-#define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE)
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-       if (gpio < TEGRA_NR_GPIOS)
-               return INT_GPIO_BASE + gpio;
-       return -EINVAL;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-       if ((irq >= INT_GPIO_BASE) && (irq < INT_GPIO_BASE + INT_GPIO_NR))
-               return irq - INT_GPIO_BASE;
-       return -EINVAL;
-}
-
-struct tegra_gpio_table {
-       int     gpio;   /* GPIO number */
-       bool    enable; /* Enable for GPIO at init? */
-};
-
-void tegra_gpio_config(struct tegra_gpio_table *table, int num);
-void tegra_gpio_enable(int gpio);
-void tegra_gpio_disable(int gpio);
-
-#endif
index 88081bb3ec52dd807092ea397685126f2a1602f2..37576a721aeb7c6b549b7201a9999901f901956f 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 #include <asm/mach-types.h>
+#include <mach/gpio-tegra.h>
 #include <mach/usb_phy.h>
 #include <mach/iomap.h>
 
index 32a7b0f7e9f79b4b11aa021b1250bc872879ce7e..7b5c229dc7eaf2f757b3adf5536c835cb7a5d38a 100644 (file)
@@ -6,6 +6,7 @@ comment "ST-Ericsson Mobile Platform Products"
 
 config MACH_U300
        bool "U300"
+       select GPIO_U300
 
 comment "ST-Ericsson U300/U330/U335/U365 Feature Selections"
 
index 399c89f14dfb5b9d78835409611c748c7411a40b..fd435f44098b50c0cade9b7f24814fa8e3231ca7 100644 (file)
@@ -37,6 +37,7 @@
 #include <mach/hardware.h>
 #include <mach/syscon.h>
 #include <mach/dma_channels.h>
+#include <mach/gpio-u300.h>
 
 #include "clock.h"
 #include "mmc.h"
@@ -239,7 +240,7 @@ static struct resource gpio_resources[] = {
                .end   = IRQ_U300_GPIO_PORT2,
                .flags = IORESOURCE_IRQ,
        },
-#ifdef U300_COH901571_3
+#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
        {
                .name  = "gpio3",
                .start = IRQ_U300_GPIO_PORT3,
@@ -252,6 +253,7 @@ static struct resource gpio_resources[] = {
                .end   = IRQ_U300_GPIO_PORT4,
                .flags = IORESOURCE_IRQ,
        },
+#endif
 #ifdef CONFIG_MACH_U300_BS335
        {
                .name  = "gpio5",
@@ -266,7 +268,6 @@ static struct resource gpio_resources[] = {
                .flags = IORESOURCE_IRQ,
        },
 #endif /* CONFIG_MACH_U300_BS335 */
-#endif /* U300_COH901571_3 */
 };
 
 static struct resource keypad_resources[] = {
@@ -1556,11 +1557,35 @@ static struct platform_device i2c1_device = {
        .resource = i2c1_resources,
 };
 
+/*
+ * The different variants have a few different versions of the
+ * GPIO block, with different number of ports.
+ */
+static struct u300_gpio_platform u300_gpio_plat = {
+#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
+       .variant = U300_GPIO_COH901335,
+       .ports = 3,
+#endif
+#ifdef CONFIG_MACH_U300_BS335
+       .variant = U300_GPIO_COH901571_3_BS335,
+       .ports = 7,
+#endif
+#ifdef CONFIG_MACH_U300_BS365
+       .variant = U300_GPIO_COH901571_3_BS365,
+       .ports = 5,
+#endif
+       .gpio_base = 0,
+       .gpio_irq_base = IRQ_U300_GPIO_BASE,
+};
+
 static struct platform_device gpio_device = {
        .name = "u300-gpio",
        .id = -1,
        .num_resources = ARRAY_SIZE(gpio_resources),
        .resource = gpio_resources,
+       .dev = {
+               .platform_data = &u300_gpio_plat,
+       },
 };
 
 static struct platform_device keypad_device = {
@@ -1666,7 +1691,7 @@ void __init u300_init_irq(void)
        BUG_ON(IS_ERR(clk));
        clk_enable(clk);
 
-       for (i = 0; i < NR_IRQS; i++)
+       for (i = 0; i < U300_VIC_IRQS_END; i++)
                set_bit(i, (unsigned long *) &mask[0]);
        vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
        vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
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 (file)
index 0000000..0c2b202
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2007-2011 ST-Ericsson AB
+ * License terms: GNU General Public License (GPL) version 2
+ * GPIO block resgister definitions and inline macros for
+ * U300 GPIO COH 901 335 or COH 901 571/3
+ * Author: Linus Walleij <linus.walleij@stericsson.com>
+ */
+
+#ifndef __MACH_U300_GPIO_U300_H
+#define __MACH_U300_GPIO_U300_H
+
+/*
+ * Individual pin assignments for the B26/S26. Notice that the
+ * actual usage of these pins depends on the PAD MUX settings, that
+ * is why the same number can potentially appear several times.
+ * In the reference design each pin is only used for one purpose.
+ * These were determined by inspecting the B26/S26 schematic:
+ * 2/1911-ROA 128 1603
+ */
+#ifdef CONFIG_MACH_U300_BS2X
+#define U300_GPIO_PIN_UART_RX          0
+#define U300_GPIO_PIN_UART_TX          1
+#define U300_GPIO_PIN_GPIO02           2  /* Unrouted */
+#define U300_GPIO_PIN_GPIO03           3  /* Unrouted */
+#define U300_GPIO_PIN_CAM_SLEEP                4
+#define U300_GPIO_PIN_CAM_REG_EN       5
+#define U300_GPIO_PIN_GPIO06           6  /* Unrouted */
+#define U300_GPIO_PIN_GPIO07           7  /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO08           8  /* Service point SP2321 */
+#define U300_GPIO_PIN_GPIO09           9  /* Service point SP2322 */
+#define U300_GPIO_PIN_PHFSENSE         10 /* Headphone jack sensing */
+#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
+#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
+#define U300_GPIO_PIN_FLIPSENSE                13 /* Mechanical flip sensing */
+#define U300_GPIO_PIN_GPIO14           14 /* DSP JTAG Port RTCK */
+#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO16           16 /* Unrouted */
+#define U300_GPIO_PIN_GPIO17           17 /* Unrouted */
+#define U300_GPIO_PIN_GPIO18           18 /* Unrouted */
+#define U300_GPIO_PIN_GPIO19           19 /* Unrouted */
+#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
+#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
+#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
+#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
+#endif
+
+/*
+ * Individual pin assignments for the B330/S330 and B365/S365.
+ * Notice that the actual usage of these pins depends on the
+ * PAD MUX settings, that is why the same number can potentially
+ * appear several times. In the reference design each pin is only
+ * used for one purpose. These were determined by inspecting the
+ * S365 schematic.
+ */
+#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
+    defined(CONFIG_MACH_U300_BS335)
+#define U300_GPIO_PIN_UART_RX          0
+#define U300_GPIO_PIN_UART_TX          1
+#define U300_GPIO_PIN_UART_CTS         2
+#define U300_GPIO_PIN_UART_RTS         3
+#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
+#define U300_GPIO_PIN_GPIO05           5 /* Unrouted */
+#define U300_GPIO_PIN_MS_CD            6 /* Memory Stick Card insertion */
+#define U300_GPIO_PIN_GPIO07           7 /* Test point TP2430 */
+
+#define U300_GPIO_PIN_GPIO08           8 /* Test point TP2437 */
+#define U300_GPIO_PIN_GPIO09           9 /* Test point TP2431 */
+#define U300_GPIO_PIN_GPIO10           10 /* Test point TP2432 */
+#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
+#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
+#define U300_GPIO_PIN_CAM_SUB_STANDBY  13 /* Camera SUB standby */
+#define U300_GPIO_PIN_GPIO14           14 /* Test point TP2436 */
+#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO16           16 /* Test point TP2438 */
+#define U300_GPIO_PIN_PHFSENSE         17 /* Headphone jack sensing */
+#define U300_GPIO_PIN_GPIO18           18 /* Test point TP2439 */
+#define U300_GPIO_PIN_GPIO19           19 /* Routed somewhere */
+#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
+#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
+#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
+#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO24           24 /* Unrouted */
+#define U300_GPIO_PIN_GPIO25           25 /* Unrouted */
+#define U300_GPIO_PIN_GPIO26           26 /* Unrouted */
+#define U300_GPIO_PIN_GPIO27           27 /* Unrouted */
+#define U300_GPIO_PIN_GPIO28           28 /* Unrouted */
+#define U300_GPIO_PIN_GPIO29           29 /* Unrouted */
+#define U300_GPIO_PIN_GPIO30           30 /* Unrouted */
+#define U300_GPIO_PIN_GPIO31           31 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO32           32 /* Unrouted */
+#define U300_GPIO_PIN_GPIO33           33 /* Unrouted */
+#define U300_GPIO_PIN_GPIO34           34 /* Unrouted */
+#define U300_GPIO_PIN_GPIO35           35 /* Unrouted */
+#define U300_GPIO_PIN_GPIO36           36 /* Unrouted */
+#define U300_GPIO_PIN_GPIO37           37 /* Unrouted */
+#define U300_GPIO_PIN_GPIO38           38 /* Unrouted */
+#define U300_GPIO_PIN_GPIO39           39 /* Unrouted */
+
+#ifdef CONFIG_MACH_U300_BS335
+
+#define U300_GPIO_PIN_GPIO40           40 /* Unrouted */
+#define U300_GPIO_PIN_GPIO41           41 /* Unrouted */
+#define U300_GPIO_PIN_GPIO42           42 /* Unrouted */
+#define U300_GPIO_PIN_GPIO43           43 /* Unrouted */
+#define U300_GPIO_PIN_GPIO44           44 /* Unrouted */
+#define U300_GPIO_PIN_GPIO45           45 /* Unrouted */
+#define U300_GPIO_PIN_GPIO46           46 /* Unrouted */
+#define U300_GPIO_PIN_GPIO47           47 /* Unrouted */
+
+#define U300_GPIO_PIN_GPIO48           48 /* Unrouted */
+#define U300_GPIO_PIN_GPIO49           49 /* Unrouted */
+#define U300_GPIO_PIN_GPIO50           50 /* Unrouted */
+#define U300_GPIO_PIN_GPIO51           51 /* Unrouted */
+#define U300_GPIO_PIN_GPIO52           52 /* Unrouted */
+#define U300_GPIO_PIN_GPIO53           53 /* Unrouted */
+#define U300_GPIO_PIN_GPIO54           54 /* Unrouted */
+#define U300_GPIO_PIN_GPIO55           55 /* Unrouted */
+#endif
+
+#endif
+
+/**
+ * enum u300_gpio_variant - the type of U300 GPIO employed
+ */
+enum u300_gpio_variant {
+       U300_GPIO_COH901335,
+       U300_GPIO_COH901571_3_BS335,
+       U300_GPIO_COH901571_3_BS365,
+};
+
+/**
+ * struct u300_gpio_platform - U300 GPIO platform data
+ * @variant: IP block variant
+ * @ports: number of GPIO block ports
+ * @gpio_base: first GPIO number for this block (use a free range)
+ * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
+ */
+struct u300_gpio_platform {
+       enum u300_gpio_variant variant;
+       u8 ports;
+       int gpio_base;
+       int gpio_irq_base;
+};
+
+#endif /* __MACH_U300_GPIO_U300_H */
index d5a71abcbaeaf5a8da0255e50e89f5982fd447d4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,294 +0,0 @@
-/*
- *
- * arch/arm/mach-u300/include/mach/gpio.h
- *
- *
- * Copyright (C) 2007-2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * GPIO block resgister definitions and inline macros for
- * U300 GPIO COH 901 335 or COH 901 571/3
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- */
-
-#ifndef __MACH_U300_GPIO_H
-#define __MACH_U300_GPIO_H
-
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <mach/hardware.h>
-#include <asm/irq.h>
-
-/* Switch type depending on platform/chip variant */
-#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
-#define U300_COH901335
-#endif
-#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
-#define U300_COH901571_3
-#endif
-
-/* Get base address for regs here */
-#include "u300-regs.h"
-/* IRQ numbers */
-#include "irqs.h"
-
-/*
- * This is the GPIO block definitions. GPIO (General Purpose I/O) can be
- * used for anything, and often is. The event/enable etc figures are for
- * the lowermost pin (pin 0 on each port), shift this left to match your
- * pin if you're gonna use these values.
- */
-#ifdef U300_COH901335
-#define U300_GPIO_PORTX_SPACING                                (0x1C)
-/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
-#define U300_GPIO_PXPDIR                               (0x00)
-#define U300_GPIO_PXPDOR                               (0x00)
-/* Port X Pin Config Register 32bit (R/W) */
-#define U300_GPIO_PXPCR                                        (0x04)
-#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK             (0x0000FFFFUL)
-#define U300_GPIO_PXPCR_PIN_MODE_MASK                  (0x00000003UL)
-#define U300_GPIO_PXPCR_PIN_MODE_SHIFT                 (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_INPUT                 (0x00000000UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL      (0x00000001UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN     (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE    (0x00000003UL)
-/* Port X Interrupt Event Register 32bit (R/W) */
-#define U300_GPIO_PXIEV                                        (0x08)
-#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIEV_IRQ_EVENT                      (0x00000001UL)
-/* Port X Interrupt Enable Register 32bit (R/W) */
-#define U300_GPIO_PXIEN                                        (0x0C)
-#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK            (0x000000FFUL)
-#define U300_GPIO_PXIEN_IRQ_ENABLE                     (0x00000001UL)
-/* Port X Interrupt Force Register 32bit (R/W) */
-#define U300_GPIO_PXIFR                                        (0x10)
-#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIFR_IRQ_FORCE                      (0x00000001UL)
-/* Port X Interrupt Config Register 32bit (R/W) */
-#define U300_GPIO_PXICR                                        (0x14)
-#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK            (0x000000FFUL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_MASK                        (0x00000001UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE                (0x00000000UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE         (0x00000001UL)
-/* Port X Pull-up Enable Register 32bit (R/W) */
-#define U300_GPIO_PXPER                                        (0x18)
-#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK       (0x000000FFUL)
-#define U300_GPIO_PXPER_PULL_UP_DISABLE                        (0x00000001UL)
-/* Control Register 32bit (R/W) */
-#define U300_GPIO_CR                                   (0x54)
-#define U300_GPIO_CR_BLOCK_CLOCK_ENABLE                        (0x00000001UL)
-/* three ports of 8 bits each = GPIO pins 0..23 */
-#define U300_GPIO_NUM_PORTS 3
-#define U300_GPIO_PINS_PER_PORT 8
-#define U300_GPIO_MAX  (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
-#endif
-
-#ifdef U300_COH901571_3
-/*
- * Control Register 32bit (R/W)
- * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
- * gives the number of GPIO pins.
- * bit 8-2  (mask 0x000001FC) contains the core version ID.
- */
-#define U300_GPIO_CR                                   (0x00)
-#define U300_GPIO_CR_SYNC_SEL_ENABLE                   (0x00000002UL)
-#define U300_GPIO_CR_BLOCK_CLKRQ_ENABLE                        (0x00000001UL)
-#define U300_GPIO_PORTX_SPACING                                (0x30)
-/* Port X Pin Data INPUT Register 32bit (R/W) */
-#define U300_GPIO_PXPDIR                               (0x04)
-/* Port X Pin Data OUTPUT Register 32bit (R/W) */
-#define U300_GPIO_PXPDOR                               (0x08)
-/* Port X Pin Config Register 32bit (R/W) */
-#define U300_GPIO_PXPCR                                        (0x0C)
-#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK             (0x0000FFFFUL)
-#define U300_GPIO_PXPCR_PIN_MODE_MASK                  (0x00000003UL)
-#define U300_GPIO_PXPCR_PIN_MODE_SHIFT                 (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_INPUT                 (0x00000000UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL      (0x00000001UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN     (0x00000002UL)
-#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE    (0x00000003UL)
-/* Port X Pull-up Enable Register 32bit (R/W) */
-#define U300_GPIO_PXPER                                        (0x10)
-#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK       (0x000000FFUL)
-#define U300_GPIO_PXPER_PULL_UP_DISABLE                        (0x00000001UL)
-/* Port X Interrupt Event Register 32bit (R/W) */
-#define U300_GPIO_PXIEV                                        (0x14)
-#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIEV_IRQ_EVENT                      (0x00000001UL)
-/* Port X Interrupt Enable Register 32bit (R/W) */
-#define U300_GPIO_PXIEN                                        (0x18)
-#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK            (0x000000FFUL)
-#define U300_GPIO_PXIEN_IRQ_ENABLE                     (0x00000001UL)
-/* Port X Interrupt Force Register 32bit (R/W) */
-#define U300_GPIO_PXIFR                                        (0x1C)
-#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK             (0x000000FFUL)
-#define U300_GPIO_PXIFR_IRQ_FORCE                      (0x00000001UL)
-/* Port X Interrupt Config Register 32bit (R/W) */
-#define U300_GPIO_PXICR                                        (0x20)
-#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK            (0x000000FFUL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_MASK                        (0x00000001UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE                (0x00000000UL)
-#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE         (0x00000001UL)
-#ifdef CONFIG_MACH_U300_BS335
-/* seven ports of 8 bits each = GPIO pins 0..55 */
-#define U300_GPIO_NUM_PORTS 7
-#else
-/* five ports of 8 bits each = GPIO pins 0..39 */
-#define U300_GPIO_NUM_PORTS 5
-#endif
-#define U300_GPIO_PINS_PER_PORT 8
-#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
-#endif
-
-/*
- * Individual pin assignments for the B26/S26. Notice that the
- * actual usage of these pins depends on the PAD MUX settings, that
- * is why the same number can potentially appear several times.
- * In the reference design each pin is only used for one purpose.
- * These were determined by inspecting the B26/S26 schematic:
- * 2/1911-ROA 128 1603
- */
-#ifdef CONFIG_MACH_U300_BS2X
-#define U300_GPIO_PIN_UART_RX          0
-#define U300_GPIO_PIN_UART_TX          1
-#define U300_GPIO_PIN_GPIO02           2  /* Unrouted */
-#define U300_GPIO_PIN_GPIO03           3  /* Unrouted */
-#define U300_GPIO_PIN_CAM_SLEEP                4
-#define U300_GPIO_PIN_CAM_REG_EN       5
-#define U300_GPIO_PIN_GPIO06           6  /* Unrouted */
-#define U300_GPIO_PIN_GPIO07           7  /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO08           8  /* Service point SP2321 */
-#define U300_GPIO_PIN_GPIO09           9  /* Service point SP2322 */
-#define U300_GPIO_PIN_PHFSENSE         10 /* Headphone jack sensing */
-#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
-#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
-#define U300_GPIO_PIN_FLIPSENSE                13 /* Mechanical flip sensing */
-#define U300_GPIO_PIN_GPIO14           14 /* DSP JTAG Port RTCK */
-#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO16           16 /* Unrouted */
-#define U300_GPIO_PIN_GPIO17           17 /* Unrouted */
-#define U300_GPIO_PIN_GPIO18           18 /* Unrouted */
-#define U300_GPIO_PIN_GPIO19           19 /* Unrouted */
-#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
-#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
-#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
-#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
-#endif
-
-/*
- * Individual pin assignments for the B330/S330 and B365/S365.
- * Notice that the actual usage of these pins depends on the
- * PAD MUX settings, that is why the same number can potentially
- * appear several times. In the reference design each pin is only
- * used for one purpose. These were determined by inspecting the
- * S365 schematic.
- */
-#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
-    defined(CONFIG_MACH_U300_BS335)
-#define U300_GPIO_PIN_UART_RX          0
-#define U300_GPIO_PIN_UART_TX          1
-#define U300_GPIO_PIN_UART_CTS         2
-#define U300_GPIO_PIN_UART_RTS         3
-#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
-#define U300_GPIO_PIN_GPIO05           5 /* Unrouted */
-#define U300_GPIO_PIN_MS_CD            6 /* Memory Stick Card insertion */
-#define U300_GPIO_PIN_GPIO07           7 /* Test point TP2430 */
-
-#define U300_GPIO_PIN_GPIO08           8 /* Test point TP2437 */
-#define U300_GPIO_PIN_GPIO09           9 /* Test point TP2431 */
-#define U300_GPIO_PIN_GPIO10           10 /* Test point TP2432 */
-#define U300_GPIO_PIN_MMC_CLKRET       11 /* Clock return from MMC/SD card */
-#define U300_GPIO_PIN_MMC_CD           12 /* MMC Card insertion detection */
-#define U300_GPIO_PIN_CAM_SUB_STANDBY  13 /* Camera SUB standby */
-#define U300_GPIO_PIN_GPIO14           14 /* Test point TP2436 */
-#define U300_GPIO_PIN_GPIO15           15 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO16           16 /* Test point TP2438 */
-#define U300_GPIO_PIN_PHFSENSE         17 /* Headphone jack sensing */
-#define U300_GPIO_PIN_GPIO18           18 /* Test point TP2439 */
-#define U300_GPIO_PIN_GPIO19           19 /* Routed somewhere */
-#define U300_GPIO_PIN_GPIO20           20 /* Unrouted */
-#define U300_GPIO_PIN_GPIO21           21 /* Unrouted */
-#define U300_GPIO_PIN_GPIO22           22 /* Unrouted */
-#define U300_GPIO_PIN_GPIO23           23 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO24           24 /* Unrouted */
-#define U300_GPIO_PIN_GPIO25           25 /* Unrouted */
-#define U300_GPIO_PIN_GPIO26           26 /* Unrouted */
-#define U300_GPIO_PIN_GPIO27           27 /* Unrouted */
-#define U300_GPIO_PIN_GPIO28           28 /* Unrouted */
-#define U300_GPIO_PIN_GPIO29           29 /* Unrouted */
-#define U300_GPIO_PIN_GPIO30           30 /* Unrouted */
-#define U300_GPIO_PIN_GPIO31           31 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO32           32 /* Unrouted */
-#define U300_GPIO_PIN_GPIO33           33 /* Unrouted */
-#define U300_GPIO_PIN_GPIO34           34 /* Unrouted */
-#define U300_GPIO_PIN_GPIO35           35 /* Unrouted */
-#define U300_GPIO_PIN_GPIO36           36 /* Unrouted */
-#define U300_GPIO_PIN_GPIO37           37 /* Unrouted */
-#define U300_GPIO_PIN_GPIO38           38 /* Unrouted */
-#define U300_GPIO_PIN_GPIO39           39 /* Unrouted */
-
-#ifdef CONFIG_MACH_U300_BS335
-
-#define U300_GPIO_PIN_GPIO40           40 /* Unrouted */
-#define U300_GPIO_PIN_GPIO41           41 /* Unrouted */
-#define U300_GPIO_PIN_GPIO42           42 /* Unrouted */
-#define U300_GPIO_PIN_GPIO43           43 /* Unrouted */
-#define U300_GPIO_PIN_GPIO44           44 /* Unrouted */
-#define U300_GPIO_PIN_GPIO45           45 /* Unrouted */
-#define U300_GPIO_PIN_GPIO46           46 /* Unrouted */
-#define U300_GPIO_PIN_GPIO47           47 /* Unrouted */
-
-#define U300_GPIO_PIN_GPIO48           48 /* Unrouted */
-#define U300_GPIO_PIN_GPIO49           49 /* Unrouted */
-#define U300_GPIO_PIN_GPIO50           50 /* Unrouted */
-#define U300_GPIO_PIN_GPIO51           51 /* Unrouted */
-#define U300_GPIO_PIN_GPIO52           52 /* Unrouted */
-#define U300_GPIO_PIN_GPIO53           53 /* Unrouted */
-#define U300_GPIO_PIN_GPIO54           54 /* Unrouted */
-#define U300_GPIO_PIN_GPIO55           55 /* Unrouted */
-#endif
-
-#endif
-
-/* translates a pin number to a port number */
-#define PIN_TO_PORT(val) (val >> 3)
-
-/* These can be found in arch/arm/mach-u300/gpio.c */
-extern int gpio_is_valid(int number);
-extern int gpio_request(unsigned gpio, const char *label);
-extern void gpio_free(unsigned gpio);
-extern int gpio_direction_input(unsigned gpio);
-extern int gpio_direction_output(unsigned gpio, int value);
-extern int gpio_register_callback(unsigned gpio,
-                                 int (*func)(void *arg),
-                                 void *);
-extern int gpio_unregister_callback(unsigned gpio);
-extern void enable_irq_on_gpio_pin(unsigned gpio, int edge);
-extern void disable_irq_on_gpio_pin(unsigned gpio);
-extern void gpio_pullup(unsigned gpio, int value);
-extern int gpio_get_value(unsigned gpio);
-extern void gpio_set_value(unsigned gpio, int value);
-
-#define gpio_get_value_cansleep gpio_get_value
-#define gpio_set_value_cansleep gpio_set_value
-
-/* wrappers to sleep-enable the previous two functions */
-static inline unsigned gpio_to_irq(unsigned gpio)
-{
-       return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0;
-}
-
-static inline unsigned irq_to_gpio(unsigned irq)
-{
-       /*
-        * FIXME: This is no 1-1 mapping at all, it points to the
-        * whole block of 8 pins.
-        */
-       return (irq - IRQ_U300_GPIO_PORT0) << 3;
-}
-
-#endif
index 09b1b28fa8fd948f611d8dbede95877233ec2045..d270fea32926dcf7687013f4cb0fbe0bb4c70694 100644 (file)
@@ -72,7 +72,7 @@
 
 /* DB3150 and DB3200 have only 45 IRQs */
 #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
-#define U300_NR_IRQS                   45
+#define U300_VIC_IRQS_END              45
 #endif
 
 /* The DB3350-specific interrupt lines */
@@ -88,7 +88,7 @@
 #define IRQ_U300_GPIO_PORT4            53
 #define IRQ_U300_GPIO_PORT5            54
 #define IRQ_U300_GPIO_PORT6            55
-#define U300_NR_IRQS                   56
+#define U300_VIC_IRQS_END              56
 #endif
 
 /* The DB3210-specific interrupt lines */
 #define IRQ_U300_NFIF                  45
 #define IRQ_U300_NFIF2                 46
 #define IRQ_U300_SYSCON_PLL_LOCK       47
-#define U300_NR_IRQS                   48
+#define U300_VIC_IRQS_END              48
 #endif
 
-#ifdef CONFIG_AB3550_CORE
-#define IRQ_AB3550_BASE                        (U300_NR_IRQS)
-#define IRQ_AB3550_END                 (IRQ_AB3550_BASE + 37)
+/* Maximum 8*7 GPIO lines */
+#ifdef CONFIG_GPIO_U300
+#define IRQ_U300_GPIO_BASE             (U300_VIC_IRQS_END)
+#define IRQ_U300_GPIO_END              (IRQ_U300_GPIO_BASE + 56)
+#else
+#define IRQ_U300_GPIO_END              (U300_VIC_IRQS_END)
+#endif
 
-#define NR_IRQS                                (IRQ_AB3550_END + 1)
+/* Optional AB3550 mixsig chip */
+#ifdef CONFIG_AB3550_CORE
+#define IRQ_AB3550_BASE                        (IRQ_U300_GPIO_END)
+#define IRQ_AB3550_END                 (IRQ_AB3550_BASE + 38)
 #else
-#define NR_IRQS U300_NR_IRQS
+#define IRQ_AB3550_END                 (IRQ_U300_GPIO_END)
 #endif
 
+#define NR_IRQS                                (IRQ_AB3550_END)
+
 #endif
index 677ccef5cd32eddbe1e309d0f169e70af547e041..d9a5c92db74a5cc0aa9a69276bdd17fc464628ff 100644 (file)
 #include <linux/device.h>
 #include <linux/amba/bus.h>
 #include <linux/mmc/host.h>
-#include <linux/gpio.h>
 #include <linux/dmaengine.h>
 #include <linux/amba/mmci.h>
 #include <linux/slab.h>
 #include <mach/coh901318.h>
 #include <mach/dma_channels.h>
+#include <mach/gpio-u300.h>
 
 #include "mmc.h"
 #include "padmux.h"
index f26fd76f72b4f26301b2af1226664c4767ae6b86..15b23e4bd48888cd9e5a83b9a89b3de7394ca8be 100644 (file)
@@ -6,10 +6,10 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/gpio.h>
 
 #include <asm/mach-types.h>
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 
 #include "pins-db8500.h"
index 8ce46c0fdfd5fc706afa8f710de8cd7f5fe3d463..feb5744d98b7d7658f3d58290b0b1c76ded8f295 100644 (file)
@@ -4,7 +4,7 @@
  * Board data for the U8500 UIB, also known as the New UIB
  * License terms: GNU General Public License (GPL), version 2
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
@@ -13,7 +13,6 @@
 #include <linux/mfd/tc3589x.h>
 #include <linux/input/matrix_keypad.h>
 
-#include <mach/gpio.h>
 #include <mach/irqs.h>
 
 #include "board-mop500.h"
index cd54abaccd96460e1a821d574223887dedb82f86..537ab63c1dc96dc45cd40e9986c3445f6e0384f8 100644 (file)
@@ -37,6 +37,7 @@
 #include <plat/i2c.h>
 #include <plat/ste_dma40.h>
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 #include <mach/setup.h>
index 739fb4c5b1605e2ee19dab40501cb788a9de712f..63c3f8058ffcb370821f3d79a2f94dd7d0e44b88 100644 (file)
@@ -7,9 +7,9 @@
 
 #include <linux/amba/mmci.h>
 #include <linux/mmc/host.h>
-#include <linux/gpio.h>
 
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/db5500-regs.h>
 #include <plat/ste_dma40.h>
 
index e58f0f562426236c0cd91f11a583cf231003750d..2d9e191bd30aab720d59a13491479acb41862f02 100644 (file)
@@ -8,7 +8,6 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/amba/bus.h>
-#include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/i2c.h>
 
@@ -17,6 +16,7 @@
 
 #include <plat/pincfg.h>
 #include <plat/i2c.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 #include <mach/devices.h>
index 22705d246fc7ee8262858f46e521a1bd86276f27..9de1af0080944cdcd57c3da3dd48634da24fd279 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/mach/map.h>
 #include <asm/pmu.h>
 
-#include <plat/gpio.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 #include <mach/devices.h>
index 4598b06c8c554383a711b205f103ebfae29b87e7..13e8890a8b8aae91361998a8ac7c330fd7d9727c 100644 (file)
 #include <linux/amba/bus.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
 #include <asm/mach/map.h>
 #include <asm/pmu.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
 #include <mach/setup.h>
 #include <mach/devices.h>
index 13a4ce046ae55926961a22c08ba4820df5a54299..c563e5418d80b5af3e99e2a76f776e44c9b94e0a 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/platform_device.h>
 #include <linux/amba/bus.h>
 
-#include <plat/gpio.h>
+#include <plat/gpio-nomadik.h>
 
 #include <mach/hardware.h>
 
index 3c4cd31ad9f734a8b463ad4f2b24b50ef1c3836b..7389df911b1ac8639e6e1dc3c5975d9ed5c112dc 100644 (file)
@@ -7,6 +7,4 @@
  */
 #define ARCH_NR_GPIOS  350
 
-#include <plat/gpio.h>
-
 #endif /* __ASM_ARCH_GPIO_H */
index 94ff27678a46ff9492f9e3e172e75e818049bdb2..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,6 +1 @@
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
+/* empty */
index 94ff27678a46ff9492f9e3e172e75e818049bdb2..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,6 +1 @@
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
+/* empty */
index 034da3e390c9b60e82a23ec18c7e778fcb611717..5385a42032779094043069f005b3e0a9cb8435b2 100644 (file)
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
 
 static inline int gpio_to_irq(unsigned gpio)
 {
        return gpio;
 }
+#define gpio_to_irq gpio_to_irq
 
 static inline int irq_to_gpio(unsigned irq)
 {
index 31c820c1b7960eb3e0d64aa9dfc782f9c7e4ff00..3e1ffc8b8f0c2d56283bdbc92b476bb07f86196d 100644 (file)
 
 #include <linux/spinlock.h>
 #include <mach/hardware.h>
-#include <asm-generic/gpio.h>
 
 
 /* There's a off-by-one betweem the gpio bank number and the gpiochip */
 /* range e.g. GPIO_1_5 is gpio 5 under linux */
 #define IMX_GPIO_NR(bank, nr)          (((bank) - 1) * 32 + (nr))
 
-/* use gpiolib dispatchers */
-#define gpio_get_value         __gpio_get_value
-#define gpio_set_value         __gpio_set_value
-#define gpio_cansleep          __gpio_cansleep
-
 #define gpio_to_irq(gpio)      (MXC_GPIO_IRQ_START + (gpio))
 #define irq_to_gpio(irq)       ((irq) - MXC_GPIO_IRQ_START)
 
similarity index 82%
rename from arch/arm/plat-nomadik/include/plat/gpio.h
rename to arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
index d5d7e651269c3b434c5f500c5a491b9f7e3437c1..3ba4d8f8073baf10279e3c69122c822c87d8bb1c 100644 (file)
@@ -9,20 +9,9 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#ifndef __ASM_PLAT_GPIO_H
-#define __ASM_PLAT_GPIO_H
 
-#include <asm-generic/gpio.h>
-
-/*
- * These currently cause a function call to happen, they may be optimized
- * if needed by adding cpu-specific defines to identify blocks
- * (see mach-pxa/include/mach/gpio.h as an example using GPLR etc)
- */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#define gpio_to_irq     __gpio_to_irq
+#ifndef __PLAT_NOMADIK_GPIO
+#define __PLAT_NOMADIK_GPIO
 
 /*
  * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
@@ -93,4 +82,4 @@ struct nmk_gpio_platform_data {
        bool supports_sleepmode;
 };
 
-#endif /* __ASM_PLAT_GPIO_H */
+#endif /* __PLAT_NOMADIK_GPIO */
index 923c9621096b85f63e6e8c6ba2fa9909b3c06311..caa1f7b6cc2145995bedeaa321a77078869c3bf7 100644 (file)
@@ -8,7 +8,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
@@ -18,7 +18,6 @@
 #include <mach/hardware.h>
 
 #include <plat/board.h>
-#include <mach/gpio.h>
 
 
 /* Many OMAP development platforms reuse the same "debug board"; these
index fc05b10226026e6b514adaa10199bf270cbba7f2..61a1ec2a6af4273e1c7693fdd4191ba3c92a0616 100644 (file)
@@ -7,7 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/leds.h>
@@ -19,7 +19,6 @@
 #include <asm/mach-types.h>
 
 #include <plat/fpga.h>
-#include <mach/gpio.h>
 
 
 /* Many OMAP development platforms reuse the same "debug board"; these
index ea28f98d5d6a63da2ab5ede0327ec9188f5caf97..64c3bd4aa54ecbd43c9d4f6eeccaaf97fa0001e1 100644 (file)
@@ -8,7 +8,7 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -24,7 +24,6 @@
 #include <plat/tc.h>
 #include <plat/board.h>
 #include <plat/mmc.h>
-#include <mach/gpio.h>
 #include <plat/menelaus.h>
 #include <plat/mcbsp.h>
 #include <plat/omap44xx.h>
index 91e8de3db085d195be80690fbb5139149d7040f6..9e86ee0aed0a05fb5ad448d144a84a93e21e5d53 100644 (file)
@@ -222,26 +222,6 @@ extern void omap_gpio_restore_context(void);
 #include <linux/errno.h>
 #include <asm-generic/gpio.h>
 
-static inline int gpio_get_value(unsigned gpio)
-{
-       return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       __gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-       return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-       return __gpio_to_irq(gpio);
-}
-
 static inline int irq_to_gpio(unsigned irq)
 {
        int tmp;
index 3075b9fdde831fc314522ca4636a9d4b99227b67..3abf30428beed9caf85574e63cf9440f068c8225 100644 (file)
 #define __PLAT_GPIO_H
 
 #include <linux/init.h>
-#include <asm-generic/gpio.h>
-
-/*
- * GENERIC_GPIO primitives.
- */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#define gpio_to_irq     __gpio_to_irq
+#include <linux/types.h>
 
 /*
  * Orion-specific GPIO API extensions.
index 3aca5ba0f87654cf9055a880363f39fedc233473..f302d048392db9df129f7b5e025a007e28f11419 100644 (file)
@@ -4,7 +4,6 @@
 
 obj-y  := dma.o
 
-obj-$(CONFIG_GENERIC_GPIO)     += gpio.o
 obj-$(CONFIG_PXA3xx)           += mfp.o
 obj-$(CONFIG_PXA95x)           += mfp.o
 obj-$(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 (file)
index 0000000..b6390be
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef __PLAT_PXA_GPIO_H
+#define __PLAT_PXA_GPIO_H
+
+struct irq_data;
+
+/*
+ * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
+ * one set of registers. The register offsets are organized below:
+ *
+ *           GPLR    GPDR    GPSR    GPCR    GRER    GFER    GEDR
+ * BANK 0 - 0x0000  0x000C  0x0018  0x0024  0x0030  0x003C  0x0048
+ * BANK 1 - 0x0004  0x0010  0x001C  0x0028  0x0034  0x0040  0x004C
+ * BANK 2 - 0x0008  0x0014  0x0020  0x002C  0x0038  0x0044  0x0050
+ *
+ * BANK 3 - 0x0100  0x010C  0x0118  0x0124  0x0130  0x013C  0x0148
+ * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
+ * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
+ *
+ * NOTE:
+ *   BANK 3 is only available on PXA27x and later processors.
+ *   BANK 4 and 5 are only available on PXA935
+ */
+
+#define GPIO_BANK(n)   (GPIO_REGS_VIRT + BANK_OFF(n))
+
+#define GPLR_OFFSET    0x00
+#define GPDR_OFFSET    0x0C
+#define GPSR_OFFSET    0x18
+#define GPCR_OFFSET    0x24
+#define GRER_OFFSET    0x30
+#define GFER_OFFSET    0x3C
+#define GEDR_OFFSET    0x48
+
+/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
+ * Those cases currently cause holes in the GPIO number space, the
+ * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
+ */
+extern int pxa_last_gpio;
+
+typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
+
+extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
+
+#endif /* __PLAT_PXA_GPIO_H */
index 1ddd2b97a72995d90107cb05d0658b1c035236f5..258f77210b02ab8784771aa89b9d2d0b9428169a 100644 (file)
@@ -1,35 +1,10 @@
 #ifndef __PLAT_GPIO_H
 #define __PLAT_GPIO_H
 
-struct irq_data;
+#define __ARM_GPIOLIB_COMPLEX
 
-/*
- * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
- * one set of registers. The register offsets are organized below:
- *
- *           GPLR    GPDR    GPSR    GPCR    GRER    GFER    GEDR
- * BANK 0 - 0x0000  0x000C  0x0018  0x0024  0x0030  0x003C  0x0048
- * BANK 1 - 0x0004  0x0010  0x001C  0x0028  0x0034  0x0040  0x004C
- * BANK 2 - 0x0008  0x0014  0x0020  0x002C  0x0038  0x0044  0x0050
- *
- * BANK 3 - 0x0100  0x010C  0x0118  0x0124  0x0130  0x013C  0x0148
- * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
- * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
- *
- * NOTE:
- *   BANK 3 is only available on PXA27x and later processors.
- *   BANK 4 and 5 are only available on PXA935
- */
-
-#define GPIO_BANK(n)   (GPIO_REGS_VIRT + BANK_OFF(n))
-
-#define GPLR_OFFSET    0x00
-#define GPDR_OFFSET    0x0C
-#define GPSR_OFFSET    0x18
-#define GPCR_OFFSET    0x24
-#define GRER_OFFSET    0x30
-#define GFER_OFFSET    0x3C
-#define GEDR_OFFSET    0x48
+/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
+#include <mach/gpio-pxa.h>
 
 static inline int gpio_get_value(unsigned gpio)
 {
@@ -52,13 +27,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
 
 #define gpio_cansleep          __gpio_cansleep
 
-/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
- * Those cases currently cause holes in the GPIO number space, the
- * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
- */
-extern int pxa_last_gpio;
-
-typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
-
-extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
 #endif /* __PLAT_GPIO_H */
index b857c91257dde3c885c1b3bf1d813b0ae4adf961..40a8c178f10d9e85a2873c83247c3f2fe553f408 100644 (file)
@@ -1,24 +1 @@
-/*
- * arch/arm/plat-spear/include/plat/gpio.h
- *
- * GPIO macros for SPEAr platform
- *
- * Copyright (C) 2009 ST Microelectronics
- * Viresh Kumar<viresh.kumar@st.com>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#ifndef __PLAT_GPIO_H
-#define __PLAT_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep  __gpio_cansleep
-#define gpio_to_irq    __gpio_to_irq
-
-#endif /* __PLAT_GPIO_H */
+/* empty */
index 960c725713951632869b9bc01585374ea2e5ae4d..3f4c2613b3dfa1a2f672bbb6d86383dc2e58d029 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <mach/at91sam9_smc.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #define DRV_NAME               "pata_at91"
 #define DRV_VERSION            "0.3"
index d539efd96d4b8d5b7c032c5c0767543da7413cd7..4caa3d37bbde5783164f47cc68e278bb4d243c0d 100644 (file)
@@ -178,6 +178,15 @@ config GPIO_SCH
          The Intel Tunnel Creek processor has 5 GPIOs powered by the
          core power rail and 9 from suspend power supply.
 
+config GPIO_U300
+       bool "ST-Ericsson U300 COH 901 335/571 GPIO"
+       depends on GPIOLIB && ARCH_U300
+       help
+         Say yes here to support GPIO interface on ST-Ericsson U300.
+         The names of the two IP block variants supported are
+         COH 901 335 and COH 901 571/3. They contain 3, 5 or 7
+         ports of 8 GPIO pins each.
+
 config GPIO_VX855
        tristate "VIA VX855/VX875 GPIO"
        depends on MFD_SUPPORT && PCI
index 9588948c96f08b2e8487b6333d7151fd1e914267..19c5d27b6d2e916216594bca14e7243983634bf1 100644 (file)
@@ -14,11 +14,14 @@ obj-$(CONFIG_GPIO_ADP5588)  += gpio-adp5588.o
 obj-$(CONFIG_GPIO_BT8XX)       += gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CS5535)      += gpio-cs5535.o
 obj-$(CONFIG_GPIO_DA9052)      += gpio-da9052.o
+obj-$(CONFIG_ARCH_DAVINCI)     += gpio-davinci.o
 obj-$(CONFIG_GPIO_EP93XX)      += gpio-ep93xx.o
 obj-$(CONFIG_GPIO_EXYNOS4)     += gpio-exynos4.o
 obj-$(CONFIG_GPIO_IT8761E)     += gpio-it8761e.o
 obj-$(CONFIG_GPIO_JANZ_TTL)    += gpio-janz-ttl.o
+obj-$(CONFIG_MACH_KS8695)      += gpio-ks8695.o
 obj-$(CONFIG_GPIO_LANGWELL)    += gpio-langwell.o
+obj-$(CONFIG_ARCH_LPC32XX)     += gpio-lpc32xx.o
 obj-$(CONFIG_GPIO_MAX730X)     += gpio-max730x.o
 obj-$(CONFIG_GPIO_MAX7300)     += gpio-max7300.o
 obj-$(CONFIG_GPIO_MAX7301)     += gpio-max7301.o
@@ -37,18 +40,20 @@ obj-$(CONFIG_GPIO_PCA953X)  += gpio-pca953x.o
 obj-$(CONFIG_GPIO_PCF857X)     += gpio-pcf857x.o
 obj-$(CONFIG_GPIO_PCH)         += gpio-pch.o
 obj-$(CONFIG_GPIO_PL061)       += gpio-pl061.o
+obj-$(CONFIG_PLAT_PXA)         += gpio-pxa.o
 obj-$(CONFIG_GPIO_RDC321X)     += gpio-rdc321x.o
 
 obj-$(CONFIG_GPIO_PLAT_SAMSUNG)        += gpio-plat-samsung.o
 obj-$(CONFIG_GPIO_S5PC100)     += gpio-s5pc100.o
 obj-$(CONFIG_GPIO_S5PV210)     += gpio-s5pv210.o
-
+obj-$(CONFIG_ARCH_SA1100)      += gpio-sa1100.o
 obj-$(CONFIG_GPIO_SCH)         += gpio-sch.o
 obj-$(CONFIG_GPIO_STMPE)       += gpio-stmpe.o
 obj-$(CONFIG_GPIO_SX150X)      += gpio-sx150x.o
 obj-$(CONFIG_GPIO_TC3589X)     += gpio-tc3589x.o
 obj-$(CONFIG_ARCH_TEGRA)       += gpio-tegra.o
 obj-$(CONFIG_GPIO_TIMBERDALE)  += gpio-timberdale.o
+obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += gpio-tnetv107x.o
 obj-$(CONFIG_GPIO_TPS65910)    += gpio-tps65910.o
 obj-$(CONFIG_GPIO_TPS65912)    += gpio-tps65912.o
 obj-$(CONFIG_GPIO_TWL4030)     += gpio-twl4030.o
similarity index 98%
rename from arch/arm/mach-davinci/gpio.c
rename to drivers/gpio/gpio-davinci.c
index cafbe13a82a5c5bc56e24bf60fd37fae1d324c4c..df0d59570a8410ac4ae1dfa89bed1c016ef3c2e5 100644 (file)
@@ -9,15 +9,13 @@
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
-
+#include <linux/gpio.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
 
-#include <mach/gpio.h>
-
 #include <asm/mach/irq.h>
 
 struct davinci_gpio_regs {
@@ -232,9 +230,6 @@ static void gpio_irq_enable(struct irq_data *d)
 
 static int gpio_irq_type(struct irq_data *d, unsigned trigger)
 {
-       struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
-       u32 mask = (u32) irq_data_get_irq_handler_data(d);
-
        if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
                return -EINVAL;
 
index 72fb9c665320804b43c7e9bff8bcd663fdc2ba74..7aafbb4373396661dc1afc15b4606c11c77bb20c 100644 (file)
@@ -23,6 +23,9 @@
 #include <linux/basic_mmio_gpio.h>
 
 #include <mach/hardware.h>
+#include <mach/gpio-ep93xx.h>
+
+#define irq_to_gpio(irq)       ((irq) - gpio_to_irq(0))
 
 struct ep93xx_gpio {
        void __iomem            *mmio_base;
@@ -307,6 +310,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
        return 0;
 }
 
+/*
+ * Map GPIO A0..A7  (0..7)  to irq 64..71,
+ *          B0..B7  (7..15) to irq 72..79, and
+ *          F0..F7 (16..24) to irq 80..87.
+ */
+static int ep93xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+       int gpio = chip->base + offset;
+
+       if (gpio > EP93XX_GPIO_LINE_MAX_IRQ)
+               return -EINVAL;
+
+       return 64 + gpio;
+}
+
 static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
        void __iomem *mmio_base, struct ep93xx_gpio_bank *bank)
 {
@@ -321,8 +339,10 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
        bgc->gc.label = bank->label;
        bgc->gc.base = bank->base;
 
-       if (bank->has_debounce)
+       if (bank->has_debounce) {
                bgc->gc.set_debounce = ep93xx_gpio_set_debounce;
+               bgc->gc.to_irq = ep93xx_gpio_to_irq;
+       }
 
        return gpiochip_add(&bgc->gc);
 }
similarity index 99%
rename from arch/arm/mach-ks8695/gpio.c
rename to drivers/gpio/gpio-ks8695.c
index 31e456508a6f4d83adbf06d256216a717dd1b96c..a3ac66ea364b8cce3f624b9000d4e5c53e906c1b 100644 (file)
@@ -18,7 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
+#include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/init.h>
@@ -31,7 +31,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/gpio.h>
+#include <mach/gpio-ks8695.h>
 
 /*
  * Configure a GPIO line for either GPIO function, or its internal
similarity index 99%
rename from arch/arm/mach-lpc32xx/gpiolib.c
rename to drivers/gpio/gpio-lpc32xx.c
index 69061ea8997afee70dafdd260c37b1ba49851559..5b6948081f8fb3d953d5f95703ed6dac95f9e23d 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include "common.h"
+#include <mach/gpio-lpc32xx.h>
 
 #define LPC32XX_GPIO_P3_INP_STATE              _GPREG(0x000)
 #define LPC32XX_GPIO_P3_OUTP_SET               _GPREG(0x004)
index 2c212c732d76e5e0996fb90a354f33e383ab7297..740caed2b278bc4defd03dccb5444885ec6804d2 100644 (file)
@@ -27,8 +27,9 @@
 #include <asm/mach/irq.h>
 
 #include <plat/pincfg.h>
+#include <plat/gpio-nomadik.h>
 #include <mach/hardware.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 /*
  * The GPIO module in the Nomadik family of Systems-on-Chip is an
index 0599854e22171449ed214366140313b4ac38e152..9c27244fd680ecf06e9e3309e983a8810c83baae 100644 (file)
@@ -25,7 +25,7 @@
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <asm/mach/irq.h>
 
 struct gpio_bank {
similarity index 99%
rename from arch/arm/plat-pxa/gpio.c
rename to drivers/gpio/gpio-pxa.c
index 0db7615c2cf012722ee38cdf2a822b5618e24056..ee137712f9db2cc1820343b210ce00556ee0b003 100644 (file)
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/syscore_ops.h>
 #include <linux/slab.h>
 
-#include <mach/gpio.h>
+#include <mach/gpio-pxa.h>
 
 int pxa_last_gpio;
 
similarity index 96%
rename from arch/arm/mach-sa1100/gpio.c
rename to drivers/gpio/gpio-sa1100.c
index 0d3829a8c2c1df94cd2e8ceb3ef8aa751291a336..b6c1f6d80649a93145daef13d6fcfd042fe20e47 100644 (file)
@@ -7,13 +7,11 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 
-#include <asm/gpio.h>
 #include <mach/hardware.h>
-#include "generic.h"
 
 static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
index 747eb40e8afe267dc998a2abed4c96f81f332f49..6b65207c8106d031fd68be1380c0656f35d68969 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <asm/mach/irq.h>
 
+#include <mach/gpio-tegra.h>
 #include <mach/iomap.h>
 #include <mach/suspend.h>
 
@@ -134,7 +135,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
        return 0;
 }
 
-
+static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+       return TEGRA_GPIO_TO_IRQ(offset);
+}
 
 static struct gpio_chip tegra_gpio_chip = {
        .label                  = "tegra-gpio",
@@ -142,6 +146,7 @@ static struct gpio_chip tegra_gpio_chip = {
        .get                    = tegra_gpio_get,
        .direction_output       = tegra_gpio_direction_output,
        .set                    = tegra_gpio_set,
+       .to_irq                 = tegra_gpio_to_irq,
        .base                   = 0,
        .ngpio                  = TEGRA_NR_GPIOS,
 };
@@ -331,6 +336,7 @@ static struct lock_class_key gpio_lock_class;
 static int __init tegra_gpio_init(void)
 {
        struct tegra_gpio_bank *bank;
+       int gpio;
        int i;
        int j;
 
@@ -352,14 +358,17 @@ static int __init tegra_gpio_init(void)
 
        gpiochip_add(&tegra_gpio_chip);
 
-       for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {
-               bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))];
+       for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
+               int irq = TEGRA_GPIO_TO_IRQ(gpio);
+               /* No validity check; all Tegra GPIOs are valid IRQs */
+
+               bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
 
-               irq_set_lockdep_class(i, &gpio_lock_class);
-               irq_set_chip_data(i, bank);
-               irq_set_chip_and_handler(i, &tegra_gpio_irq_chip,
+               irq_set_lockdep_class(irq, &gpio_lock_class);
+               irq_set_chip_data(irq, bank);
+               irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
                                         handle_simple_irq);
-               set_irq_flags(i, IRQF_VALID);
+               set_irq_flags(irq, IRQF_VALID);
        }
 
        for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
index 53e8255cb0bac91dd5562a0c15336257229d015a..4035778852b0d7a1cfbc97d16ab1f8637c1bba59 100644 (file)
@@ -1,18 +1,17 @@
 /*
  * U300 GPIO module.
  *
- * Copyright (C) 2007-2009 ST-Ericsson AB
+ * Copyright (C) 2007-2011 ST-Ericsson AB
  * License terms: GNU General Public License (GPL) version 2
  * This can driver either of the two basic GPIO cores
  * available in the U300 platforms:
  * COH 901 335   - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0)
  * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0)
- * Notice that you also have inline macros in <asm-arch/gpio.h>
- * Author: Linus Walleij <linus.walleij@stericsson.com>
+ * Author: Linus Walleij <linus.walleij@linaro.org>
  * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
- *
  */
 #include <linux/module.h>
+#include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <mach/gpio-u300.h>
 
-/* Reference to GPIO block clock */
-static struct clk *clk;
+/*
+ * Bias modes for U300 GPIOs
+ *
+ * GPIO_U300_CONFIG_BIAS_UNKNOWN: this bias mode is not known to us
+ * GPIO_U300_CONFIG_BIAS_FLOAT: no specific bias, the GPIO will float or state
+ *     is not controlled by software
+ * GPIO_U300_CONFIG_BIAS_PULL_UP: the GPIO will be pulled up (usually with high
+ *     impedance to VDD)
+ */
+#define GPIO_U300_CONFIG_BIAS_UNKNOWN  0x1000
+#define GPIO_U300_CONFIG_BIAS_FLOAT    0x1001
+#define GPIO_U300_CONFIG_BIAS_PULL_UP  0x1002
 
-/* Memory resource */
-static struct resource *memres;
-static void __iomem *virtbase;
-static struct device *gpiodev;
+/*
+ * Drive modes for U300 GPIOs (output)
+ *
+ * GPIO_U300_CONFIG_DRIVE_PUSH_PULL: the GPIO will be driven actively high and
+ *     low, this is the most typical case and is typically achieved with two
+ *     active transistors on the output
+ * GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: the GPIO will be driven with open drain
+ *     (open collector) which means it is usually wired with other output
+ *     ports which are then pulled up with an external resistor
+ * GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: the GPIO will be driven with open drain
+ *     (open emitter) which is the same as open drain mutatis mutandis but
+ *     pulled to ground
+ */
+#define GPIO_U300_CONFIG_DRIVE_PUSH_PULL       0x2000
+#define GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN      0x2001
+#define GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE     0x2002
+
+/*
+ * Register definitions for COH 901 335 variant
+ */
+#define U300_335_PORT_STRIDE                           (0x1C)
+/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
+#define U300_335_PXPDIR                                        (0x00)
+#define U300_335_PXPDOR                                        (0x00)
+/* Port X Pin Config Register 32bit (R/W) */
+#define U300_335_PXPCR                                 (0x04)
+/* This register layout is the same in both blocks */
+#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK             (0x0000FFFFUL)
+#define U300_GPIO_PXPCR_PIN_MODE_MASK                  (0x00000003UL)
+#define U300_GPIO_PXPCR_PIN_MODE_SHIFT                 (0x00000002UL)
+#define U300_GPIO_PXPCR_PIN_MODE_INPUT                 (0x00000000UL)
+#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL      (0x00000001UL)
+#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN     (0x00000002UL)
+#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE    (0x00000003UL)
+/* Port X Interrupt Event Register 32bit (R/W) */
+#define U300_335_PXIEV                                 (0x08)
+/* Port X Interrupt Enable Register 32bit (R/W) */
+#define U300_335_PXIEN                                 (0x0C)
+/* Port X Interrupt Force Register 32bit (R/W) */
+#define U300_335_PXIFR                                 (0x10)
+/* Port X Interrupt Config Register 32bit (R/W) */
+#define U300_335_PXICR                                 (0x14)
+/* This register layout is the same in both blocks */
+#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK            (0x000000FFUL)
+#define U300_GPIO_PXICR_IRQ_CONFIG_MASK                        (0x00000001UL)
+#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE                (0x00000000UL)
+#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE         (0x00000001UL)
+/* Port X Pull-up Enable Register 32bit (R/W) */
+#define U300_335_PXPER                                 (0x18)
+/* This register layout is the same in both blocks */
+#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK       (0x000000FFUL)
+#define U300_GPIO_PXPER_PULL_UP_DISABLE                        (0x00000001UL)
+/* Control Register 32bit (R/W) */
+#define U300_335_CR                                    (0x54)
+#define U300_335_CR_BLOCK_CLOCK_ENABLE                 (0x00000001UL)
+
+/*
+ * Register definitions for COH 901 571 / 3 variant
+ */
+#define U300_571_PORT_STRIDE                           (0x30)
+/*
+ * Control Register 32bit (R/W)
+ * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
+ * gives the number of GPIO pins.
+ * bit 8-2  (mask 0x000001FC) contains the core version ID.
+ */
+#define U300_571_CR                                    (0x00)
+#define U300_571_CR_SYNC_SEL_ENABLE                    (0x00000002UL)
+#define U300_571_CR_BLOCK_CLKRQ_ENABLE                 (0x00000001UL)
+/*
+ * These registers have the same layout and function as the corresponding
+ * COH 901 335 registers, just at different offset.
+ */
+#define U300_571_PXPDIR                                        (0x04)
+#define U300_571_PXPDOR                                        (0x08)
+#define U300_571_PXPCR                                 (0x0C)
+#define U300_571_PXPER                                 (0x10)
+#define U300_571_PXIEV                                 (0x14)
+#define U300_571_PXIEN                                 (0x18)
+#define U300_571_PXIFR                                 (0x1C)
+#define U300_571_PXICR                                 (0x20)
+
+/* 8 bits per port, no version has more than 7 ports */
+#define U300_GPIO_PINS_PER_PORT 8
+#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * 7)
+
+struct u300_gpio {
+       struct gpio_chip chip;
+       struct list_head port_list;
+       struct clk *clk;
+       struct resource *memres;
+       void __iomem *base;
+       struct device *dev;
+       int irq_base;
+       u32 stride;
+       /* Register offsets */
+       u32 pcr;
+       u32 dor;
+       u32 dir;
+       u32 per;
+       u32 icr;
+       u32 ien;
+       u32 iev;
+};
 
 struct u300_gpio_port {
-       const char *name;
+       struct list_head node;
+       struct u300_gpio *gpio;
+       char name[8];
        int irq;
        int number;
+       u8 toggle_edge_mode;
 };
 
+/*
+ * Macro to expand to read a specific register found in the "gpio"
+ * struct. It requires the struct u300_gpio *gpio variable to exist in
+ * its context. It calculates the port offset from the given pin
+ * offset, muliplies by the port stride and adds the register offset
+ * so it provides a pointer to the desired register.
+ */
+#define U300_PIN_REG(pin, reg) \
+       (gpio->base + (pin >> 3) * gpio->stride + gpio->reg)
 
-static struct u300_gpio_port gpio_ports[] = {
-       {
-               .name = "gpio0",
-               .number = 0,
-       },
-       {
-               .name = "gpio1",
-               .number = 1,
-       },
-       {
-               .name = "gpio2",
-               .number = 2,
-       },
-#ifdef U300_COH901571_3
-       {
-               .name = "gpio3",
-               .number = 3,
-       },
-       {
-               .name = "gpio4",
-               .number = 4,
-       },
-#ifdef CONFIG_MACH_U300_BS335
-       {
-               .name = "gpio5",
-               .number = 5,
-       },
-       {
-               .name = "gpio6",
-               .number = 6,
-       },
-#endif
-#endif
+/*
+ * Provides a bitmask for a specific gpio pin inside an 8-bit GPIO
+ * register.
+ */
+#define U300_PIN_BIT(pin) \
+       (1 << (pin & 0x07))
 
+struct u300_gpio_confdata {
+       u16 bias_mode;
+       bool output;
+       int outval;
 };
 
+/* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */
+#define BS335_GPIO_NUM_PORTS 7
+/* BS365 has five ports of 8 bits each = GPIO pins 0..39 */
+#define BS365_GPIO_NUM_PORTS 5
 
-#ifdef U300_COH901571_3
+#define U300_FLOATING_INPUT { \
+       .bias_mode = GPIO_U300_CONFIG_BIAS_FLOAT, \
+       .output = false, \
+}
 
-/* Default input value */
-#define DEFAULT_OUTPUT_LOW   0
-#define DEFAULT_OUTPUT_HIGH  1
+#define U300_PULL_UP_INPUT { \
+       .bias_mode = GPIO_U300_CONFIG_BIAS_PULL_UP, \
+       .output = false, \
+}
 
-/* GPIO Pull-Up status */
-#define DISABLE_PULL_UP  0
-#define ENABLE_PULL_UP  1
+#define U300_OUTPUT_LOW { \
+       .output = true, \
+       .outval = 0, \
+}
 
-#define GPIO_NOT_USED 0
-#define GPIO_IN       1
-#define GPIO_OUT      2
+#define U300_OUTPUT_HIGH { \
+       .output = true, \
+       .outval = 1, \
+}
 
-struct u300_gpio_configuration_data {
-       unsigned char pin_usage;
-       unsigned char default_output_value;
-       unsigned char pull_up;
-};
 
 /* Initial configuration */
-const struct u300_gpio_configuration_data
-u300_gpio_config[U300_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
-#ifdef CONFIG_MACH_U300_BS335
+static const struct __initdata u300_gpio_confdata
+bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
        /* Port 0, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_HIGH,  DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_HIGH,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        },
        /* Port 1, pins 0-7 */
        {
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_HIGH,  DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_HIGH,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        },
        /* Port 2, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
        },
        /* Port 3, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_PULL_UP_INPUT,
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 4, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 5, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 6, pind 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
        }
-#endif
+};
 
-#ifdef CONFIG_MACH_U300_BS365
+static const struct __initdata u300_gpio_confdata
+bs365_gpio_config[BS365_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
        /* Port 0, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_FLOATING_INPUT,
        },
        /* Port 1, pins 0-7 */
        {
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_HIGH,  DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP}
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_LOW,
+               U300_FLOATING_INPUT,
+               U300_FLOATING_INPUT,
+               U300_OUTPUT_HIGH,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        },
        /* Port 2, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,   DISABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_FLOATING_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
        },
        /* Port 3, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
        },
        /* Port 4, pins 0-7 */
        {
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_IN,  DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
+               U300_PULL_UP_INPUT,
                /* These 4 pins doesn't exist on DB3210 */
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP},
-               {GPIO_OUT, DEFAULT_OUTPUT_LOW,    ENABLE_PULL_UP}
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
+               U300_OUTPUT_LOW,
        }
-#endif
 };
-#endif
 
-
-/* No users == we can power down GPIO */
-static int gpio_users;
-
-struct gpio_struct {
-       int (*callback)(void *);
-       void *data;
-       int users;
-};
-
-static struct gpio_struct gpio_pin[U300_GPIO_MAX];
-
-/*
- * Let drivers register callback in order to get notified when there is
- * an interrupt on the gpio pin
+/**
+ * to_u300_gpio() - get the pointer to u300_gpio
+ * @chip: the gpio chip member of the structure u300_gpio
  */
-int gpio_register_callback(unsigned gpio, int (*func)(void *arg), void *data)
+static inline struct u300_gpio *to_u300_gpio(struct gpio_chip *chip)
 {
-       if (gpio_pin[gpio].callback)
-               dev_warn(gpiodev, "%s: WARNING: callback already "
-                        "registered for gpio pin#%d\n", __func__, gpio);
-       gpio_pin[gpio].callback = func;
-       gpio_pin[gpio].data = data;
-
-       return 0;
+       return container_of(chip, struct u300_gpio, chip);
 }
-EXPORT_SYMBOL(gpio_register_callback);
 
-int gpio_unregister_callback(unsigned gpio)
+static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-       if (!gpio_pin[gpio].callback)
-               dev_warn(gpiodev, "%s: WARNING: callback already "
-                        "unregistered for gpio pin#%d\n", __func__, gpio);
-       gpio_pin[gpio].callback = NULL;
-       gpio_pin[gpio].data = NULL;
+       struct u300_gpio *gpio = to_u300_gpio(chip);
 
-       return 0;
+       return readl(U300_PIN_REG(offset, dir)) & U300_PIN_BIT(offset);
 }
-EXPORT_SYMBOL(gpio_unregister_callback);
 
-/* Non-zero means valid */
-int gpio_is_valid(int number)
+static void u300_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-       if (number >= 0 &&
-           number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT))
-               return 1;
-       return 0;
-}
-EXPORT_SYMBOL(gpio_is_valid);
+       struct u300_gpio *gpio = to_u300_gpio(chip);
+       unsigned long flags;
+       u32 val;
 
-int gpio_request(unsigned gpio, const char *label)
-{
-       if (gpio_pin[gpio].users)
-               return -EINVAL;
-       else
-               gpio_pin[gpio].users++;
+       local_irq_save(flags);
 
-       gpio_users++;
+       val = readl(U300_PIN_REG(offset, dor));
+       if (value)
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
+       else
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
 
-       return 0;
+       local_irq_restore(flags);
 }
-EXPORT_SYMBOL(gpio_request);
 
-void gpio_free(unsigned gpio)
+static int u300_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-       gpio_users--;
-       gpio_pin[gpio].users--;
-       if (unlikely(gpio_pin[gpio].users < 0)) {
-               dev_warn(gpiodev, "warning: gpio#%d release mismatch\n",
-                        gpio);
-               gpio_pin[gpio].users = 0;
-       }
-
-       return;
-}
-EXPORT_SYMBOL(gpio_free);
+       struct u300_gpio *gpio = to_u300_gpio(chip);
+       unsigned long flags;
+       u32 val;
 
-/* This returns zero or nonzero */
-int gpio_get_value(unsigned gpio)
-{
-       return readl(virtbase + U300_GPIO_PXPDIR +
-         PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) & (1 << (gpio & 0x07));
+       local_irq_save(flags);
+       val = readl(U300_PIN_REG(offset, pcr));
+       /* Mask out this pin, note 2 bits per setting */
+       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1));
+       writel(val, U300_PIN_REG(offset, pcr));
+       local_irq_restore(flags);
+       return 0;
 }
-EXPORT_SYMBOL(gpio_get_value);
 
-/*
- * We hope that the compiler will optimize away the unused branch
- * in case "value" is a constant
- */
-void gpio_set_value(unsigned gpio, int value)
+static int u300_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
+                                     int value)
 {
-       u32 val;
+       struct u300_gpio *gpio = to_u300_gpio(chip);
        unsigned long flags;
+       u32 oldmode;
+       u32 val;
 
        local_irq_save(flags);
-       if (value) {
-               /* set */
-               val = readl(virtbase + U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING)
-                 & (1 << (gpio & 0x07));
-               writel(val | (1 << (gpio & 0x07)), virtbase +
-                 U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
-       } else {
-               /* clear */
-               val = readl(virtbase + U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING)
-                 & (1 << (gpio & 0x07));
-               writel(val & ~(1 << (gpio & 0x07)), virtbase +
-                 U300_GPIO_PXPDOR +
-                 PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
+       val = readl(U300_PIN_REG(offset, pcr));
+       /*
+        * Drive mode must be set by the special mode set function, set
+        * push/pull mode by default if no mode has been selected.
+        */
+       oldmode = val & (U300_GPIO_PXPCR_PIN_MODE_MASK <<
+                        ((offset & 0x07) << 1));
+       /* mode = 0 means input, else some mode is already set */
+       if (oldmode == 0) {
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK <<
+                        ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
        }
+       u300_gpio_set(chip, offset, value);
        local_irq_restore(flags);
+       return 0;
 }
-EXPORT_SYMBOL(gpio_set_value);
 
-int gpio_direction_input(unsigned gpio)
+static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
+       struct u300_gpio *gpio = to_u300_gpio(chip);
+       int retirq = gpio->irq_base + offset;
+
+       dev_dbg(gpio->dev, "request IRQ for GPIO %d, return %d\n", offset,
+               retirq);
+       return retirq;
+}
+
+static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
+                    u16 param, unsigned long *data)
+{
+       struct u300_gpio *gpio = to_u300_gpio(chip);
        unsigned long flags;
        u32 val;
 
-       if (gpio > U300_GPIO_MAX)
-               return -EINVAL;
-
        local_irq_save(flags);
-       val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       /* Mask out this pin*/
-       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1));
-       /* This is not needed since it sets the bits to zero.*/
-       /* val |= (U300_GPIO_PXPCR_PIN_MODE_INPUT << (gpio*2)); */
-       writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
+       switch (param) {
+       case GPIO_U300_CONFIG_BIAS_UNKNOWN:
+       case GPIO_U300_CONFIG_BIAS_FLOAT:
+               val = readl(U300_PIN_REG(offset, per));
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
+               break;
+       case GPIO_U300_CONFIG_BIAS_PULL_UP:
+               val = readl(U300_PIN_REG(offset, per));
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
+               break;
+       case GPIO_U300_CONFIG_DRIVE_PUSH_PULL:
+               val = readl(U300_PIN_REG(offset, pcr));
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
+                        << ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
+               break;
+       case GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN:
+               val = readl(U300_PIN_REG(offset, pcr));
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
+                        << ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
+               break;
+       case GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE:
+               val = readl(U300_PIN_REG(offset, pcr));
+               val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
+                        << ((offset & 0x07) << 1));
+               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE
+                       << ((offset & 0x07) << 1));
+               writel(val, U300_PIN_REG(offset, pcr));
+               break;
+       default:
+               local_irq_restore(flags);
+               dev_err(gpio->dev, "illegal configuration requested\n");
+               return -EINVAL;
+       }
        local_irq_restore(flags);
        return 0;
 }
-EXPORT_SYMBOL(gpio_direction_input);
 
-int gpio_direction_output(unsigned gpio, int value)
+static struct gpio_chip u300_gpio_chip = {
+       .label                  = "u300-gpio-chip",
+       .owner                  = THIS_MODULE,
+       .get                    = u300_gpio_get,
+       .set                    = u300_gpio_set,
+       .direction_input        = u300_gpio_direction_input,
+       .direction_output       = u300_gpio_direction_output,
+       .to_irq                 = u300_gpio_to_irq,
+};
+
+static void u300_toggle_trigger(struct u300_gpio *gpio, unsigned offset)
 {
-       unsigned long flags;
        u32 val;
 
-       if (gpio > U300_GPIO_MAX)
-               return -EINVAL;
-
-       local_irq_save(flags);
-       val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       /* Mask out this pin */
-       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1));
-       /*
-        * FIXME: configure for push/pull, open drain or open source per pin
-        * in setup. The current driver will only support push/pull.
-        */
-       val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
-                       << ((gpio & 0x07) << 1));
-       writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       gpio_set_value(gpio, value);
-       local_irq_restore(flags);
-       return 0;
+       val = readl(U300_PIN_REG(offset, icr));
+       /* Set mode depending on state */
+       if (u300_gpio_get(&gpio->chip, offset)) {
+               /* High now, let's trigger on falling edge next then */
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               dev_dbg(gpio->dev, "next IRQ on falling edge on pin %d\n",
+                       offset);
+       } else {
+               /* Low now, let's trigger on rising edge next then */
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               dev_dbg(gpio->dev, "next IRQ on rising edge on pin %d\n",
+                       offset);
+       }
 }
-EXPORT_SYMBOL(gpio_direction_output);
 
-/*
- * Enable an IRQ, edge is rising edge (!= 0) or falling edge (==0).
- */
-void enable_irq_on_gpio_pin(unsigned gpio, int edge)
+static int u300_gpio_irq_type(struct irq_data *d, unsigned trigger)
 {
+       struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
+       struct u300_gpio *gpio = port->gpio;
+       int offset = d->irq - gpio->irq_base;
        u32 val;
-       unsigned long flags;
-       local_irq_save(flags);
 
-       val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       val |= (1 << (gpio & 0x07));
-       writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       val = readl(virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       if (edge)
-               val |= (1 << (gpio & 0x07));
-       else
-               val &= ~(1 << (gpio & 0x07));
-       writel(val, virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       local_irq_restore(flags);
+       if ((trigger & IRQF_TRIGGER_RISING) &&
+           (trigger & IRQF_TRIGGER_FALLING)) {
+               /*
+                * The GPIO block can only trigger on falling OR rising edges,
+                * not both. So we need to toggle the mode whenever the pin
+                * goes from one state to the other with a special state flag
+                */
+               dev_dbg(gpio->dev,
+                       "trigger on both rising and falling edge on pin %d\n",
+                       offset);
+               port->toggle_edge_mode |= U300_PIN_BIT(offset);
+               u300_toggle_trigger(gpio, offset);
+       } else if (trigger & IRQF_TRIGGER_RISING) {
+               dev_dbg(gpio->dev, "trigger on rising edge on pin %d\n",
+                       offset);
+               val = readl(U300_PIN_REG(offset, icr));
+               writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               port->toggle_edge_mode &= ~U300_PIN_BIT(offset);
+       } else if (trigger & IRQF_TRIGGER_FALLING) {
+               dev_dbg(gpio->dev, "trigger on falling edge on pin %d\n",
+                       offset);
+               val = readl(U300_PIN_REG(offset, icr));
+               writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
+               port->toggle_edge_mode &= ~U300_PIN_BIT(offset);
+       }
+
+       return 0;
 }
-EXPORT_SYMBOL(enable_irq_on_gpio_pin);
 
-void disable_irq_on_gpio_pin(unsigned gpio)
+static void u300_gpio_irq_enable(struct irq_data *d)
 {
+       struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
+       struct u300_gpio *gpio = port->gpio;
+       int offset = d->irq - gpio->irq_base;
        u32 val;
        unsigned long flags;
 
        local_irq_save(flags);
-       val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
-       val &= ~(1 << (gpio & 0x07));
-       writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
-                               U300_GPIO_PORTX_SPACING);
+       val = readl(U300_PIN_REG(offset, ien));
+       writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
        local_irq_restore(flags);
 }
-EXPORT_SYMBOL(disable_irq_on_gpio_pin);
 
-/* Enable (value == 0) or disable (value == 1) internal pullup */
-void gpio_pullup(unsigned gpio, int value)
+static void u300_gpio_irq_disable(struct irq_data *d)
 {
+       struct u300_gpio_port *port = irq_data_get_irq_chip_data(d);
+       struct u300_gpio *gpio = port->gpio;
+       int offset = d->irq - gpio->irq_base;
        u32 val;
        unsigned long flags;
 
        local_irq_save(flags);
-       if (value) {
-               val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) *
-                                       U300_GPIO_PORTX_SPACING);
-               writel(val | (1 << (gpio & 0x07)), virtbase + U300_GPIO_PXPER +
-                               PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
-       } else {
-               val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) *
-                                       U300_GPIO_PORTX_SPACING);
-               writel(val & ~(1 << (gpio & 0x07)), virtbase + U300_GPIO_PXPER +
-                               PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING);
-       }
+       val = readl(U300_PIN_REG(offset, ien));
+       writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
        local_irq_restore(flags);
 }
-EXPORT_SYMBOL(gpio_pullup);
 
-static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
+static struct irq_chip u300_gpio_irqchip = {
+       .name                   = "u300-gpio-irqchip",
+       .irq_enable             = u300_gpio_irq_enable,
+       .irq_disable            = u300_gpio_irq_disable,
+       .irq_set_type           = u300_gpio_irq_type,
+
+};
+
+static void u300_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 {
-       struct u300_gpio_port *port = dev_id;
-       u32 val;
-       int pin;
+       struct u300_gpio_port *port = irq_get_handler_data(irq);
+       struct u300_gpio *gpio = port->gpio;
+       int pinoffset = port->number << 3; /* get the right stride */
+       unsigned long val;
 
+       desc->irq_data.chip->irq_ack(&desc->irq_data);
        /* Read event register */
-       val = readl(virtbase + U300_GPIO_PXIEV + port->number *
-                               U300_GPIO_PORTX_SPACING);
-       /* Mask with enable register */
-       val &= readl(virtbase + U300_GPIO_PXIEV + port->number *
-                               U300_GPIO_PORTX_SPACING);
+       val = readl(U300_PIN_REG(pinoffset, iev));
        /* Mask relevant bits */
-       val &= U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK;
+       val &= 0xFFU; /* 8 bits per port */
        /* ACK IRQ (clear event) */
-       writel(val, virtbase + U300_GPIO_PXIEV + port->number *
-                               U300_GPIO_PORTX_SPACING);
-       /* Print message */
-       while (val != 0) {
-               unsigned gpio;
-
-               pin = __ffs(val);
-               /* mask off this pin */
-               val &= ~(1 << pin);
-               gpio = (port->number << 3) + pin;
-
-               if (gpio_pin[gpio].callback)
-                       (void)gpio_pin[gpio].callback(gpio_pin[gpio].data);
-               else
-                       dev_dbg(gpiodev, "stray GPIO IRQ on line %d\n",
-                              gpio);
+       writel(val, U300_PIN_REG(pinoffset, iev));
+
+       /* Call IRQ handler */
+       if (val != 0) {
+               int irqoffset;
+
+               for_each_set_bit(irqoffset, &val, U300_GPIO_PINS_PER_PORT) {
+                       int pin_irq = gpio->irq_base + (port->number << 3)
+                               + irqoffset;
+                       int offset = pinoffset + irqoffset;
+
+                       dev_dbg(gpio->dev, "GPIO IRQ %d on pin %d\n",
+                               pin_irq, offset);
+                       generic_handle_irq(pin_irq);
+                       /*
+                        * Triggering IRQ on both rising and falling edge
+                        * needs mockery
+                        */
+                       if (port->toggle_edge_mode & U300_PIN_BIT(offset))
+                               u300_toggle_trigger(gpio, offset);
+               }
        }
-       return IRQ_HANDLED;
+
+       desc->irq_data.chip->irq_unmask(&desc->irq_data);
 }
 
-static void gpio_set_initial_values(void)
+static void __init u300_gpio_init_pin(struct u300_gpio *gpio,
+                                     int offset,
+                                     const struct u300_gpio_confdata *conf)
 {
-#ifdef U300_COH901571_3
-       int i, j;
-       unsigned long flags;
-       u32 val;
+       /* Set mode: input or output */
+       if (conf->output) {
+               u300_gpio_direction_output(&gpio->chip, offset, conf->outval);
 
-       /* Write default values to all pins */
-       for (i = 0; i < U300_GPIO_NUM_PORTS; i++) {
-               val = 0;
-               for (j = 0; j < 8; j++)
-                       val |= (u32) (u300_gpio_config[i][j].default_output_value != DEFAULT_OUTPUT_LOW) << j;
-               local_irq_save(flags);
-               writel(val, virtbase + U300_GPIO_PXPDOR + i * U300_GPIO_PORTX_SPACING);
-               local_irq_restore(flags);
+               /* Deactivate bias mode for output */
+               u300_gpio_config(&gpio->chip, offset,
+                                GPIO_U300_CONFIG_BIAS_FLOAT,
+                                NULL);
+
+               /* Set drive mode for output */
+               u300_gpio_config(&gpio->chip, offset,
+                                GPIO_U300_CONFIG_DRIVE_PUSH_PULL, NULL);
+
+               dev_dbg(gpio->dev, "set up pin %d as output, value: %d\n",
+                       offset, conf->outval);
+       } else {
+               u300_gpio_direction_input(&gpio->chip, offset);
+
+               /* Always set output low on input pins */
+               u300_gpio_set(&gpio->chip, offset, 0);
+
+               /* Set bias mode for input */
+               u300_gpio_config(&gpio->chip, offset, conf->bias_mode, NULL);
+
+               dev_dbg(gpio->dev, "set up pin %d as input, bias: %04x\n",
+                       offset, conf->bias_mode);
        }
+}
 
-       /*
-        * Put all pins that are set to either 'GPIO_OUT' or 'GPIO_NOT_USED'
-        * to output and 'GPIO_IN' to input for each port. And initialize
-        * default value on outputs.
-        */
-       for (i = 0; i < U300_GPIO_NUM_PORTS; i++) {
-               for (j = 0; j < U300_GPIO_PINS_PER_PORT; j++) {
-                       local_irq_save(flags);
-                       val = readl(virtbase + U300_GPIO_PXPCR +
-                                        i * U300_GPIO_PORTX_SPACING);
-                       /* Mask out this pin */
-                       val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << (j << 1));
-
-                       if (u300_gpio_config[i][j].pin_usage != GPIO_IN)
-                               val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL << (j << 1));
-                       writel(val, virtbase + U300_GPIO_PXPCR +
-                                        i * U300_GPIO_PORTX_SPACING);
-                       local_irq_restore(flags);
+static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio,
+                                    struct u300_gpio_platform *plat)
+{
+       int i, j;
+
+       /* Write default config and values to all pins */
+       for (i = 0; i < plat->ports; i++) {
+               for (j = 0; j < 8; j++) {
+                       const struct u300_gpio_confdata *conf;
+                       int offset = (i*8) + j;
+
+                       if (plat->variant == U300_GPIO_COH901571_3_BS335)
+                               conf = &bs335_gpio_config[i][j];
+                       else if (plat->variant == U300_GPIO_COH901571_3_BS365)
+                               conf = &bs365_gpio_config[i][j];
+                       else
+                               break;
+
+                       u300_gpio_init_pin(gpio, offset, conf);
                }
        }
+}
 
-       /* Enable or disable the internal pull-ups in the GPIO ASIC block */
-       for (i = 0; i < U300_GPIO_MAX; i++) {
-               val = 0;
-               for (j = 0; j < 8; j++)
-                       val |= (u32)((u300_gpio_config[i][j].pull_up == DISABLE_PULL_UP) << j);
-               local_irq_save(flags);
-               writel(val, virtbase + U300_GPIO_PXPER + i * U300_GPIO_PORTX_SPACING);
-               local_irq_restore(flags);
+static inline void u300_gpio_free_ports(struct u300_gpio *gpio)
+{
+       struct u300_gpio_port *port;
+       struct list_head *p, *n;
+
+       list_for_each_safe(p, n, &gpio->port_list) {
+               port = list_entry(p, struct u300_gpio_port, node);
+               list_del(&port->node);
+               free_irq(port->irq, port);
+               kfree(port);
        }
-#endif
 }
 
-static int __init gpio_probe(struct platform_device *pdev)
+static int __init u300_gpio_probe(struct platform_device *pdev)
 {
-       u32 val;
+       struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
+       struct u300_gpio *gpio;
        int err = 0;
+       int portno;
+       u32 val;
+       u32 ifr;
        int i;
-       int num_irqs;
 
-       gpiodev = &pdev->dev;
-       memset(gpio_pin, 0, sizeof(gpio_pin));
+       gpio = kzalloc(sizeof(struct u300_gpio), GFP_KERNEL);
+       if (gpio == NULL) {
+               dev_err(&pdev->dev, "failed to allocate memory\n");
+               return -ENOMEM;
+       }
+
+       gpio->chip = u300_gpio_chip;
+       gpio->chip.ngpio = plat->ports * U300_GPIO_PINS_PER_PORT;
+       gpio->irq_base = plat->gpio_irq_base;
+       gpio->chip.dev = &pdev->dev;
+       gpio->chip.base = plat->gpio_base;
+       gpio->dev = &pdev->dev;
 
        /* Get GPIO clock */
-       clk = clk_get(&pdev->dev, NULL);
-       if (IS_ERR(clk)) {
-               err = PTR_ERR(clk);
-               dev_err(gpiodev, "could not get GPIO clock\n");
+       gpio->clk = clk_get(gpio->dev, NULL);
+       if (IS_ERR(gpio->clk)) {
+               err = PTR_ERR(gpio->clk);
+               dev_err(gpio->dev, "could not get GPIO clock\n");
                goto err_no_clk;
        }
-       err = clk_enable(clk);
+       err = clk_enable(gpio->clk);
        if (err) {
-               dev_err(gpiodev, "could not enable GPIO clock\n");
+               dev_err(gpio->dev, "could not enable GPIO clock\n");
                goto err_no_clk_enable;
        }
 
-       memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!memres)
+       gpio->memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!gpio->memres) {
+               dev_err(gpio->dev, "could not get GPIO memory resource\n");
+               err = -ENODEV;
                goto err_no_resource;
+       }
 
-       if (!request_mem_region(memres->start, resource_size(memres),
+       if (!request_mem_region(gpio->memres->start,
+                               resource_size(gpio->memres),
                                "GPIO Controller")) {
                err = -ENODEV;
                goto err_no_ioregion;
        }
 
-       virtbase = ioremap(memres->start, resource_size(memres));
-       if (!virtbase) {
+       gpio->base = ioremap(gpio->memres->start, resource_size(gpio->memres));
+       if (!gpio->base) {
                err = -ENOMEM;
                goto err_no_ioremap;
        }
-       dev_info(gpiodev, "remapped 0x%08x to %p\n",
-                memres->start, virtbase);
-
-#ifdef U300_COH901335
-       dev_info(gpiodev, "initializing GPIO Controller COH 901 335\n");
-       /* Turn on the GPIO block */
-       writel(U300_GPIO_CR_BLOCK_CLOCK_ENABLE, virtbase + U300_GPIO_CR);
-#endif
-
-#ifdef U300_COH901571_3
-       dev_info(gpiodev, "initializing GPIO Controller COH 901 571/3\n");
-       val = readl(virtbase + U300_GPIO_CR);
-       dev_info(gpiodev, "COH901571/3 block version: %d, " \
-              "number of cores: %d\n",
-              ((val & 0x0000FE00) >> 9),
-              ((val & 0x000001FC) >> 2));
-       writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE, virtbase + U300_GPIO_CR);
-#endif
-
-       gpio_set_initial_values();
-
-       for (num_irqs = 0 ; num_irqs < U300_GPIO_NUM_PORTS; num_irqs++) {
-
-               gpio_ports[num_irqs].irq =
-                       platform_get_irq_byname(pdev,
-                                               gpio_ports[num_irqs].name);
-
-               err = request_irq(gpio_ports[num_irqs].irq,
-                                 gpio_irq_handler, IRQF_DISABLED,
-                                 gpio_ports[num_irqs].name,
-                                 &gpio_ports[num_irqs]);
-               if (err) {
-                       dev_err(gpiodev, "cannot allocate IRQ for %s!\n",
-                               gpio_ports[num_irqs].name);
-                       goto err_no_irq;
+
+       if (plat->variant == U300_GPIO_COH901335) {
+               dev_info(gpio->dev,
+                        "initializing GPIO Controller COH 901 335\n");
+               gpio->stride = U300_335_PORT_STRIDE;
+               gpio->pcr = U300_335_PXPCR;
+               gpio->dor = U300_335_PXPDOR;
+               gpio->dir = U300_335_PXPDIR;
+               gpio->per = U300_335_PXPER;
+               gpio->icr = U300_335_PXICR;
+               gpio->ien = U300_335_PXIEN;
+               gpio->iev = U300_335_PXIEV;
+               ifr = U300_335_PXIFR;
+
+               /* Turn on the GPIO block */
+               writel(U300_335_CR_BLOCK_CLOCK_ENABLE,
+                      gpio->base + U300_335_CR);
+       } else if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
+                  plat->variant == U300_GPIO_COH901571_3_BS365) {
+               dev_info(gpio->dev,
+                        "initializing GPIO Controller COH 901 571/3\n");
+               gpio->stride = U300_571_PORT_STRIDE;
+               gpio->pcr = U300_571_PXPCR;
+               gpio->dor = U300_571_PXPDOR;
+               gpio->dir = U300_571_PXPDIR;
+               gpio->per = U300_571_PXPER;
+               gpio->icr = U300_571_PXICR;
+               gpio->ien = U300_571_PXIEN;
+               gpio->iev = U300_571_PXIEV;
+               ifr = U300_571_PXIFR;
+
+               val = readl(gpio->base + U300_571_CR);
+               dev_info(gpio->dev, "COH901571/3 block version: %d, " \
+                        "number of cores: %d totalling %d pins\n",
+                        ((val & 0x000001FC) >> 2),
+                        ((val & 0x0000FE00) >> 9),
+                        ((val & 0x0000FE00) >> 9) * 8);
+               writel(U300_571_CR_BLOCK_CLKRQ_ENABLE,
+                      gpio->base + U300_571_CR);
+               u300_gpio_init_coh901571(gpio, plat);
+       } else {
+               dev_err(gpio->dev, "unknown block variant\n");
+               err = -ENODEV;
+               goto err_unknown_variant;
+       }
+
+       /* Add each port with its IRQ separately */
+       INIT_LIST_HEAD(&gpio->port_list);
+       for (portno = 0 ; portno < plat->ports; portno++) {
+               struct u300_gpio_port *port =
+                       kmalloc(sizeof(struct u300_gpio_port), GFP_KERNEL);
+
+               if (!port) {
+                       dev_err(gpio->dev, "out of memory\n");
+                       err = -ENOMEM;
+                       goto err_no_port;
                }
-               /* Turns off PortX_irq_force */
-               writel(0x0, virtbase + U300_GPIO_PXIFR +
-                                num_irqs * U300_GPIO_PORTX_SPACING);
+
+               snprintf(port->name, 8, "gpio%d", portno);
+               port->number = portno;
+               port->gpio = gpio;
+
+               port->irq = platform_get_irq_byname(pdev,
+                                                   port->name);
+
+               dev_dbg(gpio->dev, "register IRQ %d for %s\n", port->irq,
+                       port->name);
+
+               irq_set_chained_handler(port->irq, u300_gpio_irq_handler);
+               irq_set_handler_data(port->irq, port);
+
+               /* For each GPIO pin set the unique IRQ handler */
+               for (i = 0; i < U300_GPIO_PINS_PER_PORT; i++) {
+                       int irqno = gpio->irq_base + (portno << 3) + i;
+
+                       dev_dbg(gpio->dev, "handler for IRQ %d on %s\n",
+                               irqno, port->name);
+                       irq_set_chip_and_handler(irqno, &u300_gpio_irqchip,
+                                                handle_simple_irq);
+                       set_irq_flags(irqno, IRQF_VALID);
+                       irq_set_chip_data(irqno, port);
+               }
+
+               /* Turns off irq force (test register) for this port */
+               writel(0x0, gpio->base + portno * gpio->stride + ifr);
+
+               list_add_tail(&port->node, &gpio->port_list);
        }
+       dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno);
+
+       err = gpiochip_add(&gpio->chip);
+       if (err) {
+               dev_err(gpio->dev, "unable to add gpiochip: %d\n", err);
+               goto err_no_chip;
+       }
+
+       platform_set_drvdata(pdev, gpio);
 
        return 0;
 
- err_no_irq:
-       for (i = 0; i < num_irqs; i++)
-               free_irq(gpio_ports[i].irq, &gpio_ports[i]);
-       iounmap(virtbase);
- err_no_ioremap:
-       release_mem_region(memres->start, resource_size(memres));
- err_no_ioregion:
- err_no_resource:
-       clk_disable(clk);
- err_no_clk_enable:
-       clk_put(clk);
- err_no_clk:
-       dev_info(gpiodev, "module ERROR:%d\n", err);
+err_no_chip:
+err_no_port:
+       u300_gpio_free_ports(gpio);
+err_unknown_variant:
+       iounmap(gpio->base);
+err_no_ioremap:
+       release_mem_region(gpio->memres->start, resource_size(gpio->memres));
+err_no_ioregion:
+err_no_resource:
+       clk_disable(gpio->clk);
+err_no_clk_enable:
+       clk_put(gpio->clk);
+err_no_clk:
+       kfree(gpio);
+       dev_info(&pdev->dev, "module ERROR:%d\n", err);
        return err;
 }
 
-static int __exit gpio_remove(struct platform_device *pdev)
+static int __exit u300_gpio_remove(struct platform_device *pdev)
 {
-       int i;
+       struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
+       struct u300_gpio *gpio = platform_get_drvdata(pdev);
+       int err;
 
        /* Turn off the GPIO block */
-       writel(0x00000000U, virtbase + U300_GPIO_CR);
-       for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++)
-               free_irq(gpio_ports[i].irq, &gpio_ports[i]);
-       iounmap(virtbase);
-       release_mem_region(memres->start, resource_size(memres));
-       clk_disable(clk);
-       clk_put(clk);
+       if (plat->variant == U300_GPIO_COH901335)
+               writel(0x00000000U, gpio->base + U300_335_CR);
+       if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
+           plat->variant == U300_GPIO_COH901571_3_BS365)
+               writel(0x00000000U, gpio->base + U300_571_CR);
+
+       err = gpiochip_remove(&gpio->chip);
+       if (err < 0) {
+               dev_err(gpio->dev, "unable to remove gpiochip: %d\n", err);
+               return err;
+       }
+       u300_gpio_free_ports(gpio);
+       iounmap(gpio->base);
+       release_mem_region(gpio->memres->start,
+                          resource_size(gpio->memres));
+       clk_disable(gpio->clk);
+       clk_put(gpio->clk);
+       platform_set_drvdata(pdev, NULL);
+       kfree(gpio);
        return 0;
 }
 
-static struct platform_driver gpio_driver = {
+static struct platform_driver u300_gpio_driver = {
        .driver         = {
                .name   = "u300-gpio",
        },
-       .remove         = __exit_p(gpio_remove),
+       .remove         = __exit_p(u300_gpio_remove),
 };
 
 
 static int __init u300_gpio_init(void)
 {
-       return platform_driver_probe(&gpio_driver, gpio_probe);
+       return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe);
 }
 
 static void __exit u300_gpio_exit(void)
 {
-       platform_driver_unregister(&gpio_driver);
+       platform_driver_unregister(&u300_gpio_driver);
 }
 
 arch_initcall(u300_gpio_init);
 module_exit(u300_gpio_exit);
 
 MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
-
-#ifdef U300_COH901571_3
-MODULE_DESCRIPTION("ST-Ericsson AB COH 901 571/3 GPIO driver");
-#endif
-
-#ifdef U300_COH901335
-MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335 GPIO driver");
-#endif
-
+MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335/COH 901 571/3 GPIO driver");
 MODULE_LICENSE("GPL");
index 5d8aed5ec21bb85863743e4855d450403074cf64..c01e9519f6c15ee5df4e8cb32ae44ae234f57482 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/slab.h>
 
 #include <mach/hardware.h>     /* Pick up IXP2000-specific bits */
-#include <mach/gpio.h>
+#include <mach/gpio-ixp2000.h>
 
 static inline int ixp2000_scl_pin(void *data)
 {
index 000a78e5246c5c1d9f510fcfbbfc9cf35700137a..6dede8f366c59417b3283cc03b220f6b5c58c97b 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/platform_device.h>
 
 #include <mach/board.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/at91sam9_smc.h>
 
 #define DRV_NAME "at91_ide"
index 33d0bdc837c099a486e2bffc95dbe0fb6a8ee7c4..323bcdfff2484b6d3ddf22fddcb343216c879ee6 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/mutex.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/keypad.h>
 #include <plat/menelaus.h>
 #include <asm/irq.h>
index 9cee8e7f0bcb1297116667de77ab1d3f49ce1213..af5d9d0613716177bbd0dd53d6940dd5cbe7f596 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <asm/mach/irq.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/menelaus.h>
 
 #define DRIVER_NAME                    "menelaus"
index a6c329040140420ab73ded04fa08c7ca9cdaa07e..2dba999caf2c997ecf0fb3a53dcb47d63c852d74 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <plat/board.h>
 #include <plat/mmc.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/dma.h>
 #include <plat/mux.h>
 #include <plat/fpga.h>
index 18b0bd31de78a661a1839d094e756df9d7ce6762..21b00cefae63f2372dd14ee96453bc9c6f68bd6e 100644 (file)
@@ -21,7 +21,9 @@
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
+
+#include <mach/gpio-tegra.h>
 #include <mach/sdhci.h>
 
 #include "sdhci-pltfm.h"
index 78017eb9318ebc7dbbf4c8269b83b3d0ca924e34..9e6b498c9bebb07191d8146f447a89c56d2ca11b 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/io.h>
 #include <mach/hardware.h>
 #include <asm/sizes.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/board-ams-delta.h>
 
 /*
index a916dec292156a524438b117400837fd7d9f6145..6a1d6d9a2df95454fcb7a0212be53fdaf72936b1 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/mach/flash.h>
 #include <plat/gpmc.h>
 #include <plat/onenand.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include <plat/dma.h>
 
index 29dc43523cec2822b9b50902fe005d84d2aa4312..48b4ec121f7f74c86342c2897bec326a07cd5a3f 100644 (file)
@@ -35,7 +35,7 @@
 #include <asm/mach-types.h>
 
 #include <mach/at91rm9200_emac.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/board.h>
 
 #include "at91_ether.h"
index e956f659089a2c1b91716a7bccdf68f425837131..66ab92cf3105ca4db179f34868bd1416df9a8b04 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <asm/mach-types.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/vpac270.h>
 
 #include "soc_common.h"
index 82dee9a6c0de5a7761c95820697963938bbfb3fe..d3bff424286f109c6fcb1f0956096e604b0c0459 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <asm/io.h>
 #include <mach/board.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/cpu.h>
 
 /* SPI register offsets */
index b922f5d2e61e0cc52d4aea4ba9c81fca0b7fcc52..caba6730a9434b33054260d3aee794cf788a5b6c 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifdef CONFIG_ARM
 #include <mach/cpu.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #endif
 
 #define PDC_BUFFER_SIZE                512
index 653d6a60edb54e9e748b9e11e18a22192c8e3900..d1b41933199ec0aeaecd19cc67fd26083efbfdc6 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <mach/platform.h>
 #include <mach/irqs.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #define USB_CTRL       IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64)
 
index 8bdf25a8b023645ec839361cdc18f86dc624c7bb..f9a3f62a83b51d82d9192a4d9325eb0318df689e 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <mach/hardware.h>
 #include <mach/memory.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <mach/cputype.h>
 
 #include <asm/mach-types.h>
index 817ab60f7537266d5f63e2e3ef9bbeb1b108bac5..dda920623c6a45b96886e5729419f9dc1c1d7534 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <mach/board.h>
 #include <mach/cpu.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include <video/atmel_lcdc.h>
 
index 10459d8bd9a01268f99321aee171d8be0abf4294..4b24f549f9b92dd70d84b48259bf38fdfebf8319 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include "omapfb.h"
 
index 8df688748b5a5376b6fd6419484e4bbdf296f0ba..622ad839fd9d46701af954235af4b30536f5c9da 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/i2c/tps65010.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include "omapfb.h"
 
 #define MODULE_NAME    "omapfb-lcd_h3"
index 9fff86f67bde401ff475e2ba977db90897c613b0..12cc52a70f9642ad2c7c568b00ecca24cbb084f5 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include "omapfb.h"
 
 #define MODULE_NAME    "omapfb-lcd_h3"
index 0f5952cae85e6b2ddfd47ffd66ac1c0f7c88a919..062466402c0e67531e4fff8dbe6484973b1f7ced 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/delay.h>
 #include <linux/i2c/twl.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/mux.h>
 #include <asm/mach-types.h>
 
index b87e8b83f29c5fe12f40c5c76f14ff1f071baa32..6f8d13c41202a8addf821111d674a9e7fab8f8b9 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/mux.h>
 #include "omapfb.h"
 
index 564933ffac6ef73fc00b7e36bf81ca155f57d9db..b8fd5b2ec29c58899b976ae8a3a331b1ae3b345f 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/platform_device.h>
 #include <linux/i2c/twl.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include <plat/mux.h>
 #include <asm/mach-types.h>
 
index ff0e6d7ab3a207b118fed6ffa0d189caae46b838..b51b332e5a2bd16d05833996191034143808af52 100644 (file)
@@ -29,7 +29,7 @@ GPIO13 - screen blanking
 #include <linux/module.h>
 #include <linux/io.h>
 
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 #include "omapfb.h"
 
 static int palmtt_panel_init(struct lcd_panel *panel,
index 5ec4f2d439c949efd03f8b6d6024ac77cea81e83..50e00395240f67b43eb93f9c7697c5ff12d60a1a 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/clk.h>
 #include <linux/gfp.h>
 #include <asm/uaccess.h>
-#include <mach/gpio.h>
+#include <asm/gpio.h>
 
 #include "sdum.h"
 #include "fbcommon.h"