add chaos_calmer branch
[15.05/openwrt.git] / target / linux / brcm63xx / patches-3.18 / 379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch
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
7 To prepare for a time when gpiobases don't need to be fixed anymore.
8
9 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 ---
11  arch/mips/bcm63xx/dev-pcmcia.c |   13 +++++++++++++
12  1 file changed, 13 insertions(+)
13
14 --- a/arch/mips/bcm63xx/dev-pcmcia.c
15 +++ b/arch/mips/bcm63xx/dev-pcmcia.c
16 @@ -10,6 +10,7 @@
17  #include <linux/kernel.h>
18  #include <asm/bootinfo.h>
19  #include <linux/platform_device.h>
20 +#include <linux/gpio/machine.h>
21  #include <bcm63xx_cs.h>
22  #include <bcm63xx_cpu.h>
23  #include <bcm63xx_dev_pcmcia.h>
24 @@ -101,6 +102,14 @@ static const struct {
25         },
26  };
27  
28 +static struct gpiod_lookup_table pcmcia_gpios_table = {
29 +       .dev_id = "bcm63xx_pcmcia.0",
30 +       .table = {
31 +               GPIO_LOOKUP("bcm63xx-gpio.0", 0, "ready", GPIO_ACTIVE_HIGH),
32 +               { },
33 +       },
34 +};
35 +
36  int __init bcm63xx_pcmcia_register(void)
37  {
38         int ret, i;
39 @@ -112,16 +121,20 @@ int __init bcm63xx_pcmcia_register(void)
40         switch (bcm63xx_get_cpu_id()) {
41         case BCM6348_CPU_ID:
42                 pd.ready_gpio = 22;
43 +               pcmcia_gpios_table.table[0].chip_hwnum = 22;
44                 break;
45  
46         case BCM6358_CPU_ID:
47                 pd.ready_gpio = 18;
48 +               pcmcia_gpios_table.table[0].chip_hwnum = 18;
49                 break;
50  
51         default:
52                 return -ENODEV;
53         }
54  
55 +       gpiod_add_lookup_table(&pcmcia_gpios_table);
56 +
57         pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA);
58         pcmcia_resources[0].end = pcmcia_resources[0].start +
59                 RSET_PCMCIA_SIZE - 1;