| 1 | --- a/drivers/ssb/embedded.c |
| 2 | +++ b/drivers/ssb/embedded.c |
| 3 | @@ -171,6 +171,18 @@ u32 ssb_gpio_polarity(struct ssb_bus *bu |
| 4 | } |
| 5 | EXPORT_SYMBOL(ssb_gpio_polarity); |
| 6 | |
| 7 | +int ssb_gpio_count(struct ssb_bus *bus) |
| 8 | +{ |
| 9 | + if (ssb_chipco_available(&bus->chipco)) |
| 10 | + return SSB_GPIO_CHIPCO_LINES; |
| 11 | + else if (ssb_extif_available(&bus->extif)) |
| 12 | + return SSB_GPIO_EXTIF_LINES; |
| 13 | + else |
| 14 | + SSB_WARN_ON(1); |
| 15 | + return 0; |
| 16 | +} |
| 17 | +EXPORT_SYMBOL(ssb_gpio_count); |
| 18 | + |
| 19 | #ifdef CONFIG_SSB_DRIVER_GIGE |
| 20 | static int gige_pci_init_callback(struct ssb_bus *bus, unsigned long data) |
| 21 | { |
| 22 | --- a/include/linux/ssb/ssb_embedded.h |
| 23 | +++ b/include/linux/ssb/ssb_embedded.h |
| 24 | @@ -7,6 +7,9 @@ |
| 25 | |
| 26 | extern int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks); |
| 27 | |
| 28 | +#define SSB_GPIO_EXTIF_LINES 5 |
| 29 | +#define SSB_GPIO_CHIPCO_LINES 16 |
| 30 | + |
| 31 | /* Generic GPIO API */ |
| 32 | u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask); |
| 33 | u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value); |
| 34 | @@ -14,5 +17,6 @@ u32 ssb_gpio_outen(struct ssb_bus *bus, |
| 35 | u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value); |
| 36 | u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value); |
| 37 | u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value); |
| 38 | +int ssb_gpio_count(struct ssb_bus *bus); |
| 39 | |
| 40 | #endif /* LINUX_SSB_EMBEDDED_H_ */ |
| 41 | |