aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-10-07 15:57:31 -0400
committerArnd Bergmann <arnd@arndb.de>2011-10-07 15:57:31 -0400
commit526b264163068f77c5f2409031f5e25caf3900a9 (patch)
tree196e7581f1546e48ba392ff099f369e5c622636b /drivers/gpio
parent4c4cbce68f57555cddb9d77da333bf50875148ce (diff)
parent05d900c9d8ce536c6792efb323c82b1c97b54bf9 (diff)
Merge branch 'imx/cleanup' into imx/devel
This helps resolve the conflicts between the imx cleanups and the new code that has gone into the imx tree. Conflict resolution was originally done by Sascha Hauer. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-mxc.c12
-rw-r--r--drivers/gpio/gpio-mxs.c2
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 4340acae3bd3..b588f8a41e60 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -31,6 +31,8 @@
31#include <linux/of_device.h> 31#include <linux/of_device.h>
32#include <asm-generic/bug.h> 32#include <asm-generic/bug.h>
33 33
34#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
35
34enum mxc_gpio_hwtype { 36enum mxc_gpio_hwtype {
35 IMX1_GPIO, /* runs on i.mx1 */ 37 IMX1_GPIO, /* runs on i.mx1 */
36 IMX21_GPIO, /* runs on i.mx21 and i.mx27 */ 38 IMX21_GPIO, /* runs on i.mx21 and i.mx27 */
@@ -337,6 +339,15 @@ static void __devinit mxc_gpio_get_hw(struct platform_device *pdev)
337 mxc_gpio_hwtype = hwtype; 339 mxc_gpio_hwtype = hwtype;
338} 340}
339 341
342static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
343{
344 struct bgpio_chip *bgc = to_bgpio_chip(gc);
345 struct mxc_gpio_port *port =
346 container_of(bgc, struct mxc_gpio_port, bgc);
347
348 return port->virtual_irq_start + offset;
349}
350
340static int __devinit mxc_gpio_probe(struct platform_device *pdev) 351static int __devinit mxc_gpio_probe(struct platform_device *pdev)
341{ 352{
342 struct device_node *np = pdev->dev.of_node; 353 struct device_node *np = pdev->dev.of_node;
@@ -403,6 +414,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
403 if (err) 414 if (err)
404 goto out_iounmap; 415 goto out_iounmap;
405 416
417 port->bgc.gc.to_irq = mxc_gpio_to_irq;
406 port->bgc.gc.base = pdev->id * 32; 418 port->bgc.gc.base = pdev->id * 32;
407 port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); 419 port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
408 port->bgc.data = port->bgc.read_reg(port->bgc.reg_set); 420 port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index af55a8577c2e..292b50481db9 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -49,6 +49,8 @@
49#define GPIO_INT_LEV_MASK (1 << 0) 49#define GPIO_INT_LEV_MASK (1 << 0)
50#define GPIO_INT_POL_MASK (1 << 1) 50#define GPIO_INT_POL_MASK (1 << 1)
51 51
52#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
53
52struct mxs_gpio_port { 54struct mxs_gpio_port {
53 void __iomem *base; 55 void __iomem *base;
54 int id; 56 int id;