diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-11-29 04:51:07 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-11-29 04:51:07 -0500 |
commit | 0d2cd91bf7b1a7cc1d638296111fcc2bcf5c0bb4 (patch) | |
tree | d2ca69347816c27f9dc352581f5d0fe76811cd49 /drivers/gpio/gpio-mxc.c | |
parent | 3d95fd6ad8d3cf582a70ed65660017114b6e4065 (diff) | |
parent | caca6a03d365883564885f2c1da3e88dcf65d139 (diff) |
Merge commit 'v3.2-rc3' into next
Diffstat (limited to 'drivers/gpio/gpio-mxc.c')
-rw-r--r-- | drivers/gpio/gpio-mxc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 4340acae3bd3..e79147634573 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -29,7 +29,11 @@ | |||
29 | #include <linux/basic_mmio_gpio.h> | 29 | #include <linux/basic_mmio_gpio.h> |
30 | #include <linux/of.h> | 30 | #include <linux/of.h> |
31 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
32 | #include <linux/module.h> | ||
32 | #include <asm-generic/bug.h> | 33 | #include <asm-generic/bug.h> |
34 | #include <asm/mach/irq.h> | ||
35 | |||
36 | #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) | ||
33 | 37 | ||
34 | enum mxc_gpio_hwtype { | 38 | enum mxc_gpio_hwtype { |
35 | IMX1_GPIO, /* runs on i.mx1 */ | 39 | IMX1_GPIO, /* runs on i.mx1 */ |
@@ -232,10 +236,15 @@ static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc) | |||
232 | { | 236 | { |
233 | u32 irq_stat; | 237 | u32 irq_stat; |
234 | struct mxc_gpio_port *port = irq_get_handler_data(irq); | 238 | struct mxc_gpio_port *port = irq_get_handler_data(irq); |
239 | struct irq_chip *chip = irq_get_chip(irq); | ||
240 | |||
241 | chained_irq_enter(chip, desc); | ||
235 | 242 | ||
236 | irq_stat = readl(port->base + GPIO_ISR) & readl(port->base + GPIO_IMR); | 243 | irq_stat = readl(port->base + GPIO_ISR) & readl(port->base + GPIO_IMR); |
237 | 244 | ||
238 | mxc_gpio_irq_handler(port, irq_stat); | 245 | mxc_gpio_irq_handler(port, irq_stat); |
246 | |||
247 | chained_irq_exit(chip, desc); | ||
239 | } | 248 | } |
240 | 249 | ||
241 | /* MX2 has one interrupt *for all* gpio ports */ | 250 | /* MX2 has one interrupt *for all* gpio ports */ |
@@ -337,6 +346,15 @@ static void __devinit mxc_gpio_get_hw(struct platform_device *pdev) | |||
337 | mxc_gpio_hwtype = hwtype; | 346 | mxc_gpio_hwtype = hwtype; |
338 | } | 347 | } |
339 | 348 | ||
349 | static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | ||
350 | { | ||
351 | struct bgpio_chip *bgc = to_bgpio_chip(gc); | ||
352 | struct mxc_gpio_port *port = | ||
353 | container_of(bgc, struct mxc_gpio_port, bgc); | ||
354 | |||
355 | return port->virtual_irq_start + offset; | ||
356 | } | ||
357 | |||
340 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) | 358 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) |
341 | { | 359 | { |
342 | struct device_node *np = pdev->dev.of_node; | 360 | struct device_node *np = pdev->dev.of_node; |
@@ -403,6 +421,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
403 | if (err) | 421 | if (err) |
404 | goto out_iounmap; | 422 | goto out_iounmap; |
405 | 423 | ||
424 | port->bgc.gc.to_irq = mxc_gpio_to_irq; | ||
406 | port->bgc.gc.base = pdev->id * 32; | 425 | port->bgc.gc.base = pdev->id * 32; |
407 | port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); | 426 | port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); |
408 | port->bgc.data = port->bgc.read_reg(port->bgc.reg_set); | 427 | port->bgc.data = port->bgc.read_reg(port->bgc.reg_set); |