return -ENXIO; \
} else { \
sysRegWrite(AR531X_GPIO_CR, \
- ( sysRegRead(AR531X_GPIO_CR) & \
- ~(AR531X_GPIO_CR_M(gpio)) ) | \
- AR531X_GPIO_CR_I(gpio) ); \
+ sysRegRead(AR531X_GPIO_CR) | \
+ AR531X_GPIO_CR_I(gpio) ); \
return 0; \
} \
)
return 0; \
} \
)
+ return -ENXIO;
}
/* Sets a gpio to output with value, or returns ENXIO for non-existent gpio */
~(1 << gpio) ) | \
((value!=0) << gpio)) ); \
sysRegWrite(AR531X_GPIO_CR, \
- sysRegRead(AR531X_GPIO_CR) | \
- AR531X_GPIO_CR_O(gpio) ); \
+ ( sysRegRead(AR531X_GPIO_CR) & \
+ ~(AR531X_GPIO_CR_M(gpio)) )); \
return 0; \
} \
)
return 0; \
} \
)
+ return -ENXIO;
}
/* Reads the gpio pin. Unchecked function */
static inline int gpio_get_value(unsigned gpio) {
DO_AR5312(return (sysRegRead(AR531X_GPIO_DI) & (1 << gpio));)
DO_AR5315(return (sysRegRead(AR5315_GPIO_DI) & (1 << gpio));)
+ return 0;
}
/* Writes to the gpio pin. Unchecked function */
return (irq - (AR531X_GPIO_IRQ(0)));
}
-/* #include <asm-generic/gpio.h> */ /* cansleep wrappers */
-/* platforms that don't directly support access to GPIOs through I2C, SPI,
- * or other blocking infrastructure can use these wrappers.
- */
-
-static inline int gpio_cansleep(unsigned gpio) {
- return 0;
-}
-
-static inline int gpio_get_value_cansleep(unsigned gpio) {
- might_sleep();
- return gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value_cansleep(unsigned gpio, int value) {
- might_sleep();
- gpio_set_value(gpio, value);
-}
+#include <asm-generic/gpio.h> /* cansleep wrappers */
#endif
-