aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb/driver_gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ssb/driver_gpio.c')
-rw-r--r--drivers/ssb/driver_gpio.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/ssb/driver_gpio.c b/drivers/ssb/driver_gpio.c
index 97ac0a38e3d0..accabe39b320 100644
--- a/drivers/ssb/driver_gpio.c
+++ b/drivers/ssb/driver_gpio.c
@@ -74,6 +74,16 @@ static void ssb_gpio_chipco_free(struct gpio_chip *chip, unsigned gpio)
74 ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0); 74 ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0);
75} 75}
76 76
77static int ssb_gpio_chipco_to_irq(struct gpio_chip *chip, unsigned gpio)
78{
79 struct ssb_bus *bus = ssb_gpio_get_bus(chip);
80
81 if (bus->bustype == SSB_BUSTYPE_SSB)
82 return ssb_mips_irq(bus->chipco.dev) + 2;
83 else
84 return -EINVAL;
85}
86
77static int ssb_gpio_chipco_init(struct ssb_bus *bus) 87static int ssb_gpio_chipco_init(struct ssb_bus *bus)
78{ 88{
79 struct gpio_chip *chip = &bus->gpio; 89 struct gpio_chip *chip = &bus->gpio;
@@ -86,6 +96,7 @@ static int ssb_gpio_chipco_init(struct ssb_bus *bus)
86 chip->set = ssb_gpio_chipco_set_value; 96 chip->set = ssb_gpio_chipco_set_value;
87 chip->direction_input = ssb_gpio_chipco_direction_input; 97 chip->direction_input = ssb_gpio_chipco_direction_input;
88 chip->direction_output = ssb_gpio_chipco_direction_output; 98 chip->direction_output = ssb_gpio_chipco_direction_output;
99 chip->to_irq = ssb_gpio_chipco_to_irq;
89 chip->ngpio = 16; 100 chip->ngpio = 16;
90 /* There is just one SoC in one device and its GPIO addresses should be 101 /* There is just one SoC in one device and its GPIO addresses should be
91 * deterministic to address them more easily. The other buses could get 102 * deterministic to address them more easily. The other buses could get
@@ -134,6 +145,16 @@ static int ssb_gpio_extif_direction_output(struct gpio_chip *chip,
134 return 0; 145 return 0;
135} 146}
136 147
148static int ssb_gpio_extif_to_irq(struct gpio_chip *chip, unsigned gpio)
149{
150 struct ssb_bus *bus = ssb_gpio_get_bus(chip);
151
152 if (bus->bustype == SSB_BUSTYPE_SSB)
153 return ssb_mips_irq(bus->extif.dev) + 2;
154 else
155 return -EINVAL;
156}
157
137static int ssb_gpio_extif_init(struct ssb_bus *bus) 158static int ssb_gpio_extif_init(struct ssb_bus *bus)
138{ 159{
139 struct gpio_chip *chip = &bus->gpio; 160 struct gpio_chip *chip = &bus->gpio;
@@ -144,6 +165,7 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus)
144 chip->set = ssb_gpio_extif_set_value; 165 chip->set = ssb_gpio_extif_set_value;
145 chip->direction_input = ssb_gpio_extif_direction_input; 166 chip->direction_input = ssb_gpio_extif_direction_input;
146 chip->direction_output = ssb_gpio_extif_direction_output; 167 chip->direction_output = ssb_gpio_extif_direction_output;
168 chip->to_irq = ssb_gpio_extif_to_irq;
147 chip->ngpio = 5; 169 chip->ngpio = 5;
148 /* There is just one SoC in one device and its GPIO addresses should be 170 /* There is just one SoC in one device and its GPIO addresses should be
149 * deterministic to address them more easily. The other buses could get 171 * deterministic to address them more easily. The other buses could get