ARM: OMAP: Move gpio.h to include/linux/platform_data
authorTony Lindgren <tony@atomide.com>
Thu, 30 Aug 2012 22:37:24 +0000 (15:37 -0700)
committerTony Lindgren <tony@atomide.com>
Thu, 13 Sep 2012 01:06:30 +0000 (18:06 -0700)
This way we can remove includes of plat/gpio.h which won't work
with the single zImage support.

Note that we also remove the cpu_class_is_omap2() check
in gpio-omap.c as the drivers should not call it as we need to
make it local to arch/arm/mach-omap2 for single zImage support.

While at it, arrange the related includes in the standard way.

Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-mtd@lists.infradead.org
Cc: alsa-devel@alsa-project.org
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
29 files changed:
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/gpio15xx.c
arch/arm/mach-omap1/gpio16xx.c
arch/arm/mach-omap1/gpio7xx.c
arch/arm/mach-omap1/include/mach/gpio.h
arch/arm/mach-omap1/leds-h2p2-debug.c
arch/arm/mach-omap1/leds.c
arch/arm/mach-omap2/board-am3517evm.c
arch/arm/mach-omap2/board-cm-t35.c
arch/arm/mach-omap2/board-zoom-display.c
arch/arm/mach-omap2/board-zoom-peripherals.c
arch/arm/mach-omap2/gpio.c
arch/arm/mach-omap2/hsmmc.c
arch/arm/mach-omap2/include/mach/gpio.h
arch/arm/mach-omap2/msdi.c
arch/arm/mach-omap2/omap_hwmod_2420_data.c
arch/arm/mach-omap2/omap_hwmod_2430_data.c
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/mach-omap2/pm24xx.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/plat-omap/debug-leds.c
arch/arm/plat-omap/include/plat/gpio.h [deleted file]
drivers/gpio/gpio-omap.c
drivers/mtd/nand/ams-delta.c
include/linux/platform_data/gpio-omap.h [new file with mode: 0644]
sound/soc/omap/sdp3430.c

index c162369..6f192c4 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/export.h>
 #include <linux/omapfb.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <media/soc_camera.h>
 
index 569b687..3b2d907 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/i2c/tps65010.h>
+#include <linux/platform_data/gpio-omap.h>
 #include <linux/platform_data/omap1_bl.h>
 
 #include <asm/mach-types.h>
index ebef15e..98e6f39 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #define OMAP1_MPUIO_VBASE              OMAP1_MPUIO_BASE
 #define OMAP1510_GPIO_BASE             0xFFFCE000
index 2a48cd2..33f4192 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #define OMAP1610_GPIO1_BASE            0xfffbe400
 #define OMAP1610_GPIO2_BASE            0xfffbec00
index acf12b7..958ce9a 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #define OMAP7XX_GPIO1_BASE             0xfffbc000
 #define OMAP7XX_GPIO2_BASE             0xfffbc800
index e737706..ebf86c0 100644 (file)
@@ -1,5 +1,3 @@
 /*
  * arch/arm/mach-omap1/include/mach/gpio.h
  */
-
-#include <plat/gpio.h>
index f6b14a1..7f4bba9 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/sched.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <mach/hardware.h>
 #include <asm/leds.h>
index ae6dd93..7b1a383 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/gpio.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <asm/leds.h>
 #include <asm/mach-types.h>
index 00abda1..029ebdf 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/can/platform/ti_hecc.h>
 #include <linux/davinci_emac.h>
 #include <linux/mmc/host.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <mach/hardware.h>
 #include <mach/am35xx.h>
index ea34109..34cb904 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/input/matrix_keypad.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <linux/i2c/at24.h>
 #include <linux/i2c/twl.h>
index 28187f1..d64f35f 100644 (file)
@@ -18,6 +18,8 @@
 #include <video/omapdss.h>
 #include <mach/board-zoom.h>
 
+#include <plat/cpu.h>
+
 #define LCD_PANEL_RESET_GPIO_PROD      96
 #define LCD_PANEL_RESET_GPIO_PILOT     55
 #define LCD_PANEL_QVGA_GPIO            56
index 00f73b7..ae5d36b 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/regulator/fixed.h>
 #include <linux/wl12xx.h>
 #include <linux/mmc/host.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
index 9ad7d48..7b52bdf 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
index a9675d8..80399d7 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <mach/hardware.h>
+#include <linux/platform_data/gpio-omap.h>
+
 #include <plat/mmc.h>
 #include <plat/omap-pm.h>
 #include <plat/mux.h>
index be4d290..5621cc5 100644 (file)
@@ -1,5 +1,3 @@
 /*
  * arch/arm/mach-omap2/include/mach/gpio.h
  */
-
-#include <plat/gpio.h>
index fb5bc6c..9e57b4a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <linux/kernel.h>
 #include <linux/err.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <plat/omap_hwmod.h>
 #include <plat/omap_device.h>
index 50cfab6..5b49ebf 100644 (file)
@@ -18,7 +18,6 @@
 #include <plat/dma.h>
 #include <plat/serial.h>
 #include <plat/i2c.h>
-#include <plat/gpio.h>
 #include <plat/mcspi.h>
 #include <plat/dmtimer.h>
 #include <plat/l3_2xxx.h>
index 58b5bc1..1fd66f0 100644 (file)
@@ -18,7 +18,6 @@
 #include <plat/dma.h>
 #include <plat/serial.h>
 #include <plat/i2c.h>
-#include <plat/gpio.h>
 #include <plat/mcbsp.h>
 #include <plat/mcspi.h>
 #include <plat/dmtimer.h>
index afad69c..c6416c9 100644 (file)
@@ -10,7 +10,7 @@
  */
 #include <plat/omap_hwmod.h>
 #include <plat/serial.h>
-#include <plat/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
 #include <plat/mcspi.h>
index c9e3820..5820c73 100644 (file)
@@ -15,6 +15,7 @@
  * XXX these should be marked initdata for multi-OMAP kernels
  */
 #include <linux/power/smartreflex.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <plat/omap_hwmod.h>
 #include <mach/irqs.h>
@@ -24,7 +25,6 @@
 #include <plat/l3_3xxx.h>
 #include <plat/l4_3xxx.h>
 #include <plat/i2c.h>
-#include <plat/gpio.h>
 #include <plat/mmc.h>
 #include <plat/mcbsp.h>
 #include <plat/mcspi.h>
index 242aee4..fe987f8 100644 (file)
  */
 
 #include <linux/io.h>
+#include <linux/platform_data/gpio-omap.h>
 #include <linux/power/smartreflex.h>
 
 #include <plat/omap_hwmod.h>
 #include <plat/cpu.h>
 #include <plat/i2c.h>
-#include <plat/gpio.h>
 #include <plat/dma.h>
 #include <plat/mcspi.h>
 #include <plat/mcbsp.h>
index de1caf1..2708a8b 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/irq.h>
 #include <linux/time.h>
 #include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
index 05bd8f0..90480f7 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/platform_data/gpio-omap.h>
+
 #include <trace/events/power.h>
 
 #include <asm/suspend.h>
index 39407cb..195aaae 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/platform_device.h>
 #include <linux/leds.h>
 #include <linux/io.h>
+#include <linux/platform_data/gpio-omap.h>
 
 #include <mach/hardware.h>
 #include <asm/leds.h>
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
deleted file mode 100644 (file)
index 50fb7cc..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * arch/arm/plat-omap/include/mach/gpio.h
- *
- * OMAP GPIO handling defines and functions
- *
- * Copyright (C) 2003-2005 Nokia Corporation
- *
- * Written by Juha Yrjölä <juha.yrjola@nokia.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 __ASM_ARCH_OMAP_GPIO_H
-#define __ASM_ARCH_OMAP_GPIO_H
-
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <mach/irqs.h>
-
-#define OMAP1_MPUIO_BASE                       0xfffb5000
-
-/*
- * These are the omap15xx/16xx offsets. The omap7xx offset are
- * OMAP_MPUIO_ / 2 offsets below.
- */
-#define OMAP_MPUIO_INPUT_LATCH         0x00
-#define OMAP_MPUIO_OUTPUT              0x04
-#define OMAP_MPUIO_IO_CNTL             0x08
-#define OMAP_MPUIO_KBR_LATCH           0x10
-#define OMAP_MPUIO_KBC                 0x14
-#define OMAP_MPUIO_GPIO_EVENT_MODE     0x18
-#define OMAP_MPUIO_GPIO_INT_EDGE       0x1c
-#define OMAP_MPUIO_KBD_INT             0x20
-#define OMAP_MPUIO_GPIO_INT            0x24
-#define OMAP_MPUIO_KBD_MASKIT          0x28
-#define OMAP_MPUIO_GPIO_MASKIT         0x2c
-#define OMAP_MPUIO_GPIO_DEBOUNCING     0x30
-#define OMAP_MPUIO_LATCH               0x34
-
-#define OMAP34XX_NR_GPIOS              6
-
-/*
- * OMAP1510 GPIO registers
- */
-#define OMAP1510_GPIO_DATA_INPUT       0x00
-#define OMAP1510_GPIO_DATA_OUTPUT      0x04
-#define OMAP1510_GPIO_DIR_CONTROL      0x08
-#define OMAP1510_GPIO_INT_CONTROL      0x0c
-#define OMAP1510_GPIO_INT_MASK         0x10
-#define OMAP1510_GPIO_INT_STATUS       0x14
-#define OMAP1510_GPIO_PIN_CONTROL      0x18
-
-#define OMAP1510_IH_GPIO_BASE          64
-
-/*
- * OMAP1610 specific GPIO registers
- */
-#define OMAP1610_GPIO_REVISION         0x0000
-#define OMAP1610_GPIO_SYSCONFIG                0x0010
-#define OMAP1610_GPIO_SYSSTATUS                0x0014
-#define OMAP1610_GPIO_IRQSTATUS1       0x0018
-#define OMAP1610_GPIO_IRQENABLE1       0x001c
-#define OMAP1610_GPIO_WAKEUPENABLE     0x0028
-#define OMAP1610_GPIO_DATAIN           0x002c
-#define OMAP1610_GPIO_DATAOUT          0x0030
-#define OMAP1610_GPIO_DIRECTION                0x0034
-#define OMAP1610_GPIO_EDGE_CTRL1       0x0038
-#define OMAP1610_GPIO_EDGE_CTRL2       0x003c
-#define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c
-#define OMAP1610_GPIO_CLEAR_WAKEUPENA  0x00a8
-#define OMAP1610_GPIO_CLEAR_DATAOUT    0x00b0
-#define OMAP1610_GPIO_SET_IRQENABLE1   0x00dc
-#define OMAP1610_GPIO_SET_WAKEUPENA    0x00e8
-#define OMAP1610_GPIO_SET_DATAOUT      0x00f0
-
-/*
- * OMAP7XX specific GPIO registers
- */
-#define OMAP7XX_GPIO_DATA_INPUT                0x00
-#define OMAP7XX_GPIO_DATA_OUTPUT       0x04
-#define OMAP7XX_GPIO_DIR_CONTROL       0x08
-#define OMAP7XX_GPIO_INT_CONTROL       0x0c
-#define OMAP7XX_GPIO_INT_MASK          0x10
-#define OMAP7XX_GPIO_INT_STATUS                0x14
-
-/*
- * omap2+ specific GPIO registers
- */
-#define OMAP24XX_GPIO_REVISION         0x0000
-#define OMAP24XX_GPIO_IRQSTATUS1       0x0018
-#define OMAP24XX_GPIO_IRQSTATUS2       0x0028
-#define OMAP24XX_GPIO_IRQENABLE2       0x002c
-#define OMAP24XX_GPIO_IRQENABLE1       0x001c
-#define OMAP24XX_GPIO_WAKE_EN          0x0020
-#define OMAP24XX_GPIO_CTRL             0x0030
-#define OMAP24XX_GPIO_OE               0x0034
-#define OMAP24XX_GPIO_DATAIN           0x0038
-#define OMAP24XX_GPIO_DATAOUT          0x003c
-#define OMAP24XX_GPIO_LEVELDETECT0     0x0040
-#define OMAP24XX_GPIO_LEVELDETECT1     0x0044
-#define OMAP24XX_GPIO_RISINGDETECT     0x0048
-#define OMAP24XX_GPIO_FALLINGDETECT    0x004c
-#define OMAP24XX_GPIO_DEBOUNCE_EN      0x0050
-#define OMAP24XX_GPIO_DEBOUNCE_VAL     0x0054
-#define OMAP24XX_GPIO_CLEARIRQENABLE1  0x0060
-#define OMAP24XX_GPIO_SETIRQENABLE1    0x0064
-#define OMAP24XX_GPIO_CLEARWKUENA      0x0080
-#define OMAP24XX_GPIO_SETWKUENA                0x0084
-#define OMAP24XX_GPIO_CLEARDATAOUT     0x0090
-#define OMAP24XX_GPIO_SETDATAOUT       0x0094
-
-#define OMAP4_GPIO_REVISION            0x0000
-#define OMAP4_GPIO_EOI                 0x0020
-#define OMAP4_GPIO_IRQSTATUSRAW0       0x0024
-#define OMAP4_GPIO_IRQSTATUSRAW1       0x0028
-#define OMAP4_GPIO_IRQSTATUS0          0x002c
-#define OMAP4_GPIO_IRQSTATUS1          0x0030
-#define OMAP4_GPIO_IRQSTATUSSET0       0x0034
-#define OMAP4_GPIO_IRQSTATUSSET1       0x0038
-#define OMAP4_GPIO_IRQSTATUSCLR0       0x003c
-#define OMAP4_GPIO_IRQSTATUSCLR1       0x0040
-#define OMAP4_GPIO_IRQWAKEN0           0x0044
-#define OMAP4_GPIO_IRQWAKEN1           0x0048
-#define OMAP4_GPIO_IRQENABLE1          0x011c
-#define OMAP4_GPIO_WAKE_EN             0x0120
-#define OMAP4_GPIO_IRQSTATUS2          0x0128
-#define OMAP4_GPIO_IRQENABLE2          0x012c
-#define OMAP4_GPIO_CTRL                        0x0130
-#define OMAP4_GPIO_OE                  0x0134
-#define OMAP4_GPIO_DATAIN              0x0138
-#define OMAP4_GPIO_DATAOUT             0x013c
-#define OMAP4_GPIO_LEVELDETECT0                0x0140
-#define OMAP4_GPIO_LEVELDETECT1                0x0144
-#define OMAP4_GPIO_RISINGDETECT                0x0148
-#define OMAP4_GPIO_FALLINGDETECT       0x014c
-#define OMAP4_GPIO_DEBOUNCENABLE       0x0150
-#define OMAP4_GPIO_DEBOUNCINGTIME      0x0154
-#define OMAP4_GPIO_CLEARIRQENABLE1     0x0160
-#define OMAP4_GPIO_SETIRQENABLE1       0x0164
-#define OMAP4_GPIO_CLEARWKUENA         0x0180
-#define OMAP4_GPIO_SETWKUENA           0x0184
-#define OMAP4_GPIO_CLEARDATAOUT                0x0190
-#define OMAP4_GPIO_SETDATAOUT          0x0194
-
-#define OMAP_MPUIO(nr)         (OMAP_MAX_GPIO_LINES + (nr))
-#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
-
-struct omap_gpio_dev_attr {
-       int bank_width;         /* GPIO bank width */
-       bool dbck_flag;         /* dbck required or not - True for OMAP3&4 */
-};
-
-struct omap_gpio_reg_offs {
-       u16 revision;
-       u16 direction;
-       u16 datain;
-       u16 dataout;
-       u16 set_dataout;
-       u16 clr_dataout;
-       u16 irqstatus;
-       u16 irqstatus2;
-       u16 irqstatus_raw0;
-       u16 irqstatus_raw1;
-       u16 irqenable;
-       u16 irqenable2;
-       u16 set_irqenable;
-       u16 clr_irqenable;
-       u16 debounce;
-       u16 debounce_en;
-       u16 ctrl;
-       u16 wkup_en;
-       u16 leveldetect0;
-       u16 leveldetect1;
-       u16 risingdetect;
-       u16 fallingdetect;
-       u16 irqctrl;
-       u16 edgectrl1;
-       u16 edgectrl2;
-       u16 pinctrl;
-
-       bool irqenable_inv;
-};
-
-struct omap_gpio_platform_data {
-       int bank_type;
-       int bank_width;         /* GPIO bank width */
-       int bank_stride;        /* Only needed for omap1 MPUIO */
-       bool dbck_flag;         /* dbck required or not - True for OMAP3&4 */
-       bool loses_context;     /* whether the bank would ever lose context */
-       bool is_mpuio;          /* whether the bank is of type MPUIO */
-       u32 non_wakeup_gpios;
-
-       struct omap_gpio_reg_offs *regs;
-
-       /* Return context loss count due to PM states changing */
-       int (*get_context_loss_count)(struct device *dev);
-};
-
-extern void omap2_gpio_prepare_for_idle(int off_mode);
-extern void omap2_gpio_resume_after_idle(void);
-extern void omap_set_gpio_debounce(int gpio, int enable);
-extern void omap_set_gpio_debounce_time(int gpio, int enable);
-/*-------------------------------------------------------------------------*/
-
-/*
- * Wrappers for "new style" GPIO calls, using the new infrastructure
- * which lets us plug in FPGA, I2C, and other implementations.
- *
- * The original OMAP-specific calls should eventually be removed.
- */
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#endif
index e6efd77..64fbce3 100644 (file)
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/irqdomain.h>
+#include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
 
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <mach/irqs.h>
-#include <asm/gpio.h>
 #include <asm/mach/irq.h>
 
 #define OFF_MODE       1
@@ -385,13 +383,16 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio,
 static int gpio_irq_type(struct irq_data *d, unsigned type)
 {
        struct gpio_bank *bank = irq_data_get_irq_chip_data(d);
-       unsigned gpio;
+       unsigned gpio = 0;
        int retval;
        unsigned long flags;
 
-       if (!cpu_class_is_omap2() && d->irq > IH_MPUIO_BASE)
+#ifdef CONFIG_ARCH_OMAP1
+       if (d->irq > IH_MPUIO_BASE)
                gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE);
-       else
+#endif
+
+       if (!gpio)
                gpio = irq_to_gpio(bank, d->irq);
 
        if (type & ~IRQ_TYPE_SENSE_MASK)
index 861ca8f..78a524b 100644 (file)
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/gpio.h>
+#include <linux/platform_data/gpio-omap.h>
+
 #include <asm/io.h>
-#include <mach/hardware.h>
 #include <asm/sizes.h>
-#include <linux/gpio.h>
+
 #include <plat/board-ams-delta.h>
 
+#include <mach/hardware.h>
+
 /*
  * MTD structure for E3 (Delta)
  */
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
new file mode 100644 (file)
index 0000000..e8741c2
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * OMAP GPIO handling defines and functions
+ *
+ * Copyright (C) 2003-2005 Nokia Corporation
+ *
+ * Written by Juha Yrjölä <juha.yrjola@nokia.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 __ASM_ARCH_OMAP_GPIO_H
+#define __ASM_ARCH_OMAP_GPIO_H
+
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <mach/irqs.h>
+
+#define OMAP1_MPUIO_BASE                       0xfffb5000
+
+/*
+ * These are the omap15xx/16xx offsets. The omap7xx offset are
+ * OMAP_MPUIO_ / 2 offsets below.
+ */
+#define OMAP_MPUIO_INPUT_LATCH         0x00
+#define OMAP_MPUIO_OUTPUT              0x04
+#define OMAP_MPUIO_IO_CNTL             0x08
+#define OMAP_MPUIO_KBR_LATCH           0x10
+#define OMAP_MPUIO_KBC                 0x14
+#define OMAP_MPUIO_GPIO_EVENT_MODE     0x18
+#define OMAP_MPUIO_GPIO_INT_EDGE       0x1c
+#define OMAP_MPUIO_KBD_INT             0x20
+#define OMAP_MPUIO_GPIO_INT            0x24
+#define OMAP_MPUIO_KBD_MASKIT          0x28
+#define OMAP_MPUIO_GPIO_MASKIT         0x2c
+#define OMAP_MPUIO_GPIO_DEBOUNCING     0x30
+#define OMAP_MPUIO_LATCH               0x34
+
+#define OMAP34XX_NR_GPIOS              6
+
+/*
+ * OMAP1510 GPIO registers
+ */
+#define OMAP1510_GPIO_DATA_INPUT       0x00
+#define OMAP1510_GPIO_DATA_OUTPUT      0x04
+#define OMAP1510_GPIO_DIR_CONTROL      0x08
+#define OMAP1510_GPIO_INT_CONTROL      0x0c
+#define OMAP1510_GPIO_INT_MASK         0x10
+#define OMAP1510_GPIO_INT_STATUS       0x14
+#define OMAP1510_GPIO_PIN_CONTROL      0x18
+
+#define OMAP1510_IH_GPIO_BASE          64
+
+/*
+ * OMAP1610 specific GPIO registers
+ */
+#define OMAP1610_GPIO_REVISION         0x0000
+#define OMAP1610_GPIO_SYSCONFIG                0x0010
+#define OMAP1610_GPIO_SYSSTATUS                0x0014
+#define OMAP1610_GPIO_IRQSTATUS1       0x0018
+#define OMAP1610_GPIO_IRQENABLE1       0x001c
+#define OMAP1610_GPIO_WAKEUPENABLE     0x0028
+#define OMAP1610_GPIO_DATAIN           0x002c
+#define OMAP1610_GPIO_DATAOUT          0x0030
+#define OMAP1610_GPIO_DIRECTION                0x0034
+#define OMAP1610_GPIO_EDGE_CTRL1       0x0038
+#define OMAP1610_GPIO_EDGE_CTRL2       0x003c
+#define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c
+#define OMAP1610_GPIO_CLEAR_WAKEUPENA  0x00a8
+#define OMAP1610_GPIO_CLEAR_DATAOUT    0x00b0
+#define OMAP1610_GPIO_SET_IRQENABLE1   0x00dc
+#define OMAP1610_GPIO_SET_WAKEUPENA    0x00e8
+#define OMAP1610_GPIO_SET_DATAOUT      0x00f0
+
+/*
+ * OMAP7XX specific GPIO registers
+ */
+#define OMAP7XX_GPIO_DATA_INPUT                0x00
+#define OMAP7XX_GPIO_DATA_OUTPUT       0x04
+#define OMAP7XX_GPIO_DIR_CONTROL       0x08
+#define OMAP7XX_GPIO_INT_CONTROL       0x0c
+#define OMAP7XX_GPIO_INT_MASK          0x10
+#define OMAP7XX_GPIO_INT_STATUS                0x14
+
+/*
+ * omap2+ specific GPIO registers
+ */
+#define OMAP24XX_GPIO_REVISION         0x0000
+#define OMAP24XX_GPIO_IRQSTATUS1       0x0018
+#define OMAP24XX_GPIO_IRQSTATUS2       0x0028
+#define OMAP24XX_GPIO_IRQENABLE2       0x002c
+#define OMAP24XX_GPIO_IRQENABLE1       0x001c
+#define OMAP24XX_GPIO_WAKE_EN          0x0020
+#define OMAP24XX_GPIO_CTRL             0x0030
+#define OMAP24XX_GPIO_OE               0x0034
+#define OMAP24XX_GPIO_DATAIN           0x0038
+#define OMAP24XX_GPIO_DATAOUT          0x003c
+#define OMAP24XX_GPIO_LEVELDETECT0     0x0040
+#define OMAP24XX_GPIO_LEVELDETECT1     0x0044
+#define OMAP24XX_GPIO_RISINGDETECT     0x0048
+#define OMAP24XX_GPIO_FALLINGDETECT    0x004c
+#define OMAP24XX_GPIO_DEBOUNCE_EN      0x0050
+#define OMAP24XX_GPIO_DEBOUNCE_VAL     0x0054
+#define OMAP24XX_GPIO_CLEARIRQENABLE1  0x0060
+#define OMAP24XX_GPIO_SETIRQENABLE1    0x0064
+#define OMAP24XX_GPIO_CLEARWKUENA      0x0080
+#define OMAP24XX_GPIO_SETWKUENA                0x0084
+#define OMAP24XX_GPIO_CLEARDATAOUT     0x0090
+#define OMAP24XX_GPIO_SETDATAOUT       0x0094
+
+#define OMAP4_GPIO_REVISION            0x0000
+#define OMAP4_GPIO_EOI                 0x0020
+#define OMAP4_GPIO_IRQSTATUSRAW0       0x0024
+#define OMAP4_GPIO_IRQSTATUSRAW1       0x0028
+#define OMAP4_GPIO_IRQSTATUS0          0x002c
+#define OMAP4_GPIO_IRQSTATUS1          0x0030
+#define OMAP4_GPIO_IRQSTATUSSET0       0x0034
+#define OMAP4_GPIO_IRQSTATUSSET1       0x0038
+#define OMAP4_GPIO_IRQSTATUSCLR0       0x003c
+#define OMAP4_GPIO_IRQSTATUSCLR1       0x0040
+#define OMAP4_GPIO_IRQWAKEN0           0x0044
+#define OMAP4_GPIO_IRQWAKEN1           0x0048
+#define OMAP4_GPIO_IRQENABLE1          0x011c
+#define OMAP4_GPIO_WAKE_EN             0x0120
+#define OMAP4_GPIO_IRQSTATUS2          0x0128
+#define OMAP4_GPIO_IRQENABLE2          0x012c
+#define OMAP4_GPIO_CTRL                        0x0130
+#define OMAP4_GPIO_OE                  0x0134
+#define OMAP4_GPIO_DATAIN              0x0138
+#define OMAP4_GPIO_DATAOUT             0x013c
+#define OMAP4_GPIO_LEVELDETECT0                0x0140
+#define OMAP4_GPIO_LEVELDETECT1                0x0144
+#define OMAP4_GPIO_RISINGDETECT                0x0148
+#define OMAP4_GPIO_FALLINGDETECT       0x014c
+#define OMAP4_GPIO_DEBOUNCENABLE       0x0150
+#define OMAP4_GPIO_DEBOUNCINGTIME      0x0154
+#define OMAP4_GPIO_CLEARIRQENABLE1     0x0160
+#define OMAP4_GPIO_SETIRQENABLE1       0x0164
+#define OMAP4_GPIO_CLEARWKUENA         0x0180
+#define OMAP4_GPIO_SETWKUENA           0x0184
+#define OMAP4_GPIO_CLEARDATAOUT                0x0190
+#define OMAP4_GPIO_SETDATAOUT          0x0194
+
+#define OMAP_MAX_GPIO_LINES            192
+
+#define OMAP_MPUIO(nr)         (OMAP_MAX_GPIO_LINES + (nr))
+#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
+
+struct omap_gpio_dev_attr {
+       int bank_width;         /* GPIO bank width */
+       bool dbck_flag;         /* dbck required or not - True for OMAP3&4 */
+};
+
+struct omap_gpio_reg_offs {
+       u16 revision;
+       u16 direction;
+       u16 datain;
+       u16 dataout;
+       u16 set_dataout;
+       u16 clr_dataout;
+       u16 irqstatus;
+       u16 irqstatus2;
+       u16 irqstatus_raw0;
+       u16 irqstatus_raw1;
+       u16 irqenable;
+       u16 irqenable2;
+       u16 set_irqenable;
+       u16 clr_irqenable;
+       u16 debounce;
+       u16 debounce_en;
+       u16 ctrl;
+       u16 wkup_en;
+       u16 leveldetect0;
+       u16 leveldetect1;
+       u16 risingdetect;
+       u16 fallingdetect;
+       u16 irqctrl;
+       u16 edgectrl1;
+       u16 edgectrl2;
+       u16 pinctrl;
+
+       bool irqenable_inv;
+};
+
+struct omap_gpio_platform_data {
+       int bank_type;
+       int bank_width;         /* GPIO bank width */
+       int bank_stride;        /* Only needed for omap1 MPUIO */
+       bool dbck_flag;         /* dbck required or not - True for OMAP3&4 */
+       bool loses_context;     /* whether the bank would ever lose context */
+       bool is_mpuio;          /* whether the bank is of type MPUIO */
+       u32 non_wakeup_gpios;
+
+       struct omap_gpio_reg_offs *regs;
+
+       /* Return context loss count due to PM states changing */
+       int (*get_context_loss_count)(struct device *dev);
+};
+
+extern void omap2_gpio_prepare_for_idle(int off_mode);
+extern void omap2_gpio_resume_after_idle(void);
+extern void omap_set_gpio_debounce(int gpio, int enable);
+extern void omap_set_gpio_debounce_time(int gpio, int enable);
+
+#endif
index 0e28322..78e1419 100644 (file)
@@ -34,6 +34,7 @@
 #include <mach/hardware.h>
 #include <mach/gpio.h>
 #include <plat/mcbsp.h>
+#include <linux/platform_data/gpio-omap.h>
 
 /* Register descriptions for twl4030 codec part */
 #include <linux/mfd/twl4030-audio.h>