aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2013-02-05 08:33:49 -0500
committerGrant Likely <grant.likely@secretlab.ca>2013-02-05 08:37:46 -0500
commit0fa2fd9a0d4f1305a54a396d44975894e90eed7b (patch)
tree56045663b63cb29c2515e0c87519ff10398c4ab0
parent46ebfbc3745597067494186a0e7031add22f3134 (diff)
parent476171ce7850b28280db6a2d0c0e4d3ff26c8117 (diff)
Merge branch 'linusw/devel' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git into gpio/next
Device driver features, cleanups and bug fixes. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--arch/arm/mach-pxa/tosa.c6
-rw-r--r--drivers/gpio/Kconfig3
-rw-r--r--drivers/gpio/Makefile3
-rw-r--r--drivers/gpio/gpio-mpc8xxx.c1
-rw-r--r--drivers/gpio/gpio-mxs.c31
-rw-r--r--drivers/gpio/gpio-pca953x.c380
-rw-r--r--drivers/gpio/gpio-pl061.c2
-rw-r--r--drivers/gpio/gpio-pxa.c7
-rw-r--r--drivers/gpio/gpio-twl4030.c176
-rw-r--r--drivers/gpio/gpio-vt8500.c4
-rw-r--r--drivers/gpio/gpiolib-acpi.c87
-rw-r--r--drivers/gpio/gpiolib.c63
-rw-r--r--include/asm-generic/gpio.h81
-rw-r--r--include/linux/acpi_gpio.h4
-rw-r--r--include/linux/gpio.h28
15 files changed, 512 insertions, 364 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 233629edf7ee..4f35b333de44 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -927,8 +927,6 @@ static void tosa_restart(char mode, const char *cmd)
927 927
928static void __init tosa_init(void) 928static void __init tosa_init(void)
929{ 929{
930 int dummy;
931
932 pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); 930 pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
933 931
934 pxa_set_ffuart_info(NULL); 932 pxa_set_ffuart_info(NULL);
@@ -947,10 +945,6 @@ static void __init tosa_init(void)
947 /* enable batt_fault */ 945 /* enable batt_fault */
948 PMCR = 0x01; 946 PMCR = 0x01;
949 947
950 dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12);
951 dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12);
952 dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16);
953
954 pxa_set_mci_info(&tosa_mci_platform_data); 948 pxa_set_mci_info(&tosa_mci_platform_data);
955 pxa_set_ficp_info(&tosa_ficp_platform_data); 949 pxa_set_ficp_info(&tosa_ficp_platform_data);
956 pxa_set_i2c_info(NULL); 950 pxa_set_i2c_info(NULL);
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 3a6714539201..ab97eb805379 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -30,6 +30,9 @@ config ARCH_REQUIRE_GPIOLIB
30 Selecting this from the architecture code will cause the gpiolib 30 Selecting this from the architecture code will cause the gpiolib
31 code to always get built in. 31 code to always get built in.
32 32
33config GPIO_DEVRES
34 def_bool y
35 depends on HAS_IOMEM
33 36
34 37
35menuconfig GPIOLIB 38menuconfig GPIOLIB
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 519daaf57daf..4398034db4aa 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -2,7 +2,8 @@
2 2
3ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG 3ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG
4 4
5obj-$(CONFIG_GPIOLIB) += gpiolib.o devres.o 5obj-$(CONFIG_GPIO_DEVRES) += devres.o
6obj-$(CONFIG_GPIOLIB) += gpiolib.o
6obj-$(CONFIG_OF_GPIO) += gpiolib-of.o 7obj-$(CONFIG_OF_GPIO) += gpiolib-of.o
7obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o 8obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o
8 9
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 9ae29cc0d17f..a0b33a216d4a 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -292,7 +292,6 @@ static int mpc8xxx_gpio_irq_map(struct irq_domain *h, unsigned int virq,
292 292
293 irq_set_chip_data(virq, h->host_data); 293 irq_set_chip_data(virq, h->host_data);
294 irq_set_chip_and_handler(virq, &mpc8xxx_irq_chip, handle_level_irq); 294 irq_set_chip_and_handler(virq, &mpc8xxx_irq_chip, handle_level_irq);
295 irq_set_irq_type(virq, IRQ_TYPE_NONE);
296 295
297 return 0; 296 return 0;
298} 297}
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index fa2a63cad32e..859b6fabc7bc 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -65,6 +65,7 @@ struct mxs_gpio_port {
65 struct irq_domain *domain; 65 struct irq_domain *domain;
66 struct bgpio_chip bgc; 66 struct bgpio_chip bgc;
67 enum mxs_gpio_id devid; 67 enum mxs_gpio_id devid;
68 u32 both_edges;
68}; 69};
69 70
70static inline int is_imx23_gpio(struct mxs_gpio_port *port) 71static inline int is_imx23_gpio(struct mxs_gpio_port *port)
@@ -81,13 +82,23 @@ static inline int is_imx28_gpio(struct mxs_gpio_port *port)
81 82
82static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type) 83static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type)
83{ 84{
85 u32 val;
84 u32 pin_mask = 1 << d->hwirq; 86 u32 pin_mask = 1 << d->hwirq;
85 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 87 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
86 struct mxs_gpio_port *port = gc->private; 88 struct mxs_gpio_port *port = gc->private;
87 void __iomem *pin_addr; 89 void __iomem *pin_addr;
88 int edge; 90 int edge;
89 91
92 port->both_edges &= ~pin_mask;
90 switch (type) { 93 switch (type) {
94 case IRQ_TYPE_EDGE_BOTH:
95 val = gpio_get_value(port->bgc.gc.base + d->hwirq);
96 if (val)
97 edge = GPIO_INT_FALL_EDGE;
98 else
99 edge = GPIO_INT_RISE_EDGE;
100 port->both_edges |= pin_mask;
101 break;
91 case IRQ_TYPE_EDGE_RISING: 102 case IRQ_TYPE_EDGE_RISING:
92 edge = GPIO_INT_RISE_EDGE; 103 edge = GPIO_INT_RISE_EDGE;
93 break; 104 break;
@@ -124,6 +135,23 @@ static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type)
124 return 0; 135 return 0;
125} 136}
126 137
138static void mxs_flip_edge(struct mxs_gpio_port *port, u32 gpio)
139{
140 u32 bit, val, edge;
141 void __iomem *pin_addr;
142
143 bit = 1 << gpio;
144
145 pin_addr = port->base + PINCTRL_IRQPOL(port);
146 val = readl(pin_addr);
147 edge = val & bit;
148
149 if (edge)
150 writel(bit, pin_addr + MXS_CLR);
151 else
152 writel(bit, pin_addr + MXS_SET);
153}
154
127/* MXS has one interrupt *per* gpio port */ 155/* MXS has one interrupt *per* gpio port */
128static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc) 156static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc)
129{ 157{
@@ -137,6 +165,9 @@ static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc)
137 165
138 while (irq_stat != 0) { 166 while (irq_stat != 0) {
139 int irqoffset = fls(irq_stat) - 1; 167 int irqoffset = fls(irq_stat) - 1;
168 if (port->both_edges & (1 << irqoffset))
169 mxs_flip_edge(port, irqoffset);
170
140 generic_handle_irq(irq_find_mapping(port->domain, irqoffset)); 171 generic_handle_irq(irq_find_mapping(port->domain, irqoffset));
141 irq_stat &= ~(1 << irqoffset); 172 irq_stat &= ~(1 << irqoffset);
142 } 173 }
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index cc102d25ee24..24059462c87f 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -46,6 +46,7 @@
46#define PCA957X_TYPE 0x2000 46#define PCA957X_TYPE 0x2000
47 47
48static const struct i2c_device_id pca953x_id[] = { 48static const struct i2c_device_id pca953x_id[] = {
49 { "pca9505", 40 | PCA953X_TYPE | PCA_INT, },
49 { "pca9534", 8 | PCA953X_TYPE | PCA_INT, }, 50 { "pca9534", 8 | PCA953X_TYPE | PCA_INT, },
50 { "pca9535", 16 | PCA953X_TYPE | PCA_INT, }, 51 { "pca9535", 16 | PCA953X_TYPE | PCA_INT, },
51 { "pca9536", 4 | PCA953X_TYPE, }, 52 { "pca9536", 4 | PCA953X_TYPE, },
@@ -71,19 +72,23 @@ static const struct i2c_device_id pca953x_id[] = {
71}; 72};
72MODULE_DEVICE_TABLE(i2c, pca953x_id); 73MODULE_DEVICE_TABLE(i2c, pca953x_id);
73 74
75#define MAX_BANK 5
76#define BANK_SZ 8
77
78#define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ)
79
74struct pca953x_chip { 80struct pca953x_chip {
75 unsigned gpio_start; 81 unsigned gpio_start;
76 u32 reg_output; 82