Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pcmcia: db1xxx_ss: fix last irq_to_gpio user

remove the usage of removed irq_to_gpio() function. On pre-DB1200
boards, pass the actual carddetect GPIO number instead of the IRQ,
because we need the gpio to actually test card status (inserted or
not) and can get the irq number with gpio_to_irq() instead.

Tested on DB1300 and DB1500, this patch fixes PCMCIA on the DB1500,
which used irq_to_gpio().

Fixes: 832f5dacfa0b ("MIPS: Remove all the uses of custom gpio.h")
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-pcmcia@lists.infradead.org
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Cc: stable@vger.kernel.org # v4.3+
Patchwork: https://patchwork.linux-mips.org/patch/12747/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Manuel Lauss and committed by
Ralf Baechle
e34b6fcf fa8ff601

+19 -14
+8 -10
arch/mips/alchemy/devboards/db1000.c
··· 503 503 if (board == BCSR_WHOAMI_DB1500) { 504 504 c0 = AU1500_GPIO2_INT; 505 505 c1 = AU1500_GPIO5_INT; 506 - d0 = AU1500_GPIO0_INT; 507 - d1 = AU1500_GPIO3_INT; 506 + d0 = 0; /* GPIO number, NOT irq! */ 507 + d1 = 3; /* GPIO number, NOT irq! */ 508 508 s0 = AU1500_GPIO1_INT; 509 509 s1 = AU1500_GPIO4_INT; 510 510 } else if (board == BCSR_WHOAMI_DB1100) { 511 511 c0 = AU1100_GPIO2_INT; 512 512 c1 = AU1100_GPIO5_INT; 513 - d0 = AU1100_GPIO0_INT; 514 - d1 = AU1100_GPIO3_INT; 513 + d0 = 0; /* GPIO number, NOT irq! */ 514 + d1 = 3; /* GPIO number, NOT irq! */ 515 515 s0 = AU1100_GPIO1_INT; 516 516 s1 = AU1100_GPIO4_INT; 517 517 ··· 545 545 } else if (board == BCSR_WHOAMI_DB1000) { 546 546 c0 = AU1000_GPIO2_INT; 547 547 c1 = AU1000_GPIO5_INT; 548 - d0 = AU1000_GPIO0_INT; 549 - d1 = AU1000_GPIO3_INT; 548 + d0 = 0; /* GPIO number, NOT irq! */ 549 + d1 = 3; /* GPIO number, NOT irq! */ 550 550 s0 = AU1000_GPIO1_INT; 551 551 s1 = AU1000_GPIO4_INT; 552 552 platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs)); 553 553 } else if ((board == BCSR_WHOAMI_PB1500) || 554 554 (board == BCSR_WHOAMI_PB1500R2)) { 555 555 c0 = AU1500_GPIO203_INT; 556 - d0 = AU1500_GPIO201_INT; 556 + d0 = 1; /* GPIO number, NOT irq! */ 557 557 s0 = AU1500_GPIO202_INT; 558 558 twosocks = 0; 559 559 flashsize = 64; ··· 566 566 */ 567 567 } else if (board == BCSR_WHOAMI_PB1100) { 568 568 c0 = AU1100_GPIO11_INT; 569 - d0 = AU1100_GPIO9_INT; 569 + d0 = 9; /* GPIO number, NOT irq! */ 570 570 s0 = AU1100_GPIO10_INT; 571 571 twosocks = 0; 572 572 flashsize = 64; ··· 583 583 } else 584 584 return 0; /* unknown board, no further dev setup to do */ 585 585 586 - irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH); 587 586 irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW); 588 587 irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW); 589 588 ··· 596 597 c0, d0, /*s0*/0, 0, 0); 597 598 598 599 if (twosocks) { 599 - irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH); 600 600 irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW); 601 601 irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW); 602 602
+2 -2
arch/mips/alchemy/devboards/db1550.c
··· 514 514 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, 515 515 AU1000_PCMCIA_IO_PHYS_ADDR, 516 516 AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, 517 - AU1550_GPIO3_INT, AU1550_GPIO0_INT, 517 + AU1550_GPIO3_INT, 0, 518 518 /*AU1550_GPIO21_INT*/0, 0, 0); 519 519 520 520 db1x_register_pcmcia_socket( ··· 524 524 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, 525 525 AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, 526 526 AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, 527 - AU1550_GPIO5_INT, AU1550_GPIO1_INT, 527 + AU1550_GPIO5_INT, 1, 528 528 /*AU1550_GPIO22_INT*/0, 0, 1); 529 529 530 530 platform_device_register(&db1550_nand_dev);
+9 -2
drivers/pcmcia/db1xxx_ss.c
··· 56 56 int stschg_irq; /* card-status-change irq */ 57 57 int card_irq; /* card irq */ 58 58 int eject_irq; /* db1200/pb1200 have these */ 59 + int insert_gpio; /* db1000 carddetect gpio */ 59 60 60 61 #define BOARD_TYPE_DEFAULT 0 /* most boards */ 61 62 #define BOARD_TYPE_DB1200 1 /* IRQs aren't gpios */ ··· 84 83 /* carddetect gpio: low-active */ 85 84 static int db1000_card_inserted(struct db1x_pcmcia_sock *sock) 86 85 { 87 - return !gpio_get_value(irq_to_gpio(sock->insert_irq)); 86 + return !gpio_get_value(sock->insert_gpio); 88 87 } 89 88 90 89 static int db1x_card_inserted(struct db1x_pcmcia_sock *sock) ··· 458 457 r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "card"); 459 458 sock->card_irq = r ? r->start : 0; 460 459 461 - /* insert: irq which triggers on card insertion/ejection */ 460 + /* insert: irq which triggers on card insertion/ejection 461 + * BIG FAT NOTE: on DB1000/1100/1500/1550 we pass a GPIO here! 462 + */ 462 463 r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "insert"); 463 464 sock->insert_irq = r ? r->start : -1; 465 + if (sock->board_type == BOARD_TYPE_DEFAULT) { 466 + sock->insert_gpio = r ? r->start : -1; 467 + sock->insert_irq = r ? gpio_to_irq(r->start) : -1; 468 + } 464 469 465 470 /* stschg: irq which trigger on card status change (optional) */ 466 471 r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "stschg");