mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-11 23:25:55 +02:00
115a129a30
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11933 3c298f89-4303-0410-b956-a3cf2f4a3e73
39 lines
1.0 KiB
Diff
39 lines
1.0 KiB
Diff
Add gpio_is_valid() for bcm47xx
|
|
--- a/arch/mips/bcm47xx/gpio.c
|
|
+++ b/arch/mips/bcm47xx/gpio.c
|
|
@@ -77,3 +77,15 @@
|
|
}
|
|
EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_output);
|
|
|
|
+int bcm47xx_gpio_is_valid(int gpio)
|
|
+{
|
|
+ if (ssb_bcm47xx.chipco.dev) {
|
|
+ if (gpio >= 0 && gpio < BCM47XX_CHIPCO_GPIO_LINES)
|
|
+ return 1;
|
|
+ } else if (ssb_bcm47xx.extif.dev) {
|
|
+ if (gpio >= 0 && gpio < BCM47XX_EXTIF_GPIO_LINES)
|
|
+ return 1;
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
+EXPORT_SYMBOL_GPL(bcm47xx_gpio_is_valid);
|
|
--- a/include/asm-mips/mach-bcm47xx/gpio.h
|
|
+++ b/include/asm-mips/mach-bcm47xx/gpio.h
|
|
@@ -17,6 +17,7 @@
|
|
extern void bcm47xx_gpio_set_value(unsigned gpio, int value);
|
|
extern int bcm47xx_gpio_direction_input(unsigned gpio);
|
|
extern int bcm47xx_gpio_direction_output(unsigned gpio, int value);
|
|
+extern int bcm47xx_gpio_is_valid(int gpio);
|
|
|
|
static inline int gpio_request(unsigned gpio, const char *label)
|
|
{
|
|
@@ -52,6 +53,8 @@
|
|
return bcm47xx_gpio_direction_output(gpio, value);
|
|
}
|
|
|
|
+#define gpio_is_valid bcm47xx_gpio_is_valid
|
|
+
|
|
|
|
/* cansleep wrappers */
|
|
#include <asm-generic/gpio.h>
|