提交 33533277 编写于 作者: A Arnd Bergmann

Merge branch 'depends/rmk/gpio' into next/board

Conflicts:
	arch/arm/mach-at91/board-usb-a9260.c
	arch/arm/mach-at91/board-usb-a9263.c
	arch/arm/mach-tegra/board-paz00.h
	arch/arm/mach-tegra/board-seaboard.h
...@@ -835,6 +835,7 @@ config ARCH_U300 ...@@ -835,6 +835,7 @@ config ARCH_U300
select CLKDEV_LOOKUP select CLKDEV_LOOKUP
select HAVE_MACH_CLKDEV select HAVE_MACH_CLKDEV
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB
help help
Support for ST-Ericsson U300 series mobile platforms. Support for ST-Ericsson U300 series mobile platforms.
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
*/ */
#include <linux/device.h> #include <linux/device.h>
#include <linux/gpio.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/gpio.h>
#include <asm/hardware/scoop.h> #include <asm/hardware/scoop.h>
/* PCMCIA to Scoop linkage /* PCMCIA to Scoop linkage
......
...@@ -4,4 +4,23 @@ ...@@ -4,4 +4,23 @@
/* not all ARM platforms necessarily support this API ... */ /* not all ARM platforms necessarily support this API ... */
#include <mach/gpio.h> #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 */ #endif /* _ARCH_ARM_GPIO_H */
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#define __ARM_GPIOLIB_COMPLEX
#define IOP3XX_N_GPIOS 8 #define IOP3XX_N_GPIOS 8
static inline int gpio_get_value(unsigned gpio) static inline int gpio_get_value(unsigned gpio)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
...@@ -23,7 +24,6 @@ ...@@ -23,7 +24,6 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include <mach/gpio.h>
#include <mach/at91cap9.h> #include <mach/at91cap9.h>
#include <mach/at91cap9_matrix.h> #include <mach/at91cap9_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91rm9200.h> #include <mach/at91rm9200.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include <mach/at91sam9260.h> #include <mach/at91sam9260.h>
#include <mach/at91sam9260_matrix.h> #include <mach/at91sam9260_matrix.h>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
#include <video/atmel_lcdc.h> #include <video/atmel_lcdc.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9261.h> #include <mach/at91sam9261.h>
#include <mach/at91sam9261_matrix.h> #include <mach/at91sam9261_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
...@@ -20,7 +21,6 @@ ...@@ -20,7 +21,6 @@
#include <video/atmel_lcdc.h> #include <video/atmel_lcdc.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9263.h> #include <mach/at91sam9263.h>
#include <mach/at91sam9263_matrix.h> #include <mach/at91sam9263_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <linux/atmel-mci.h> #include <linux/atmel-mci.h>
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
#include <video/atmel_lcdc.h> #include <video/atmel_lcdc.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9g45.h> #include <mach/at91sam9g45.h>
#include <mach/at91sam9g45_matrix.h> #include <mach/at91sam9g45_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
#include <video/atmel_lcdc.h> #include <video/atmel_lcdc.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9rl.h> #include <mach/at91sam9rl.h>
#include <mach/at91sam9rl_matrix.h> #include <mach/at91sam9rl_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -34,7 +35,6 @@ ...@@ -34,7 +35,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include "generic.h" #include "generic.h"
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -43,7 +44,6 @@ ...@@ -43,7 +44,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -38,7 +39,6 @@ ...@@ -38,7 +39,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include "sam9_smc.h" #include "sam9_smc.h"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91cap9_matrix.h> #include <mach/at91cap9_matrix.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/system_rev.h> #include <mach/system_rev.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -40,7 +41,6 @@ ...@@ -40,7 +41,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91sam9260_matrix.h> #include <mach/at91sam9260_matrix.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -36,7 +37,6 @@ ...@@ -36,7 +37,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
#include <mach/cpu.h> #include <mach/cpu.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -38,7 +39,6 @@ ...@@ -38,7 +39,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include "generic.h" #include "generic.h"
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -34,7 +35,6 @@ ...@@ -34,7 +35,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include "generic.h" #include "generic.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -35,7 +36,6 @@ ...@@ -35,7 +36,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -44,7 +45,6 @@ ...@@ -44,7 +45,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include "sam9_smc.h" #include "sam9_smc.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
#include "generic.h" #include "generic.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -40,7 +41,6 @@ ...@@ -40,7 +41,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -39,7 +40,6 @@ ...@@ -39,7 +40,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
#include "generic.h" #include "generic.h"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -39,7 +40,6 @@ ...@@ -39,7 +40,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
#include "generic.h" #include "generic.h"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include "sam9_smc.h" #include "sam9_smc.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include <mach/system_rev.h> #include <mach/system_rev.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -45,7 +46,6 @@ ...@@ -45,7 +46,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include <mach/system_rev.h> #include <mach/system_rev.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -44,7 +45,6 @@ ...@@ -44,7 +45,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include <mach/system_rev.h> #include <mach/system_rev.h>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/system_rev.h> #include <mach/system_rev.h>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -38,7 +39,6 @@ ...@@ -38,7 +39,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
#include <mach/system_rev.h> #include <mach/system_rev.h>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -30,7 +31,6 @@ ...@@ -30,7 +31,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/gpio.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/spi/mmc_spi.h> #include <linux/spi/mmc_spi.h>
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/at91_shdwc.h> #include <mach/at91_shdwc.h>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -43,7 +44,6 @@ ...@@ -43,7 +44,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
#include <mach/at91rm9200_mc.h> #include <mach/at91rm9200_mc.h>
#include <mach/cpu.h> #include <mach/cpu.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
...@@ -22,9 +23,6 @@ ...@@ -22,9 +23,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/at91_pio.h> #include <mach/at91_pio.h>
#include <mach/gpio.h>
#include <asm/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -214,11 +214,6 @@ extern void at91_gpio_resume(void); ...@@ -214,11 +214,6 @@ extern void at91_gpio_resume(void);
*/ */
#include <asm/errno.h> #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 gpio_to_irq(gpio) (gpio)
#define irq_to_gpio(irq) (irq) #define irq_to_gpio(irq) (irq)
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h>
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
...@@ -25,7 +26,6 @@ ...@@ -25,7 +26,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/at91_pmc.h> #include <mach/at91_pmc.h>
#include <mach/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include "generic.h" #include "generic.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Common objects # Common objects
obj-y := time.o clock.o serial.o io.o psc.o \ 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 obj-$(CONFIG_DAVINCI_MUX) += mux.o
...@@ -17,7 +17,6 @@ obj-$(CONFIG_ARCH_DAVINCI_DM365) += dm365.o devices.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_DA830) += da830.o devices-da8xx.o
obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.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) += tnetv107x.o devices-tnetv107x.o
obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += gpio-tnetv107x.o
obj-$(CONFIG_AINTC) += irq.o obj-$(CONFIG_AINTC) += irq.o
obj-$(CONFIG_CP_INTC) += cp_intc.o obj-$(CONFIG_CP_INTC) += cp_intc.o
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* is licensed "as is" without any warranty of any kind, whether express * is licensed "as is" without any warranty of any kind, whether express
* or implied. * or implied.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/clk.h> #include <linux/clk.h>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
#include <mach/common.h> #include <mach/common.h>
#include <mach/time.h> #include <mach/time.h>
#include <mach/da8xx.h> #include <mach/da8xx.h>
#include <mach/gpio.h> #include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* is licensed "as is" without any warranty of any kind, whether express * is licensed "as is" without any warranty of any kind, whether express
* or implied. * or implied.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -27,7 +28,7 @@ ...@@ -27,7 +28,7 @@
#include <mach/da8xx.h> #include <mach/da8xx.h>
#include <mach/cpufreq.h> #include <mach/cpufreq.h>
#include <mach/pm.h> #include <mach/pm.h>
#include <mach/gpio.h> #include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
#include <mach/common.h> #include <mach/common.h>
#include <mach/asp.h> #include <mach/asp.h>
#include <mach/spi.h> #include <mach/spi.h>
#include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -34,7 +33,7 @@ ...@@ -34,7 +33,7 @@
#include <mach/asp.h> #include <mach/asp.h>
#include <mach/keyscan.h> #include <mach/keyscan.h>
#include <mach/spi.h> #include <mach/spi.h>
#include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -26,6 +25,7 @@ ...@@ -26,6 +25,7 @@
#include <mach/serial.h> #include <mach/serial.h>
#include <mach/common.h> #include <mach/common.h>
#include <mach/asp.h> #include <mach/asp.h>
#include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
...@@ -27,6 +26,7 @@ ...@@ -27,6 +26,7 @@
#include <mach/serial.h> #include <mach/serial.h>
#include <mach/common.h> #include <mach/common.h>
#include <mach/asp.h> #include <mach/asp.h>
#include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
/*
* 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 */
...@@ -13,80 +13,10 @@ ...@@ -13,80 +13,10 @@
#ifndef __DAVINCI_GPIO_H #ifndef __DAVINCI_GPIO_H
#define __DAVINCI_GPIO_H #define __DAVINCI_GPIO_H
#include <linux/io.h>
#include <linux/spinlock.h>
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#include <mach/irqs.h> /* The inline versions use the static inlines in the driver header */
#include <mach/common.h> #include "gpio-davinci.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 get/set/clear functions will inline when called with constant * The get/set/clear functions will inline when called with constant
...@@ -147,11 +77,6 @@ static inline int gpio_cansleep(unsigned gpio) ...@@ -147,11 +77,6 @@ static inline int gpio_cansleep(unsigned gpio)
return __gpio_cansleep(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) static inline int irq_to_gpio(unsigned irq)
{ {
/* don't support the reverse mapping */ /* don't support the reverse mapping */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/clk.h> #include <linux/clk.h>
...@@ -27,9 +28,9 @@ ...@@ -27,9 +28,9 @@
#include <mach/psc.h> #include <mach/psc.h>
#include <mach/cp_intc.h> #include <mach/cp_intc.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/tnetv107x.h> #include <mach/tnetv107x.h>
#include <mach/gpio-davinci.h>
#include "clock.h" #include "clock.h"
#include "mux.h" #include "mux.h"
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <mach/fb.h> #include <mach/fb.h>
#include <mach/ep93xx_keypad.h> #include <mach/ep93xx_keypad.h>
#include <mach/ep93xx_spi.h> #include <mach/ep93xx_spi.h>
#include <mach/gpio-ep93xx.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/fb.h> #include <mach/fb.h>
#include <mach/ep93xx_spi.h> #include <mach/ep93xx_spi.h>
#include <mach/gpio-ep93xx.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
/* /* Include file for the EP93XX GPIO controller machine specifics */
* arch/arm/mach-ep93xx/include/mach/gpio.h
*/
#ifndef __ASM_ARCH_GPIO_H #ifndef __GPIO_EP93XX_H
#define __ASM_ARCH_GPIO_H #define __GPIO_EP93XX_H
/* GPIO port A. */ /* GPIO port A. */
#define EP93XX_GPIO_LINE_A(x) ((x) + 0) #define EP93XX_GPIO_LINE_A(x) ((x) + 0)
...@@ -99,22 +97,4 @@ ...@@ -99,22 +97,4 @@
/* maximum value for irq capable line identifiers */ /* maximum value for irq capable line identifiers */
#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
/* new generic GPIO API - see Documentation/gpio.txt */ #endif /* __GPIO_EP93XX_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
/*
* 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
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/fb.h> #include <mach/fb.h>
#include <mach/gpio-ep93xx.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <linux/fb.h> #include <linux/fb.h>
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/fb.h> #include <mach/fb.h>
#include <mach/gpio-ep93xx.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #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 */ /* Practically, GPIO banks up to GPZ are the configurable gpio banks */
/* GPIO bank sizes */ /* GPIO bank sizes */
...@@ -151,6 +146,4 @@ enum s5p_gpio_number { ...@@ -151,6 +146,4 @@ enum s5p_gpio_number {
#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ #define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \
CONFIG_SAMSUNG_GPIO_EXTRA + 1) CONFIG_SAMSUNG_GPIO_EXTRA + 1)
#include <asm-generic/gpio.h>
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#define __MACH_GPIO_H__ #define __MACH_GPIO_H__
#include <mach/irqs.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 gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE) #define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
......
...@@ -17,13 +17,12 @@ ...@@ -17,13 +17,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/gpio.h>
#include <mach/iomux-mx3.h> #include <mach/iomux-mx3.h>
/* /*
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <mach/iomux-mx27.h> #include <mach/iomux-mx27.h>
#include "devices-imx27.h" #include "devices-imx27.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/gpio.h> #include <mach/gpio-ixp2000.h>
static DEFINE_SPINLOCK(ixp2000_slowport_lock); static DEFINE_SPINLOCK(ixp2000_slowport_lock);
static unsigned long ixp2000_slowport_irq_flags; static unsigned long ixp2000_slowport_irq_flags;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* Free Software Foundation; either version 2 of the License, or (at your * Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. * option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -40,8 +41,7 @@ ...@@ -40,8 +41,7 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/gpio.h> #include <mach/gpio-ixp2000.h>
/************************************************************************* /*************************************************************************
* IXDP2x00 IRQ Initialization * IXDP2x00 IRQ Initialization
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Author: Rod Whitby <rod@whitby.id.au> * Author: Rod Whitby <rod@whitby.id.au>
* Maintainers: http://www.nslu2-linux.org/ * Maintainers: http://www.nslu2-linux.org/
*/ */
#include <linux/gpio.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/timer.h> #include <linux/timer.h>
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/gpio.h>
#define DSMG600_SDA_PIN 5 #define DSMG600_SDA_PIN 5
#define DSMG600_SCL_PIN 4 #define DSMG600_SCL_PIN 4
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* Maintainers: http://www.nslu2-linux.org/ * Maintainers: http://www.nslu2-linux.org/
* *
*/ */
#include <linux/gpio.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/serial.h> #include <linux/serial.h>
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/gpio.h>
#define FSG_SDA_PIN 12 #define FSG_SDA_PIN 12
#define FSG_SCL_PIN 13 #define FSG_SCL_PIN 13
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#define __ARM_GPIOLIB_COMPLEX
static inline int gpio_request(unsigned gpio, const char *label) static inline int gpio_request(unsigned gpio, const char *label)
{ {
return 0; return 0;
...@@ -70,6 +72,7 @@ static inline void gpio_set_value(unsigned gpio, int value) ...@@ -70,6 +72,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
#include <asm-generic/gpio.h> /* cansleep wrappers */ #include <asm-generic/gpio.h> /* cansleep wrappers */
extern int gpio_to_irq(int gpio); extern int gpio_to_irq(int gpio);
#define gpio_to_irq gpio_to_irq
extern int irq_to_gpio(unsigned int irq); extern int irq_to_gpio(unsigned int irq);
#endif #endif
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Maintainers: http://www.nslu2-linux.org/ * Maintainers: http://www.nslu2-linux.org/
* *
*/ */
#include <linux/gpio.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/gpio.h>
#define NAS100D_SDA_PIN 5 #define NAS100D_SDA_PIN 5
#define NAS100D_SCL_PIN 6 #define NAS100D_SCL_PIN 6
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Maintainers: http://www.nslu2-linux.org/ * Maintainers: http://www.nslu2-linux.org/
* *
*/ */
#include <linux/gpio.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/serial.h> #include <linux/serial.h>
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/gpio.h>
#define NSLU2_SDA_PIN 7 #define NSLU2_SDA_PIN 7
#define NSLU2_SCL_PIN 6 #define NSLU2_SCL_PIN 6
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h> #include <linux/io.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h> #include <plat/irq.h>
#include <asm/gpio.h>
#include "common.h" #include "common.h"
static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
......
...@@ -7,12 +7,11 @@ ...@@ -7,12 +7,11 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mbus.h> #include <linux/mbus.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <plat/mpp.h> #include <plat/mpp.h>
#include "common.h" #include "common.h"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Makefile for KS8695 architecture support # 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-m :=
obj-n := obj-n :=
obj- := obj- :=
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/devices.h> #include <mach/devices.h>
#include <mach/gpio.h> #include <mach/gpio-ks8695.h>
#include "generic.h" #include "generic.h"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/devices.h> #include <mach/devices.h>
#include <mach/gpio.h> #include <mach/gpio-ks8695.h>
#include "generic.h" #include "generic.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/gpio.h> #include <mach/gpio-ks8695.h>
#include <mach/devices.h> #include <mach/devices.h>
#include "generic.h" #include "generic.h"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/irqs.h> #include <mach/irqs.h>
......
/*
* 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 */
...@@ -11,47 +11,9 @@ ...@@ -11,47 +11,9 @@
#ifndef __ASM_ARCH_GPIO_H_ #ifndef __ASM_ARCH_GPIO_H_
#define __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. * Map IRQ number to GPIO line.
*/ */
extern int irq_to_gpio(unsigned int irq); 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 #endif
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <mach/devices.h> #include <mach/devices.h>
#include <mach/gpio.h>
static inline void ks8695_led_on(unsigned int led) static inline void ks8695_led_on(unsigned int led)
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
# #
obj-y := timer.o irq.o common.o serial.o clock.o 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 obj-y += phy3250.o
/*
* 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 */
/*
* 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
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <mach/gpio-lpc32xx.h>
#include "common.h" #include "common.h"
/* /*
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* publishhed by the Free Software Foundation. * publishhed by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/addr-map.h> #include <mach/addr-map.h>
#include <mach/mfp-pxa168.h> #include <mach/mfp-pxa168.h>
#include <mach/pxa168.h> #include <mach/pxa168.h>
#include <mach/gpio.h>
#include <video/pxa168fb.h> #include <video/pxa168fb.h>
#include <linux/input.h> #include <linux/input.h>
#include <plat/pxa27x_keypad.h> #include <plat/pxa27x_keypad.h>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/max8649.h> #include <linux/regulator/max8649.h>
#include <linux/regulator/fixed.h> #include <linux/regulator/fixed.h>
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/gpio.h>
#include <mach/pxa168.h> #include <mach/pxa168.h>
#include <mach/mfp-pxa168.h> #include <mach/mfp-pxa168.h>
......
#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) (*((volatile u32 *)(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 */
#ifndef __ASM_MACH_GPIO_H #ifndef __ASM_MACH_GPIO_H
#define __ASM_MACH_GPIO_H #define __ASM_MACH_GPIO_H
#include <mach/addr-map.h>
#include <mach/irqs.h>
#include <asm-generic/gpio.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 gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START) #define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
#define __gpio_is_inverted(gpio) (0) #define __gpio_is_inverted(gpio) (0)
#define __gpio_is_occupied(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> #include <plat/gpio.h>
#endif /* __ASM_MACH_GPIO_H */ #endif /* __ASM_MACH_GPIO_H */
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/max8649.h> #include <linux/regulator/max8649.h>
#include <linux/mfd/max8925.h> #include <linux/mfd/max8925.h>
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -25,7 +24,7 @@ ...@@ -25,7 +24,7 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/dma.h> #include <mach/dma.h>
#include <mach/mfp.h> #include <mach/mfp.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#include <mach/devices.h> #include <mach/devices.h>
#include <mach/mmp2.h> #include <mach/mmp2.h>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -21,7 +20,7 @@ ...@@ -21,7 +20,7 @@
#include <mach/regs-apbc.h> #include <mach/regs-apbc.h>
#include <mach/regs-apmu.h> #include <mach/regs-apmu.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#include <mach/dma.h> #include <mach/dma.h>
#include <mach/devices.h> #include <mach/devices.h>
#include <mach/mfp.h> #include <mach/mfp.h>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -20,7 +19,7 @@ ...@@ -20,7 +19,7 @@
#include <mach/regs-apmu.h> #include <mach/regs-apmu.h>
#include <mach/cputype.h> #include <mach/cputype.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#include <mach/dma.h> #include <mach/dma.h>
#include <mach/mfp.h> #include <mach/mfp.h>
#include <mach/devices.h> #include <mach/devices.h>
......
...@@ -7,18 +7,18 @@ ...@@ -7,18 +7,18 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* publishhed by the Free Software Foundation. * publishhed by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/addr-map.h> #include <mach/addr-map.h>
#include <mach/mfp-pxa910.h> #include <mach/mfp-pxa910.h>
#include <mach/pxa910.h> #include <mach/pxa910.h>
#include <mach/gpio.h>
#include "common.h" #include "common.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <mach/vreg.h> #include <mach/vreg.h>
#include <mach/mpp.h> #include <mach/mpp.h>
#include <mach/gpio.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/msm_iomap.h> #include <mach/msm_iomap.h>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA. * 02110-1301, USA.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <asm/memory.h> #include <asm/memory.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <mach/gpio.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/msm_iomap.h> #include <mach/msm_iomap.h>
#include <mach/dma.h> #include <mach/dma.h>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA. * 02110-1301, USA.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/sirc.h> #include <mach/sirc.h>
#include <mach/gpio.h>
#include <mach/vreg.h> #include <mach/vreg.h>
#include <mach/mmc.h> #include <mach/mmc.h>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
/* linux/arch/arm/mach-msm/board-trout-mmc.c /* linux/arch/arm/mach-msm/board-trout-mmc.c
** Author: Brian Swetland <swetland@google.com> ** Author: Brian Swetland <swetland@google.com>
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <asm/gpio.h>
#include <asm/io.h> #include <asm/io.h>
#include <mach/vreg.h> #include <mach/vreg.h>
......
/* linux/arch/arm/mach-msm/board-trout-mddi.c /* linux/arch/arm/mach-msm/board-trout-mddi.c
** Author: Brian Swetland <swetland@google.com> ** Author: Brian Swetland <swetland@google.com>
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/err.h> #include <linux/err.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/msm_fb.h> #include <mach/msm_fb.h>
......
/* /* empty */
* 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 */
...@@ -7,12 +7,11 @@ ...@@ -7,12 +7,11 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <asm/gpio.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h> #include <plat/irq.h>
#include "common.h" #include "common.h"
......
...@@ -7,13 +7,12 @@ ...@@ -7,13 +7,12 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mbus.h> #include <linux/mbus.h>
#include <linux/io.h> #include <linux/io.h>
#include <plat/mpp.h> #include <plat/mpp.h>
#include <asm/gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include "common.h" #include "common.h"
#include "mpp.h" #include "mpp.h"
......
...@@ -20,16 +20,8 @@ ...@@ -20,16 +20,8 @@
#ifndef __MACH_MXS_GPIO_H__ #ifndef __MACH_MXS_GPIO_H__
#define __MACH_MXS_GPIO_H__ #define __MACH_MXS_GPIO_H__
#include <asm-generic/gpio.h>
#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr)) #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) #define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
#endif /* __MACH_MXS_GPIO_H__ */ #endif /* __MACH_MXS_GPIO_H__ */
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <plat/gpio-nomadik.h>
#include <plat/mtu.h> #include <plat/mtu.h>
#include <mach/setup.h> #include <mach/setup.h>
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <plat/gpio-nomadik.h>
/* /*
* There are two busses in the 8815NHK. * There are two busses in the 8815NHK.
......
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H #define __ASM_ARCH_GPIO_H
#include <plat/gpio.h>
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <plat/io.h> #include <plat/io.h>
#include <plat/board-ams-delta.h> #include <plat/board-ams-delta.h>
#include <mach/gpio.h>
#include <plat/keypad.h> #include <plat/keypad.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/usb.h> #include <plat/usb.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <plat/tc.h> #include <plat/tc.h>
#include <mach/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/fpga.h> #include <plat/fpga.h>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/usb.h> #include <plat/usb.h>
#include <plat/board.h> #include <plat/board.h>
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c/tps65010.h> #include <linux/i2c/tps65010.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <mach/gpio.h>
#include "board-h2.h" #include "board-h2.h"
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c/tps65010.h> #include <linux/i2c/tps65010.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <mach/gpio.h>
#include "board-h3.h" #include "board-h3.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/major.h> #include <linux/major.h>
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/page.h> #include <asm/page.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
* 02110-1301, USA. * 02110-1301, USA.
* *
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/fpga.h> #include <plat/fpga.h>
#include <mach/gpio.h>
#include <plat/tc.h> #include <plat/tc.h>
#include <plat/usb.h> #include <plat/usb.h>
#include <plat/keypad.h> #include <plat/keypad.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/usb.h> #include <plat/usb.h>
#include <plat/board.h> #include <plat/board.h>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA. * 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include <linux/i2c/tps65010.h> #include <linux/i2c/tps65010.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/usb.h> #include <plat/usb.h>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -30,7 +31,6 @@ ...@@ -30,7 +31,6 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <plat/led.h> #include <plat/led.h>
#include <mach/gpio.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/usb.h> #include <plat/usb.h>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -32,7 +33,6 @@ ...@@ -32,7 +33,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/usb.h> #include <plat/usb.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <plat/tc.h> #include <plat/tc.h>
#include <mach/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/fpga.h> #include <plat/fpga.h>
#include <plat/flash.h> #include <plat/flash.h>
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <mach/gpio.h>
#include <plat/board-sx1.h> #include <plat/board-sx1.h>
#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/dma.h> #include <plat/dma.h>
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
...@@ -33,7 +34,6 @@ ...@@ -33,7 +34,6 @@
#include <plat/board-voiceblue.h> #include <plat/board-voiceblue.h>
#include <plat/common.h> #include <plat/common.h>
#include <mach/gpio.h>
#include <plat/flash.h> #include <plat/flash.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/tc.h> #include <plat/tc.h>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
*/ */
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -24,7 +25,6 @@ ...@@ -24,7 +25,6 @@
#include <plat/tc.h> #include <plat/tc.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <mach/gpio.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <plat/omap7xx.h> #include <plat/omap7xx.h>
#include <plat/mcbsp.h> #include <plat/mcbsp.h>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -28,7 +29,6 @@ ...@@ -28,7 +29,6 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <plat/fpga.h> #include <plat/fpga.h>
#include <mach/gpio.h>
static void fpga_mask_irq(struct irq_data *d) static void fpga_mask_irq(struct irq_data *d)
{ {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA. * 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/gpio.h>
#include <plat/cpu.h> #include <plat/cpu.h>
#define IRQ_BANK(irq) ((irq) >> 5) #define IRQ_BANK(irq) ((irq) >> 5)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* The "surfer" expansion board and H2 sample board also have two-color * The "surfer" expansion board and H2 sample board also have two-color
* green+red LEDs (in parallel), used here for timer and idle indicators. * green+red LEDs (in parallel), used here for timer and idle indicators.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -20,7 +21,6 @@ ...@@ -20,7 +21,6 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <plat/fpga.h> #include <plat/fpga.h>
#include <mach/gpio.h>
#include "leds.h" #include "leds.h"
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
* *
* LED driver for OSK with optional Mistral QVGA board * LED driver for OSK with optional Mistral QVGA board
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/system.h> #include <asm/system.h>
#include <mach/gpio.h>
#include "leds.h" #include "leds.h"
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
* *
* OMAP LEDs dispatcher * OMAP LEDs dispatcher
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include "leds.h" #include "leds.h"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <plat/board.h> #include <plat/board.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <mach/gpio.h>
#include <plat/fpga.h> #include <plat/fpga.h>
#include "pm.h" #include "pm.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/usb.h> #include <plat/usb.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/common.h> #include <plat/common.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <plat/usb.h> #include <plat/usb.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/common.h> #include <plat/common.h>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <plat/mcspi.h> #include <plat/mcspi.h>
#include <mach/gpio.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/common.h> #include <plat/common.h>
#include <plat/gpmc.h> #include <plat/gpmc.h>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <plat/tc.h> #include <plat/tc.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/mcbsp.h> #include <plat/mcbsp.h>
#include <mach/gpio.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <plat/dma.h> #include <plat/dma.h>
#include <plat/omap_hwmod.h> #include <plat/omap_hwmod.h>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/mv643xx_eth.h> #include <linux/mv643xx_eth.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/marvell_phy.h> #include <linux/marvell_phy.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/gpio.h>
#include <mach/bridge-regs.h> #include <mach/bridge-regs.h>
#include <plat/irq.h> #include <plat/irq.h>
#include "common.h" #include "common.h"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* published by the Free Software Foundation; either version 2 of the * published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
#include "common.h" #include "common.h"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/ata_platform.h> #include <linux/ata_platform.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* License version 2. This program is licensed "as is" without any * License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/input.h> #include <linux/input.h>
#include <net/dsa.h> #include <net/dsa.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
#include <mach/orion5x.h> #include <mach/orion5x.h>
......
...@@ -13,14 +13,13 @@ ...@@ -13,14 +13,13 @@
* is licensed "as is" without any warranty of any kind, whether express * is licensed "as is" without any warranty of any kind, whether express
* or implied. * or implied.
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/io.h> #include <linux/io.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <mach/gpio.h> #include <mach/gpio-pnx4008.h>
/* register definitions */ /* register definitions */
#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE) #define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE)
......
/* /*
* arch/arm/mach-pnx4008/include/mach/gpio.h * arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
* *
* PNX4008 GPIO driver - header file * PNX4008 GPIO driver - header file
* *
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -19,8 +18,8 @@ ...@@ -19,8 +18,8 @@
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <mach/gpio.h>
#include <mach/gpio-pnx4008.h>
#include <mach/clock.h> #include <mach/clock.h>
#define UART_3 0 #define UART_3 0
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/mtd/nand-gpio.h> #include <linux/mtd/nand-gpio.h>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* initialization stuff for PXA machines which can be overridden later if * initialization stuff for PXA machines which can be overridden later if
* need be. * need be.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -26,7 +27,6 @@ ...@@ -26,7 +27,6 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/reset.h> #include <mach/reset.h>
#include <mach/gpio.h>
#include <mach/smemc.h> #include <mach/smemc.h>
#include <mach/pxa3xx-regs.h> #include <mach/pxa3xx-regs.h>
......
/*
* 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) (*(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)
#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 */
...@@ -24,84 +24,10 @@ ...@@ -24,84 +24,10 @@
#ifndef __ASM_ARCH_PXA_GPIO_H #ifndef __ASM_ARCH_PXA_GPIO_H
#define __ASM_ARCH_PXA_GPIO_H #define __ASM_ARCH_PXA_GPIO_H
#include <mach/irqs.h>
#include <mach/hardware.h>
#include <asm-generic/gpio.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) #define gpio_to_irq(gpio) IRQ_GPIO(gpio)
static inline int irq_to_gpio(unsigned int irq) static inline int irq_to_gpio(unsigned int irq)
...@@ -118,37 +44,5 @@ static inline int irq_to_gpio(unsigned int irq) ...@@ -118,37 +44,5 @@ static inline int irq_to_gpio(unsigned int irq)
return -1; 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> #include <plat/gpio.h>
#endif #endif
#ifndef __ASM_ARCH_LITTLETON_H #ifndef __ASM_ARCH_LITTLETON_H
#define __ASM_ARCH_LITTLETON_H #define __ASM_ARCH_LITTLETON_H
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#define LITTLETON_ETH_PHYS 0x30000000 #define LITTLETON_ETH_PHYS 0x30000000
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -21,7 +20,7 @@ ...@@ -21,7 +20,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#include "generic.h" #include "generic.h"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <mach/pxa27x.h> #include <mach/pxa27x.h>
#include <mach/gpio.h>
#include <mach/lpd270.h> #include <mach/lpd270.h>
#include <mach/audio.h> #include <mach/audio.h>
#include <mach/pxafb.h> #include <mach/pxafb.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -42,7 +43,6 @@ ...@@ -42,7 +43,6 @@
#include <asm/hardware/sa1111.h> #include <asm/hardware/sa1111.h>
#include <mach/pxa25x.h> #include <mach/pxa25x.h>
#include <mach/gpio.h>
#include <mach/audio.h> #include <mach/audio.h>
#include <mach/lubbock.h> #include <mach/lubbock.h>
#include <mach/udc.h> #include <mach/udc.h>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <mach/pxa27x.h> #include <mach/pxa27x.h>
#include <mach/gpio.h>
#include <mach/mainstone.h> #include <mach/mainstone.h>
#include <mach/audio.h> #include <mach/audio.h>
#include <mach/pxafb.h> #include <mach/pxafb.h>
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <mach/gpio.h>
#include <mach/pxa2xx-regs.h> #include <mach/pxa2xx-regs.h>
#include <mach/mfp-pxa2xx.h> #include <mach/mfp-pxa2xx.h>
#include <mach/gpio-pxa.h>
#include "generic.h" #include "generic.h"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <media/soc_camera.h> #include <media/soc_camera.h>
#include <asm/gpio.h>
#include <mach/camera.h> #include <mach/camera.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/pxa27x.h> #include <mach/pxa27x.h>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* initialization stuff for PXA machines which can be overridden later if * initialization stuff for PXA machines which can be overridden later if
* need be. * need be.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -23,12 +24,12 @@ ...@@ -23,12 +24,12 @@
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/suspend.h> #include <asm/suspend.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h>
#include <mach/pxa25x.h> #include <mach/pxa25x.h>
#include <mach/reset.h> #include <mach/reset.h>
#include <mach/pm.h> #include <mach/pm.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -20,13 +21,13 @@ ...@@ -20,13 +21,13 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <linux/gpio.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/suspend.h> #include <asm/suspend.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h>
#include <mach/pxa27x.h> #include <mach/pxa27x.h>
#include <mach/reset.h> #include <mach/reset.h>
#include <mach/ohci.h> #include <mach/ohci.h>
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -26,7 +25,7 @@ ...@@ -26,7 +25,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/suspend.h> #include <asm/suspend.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#include <mach/pxa3xx-regs.h> #include <mach/pxa3xx-regs.h>
#include <mach/reset.h> #include <mach/reset.h>
#include <mach/ohci.h> #include <mach/ohci.h>
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -21,7 +20,7 @@ ...@@ -21,7 +20,7 @@
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
#include <mach/pxa3xx-regs.h> #include <mach/pxa3xx-regs.h>
#include <mach/pxa930.h> #include <mach/pxa930.h>
#include <mach/reset.h> #include <mach/reset.h>
......
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* publishhed by the Free Software Foundation. * publishhed by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <linux/mfd/88pm860x.h> #include <linux/mfd/88pm860x.h>
#include <linux/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -23,7 +24,6 @@ ...@@ -23,7 +24,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/mfp.h> #include <mach/mfp.h>
#include <mach/mfp-pxa930.h> #include <mach/mfp-pxa930.h>
#include <mach/gpio.h>
#include "generic.h" #include "generic.h"
......
#include <asm-generic/gpio.h> /* empty */
#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
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
* published by the Free Software Foundation. * 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 /* some boards require extra gpio capacity to support external
* devices that need GPIO. * devices that need GPIO.
*/ */
...@@ -28,7 +23,6 @@ ...@@ -28,7 +23,6 @@
#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) #define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)
#endif #endif
#include <asm-generic/gpio.h>
#include <mach/gpio-nrs.h> #include <mach/gpio-nrs.h>
#include <mach/gpio-fns.h> #include <mach/gpio-fns.h>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#ifndef __ASM_ARCH_H1940_LATCH_H #ifndef __ASM_ARCH_H1940_LATCH_H
#define __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)) #define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x))
......
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
* published by the Free Software Foundation. * 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 */ /* GPIO bank sizes */
#define S3C64XX_GPIO_A_NR (8) #define S3C64XX_GPIO_A_NR (8)
#define S3C64XX_GPIO_B_NR (7) #define S3C64XX_GPIO_B_NR (7)
...@@ -96,5 +91,3 @@ enum s3c_gpio_number { ...@@ -96,5 +91,3 @@ enum s3c_gpio_number {
#define BOARD_NR_GPIOS 16 #define BOARD_NR_GPIOS 16
#define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS) #define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS)
#include <asm-generic/gpio.h>
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #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 */ /* GPIO bank sizes */
#define S5P6440_GPIO_A_NR (6) #define S5P6440_GPIO_A_NR (6)
...@@ -134,6 +129,4 @@ enum s5p6450_gpio_number { ...@@ -134,6 +129,4 @@ enum s5p6450_gpio_number {
#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA) #define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
#include <asm-generic/gpio.h>
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #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 */ /* GPIO bank sizes */
#define S5PC100_GPIO_A0_NR (8) #define S5PC100_GPIO_A0_NR (8)
#define S5PC100_GPIO_A1_NR (5) #define S5PC100_GPIO_A1_NR (5)
...@@ -146,6 +141,4 @@ enum s5p_gpio_number { ...@@ -146,6 +141,4 @@ enum s5p_gpio_number {
/* define the number of gpios we need to the one after the MP04() range */ /* define the number of gpios we need to the one after the MP04() range */
#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1) #define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
#include <asm-generic/gpio.h>
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #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 */ /* Practically, GPIO banks up to MP03 are the configurable gpio banks */
/* GPIO bank sizes */ /* GPIO bank sizes */
...@@ -142,6 +137,4 @@ enum s5p_gpio_number { ...@@ -142,6 +137,4 @@ enum s5p_gpio_number {
#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \ #define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \
CONFIG_SAMSUNG_GPIO_EXTRA + 1) CONFIG_SAMSUNG_GPIO_EXTRA + 1)
#include <asm-generic/gpio.h>
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Common support # 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-m :=
obj-n := obj-n :=
obj- := obj- :=
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -24,7 +25,6 @@ ...@@ -24,7 +25,6 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/gpio.h>
#include "generic.h" #include "generic.h"
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm-generic/gpio.h> #include <asm-generic/gpio.h>
#define __ARM_GPIOLIB_COMPLEX
static inline int gpio_get_value(unsigned gpio) static inline int gpio_get_value(unsigned gpio)
{ {
if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
...@@ -51,7 +53,5 @@ static inline void gpio_set_value(unsigned gpio, int value) ...@@ -51,7 +53,5 @@ static inline void gpio_set_value(unsigned gpio, int value)
#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \ #define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
(IRQ_GPIO11 - 11 + gpio)) (IRQ_GPIO11 - 11 + gpio))
#define irq_to_gpio(irq) ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
(irq - IRQ_GPIO11 + 11))
#endif #endif
...@@ -18,31 +18,15 @@ ...@@ -18,31 +18,15 @@
#ifdef CONFIG_GPIOLIB #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) static inline int irq_to_gpio(unsigned int irq)
{ {
return -ENOSYS; return -ENOSYS;
} }
#else
#define __ARM_GPIOLIB_COMPLEX
#endif /* CONFIG_GPIOLIB */ #endif /* CONFIG_GPIOLIB */
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
...@@ -24,12 +24,10 @@ ...@@ -24,12 +24,10 @@
#include <mach/pinmux.h> #include <mach/pinmux.h>
#include "board.h" #include "board.h"
#include "board-harmony.h"
#ifdef CONFIG_TEGRA_PCI #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) static int __init harmony_pcie_init(void)
{ {
struct regulator *regulator = NULL; struct regulator *regulator = NULL;
...@@ -38,11 +36,11 @@ static int __init harmony_pcie_init(void) ...@@ -38,11 +36,11 @@ static int __init harmony_pcie_init(void)
if (!machine_is_harmony()) if (!machine_is_harmony())
return 0; 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) if (err)
return 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"); regulator = regulator_get(NULL, "pex_clk");
if (IS_ERR_OR_NULL(regulator)) if (IS_ERR_OR_NULL(regulator))
...@@ -68,7 +66,7 @@ static int __init harmony_pcie_init(void) ...@@ -68,7 +66,7 @@ static int __init harmony_pcie_init(void)
regulator_disable(regulator); regulator_disable(regulator);
regulator_put(regulator); regulator_put(regulator);
err_reg: err_reg:
gpio_free(EN_VDD_1V05_GPIO); gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
return err; return err;
} }
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef _MACH_TEGRA_BOARD_HARMONY_H #ifndef _MACH_TEGRA_BOARD_HARMONY_H
#define _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_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_))
#define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_)) #define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_))
...@@ -31,6 +33,7 @@ ...@@ -31,6 +33,7 @@
#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2 #define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2
#define TEGRA_GPIO_INT_MIC_EN TEGRA_GPIO_PX0 #define TEGRA_GPIO_INT_MIC_EN TEGRA_GPIO_PX0
#define TEGRA_GPIO_EXT_MIC_EN TEGRA_GPIO_PX1 #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); void harmony_pinmux_init(void);
int harmony_regulator_init(void); int harmony_regulator_init(void);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/gpio.h>
#include <linux/rfkill-gpio.h> #include <linux/rfkill-gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -36,7 +37,6 @@ ...@@ -36,7 +37,6 @@
#include <mach/iomap.h> #include <mach/iomap.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/sdhci.h> #include <mach/sdhci.h>
#include <mach/gpio.h>
#include "board.h" #include "board.h"
#include "board-paz00.h" #include "board-paz00.h"
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef _MACH_TEGRA_BOARD_PAZ00_H #ifndef _MACH_TEGRA_BOARD_PAZ00_H
#define _MACH_TEGRA_BOARD_PAZ00_H #define _MACH_TEGRA_BOARD_PAZ00_H
#include <mach/gpio-tegra.h>
/* SDCARD */ /* SDCARD */
#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5 #define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5
#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1 #define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef _MACH_TEGRA_BOARD_SEABOARD_H #ifndef _MACH_TEGRA_BOARD_SEABOARD_H
#define _MACH_TEGRA_BOARD_SEABOARD_H #define _MACH_TEGRA_BOARD_SEABOARD_H
#include <mach/gpio-tegra.h>
#define SEABOARD_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_)) #define SEABOARD_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_))
#define SEABOARD_GPIO_WM8903(_x_) (SEABOARD_GPIO_TPS6586X(4) + (_x_)) #define SEABOARD_GPIO_WM8903(_x_) (SEABOARD_GPIO_TPS6586X(4) + (_x_))
......
...@@ -13,12 +13,11 @@ ...@@ -13,12 +13,11 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <mach/pinmux.h> #include <mach/pinmux.h>
#include <mach/gpio.h>
#include "gpio-names.h" #include "gpio-names.h"
#include "board-trimslice.h" #include "board-trimslice.h"
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <mach/iomap.h> #include <mach/iomap.h>
#include <mach/sdhci.h> #include <mach/sdhci.h>
#include <mach/gpio.h>
#include "board.h" #include "board.h"
#include "clock.h" #include "clock.h"
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H #ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H
#define _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_CD TEGRA_GPIO_PP1 /* mmc4 cd */
#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */ #define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */
......
/*
* 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
/*
* 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
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/usb/ulpi.h> #include <linux/usb/ulpi.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/gpio-tegra.h>
#include <mach/usb_phy.h> #include <mach/usb_phy.h>
#include <mach/iomap.h> #include <mach/iomap.h>
......
...@@ -6,6 +6,7 @@ comment "ST-Ericsson Mobile Platform Products" ...@@ -6,6 +6,7 @@ comment "ST-Ericsson Mobile Platform Products"
config MACH_U300 config MACH_U300
bool "U300" bool "U300"
select GPIO_U300
comment "ST-Ericsson U300/U330/U335/U365 Feature Selections" comment "ST-Ericsson U300/U330/U335/U365 Feature Selections"
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/syscon.h> #include <mach/syscon.h>
#include <mach/dma_channels.h> #include <mach/dma_channels.h>
#include <mach/gpio-u300.h>
#include "clock.h" #include "clock.h"
#include "mmc.h" #include "mmc.h"
...@@ -239,7 +240,7 @@ static struct resource gpio_resources[] = { ...@@ -239,7 +240,7 @@ static struct resource gpio_resources[] = {
.end = IRQ_U300_GPIO_PORT2, .end = IRQ_U300_GPIO_PORT2,
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
#ifdef U300_COH901571_3 #if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
{ {
.name = "gpio3", .name = "gpio3",
.start = IRQ_U300_GPIO_PORT3, .start = IRQ_U300_GPIO_PORT3,
...@@ -252,6 +253,7 @@ static struct resource gpio_resources[] = { ...@@ -252,6 +253,7 @@ static struct resource gpio_resources[] = {
.end = IRQ_U300_GPIO_PORT4, .end = IRQ_U300_GPIO_PORT4,
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
#endif
#ifdef CONFIG_MACH_U300_BS335 #ifdef CONFIG_MACH_U300_BS335
{ {
.name = "gpio5", .name = "gpio5",
...@@ -266,7 +268,6 @@ static struct resource gpio_resources[] = { ...@@ -266,7 +268,6 @@ static struct resource gpio_resources[] = {
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
#endif /* CONFIG_MACH_U300_BS335 */ #endif /* CONFIG_MACH_U300_BS335 */
#endif /* U300_COH901571_3 */
}; };
static struct resource keypad_resources[] = { static struct resource keypad_resources[] = {
...@@ -1556,11 +1557,35 @@ static struct platform_device i2c1_device = { ...@@ -1556,11 +1557,35 @@ static struct platform_device i2c1_device = {
.resource = i2c1_resources, .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 = { static struct platform_device gpio_device = {
.name = "u300-gpio", .name = "u300-gpio",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(gpio_resources), .num_resources = ARRAY_SIZE(gpio_resources),
.resource = gpio_resources, .resource = gpio_resources,
.dev = {
.platform_data = &u300_gpio_plat,
},
}; };
static struct platform_device keypad_device = { static struct platform_device keypad_device = {
...@@ -1666,7 +1691,7 @@ void __init u300_init_irq(void) ...@@ -1666,7 +1691,7 @@ void __init u300_init_irq(void)
BUG_ON(IS_ERR(clk)); BUG_ON(IS_ERR(clk));
clk_enable(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]); set_bit(i, (unsigned long *) &mask[0]);
vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], 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]); vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
......
/*
* 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 */
/*
*
* 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
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
/* DB3150 and DB3200 have only 45 IRQs */ /* DB3150 and DB3200 have only 45 IRQs */
#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
#define U300_NR_IRQS 45 #define U300_VIC_IRQS_END 45
#endif #endif
/* The DB3350-specific interrupt lines */ /* The DB3350-specific interrupt lines */
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
#define IRQ_U300_GPIO_PORT4 53 #define IRQ_U300_GPIO_PORT4 53
#define IRQ_U300_GPIO_PORT5 54 #define IRQ_U300_GPIO_PORT5 54
#define IRQ_U300_GPIO_PORT6 55 #define IRQ_U300_GPIO_PORT6 55
#define U300_NR_IRQS 56 #define U300_VIC_IRQS_END 56
#endif #endif
/* The DB3210-specific interrupt lines */ /* The DB3210-specific interrupt lines */
...@@ -106,16 +106,25 @@ ...@@ -106,16 +106,25 @@
#define IRQ_U300_NFIF 45 #define IRQ_U300_NFIF 45
#define IRQ_U300_NFIF2 46 #define IRQ_U300_NFIF2 46
#define IRQ_U300_SYSCON_PLL_LOCK 47 #define IRQ_U300_SYSCON_PLL_LOCK 47
#define U300_NR_IRQS 48 #define U300_VIC_IRQS_END 48
#endif #endif
#ifdef CONFIG_AB3550_CORE /* Maximum 8*7 GPIO lines */
#define IRQ_AB3550_BASE (U300_NR_IRQS) #ifdef CONFIG_GPIO_U300
#define IRQ_AB3550_END (IRQ_AB3550_BASE + 37) #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 #else
#define NR_IRQS U300_NR_IRQS #define IRQ_AB3550_END (IRQ_U300_GPIO_END)
#endif #endif
#define NR_IRQS (IRQ_AB3550_END)
#endif #endif
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/gpio.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/amba/mmci.h> #include <linux/amba/mmci.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <mach/coh901318.h> #include <mach/coh901318.h>
#include <mach/dma_channels.h> #include <mach/dma_channels.h>
#include <mach/gpio-u300.h>
#include "mmc.h" #include "mmc.h"
#include "padmux.h" #include "padmux.h"
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <plat/pincfg.h> #include <plat/pincfg.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include "pins-db8500.h" #include "pins-db8500.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Board data for the U8500 UIB, also known as the New UIB * Board data for the U8500 UIB, also known as the New UIB
* License terms: GNU General Public License (GPL), version 2 * License terms: GNU General Public License (GPL), version 2
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/mfd/tc3589x.h> #include <linux/mfd/tc3589x.h>
#include <linux/input/matrix_keypad.h> #include <linux/input/matrix_keypad.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include "board-mop500.h" #include "board-mop500.h"
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <plat/i2c.h> #include <plat/i2c.h>
#include <plat/ste_dma40.h> #include <plat/ste_dma40.h>
#include <plat/pincfg.h> #include <plat/pincfg.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/setup.h> #include <mach/setup.h>
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include <linux/amba/mmci.h> #include <linux/amba/mmci.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/gpio.h>
#include <plat/pincfg.h> #include <plat/pincfg.h>
#include <plat/gpio-nomadik.h>
#include <mach/db5500-regs.h> #include <mach/db5500-regs.h>
#include <plat/ste_dma40.h> #include <plat/ste_dma40.h>
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/gpio.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -17,6 +16,7 @@ ...@@ -17,6 +16,7 @@
#include <plat/pincfg.h> #include <plat/pincfg.h>
#include <plat/i2c.h> #include <plat/i2c.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/devices.h> #include <mach/devices.h>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/pmu.h> #include <asm/pmu.h>
#include <plat/gpio.h> #include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/devices.h> #include <mach/devices.h>
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/pmu.h> #include <asm/pmu.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/setup.h> #include <mach/setup.h>
#include <mach/devices.h> #include <mach/devices.h>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <plat/gpio.h> #include <plat/gpio-nomadik.h>
#include <mach/hardware.h> #include <mach/hardware.h>
......
...@@ -7,6 +7,4 @@ ...@@ -7,6 +7,4 @@
*/ */
#define ARCH_NR_GPIOS 350 #define ARCH_NR_GPIOS 350
#include <plat/gpio.h>
#endif /* __ASM_ARCH_GPIO_H */ #endif /* __ASM_ARCH_GPIO_H */
#include <asm-generic/gpio.h> /* empty */
#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 <asm-generic/gpio.h> /* empty */
#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
...@@ -15,16 +15,12 @@ ...@@ -15,16 +15,12 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.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) static inline int gpio_to_irq(unsigned gpio)
{ {
return gpio; return gpio;
} }
#define gpio_to_irq gpio_to_irq
static inline int irq_to_gpio(unsigned irq) static inline int irq_to_gpio(unsigned irq)
{ {
......
...@@ -21,18 +21,12 @@ ...@@ -21,18 +21,12 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm-generic/gpio.h>
/* There's a off-by-one betweem the gpio bank number and the gpiochip */ /* 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 */ /* range e.g. GPIO_1_5 is gpio 5 under linux */
#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr)) #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 gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
......
...@@ -9,20 +9,9 @@ ...@@ -9,20 +9,9 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#ifndef __ASM_PLAT_GPIO_H
#define __ASM_PLAT_GPIO_H
#include <asm-generic/gpio.h> #ifndef __PLAT_NOMADIK_GPIO
#define __PLAT_NOMADIK_GPIO
/*
* 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
/* /*
* "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
...@@ -93,4 +82,4 @@ struct nmk_gpio_platform_data { ...@@ -93,4 +82,4 @@ struct nmk_gpio_platform_data {
bool supports_sleepmode; bool supports_sleepmode;
}; };
#endif /* __ASM_PLAT_GPIO_H */ #endif /* __PLAT_NOMADIK_GPIO */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <plat/board.h> #include <plat/board.h>
#include <mach/gpio.h>
/* Many OMAP development platforms reuse the same "debug board"; these /* Many OMAP development platforms reuse the same "debug board"; these
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/leds.h> #include <linux/leds.h>
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <plat/fpga.h> #include <plat/fpga.h>
#include <mach/gpio.h>
/* Many OMAP development platforms reuse the same "debug board"; these /* Many OMAP development platforms reuse the same "debug board"; these
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <plat/tc.h> #include <plat/tc.h>
#include <plat/board.h> #include <plat/board.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <mach/gpio.h>
#include <plat/menelaus.h> #include <plat/menelaus.h>
#include <plat/mcbsp.h> #include <plat/mcbsp.h>
#include <plat/omap44xx.h> #include <plat/omap44xx.h>
......
...@@ -222,26 +222,6 @@ extern void omap_gpio_restore_context(void); ...@@ -222,26 +222,6 @@ extern void omap_gpio_restore_context(void);
#include <linux/errno.h> #include <linux/errno.h>
#include <asm-generic/gpio.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) static inline int irq_to_gpio(unsigned irq)
{ {
int tmp; int tmp;
......
...@@ -12,15 +12,7 @@ ...@@ -12,15 +12,7 @@
#define __PLAT_GPIO_H #define __PLAT_GPIO_H
#include <linux/init.h> #include <linux/init.h>
#include <asm-generic/gpio.h> #include <linux/types.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
/* /*
* Orion-specific GPIO API extensions. * Orion-specific GPIO API extensions.
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
obj-y := dma.o obj-y := dma.o
obj-$(CONFIG_GENERIC_GPIO) += gpio.o
obj-$(CONFIG_PXA3xx) += mfp.o obj-$(CONFIG_PXA3xx) += mfp.o
obj-$(CONFIG_PXA95x) += mfp.o obj-$(CONFIG_PXA95x) += mfp.o
obj-$(CONFIG_ARCH_MMP) += mfp.o obj-$(CONFIG_ARCH_MMP) += mfp.o
......
#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 */
#ifndef __PLAT_GPIO_H #ifndef __PLAT_GPIO_H
#define __PLAT_GPIO_H #define __PLAT_GPIO_H
struct irq_data; #define __ARM_GPIOLIB_COMPLEX
/* /* The individual machine provides register offsets and NR_BUILTIN_GPIO */
* We handle the GPIOs by banks, each bank covers up to 32 GPIOs with #include <mach/gpio-pxa.h>
* 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
static inline int gpio_get_value(unsigned gpio) static inline int gpio_get_value(unsigned gpio)
{ {
...@@ -52,13 +27,4 @@ static inline void gpio_set_value(unsigned gpio, int value) ...@@ -52,13 +27,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
#define gpio_cansleep __gpio_cansleep #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 */ #endif /* __PLAT_GPIO_H */
/* /* empty */
* 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 */
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#define DRV_NAME "pata_at91" #define DRV_NAME "pata_at91"
#define DRV_VERSION "0.3" #define DRV_VERSION "0.3"
......
...@@ -178,6 +178,15 @@ config GPIO_SCH ...@@ -178,6 +178,15 @@ config GPIO_SCH
The Intel Tunnel Creek processor has 5 GPIOs powered by the The Intel Tunnel Creek processor has 5 GPIOs powered by the
core power rail and 9 from suspend power supply. 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 config GPIO_VX855
tristate "VIA VX855/VX875 GPIO" tristate "VIA VX855/VX875 GPIO"
depends on MFD_SUPPORT && PCI depends on MFD_SUPPORT && PCI
......
...@@ -14,11 +14,14 @@ obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o ...@@ -14,11 +14,14 @@ obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o
obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o
obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o
obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.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_EP93XX) += gpio-ep93xx.o
obj-$(CONFIG_GPIO_EXYNOS4) += gpio-exynos4.o obj-$(CONFIG_GPIO_EXYNOS4) += gpio-exynos4.o
obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o
obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.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_GPIO_LANGWELL) += gpio-langwell.o
obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o
obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o
obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o
...@@ -37,18 +40,20 @@ obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o ...@@ -37,18 +40,20 @@ obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o
obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o
obj-$(CONFIG_GPIO_PCH) += gpio-pch.o obj-$(CONFIG_GPIO_PCH) += gpio-pch.o
obj-$(CONFIG_GPIO_PL061) += gpio-pl061.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_RDC321X) += gpio-rdc321x.o
obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o
obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o
obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.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_SCH) += gpio-sch.o
obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o
obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o obj-$(CONFIG_GPIO_TC3589X) += gpio-tc3589x.o
obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o obj-$(CONFIG_ARCH_TEGRA) += gpio-tegra.o
obj-$(CONFIG_GPIO_TIMBERDALE) += gpio-timberdale.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_TPS65910) += gpio-tps65910.o
obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o obj-$(CONFIG_GPIO_TPS65912) += gpio-tps65912.o
obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o
......
...@@ -9,15 +9,13 @@ ...@@ -9,15 +9,13 @@
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
*/ */
#include <linux/gpio.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <mach/gpio.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
struct davinci_gpio_regs { struct davinci_gpio_regs {
...@@ -232,9 +230,6 @@ static void gpio_irq_enable(struct irq_data *d) ...@@ -232,9 +230,6 @@ static void gpio_irq_enable(struct irq_data *d)
static int gpio_irq_type(struct irq_data *d, unsigned trigger) 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)) if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
return -EINVAL; return -EINVAL;
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include <linux/basic_mmio_gpio.h> #include <linux/basic_mmio_gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/gpio-ep93xx.h>
#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
struct ep93xx_gpio { struct ep93xx_gpio {
void __iomem *mmio_base; void __iomem *mmio_base;
...@@ -307,6 +310,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip, ...@@ -307,6 +310,21 @@ static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
return 0; 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, static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
void __iomem *mmio_base, struct ep93xx_gpio_bank *bank) 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, ...@@ -321,8 +339,10 @@ static int ep93xx_gpio_add_bank(struct bgpio_chip *bgc, struct device *dev,
bgc->gc.label = bank->label; bgc->gc.label = bank->label;
bgc->gc.base = bank->base; bgc->gc.base = bank->base;
if (bank->has_debounce) if (bank->has_debounce) {
bgc->gc.set_debounce = ep93xx_gpio_set_debounce; bgc->gc.set_debounce = ep93xx_gpio_set_debounce;
bgc->gc.to_irq = ep93xx_gpio_to_irq;
}
return gpiochip_add(&bgc->gc); return gpiochip_add(&bgc->gc);
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <linux/gpio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/regs-gpio.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 * Configure a GPIO line for either GPIO function, or its internal
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.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_INP_STATE _GPREG(0x000)
#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) #define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004)
......
...@@ -27,8 +27,9 @@ ...@@ -27,8 +27,9 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <plat/pincfg.h> #include <plat/pincfg.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.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 * The GPIO module in the Nomadik family of Systems-on-Chip is an
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
struct gpio_bank { struct gpio_bank {
......
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <mach/gpio.h> #include <mach/gpio-pxa.h>
int pxa_last_gpio; int pxa_last_gpio;
......
...@@ -7,13 +7,11 @@ ...@@ -7,13 +7,11 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/gpio.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include "generic.h"
static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset) static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
{ {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/gpio-tegra.h>
#include <mach/iomap.h> #include <mach/iomap.h>
#include <mach/suspend.h> #include <mach/suspend.h>
...@@ -134,7 +135,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, ...@@ -134,7 +135,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
return 0; 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 = { static struct gpio_chip tegra_gpio_chip = {
.label = "tegra-gpio", .label = "tegra-gpio",
...@@ -142,6 +146,7 @@ static struct gpio_chip tegra_gpio_chip = { ...@@ -142,6 +146,7 @@ static struct gpio_chip tegra_gpio_chip = {
.get = tegra_gpio_get, .get = tegra_gpio_get,
.direction_output = tegra_gpio_direction_output, .direction_output = tegra_gpio_direction_output,
.set = tegra_gpio_set, .set = tegra_gpio_set,
.to_irq = tegra_gpio_to_irq,
.base = 0, .base = 0,
.ngpio = TEGRA_NR_GPIOS, .ngpio = TEGRA_NR_GPIOS,
}; };
...@@ -331,6 +336,7 @@ static struct lock_class_key gpio_lock_class; ...@@ -331,6 +336,7 @@ static struct lock_class_key gpio_lock_class;
static int __init tegra_gpio_init(void) static int __init tegra_gpio_init(void)
{ {
struct tegra_gpio_bank *bank; struct tegra_gpio_bank *bank;
int gpio;
int i; int i;
int j; int j;
...@@ -352,14 +358,17 @@ static int __init tegra_gpio_init(void) ...@@ -352,14 +358,17 @@ static int __init tegra_gpio_init(void)
gpiochip_add(&tegra_gpio_chip); gpiochip_add(&tegra_gpio_chip);
for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) { for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))]; 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_lockdep_class(irq, &gpio_lock_class);
irq_set_chip_data(i, bank); irq_set_chip_data(irq, bank);
irq_set_chip_and_handler(i, &tegra_gpio_irq_chip, irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
handle_simple_irq); 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++) { for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
......
/* /*
* U300 GPIO module. * 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 * License terms: GNU General Public License (GPL) version 2
* This can driver either of the two basic GPIO cores * This can driver either of the two basic GPIO cores
* available in the U300 platforms: * available in the U300 platforms:
* COH 901 335 - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0) * 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) * 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@linaro.org>
* Author: Linus Walleij <linus.walleij@stericsson.com>
* Author: Jonas Aaberg <jonas.aberg@stericsson.com> * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
*
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/irq.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -21,677 +20,898 @@ ...@@ -21,677 +20,898 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <mach/gpio-u300.h>
/*
* 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
/* Reference to GPIO block clock */ /*
static struct clk *clk; * 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
/* Memory resource */ /*
static struct resource *memres; * Register definitions for COH 901 335 variant
static void __iomem *virtbase; */
static struct device *gpiodev; #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 { struct u300_gpio_port {
const char *name; struct list_head node;
struct u300_gpio *gpio;
char name[8];
int irq; int irq;
int number; 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[] = { /*
{ * Provides a bitmask for a specific gpio pin inside an 8-bit GPIO
.name = "gpio0", * register.
.number = 0, */
}, #define U300_PIN_BIT(pin) \
{ (1 << (pin & 0x07))
.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
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 U300_PULL_UP_INPUT { \
#define DEFAULT_OUTPUT_LOW 0 .bias_mode = GPIO_U300_CONFIG_BIAS_PULL_UP, \
#define DEFAULT_OUTPUT_HIGH 1 .output = false, \
}
/* GPIO Pull-Up status */ #define U300_OUTPUT_LOW { \
#define DISABLE_PULL_UP 0 .output = true, \
#define ENABLE_PULL_UP 1 .outval = 0, \
}
#define GPIO_NOT_USED 0 #define U300_OUTPUT_HIGH { \
#define GPIO_IN 1 .output = true, \
#define GPIO_OUT 2 .outval = 1, \
}
struct u300_gpio_configuration_data {
unsigned char pin_usage;
unsigned char default_output_value;
unsigned char pull_up;
};
/* Initial configuration */ /* Initial configuration */
const struct u300_gpio_configuration_data static const struct __initdata u300_gpio_confdata
u300_gpio_config[U300_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
#ifdef CONFIG_MACH_U300_BS335
/* Port 0, pins 0-7 */ /* Port 0, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_HIGH, DISABLE_PULL_UP}, U300_OUTPUT_HIGH,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_OUTPUT_LOW,
}, },
/* Port 1, pins 0-7 */ /* Port 1, pins 0-7 */
{ {
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_HIGH, DISABLE_PULL_UP}, U300_OUTPUT_HIGH,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_OUTPUT_LOW,
}, },
/* Port 2, pins 0-7 */ /* Port 2, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} U300_PULL_UP_INPUT,
}, },
/* Port 3, pins 0-7 */ /* Port 3, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_FLOATING_INPUT,
}, },
/* Port 4, pins 0-7 */ /* Port 4, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_FLOATING_INPUT,
}, },
/* Port 5, pins 0-7 */ /* Port 5, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_FLOATING_INPUT,
}, },
/* Port 6, pind 0-7 */ /* Port 6, pind 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} 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 */ /* Port 0, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_FLOATING_INPUT,
}, },
/* Port 1, pins 0-7 */ /* Port 1, pins 0-7 */
{ {
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_HIGH, DISABLE_PULL_UP}, U300_OUTPUT_HIGH,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP} U300_OUTPUT_LOW,
}, },
/* Port 2, pins 0-7 */ /* Port 2, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_FLOATING_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, DISABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} U300_PULL_UP_INPUT,
}, },
/* Port 3, pins 0-7 */ /* Port 3, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} U300_PULL_UP_INPUT,
}, },
/* Port 4, pins 0-7 */ /* Port 4, pins 0-7 */
{ {
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
{GPIO_IN, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_PULL_UP_INPUT,
/* These 4 pins doesn't exist on DB3210 */ /* These 4 pins doesn't exist on DB3210 */
{GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP}, U300_OUTPUT_LOW,
{GPIO_OUT, DEFAULT_OUTPUT_LOW, ENABLE_PULL_UP} 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]; /**
* to_u300_gpio() - get the pointer to u300_gpio
/* * @chip: the gpio chip member of the structure u300_gpio
* Let drivers register callback in order to get notified when there is
* an interrupt on the gpio pin
*/ */
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) return container_of(chip, struct u300_gpio, chip);
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;
} }
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) struct u300_gpio *gpio = to_u300_gpio(chip);
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;
return 0;
}
EXPORT_SYMBOL(gpio_unregister_callback);
/* Non-zero means valid */ return readl(U300_PIN_REG(offset, dir)) & U300_PIN_BIT(offset);
int gpio_is_valid(int number)
{
if (number >= 0 &&
number < (U300_GPIO_NUM_PORTS * U300_GPIO_PINS_PER_PORT))
return 1;
return 0;
} }
EXPORT_SYMBOL(gpio_is_valid);
int gpio_request(unsigned gpio, const char *label) static void u300_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ {
if (gpio_pin[gpio].users) struct u300_gpio *gpio = to_u300_gpio(chip);
return -EINVAL; unsigned long flags;
else u32 val;
gpio_pin[gpio].users++;
gpio_users++;
return 0;
}
EXPORT_SYMBOL(gpio_request);
void gpio_free(unsigned gpio) local_irq_save(flags);
{
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; val = readl(U300_PIN_REG(offset, dor));
} if (value)
EXPORT_SYMBOL(gpio_free); writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
else
writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, dor));
/* This returns zero or nonzero */ local_irq_restore(flags);
int gpio_get_value(unsigned gpio)
{
return readl(virtbase + U300_GPIO_PXPDIR +
PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) & (1 << (gpio & 0x07));
} }
EXPORT_SYMBOL(gpio_get_value);
/* static int u300_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
* 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)
{ {
u32 val; struct u300_gpio *gpio = to_u300_gpio(chip);
unsigned long flags; unsigned long flags;
u32 val;
local_irq_save(flags); local_irq_save(flags);
if (value) { val = readl(U300_PIN_REG(offset, pcr));
/* set */ /* Mask out this pin, note 2 bits per setting */
val = readl(virtbase + U300_GPIO_PXPDOR + val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1));
PIN_TO_PORT(gpio) * U300_GPIO_PORTX_SPACING) writel(val, U300_PIN_REG(offset, pcr));
& (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);
}
local_irq_restore(flags); local_irq_restore(flags);
return 0;
} }
EXPORT_SYMBOL(gpio_set_value);
int gpio_direction_input(unsigned gpio) static int u300_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{ {
struct u300_gpio *gpio = to_u300_gpio(chip);
unsigned long flags; unsigned long flags;
u32 oldmode;
u32 val; u32 val;
if (gpio > U300_GPIO_MAX)
return -EINVAL;
local_irq_save(flags); local_irq_save(flags);
val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * val = readl(U300_PIN_REG(offset, pcr));
U300_GPIO_PORTX_SPACING); /*
/* Mask out this pin*/ * Drive mode must be set by the special mode set function, set
val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1)); * push/pull mode by default if no mode has been selected.
/* This is not needed since it sets the bits to zero.*/ */
/* val |= (U300_GPIO_PXPCR_PIN_MODE_INPUT << (gpio*2)); */ oldmode = val & (U300_GPIO_PXPCR_PIN_MODE_MASK <<
writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * ((offset & 0x07) << 1));
U300_GPIO_PORTX_SPACING); /* 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); local_irq_restore(flags);
return 0; return 0;
} }
EXPORT_SYMBOL(gpio_direction_input);
int gpio_direction_output(unsigned gpio, int value) 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; unsigned long flags;
u32 val; u32 val;
if (gpio > U300_GPIO_MAX)
return -EINVAL;
local_irq_save(flags); local_irq_save(flags);
val = readl(virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * switch (param) {
U300_GPIO_PORTX_SPACING); case GPIO_U300_CONFIG_BIAS_UNKNOWN:
/* Mask out this pin */ case GPIO_U300_CONFIG_BIAS_FLOAT:
val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << ((gpio & 0x07) << 1)); val = readl(U300_PIN_REG(offset, per));
/* writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
* FIXME: configure for push/pull, open drain or open source per pin break;
* in setup. The current driver will only support push/pull. 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 val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL
<< ((gpio & 0x07) << 1)); << ((offset & 0x07) << 1));
writel(val, virtbase + U300_GPIO_PXPCR + PIN_TO_PORT(gpio) * writel(val, U300_PIN_REG(offset, pcr));
U300_GPIO_PORTX_SPACING); break;
gpio_set_value(gpio, value); 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); local_irq_restore(flags);
return 0; return 0;
} }
EXPORT_SYMBOL(gpio_direction_output);
/* static struct gpio_chip u300_gpio_chip = {
* Enable an IRQ, edge is rising edge (!= 0) or falling edge (==0). .label = "u300-gpio-chip",
*/ .owner = THIS_MODULE,
void enable_irq_on_gpio_pin(unsigned gpio, int edge) .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)
{ {
u32 val; u32 val;
unsigned long flags;
local_irq_save(flags);
val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) * val = readl(U300_PIN_REG(offset, icr));
U300_GPIO_PORTX_SPACING); /* Set mode depending on state */
val |= (1 << (gpio & 0x07)); if (u300_gpio_get(&gpio->chip, offset)) {
writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) * /* High now, let's trigger on falling edge next then */
U300_GPIO_PORTX_SPACING); writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
val = readl(virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) * dev_dbg(gpio->dev, "next IRQ on falling edge on pin %d\n",
U300_GPIO_PORTX_SPACING); offset);
if (edge) } else {
val |= (1 << (gpio & 0x07)); /* Low now, let's trigger on rising edge next then */
else writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, icr));
val &= ~(1 << (gpio & 0x07)); dev_dbg(gpio->dev, "next IRQ on rising edge on pin %d\n",
writel(val, virtbase + U300_GPIO_PXICR + PIN_TO_PORT(gpio) * offset);
U300_GPIO_PORTX_SPACING); }
local_irq_restore(flags);
} }
EXPORT_SYMBOL(enable_irq_on_gpio_pin);
void disable_irq_on_gpio_pin(unsigned gpio) 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;
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;
}
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; u32 val;
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
val = readl(virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) * val = readl(U300_PIN_REG(offset, ien));
U300_GPIO_PORTX_SPACING); writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
val &= ~(1 << (gpio & 0x07));
writel(val, virtbase + U300_GPIO_PXIEN + PIN_TO_PORT(gpio) *
U300_GPIO_PORTX_SPACING);
local_irq_restore(flags); local_irq_restore(flags);
} }
EXPORT_SYMBOL(disable_irq_on_gpio_pin);
/* Enable (value == 0) or disable (value == 1) internal pullup */ static void u300_gpio_irq_disable(struct irq_data *d)
void gpio_pullup(unsigned gpio, int value)
{ {
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; u32 val;
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
if (value) { val = readl(U300_PIN_REG(offset, ien));
val = readl(virtbase + U300_GPIO_PXPER + PIN_TO_PORT(gpio) * writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, ien));
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);
}
local_irq_restore(flags); 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; struct u300_gpio_port *port = irq_get_handler_data(irq);
u32 val; struct u300_gpio *gpio = port->gpio;
int pin; int pinoffset = port->number << 3; /* get the right stride */
unsigned long val;
desc->irq_data.chip->irq_ack(&desc->irq_data);
/* Read event register */ /* Read event register */
val = readl(virtbase + U300_GPIO_PXIEV + port->number * val = readl(U300_PIN_REG(pinoffset, iev));
U300_GPIO_PORTX_SPACING);
/* Mask with enable register */
val &= readl(virtbase + U300_GPIO_PXIEV + port->number *
U300_GPIO_PORTX_SPACING);
/* Mask relevant bits */ /* Mask relevant bits */
val &= U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK; val &= 0xFFU; /* 8 bits per port */
/* ACK IRQ (clear event) */ /* ACK IRQ (clear event) */
writel(val, virtbase + U300_GPIO_PXIEV + port->number * writel(val, U300_PIN_REG(pinoffset, iev));
U300_GPIO_PORTX_SPACING);
/* Print message */ /* Call IRQ handler */
while (val != 0) { if (val != 0) {
unsigned gpio; int irqoffset;
pin = __ffs(val); for_each_set_bit(irqoffset, &val, U300_GPIO_PINS_PER_PORT) {
/* mask off this pin */ int pin_irq = gpio->irq_base + (port->number << 3)
val &= ~(1 << pin); + irqoffset;
gpio = (port->number << 3) + pin; int offset = pinoffset + irqoffset;
if (gpio_pin[gpio].callback) dev_dbg(gpio->dev, "GPIO IRQ %d on pin %d\n",
(void)gpio_pin[gpio].callback(gpio_pin[gpio].data); pin_irq, offset);
else generic_handle_irq(pin_irq);
dev_dbg(gpiodev, "stray GPIO IRQ on line %d\n", /*
gpio); * 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 /* Set mode: input or output */
int i, j; if (conf->output) {
unsigned long flags; u300_gpio_direction_output(&gpio->chip, offset, conf->outval);
u32 val;
/* Write default values to all pins */ /* Deactivate bias mode for output */
for (i = 0; i < U300_GPIO_NUM_PORTS; i++) { u300_gpio_config(&gpio->chip, offset,
val = 0; GPIO_U300_CONFIG_BIAS_FLOAT,
for (j = 0; j < 8; j++) NULL);
val |= (u32) (u300_gpio_config[i][j].default_output_value != DEFAULT_OUTPUT_LOW) << j;
local_irq_save(flags); /* Set drive mode for output */
writel(val, virtbase + U300_GPIO_PXPDOR + i * U300_GPIO_PORTX_SPACING); u300_gpio_config(&gpio->chip, offset,
local_irq_restore(flags); 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);
} }
}
/* static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio,
* Put all pins that are set to either 'GPIO_OUT' or 'GPIO_NOT_USED' struct u300_gpio_platform *plat)
* to output and 'GPIO_IN' to input for each port. And initialize {
* default value on outputs. int i, j;
*/
for (i = 0; i < U300_GPIO_NUM_PORTS; i++) { /* Write default config and values to all pins */
for (j = 0; j < U300_GPIO_PINS_PER_PORT; j++) { for (i = 0; i < plat->ports; i++) {
local_irq_save(flags); for (j = 0; j < 8; j++) {
val = readl(virtbase + U300_GPIO_PXPCR + const struct u300_gpio_confdata *conf;
i * U300_GPIO_PORTX_SPACING); int offset = (i*8) + j;
/* Mask out this pin */
val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK << (j << 1)); if (plat->variant == U300_GPIO_COH901571_3_BS335)
conf = &bs335_gpio_config[i][j];
if (u300_gpio_config[i][j].pin_usage != GPIO_IN) else if (plat->variant == U300_GPIO_COH901571_3_BS365)
val |= (U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL << (j << 1)); conf = &bs365_gpio_config[i][j];
writel(val, virtbase + U300_GPIO_PXPCR + else
i * U300_GPIO_PORTX_SPACING); break;
local_irq_restore(flags);
u300_gpio_init_pin(gpio, offset, conf);
} }
} }
}
/* Enable or disable the internal pull-ups in the GPIO ASIC block */ static inline void u300_gpio_free_ports(struct u300_gpio *gpio)
for (i = 0; i < U300_GPIO_MAX; i++) { {
val = 0; struct u300_gpio_port *port;
for (j = 0; j < 8; j++) struct list_head *p, *n;
val |= (u32)((u300_gpio_config[i][j].pull_up == DISABLE_PULL_UP) << j);
local_irq_save(flags); list_for_each_safe(p, n, &gpio->port_list) {
writel(val, virtbase + U300_GPIO_PXPER + i * U300_GPIO_PORTX_SPACING); port = list_entry(p, struct u300_gpio_port, node);
local_irq_restore(flags); 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 err = 0;
int portno;
u32 val;
u32 ifr;
int i; int i;
int num_irqs;
gpiodev = &pdev->dev; gpio = kzalloc(sizeof(struct u300_gpio), GFP_KERNEL);
memset(gpio_pin, 0, sizeof(gpio_pin)); 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 */ /* Get GPIO clock */
clk = clk_get(&pdev->dev, NULL); gpio->clk = clk_get(gpio->dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(gpio->clk)) {
err = PTR_ERR(clk); err = PTR_ERR(gpio->clk);
dev_err(gpiodev, "could not get GPIO clock\n"); dev_err(gpio->dev, "could not get GPIO clock\n");
goto err_no_clk; goto err_no_clk;
} }
err = clk_enable(clk); err = clk_enable(gpio->clk);
if (err) { 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; goto err_no_clk_enable;
} }
memres = platform_get_resource(pdev, IORESOURCE_MEM, 0); gpio->memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!memres) if (!gpio->memres) {
dev_err(gpio->dev, "could not get GPIO memory resource\n");
err = -ENODEV;
goto err_no_resource; 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")) { "GPIO Controller")) {
err = -ENODEV; err = -ENODEV;
goto err_no_ioregion; goto err_no_ioregion;
} }
virtbase = ioremap(memres->start, resource_size(memres)); gpio->base = ioremap(gpio->memres->start, resource_size(gpio->memres));
if (!virtbase) { if (!gpio->base) {
err = -ENOMEM; err = -ENOMEM;
goto err_no_ioremap; goto err_no_ioremap;
} }
dev_info(gpiodev, "remapped 0x%08x to %p\n",
memres->start, virtbase);
#ifdef U300_COH901335 if (plat->variant == U300_GPIO_COH901335) {
dev_info(gpiodev, "initializing GPIO Controller COH 901 335\n"); 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 */ /* Turn on the GPIO block */
writel(U300_GPIO_CR_BLOCK_CLOCK_ENABLE, virtbase + U300_GPIO_CR); writel(U300_335_CR_BLOCK_CLOCK_ENABLE,
#endif gpio->base + U300_335_CR);
} else if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
#ifdef U300_COH901571_3 plat->variant == U300_GPIO_COH901571_3_BS365) {
dev_info(gpiodev, "initializing GPIO Controller COH 901 571/3\n"); dev_info(gpio->dev,
val = readl(virtbase + U300_GPIO_CR); "initializing GPIO Controller COH 901 571/3\n");
dev_info(gpiodev, "COH901571/3 block version: %d, " \ gpio->stride = U300_571_PORT_STRIDE;
"number of cores: %d\n", 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),
((val & 0x000001FC) >> 2)); ((val & 0x0000FE00) >> 9) * 8);
writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE, virtbase + U300_GPIO_CR); writel(U300_571_CR_BLOCK_CLKRQ_ENABLE,
#endif 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;
}
gpio_set_initial_values(); /* 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);
for (num_irqs = 0 ; num_irqs < U300_GPIO_NUM_PORTS; num_irqs++) { if (!port) {
dev_err(gpio->dev, "out of memory\n");
err = -ENOMEM;
goto err_no_port;
}
gpio_ports[num_irqs].irq = snprintf(port->name, 8, "gpio%d", portno);
platform_get_irq_byname(pdev, port->number = portno;
gpio_ports[num_irqs].name); port->gpio = gpio;
err = request_irq(gpio_ports[num_irqs].irq, port->irq = platform_get_irq_byname(pdev,
gpio_irq_handler, IRQF_DISABLED, port->name);
gpio_ports[num_irqs].name,
&gpio_ports[num_irqs]); dev_dbg(gpio->dev, "register IRQ %d for %s\n", port->irq,
if (err) { port->name);
dev_err(gpiodev, "cannot allocate IRQ for %s!\n",
gpio_ports[num_irqs].name); irq_set_chained_handler(port->irq, u300_gpio_irq_handler);
goto err_no_irq; 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);
} }
/* Turns off PortX_irq_force */ dev_dbg(gpio->dev, "initialized %d GPIO ports\n", portno);
writel(0x0, virtbase + U300_GPIO_PXIFR +
num_irqs * U300_GPIO_PORTX_SPACING); 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; return 0;
err_no_irq: err_no_chip:
for (i = 0; i < num_irqs; i++) err_no_port:
free_irq(gpio_ports[i].irq, &gpio_ports[i]); u300_gpio_free_ports(gpio);
iounmap(virtbase); err_unknown_variant:
err_no_ioremap: iounmap(gpio->base);
release_mem_region(memres->start, resource_size(memres)); err_no_ioremap:
err_no_ioregion: release_mem_region(gpio->memres->start, resource_size(gpio->memres));
err_no_resource: err_no_ioregion:
clk_disable(clk); err_no_resource:
err_no_clk_enable: clk_disable(gpio->clk);
clk_put(clk); err_no_clk_enable:
err_no_clk: clk_put(gpio->clk);
dev_info(gpiodev, "module ERROR:%d\n", err); err_no_clk:
kfree(gpio);
dev_info(&pdev->dev, "module ERROR:%d\n", err);
return 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 */ /* Turn off the GPIO block */
writel(0x00000000U, virtbase + U300_GPIO_CR); if (plat->variant == U300_GPIO_COH901335)
for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++) writel(0x00000000U, gpio->base + U300_335_CR);
free_irq(gpio_ports[i].irq, &gpio_ports[i]); if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
iounmap(virtbase); plat->variant == U300_GPIO_COH901571_3_BS365)
release_mem_region(memres->start, resource_size(memres)); writel(0x00000000U, gpio->base + U300_571_CR);
clk_disable(clk);
clk_put(clk); 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; return 0;
} }
static struct platform_driver gpio_driver = { static struct platform_driver u300_gpio_driver = {
.driver = { .driver = {
.name = "u300-gpio", .name = "u300-gpio",
}, },
.remove = __exit_p(gpio_remove), .remove = __exit_p(u300_gpio_remove),
}; };
static int __init u300_gpio_init(void) 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) static void __exit u300_gpio_exit(void)
{ {
platform_driver_unregister(&gpio_driver); platform_driver_unregister(&u300_gpio_driver);
} }
arch_initcall(u300_gpio_init); arch_initcall(u300_gpio_init);
module_exit(u300_gpio_exit); module_exit(u300_gpio_exit);
MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
MODULE_DESCRIPTION("ST-Ericsson AB COH 901 335/COH 901 571/3 GPIO driver");
#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_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <mach/hardware.h> /* Pick up IXP2000-specific bits */ #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) static inline int ixp2000_scl_pin(void *data)
{ {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <mach/at91sam9_smc.h> #include <mach/at91sam9_smc.h>
#define DRV_NAME "at91_ide" #define DRV_NAME "at91_ide"
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/keypad.h> #include <plat/keypad.h>
#include <plat/menelaus.h> #include <plat/menelaus.h>
#include <asm/irq.h> #include <asm/irq.h>
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/menelaus.h> #include <plat/menelaus.h>
#define DRIVER_NAME "menelaus" #define DRIVER_NAME "menelaus"
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <plat/board.h> #include <plat/board.h>
#include <plat/mmc.h> #include <plat/mmc.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/dma.h> #include <plat/dma.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <plat/fpga.h> #include <plat/fpga.h>
......
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <mach/gpio-tegra.h>
#include <mach/sdhci.h> #include <mach/sdhci.h>
#include "sdhci-pltfm.h" #include "sdhci-pltfm.h"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/sizes.h> #include <asm/sizes.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/board-ams-delta.h> #include <plat/board-ams-delta.h>
/* /*
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <asm/mach/flash.h> #include <asm/mach/flash.h>
#include <plat/gpmc.h> #include <plat/gpmc.h>
#include <plat/onenand.h> #include <plat/onenand.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/dma.h> #include <plat/dma.h>
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/at91rm9200_emac.h> #include <mach/at91rm9200_emac.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <mach/board.h> #include <mach/board.h>
#include "at91_ether.h" #include "at91_ether.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <mach/vpac270.h> #include <mach/vpac270.h>
#include "soc_common.h" #include "soc_common.h"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <mach/board.h> #include <mach/board.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <mach/cpu.h> #include <mach/cpu.h>
/* SPI register offsets */ /* SPI register offsets */
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#ifdef CONFIG_ARM #ifdef CONFIG_ARM
#include <mach/cpu.h> #include <mach/cpu.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#endif #endif
#define PDC_BUFFER_SIZE 512 #define PDC_BUFFER_SIZE 512
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <mach/platform.h> #include <mach/platform.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64) #define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64)
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/memory.h> #include <mach/memory.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <mach/cputype.h> #include <mach/cputype.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/cpu.h> #include <mach/cpu.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <video/atmel_lcdc.h> #include <video/atmel_lcdc.h>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include "omapfb.h" #include "omapfb.h"
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c/tps65010.h> #include <linux/i2c/tps65010.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include "omapfb.h" #include "omapfb.h"
#define MODULE_NAME "omapfb-lcd_h3" #define MODULE_NAME "omapfb-lcd_h3"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include "omapfb.h" #include "omapfb.h"
#define MODULE_NAME "omapfb-lcd_h3" #define MODULE_NAME "omapfb-lcd_h3"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include "omapfb.h" #include "omapfb.h"
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include <plat/mux.h> #include <plat/mux.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
......
...@@ -29,7 +29,7 @@ GPIO13 - screen blanking ...@@ -29,7 +29,7 @@ GPIO13 - screen blanking
#include <linux/module.h> #include <linux/module.h>
#include <linux/io.h> #include <linux/io.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include "omapfb.h" #include "omapfb.h"
static int palmtt_panel_init(struct lcd_panel *panel, static int palmtt_panel_init(struct lcd_panel *panel,
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <mach/gpio.h> #include <asm/gpio.h>
#include "sdum.h" #include "sdum.h"
#include "fbcommon.h" #include "fbcommon.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册