aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/Kconfig21
-rw-r--r--drivers/gpio/Makefile4
-rw-r--r--drivers/gpio/gpio-adp5520.c12
-rw-r--r--drivers/gpio/gpio-adp5588.c5
-rw-r--r--drivers/gpio/gpio-bt8xx.c3
-rw-r--r--drivers/gpio/gpio-cs5535.c14
-rw-r--r--drivers/gpio/gpio-da9052.c33
-rw-r--r--drivers/gpio/gpio-generic.c12
-rw-r--r--drivers/gpio/gpio-janz-ttl.c15
-rw-r--r--drivers/gpio/gpio-ml-ioh.c32
-rw-r--r--drivers/gpio/gpio-mpc8xxx.c18
-rw-r--r--drivers/gpio/gpio-nomadik.c4
-rw-r--r--drivers/gpio/gpio-pca953x.c4
-rw-r--r--drivers/gpio/gpio-pcf857x.c5
-rw-r--r--drivers/gpio/gpio-pch.c7
-rw-r--r--drivers/gpio/gpio-pl061.c6
-rw-r--r--drivers/gpio/gpio-pxa.c377
-rw-r--r--drivers/gpio/gpio-rdc321x.c13
-rw-r--r--drivers/gpio/gpio-samsung.c105
-rw-r--r--drivers/gpio/gpio-sch.c13
-rw-r--r--drivers/gpio/gpio-timberdale.c13
-rw-r--r--drivers/gpio/gpio-ucb1400.c13
-rw-r--r--drivers/gpio/gpio-vr41xx.c13
-rw-r--r--drivers/gpio/gpio-vx855.c12
-rw-r--r--drivers/gpio/gpio-wm8994.c79
-rw-r--r--drivers/gpio/gpio-xilinx.c1
-rw-r--r--drivers/gpio/gpiolib.c6
27 files changed, 594 insertions, 246 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 0f82aa8fa158..573532f7553e 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -70,7 +70,7 @@ config GPIO_GENERIC
70 70
71config GPIO_DA9052 71config GPIO_DA9052
72 tristate "Dialog DA9052 GPIO" 72 tristate "Dialog DA9052 GPIO"
73 depends on PMIC_DA9052 73 depends on PMIC_DA9052 && BROKEN
74 help 74 help
75 Say yes here to enable the GPIO driver for the DA9052 chip. 75 Say yes here to enable the GPIO driver for the DA9052 chip.
76 76
@@ -141,6 +141,12 @@ config GPIO_PL061
141 help 141 help
142 Say yes here to support the PrimeCell PL061 GPIO device 142 Say yes here to support the PrimeCell PL061 GPIO device
143 143
144config GPIO_PXA
145 bool "PXA GPIO support"
146 depends on ARCH_PXA || ARCH_MMP
147 help
148 Say yes here to support the PXA GPIO device
149
144config GPIO_XILINX 150config GPIO_XILINX
145 bool "Xilinx GPIO support" 151 bool "Xilinx GPIO support"
146 depends on PPC_OF || MICROBLAZE 152 depends on PPC_OF || MICROBLAZE
@@ -347,7 +353,7 @@ comment "PCI GPIO expanders:"
347 353
348config GPIO_CS5535 354config GPIO_CS5535
349 tristate "AMD CS5535/CS5536 GPIO support" 355 tristate "AMD CS5535/CS5536 GPIO support"
350 depends on PCI && X86 && !CS5535_GPIO && MFD_CS5535 356 depends on PCI && X86 && MFD_CS5535
351 help 357 help
352 The AMD CS5535 and CS5536 southbridges support 28 GPIO pins that 358 The AMD CS5535 and CS5536 southbridges support 28 GPIO pins that
353 can be used for quite a number of things. The CS5535/6 is found on 359 can be used for quite a number of things. The CS5535/6 is found on
@@ -378,7 +384,7 @@ config GPIO_LANGWELL
378 Say Y here to support Intel Langwell/Penwell GPIO. 384 Say Y here to support Intel Langwell/Penwell GPIO.
379 385
380config GPIO_PCH 386config GPIO_PCH
381 tristate "Intel EG20T PCH / OKI SEMICONDUCTOR ML7223 IOH GPIO" 387 tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7223/ML7831) GPIO"
382 depends on PCI && X86 388 depends on PCI && X86
383 select GENERIC_IRQ_CHIP 389 select GENERIC_IRQ_CHIP
384 help 390 help
@@ -386,11 +392,12 @@ config GPIO_PCH
386 which is an IOH(Input/Output Hub) for x86 embedded processor. 392 which is an IOH(Input/Output Hub) for x86 embedded processor.
387 This driver can access PCH GPIO device. 393 This driver can access PCH GPIO device.
388 394
389 This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ 395 This driver also can be used for LAPIS Semiconductor IOH(Input/
390 Output Hub), ML7223. 396 Output Hub), ML7223 and ML7831.
391 ML7223 IOH is for MP(Media Phone) use. 397 ML7223 IOH is for MP(Media Phone) use.
392 ML7223 is companion chip for Intel Atom E6xx series. 398 ML7831 IOH is for general purpose use.
393 ML7223 is completely compatible for Intel EG20T PCH. 399 ML7223/ML7831 is companion chip for Intel Atom E6xx series.
400 ML7223/ML7831 is completely compatible for Intel EG20T PCH.
394 401
395config GPIO_ML_IOH 402config GPIO_ML_IOH
396 tristate "OKI SEMICONDUCTOR ML7213 IOH GPIO support" 403 tristate "OKI SEMICONDUCTOR ML7213 IOH GPIO support"
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 7f20316fb156..62e641e79e8f 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o
18obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o 18obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o
19obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o 19obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o
20obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o 20obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
21obj-$(CONFIG_MACH_KS8695) += gpio-ks8695.o 21obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o
22obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o 22obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o
23obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o 23obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
24obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o 24obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o
@@ -40,7 +40,7 @@ obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o
40obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o 40obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o
41obj-$(CONFIG_GPIO_PCH) += gpio-pch.o 41obj-$(CONFIG_GPIO_PCH) += gpio-pch.o
42obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o 42obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
43obj-$(CONFIG_PLAT_PXA) += gpio-pxa.o 43obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
44obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o 44obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
45obj-$(CONFIG_PLAT_SAMSUNG) += gpio-samsung.o 45obj-$(CONFIG_PLAT_SAMSUNG) += gpio-samsung.o
46obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o 46obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index 9f2781537001..2f263cc32561 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -193,17 +193,7 @@ static struct platform_driver adp5520_gpio_driver = {
193 .remove = __devexit_p(adp5520_gpio_remove), 193 .remove = __devexit_p(adp5520_gpio_remove),
194}; 194};
195 195
196static int __init adp5520_gpio_init(void) 196module_platform_driver(adp5520_gpio_driver);
197{
198 return platform_driver_register(&adp5520_gpio_driver);
199}
200module_init(adp5520_gpio_init);
201
202static void __exit adp5520_gpio_exit(void)
203{
204 platform_driver_unregister(&adp5520_gpio_driver);
205}
206module_exit(adp5520_gpio_exit);
207 197
208MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 198MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
209MODULE_DESCRIPTION("GPIO ADP5520 Driver"); 199MODULE_DESCRIPTION("GPIO ADP5520 Driver");
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c
index 3525ad918771..9ad1703d1408 100644
--- a/drivers/gpio/gpio-adp5588.c
+++ b/drivers/gpio/gpio-adp5588.c
@@ -418,9 +418,8 @@ static int __devinit adp5588_gpio_probe(struct i2c_client *client,
418 if (ret) 418 if (ret)
419 goto err_irq; 419 goto err_irq;
420 420
421 dev_info(&client->dev, "gpios %d..%d (IRQ Base %d) on a %s Rev. %d\n", 421 dev_info(&client->dev, "IRQ Base: %d Rev.: %d\n",
422 gc->base, gc->base + gc->ngpio - 1, 422 pdata->irq_base, revid);
423 pdata->irq_base, client->name, revid);
424 423
425 if (pdata->setup) { 424 if (pdata->setup) {
426 ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context); 425 ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context);
diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c
index ec57936aef62..5ca4098ba092 100644
--- a/drivers/gpio/gpio-bt8xx.c
+++ b/drivers/gpio/gpio-bt8xx.c
@@ -223,9 +223,6 @@ static int bt8xxgpio_probe(struct pci_dev *dev,
223 goto err_release_mem; 223 goto err_release_mem;
224 } 224 }
225 225
226 printk(KERN_INFO "bt8xxgpio: Abusing BT8xx card for GPIOs %d to %d\n",
227 bg->gpio.base, bg->gpio.base + BT8XXGPIO_NR_GPIOS - 1);
228
229 return 0; 226 return 0;
230 227
231err_release_mem: 228err_release_mem:
diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c
index 6e16cba56ad2..19eda1bbe343 100644
--- a/drivers/gpio/gpio-cs5535.c
+++ b/drivers/gpio/gpio-cs5535.c
@@ -347,7 +347,6 @@ static int __devinit cs5535_gpio_probe(struct platform_device *pdev)
347 if (err) 347 if (err)
348 goto release_region; 348 goto release_region;
349 349
350 dev_info(&pdev->dev, "GPIO support successfully loaded.\n");
351 return 0; 350 return 0;
352 351
353release_region: 352release_region:
@@ -382,18 +381,7 @@ static struct platform_driver cs5535_gpio_driver = {
382 .remove = __devexit_p(cs5535_gpio_remove), 381 .remove = __devexit_p(cs5535_gpio_remove),
383}; 382};
384 383
385static int __init cs5535_gpio_init(void) 384module_platform_driver(cs5535_gpio_driver);
386{
387 return platform_driver_register(&cs5535_gpio_driver);
388}
389
390static void __exit cs5535_gpio_exit(void)
391{
392 platform_driver_unregister(&cs5535_gpio_driver);
393}
394
395module_init(cs5535_gpio_init);
396module_exit(cs5535_gpio_exit);
397 385
398MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>"); 386MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
399MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver"); 387MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index 038f5eb8b13d..56dd047d5844 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -22,7 +22,6 @@
22#include <linux/mfd/da9052/da9052.h> 22#include <linux/mfd/da9052/da9052.h>
23#include <linux/mfd/da9052/reg.h> 23#include <linux/mfd/da9052/reg.h>
24#include <linux/mfd/da9052/pdata.h> 24#include <linux/mfd/da9052/pdata.h>
25#include <linux/mfd/da9052/gpio.h>
26 25
27#define DA9052_INPUT 1 26#define DA9052_INPUT 1
28#define DA9052_OUTPUT_OPENDRAIN 2 27#define DA9052_OUTPUT_OPENDRAIN 2
@@ -43,6 +42,9 @@
43#define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 42#define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0
44#define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F 43#define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F
45#define DA9052_GPIO_NIBBLE_SHIFT 4 44#define DA9052_GPIO_NIBBLE_SHIFT 4
45#define DA9052_IRQ_GPI0 16
46#define DA9052_GPIO_ODD_SHIFT 7
47#define DA9052_GPIO_EVEN_SHIFT 3
46 48
47struct da9052_gpio { 49struct da9052_gpio {
48 struct da9052 *da9052; 50 struct da9052 *da9052;
@@ -104,33 +106,26 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset)
104static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 106static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
105{ 107{
106 struct da9052_gpio *gpio = to_da9052_gpio(gc); 108 struct da9052_gpio *gpio = to_da9052_gpio(gc);
107 unsigned char register_value = 0;
108 int ret; 109 int ret;
109 110
110 if (da9052_gpio_port_odd(offset)) { 111 if (da9052_gpio_port_odd(offset)) {
111 if (value) {
112 register_value = DA9052_GPIO_ODD_PORT_MODE;
113 ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 112 ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
114 DA9052_GPIO_0_1_REG, 113 DA9052_GPIO_0_1_REG,
115 DA9052_GPIO_ODD_PORT_MODE, 114 DA9052_GPIO_ODD_PORT_MODE,
116 register_value); 115 value << DA9052_GPIO_ODD_SHIFT);
117 if (ret != 0) 116 if (ret != 0)
118 dev_err(gpio->da9052->dev, 117 dev_err(gpio->da9052->dev,
119 "Failed to updated gpio odd reg,%d", 118 "Failed to updated gpio odd reg,%d",
120 ret); 119 ret);
121 }
122 } else { 120 } else {
123 if (value) {
124 register_value = DA9052_GPIO_EVEN_PORT_MODE;
125 ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 121 ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
126 DA9052_GPIO_0_1_REG, 122 DA9052_GPIO_0_1_REG,
127 DA9052_GPIO_EVEN_PORT_MODE, 123 DA9052_GPIO_EVEN_PORT_MODE,
128 register_value); 124 value << DA9052_GPIO_EVEN_SHIFT);
129 if (ret != 0) 125 if (ret != 0)
130 dev_err(gpio->da9052->dev, 126 dev_err(gpio->da9052->dev,
131 "Failed to updated gpio even reg,%d", 127 "Failed to updated gpio even reg,%d",
132 ret); 128 ret);
133 }
134 } 129 }
135} 130}
136 131
@@ -201,9 +196,9 @@ static struct gpio_chip reference_gp __devinitdata = {
201 .direction_input = da9052_gpio_direction_input, 196 .direction_input = da9052_gpio_direction_input,
202 .direction_output = da9052_gpio_direction_output, 197 .direction_output = da9052_gpio_direction_output,
203 .to_irq = da9052_gpio_to_irq, 198 .to_irq = da9052_gpio_to_irq,
204 .can_sleep = 1; 199 .can_sleep = 1,
205 .ngpio = 16; 200 .ngpio = 16,
206 .base = -1; 201 .base = -1,
207}; 202};
208 203
209static int __devinit da9052_gpio_probe(struct platform_device *pdev) 204static int __devinit da9052_gpio_probe(struct platform_device *pdev)
@@ -259,17 +254,7 @@ static struct platform_driver da9052_gpio_driver = {
259 }, 254 },
260}; 255};
261 256
262static int __init da9052_gpio_init(void) 257module_platform_driver(da9052_gpio_driver);
263{
264 return platform_driver_register(&da9052_gpio_driver);
265}
266module_init(da9052_gpio_init);
267
268static void __exit da9052_gpio_exit(void)
269{
270 return platform_driver_unregister(&da9052_gpio_driver);
271}
272module_exit(da9052_gpio_exit);
273 258
274MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>"); 259MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
275MODULE_DESCRIPTION("DA9052 GPIO Device Driver"); 260MODULE_DESCRIPTION("DA9052 GPIO Device Driver");
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index 4e24436b0f82..e38dd0c31973 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -524,17 +524,7 @@ static struct platform_driver bgpio_driver = {
524 .remove = __devexit_p(bgpio_pdev_remove), 524 .remove = __devexit_p(bgpio_pdev_remove),
525}; 525};
526 526
527static int __init bgpio_platform_init(void) 527module_platform_driver(bgpio_driver);
528{
529 return platform_driver_register(&bgpio_driver);
530}
531module_init(bgpio_platform_init);
532
533static void __exit bgpio_platform_exit(void)
534{
535 platform_driver_unregister(&bgpio_driver);
536}
537module_exit(bgpio_platform_exit);
538 528
539#endif /* CONFIG_GPIO_GENERIC_PLATFORM */ 529#endif /* CONFIG_GPIO_GENERIC_PLATFORM */
540 530
diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c
index 813ac077e5d7..f2f000dd70b3 100644
--- a/drivers/gpio/gpio-janz-ttl.c
+++ b/drivers/gpio/gpio-janz-ttl.c
@@ -201,8 +201,6 @@ static int __devinit ttl_probe(struct platform_device *pdev)
201 goto out_iounmap_regs; 201 goto out_iounmap_regs;
202 } 202 }
203 203
204 dev_info(&pdev->dev, "module %d: registered GPIO device\n",
205 pdata->modno);
206 return 0; 204 return 0;
207 205
208out_iounmap_regs: 206out_iounmap_regs:
@@ -239,20 +237,9 @@ static struct platform_driver ttl_driver = {
239 .remove = __devexit_p(ttl_remove), 237 .remove = __devexit_p(ttl_remove),
240}; 238};
241 239
242static int __init ttl_init(void) 240module_platform_driver(ttl_driver);
243{
244 return platform_driver_register(&ttl_driver);
245}
246
247static void __exit ttl_exit(void)
248{
249 platform_driver_unregister(&ttl_driver);
250}
251 241
252MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>"); 242MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
253MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver"); 243MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver");
254MODULE_LICENSE("GPL"); 244MODULE_LICENSE("GPL");
255MODULE_ALIAS("platform:janz-ttl"); 245MODULE_ALIAS("platform:janz-ttl");
256
257module_init(ttl_init);
258module_exit(ttl_exit);
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
index ea8e73869250..461958fc2264 100644
--- a/drivers/gpio/gpio-ml-ioh.c
+++ b/drivers/gpio/gpio-ml-ioh.c
@@ -332,6 +332,34 @@ static void ioh_irq_mask(struct irq_data *d)
332 &chip->reg->regs[chip->ch].imask); 332 &chip->reg->regs[chip->ch].imask);
333} 333}
334 334
335static void ioh_irq_disable(struct irq_data *d)
336{
337 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
338 struct ioh_gpio *chip = gc->private;
339 unsigned long flags;
340 u32 ien;
341
342 spin_lock_irqsave(&chip->spinlock, flags);
343 ien = ioread32(&chip->reg->regs[chip->ch].ien);
344 ien &= ~(1 << (d->irq - chip->irq_base));
345 iowrite32(ien, &chip->reg->regs[chip->ch].ien);
346 spin_unlock_irqrestore(&chip->spinlock, flags);
347}
348
349static void ioh_irq_enable(struct irq_data *d)
350{
351 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
352 struct ioh_gpio *chip = gc->private;
353 unsigned long flags;
354 u32 ien;
355
356 spin_lock_irqsave(&chip->spinlock, flags);
357 ien = ioread32(&chip->reg->regs[chip->ch].ien);
358 ien |= 1 << (d->irq - chip->irq_base);
359 iowrite32(ien, &chip->reg->regs[chip->ch].ien);
360 spin_unlock_irqrestore(&chip->spinlock, flags);
361}
362
335static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) 363static irqreturn_t ioh_gpio_handler(int irq, void *dev_id)
336{ 364{
337 struct ioh_gpio *chip = dev_id; 365 struct ioh_gpio *chip = dev_id;
@@ -339,7 +367,7 @@ static irqreturn_t ioh_gpio_handler(int irq, void *dev_id)
339 int i, j; 367 int i, j;
340 int ret = IRQ_NONE; 368 int ret = IRQ_NONE;
341 369
342 for (i = 0; i < 8; i++) { 370 for (i = 0; i < 8; i++, chip++) {
343 reg_val = ioread32(&chip->reg->regs[i].istatus); 371 reg_val = ioread32(&chip->reg->regs[i].istatus);
344 for (j = 0; j < num_ports[i]; j++) { 372 for (j = 0; j < num_ports[i]; j++) {
345 if (reg_val & BIT(j)) { 373 if (reg_val & BIT(j)) {
@@ -370,6 +398,8 @@ static __devinit void ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip,
370 ct->chip.irq_mask = ioh_irq_mask; 398 ct->chip.irq_mask = ioh_irq_mask;
371 ct->chip.irq_unmask = ioh_irq_unmask; 399 ct->chip.irq_unmask = ioh_irq_unmask;
372 ct->chip.irq_set_type = ioh_irq_type; 400 ct->chip.irq_set_type = ioh_irq_type;
401 ct->chip.irq_disable = ioh_irq_disable;
402 ct->chip.irq_enable = ioh_irq_enable;
373 403
374 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, 404 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
375 IRQ_NOREQUEST | IRQ_NOPROBE, 0); 405 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index ec3fcf0a7e12..5cd04b65c556 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -132,6 +132,15 @@ static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val
132 return 0; 132 return 0;
133} 133}
134 134
135static int mpc5121_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
136{
137 /* GPIO 28..31 are input only on MPC5121 */
138 if (gpio >= 28)
139 return -EINVAL;
140
141 return mpc8xxx_gpio_dir_out(gc, gpio, val);
142}
143
135static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset) 144static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
136{ 145{
137 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); 146 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
@@ -340,11 +349,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
340 mm_gc->save_regs = mpc8xxx_gpio_save_regs; 349 mm_gc->save_regs = mpc8xxx_gpio_save_regs;
341 gc->ngpio = MPC8XXX_GPIO_PINS; 350 gc->ngpio = MPC8XXX_GPIO_PINS;
342 gc->direction_input = mpc8xxx_gpio_dir_in; 351 gc->direction_input = mpc8xxx_gpio_dir_in;
343 gc->direction_output = mpc8xxx_gpio_dir_out; 352 gc->direction_output = of_device_is_compatible(np, "fsl,mpc5121-gpio") ?
344 if (of_device_is_compatible(np, "fsl,mpc8572-gpio")) 353 mpc5121_gpio_dir_out : mpc8xxx_gpio_dir_out;
345 gc->get = mpc8572_gpio_get; 354 gc->get = of_device_is_compatible(np, "fsl,mpc8572-gpio") ?
346 else 355 mpc8572_gpio_get : mpc8xxx_gpio_get;
347 gc->get = mpc8xxx_gpio_get;
348 gc->set = mpc8xxx_gpio_set; 356 gc->set = mpc8xxx_gpio_set;
349 gc->to_irq = mpc8xxx_gpio_to_irq; 357 gc->to_irq = mpc8xxx_gpio_to_irq;
350 358
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index 1ebedfb6d46d..839624f9fe6a 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -1150,8 +1150,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
1150 1150
1151 nmk_gpio_init_irq(nmk_chip); 1151 nmk_gpio_init_irq(nmk_chip);
1152 1152
1153 dev_info(&dev->dev, "Bits %i-%i at address %p\n", 1153 dev_info(&dev->dev, "at address %p\n",
1154 nmk_chip->chip.base, nmk_chip->chip.base+31, nmk_chip->addr); 1154 nmk_chip->addr);
1155 return 0; 1155 return 0;
1156 1156
1157out_free: 1157out_free:
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 147df8ae79db..d3f3e8f54561 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -546,7 +546,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip)
546 * Translate OpenFirmware node properties into platform_data 546 * Translate OpenFirmware node properties into platform_data
547 * WARNING: This is DEPRECATED and will be removed eventually! 547 * WARNING: This is DEPRECATED and will be removed eventually!
548 */ 548 */
549void 549static void
550pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) 550pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
551{ 551{
552 struct device_node *node; 552 struct device_node *node;
@@ -574,7 +574,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
574 *invert = *val; 574 *invert = *val;
575} 575}
576#else 576#else
577void 577static void
578pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) 578pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
579{ 579{
580 *gpio_base = -1; 580 *gpio_base = -1;
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index 3e1f1ecd07be..2d1de9e7e9bd 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -290,10 +290,7 @@ static int pcf857x_probe(struct i2c_client *client,
290 * methods can't be called from sleeping contexts. 290 * methods can't be called from sleeping contexts.
291 */ 291 */
292 292
293 dev_info(&client->dev, "gpios %d..%d on a %s%s\n", 293 dev_info(&client->dev, "%s\n",
294 gpio->chip.base,
295 gpio->chip.base + gpio->chip.ngpio - 1,
296 client->name,
297 client->irq ? " (irq ignored)" : ""); 294 client->irq ? " (irq ignored)" : "");
298 295
299 /* Let platform code set up the GPIOs and their users. 296 /* Let platform code set up the GPIOs and their users.
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index a6008e123d04..f0603297f829 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. 2 * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -49,8 +49,8 @@ struct pch_regs {
49 49
50enum pch_type_t { 50enum pch_type_t {
51 INTEL_EG20T_PCH, 51 INTEL_EG20T_PCH,
52 OKISEMI_ML7223m_IOH, /* OKISEMI ML7223 IOH PCIe Bus-m */ 52 OKISEMI_ML7223m_IOH, /* LAPIS Semiconductor ML7223 IOH PCIe Bus-m */
53 OKISEMI_ML7223n_IOH /* OKISEMI ML7223 IOH PCIe Bus-n */ 53 OKISEMI_ML7223n_IOH /* LAPIS Semiconductor ML7223 IOH PCIe Bus-n */
54}; 54};
55 55
56/* Specifies number of GPIO PINS */ 56/* Specifies number of GPIO PINS */
@@ -524,6 +524,7 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gpio_pcidev_id) = {
524 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) }, 524 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) },
525 { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014) }, 525 { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014) },
526 { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043) }, 526 { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043) },
527 { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8803) },
527 { 0, } 528 { 0, }
528}; 529};
529MODULE_DEVICE_TABLE(pci, pch_gpio_pcidev_id); 530MODULE_DEVICE_TABLE(pci, pch_gpio_pcidev_id);
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 093c90bd3c1d..8f79c03049f3 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -238,10 +238,6 @@ static int pl061_probe(struct amba_device *dev, const struct amba_id *id)
238 int ret, irq, i; 238 int ret, irq, i;
239 static DECLARE_BITMAP(init_irq, NR_IRQS); 239 static DECLARE_BITMAP(init_irq, NR_IRQS);
240 240
241 pdata = dev->dev.platform_data;
242 if (pdata == NULL)
243 return -ENODEV;
244
245 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 241 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
246 if (chip == NULL) 242 if (chip == NULL)
247 return -ENOMEM; 243 return -ENOMEM;
@@ -350,6 +346,8 @@ static struct amba_id pl061_ids[] = {
350 { 0, 0 }, 346 { 0, 0 },
351}; 347};
352 348
349MODULE_DEVICE_TABLE(amba, pl061_ids);
350
353static struct amba_driver pl061_gpio_driver = { 351static struct amba_driver pl061_gpio_driver = {
354 .drv = { 352 .drv = {
355 .name = "pl061_gpio", 353 .name = "pl061_gpio",
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index ee137712f9db..b2d3ee1d183a 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -11,14 +11,46 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/clk.h>
15#include <linux/err.h>
14#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/gpio-pxa.h>
15#include <linux/init.h> 18#include <linux/init.h>
16#include <linux/irq.h> 19#include <linux/irq.h>
17#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/platform_device.h>
18#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
19#include <linux/slab.h> 23#include <linux/slab.h>
20 24
21#include <mach/gpio-pxa.h> 25/*
26 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
27 * one set of registers. The register offsets are organized below:
28 *
29 * GPLR GPDR GPSR GPCR GRER GFER GEDR
30 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
31 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
32 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
33 *
34 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
35 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
36 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
37 *
38 * NOTE:
39 * BANK 3 is only available on PXA27x and later processors.
40 * BANK 4 and 5 are only available on PXA935
41 */
42
43#define GPLR_OFFSET 0x00
44#define GPDR_OFFSET 0x0C
45#define GPSR_OFFSET 0x18
46#define GPCR_OFFSET 0x24
47#define GRER_OFFSET 0x30
48#define GFER_OFFSET 0x3C
49#define GEDR_OFFSET 0x48
50#define GAFR_OFFSET 0x54
51#define ED_MASK_OFFSET 0x9C /* GPIO edge detection for AP side */
52
53#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
22 54
23int pxa_last_gpio; 55int pxa_last_gpio;
24 56
@@ -39,8 +71,20 @@ struct pxa_gpio_chip {
39#endif 71#endif
40}; 72};
41 73
74enum {
75 PXA25X_GPIO = 0,
76 PXA26X_GPIO,
77 PXA27X_GPIO,
78 PXA3XX_GPIO,
79 PXA93X_GPIO,
80 MMP_GPIO = 0x10,
81 MMP2_GPIO,
82};
83
42static DEFINE_SPINLOCK(gpio_lock); 84static DEFINE_SPINLOCK(gpio_lock);
43static struct pxa_gpio_chip *pxa_gpio_chips; 85static struct pxa_gpio_chip *pxa_gpio_chips;
86static int gpio_type;
87static void __iomem *gpio_reg_base;
44 88
45#define for_each_gpio_chip(i, c) \ 89#define for_each_gpio_chip(i, c) \
46 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++) 90 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
@@ -55,6 +99,122 @@ static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
55 return &pxa_gpio_chips[gpio_to_bank(gpio)]; 99 return &pxa_gpio_chips[gpio_to_bank(gpio)];
56} 100}
57 101
102static inline int gpio_is_pxa_type(int type)
103{
104 return (type & MMP_GPIO) == 0;
105}
106
107static inline int gpio_is_mmp_type(int type)
108{
109 return (type & MMP_GPIO) != 0;
110}
111
112/* GPIO86/87/88/89 on PXA26x have their direction bits in PXA_GPDR(2 inverted,
113 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
114 */
115static inline int __gpio_is_inverted(int gpio)
116{
117 if ((gpio_type == PXA26X_GPIO) && (gpio > 85))
118 return 1;
119 return 0;
120}
121
122/*
123 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
124 * function of a GPIO, and GPDRx cannot be altered once configured. It
125 * is attributed as "occupied" here (I know this terminology isn't
126 * accurate, you are welcome to propose a better one :-)
127 */
128static inline int __gpio_is_occupied(unsigned gpio)
129{
130 struct pxa_gpio_chip *pxachip;
131 void __iomem *base;
132 unsigned long gafr = 0, gpdr = 0;
133 int ret, af = 0, dir = 0;
134
135 pxachip = gpio_to_pxachip(gpio);
136 base = gpio_chip_base(&pxachip->chip);
137 gpdr = readl_relaxed(base + GPDR_OFFSET);
138
139 switch (gpio_type) {
140 case PXA25X_GPIO:
141 case PXA26X_GPIO:
142 case PXA27X_GPIO:
143 gafr = readl_relaxed(base + GAFR_OFFSET);
144 af = (gafr >> ((gpio & 0xf) * 2)) & 0x3;
145 dir = gpdr & GPIO_bit(gpio);
146
147 if (__gpio_is_inverted(gpio))
148 ret = (af != 1) || (dir == 0);
149 else
150 ret = (af != 0) || (dir != 0);
151 break;
152 default:
153 ret = gpdr & GPIO_bit(gpio);
154 break;
155 }
156 return ret;
157}
158
159#ifdef CONFIG_ARCH_PXA
160static inline int __pxa_gpio_to_irq(int gpio)
161{
162 if (gpio_is_pxa_type(gpio_type))
163 return PXA_GPIO_TO_IRQ(gpio);
164 return -1;
165}
166
167static inline int __pxa_irq_to_gpio(int irq)
168{
169 if (gpio_is_pxa_type(gpio_type))
170 return irq - PXA_GPIO_TO_IRQ(0);
171 return -1;
172}
173#else
174static inline int __pxa_gpio_to_irq(int gpio) { return -1; }
175static inline int __pxa_irq_to_gpio(int irq) { return -1; }
176#endif
177
178#ifdef CONFIG_ARCH_MMP
179static inline int __mmp_gpio_to_irq(int gpio)
180{
181 if (gpio_is_mmp_type(gpio_type))
182 return MMP_GPIO_TO_IRQ(gpio);
183 return -1;
184}
185
186static inline int __mmp_irq_to_gpio(int irq)
187{
188 if (gpio_is_mmp_type(gpio_type))
189 return irq - MMP_GPIO_TO_IRQ(0);
190 return -1;
191}
192#else
193static inline int __mmp_gpio_to_irq(int gpio) { return -1; }
194static inline int __mmp_irq_to_gpio(int irq) { return -1; }
195#endif
196
197static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
198{
199 int gpio, ret;
200
201 gpio = chip->base + offset;
202 ret = __pxa_gpio_to_irq(gpio);
203 if (ret >= 0)
204 return ret;
205 return __mmp_gpio_to_irq(gpio);
206}
207
208int pxa_irq_to_gpio(int irq)
209{
210 int ret;
211
212 ret = __pxa_irq_to_gpio(irq);
213 if (ret >= 0)
214 return ret;
215 return __mmp_irq_to_gpio(irq);
216}
217
58static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 218static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
59{ 219{
60 void __iomem *base = gpio_chip_base(chip); 220 void __iomem *base = gpio_chip_base(chip);
@@ -63,12 +223,12 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
63 223
64 spin_lock_irqsave(&gpio_lock, flags); 224 spin_lock_irqsave(&gpio_lock, flags);
65 225
66 value = __raw_readl(base + GPDR_OFFSET); 226 value = readl_relaxed(base + GPDR_OFFSET);
67 if (__gpio_is_inverted(chip->base + offset)) 227 if (__gpio_is_inverted(chip->base + offset))
68 value |= mask; 228 value |= mask;
69 else 229 else
70 value &= ~mask; 230 value &= ~mask;
71 __raw_writel(value, base + GPDR_OFFSET); 231 writel_relaxed(value, base + GPDR_OFFSET);
72 232
73 spin_unlock_irqrestore(&gpio_lock, flags); 233 spin_unlock_irqrestore(&gpio_lock, flags);
74 return 0; 234 return 0;
@@ -81,16 +241,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
81 uint32_t tmp, mask = 1 << offset; 241 uint32_t tmp, mask = 1 << offset;
82 unsigned long flags; 242 unsigned long flags;
83 243
84 __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET)); 244 writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
85 245
86 spin_lock_irqsave(&gpio_lock, flags); 246 spin_lock_irqsave(&gpio_lock, flags);
87 247
88 tmp = __raw_readl(base + GPDR_OFFSET); 248 tmp = readl_relaxed(base + GPDR_OFFSET);
89 if (__gpio_is_inverted(chip->base + offset)) 249 if (__gpio_is_inverted(chip->base + offset))
90 tmp &= ~mask; 250 tmp &= ~mask;
91 else 251 else
92 tmp |= mask; 252 tmp |= mask;
93 __raw_writel(tmp, base + GPDR_OFFSET); 253 writel_relaxed(tmp, base + GPDR_OFFSET);
94 254
95 spin_unlock_irqrestore(&gpio_lock, flags); 255 spin_unlock_irqrestore(&gpio_lock, flags);
96 return 0; 256 return 0;
@@ -98,16 +258,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
98 258
99static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset) 259static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
100{ 260{
101 return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset); 261 return readl_relaxed(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
102} 262}
103 263
104static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 264static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
105{ 265{
106 __raw_writel(1 << offset, gpio_chip_base(chip) + 266 writel_relaxed(1 << offset, gpio_chip_base(chip) +
107 (value ? GPSR_OFFSET : GPCR_OFFSET)); 267 (value ? GPSR_OFFSET : GPCR_OFFSET));
108} 268}
109 269
110static int __init pxa_init_gpio_chip(int gpio_end) 270static int __devinit pxa_init_gpio_chip(int gpio_end)
111{ 271{
112 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; 272 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
113 struct pxa_gpio_chip *chips; 273 struct pxa_gpio_chip *chips;
@@ -122,7 +282,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
122 struct gpio_chip *c = &chips[i].chip; 282 struct gpio_chip *c = &chips[i].chip;
123 283
124 sprintf(chips[i].label, "gpio-%d", i); 284 sprintf(chips[i].label, "gpio-%d", i);
125 chips[i].regbase = GPIO_BANK(i); 285 chips[i].regbase = gpio_reg_base + BANK_OFF(i);
126 286
127 c->base = gpio; 287 c->base = gpio;
128 c->label = chips[i].label; 288 c->label = chips[i].label;
@@ -131,6 +291,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
131 c->direction_output = pxa_gpio_direction_output; 291 c->direction_output = pxa_gpio_direction_output;
132 c->get = pxa_gpio_get; 292 c->get = pxa_gpio_get;
133 c->set = pxa_gpio_set; 293 c->set = pxa_gpio_set;
294 c->to_irq = pxa_gpio_to_irq;
134 295
135 /* number of GPIOs on last bank may be less than 32 */ 296 /* number of GPIOs on last bank may be less than 32 */
136 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; 297 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
@@ -147,18 +308,18 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c)
147{ 308{
148 uint32_t grer, gfer; 309 uint32_t grer, gfer;
149 310
150 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask; 311 grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~c->irq_mask;
151 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask; 312 gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~c->irq_mask;
152 grer |= c->irq_edge_rise & c->irq_mask; 313 grer |= c->irq_edge_rise & c->irq_mask;
153 gfer |= c->irq_edge_fall & c->irq_mask; 314 gfer |= c->irq_edge_fall & c->irq_mask;
154 __raw_writel(grer, c->regbase + GRER_OFFSET); 315 writel_relaxed(grer, c->regbase + GRER_OFFSET);
155 __raw_writel(gfer, c->regbase + GFER_OFFSET); 316 writel_relaxed(gfer, c->regbase + GFER_OFFSET);
156} 317}
157 318
158static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type) 319static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
159{ 320{
160 struct pxa_gpio_chip *c; 321 struct pxa_gpio_chip *c;
161 int gpio = irq_to_gpio(d->irq); 322 int gpio = pxa_irq_to_gpio(d->irq);
162 unsigned long gpdr, mask = GPIO_bit(gpio); 323 unsigned long gpdr, mask = GPIO_bit(gpio);
163 324
164 c = gpio_to_pxachip(gpio); 325 c = gpio_to_pxachip(gpio);
@@ -176,12 +337,12 @@ static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
176 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 337 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
177 } 338 }
178 339
179 gpdr = __raw_readl(c->regbase + GPDR_OFFSET); 340 gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
180 341
181 if (__gpio_is_inverted(gpio)) 342 if (__gpio_is_inverted(gpio))
182 __raw_writel(gpdr | mask, c->regbase + GPDR_OFFSET); 343 writel_relaxed(gpdr | mask, c->regbase + GPDR_OFFSET);
183 else 344 else
184 __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET); 345 writel_relaxed(gpdr & ~mask, c->regbase + GPDR_OFFSET);
185 346
186 if (type & IRQ_TYPE_EDGE_RISING) 347 if (type & IRQ_TYPE_EDGE_RISING)
187 c->irq_edge_rise |= mask; 348 c->irq_edge_rise |= mask;
@@ -212,9 +373,9 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
212 for_each_gpio_chip(gpio, c) { 373 for_each_gpio_chip(gpio, c) {
213 gpio_base = c->chip.base; 374 gpio_base = c->chip.base;
214 375
215 gedr = __raw_readl(c->regbase + GEDR_OFFSET); 376 gedr = readl_relaxed(c->regbase + GEDR_OFFSET);
216 gedr = gedr & c->irq_mask; 377 gedr = gedr & c->irq_mask;
217 __raw_writel(gedr, c->regbase + GEDR_OFFSET); 378 writel_relaxed(gedr, c->regbase + GEDR_OFFSET);
218 379
219 n = find_first_bit(&gedr, BITS_PER_LONG); 380 n = find_first_bit(&gedr, BITS_PER_LONG);
220 while (n < BITS_PER_LONG) { 381 while (n < BITS_PER_LONG) {
@@ -229,29 +390,29 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
229 390
230static void pxa_ack_muxed_gpio(struct irq_data *d) 391static void pxa_ack_muxed_gpio(struct irq_data *d)
231{ 392{
232 int gpio = irq_to_gpio(d->irq); 393 int gpio = pxa_irq_to_gpio(d->irq);
233 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); 394 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
234 395
235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); 396 writel_relaxed(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
236} 397}
237 398
238static void pxa_mask_muxed_gpio(struct irq_data *d) 399static void pxa_mask_muxed_gpio(struct irq_data *d)
239{ 400{
240 int gpio = irq_to_gpio(d->irq); 401 int gpio = pxa_irq_to_gpio(d->irq);
241 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); 402 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
242 uint32_t grer, gfer; 403 uint32_t grer, gfer;
243 404
244 c->irq_mask &= ~GPIO_bit(gpio); 405 c->irq_mask &= ~GPIO_bit(gpio);
245 406
246 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio); 407 grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
247 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio); 408 gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
248 __raw_writel(grer, c->regbase + GRER_OFFSET); 409 writel_relaxed(grer, c->regbase + GRER_OFFSET);
249 __raw_writel(gfer, c->regbase + GFER_OFFSET); 410 writel_relaxed(gfer, c->regbase + GFER_OFFSET);
250} 411}
251 412
252static void pxa_unmask_muxed_gpio(struct irq_data *d) 413static void pxa_unmask_muxed_gpio(struct irq_data *d)
253{ 414{
254 int gpio = irq_to_gpio(d->irq); 415 int gpio = pxa_irq_to_gpio(d->irq);
255 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); 416 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
256 417
257 c->irq_mask |= GPIO_bit(gpio); 418 c->irq_mask |= GPIO_bit(gpio);
@@ -266,34 +427,143 @@ static struct irq_chip pxa_muxed_gpio_chip = {
266 .irq_set_type = pxa_gpio_irq_type, 427 .irq_set_type = pxa_gpio_irq_type,
267}; 428};
268 429
269void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn) 430static int pxa_gpio_nums(void)
270{ 431{
271 struct pxa_gpio_chip *c; 432 int count = 0;
272 int gpio, irq; 433
434#ifdef CONFIG_ARCH_PXA
435 if (cpu_is_pxa25x()) {
436#ifdef CONFIG_CPU_PXA26x
437 count = 89;
438 gpio_type = PXA26X_GPIO;
439#elif defined(CONFIG_PXA25x)
440 count = 84;
441 gpio_type = PXA26X_GPIO;
442#endif /* CONFIG_CPU_PXA26x */
443 } else if (cpu_is_pxa27x()) {
444 count = 120;
445 gpio_type = PXA27X_GPIO;
446 } else if (cpu_is_pxa93x() || cpu_is_pxa95x()) {
447 count = 191;
448 gpio_type = PXA93X_GPIO;
449 } else if (cpu_is_pxa3xx()) {
450 count = 127;
451 gpio_type = PXA3XX_GPIO;
452 }
453#endif /* CONFIG_ARCH_PXA */
454
455#ifdef CONFIG_ARCH_MMP
456 if (cpu_is_pxa168() || cpu_is_pxa910()) {
457 count = 127;
458 gpio_type = MMP_GPIO;
459 } else if (cpu_is_mmp2()) {
460 count = 191;
461 gpio_type = MMP2_GPIO;
462 }
463#endif /* CONFIG_ARCH_MMP */
464 return count;
465}
273 466
274 pxa_last_gpio = end; 467static int __devinit pxa_gpio_probe(struct platform_device *pdev)
468{
469 struct pxa_gpio_chip *c;
470 struct resource *res;
471 struct clk *clk;
472 int gpio, irq, ret;
473 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
474
475 pxa_last_gpio = pxa_gpio_nums();
476 if (!pxa_last_gpio)
477 return -EINVAL;
478
479 irq0 = platform_get_irq_byname(pdev, "gpio0");
480 irq1 = platform_get_irq_byname(pdev, "gpio1");
481 irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
482 if ((irq0 > 0 && irq1 <= 0) || (irq0 <= 0 && irq1 > 0)
483 || (irq_mux <= 0))
484 return -EINVAL;
485 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
486 if (!res)
487 return -EINVAL;
488 gpio_reg_base = ioremap(res->start, resource_size(res));
489 if (!gpio_reg_base)
490 return -EINVAL;
491
492 if (irq0 > 0)
493 gpio_offset = 2;
494
495 clk = clk_get(&pdev->dev, NULL);
496 if (IS_ERR(clk)) {
497 dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
498 PTR_ERR(clk));
499 iounmap(gpio_reg_base);
500 return PTR_ERR(clk);
501 }
502 ret = clk_prepare(clk);
503 if (ret) {
504 clk_put(clk);
505 iounmap(gpio_reg_base);
506 return ret;
507 }
508 ret = clk_enable(clk);
509 if (ret) {
510 clk_unprepare(clk);
511 clk_put(clk);
512 iounmap(gpio_reg_base);
513 return ret;
514 }
275 515
276 /* Initialize GPIO chips */ 516 /* Initialize GPIO chips */
277 pxa_init_gpio_chip(end); 517 pxa_init_gpio_chip(pxa_last_gpio);
278 518
279 /* clear all GPIO edge detects */ 519 /* clear all GPIO edge detects */
280 for_each_gpio_chip(gpio, c) { 520 for_each_gpio_chip(gpio, c) {
281 __raw_writel(0, c->regbase + GFER_OFFSET); 521 writel_relaxed(0, c->regbase + GFER_OFFSET);
282 __raw_writel(0, c->regbase + GRER_OFFSET); 522 writel_relaxed(0, c->regbase + GRER_OFFSET);
283 __raw_writel(~0,c->regbase + GEDR_OFFSET); 523 writel_relaxed(~0,c->regbase + GEDR_OFFSET);
524 /* unmask GPIO edge detect for AP side */
525 if (gpio_is_mmp_type(gpio_type))
526 writel_relaxed(~0, c->regbase + ED_MASK_OFFSET);
284 } 527 }
285 528
286 for (irq = gpio_to_irq(start); irq <= gpio_to_irq(end); irq++) { 529#ifdef CONFIG_ARCH_PXA
530 irq = gpio_to_irq(0);
531 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
532 handle_edge_irq);
533 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
534 irq_set_chained_handler(IRQ_GPIO0, pxa_gpio_demux_handler);
535
536 irq = gpio_to_irq(1);
537 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
538 handle_edge_irq);
539 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
540 irq_set_chained_handler(IRQ_GPIO1, pxa_gpio_demux_handler);
541#endif
542
543 for (irq = gpio_to_irq(gpio_offset);
544 irq <= gpio_to_irq(pxa_last_gpio); irq++) {
287 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip, 545 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
288 handle_edge_irq); 546 handle_edge_irq);
289 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 547 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
290 } 548 }
291 549
292 /* Install handler for GPIO>=2 edge detect interrupts */ 550 irq_set_chained_handler(irq_mux, pxa_gpio_demux_handler);
293 irq_set_chained_handler(mux_irq, pxa_gpio_demux_handler); 551 return 0;
294 pxa_muxed_gpio_chip.irq_set_wake = fn;
295} 552}
296 553
554static struct platform_driver pxa_gpio_driver = {
555 .probe = pxa_gpio_probe,
556 .driver = {
557 .name = "pxa-gpio",
558 },
559};
560
561static int __init pxa_gpio_init(void)
562{
563 return platform_driver_register(&pxa_gpio_driver);
564}
565postcore_initcall(pxa_gpio_init);
566
297#ifdef CONFIG_PM 567#ifdef CONFIG_PM
298static int pxa_gpio_suspend(void) 568static int pxa_gpio_suspend(void)
299{ 569{
@@ -301,13 +571,13 @@ static int pxa_gpio_suspend(void)
301 int gpio; 571 int gpio;
302 572
303 for_each_gpio_chip(gpio, c) { 573 for_each_gpio_chip(gpio, c) {
304 c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET); 574 c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
305 c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET); 575 c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
306 c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET); 576 c->saved_grer = readl_relaxed(c->regbase + GRER_OFFSET);
307 c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET); 577 c->saved_gfer = readl_relaxed(c->regbase + GFER_OFFSET);
308 578
309 /* Clear GPIO transition detect bits */ 579 /* Clear GPIO transition detect bits */
310 __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET); 580 writel_relaxed(0xffffffff, c->regbase + GEDR_OFFSET);
311 } 581 }
312 return 0; 582 return 0;
313} 583}
@@ -319,12 +589,12 @@ static void pxa_gpio_resume(void)
319 589
320 for_each_gpio_chip(gpio, c) { 590 for_each_gpio_chip(gpio, c) {
321 /* restore level with set/clear */ 591 /* restore level with set/clear */
322 __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET); 592 writel_relaxed( c->saved_gplr, c->regbase + GPSR_OFFSET);
323 __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET); 593 writel_relaxed(~c->saved_gplr, c->regbase + GPCR_OFFSET);
324 594
325 __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET); 595 writel_relaxed(c->saved_grer, c->regbase + GRER_OFFSET);
326 __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET); 596 writel_relaxed(c->saved_gfer, c->regbase + GFER_OFFSET);
327 __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); 597 writel_relaxed(c->saved_gpdr, c->regbase + GPDR_OFFSET);
328 } 598 }
329} 599}
330#else 600#else
@@ -336,3 +606,10 @@ struct syscore_ops pxa_gpio_syscore_ops = {
336 .suspend = pxa_gpio_suspend, 606 .suspend = pxa_gpio_suspend,
337 .resume = pxa_gpio_resume, 607 .resume = pxa_gpio_resume,
338}; 608};
609
610static int __init pxa_gpio_sysinit(void)
611{
612 register_syscore_ops(&pxa_gpio_syscore_ops);
613 return 0;
614}
615postcore_initcall(pxa_gpio_sysinit);
diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c
index 2762698e0204..e97016af6443 100644
--- a/drivers/gpio/gpio-rdc321x.c
+++ b/drivers/gpio/gpio-rdc321x.c
@@ -227,18 +227,7 @@ static struct platform_driver rdc321x_gpio_driver = {
227 .remove = __devexit_p(rdc321x_gpio_remove), 227 .remove = __devexit_p(rdc321x_gpio_remove),
228}; 228};
229 229
230static int __init rdc321x_gpio_init(void) 230module_platform_driver(rdc321x_gpio_driver);
231{
232 return platform_driver_register(&rdc321x_gpio_driver);
233}
234
235static void __exit rdc321x_gpio_exit(void)
236{
237 platform_driver_unregister(&rdc321x_gpio_driver);
238}
239
240module_init(rdc321x_gpio_init);
241module_exit(rdc321x_gpio_exit);
242 231
243MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); 232MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
244MODULE_DESCRIPTION("RDC321x GPIO driver"); 233MODULE_DESCRIPTION("RDC321x GPIO driver");
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 866251852719..a7661773c052 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -22,8 +22,11 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/sysdev.h> 25#include <linux/device.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/of.h>
28#include <linux/slab.h>
29#include <linux/of_address.h>
27 30
28#include <asm/irq.h> 31#include <asm/irq.h>
29 32
@@ -230,7 +233,7 @@ static int samsung_gpio_setcfg_2bit(struct samsung_gpio_chip *chip,
230 * @chip: The gpio chip that is being configured. 233 * @chip: The gpio chip that is being configured.
231 * @off: The offset for the GPIO being configured. 234 * @off: The offset for the GPIO being configured.
232 * 235 *
233 * The reverse of samsung_gpio_setcfg_2bit(). Will return a value whicg 236 * The reverse of samsung_gpio_setcfg_2bit(). Will return a value which
234 * could be directly passed back to samsung_gpio_setcfg_2bit(), from the 237 * could be directly passed back to samsung_gpio_setcfg_2bit(), from the
235 * S3C_GPIO_SPECIAL() macro. 238 * S3C_GPIO_SPECIAL() macro.
236 */ 239 */
@@ -467,33 +470,42 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
467#endif 470#endif
468 471
469static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { 472static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
470 { 473 [0] = {
471 .cfg_eint = 0x0, 474 .cfg_eint = 0x0,
472 }, { 475 },
476 [1] = {
473 .cfg_eint = 0x3, 477 .cfg_eint = 0x3,
474 }, { 478 },
479 [2] = {
475 .cfg_eint = 0x7, 480 .cfg_eint = 0x7,
476 }, { 481 },
482 [3] = {
477 .cfg_eint = 0xF, 483 .cfg_eint = 0xF,
478 }, { 484 },
485 [4] = {
479 .cfg_eint = 0x0, 486 .cfg_eint = 0x0,
480 .set_config = samsung_gpio_setcfg_2bit, 487 .set_config = samsung_gpio_setcfg_2bit,
481 .get_config = samsung_gpio_getcfg_2bit, 488 .get_config = samsung_gpio_getcfg_2bit,
482 }, { 489 },
490 [5] = {
483 .cfg_eint = 0x2, 491 .cfg_eint = 0x2,
484 .set_config = samsung_gpio_setcfg_2bit, 492 .set_config = samsung_gpio_setcfg_2bit,
485 .get_config = samsung_gpio_getcfg_2bit, 493 .get_config = samsung_gpio_getcfg_2bit,
486 }, { 494 },
495 [6] = {
487 .cfg_eint = 0x3, 496 .cfg_eint = 0x3,
488 .set_config = samsung_gpio_setcfg_2bit, 497 .set_config = samsung_gpio_setcfg_2bit,
489 .get_config = samsung_gpio_getcfg_2bit, 498 .get_config = samsung_gpio_getcfg_2bit,
490 }, { 499 },
500 [7] = {
491 .set_config = samsung_gpio_setcfg_2bit, 501 .set_config = samsung_gpio_setcfg_2bit,
492 .get_config = samsung_gpio_getcfg_2bit, 502 .get_config = samsung_gpio_getcfg_2bit,
493 }, { 503 },
504 [8] = {
494 .set_pull = exynos4_gpio_setpull, 505 .set_pull = exynos4_gpio_setpull,
495 .get_pull = exynos4_gpio_getpull, 506 .get_pull = exynos4_gpio_getpull,
496 }, { 507 },
508 [9] = {
497 .cfg_eint = 0x3, 509 .cfg_eint = 0x3,
498 .set_pull = exynos4_gpio_setpull, 510 .set_pull = exynos4_gpio_setpull,
499 .get_pull = exynos4_gpio_getpull, 511 .get_pull = exynos4_gpio_getpull,
@@ -2374,6 +2386,63 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = {
2374#endif 2386#endif
2375}; 2387};
2376 2388
2389#if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF)
2390static int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np,
2391 const void *gpio_spec, u32 *flags)
2392{
2393 const __be32 *gpio = gpio_spec;
2394 const u32 n = be32_to_cpup(gpio);
2395 unsigned int pin = gc->base + be32_to_cpu(gpio[0]);
2396
2397 if (WARN_ON(gc->of_gpio_n_cells < 4))
2398 return -EINVAL;
2399
2400 if (n > gc->ngpio)
2401 return -EINVAL;
2402
2403 if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1]))))
2404 pr_warn("gpio_xlate: failed to set pin function\n");
2405 if (s3c_gpio_setpull(pin, be32_to_cpu(gpio[2])))
2406 pr_warn("gpio_xlate: failed to set pin pull up/down\n");
2407 if (s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3])))
2408 pr_warn("gpio_xlate: failed to set pin drive strength\n");
2409
2410 return n;
2411}
2412
2413static const struct of_device_id exynos4_gpio_dt_match[] __initdata = {
2414 { .compatible = "samsung,exynos4-gpio", },
2415 {}
2416};
2417
2418static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
2419 u64 base, u64 offset)
2420{
2421 struct gpio_chip *gc = &chip->chip;
2422 u64 address;
2423
2424 if (!of_have_populated_dt())
2425 return;
2426
2427 address = chip->base ? base + ((u32)chip->base & 0xfff) : base + offset;
2428 gc->of_node = of_find_matching_node_by_address(NULL,
2429 exynos4_gpio_dt_match, address);
2430 if (!gc->of_node) {
2431 pr_info("gpio: device tree node not found for gpio controller"
2432 " with base address %08llx\n", address);
2433 return;
2434 }
2435 gc->of_gpio_n_cells = 4;
2436 gc->of_xlate = exynos4_gpio_xlate;
2437}
2438#elif defined(CONFIG_ARCH_EXYNOS4)
2439static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
2440 u64 base, u64 offset)
2441{
2442 return;
2443}
2444#endif /* defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) */
2445
2377/* TODO: cleanup soc_is_* */ 2446/* TODO: cleanup soc_is_* */
2378static __init int samsung_gpiolib_init(void) 2447static __init int samsung_gpiolib_init(void)
2379{ 2448{
@@ -2455,6 +2524,10 @@ static __init int samsung_gpiolib_init(void)
2455 chip->config = &exynos4_gpio_cfg; 2524 chip->config = &exynos4_gpio_cfg;
2456 chip->group = group++; 2525 chip->group = group++;
2457 } 2526 }
2527#ifdef CONFIG_CPU_EXYNOS4210
2528 exynos4_gpiolib_attach_ofnode(chip,
2529 EXYNOS4_PA_GPIO1, i * 0x20);
2530#endif
2458 } 2531 }
2459 samsung_gpiolib_add_4bit_chips(exynos4_gpios_1, nr_chips, S5P_VA_GPIO1); 2532 samsung_gpiolib_add_4bit_chips(exynos4_gpios_1, nr_chips, S5P_VA_GPIO1);
2460 2533
@@ -2467,6 +2540,10 @@ static __init int samsung_gpiolib_init(void)
2467 chip->config = &exynos4_gpio_cfg; 2540 chip->config = &exynos4_gpio_cfg;
2468 chip->group = group++; 2541 chip->group = group++;
2469 } 2542 }
2543#ifdef CONFIG_CPU_EXYNOS4210
2544 exynos4_gpiolib_attach_ofnode(chip,
2545 EXYNOS4_PA_GPIO2, i * 0x20);
2546#endif
2470 } 2547 }
2471 samsung_gpiolib_add_4bit_chips(exynos4_gpios_2, nr_chips, S5P_VA_GPIO2); 2548 samsung_gpiolib_add_4bit_chips(exynos4_gpios_2, nr_chips, S5P_VA_GPIO2);
2472 2549
@@ -2479,6 +2556,10 @@ static __init int samsung_gpiolib_init(void)
2479 chip->config = &exynos4_gpio_cfg; 2556 chip->config = &exynos4_gpio_cfg;
2480 chip->group = group++; 2557 chip->group = group++;
2481 } 2558 }
2559#ifdef CONFIG_CPU_EXYNOS4210
2560 exynos4_gpiolib_attach_ofnode(chip,
2561 EXYNOS4_PA_GPIO3, i * 0x20);
2562#endif
2482 } 2563 }
2483 samsung_gpiolib_add_4bit_chips(exynos4_gpios_3, nr_chips, S5P_VA_GPIO3); 2564 samsung_gpiolib_add_4bit_chips(exynos4_gpios_3, nr_chips, S5P_VA_GPIO3);
2484 2565
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 163515845494..8cadf4d683a8 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -297,18 +297,7 @@ static struct platform_driver sch_gpio_driver = {
297 .remove = __devexit_p(sch_gpio_remove), 297 .remove = __devexit_p(sch_gpio_remove),
298}; 298};
299 299
300static int __init sch_gpio_init(void) 300module_platform_driver(sch_gpio_driver);
301{
302 return platform_driver_register(&sch_gpio_driver);
303}
304
305static void __exit sch_gpio_exit(void)
306{
307 platform_driver_unregister(&sch_gpio_driver);
308}
309
310module_init(sch_gpio_init);
311module_exit(sch_gpio_exit);
312 301
313MODULE_AUTHOR("Denis Turischev <denis@compulab.co.il>"); 302MODULE_AUTHOR("Denis Turischev <denis@compulab.co.il>");
314MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH"); 303MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH");
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index c593bd46bfb6..031c6adf5b65 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -359,18 +359,7 @@ static struct platform_driver timbgpio_platform_driver = {
359 359
360/*--------------------------------------------------------------------------*/ 360/*--------------------------------------------------------------------------*/
361 361
362static int __init timbgpio_init(void) 362module_platform_driver(timbgpio_platform_driver);
363{
364 return platform_driver_register(&timbgpio_platform_driver);
365}
366
367static void __exit timbgpio_exit(void)
368{
369 platform_driver_unregister(&timbgpio_platform_driver);
370}
371
372module_init(timbgpio_init);
373module_exit(timbgpio_exit);
374 363
375MODULE_DESCRIPTION("Timberdale GPIO driver"); 364MODULE_DESCRIPTION("Timberdale GPIO driver");
376MODULE_LICENSE("GPL v2"); 365MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c
index 50e6bd1392ce..26405efe0f9f 100644
--- a/drivers/gpio/gpio-ucb1400.c
+++ b/drivers/gpio/gpio-ucb1400.c
@@ -103,23 +103,12 @@ static struct platform_driver ucb1400_gpio_driver = {
103 }, 103 },
104}; 104};
105 105
106static int __init ucb1400_gpio_init(void)
107{
108 return platform_driver_register(&ucb1400_gpio_driver);
109}
110
111static void __exit ucb1400_gpio_exit(void)
112{
113 platform_driver_unregister(&ucb1400_gpio_driver);
114}
115
116void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data) 106void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
117{ 107{
118 ucbdata = data; 108 ucbdata = data;
119} 109}
120 110
121module_init(ucb1400_gpio_init); 111module_platform_driver(ucb1400_gpio_driver);
122module_exit(ucb1400_gpio_exit);
123 112
124MODULE_DESCRIPTION("Philips UCB1400 GPIO driver"); 113MODULE_DESCRIPTION("Philips UCB1400 GPIO driver");
125MODULE_LICENSE("GPL"); 114MODULE_LICENSE("GPL");
diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
index 98723cb9ac68..82d5c20ad3cb 100644
--- a/drivers/gpio/gpio-vr41xx.c
+++ b/drivers/gpio/gpio-vr41xx.c
@@ -571,15 +571,4 @@ static struct platform_driver giu_device_driver = {
571 }, 571 },
572}; 572};
573 573
574static int __init vr41xx_giu_init(void) 574module_platform_driver(giu_device_driver);
575{
576 return platform_driver_register(&giu_device_driver);
577}
578
579static void __exit vr41xx_giu_exit(void)
580{
581 platform_driver_unregister(&giu_device_driver);
582}
583
584module_init(vr41xx_giu_init);
585module_exit(vr41xx_giu_exit);
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index ef5aabd8b8b7..76ebfe5ff702 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -315,17 +315,7 @@ static struct platform_driver vx855gpio_driver = {
315 .remove = __devexit_p(vx855gpio_remove), 315 .remove = __devexit_p(vx855gpio_remove),
316}; 316};
317 317
318static int vx855gpio_init(void) 318module_platform_driver(vx855gpio_driver);
319{
320 return platform_driver_register(&vx855gpio_driver);
321}
322module_init(vx855gpio_init);
323
324static void vx855gpio_exit(void)
325{
326 platform_driver_unregister(&vx855gpio_driver);
327}
328module_exit(vx855gpio_exit);
329 319
330MODULE_LICENSE("GPL"); 320MODULE_LICENSE("GPL");
331MODULE_AUTHOR("Harald Welte <HaraldWelte@viatech.com>"); 321MODULE_AUTHOR("Harald Welte <HaraldWelte@viatech.com>");
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index 96198f3fab73..92ea5350dfe9 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -117,6 +117,60 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
117 117
118 118
119#ifdef CONFIG_DEBUG_FS 119#ifdef CONFIG_DEBUG_FS
120static const char *wm8994_gpio_fn(u16 fn)
121{
122 switch (fn) {
123 case WM8994_GP_FN_PIN_SPECIFIC:
124 return "pin-specific";
125 case WM8994_GP_FN_GPIO:
126 return "GPIO";
127 case WM8994_GP_FN_SDOUT:
128 return "SDOUT";
129 case WM8994_GP_FN_IRQ:
130 return "IRQ";
131 case WM8994_GP_FN_TEMPERATURE:
132 return "Temperature";
133 case WM8994_GP_FN_MICBIAS1_DET:
134 return "MICBIAS1 detect";
135 case WM8994_GP_FN_MICBIAS1_SHORT:
136 return "MICBIAS1 short";
137 case WM8994_GP_FN_MICBIAS2_DET:
138 return "MICBIAS2 detect";
139 case WM8994_GP_FN_MICBIAS2_SHORT:
140 return "MICBIAS2 short";
141 case WM8994_GP_FN_FLL1_LOCK:
142 return "FLL1 lock";
143 case WM8994_GP_FN_FLL2_LOCK:
144 return "FLL2 lock";
145 case WM8994_GP_FN_SRC1_LOCK:
146 return "SRC1 lock";
147 case WM8994_GP_FN_SRC2_LOCK:
148 return "SRC2 lock";
149 case WM8994_GP_FN_DRC1_ACT:
150 return "DRC1 activity";
151 case WM8994_GP_FN_DRC2_ACT:
152 return "DRC2 activity";
153 case WM8994_GP_FN_DRC3_ACT:
154 return "DRC3 activity";
155 case WM8994_GP_FN_WSEQ_STATUS:
156 return "Write sequencer";
157 case WM8994_GP_FN_FIFO_ERROR:
158 return "FIFO error";
159 case WM8994_GP_FN_OPCLK:
160 return "OPCLK";
161 case WM8994_GP_FN_THW:
162 return "Thermal warning";
163 case WM8994_GP_FN_DCS_DONE:
164 return "DC servo";
165 case WM8994_GP_FN_FLL1_OUT:
166 return "FLL1 output";
167 case WM8994_GP_FN_FLL2_OUT:
168 return "FLL1 output";
169 default:
170 return "Unknown";
171 }
172}
173
120static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) 174static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
121{ 175{
122 struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); 176 struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
@@ -148,8 +202,29 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
148 continue; 202 continue;
149 } 203 }
150 204
151 /* No decode yet; note that GPIO2 is special */ 205 if (reg & WM8994_GPN_DIR)
152 seq_printf(s, "(%x)\n", reg); 206 seq_printf(s, "in ");
207 else
208 seq_printf(s, "out ");
209
210 if (reg & WM8994_GPN_PU)
211 seq_printf(s, "pull up ");
212
213 if (reg & WM8994_GPN_PD)
214 seq_printf(s, "pull down ");
215
216 if (reg & WM8994_GPN_POL)
217 seq_printf(s, "inverted ");
218 else
219 seq_printf(s, "noninverted ");
220
221 if (reg & WM8994_GPN_OP_CFG)
222 seq_printf(s, "open drain ");
223 else
224 seq_printf(s, "CMOS ");
225
226 seq_printf(s, "%s (%x)\n",
227 wm8994_gpio_fn(reg & WM8994_GPN_FN_MASK), reg);
153 } 228 }
154} 229}
155#else 230#else
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 0ce6ac9898b1..79b0fe8a7253 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -206,7 +206,6 @@ static int __devinit xgpio_of_probe(struct device_node *np)
206 np->full_name, status); 206 np->full_name, status);
207 return status; 207 return status;
208 } 208 }
209 pr_info("XGpio: %s: registered\n", np->full_name);
210 return 0; 209 return 0;
211} 210}
212 211
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a971e3d043ba..17fdf4b6af93 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -114,7 +114,7 @@ static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset)
114} 114}
115 115
116/* caller holds gpio_lock *OR* gpio is marked as requested */ 116/* caller holds gpio_lock *OR* gpio is marked as requested */
117static inline struct gpio_chip *gpio_to_chip(unsigned gpio) 117struct gpio_chip *gpio_to_chip(unsigned gpio)
118{ 118{
119 return gpio_desc[gpio].chip; 119 return gpio_desc[gpio].chip;
120} 120}
@@ -1089,6 +1089,10 @@ unlock:
1089 if (status) 1089 if (status)
1090 goto fail; 1090 goto fail;
1091 1091
1092 pr_info("gpiochip_add: registered GPIOs %d to %d on device: %s\n",
1093 chip->base, chip->base + chip->ngpio - 1,
1094 chip->label ? : "generic");
1095
1092 return 0; 1096 return 0;
1093fail: 1097fail:
1094 /* failures here can mean systems won't boot... */ 1098 /* failures here can mean systems won't boot... */