Skip to content

Commit a6ca2e1

Browse files
haukelinvjw
authored andcommitted
ssb: add gpio_to_irq
The old bcm47xx gpio code had support for gpio_to_irq, but the new code did not provide this function, but returned -ENXIO all the time. This patch adds the missing function. arch/mips/bcm47xx/wgt634u.c calls gpio_to_irq() and got the correct irq number with the old gpio handling code. With this patch the code in wgt634u.c should work again. I do not have a wgt634u to test this. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 5b2e2ec commit a6ca2e1

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎drivers/ssb/driver_gpio.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ static void ssb_gpio_chipco_free(struct gpio_chip *chip, unsigned gpio)
7474
ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0);
7575
}
7676

77+
static 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+
7787
static int ssb_gpio_chipco_init(struct ssb_bus *bus)
7888
{
7989
struct gpio_chip *chip = &bus->gpio;
@@ -86,6 +96,7 @@ static int ssb_gpio_chipco_init(struct ssb_bus *bus)
8696
chip->set = ssb_gpio_chipco_set_value;
8797
chip->direction_input = ssb_gpio_chipco_direction_input;
8898
chip->direction_output = ssb_gpio_chipco_direction_output;
99+
chip->to_irq = ssb_gpio_chipco_to_irq;
89100
chip->ngpio = 16;
90101
/* There is just one SoC in one device and its GPIO addresses should be
91102
* 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,
134145
return 0;
135146
}
136147

148+
static 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+
137158
static int ssb_gpio_extif_init(struct ssb_bus *bus)
138159
{
139160
struct gpio_chip *chip = &bus->gpio;
@@ -144,6 +165,7 @@ static int ssb_gpio_extif_init(struct ssb_bus *bus)
144165
chip->set = ssb_gpio_extif_set_value;
145166
chip->direction_input = ssb_gpio_extif_direction_input;
146167
chip->direction_output = ssb_gpio_extif_direction_output;
168+
chip->to_irq = ssb_gpio_extif_to_irq;
147169
chip->ngpio = 5;
148170
/* There is just one SoC in one device and its GPIO addresses should be
149171
* deterministic to address them more easily. The other buses could get

‎include/linux/ssb/ssb_driver_mips.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
4545
{
4646
}
4747

48+
static inline unsigned int ssb_mips_irq(struct ssb_device *dev)
49+
{
50+
return 0;
51+
}
52+
4853
#endif /* CONFIG_SSB_DRIVER_MIPS */
4954

5055
#endif /* LINUX_SSB_MIPSCORE_H_ */

0 commit comments

Comments
 (0)