aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-pxa.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-08-24 10:25:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-24 10:25:10 -0400
commit79e8c7bebb467bbc3f2514d75bba669a3f354324 (patch)
tree5a07985daff3e50751ec40c51c4536d8f2284031 /drivers/gpio/gpio-pxa.c
parenta47b6118e134b51562de520d644d3979b3d99e44 (diff)
parentfea7a08acb13524b47711625eebea40a0ede69a0 (diff)
Merge tag 'v3.6-rc3' into staging/for_v3.7
Linux 3.6-rc3 * tag 'v3.6-rc3': (764 commits) Linux 3.6-rc3 task_work: add a scheduling point in task_work_run() fs: fix fs/namei.c kernel-doc warnings eventpoll: use-after-possible-free in epoll_create1() vfio: grab vfio_device reference *before* exposing the sucker via fd_install() vfio: get rid of vfio_device_put()/vfio_group_get_device* races vfio: get rid of open-coding kref_put_mutex introduce kref_put_mutex() vfio: don't dereference after kfree... fbcon: fix race condition between console lock and cursor timer (v1.1) mm: compaction: Abort async compaction if locks are contended or taking too long mm: have order > 0 compaction start near a pageblock with free pages rapidio/tsi721: fix unused variable compiler warning rapidio/tsi721: fix inbound doorbell interrupt handling drivers/rtc/rtc-rs5c348.c: fix hour decoding in 12-hour mode mm: correct page->pfmemalloc to fix deactivate_slab regression drivers/rtc/rtc-pcf2123.c: initialize dynamic sysfs attributes mm/compaction.c: fix deferring compaction mistake drivers/misc/sgi-xp/xpc_uv.c: SGI XPC fails to load when cpu 0 is out of IRQ resources string: do not export memweight() to userspace ...
Diffstat (limited to 'drivers/gpio/gpio-pxa.c')
-rw-r--r--drivers/gpio/gpio-pxa.c30
1 files changed, 28 insertions, 2 deletions
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
64static struct irq_domain *domain; 64static struct irq_domain *domain;
65static struct device_node *pxa_gpio_of_node;
65#endif 66#endif
66 67
67struct pxa_gpio_chip { 68struct 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
282static 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
280static int __devinit pxa_init_gpio_chip(int gpio_end, 299static 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
491static struct of_device_id pxa_gpio_dt_ids[] = { 516static 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
506const struct irq_domain_ops pxa_irq_domain_ops = { 531const 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
511static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) 536static 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;
549err: 575err:
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