Merge tag 'v3.13-rc3' into devel
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 9 Dec 2013 13:04:37 +0000 (14:04 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 9 Dec 2013 13:04:37 +0000 (14:04 +0100)
Linux 3.13-rc3

73 files changed:
Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt [new file with mode: 0644]
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
arch/arm/mach-ks8695/include/mach/gpio.h [deleted file]
arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h [deleted file]
arch/arm/mach-lpc32xx/include/mach/gpio.h [deleted file]
arch/arm/mach-lpc32xx/phy3250.c
arch/arm/mach-mv78xx0/include/mach/gpio.h [deleted file]
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-74x164.c
drivers/gpio/gpio-adnp.c
drivers/gpio/gpio-adp5520.c
drivers/gpio/gpio-adp5588.c
drivers/gpio/gpio-amd8111.c
drivers/gpio/gpio-arizona.c
drivers/gpio/gpio-bcm-kona.c
drivers/gpio/gpio-bt8xx.c
drivers/gpio/gpio-da9052.c
drivers/gpio/gpio-da9055.c
drivers/gpio/gpio-em.c
drivers/gpio/gpio-ich.c
drivers/gpio/gpio-intel-mid.c
drivers/gpio/gpio-kempld.c
drivers/gpio/gpio-ks8695.c
drivers/gpio/gpio-lpc32xx.c
drivers/gpio/gpio-lynxpoint.c
drivers/gpio/gpio-max730x.c
drivers/gpio/gpio-max732x.c
drivers/gpio/gpio-mc33880.c
drivers/gpio/gpio-mc9s08dz60.c
drivers/gpio/gpio-mcp23s08.c
drivers/gpio/gpio-ml-ioh.c
drivers/gpio/gpio-moxart.c [new file with mode: 0644]
drivers/gpio/gpio-msic.c
drivers/gpio/gpio-mvebu.c
drivers/gpio/gpio-octeon.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-palmas.c
drivers/gpio/gpio-pca953x.c
drivers/gpio/gpio-pcf857x.c
drivers/gpio/gpio-pch.c
drivers/gpio/gpio-rc5t583.c
drivers/gpio/gpio-rcar.c
drivers/gpio/gpio-sodaville.c
drivers/gpio/gpio-sta2x11.c
drivers/gpio/gpio-stmpe.c
drivers/gpio/gpio-sx150x.c
drivers/gpio/gpio-tb10x.c
drivers/gpio/gpio-tc3589x.c
drivers/gpio/gpio-timberdale.c
drivers/gpio/gpio-tnetv107x.c
drivers/gpio/gpio-tps6586x.c
drivers/gpio/gpio-tps65910.c
drivers/gpio/gpio-tps65912.c
drivers/gpio/gpio-twl4030.c
drivers/gpio/gpio-twl6040.c
drivers/gpio/gpio-ucb1400.c
drivers/gpio/gpio-viperboard.c
drivers/gpio/gpio-vx855.c
drivers/gpio/gpio-wm831x.c
drivers/gpio/gpio-wm8350.c
drivers/gpio/gpio-wm8994.c
drivers/gpio/gpiolib.c
drivers/pinctrl/pinctrl-as3722.c
drivers/pinctrl/pinctrl-at91.c
drivers/pinctrl/pinctrl-baytrail.c
drivers/pinctrl/pinctrl-bcm2835.c
drivers/pinctrl/pinctrl-nomadik.c
drivers/pinctrl/pinctrl-sunxi.c
drivers/pinctrl/vt8500/pinctrl-wmt.c
include/linux/gpio.h
include/linux/gpio/driver.h
include/linux/platform_data/gpio-lpc32xx.h [new file with mode: 0644]

diff --git a/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt b/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt
new file mode 100644 (file)
index 0000000..f8e8f18
--- /dev/null
@@ -0,0 +1,19 @@
+MOXA ART GPIO Controller
+
+Required properties:
+
+- #gpio-cells : Should be 2, The first cell is the pin number,
+               the second cell is used to specify polarity:
+                       0 = active high
+                       1 = active low
+- compatible : Must be "moxa,moxart-gpio"
+- reg : Should contain registers location and length
+
+Example:
+
+       gpio: gpio@98700000 {
+               gpio-controller;
+               #gpio-cells = <2>;
+               compatible = "moxa,moxart-gpio";
+               reg =   <0x98700000 0xC>;
+       };
index 8655df9440d506986225dad0594d045054a96728..f61cef74a2124ccdbd222802a4f340e88b1f6ef3 100644 (file)
@@ -2,10 +2,11 @@
 
 Required Properties:
 
-  - compatible: should be one of the following.
+  - compatible: should contain one of the following.
     - "renesas,gpio-r8a7778": for R8A7778 (R-Mobile M1) compatible GPIO controller.
     - "renesas,gpio-r8a7779": for R8A7779 (R-Car H1) compatible GPIO controller.
     - "renesas,gpio-r8a7790": for R8A7790 (R-Car H2) compatible GPIO controller.
+    - "renesas,gpio-r8a7791": for R8A7791 (R-Car M2) compatible GPIO controller.
     - "renesas,gpio-rcar": for generic R-Car GPIO controller.
 
   - reg: Base address and length of each memory resource used by the GPIO
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
deleted file mode 100644 (file)
index f5fda36..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * arch/arm/mach-ks8695/include/mach/gpio.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 __ASM_ARCH_GPIO_H_
-#define __ASM_ARCH_GPIO_H_
-
-/*
- * Map IRQ number to GPIO line.
- */
-extern int irq_to_gpio(unsigned int irq);
-
-#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
deleted file mode 100644 (file)
index a544e96..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 29
-#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 */
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio.h b/arch/arm/mach-lpc32xx/include/mach/gpio.h
deleted file mode 100644 (file)
index 0052e7a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __MACH_GPIO_H
-#define __MACH_GPIO_H
-
-#include "gpio-lpc32xx.h"
-
-#endif /* __MACH_GPIO_H */
index e54f87ec2e4adca1913893e05665030c824bf40b..34932e0e31fad10686ad3077b68a64003dd6e9a9 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/clk.h>
 #include <linux/mtd/lpc32xx_slc.h>
 #include <linux/mtd/lpc32xx_mlc.h>
+#include <linux/platform_data/gpio-lpc32xx.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -44,7 +45,6 @@
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <mach/board.h>
-#include <mach/gpio-lpc32xx.h>
 #include "common.h"
 
 /*
diff --git a/arch/arm/mach-mv78xx0/include/mach/gpio.h b/arch/arm/mach-mv78xx0/include/mach/gpio.h
deleted file mode 100644 (file)
index 77e1b84..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * arch/asm-arm/mach-mv78xx0/include/mach/gpio.h
- *
- * 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.
- */
-
-#include <plat/gpio.h>
index 0f0444475bf065e9bc90e9d72ad26fac284ec9f9..ae3682d25a3c1d0303e895a2808c686a140e48b0 100644 (file)
@@ -156,6 +156,13 @@ config GPIO_F7188X
          To compile this driver as a module, choose M here: the module will
          be called f7188x-gpio.
 
+config GPIO_MOXART
+       bool "MOXART GPIO support"
+       depends on ARCH_MOXART
+       help
+         Select this option to enable GPIO driver for
+         MOXA ART SoC devices.
+
 config GPIO_MPC5200
        def_bool y
        depends on PPC_MPC52xx
@@ -353,7 +360,7 @@ config GPIO_GE_FPGA
          board computers.
 
 config GPIO_LYNXPOINT
-       bool "Intel Lynxpoint GPIO support"
+       tristate "Intel Lynxpoint GPIO support"
        depends on ACPI && X86
        select IRQ_DOMAIN
        help
index 7971e36b8b1200d354254fb877a0b772a6d28361..ee95154cb1d24112cbb8d660c22ef1ed8c76244c 100644 (file)
@@ -46,6 +46,7 @@ obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o
 obj-$(CONFIG_GPIO_MCP23S08)    += gpio-mcp23s08.o
 obj-$(CONFIG_GPIO_ML_IOH)      += gpio-ml-ioh.o
 obj-$(CONFIG_GPIO_MM_LANTIQ)   += gpio-mm-lantiq.o
+obj-$(CONFIG_GPIO_MOXART)      += gpio-moxart.o
 obj-$(CONFIG_GPIO_MPC5200)     += gpio-mpc5200.o
 obj-$(CONFIG_GPIO_MPC8XXX)     += gpio-mpc8xxx.o
 obj-$(CONFIG_GPIO_MSIC)                += gpio-msic.o
index 1e04bf91328d5895a65799a85b6b874a09710233..ddb831232407b8315cf73d030e60bec6f23e6ac9 100644 (file)
@@ -159,7 +159,7 @@ static int gen_74x164_probe(struct spi_device *spi)
                goto exit_destroy;
        }
 
-       chip->gpio_chip.can_sleep = 1;
+       chip->gpio_chip.can_sleep = true;
        chip->gpio_chip.dev = &spi->dev;
        chip->gpio_chip.owner = THIS_MODULE;
 
index b204033acaebb4e3fe8489c487a95a5406343f9b..6fc6206b38bd1f9ef8bc4e2a613740804a49ba78 100644 (file)
@@ -260,7 +260,7 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios)
        chip->direction_output = adnp_gpio_direction_output;
        chip->get = adnp_gpio_get;
        chip->set = adnp_gpio_set;
-       chip->can_sleep = 1;
+       chip->can_sleep = true;
 
        if (IS_ENABLED(CONFIG_DEBUG_FS))
                chip->dbg_show = adnp_gpio_dbg_show;
@@ -408,6 +408,27 @@ static void adnp_irq_bus_unlock(struct irq_data *data)
        mutex_unlock(&adnp->irq_lock);
 }
 
+static unsigned int adnp_irq_startup(struct irq_data *data)
+{
+       struct adnp *adnp = irq_data_get_irq_chip_data(data);
+
+       if (gpio_lock_as_irq(&adnp->gpio, data->hwirq))
+               dev_err(adnp->gpio.dev,
+                       "unable to lock HW IRQ %lu for IRQ\n",
+                       data->hwirq);
+       /* Satisfy the .enable semantics by unmasking the line */
+       adnp_irq_unmask(data);
+       return 0;
+}
+
+static void adnp_irq_shutdown(struct irq_data *data)
+{
+       struct adnp *adnp = irq_data_get_irq_chip_data(data);
+
+       adnp_irq_mask(data);
+       gpio_unlock_as_irq(&adnp->gpio, data->hwirq);
+}
+
 static struct irq_chip adnp_irq_chip = {
        .name = "gpio-adnp",
        .irq_mask = adnp_irq_mask,
@@ -415,6 +436,8 @@ static struct irq_chip adnp_irq_chip = {
        .irq_set_type = adnp_irq_set_type,
        .irq_bus_lock = adnp_irq_bus_lock,
        .irq_bus_sync_unlock = adnp_irq_bus_unlock,
+       .irq_startup = adnp_irq_startup,
+       .irq_shutdown = adnp_irq_shutdown,
 };
 
 static int adnp_irq_map(struct irq_domain *domain, unsigned int irq,
index 084337d5514d8d1c373413d4c66d1ec1aa317163..613265944e2e3966f57aa21447cd2093422d9ef5 100644 (file)
@@ -127,7 +127,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
        gc->direction_output = adp5520_gpio_direction_output;
        gc->get = adp5520_gpio_get_value;
        gc->set = adp5520_gpio_set_value;
-       gc->can_sleep = 1;
+       gc->can_sleep = true;
 
        gc->base = pdata->gpio_start;
        gc->ngpio = gpios;
index 90fc4c99c024ee39605381c247236644e4c927b4..3f190e68f973bfd551e47bb07999137d33569fdf 100644 (file)
@@ -380,7 +380,7 @@ static int adp5588_gpio_probe(struct i2c_client *client,
        gc->direction_output = adp5588_gpio_direction_output;
        gc->get = adp5588_gpio_get_value;
        gc->set = adp5588_gpio_set_value;
-       gc->can_sleep = 1;
+       gc->can_sleep = true;
 
        gc->base = pdata->gpio_start;
        gc->ngpio = ADP5588_MAXGPIO;
index 710fafcdd1b1c26da908e00ad3ee8c8a3f8629a3..94e9992f890494a8342a618747cbe540bc448233 100644 (file)
@@ -60,7 +60,7 @@
  * register a pci_driver, because someone else might one day
  * want to register another driver on the same PCI id.
  */
-static DEFINE_PCI_DEVICE_TABLE(pci_tbl) = {
+static const struct pci_device_id pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS), 0 },
        { 0, }, /* terminate list */
 };
index dceb5dcf9d16d21da3ac2e022f4b893731cd663c..29bdff558981306c4f9c78419a5bafa723536900 100644 (file)
@@ -91,7 +91,7 @@ static struct gpio_chip template_chip = {
        .get                    = arizona_gpio_get,
        .direction_output       = arizona_gpio_direction_out,
        .set                    = arizona_gpio_set,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 static int arizona_gpio_probe(struct platform_device *pdev)
index 54c18c220a60575d0ebc63f952937d816132f89c..233d088ac59fd69e389c8b759fab75bb5af231eb 100644 (file)
@@ -449,12 +449,34 @@ static void bcm_kona_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
        chained_irq_exit(chip, desc);
 }
 
+static unsigned int bcm_kona_gpio_irq_startup(struct irq_data *d)
+{
+       struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);
+
+       if (gpio_lock_as_irq(&kona_gpio->gpio_chip, d->hwirq))
+               dev_err(kona_gpio->gpio_chip.dev,
+                       "unable to lock HW IRQ %lu for IRQ\n",
+                       d->hwirq);
+       bcm_kona_gpio_irq_unmask(d);
+       return 0;
+}
+
+static void bcm_kona_gpio_irq_shutdown(struct irq_data *d)
+{
+       struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);
+
+       bcm_kona_gpio_irq_mask(d);
+       gpio_unlock_as_irq(&kona_gpio->gpio_chip, d->hwirq);
+}
+
 static struct irq_chip bcm_gpio_irq_chip = {
        .name = "bcm-kona-gpio",
        .irq_ack = bcm_kona_gpio_irq_ack,
        .irq_mask = bcm_kona_gpio_irq_mask,
        .irq_unmask = bcm_kona_gpio_irq_unmask,
        .irq_set_type = bcm_kona_gpio_irq_set_type,
+       .irq_startup = bcm_kona_gpio_irq_startup,
+       .irq_shutdown = bcm_kona_gpio_irq_shutdown,
 };
 
 static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
index 9dfe36fd8baff2a56f80db19e369b6716e03a3ef..ecb3ca2d1d102ab517c23be30b1d801874d7143d 100644 (file)
@@ -169,7 +169,7 @@ static void bt8xxgpio_gpio_setup(struct bt8xxgpio *bg)
        c->dbg_show = NULL;
        c->base = modparam_gpiobase;
        c->ngpio = BT8XXGPIO_NR_GPIOS;
-       c->can_sleep = 0;
+       c->can_sleep = false;
 }
 
 static int bt8xxgpio_probe(struct pci_dev *dev,
@@ -308,7 +308,7 @@ static int bt8xxgpio_resume(struct pci_dev *pdev)
 #define bt8xxgpio_resume NULL
 #endif /* CONFIG_PM */
 
-static DEFINE_PCI_DEVICE_TABLE(bt8xxgpio_pci_tbl) = {
+static const struct pci_device_id bt8xxgpio_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT849) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT878) },
index 9b77dc05d4ada6c6744040cf2cdfb5d76c3188a4..416cdf786b05fe4c73ff8f83e83f01676c2e1450 100644 (file)
@@ -200,7 +200,7 @@ static struct gpio_chip reference_gp = {
        .direction_input = da9052_gpio_direction_input,
        .direction_output = da9052_gpio_direction_output,
        .to_irq = da9052_gpio_to_irq,
-       .can_sleep = 1,
+       .can_sleep = true,
        .ngpio = 16,
        .base = -1,
 };
index 7ef0820032bd157a7adadc368cc521d0a7ff57aa..f992997bc30125c64b0731367c56fd4742efe17c 100644 (file)
@@ -134,7 +134,7 @@ static struct gpio_chip reference_gp = {
        .direction_input = da9055_gpio_direction_input,
        .direction_output = da9055_gpio_direction_output,
        .to_irq = da9055_gpio_to_irq,
-       .can_sleep = 1,
+       .can_sleep = true,
        .ngpio = 3,
        .base = -1,
 };
index ec190361bf2e551352a265fd2bcb576e71bd06f1..1e98a9873967fe43eb0b9e5eb88bdd8a0b760364 100644 (file)
@@ -99,6 +99,27 @@ static void em_gio_irq_enable(struct irq_data *d)
        em_gio_write(p, GIO_IEN, BIT(irqd_to_hwirq(d)));
 }
 
+static unsigned int em_gio_irq_startup(struct irq_data *d)
+{
+       struct em_gio_priv *p = irq_data_get_irq_chip_data(d);
+
+       if (gpio_lock_as_irq(&p->gpio_chip, irqd_to_hwirq(d)))
+               dev_err(p->gpio_chip.dev,
+                       "unable to lock HW IRQ %lu for IRQ\n",
+                       irqd_to_hwirq(d));
+       em_gio_irq_enable(d);
+       return 0;
+}
+
+static void em_gio_irq_shutdown(struct irq_data *d)
+{
+       struct em_gio_priv *p = irq_data_get_irq_chip_data(d);
+
+       em_gio_irq_disable(d);
+       gpio_unlock_as_irq(&p->gpio_chip, irqd_to_hwirq(d));
+}
+
+
 #define GIO_ASYNC(x) (x + 8)
 
 static unsigned char em_gio_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
@@ -328,6 +349,7 @@ static int em_gio_probe(struct platform_device *pdev)
        gpio_chip->request = em_gio_request;
        gpio_chip->free = em_gio_free;
        gpio_chip->label = name;
+       gpio_chip->dev = &pdev->dev;
        gpio_chip->owner = THIS_MODULE;
        gpio_chip->base = pdata->gpio_base;
        gpio_chip->ngpio = pdata->number_of_pins;
@@ -336,10 +358,10 @@ static int em_gio_probe(struct platform_device *pdev)
        irq_chip->name = name;
        irq_chip->irq_mask = em_gio_irq_disable;
        irq_chip->irq_unmask = em_gio_irq_enable;
-       irq_chip->irq_enable = em_gio_irq_enable;
-       irq_chip->irq_disable = em_gio_irq_disable;
        irq_chip->irq_set_type = em_gio_irq_set_type;
-       irq_chip->flags = IRQCHIP_SKIP_SET_WAKE;
+       irq_chip->irq_startup = em_gio_irq_startup;
+       irq_chip->irq_shutdown = em_gio_irq_shutdown;
+       irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND;
 
        p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
                                              pdata->number_of_pins,
index 814addb62d2cce372ac4a9df25733d6f3f52284e..f5bf3c38bca666fbad9a5a4ac9b52585286a9d37 100644 (file)
@@ -252,7 +252,7 @@ static void ichx_gpiolib_setup(struct gpio_chip *chip)
        chip->direction_output = ichx_gpio_direction_output;
        chip->base = modparam_gpiobase;
        chip->ngpio = ichx_priv.desc->ngpio;
-       chip->can_sleep = 0;
+       chip->can_sleep = false;
        chip->dbg_show = NULL;
 }
 
index be803af658acf2e95f4782ff40ae2a560ec03f11..d1b50ef5fab86928346ac741e7cbfc1c40d64ea0 100644 (file)
@@ -235,11 +235,33 @@ static void intel_mid_irq_mask(struct irq_data *d)
 {
 }
 
+static unsigned int intel_mid_irq_startup(struct irq_data *d)
+{
+       struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d);
+
+       if (gpio_lock_as_irq(&priv->chip, irqd_to_hwirq(d)))
+               dev_err(priv->chip.dev,
+                       "unable to lock HW IRQ %lu for IRQ\n",
+                       irqd_to_hwirq(d));
+       intel_mid_irq_unmask(d);
+       return 0;
+}
+
+static void intel_mid_irq_shutdown(struct irq_data *d)
+{
+       struct intel_mid_gpio *priv = irq_data_get_irq_chip_data(d);
+
+       intel_mid_irq_mask(d);
+       gpio_unlock_as_irq(&priv->chip, irqd_to_hwirq(d));
+}
+
 static struct irq_chip intel_mid_irqchip = {
        .name           = "INTEL_MID-GPIO",
        .irq_mask       = intel_mid_irq_mask,
        .irq_unmask     = intel_mid_irq_unmask,
        .irq_set_type   = intel_mid_irq_type,
+       .irq_startup    = intel_mid_irq_startup,
+       .irq_shutdown   = intel_mid_irq_shutdown,
 };
 
 static const struct intel_mid_gpio_ddata gpio_lincroft = {
@@ -275,7 +297,7 @@ static const struct intel_mid_gpio_ddata gpio_tangier = {
        .chip_irq_type = INTEL_MID_IRQ_TYPE_EDGE,
 };
 
-static DEFINE_PCI_DEVICE_TABLE(intel_gpio_ids) = {
+static const struct pci_device_id intel_gpio_ids[] = {
        {
                /* Lincroft */
                PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f),
@@ -358,8 +380,7 @@ static int intel_gpio_irq_map(struct irq_domain *d, unsigned int irq,
 {
        struct intel_mid_gpio *priv = d->host_data;
 
-       irq_set_chip_and_handler_name(irq, &intel_mid_irqchip,
-                                     handle_simple_irq, "demux");
+       irq_set_chip_and_handler(irq, &intel_mid_irqchip, handle_simple_irq);
        irq_set_chip_data(irq, priv);
        irq_set_irq_type(irq, IRQ_TYPE_NONE);
 
@@ -418,6 +439,7 @@ static int intel_gpio_probe(struct pci_dev *pdev,
 
        priv->reg_base = pcim_iomap_table(pdev)[0];
        priv->chip.label = dev_name(&pdev->dev);
+       priv->chip.dev = &pdev->dev;
        priv->chip.request = intel_gpio_request;
        priv->chip.direction_input = intel_gpio_direction_input;
        priv->chip.direction_output = intel_gpio_direction_output;
@@ -426,7 +448,7 @@ static int intel_gpio_probe(struct pci_dev *pdev,
        priv->chip.to_irq = intel_gpio_to_irq;
        priv->chip.base = gpio_base;
        priv->chip.ngpio = ddata->ngpio;
-       priv->chip.can_sleep = 0;
+       priv->chip.can_sleep = false;
        priv->pdev = pdev;
 
        spin_lock_init(&priv->lock);
index efdc3924d7dfe425c421edbdfc8825f1a8715ced..c6d88173f5a2ab53f267987b0323550c1dc7bd33 100644 (file)
@@ -167,7 +167,7 @@ static int kempld_gpio_probe(struct platform_device *pdev)
        chip->label = "gpio-kempld";
        chip->owner = THIS_MODULE;
        chip->dev = dev;
-       chip->can_sleep = 1;
+       chip->can_sleep = true;
        if (pdata && pdata->gpio_base)
                chip->base = pdata->gpio_base;
        else
index a3ac66ea364b8cce3f624b9000d4e5c53e906c1b..464a83de0d6a48fea14125fc81134e6d1bda21f5 100644 (file)
@@ -228,7 +228,7 @@ static struct gpio_chip ks8695_gpio_chip = {
        .to_irq                 = ks8695_gpio_to_irq,
        .base                   = 0,
        .ngpio                  = 16,
-       .can_sleep              = 0,
+       .can_sleep              = false,
 };
 
 /* Register the GPIOs */
index 2d5555decf0cfa6ddfff1c5afcb9c6b80d314ced..225344d6640478e230ff04ec15825507f5f59366 100644 (file)
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/platform_data/gpio-lpc32xx.h>
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <mach/gpio-lpc32xx.h>
 #include <mach/irqs.h>
 
 #define LPC32XX_GPIO_P3_INP_STATE              _GPREG(0x000)
@@ -448,7 +448,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
                        .base                   = LPC32XX_GPIO_P0_GRP,
                        .ngpio                  = LPC32XX_GPIO_P0_MAX,
                        .names                  = gpio_p0_names,
-                       .can_sleep              = 0,
+                       .can_sleep              = false,
                },
                .gpio_grp = &gpio_grp_regs_p0,
        },
@@ -464,7 +464,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
                        .base                   = LPC32XX_GPIO_P1_GRP,
                        .ngpio                  = LPC32XX_GPIO_P1_MAX,
                        .names                  = gpio_p1_names,
-                       .can_sleep              = 0,
+                       .can_sleep              = false,
                },
                .gpio_grp = &gpio_grp_regs_p1,
        },
@@ -479,7 +479,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
                        .base                   = LPC32XX_GPIO_P2_GRP,
                        .ngpio                  = LPC32XX_GPIO_P2_MAX,
                        .names                  = gpio_p2_names,
-                       .can_sleep              = 0,
+                       .can_sleep              = false,
                },
                .gpio_grp = &gpio_grp_regs_p2,
        },
@@ -495,7 +495,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
                        .base                   = LPC32XX_GPIO_P3_GRP,
                        .ngpio                  = LPC32XX_GPIO_P3_MAX,
                        .names                  = gpio_p3_names,
-                       .can_sleep              = 0,
+                       .can_sleep              = false,
                },
                .gpio_grp = &gpio_grp_regs_p3,
        },
@@ -509,7 +509,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
                        .base                   = LPC32XX_GPI_P3_GRP,
                        .ngpio                  = LPC32XX_GPI_P3_MAX,
                        .names                  = gpi_p3_names,
-                       .can_sleep              = 0,
+                       .can_sleep              = false,
                },
                .gpio_grp = &gpio_grp_regs_p3,
        },
@@ -523,7 +523,7 @@ static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
                        .base                   = LPC32XX_GPO_P3_GRP,
                        .ngpio                  = LPC32XX_GPO_P3_MAX,
                        .names                  = gpo_p3_names,
-                       .can_sleep              = 0,
+                       .can_sleep              = false,
                },
                .gpio_grp = &gpio_grp_regs_p3,
        },
index a0804740a0b729fde5626fc3b1d6644a73839096..66b18535b5ae368f3788cadb68cf8cda8aa628e2 100644 (file)
@@ -301,6 +301,26 @@ static void lp_irq_disable(struct irq_data *d)
        spin_unlock_irqrestore(&lg->lock, flags);
 }
 
+static unsigned int lp_irq_startup(struct irq_data *d)
+{
+       struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
+
+       if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d)))
+               dev_err(lg->chip.dev,
+                       "unable to lock HW IRQ %lu for IRQ\n",
+                       irqd_to_hwirq(d));
+       lp_irq_enable(d);
+       return 0;
+}
+
+static void lp_irq_shutdown(struct irq_data *d)
+{
+       struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
+
+       lp_irq_disable(d);
+       gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d));
+}
+
 static struct irq_chip lp_irqchip = {
        .name = "LP-GPIO",
        .irq_mask = lp_irq_mask,
@@ -308,6 +328,8 @@ static struct irq_chip lp_irqchip = {
        .irq_enable = lp_irq_enable,
        .irq_disable = lp_irq_disable,
        .irq_set_type = lp_irq_type,
+       .irq_startup = lp_irq_startup,
+       .irq_shutdown = lp_irq_shutdown,
        .flags = IRQCHIP_SKIP_SET_WAKE,
 };
 
@@ -331,8 +353,7 @@ static int lp_gpio_irq_map(struct irq_domain *d, unsigned int irq,
 {
        struct lp_gpio *lg = d->host_data;
 
-       irq_set_chip_and_handler_name(irq, &lp_irqchip, handle_simple_irq,
-                                     "demux");
+       irq_set_chip_and_handler(irq, &lp_irqchip, handle_simple_irq);
        irq_set_chip_data(irq, lg);
        irq_set_irq_type(irq, IRQ_TYPE_NONE);
 
@@ -392,7 +413,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
        gc->set = lp_gpio_set;
        gc->base = -1;
        gc->ngpio = LP_NUM_GPIO;
-       gc->can_sleep = 0;
+       gc->can_sleep = false;
        gc->dev = dev;
 
        /* set up interrupts  */
@@ -438,6 +459,7 @@ static const struct dev_pm_ops lp_gpio_pm_ops = {
 
 static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
        { "INT33C7", 0 },
+       { "INT3437", 0 },
        { }
 };
 MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match);
@@ -469,4 +491,15 @@ static int __init lp_gpio_init(void)
        return platform_driver_register(&lp_gpio_driver);
 }
 
+static void __exit lp_gpio_exit(void)
+{
+       platform_driver_unregister(&lp_gpio_driver);
+}
+
 subsys_initcall(lp_gpio_init);
+module_exit(lp_gpio_exit);
+
+MODULE_AUTHOR("Mathias Nyman (Intel)");
+MODULE_DESCRIPTION("GPIO interface for Intel Lynxpoint");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:lp_gpio");
index f4f4ed19bdc13c8211d1eb74244afab51088738f..89226a36b08c9d31bdd4951e811bf88a53c1643d 100644 (file)
@@ -188,7 +188,7 @@ int __max730x_probe(struct max7301 *ts)
        ts->chip.set = max7301_set;
 
        ts->chip.ngpio = PIN_NUMBER;
-       ts->chip.can_sleep = 1;
+       ts->chip.can_sleep = true;
        ts->chip.dev = dev;
        ts->chip.owner = THIS_MODULE;
 
index 91ad74dea8ceab68dc6048ce10a1b14e6ccaf80e..36cb290764b6fc6f13b341af7452cfc9145d1f28 100644 (file)
@@ -564,7 +564,7 @@ static int max732x_setup_gpio(struct max732x_chip *chip,
                gc->set = max732x_gpio_set_value;
        }
        gc->get = max732x_gpio_get_value;
-       gc->can_sleep = 1;
+       gc->can_sleep = true;
 
        gc->base = gpio_start;
        gc->ngpio = port;
index c0b7835f513687fe8f0922ea1aaecc7e2e2ded91..553a80a5eaf3786bcf3e8436d6b4cb16d579c1cc 100644 (file)
@@ -115,7 +115,7 @@ static int mc33880_probe(struct spi_device *spi)
        mc->chip.set = mc33880_set;
        mc->chip.base = pdata->base;
        mc->chip.ngpio = PIN_NUMBER;
-       mc->chip.can_sleep = 1;
+       mc->chip.can_sleep = true;
        mc->chip.dev = &spi->dev;
        mc->chip.owner = THIS_MODULE;
 
index 0ab700046a23eec7f5e6446ea05dc6382ff28e86..dce35ff00db72ff6224dfc519a5928b9bd21a337 100644 (file)
@@ -102,7 +102,7 @@ static int mc9s08dz60_probe(struct i2c_client *client,
        mc9s->chip.dev = &client->dev;
        mc9s->chip.owner = THIS_MODULE;
        mc9s->chip.ngpio = GPIO_NUM;
-       mc9s->chip.can_sleep = 1;
+       mc9s->chip.can_sleep = true;
        mc9s->chip.get = mc9s08dz60_get_value;
        mc9s->chip.set = mc9s08dz60_set_value;
        mc9s->chip.direction_output = mc9s08dz60_direction_output;
index 2deb0c5e54a443a7546c7e4c63bf1e6a833c0d50..b16401ee4766d8fd7a7752fc9dabdb1c0b911653 100644 (file)
@@ -425,7 +425,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
        }
 
        mcp->chip.base = base;
-       mcp->chip.can_sleep = 1;
+       mcp->chip.can_sleep = true;
        mcp->chip.dev = dev;
        mcp->chip.owner = THIS_MODULE;
 
index 6da6d7667c6d70f3f57f59e5a13bfb616a5dd4a8..d51329d23d38c4d1188f4d9844ddc2308618ae4a 100644 (file)
@@ -242,7 +242,7 @@ static void ioh_gpio_setup(struct ioh_gpio *chip, int num_port)
        gpio->dbg_show = NULL;
        gpio->base = -1;
        gpio->ngpio = num_port;
-       gpio->can_sleep = 0;
+       gpio->can_sleep = false;
        gpio->to_irq = ioh_gpio_to_irq;
 }
 
@@ -596,7 +596,7 @@ static int ioh_gpio_resume(struct pci_dev *pdev)
 #define ioh_gpio_resume NULL
 #endif
 
-static DEFINE_PCI_DEVICE_TABLE(ioh_gpio_pcidev_id) = {
+static const struct pci_device_id ioh_gpio_pcidev_id[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x802E) },
        { 0, }
 };
diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
new file mode 100644 (file)
index 0000000..4ecd195
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * MOXA ART SoCs GPIO driver.
+ *
+ * Copyright (C) 2013 Jonas Jensen
+ *
+ * Jonas Jensen <jonas.jensen@gmail.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.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/of_gpio.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/delay.h>
+#include <linux/timer.h>
+#include <linux/bitops.h>
+
+#define GPIO_DATA_OUT          0x00
+#define GPIO_DATA_IN           0x04
+#define GPIO_PIN_DIRECTION     0x08
+
+struct moxart_gpio_chip {
+       struct gpio_chip gpio;
+       void __iomem *base;
+};
+
+static inline struct moxart_gpio_chip *to_moxart_gpio(struct gpio_chip *chip)
+{
+       return container_of(chip, struct moxart_gpio_chip, gpio);
+}
+
+static int moxart_gpio_request(struct gpio_chip *chip, unsigned offset)
+{
+       return pinctrl_request_gpio(offset);
+}
+
+static void moxart_gpio_free(struct gpio_chip *chip, unsigned offset)
+{
+       pinctrl_free_gpio(offset);
+}
+
+static int moxart_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
+{
+       struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
+       void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;
+
+       writel(readl(ioaddr) & ~BIT(offset), ioaddr);
+       return 0;
+}
+
+static int moxart_gpio_direction_output(struct gpio_chip *chip,
+                                       unsigned offset, int value)
+{
+       struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
+       void __iomem *ioaddr = gc->base + GPIO_PIN_DIRECTION;
+
+       writel(readl(ioaddr) | BIT(offset), ioaddr);
+       return 0;
+}
+
+static void moxart_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+{
+       struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
+       void __iomem *ioaddr = gc->base + GPIO_DATA_OUT;
+       u32 reg = readl(ioaddr);
+
+       if (value)
+               reg = reg | BIT(offset);
+       else
+               reg = reg & ~BIT(offset);
+
+
+       writel(reg, ioaddr);
+}
+
+static int moxart_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+       struct moxart_gpio_chip *gc = to_moxart_gpio(chip);
+       u32 ret = readl(gc->base + GPIO_PIN_DIRECTION);
+
+       if (ret & BIT(offset))
+               return !!(readl(gc->base + GPIO_DATA_OUT) & BIT(offset));
+       else
+               return !!(readl(gc->base + GPIO_DATA_IN) & BIT(offset));
+}
+
+static struct gpio_chip moxart_template_chip = {
+       .label                  = "moxart-gpio",
+       .request                = moxart_gpio_request,
+       .free                   = moxart_gpio_free,
+       .direction_input        = moxart_gpio_direction_input,
+       .direction_output       = moxart_gpio_direction_output,
+       .set                    = moxart_gpio_set,
+       .get                    = moxart_gpio_get,
+       .ngpio                  = 32,
+};
+
+static int moxart_gpio_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct resource *res;
+       struct moxart_gpio_chip *mgc;
+       int ret;
+
+       mgc = devm_kzalloc(dev, sizeof(*mgc), GFP_KERNEL);
+       if (!mgc) {
+               dev_err(dev, "can't allocate GPIO chip container\n");
+               return -ENOMEM;
+       }
+       mgc->gpio = moxart_template_chip;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       mgc->base = devm_ioremap_resource(dev, res);
+       if (IS_ERR(mgc->base)) {
+               dev_err(dev, "%s: devm_ioremap_resource res_gpio failed\n",
+                       dev->of_node->full_name);
+               return PTR_ERR(mgc->base);
+       }
+
+       mgc->gpio.dev = dev;
+
+       ret = gpiochip_add(&mgc->gpio);
+       if (ret) {
+               dev_err(dev, "%s: gpiochip_add failed\n",
+                       dev->of_node->full_name);
+               return ret;
+       }
+
+       return 0;
+}
+
+static const struct of_device_id moxart_gpio_match[] = {
+       { .compatible = "moxa,moxart-gpio" },
+       { }
+};
+
+static struct platform_driver moxart_gpio_driver = {
+       .driver = {
+               .name           = "moxart-gpio",
+               .owner          = THIS_MODULE,
+               .of_match_table = moxart_gpio_match,
+       },
+       .probe  = moxart_gpio_probe,
+};
+module_platform_driver(moxart_gpio_driver);
+
+MODULE_DESCRIPTION("MOXART GPIO chip driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jonas Jensen <jonas.jensen@gmail.com>");
index d75eaa3a1dcc5f2e158ff4bdf59c991402a3b822..8f70ded82a2bb29dabf1695e2f4b8207114e1f0f 100644 (file)
@@ -292,7 +292,7 @@ static int platform_msic_gpio_probe(struct platform_device *pdev)
        mg->chip.to_irq = msic_gpio_to_irq;
        mg->chip.base = pdata->gpio_base;
        mg->chip.ngpio = MSIC_NUM_GPIO;
-       mg->chip.can_sleep = 1;
+       mg->chip.can_sleep = true;
        mg->chip.dev = dev;
 
        mutex_init(&mg->buslock);
@@ -305,10 +305,9 @@ static int platform_msic_gpio_probe(struct platform_device *pdev)
 
        for (i = 0; i < mg->chip.ngpio; i++) {
                irq_set_chip_data(i + mg->irq_base, mg);
-               irq_set_chip_and_handler_name(i + mg->irq_base,
-                                             &msic_irqchip,
-                                             handle_simple_irq,
-                                             "demux");
+               irq_set_chip_and_handler(i + mg->irq_base,
+                                        &msic_irqchip,
+                                        handle_simple_irq);
        }
        irq_set_chained_handler(mg->irq, msic_gpio_irq_handler);
        irq_set_handler_data(mg->irq, mg);
index db3129043e635c2bc9c7f6a7c3ffd111de5dc6f4..bc78a9da5502cab222aabe252b638641c4de2fca 100644 (file)
@@ -600,7 +600,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
        mvchip->chip.to_irq = mvebu_gpio_to_irq;
        mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;
        mvchip->chip.ngpio = ngpios;
-       mvchip->chip.can_sleep = 0;
+       mvchip->chip.can_sleep = false;
        mvchip->chip.of_node = np;
        mvchip->chip.dbg_show = mvebu_gpio_dbg_show;
 
index 71a4a318315d9f6c37355038ff21e736e156bb90..dbb08546b9ec2e70eb73cd4cf87e76fba39af368 100644 (file)
@@ -111,7 +111,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
        chip->dev = &pdev->dev;
        chip->owner = THIS_MODULE;
        chip->base = 0;
-       chip->can_sleep = 0;
+       chip->can_sleep = false;
        chip->ngpio = 20;
        chip->direction_input = octeon_gpio_dir_in;
        chip->get = octeon_gpio_get;
index f319c9ffd4a8b386e86cad96564fb9b629512b27..424319061e0941aa70add47f949d012867f980ea 100644 (file)
@@ -108,12 +108,12 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
        u32 l;
 
        reg += bank->regs->direction;
-       l = __raw_readl(reg);
+       l = readl_relaxed(reg);
        if (is_input)
                l |= 1 << gpio;
        else
                l &= ~(1 << gpio);
-       __raw_writel(l, reg);
+       writel_relaxed(l, reg);
        bank->context.oe = l;
 }
 
@@ -132,7 +132,7 @@ static void _set_gpio_dataout_reg(struct gpio_bank *bank, int gpio, int enable)
                bank->context.dataout &= ~l;
        }
 
-       __raw_writel(l, reg);
+       writel_relaxed(l, reg);
 }
 
 /* set data out value using mask register */
@@ -142,12 +142,12 @@ static void _set_gpio_dataout_mask(struct gpio_bank *bank, int gpio, int enable)
        u32 gpio_bit = GPIO_BIT(bank, gpio);
        u32 l;
 
-       l = __raw_readl(reg);
+       l = readl_relaxed(reg);
        if (enable)
                l |= gpio_bit;
        else
                l &= ~gpio_bit;
-       __raw_writel(l, reg);
+       writel_relaxed(l, reg);
        bank->context.dataout = l;
 }
 
@@ -155,26 +155,26 @@ static int _get_gpio_datain(struct gpio_bank *bank, int offset)
 {
        void __iomem *reg = bank->base + bank->regs->datain;
 
-       return (__raw_readl(reg) & (1 << offset)) != 0;
+       return (readl_relaxed(reg) & (1 << offset)) != 0;
 }
 
 static int _get_gpio_dataout(struct gpio_bank *bank, int offset)
 {
        void __iomem *reg = bank->base + bank->regs->dataout;
 
-       return (__raw_readl(reg) & (1 << offset)) != 0;
+       return (readl_relaxed(reg) & (1 << offset)) != 0;
 }
 
 static inline void _gpio_rmw(void __iomem *base, u32 reg, u32 mask, bool set)
 {
-       int l = __raw_readl(base + reg);
+       int l = readl_relaxed(base + reg);
 
        if (set)
                l |= mask;
        else
                l &= ~mask;
 
-       __raw_writel(l, base + reg);
+       writel_relaxed(l, base + reg);
 }
 
 static inline void _gpio_dbck_enable(struct gpio_bank *bank)
@@ -183,7 +183,7 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank)
                clk_enable(bank->dbck);
                bank->dbck_enabled = true;
 
-               __raw_writel(bank->dbck_enable_mask,
+               writel_relaxed(bank->dbck_enable_mask,
                             bank->base + bank->regs->debounce_en);
        }
 }
@@ -196,7 +196,7 @@ static inline void _gpio_dbck_disable(struct gpio_bank *bank)
                 * enabled but the clock is not, GPIO module seems to be unable
                 * to detect events and generate interrupts at least on OMAP3.
                 */
-               __raw_writel(0, bank->base + bank->regs->debounce_en);
+               writel_relaxed(0, bank->base + bank->regs->debounce_en);
 
                clk_disable(bank->dbck);
                bank->dbck_enabled = false;
@@ -233,10 +233,10 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
 
        clk_enable(bank->dbck);
        reg = bank->base + bank->regs->debounce;
-       __raw_writel(debounce, reg);
+       writel_relaxed(debounce, reg);
 
        reg = bank->base + bank->regs->debounce_en;
-       val = __raw_readl(reg);
+       val = readl_relaxed(reg);
 
        if (debounce)
                val |= l;
@@ -244,7 +244,7 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
                val &= ~l;
        bank->dbck_enable_mask = val;
 
-       __raw_writel(val, reg);
+       writel_relaxed(val, reg);
        clk_disable(bank->dbck);
        /*
         * Enable debounce clock per module.
@@ -283,12 +283,12 @@ static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio)
 
        bank->dbck_enable_mask &= ~gpio_bit;
        bank->context.debounce_en &= ~gpio_bit;
-       __raw_writel(bank->context.debounce_en,
+        writel_relaxed(bank->context.debounce_en,
                     bank->base + bank->regs->debounce_en);
 
        if (!bank->dbck_enable_mask) {
                bank->context.debounce = 0;
-               __raw_writel(bank->context.debounce, bank->base +
+               writel_relaxed(bank->context.debounce, bank->base +
                             bank->regs->debounce);
                clk_disable(bank->dbck);
                bank->dbck_enabled = false;
@@ -311,18 +311,18 @@ static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,
                  trigger & IRQ_TYPE_EDGE_FALLING);
 
        bank->context.leveldetect0 =
-                       __raw_readl(bank->base + bank->regs->leveldetect0);
+                       readl_relaxed(bank->base + bank->regs->leveldetect0);
        bank->context.leveldetect1 =
-                       __raw_readl(bank->base + bank->regs->leveldetect1);
+                       readl_relaxed(bank->base + bank->regs->leveldetect1);
        bank->context.risingdetect =
-                       __raw_readl(bank->base + bank->regs->risingdetect);
+                       readl_relaxed(bank->base + bank->regs->risingdetect);
        bank->context.fallingdetect =
-                       __raw_readl(bank->base + bank->regs->fallingdetect);
+                       readl_relaxed(bank->base + bank->regs->fallingdetect);
 
        if (likely(!(bank->non_wakeup_gpios & gpio_bit))) {
                _gpio_rmw(base, bank->regs->wkup_en, gpio_bit, trigger != 0);
                bank->context.wake_en =
-                       __raw_readl(bank->base + bank->regs->wkup_en);
+                       readl_relaxed(bank->base + bank->regs->wkup_en);
        }
 
        /* This part needs to be executed always for OMAP{34xx, 44xx} */
@@ -347,8 +347,8 @@ static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,
 
 exit:
        bank->level_mask =
-               __raw_readl(bank->base + bank->regs->leveldetect0) |
-               __raw_readl(bank->base + bank->regs->leveldetect1);
+               readl_relaxed(bank->base + bank->regs->leveldetect0) |
+               readl_relaxed(bank->base + bank->regs->leveldetect1);
 }
 
 #ifdef CONFIG_ARCH_OMAP1
@@ -366,13 +366,13 @@ static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio)
 
        reg += bank->regs->irqctrl;
 
-       l = __raw_readl(reg);
+       l = readl_relaxed(reg);
        if ((l >> gpio) & 1)
                l &= ~(1 << gpio);
        else
                l |= 1 << gpio;
 
-       __raw_writel(l, reg);
+       writel_relaxed(l, reg);
 }
 #else
 static void _toggle_gpio_edge_triggering(struct gpio_bank *bank, int gpio) {}
@@ -390,7 +390,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio,
        } else if (bank->regs->irqctrl) {
                reg += bank->regs->irqctrl;
 
-               l = __raw_readl(reg);
+               l = readl_relaxed(reg);
                if ((trigger & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH)
                        bank->toggle_mask |= 1 << gpio;
                if (trigger & IRQ_TYPE_EDGE_RISING)
@@ -400,7 +400,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio,
                else
                        return -EINVAL;
 
-               __raw_writel(l, reg);
+               writel_relaxed(l, reg);
        } else if (bank->regs->edgectrl1) {
                if (gpio & 0x08)
                        reg += bank->regs->edgectrl2;
@@ -408,7 +408,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio,
                        reg += bank->regs->edgectrl1;
 
                gpio &= 0x07;
-               l = __raw_readl(reg);
+               l = readl_relaxed(reg);
                l &= ~(3 << (gpio << 1));
                if (trigger & IRQ_TYPE_EDGE_RISING)
                        l |= 2 << (gpio << 1);
@@ -418,8 +418,8 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio,
                /* Enable wake-up during idle for dynamic tick */
                _gpio_rmw(base, bank->regs->wkup_en, 1 << gpio, trigger);
                bank->context.wake_en =
-                       __raw_readl(bank->base + bank->regs->wkup_en);
-               __raw_writel(l, reg);
+                       readl_relaxed(bank->base + bank->regs->wkup_en);
+               writel_relaxed(l, reg);
        }
        return 0;
 }
@@ -430,17 +430,17 @@ static void _enable_gpio_module(struct gpio_bank *bank, unsigned offset)
                void __iomem *reg = bank->base + bank->regs->pinctrl;
 
                /* Claim the pin for MPU */
-               __raw_writel(__raw_readl(reg) | (1 << offset), reg);
+               writel_relaxed(readl_relaxed(reg) | (1 << offset), reg);
        }
 
        if (bank->regs->ctrl && !BANK_USED(bank)) {
                void __iomem *reg = bank->base + bank->regs->ctrl;
                u32 ctrl;
 
-               ctrl = __raw_readl(reg);
+               ctrl = readl_relaxed(reg);
                /* Module is enabled, clocks are not gated */
                ctrl &= ~GPIO_MOD_CTRL_BIT;
-               __raw_writel(ctrl, reg);
+               writel_relaxed(ctrl, reg);
                bank->context.ctrl = ctrl;
        }
 }
@@ -455,17 +455,17 @@ static void _disable_gpio_module(struct gpio_bank *bank, unsigned offset)
                /* Disable wake-up during idle for dynamic tick */
                _gpio_rmw(base, bank->regs->wkup_en, 1 << offset, 0);
                bank->context.wake_en =
-                       __raw_readl(bank->base + bank->regs->wkup_en);
+                       readl_relaxed(bank->base + bank->regs->wkup_en);
        }
 
        if (bank->regs->ctrl && !BANK_USED(bank)) {
                void __iomem *reg = bank->base + bank->regs->ctrl;
                u32 ctrl;
 
-               ctrl = __raw_readl(reg);
+               ctrl = readl_relaxed(reg);
                /* Module is disabled, clocks are gated */
                ctrl |= GPIO_MOD_CTRL_BIT;
-               __raw_writel(ctrl, reg);
+               writel_relaxed(ctrl, reg);
                bank->context.ctrl = ctrl;
        }
 }
@@ -474,7 +474,7 @@ static int gpio_is_input(struct gpio_bank *bank, int mask)
 {
        void __iomem *reg = bank->base + bank->regs->direction;
 
-       return __raw_readl(reg) & mask;
+       return readl_relaxed(reg) & mask;
 }
 
 static int gpio_irq_type(struct irq_data *d, unsigned type)
@@ -538,16 +538,16 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
        void __iomem *reg = bank->base;
 
        reg += bank->regs->irqstatus;
-       __raw_writel(gpio_mask, reg);
+       writel_relaxed(gpio_mask, reg);
 
        /* Workaround for clearing DSP GPIO interrupts to allow retention */
        if (bank->regs->irqstatus2) {
                reg = bank->base + bank->regs->irqstatus2;
-               __raw_writel(gpio_mask, reg);
+               writel_relaxed(gpio_mask, reg);
        }
 
        /* Flush posted write for the irq status to avoid spurious interrupts */
-       __raw_readl(reg);
+       readl_relaxed(reg);
 }
 
 static inline void _clear_gpio_irqstatus(struct gpio_bank *bank, int gpio)
@@ -562,7 +562,7 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
        u32 mask = (1 << bank->width) - 1;
 
        reg += bank->regs->irqenable;
-       l = __raw_readl(reg);
+       l = readl_relaxed(reg);
        if (bank->regs->irqenable_inv)
                l = ~l;
        l &= mask;
@@ -580,7 +580,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
                bank->context.irqenable1 |= gpio_mask;
        } else {
                reg += bank->regs->irqenable;
-               l = __raw_readl(reg);
+               l = readl_relaxed(reg);
                if (bank->regs->irqenable_inv)
                        l &= ~gpio_mask;
                else
@@ -588,7 +588,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
                bank->context.irqenable1 = l;
        }
 
-       __raw_writel(l, reg);
+       writel_relaxed(l, reg);
 }
 
 static void _disable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
@@ -602,7 +602,7 @@ static void _disable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
                bank->context.irqenable1 &= ~gpio_mask;
        } else {
                reg += bank->regs->irqenable;
-               l = __raw_readl(reg);
+               l = readl_relaxed(reg);
                if (bank->regs->irqenable_inv)
                        l |= gpio_mask;
                else
@@ -610,7 +610,7 @@ static void _disable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
                bank->context.irqenable1 = l;
        }
 
-       __raw_writel(l, reg);
+       writel_relaxed(l, reg);
 }
 
 static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable)
@@ -646,7 +646,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
        else
                bank->context.wake_en &= ~gpio_bit;
 
-       __raw_writel(bank->context.wake_en, bank->base + bank->regs->wkup_en);
+       writel_relaxed(bank->context.wake_en, bank->base + bank->regs->wkup_en);
        spin_unlock_irqrestore(&bank->lock, flags);
 
        return 0;
@@ -748,7 +748,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
                u32 enabled;
 
                enabled = _get_gpio_irqbank_mask(bank);
-               isr_saved = isr = __raw_readl(isr_reg) & enabled;
+               isr_saved = isr = readl_relaxed(isr_reg) & enabled;
 
                if (bank->level_mask)
                        level_mask = bank->level_mask & enabled;
@@ -883,7 +883,7 @@ static int omap_mpuio_suspend_noirq(struct device *dev)
        unsigned long           flags;
 
        spin_lock_irqsave(&bank->lock, flags);
-       __raw_writel(0xffff & ~bank->context.wake_en, mask_reg);
+       writel_relaxed(0xffff & ~bank->context.wake_en, mask_reg);
        spin_unlock_irqrestore(&bank->lock, flags);
 
        return 0;
@@ -898,7 +898,7 @@ static int omap_mpuio_resume_noirq(struct device *dev)
        unsigned long           flags;
 
        spin_lock_irqsave(&bank->lock, flags);
-       __raw_writel(bank->context.wake_en, mask_reg);
+       writel_relaxed(bank->context.wake_en, mask_reg);
        spin_unlock_irqrestore(&bank->lock, flags);
 
        return 0;
@@ -1011,7 +1011,7 @@ static void __init omap_gpio_show_rev(struct gpio_bank *bank)
        if (called || bank->regs->revision == USHRT_MAX)
                return;
 
-       rev = __raw_readw(bank->base + bank->regs->revision);
+       rev = readw_relaxed(bank->base + bank->regs->revision);
        pr_info("OMAP GPIO hardware version %d.%d\n",
                (rev >> 4) & 0x0f, rev & 0x0f);
 
@@ -1032,20 +1032,20 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
                l = 0xffff;
 
        if (bank->is_mpuio) {
-               __raw_writel(l, bank->base + bank->regs->irqenable);
+               writel_relaxed(l, bank->base + bank->regs->irqenable);
                return;
        }
 
        _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv);
        _gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv);
        if (bank->regs->debounce_en)
-               __raw_writel(0, base + bank->regs->debounce_en);
+               writel_relaxed(0, base + bank->regs->debounce_en);
 
        /* Save OE default value (0xffffffff) in the context */
-       bank->context.oe = __raw_readl(bank->base + bank->regs->direction);
+       bank->context.oe = readl_relaxed(bank->base + bank->regs->direction);
         /* Initialize interface clk ungated, module enabled */
        if (bank->regs->ctrl)
-               __raw_writel(0, base + bank->regs->ctrl);
+               writel_relaxed(0, base + bank->regs->ctrl);
 
        bank->dbck = clk_get(bank->dev, "dbclk");
        if (IS_ERR(bank->dbck))
@@ -1282,11 +1282,11 @@ static int omap_gpio_runtime_suspend(struct device *dev)
         */
        wake_low = bank->context.leveldetect0 & bank->context.wake_en;
        if (wake_low)
-               __raw_writel(wake_low | bank->context.fallingdetect,
+               writel_relaxed(wake_low | bank->context.fallingdetect,
                             bank->base + bank->regs->fallingdetect);
        wake_hi = bank->context.leveldetect1 & bank->context.wake_en;
        if (wake_hi)
-               __raw_writel(wake_hi | bank->context.risingdetect,
+               writel_relaxed(wake_hi | bank->context.risingdetect,
                             bank->base + bank->regs->risingdetect);
 
        if (!bank->enabled_non_wakeup_gpios)
@@ -1301,7 +1301,7 @@ static int omap_gpio_runtime_suspend(struct device *dev)
         * non-wakeup GPIOs.  Otherwise spurious IRQs will be
         * generated.  See OMAP2420 Errata item 1.101.
         */
-       bank->saved_datain = __raw_readl(bank->base +
+       bank->saved_datain = readl_relaxed(bank->base +
                                                bank->regs->datain);
        l1 = bank->context.fallingdetect;
        l2 = bank->context.risingdetect;
@@ -1309,8 +1309,8 @@ static int omap_gpio_runtime_suspend(struct device *dev)
        l1 &= ~bank->enabled_non_wakeup_gpios;
        l2 &= ~bank->enabled_non_wakeup_gpios;
 
-       __raw_writel(l1, bank->base + bank->regs->fallingdetect);
-       __raw_writel(l2, bank->base + bank->regs->risingdetect);
+       writel_relaxed(l1, bank->base + bank->regs->fallingdetect);
+       writel_relaxed(l2, bank->base + bank->regs->risingdetect);
 
        bank->workaround_enabled = true;
 
@@ -1358,9 +1358,9 @@ static int omap_gpio_runtime_resume(struct device *dev)
         * generate a PRCM wakeup.  Here we restore the
         * pre-runtime_suspend() values for edge triggering.
         */
-       __raw_writel(bank->context.fallingdetect,
+       writel_relaxed(bank->context.fallingdetect,
                     bank->base + bank->regs->fallingdetect);
-       __raw_writel(bank->context.risingdetect,
+       writel_relaxed(bank->context.risingdetect,
                     bank->base + bank->regs->risingdetect);
 
        if (bank->loses_context) {
@@ -1382,7 +1382,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
                return 0;
        }
 
-       l = __raw_readl(bank->base + bank->regs->datain);
+       l = readl_relaxed(bank->base + bank->regs->datain);
 
        /*
         * Check if any of the non-wakeup interrupt GPIOs have changed
@@ -1412,24 +1412,24 @@ static int omap_gpio_runtime_resume(struct device *dev)
        if (gen) {
                u32 old0, old1;
 
-               old0 = __raw_readl(bank->base + bank->regs->leveldetect0);
-               old1 = __raw_readl(bank->base + bank->regs->leveldetect1);
+               old0 = readl_relaxed(bank->base + bank->regs->leveldetect0);
+               old1 = readl_relaxed(bank->base + bank->regs->leveldetect1);
 
                if (!bank->regs->irqstatus_raw0) {
-                       __raw_writel(old0 | gen, bank->base +
+                       writel_relaxed(old0 | gen, bank->base +
                                                bank->regs->leveldetect0);
-                       __raw_writel(old1 | gen, bank->base +
+                       writel_relaxed(old1 | gen, bank->base +
                                                bank->regs->leveldetect1);
                }
 
                if (bank->regs->irqstatus_raw0) {
-                       __raw_writel(old0 | l, bank->base +
+                       writel_relaxed(old0 | l, bank->base +
                                                bank->regs->leveldetect0);
-                       __raw_writel(old1 | l, bank->base +
+                       writel_relaxed(old1 | l, bank->base +
                                                bank->regs->leveldetect1);
                }
-               __raw_writel(old0, bank->base + bank->regs->leveldetect0);
-               __raw_writel(old1, bank->base + bank->regs->leveldetect1);
+               writel_relaxed(old0, bank->base + bank->regs->leveldetect0);
+               writel_relaxed(old1, bank->base + bank->regs->leveldetect1);
        }
 
        bank->workaround_enabled = false;
@@ -1471,55 +1471,55 @@ static void omap_gpio_init_context(struct gpio_bank *p)
        struct omap_gpio_reg_offs *regs = p->regs;
        void __iomem *base = p->base;
 
-       p->context.ctrl         = __raw_readl(base + regs->ctrl);
-       p->context.oe           = __raw_readl(base + regs->direction);
-       p->context.wake_en      = __raw_readl(base + regs->wkup_en);
-       p->context.leveldetect0 = __raw_readl(base + regs->leveldetect0);
-       p->context.leveldetect1 = __raw_readl(base + regs->leveldetect1);
-       p->context.risingdetect = __raw_readl(base + regs->risingdetect);
-       p->context.fallingdetect = __raw_readl(base + regs->fallingdetect);
-       p->context.irqenable1   = __raw_readl(base + regs->irqenable);
-       p->context.irqenable2   = __raw_readl(base + regs->irqenable2);
+       p->context.ctrl         = readl_relaxed(base + regs->ctrl);
+       p->context.oe           = readl_relaxed(base + regs->direction);
+       p->context.wake_en      = readl_relaxed(base + regs->wkup_en);
+       p->context.leveldetect0 = readl_relaxed(base + regs->leveldetect0);
+       p->context.leveldetect1 = readl_relaxed(base + regs->leveldetect1);
+       p->context.risingdetect = readl_relaxed(base + regs->risingdetect);
+       p->context.fallingdetect = readl_relaxed(base + regs->fallingdetect);
+       p->context.irqenable1   = readl_relaxed(base + regs->irqenable);
+       p->context.irqenable2   = readl_relaxed(base + regs->irqenable2);
 
        if (regs->set_dataout && p->regs->clr_dataout)
-               p->context.dataout = __raw_readl(base + regs->set_dataout);
+               p->context.dataout = readl_relaxed(base + regs->set_dataout);
        else
-               p->context.dataout = __raw_readl(base + regs->dataout);
+               p->context.dataout = readl_relaxed(base + regs->dataout);
 
        p->context_valid = true;
 }
 
 static void omap_gpio_restore_context(struct gpio_bank *bank)
 {
-       __raw_writel(bank->context.wake_en,
+       writel_relaxed(bank->context.wake_en,
                                bank->base + bank->regs->wkup_en);
-       __raw_writel(bank->context.ctrl, bank->base + bank->regs->ctrl);
-       __raw_writel(bank->context.leveldetect0,
+       writel_relaxed(bank->context.ctrl, bank->base + bank->regs->ctrl);
+       writel_relaxed(bank->context.leveldetect0,
                                bank->base + bank->regs->leveldetect0);
-       __raw_writel(bank->context.leveldetect1,
+       writel_relaxed(bank->context.leveldetect1,
                                bank->base + bank->regs->leveldetect1);
-       __raw_writel(bank->context.risingdetect,
+       writel_relaxed(bank->context.risingdetect,
                                bank->base + bank->regs->risingdetect);
-       __raw_writel(bank->context.fallingdetect,
+       writel_relaxed(bank->context.fallingdetect,
                                bank->base + bank->regs->fallingdetect);
        if (bank->regs->set_dataout && bank->regs->clr_dataout)
-               __raw_writel(bank->context.dataout,
+               writel_relaxed(bank->context.dataout,
                                bank->base + bank->regs->set_dataout);
        else
-               __raw_writel(bank->context.dataout,
+               writel_relaxed(bank->context.dataout,
                                bank->base + bank->regs->dataout);
-       __raw_writel(bank->context.oe, bank->base + bank->regs->direction);
+       writel_relaxed(bank->context.oe, bank->base + bank->regs->direction);
 
        if (bank->dbck_enable_mask) {
-               __raw_writel(bank->context.debounce, bank->base +
+               writel_relaxed(bank->context.debounce, bank->base +
                                        bank->regs->debounce);
-               __raw_writel(bank->context.debounce_en,
+               writel_relaxed(bank->context.debounce_en,
                                        bank->base + bank->regs->debounce_en);
        }
 
-       __raw_writel(bank->context.irqenable1,
+       writel_relaxed(bank->context.irqenable1,
                                bank->base + bank->regs->irqenable);
-       __raw_writel(bank->context.irqenable2,
+       writel_relaxed(bank->context.irqenable2,
                                bank->base + bank->regs->irqenable2);
 }
 #endif /* CONFIG_PM_RUNTIME */
index 11801e986dd925f3e60a44042a30f5d8d5ad828e..da9d33252e5603fcc8712db61bb684198fda4673 100644 (file)
@@ -182,7 +182,7 @@ static int palmas_gpio_probe(struct platform_device *pdev)
        palmas_gpio->gpio_chip.owner = THIS_MODULE;
        palmas_gpio->gpio_chip.label = dev_name(&pdev->dev);
        palmas_gpio->gpio_chip.ngpio = dev_data->ngpio;
-       palmas_gpio->gpio_chip.can_sleep = 1;
+       palmas_gpio->gpio_chip.can_sleep = true;
        palmas_gpio->gpio_chip.direction_input = palmas_gpio_input;
        palmas_gpio->gpio_chip.direction_output = palmas_gpio_output;
        palmas_gpio->gpio_chip.to_irq = palmas_gpio_to_irq;
index 6e48c07e3d8c95d84a940b1712b82bb8db1d5e9d..019b23b955a2884c6f2b63233819cdd4d3beee73 100644 (file)
@@ -354,7 +354,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
        gc->direction_output = pca953x_gpio_direction_output;
        gc->get = pca953x_gpio_get_value;
        gc->set = pca953x_gpio_set_value;
-       gc->can_sleep = 1;
+       gc->can_sleep = true;
 
        gc->base = chip->gpio_start;
        gc->ngpio = gpios;
index 1535686e74ea9b037e0799b111ccc4ebdb0489e4..82735822bc9d633ae8e54dc2df3e3b5e3ebd5b73 100644 (file)
@@ -305,7 +305,7 @@ static int pcf857x_probe(struct i2c_client *client,
        spin_lock_init(&gpio->slock);
 
        gpio->chip.base                 = pdata ? pdata->gpio_base : -1;
-       gpio->chip.can_sleep            = 1;
+       gpio->chip.can_sleep            = true;
        gpio->chip.dev                  = &client->dev;
        gpio->chip.owner                = THIS_MODULE;
        gpio->chip.get                  = pcf857x_get;
index 0fec097e838df23c264b62405b2cf10bd0531bae..9656c196772ed0d2512074b053d360928c6cd869 100644 (file)
@@ -224,7 +224,7 @@ static void pch_gpio_setup(struct pch_gpio *chip)
        gpio->dbg_show = NULL;
        gpio->base = -1;
        gpio->ngpio = gpio_pins[chip->ioh];
-       gpio->can_sleep = 0;
+       gpio->can_sleep = false;
        gpio->to_irq = pch_gpio_to_irq;
 }
 
@@ -518,7 +518,7 @@ static int pch_gpio_resume(struct pci_dev *pdev)
 #endif
 
 #define PCI_VENDOR_ID_ROHM             0x10DB
-static DEFINE_PCI_DEVICE_TABLE(pch_gpio_pcidev_id) = {
+static const struct pci_device_id pch_gpio_pcidev_id[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) },
        { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014) },
        { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043) },
index e63d6a397e1780bbefac9720bd2a7f79849eef39..122b776fdc0bc6d15187b19319c2ddb8afa5b3a4 100644 (file)
@@ -133,7 +133,7 @@ static int rc5t583_gpio_probe(struct platform_device *pdev)
        rc5t583_gpio->gpio_chip.get = rc5t583_gpio_get,
        rc5t583_gpio->gpio_chip.to_irq = rc5t583_gpio_to_irq,
        rc5t583_gpio->gpio_chip.ngpio = RC5T583_MAX_GPIO,
-       rc5t583_gpio->gpio_chip.can_sleep = 1,
+       rc5t583_gpio->gpio_chip.can_sleep = true,
        rc5t583_gpio->gpio_chip.dev = &pdev->dev;
        rc5t583_gpio->gpio_chip.base = -1;
        rc5t583_gpio->rc5t583 = rc5t583;
index fe088a30567ac63325fd02be82b8e682aa2323eb..2fdd0191819d95a07850479e98227994e0aa44e9 100644 (file)
@@ -284,7 +284,34 @@ static struct irq_domain_ops gpio_rcar_irq_domain_ops = {
        .map    = gpio_rcar_irq_domain_map,
 };
 
-static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
+struct gpio_rcar_info {
+       bool has_both_edge_trigger;
+};
+
+static const struct of_device_id gpio_rcar_of_table[] = {
+       {
+               .compatible = "renesas,gpio-r8a7790",
+               .data = (void *)&(const struct gpio_rcar_info) {
+                       .has_both_edge_trigger = true,
+               },
+       }, {
+               .compatible = "renesas,gpio-r8a7791",
+               .data = (void *)&(const struct gpio_rcar_info) {
+                       .has_both_edge_trigger = true,
+               },
+       }, {
+               .compatible = "renesas,gpio-rcar",
+               .data = (void *)&(const struct gpio_rcar_info) {
+                       .has_both_edge_trigger = false,
+               },
+       }, {
+               /* Terminator */
+       },
+};
+
+MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
+
+static int gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
 {
        struct gpio_rcar_config *pdata = dev_get_platdata(&p->pdev->dev);
        struct device_node *np = p->pdev->dev.of_node;
@@ -294,11 +321,21 @@ static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
        if (pdata) {
                p->config = *pdata;
        } else if (IS_ENABLED(CONFIG_OF) && np) {
+               const struct of_device_id *match;
+               const struct gpio_rcar_info *info;
+
+               match = of_match_node(gpio_rcar_of_table, np);
+               if (!match)
+                       return -EINVAL;
+
+               info = match->data;
+
                ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0,
                                                       &args);
                p->config.number_of_pins = ret == 0 ? args.args[2]
                                         : RCAR_MAX_GPIO_PER_BANK;
                p->config.gpio_base = -1;
+               p->config.has_both_edge_trigger = info->has_both_edge_trigger;
        }
 
        if (p->config.number_of_pins == 0 ||
@@ -308,6 +345,8 @@ static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
                         p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK);
                p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK;
        }
+
+       return 0;
 }
 
 static int gpio_rcar_probe(struct platform_device *pdev)
@@ -330,7 +369,9 @@ static int gpio_rcar_probe(struct platform_device *pdev)
        spin_lock_init(&p->lock);
 
        /* Get device configuration from DT node or platform data. */
-       gpio_rcar_parse_pdata(p);
+       ret = gpio_rcar_parse_pdata(p);
+       if (ret < 0)
+               return ret;
 
        platform_set_drvdata(pdev, p);
 
@@ -369,10 +410,9 @@ static int gpio_rcar_probe(struct platform_device *pdev)
        irq_chip->name = name;
        irq_chip->irq_mask = gpio_rcar_irq_disable;
        irq_chip->irq_unmask = gpio_rcar_irq_enable;
-       irq_chip->irq_enable = gpio_rcar_irq_enable;
-       irq_chip->irq_disable = gpio_rcar_irq_disable;
        irq_chip->irq_set_type = gpio_rcar_irq_set_type;
-       irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED;
+       irq_chip->flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED
+                        | IRQCHIP_MASK_ON_SUSPEND;
 
        p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
                                              p->config.number_of_pins,
@@ -435,17 +475,6 @@ static int gpio_rcar_remove(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_OF
-static const struct of_device_id gpio_rcar_of_table[] = {
-       {
-               .compatible = "renesas,gpio-rcar",
-       },
-       { },
-};
-
-MODULE_DEVICE_TABLE(of, gpio_rcar_of_table);
-#endif
-
 static struct platform_driver gpio_rcar_device_driver = {
        .probe          = gpio_rcar_probe,
        .remove         = gpio_rcar_remove,
index 88f374ac7753a2545e9c54e0742ce083b43c2e23..5d171e0182dbc56b0f85813eac2334c7c040225f 100644 (file)
@@ -270,7 +270,7 @@ static void sdv_gpio_remove(struct pci_dev *pdev)
        kfree(sd);
 }
 
-static DEFINE_PCI_DEVICE_TABLE(sdv_gpio_pci_ids) = {
+static const struct pci_device_id sdv_gpio_pci_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_SDV_GPIO) },
        { 0, },
 };
index f2fb12c18da97616b24b9232ac7ce8d271424115..68e3fcb1acea211df4bde311e6bc6d6b95013491 100644 (file)
@@ -146,7 +146,7 @@ static void gsta_gpio_setup(struct gsta_gpio *chip) /* called from probe */
        gpio->dbg_show = NULL;
        gpio->base = gpio_base;
        gpio->ngpio = GSTA_NR_GPIO;
-       gpio->can_sleep = 0;
+       gpio->can_sleep = false;
        gpio->to_irq = gsta_gpio_to_irq;
 
        /*
index 2647e243d4718075a9a3135366ae512df589ae51..2776a09bee58df0207968a74fa9fdc435fb5f402 100644 (file)
@@ -129,7 +129,7 @@ static struct gpio_chip template_chip = {
        .set                    = stmpe_gpio_set,
        .to_irq                 = stmpe_gpio_to_irq,
        .request                = stmpe_gpio_request,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 static int stmpe_gpio_irq_set_type(struct irq_data *d, unsigned int type)
index d2983e9ad6af78ee1705b6377cea93f5de41d245..13d73fb2b5e1a2b0346b3cd8e75c4436795cca39 100644 (file)
@@ -436,7 +436,7 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
        chip->gpio_chip.set              = sx150x_gpio_set;
        chip->gpio_chip.to_irq           = sx150x_gpio_to_irq;
        chip->gpio_chip.base             = pdata->gpio_base;
-       chip->gpio_chip.can_sleep        = 1;
+       chip->gpio_chip.can_sleep        = true;
        chip->gpio_chip.ngpio            = chip->dev_cfg->ngpios;
        if (pdata->oscio_is_gpo)
                ++chip->gpio_chip.ngpio;
index da071ddbad9985670843087ee3652844958b3827..3162555ca1cb0cf30d6ec9f68e7617edbe164af9 100644 (file)
@@ -222,7 +222,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
        tb10x_gpio->gc.free             = tb10x_gpio_free;
        tb10x_gpio->gc.base             = -1;
        tb10x_gpio->gc.ngpio            = ngpio;
-       tb10x_gpio->gc.can_sleep        = 0;
+       tb10x_gpio->gc.can_sleep        = false;
 
 
        ret = gpiochip_add(&tb10x_gpio->gc);
index ddb5fefaa715096823fad4858a7d6bb2c5f7bf5d..1019320984d778f8fd51a26d3be93551349feef8 100644 (file)
@@ -127,7 +127,7 @@ static struct gpio_chip template_chip = {
        .direction_output       = tc3589x_gpio_direction_output,
        .set                    = tc3589x_gpio_set,
        .to_irq                 = tc3589x_gpio_to_irq,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 static int tc3589x_gpio_irq_set_type(struct irq_data *d, unsigned int type)
index 7a0e956ef1ed1b47d8d034bf8e48ed3f812010f3..f9a8fbde108e3b424785a12bb5bc52dd06ac1551 100644 (file)
@@ -275,7 +275,7 @@ static int timbgpio_probe(struct platform_device *pdev)
        gc->dbg_show = NULL;
        gc->base = pdata->gpio_base;
        gc->ngpio = pdata->nr_pins;
-       gc->can_sleep = 0;
+       gc->can_sleep = false;
 
        err = gpiochip_add(gc);
        if (err)
@@ -290,8 +290,8 @@ static int timbgpio_probe(struct platform_device *pdev)
                return 0;
 
        for (i = 0; i < pdata->nr_pins; i++) {
-               irq_set_chip_and_handler_name(tgpio->irq_base + i,
-                       &timbgpio_irqchip, handle_simple_irq, "mux");
+               irq_set_chip_and_handler(tgpio->irq_base + i,
+                       &timbgpio_irqchip, handle_simple_irq);
                irq_set_chip_data(tgpio->irq_base + i, tgpio);
 #ifdef CONFIG_ARM
                set_irq_flags(tgpio->irq_base + i, IRQF_VALID | IRQF_PROBE);
index 58445bb69106c71ab648263e731e12151e48c911..4aa481579a058dc8c5f7c57647e87610a0f1888e 100644 (file)
@@ -176,7 +176,7 @@ static int __init tnetv107x_gpio_setup(void)
                ctlr = &chips[i];
 
                ctlr->chip.label        = "tnetv107x";
-               ctlr->chip.can_sleep    = 0;
+               ctlr->chip.can_sleep    = false;
                ctlr->chip.base         = base;
                ctlr->chip.ngpio        = ngpio - base;
                if (ctlr->chip.ngpio > 32)
index 29e8e750bd49580acd38f36f748187d8c60566f7..8994dfa13491bd0bb2a94ac6c72606b61c572e30 100644 (file)
@@ -108,7 +108,7 @@ static int tps6586x_gpio_probe(struct platform_device *pdev)
        tps6586x_gpio->gpio_chip.label = pdev->name;
        tps6586x_gpio->gpio_chip.dev = &pdev->dev;
        tps6586x_gpio->gpio_chip.ngpio = 4;
-       tps6586x_gpio->gpio_chip.can_sleep = 1;
+       tps6586x_gpio->gpio_chip.can_sleep = true;
 
        /* FIXME: add handling of GPIOs as dedicated inputs */
        tps6586x_gpio->gpio_chip.direction_output = tps6586x_gpio_output;
index 06146219d9d21a06087634ae21ad1e7fbb8654e3..b6e818e680076c2041469d47e4ff03f7d7dee8c0 100644 (file)
@@ -143,7 +143,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
        default:
                return -EINVAL;
        }
-       tps65910_gpio->gpio_chip.can_sleep = 1;
+       tps65910_gpio->gpio_chip.can_sleep = true;
        tps65910_gpio->gpio_chip.direction_input = tps65910_gpio_input;
        tps65910_gpio->gpio_chip.direction_output = tps65910_gpio_output;
        tps65910_gpio->gpio_chip.set    = tps65910_gpio_set;
index 276a4229b032583379dd1490716dd98565c6bca3..59ee486cb8b918ea8e06f497d87e8e3e74c48261 100644 (file)
@@ -79,7 +79,7 @@ static struct gpio_chip template_chip = {
        .direction_output       = tps65912_gpio_output,
        .get                    = tps65912_gpio_get,
        .set                    = tps65912_gpio_set,
-       .can_sleep              = 1,
+       .can_sleep              = true,
        .ngpio                  = 5,
        .base                   = -1,
 };
index b97d6a6577b961d379a977e14a3c5c693cce5049..29f00a76bb92439e27e52a8fd40143e0f97031ce 100644 (file)
@@ -387,7 +387,7 @@ static struct gpio_chip template_chip = {
        .direction_output       = twl_direction_out,
        .set                    = twl_set,
        .to_irq                 = twl_to_irq,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 /*----------------------------------------------------------------------*/
index d420d30b86e73233314b74f36d8412b4e0c01166..0caf5cd1b47d5f87298edc2c1d859dfa2e6a4dbf 100644 (file)
@@ -77,7 +77,7 @@ static struct gpio_chip twl6040gpo_chip = {
        .get                    = twl6040gpo_get,
        .direction_output       = twl6040gpo_direction_out,
        .set                    = twl6040gpo_set,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 /*----------------------------------------------------------------------*/
index 06fb5cf99dede237bd29f109bbd195bfa2230f5b..2445fe771179797cbfedee338c43ac036ded74e6 100644 (file)
@@ -64,7 +64,7 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
        ucb->gc.direction_output = ucb1400_gpio_dir_out;
        ucb->gc.get = ucb1400_gpio_get;
        ucb->gc.set = ucb1400_gpio_set;
-       ucb->gc.can_sleep = 1;
+       ucb->gc.can_sleep = true;
 
        err = gpiochip_add(&ucb->gc);
        if (err)
index 5ac2919197fe70775f8d17fda5a6dafaab9af677..79e3b5836712b1fbbbff1c638751fa761ce3a480 100644 (file)
@@ -413,7 +413,7 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
        vb_gpio->gpioa.owner = THIS_MODULE;
        vb_gpio->gpioa.base = -1;
        vb_gpio->gpioa.ngpio = 16;
-       vb_gpio->gpioa.can_sleep = 1;
+       vb_gpio->gpioa.can_sleep = true;
        vb_gpio->gpioa.set = vprbrd_gpioa_set;
        vb_gpio->gpioa.get = vprbrd_gpioa_get;
        vb_gpio->gpioa.direction_input = vprbrd_gpioa_direction_input;
@@ -430,7 +430,7 @@ static int vprbrd_gpio_probe(struct platform_device *pdev)
        vb_gpio->gpiob.owner = THIS_MODULE;
        vb_gpio->gpiob.base = -1;
        vb_gpio->gpiob.ngpio = 16;
-       vb_gpio->gpiob.can_sleep = 1;
+       vb_gpio->gpiob.can_sleep = true;
        vb_gpio->gpiob.set = vprbrd_gpiob_set;
        vb_gpio->gpiob.get = vprbrd_gpiob_get;
        vb_gpio->gpiob.direction_input = vprbrd_gpiob_direction_input;
index cddfa22edb410dc3aaaff6ff0c616e812b339966..0fd23b6a753d92576c7b6e09c467aff5f59129e8 100644 (file)
@@ -214,7 +214,7 @@ static void vx855gpio_gpio_setup(struct vx855_gpio *vg)
        c->dbg_show = NULL;
        c->base = 0;
        c->ngpio = NR_VX855_GP;
-       c->can_sleep = 0;
+       c->can_sleep = false;
        c->names = vx855gpio_names;
 }
 
index 456000c5c4579fd380cb00c68b450b883e28dfb7..b18a1a26425ed81e1c676af88d8c5b7c4ca4e8bd 100644 (file)
@@ -240,7 +240,7 @@ static struct gpio_chip template_chip = {
        .to_irq                 = wm831x_gpio_to_irq,
        .set_debounce           = wm831x_gpio_set_debounce,
        .dbg_show               = wm831x_gpio_dbg_show,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 static int wm831x_gpio_probe(struct platform_device *pdev)
index fc49154be7b14a8bccf2b7aa58d078b7da939d22..2487f9d575d3013681274a46688864a4d6b3ec52 100644 (file)
@@ -106,7 +106,7 @@ static struct gpio_chip template_chip = {
        .direction_output       = wm8350_gpio_direction_out,
        .set                    = wm8350_gpio_set,
        .to_irq                 = wm8350_gpio_to_irq,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 static int wm8350_gpio_probe(struct platform_device *pdev)
index a53dbdefc7ee147c86255fa795c7bacfc1a42d0d..d93b6b581677cada67fba27bed58a66ef1ed89ad 100644 (file)
@@ -242,7 +242,7 @@ static struct gpio_chip template_chip = {
        .set                    = wm8994_gpio_set,
        .to_irq                 = wm8994_gpio_to_irq,
        .dbg_show               = wm8994_gpio_dbg_show,
-       .can_sleep              = 1,
+       .can_sleep              = true,
 };
 
 static int wm8994_gpio_probe(struct platform_device *pdev)
index 85f772c0b26a619ec9c563f77f35c22fb8975e7f..44a2327011795ec4c3a540520d25dcd5b0909075 100644 (file)
@@ -151,9 +151,10 @@ EXPORT_SYMBOL_GPL(gpio_to_desc);
 static struct gpio_desc *gpiochip_offset_to_desc(struct gpio_chip *chip,
                                                 unsigned int offset)
 {
-       unsigned int gpio = chip->base + offset;
+       if (offset >= chip->ngpio)
+               return ERR_PTR(-EINVAL);
 
-       return gpio_to_desc(gpio);
+       return &chip->desc[offset];
 }
 
 /**
@@ -1051,7 +1052,7 @@ static void gpiochip_unexport(struct gpio_chip *chip)
        if (dev) {
                put_device(dev);
                device_unregister(dev);
-               chip->exported = 0;
+               chip->exported = false;
                status = 0;
        } else
                status = -ENODEV;
index 01bffc1d52fd278a9adfa37420e6b792c83531df..b80f1e150f53084409b8929bdea3d2d585c159cc 100644 (file)
@@ -531,7 +531,7 @@ static const struct gpio_chip as3722_gpio_chip = {
        .direction_input        = as3722_gpio_direction_input,
        .direction_output       = as3722_gpio_direction_output,
        .to_irq                 = as3722_gpio_to_irq,
-       .can_sleep              = 1,
+       .can_sleep              = true,
        .ngpio                  = AS3722_PIN_NUM,
        .base                   = -1,
 };
index a7549c4c83b43da6d5c6d108eeec41f95d7710e8..943805185f3f2c4a05b991913cd45d9f51cf030d 100644 (file)
@@ -1527,7 +1527,7 @@ static struct gpio_chip at91_gpio_template = {
        .set                    = at91_gpio_set,
        .to_irq                 = at91_gpio_to_irq,
        .dbg_show               = at91_gpio_dbg_show,
-       .can_sleep              = 0,
+       .can_sleep              = false,
        .ngpio                  = MAX_NB_GPIO_PER_BANK,
 };
 
index 2832576d8b12ee7c99e24896c3fe333dd8cffadc..31c8b3257a945e10b9761d14a850ac5690b3f149 100644 (file)
@@ -461,7 +461,7 @@ static int byt_gpio_probe(struct platform_device *pdev)
        gc->set = byt_gpio_set;
        gc->dbg_show = byt_gpio_dbg_show;
        gc->base = -1;
-       gc->can_sleep = 0;
+       gc->can_sleep = false;
        gc->dev = dev;
 
        ret = gpiochip_add(gc);
index c05c1ef2cc3c8526a886ccefb3f874f795b40807..3d907de9bc91501cc7a83ccd7cfab487bbcab265 100644 (file)
@@ -384,7 +384,7 @@ static struct gpio_chip bcm2835_gpio_chip = {
        .to_irq = bcm2835_gpio_to_irq,
        .base = -1,
        .ngpio = BCM2835_NUM_GPIOS,
-       .can_sleep = 0,
+       .can_sleep = false,
 };
 
 static irqreturn_t bcm2835_gpio_irq_handler(int irq, void *dev_id)
index 7111c3b591303cec2f3daa36d22329989c0847b9..a21820fc4b7c0818f457ed0e8f3cf43fc1869687 100644 (file)
@@ -904,7 +904,7 @@ static struct gpio_chip nmk_gpio_template = {
        .set                    = nmk_gpio_set_output,
        .to_irq                 = nmk_gpio_to_irq,
        .dbg_show               = nmk_gpio_dbg_show,
-       .can_sleep              = 0,
+       .can_sleep              = false,
 };
 
 void nmk_gpio_clocks_enable(void)
index 119d2ddedfe70c2aed27398289c8d1b2b484b160..6b181cb90d39a16e621abd3f001377d91f00d3af 100644 (file)
@@ -547,7 +547,7 @@ static struct gpio_chip sunxi_pinctrl_gpio_chip = {
        .of_xlate               = sunxi_pinctrl_gpio_of_xlate,
        .to_irq                 = sunxi_pinctrl_gpio_to_irq,
        .of_gpio_n_cells        = 3,
-       .can_sleep              = 0,
+       .can_sleep              = false,
 };
 
 static int sunxi_pinctrl_irq_set_type(struct irq_data *d,
index 39aec08508106f21dd515063ae0aa41ca4221367..b28d1af9c2320642c8ee855b07eb15c2355c4948 100644 (file)
@@ -565,7 +565,7 @@ static struct gpio_chip wmt_gpio_chip = {
        .direction_output = wmt_gpio_direction_output,
        .get = wmt_gpio_get_value,
        .set = wmt_gpio_set_value,
-       .can_sleep = 0,
+       .can_sleep = false,
 };
 
 int wmt_pinctrl_probe(struct platform_device *pdev,
index 13dfd24d01abc0d156e9cfa553f6b41aac96cb5f..b581b13d29d95aef275b1b878927f5d94e2572e4 100644 (file)
@@ -90,7 +90,6 @@ void devm_gpio_free(struct device *dev, unsigned int gpio);
 
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <linux/errno.h>
 #include <linux/bug.h>
 #include <linux/pinctrl/pinctrl.h>
 
index 3ea2cf6b0e6ce444f732e489fbf97c8a44969515..c849676c6787515f560dba91bff7a8b16346dd91 100644 (file)
@@ -39,14 +39,15 @@ struct seq_file;
  * @ngpio: the number of GPIOs handled by this controller; the last GPIO
  *     handled is (base + ngpio - 1).
  * @desc: array of ngpio descriptors. Private.
- * @can_sleep: flag must be set iff get()/set() methods sleep, as they
- *     must while accessing GPIO expander chips over I2C or SPI
  * @names: if set, must be an array of strings to use as alternative
  *      names for the GPIOs in this chip. Any entry in the array
  *      may be NULL if there is no alias for the GPIO, however the
  *      array must be @ngpio entries long.  A name can include a single printk
  *      format specifier for an unsigned int.  It is substituted by the actual
  *      number of the gpio.
+ * @can_sleep: flag must be set iff get()/set() methods sleep, as they
+ *     must while accessing GPIO expander chips over I2C or SPI
+ * @exported: flags if the gpiochip is exported for use from sysfs. Private.
  *
  * A gpio_chip can help platforms abstract various sources of GPIOs so
  * they can all be accessed through a common programing interface.
@@ -91,8 +92,8 @@ struct gpio_chip {
        u16                     ngpio;
        struct gpio_desc        *desc;
        const char              *const *names;
-       unsigned                can_sleep:1;
-       unsigned                exported:1;
+       bool                    can_sleep;
+       bool                    exported;
 
 #if defined(CONFIG_OF_GPIO)
        /*
diff --git a/include/linux/platform_data/gpio-lpc32xx.h b/include/linux/platform_data/gpio-lpc32xx.h
new file mode 100644 (file)
index 0000000..a544e96
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Author: Kevin Wells <kevin.wells@nxp.com>
+ *
+ * Copyright (C) 2010 NXP Semiconductors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MACH_GPIO_LPC32XX_H
+#define __MACH_GPIO_LPC32XX_H
+
+/*
+ * Note!
+ * Muxed GP pins need to be setup to the GP state in the board level
+ * code prior to using this driver.
+ * GPI pins : 28xP3 group
+ * GPO pins : 24xP3 group
+ * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
+ */
+
+#define LPC32XX_GPIO_P0_MAX 8
+#define LPC32XX_GPIO_P1_MAX 24
+#define LPC32XX_GPIO_P2_MAX 13
+#define LPC32XX_GPIO_P3_MAX 6
+#define LPC32XX_GPI_P3_MAX 29
+#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 */
This page took 0.078986 seconds and 5 git commands to generate.