diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/Kconfig | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-em.c | 6 | ||||
-rw-r--r-- | drivers/gpio/gpio-langwell.c | 7 | ||||
-rw-r--r-- | drivers/gpio/gpio-msic.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-mxc.c | 5 | ||||
-rw-r--r-- | drivers/gpio/gpio-pxa.c | 30 | ||||
-rw-r--r-- | drivers/gpio/gpio-rdc321x.c | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-samsung.c | 14 | ||||
-rw-r--r-- | drivers/gpio/gpio-sch.c | 3 | ||||
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 2 |
10 files changed, 51 insertions, 21 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index b16c8a72a2e2..ba7926f5c099 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -294,7 +294,7 @@ config GPIO_MAX732X_IRQ | |||
294 | 294 | ||
295 | config GPIO_MC9S08DZ60 | 295 | config GPIO_MC9S08DZ60 |
296 | bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions" | 296 | bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions" |
297 | depends on I2C && MACH_MX35_3DS | 297 | depends on I2C=y && MACH_MX35_3DS |
298 | help | 298 | help |
299 | Select this to enable the MC9S08DZ60 GPIO driver | 299 | Select this to enable the MC9S08DZ60 GPIO driver |
300 | 300 | ||
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c index 150d9768811d..ec48ed512628 100644 --- a/drivers/gpio/gpio-em.c +++ b/drivers/gpio/gpio-em.c | |||
@@ -247,9 +247,9 @@ static int __devinit em_gio_irq_domain_init(struct em_gio_priv *p) | |||
247 | 247 | ||
248 | p->irq_base = irq_alloc_descs(pdata->irq_base, 0, | 248 | p->irq_base = irq_alloc_descs(pdata->irq_base, 0, |
249 | pdata->number_of_pins, numa_node_id()); | 249 | pdata->number_of_pins, numa_node_id()); |
250 | if (IS_ERR_VALUE(p->irq_base)) { | 250 | if (p->irq_base < 0) { |
251 | dev_err(&pdev->dev, "cannot get irq_desc\n"); | 251 | dev_err(&pdev->dev, "cannot get irq_desc\n"); |
252 | return -ENXIO; | 252 | return p->irq_base; |
253 | } | 253 | } |
254 | pr_debug("gio: hw base = %d, nr = %d, sw base = %d\n", | 254 | pr_debug("gio: hw base = %d, nr = %d, sw base = %d\n", |
255 | pdata->gpio_base, pdata->number_of_pins, p->irq_base); | 255 | pdata->gpio_base, pdata->number_of_pins, p->irq_base); |
@@ -266,7 +266,7 @@ static int __devinit em_gio_irq_domain_init(struct em_gio_priv *p) | |||
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | 268 | ||
269 | static void __devexit em_gio_irq_domain_cleanup(struct em_gio_priv *p) | 269 | static void em_gio_irq_domain_cleanup(struct em_gio_priv *p) |
270 | { | 270 | { |
271 | struct gpio_em_config *pdata = p->pdev->dev.platform_data; | 271 | struct gpio_em_config *pdata = p->pdev->dev.platform_data; |
272 | 272 | ||
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c index a1c8754f52cf..202a99207b7d 100644 --- a/drivers/gpio/gpio-langwell.c +++ b/drivers/gpio/gpio-langwell.c | |||
@@ -339,7 +339,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
339 | resource_size_t start, len; | 339 | resource_size_t start, len; |
340 | struct lnw_gpio *lnw; | 340 | struct lnw_gpio *lnw; |
341 | u32 gpio_base; | 341 | u32 gpio_base; |
342 | int retval = 0; | 342 | int retval; |
343 | int ngpio = id->driver_data; | 343 | int ngpio = id->driver_data; |
344 | 344 | ||
345 | retval = pci_enable_device(pdev); | 345 | retval = pci_enable_device(pdev); |
@@ -357,6 +357,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
357 | base = ioremap_nocache(start, len); | 357 | base = ioremap_nocache(start, len); |
358 | if (!base) { | 358 | if (!base) { |
359 | dev_err(&pdev->dev, "error mapping bar1\n"); | 359 | dev_err(&pdev->dev, "error mapping bar1\n"); |
360 | retval = -EFAULT; | ||
360 | goto err3; | 361 | goto err3; |
361 | } | 362 | } |
362 | gpio_base = *((u32 *)base + 1); | 363 | gpio_base = *((u32 *)base + 1); |
@@ -381,8 +382,10 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
381 | 382 | ||
382 | lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, | 383 | lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, |
383 | &lnw_gpio_irq_ops, lnw); | 384 | &lnw_gpio_irq_ops, lnw); |
384 | if (!lnw->domain) | 385 | if (!lnw->domain) { |
386 | retval = -ENOMEM; | ||
385 | goto err3; | 387 | goto err3; |
388 | } | ||
386 | 389 | ||
387 | lnw->reg_base = base; | 390 | lnw->reg_base = base; |
388 | lnw->chip.label = dev_name(&pdev->dev); | 391 | lnw->chip.label = dev_name(&pdev->dev); |
diff --git a/drivers/gpio/gpio-msic.c b/drivers/gpio/gpio-msic.c index 71a838f44501..b38986285868 100644 --- a/drivers/gpio/gpio-msic.c +++ b/drivers/gpio/gpio-msic.c | |||
@@ -99,7 +99,7 @@ static int msic_gpio_to_oreg(unsigned offset) | |||
99 | if (offset < 20) | 99 | if (offset < 20) |
100 | return INTEL_MSIC_GPIO0HV0CTLO - offset + 16; | 100 | return INTEL_MSIC_GPIO0HV0CTLO - offset + 16; |
101 | 101 | ||
102 | return INTEL_MSIC_GPIO1HV0CTLO + offset + 20; | 102 | return INTEL_MSIC_GPIO1HV0CTLO - offset + 20; |
103 | } | 103 | } |
104 | 104 | ||
105 | static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 105 | static int msic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 4db460b6ecf7..80f44bb64a87 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -465,9 +465,8 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
465 | goto out_iounmap; | 465 | goto out_iounmap; |
466 | 466 | ||
467 | port->bgc.gc.to_irq = mxc_gpio_to_irq; | 467 | port->bgc.gc.to_irq = mxc_gpio_to_irq; |
468 | port->bgc.gc.base = pdev->id * 32; | 468 | port->bgc.gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 : |
469 | port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); | 469 | pdev->id * 32; |
470 | port->bgc.data = port->bgc.read_reg(port->bgc.reg_set); | ||
471 | 470 | ||
472 | err = gpiochip_add(&port->bgc.gc); | 471 | err = gpiochip_add(&port->bgc.gc); |
473 | if (err) | 472 | if (err) |
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 58a6a63a6ece..9cac88a65f78 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
@@ -62,6 +62,7 @@ int pxa_last_gpio; | |||
62 | 62 | ||
63 | #ifdef CONFIG_OF | 63 | #ifdef CONFIG_OF |
64 | static struct irq_domain *domain; | 64 | static struct irq_domain *domain; |
65 | static struct device_node *pxa_gpio_of_node; | ||
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | struct pxa_gpio_chip { | 68 | struct pxa_gpio_chip { |
@@ -277,6 +278,24 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
277 | (value ? GPSR_OFFSET : GPCR_OFFSET)); | 278 | (value ? GPSR_OFFSET : GPCR_OFFSET)); |
278 | } | 279 | } |
279 | 280 | ||
281 | #ifdef CONFIG_OF_GPIO | ||
282 | static int pxa_gpio_of_xlate(struct gpio_chip *gc, | ||
283 | const struct of_phandle_args *gpiospec, | ||
284 | u32 *flags) | ||
285 | { | ||
286 | if (gpiospec->args[0] > pxa_last_gpio) | ||
287 | return -EINVAL; | ||
288 | |||
289 | if (gc != &pxa_gpio_chips[gpiospec->args[0] / 32].chip) | ||
290 | return -EINVAL; | ||
291 | |||
292 | if (flags) | ||
293 | *flags = gpiospec->args[1]; | ||
294 | |||
295 | return gpiospec->args[0] % 32; | ||
296 | } | ||
297 | #endif | ||
298 | |||
280 | static int __devinit pxa_init_gpio_chip(int gpio_end, | 299 | static int __devinit pxa_init_gpio_chip(int gpio_end, |
281 | int (*set_wake)(unsigned int, unsigned int)) | 300 | int (*set_wake)(unsigned int, unsigned int)) |
282 | { | 301 | { |
@@ -304,6 +323,11 @@ static int __devinit pxa_init_gpio_chip(int gpio_end, | |||
304 | c->get = pxa_gpio_get; | 323 | c->get = pxa_gpio_get; |
305 | c->set = pxa_gpio_set; | 324 | c->set = pxa_gpio_set; |
306 | c->to_irq = pxa_gpio_to_irq; | 325 | c->to_irq = pxa_gpio_to_irq; |
326 | #ifdef CONFIG_OF_GPIO | ||
327 | c->of_node = pxa_gpio_of_node; | ||
328 | c->of_xlate = pxa_gpio_of_xlate; | ||
329 | c->of_gpio_n_cells = 2; | ||
330 | #endif | ||
307 | 331 | ||
308 | /* number of GPIOs on last bank may be less than 32 */ | 332 | /* number of GPIOs on last bank may be less than 32 */ |
309 | c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; | 333 | c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; |
@@ -488,6 +512,7 @@ static int pxa_gpio_nums(void) | |||
488 | return count; | 512 | return count; |
489 | } | 513 | } |
490 | 514 | ||
515 | #ifdef CONFIG_OF | ||
491 | static struct of_device_id pxa_gpio_dt_ids[] = { | 516 | static struct of_device_id pxa_gpio_dt_ids[] = { |
492 | { .compatible = "mrvl,pxa-gpio" }, | 517 | { .compatible = "mrvl,pxa-gpio" }, |
493 | { .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO }, | 518 | { .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO }, |
@@ -505,9 +530,9 @@ static int pxa_irq_domain_map(struct irq_domain *d, unsigned int irq, | |||
505 | 530 | ||
506 | const struct irq_domain_ops pxa_irq_domain_ops = { | 531 | const struct irq_domain_ops pxa_irq_domain_ops = { |
507 | .map = pxa_irq_domain_map, | 532 | .map = pxa_irq_domain_map, |
533 | .xlate = irq_domain_xlate_twocell, | ||
508 | }; | 534 | }; |
509 | 535 | ||
510 | #ifdef CONFIG_OF | ||
511 | static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) | 536 | static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) |
512 | { | 537 | { |
513 | int ret, nr_banks, nr_gpios, irq_base; | 538 | int ret, nr_banks, nr_gpios, irq_base; |
@@ -545,6 +570,7 @@ static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) | |||
545 | } | 570 | } |
546 | domain = irq_domain_add_legacy(np, nr_gpios, irq_base, 0, | 571 | domain = irq_domain_add_legacy(np, nr_gpios, irq_base, 0, |
547 | &pxa_irq_domain_ops, NULL); | 572 | &pxa_irq_domain_ops, NULL); |
573 | pxa_gpio_of_node = np; | ||
548 | return 0; | 574 | return 0; |
549 | err: | 575 | err: |
550 | iounmap(gpio_reg_base); | 576 | iounmap(gpio_reg_base); |
@@ -653,7 +679,7 @@ static struct platform_driver pxa_gpio_driver = { | |||
653 | .probe = pxa_gpio_probe, | 679 | .probe = pxa_gpio_probe, |
654 | .driver = { | 680 | .driver = { |
655 | .name = "pxa-gpio", | 681 | .name = "pxa-gpio", |
656 | .of_match_table = pxa_gpio_dt_ids, | 682 | .of_match_table = of_match_ptr(pxa_gpio_dt_ids), |
657 | }, | 683 | }, |
658 | }; | 684 | }; |
659 | 685 | ||
diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c index e97016af6443..b62d443e9a59 100644 --- a/drivers/gpio/gpio-rdc321x.c +++ b/drivers/gpio/gpio-rdc321x.c | |||
@@ -170,6 +170,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev) | |||
170 | rdc321x_gpio_dev->reg2_data_base = r->start + 0x4; | 170 | rdc321x_gpio_dev->reg2_data_base = r->start + 0x4; |
171 | 171 | ||
172 | rdc321x_gpio_dev->chip.label = "rdc321x-gpio"; | 172 | rdc321x_gpio_dev->chip.label = "rdc321x-gpio"; |
173 | rdc321x_gpio_dev->chip.owner = THIS_MODULE; | ||
173 | rdc321x_gpio_dev->chip.direction_input = rdc_gpio_direction_input; | 174 | rdc321x_gpio_dev->chip.direction_input = rdc_gpio_direction_input; |
174 | rdc321x_gpio_dev->chip.direction_output = rdc_gpio_config; | 175 | rdc321x_gpio_dev->chip.direction_output = rdc_gpio_config; |
175 | rdc321x_gpio_dev->chip.get = rdc_gpio_get_value; | 176 | rdc321x_gpio_dev->chip.get = rdc_gpio_get_value; |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 92f7b2bb79d4..ba126cc04073 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2454,12 +2454,6 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = { | |||
2454 | }, | 2454 | }, |
2455 | }, { | 2455 | }, { |
2456 | .chip = { | 2456 | .chip = { |
2457 | .base = EXYNOS5_GPC4(0), | ||
2458 | .ngpio = EXYNOS5_GPIO_C4_NR, | ||
2459 | .label = "GPC4", | ||
2460 | }, | ||
2461 | }, { | ||
2462 | .chip = { | ||
2463 | .base = EXYNOS5_GPD0(0), | 2457 | .base = EXYNOS5_GPD0(0), |
2464 | .ngpio = EXYNOS5_GPIO_D0_NR, | 2458 | .ngpio = EXYNOS5_GPIO_D0_NR, |
2465 | .label = "GPD0", | 2459 | .label = "GPD0", |
@@ -2513,6 +2507,12 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = { | |||
2513 | .label = "GPY6", | 2507 | .label = "GPY6", |
2514 | }, | 2508 | }, |
2515 | }, { | 2509 | }, { |
2510 | .chip = { | ||
2511 | .base = EXYNOS5_GPC4(0), | ||
2512 | .ngpio = EXYNOS5_GPIO_C4_NR, | ||
2513 | .label = "GPC4", | ||
2514 | }, | ||
2515 | }, { | ||
2516 | .config = &samsung_gpio_cfgs[9], | 2516 | .config = &samsung_gpio_cfgs[9], |
2517 | .irq_base = IRQ_EINT(0), | 2517 | .irq_base = IRQ_EINT(0), |
2518 | .chip = { | 2518 | .chip = { |
@@ -2836,7 +2836,7 @@ static __init void exynos5_gpiolib_init(void) | |||
2836 | } | 2836 | } |
2837 | 2837 | ||
2838 | /* need to set base address for gpc4 */ | 2838 | /* need to set base address for gpc4 */ |
2839 | exynos5_gpios_1[11].base = gpio_base1 + 0x2E0; | 2839 | exynos5_gpios_1[20].base = gpio_base1 + 0x2E0; |
2840 | 2840 | ||
2841 | /* need to set base address for gpx */ | 2841 | /* need to set base address for gpx */ |
2842 | chip = &exynos5_gpios_1[21]; | 2842 | chip = &exynos5_gpios_1[21]; |
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c index 424dce8e3f30..8707d4572a06 100644 --- a/drivers/gpio/gpio-sch.c +++ b/drivers/gpio/gpio-sch.c | |||
@@ -241,7 +241,8 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev) | |||
241 | break; | 241 | break; |
242 | 242 | ||
243 | default: | 243 | default: |
244 | return -ENODEV; | 244 | err = -ENODEV; |
245 | goto err_sch_gpio_core; | ||
245 | } | 246 | } |
246 | 247 | ||
247 | sch_gpio_core.dev = &pdev->dev; | 248 | sch_gpio_core.dev = &pdev->dev; |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a18c4aa68b1e..f1a45997aea8 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -82,7 +82,7 @@ int of_get_named_gpio_flags(struct device_node *np, const char *propname, | |||
82 | gpiochip_find(&gg_data, of_gpiochip_find_and_xlate); | 82 | gpiochip_find(&gg_data, of_gpiochip_find_and_xlate); |
83 | 83 | ||
84 | of_node_put(gg_data.gpiospec.np); | 84 | of_node_put(gg_data.gpiospec.np); |
85 | pr_debug("%s exited with status %d\n", __func__, ret); | 85 | pr_debug("%s exited with status %d\n", __func__, gg_data.out_gpio); |
86 | return gg_data.out_gpio; | 86 | return gg_data.out_gpio; |
87 | } | 87 | } |
88 | EXPORT_SYMBOL(of_get_named_gpio_flags); | 88 | EXPORT_SYMBOL(of_get_named_gpio_flags); |