379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 1647cccc871bf43876c3df9852869680880d054c Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Wed, 25 Mar 2015 13:52:02 +0100
  4. Subject: [PATCH 1/2] MIPS: BCM63XX: provide a gpio lookup for the pcmcia
  5. ready gpio
  6. To prepare for a time when gpiobases don't need to be fixed anymore.
  7. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  8. ---
  9. arch/mips/bcm63xx/dev-pcmcia.c | 13 +++++++++++++
  10. 1 file changed, 13 insertions(+)
  11. --- a/arch/mips/bcm63xx/dev-pcmcia.c
  12. +++ b/arch/mips/bcm63xx/dev-pcmcia.c
  13. @@ -10,6 +10,7 @@
  14. #include <linux/kernel.h>
  15. #include <asm/bootinfo.h>
  16. #include <linux/platform_device.h>
  17. +#include <linux/gpio/machine.h>
  18. #include <bcm63xx_cs.h>
  19. #include <bcm63xx_cpu.h>
  20. #include <bcm63xx_dev_pcmcia.h>
  21. @@ -101,6 +102,14 @@ static const struct {
  22. },
  23. };
  24. +static struct gpiod_lookup_table pcmcia_gpios_table = {
  25. + .dev_id = "bcm63xx_pcmcia.0",
  26. + .table = {
  27. + GPIO_LOOKUP("bcm63xx-gpio.0", 0, "ready", GPIO_ACTIVE_HIGH),
  28. + { },
  29. + },
  30. +};
  31. +
  32. int __init bcm63xx_pcmcia_register(void)
  33. {
  34. int ret, i;
  35. @@ -112,16 +121,20 @@ int __init bcm63xx_pcmcia_register(void)
  36. switch (bcm63xx_get_cpu_id()) {
  37. case BCM6348_CPU_ID:
  38. pd.ready_gpio = 22;
  39. + pcmcia_gpios_table.table[0].chip_hwnum = 22;
  40. break;
  41. case BCM6358_CPU_ID:
  42. pd.ready_gpio = 18;
  43. + pcmcia_gpios_table.table[0].chip_hwnum = 18;
  44. break;
  45. default:
  46. return -ENODEV;
  47. }
  48. + gpiod_add_lookup_table(&pcmcia_gpios_table);
  49. +
  50. pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA);
  51. pcmcia_resources[0].end = pcmcia_resources[0].start +
  52. RSET_PCMCIA_SIZE - 1;