x86: Add user configurable GPIO-lib support
More food for thought ...
This makes the rdc321x support switch over to using gpiolib, along with all of x86. Quick'n'dirty.
It's perhaps best done in conjunction with something to make GPIOLIB be user-configurable on systems where it's not already selected by platform code. The rdc321x stuff needs more working, but this is a start.
- Dave
--- arch/x86/Kconfig | 6 + arch/x86/mach-rdc321x/gpio.c | 107 ++++++++-------------------- arch/x86/mach-rdc321x/platform.c | 3 include/asm-x86/gpio.h | 22 +++++ include/asm-x86/mach-rdc321x/gpio.h | 52 ------------- include/asm-x86/mach-rdc321x/rdc321x_defs.h | 2 6 files changed, 62 insertions(+), 130 deletions(-)
arch/x86/Kconfig +4 -2
@@ -87,7 +87,10 @@ config GENERIC_HWEIGHT def_bool y config GENERIC_GPIO - def_bool n + def_bool y + +config HAVE_GPIO_LIB + def_bool y config ARCH_MAY_HAVE_PC_FDC def_bool y
@@ -325,7 +328,6 @@ config X86_RDC321X depends on X86_32 select M486 select X86_REBOOTFIXUPS - select GENERIC_GPIO select LEDS_CLASS select LEDS_GPIO select NEW_LEDS
arch/x86/mach-rdc321x/gpio.c +33 -74
166 lines not on this page · raw message
arch/x86/mach-rdc321x/platform.c +1 -2
@@ -27,8 +27,7 @@#include <linux/platform_device.h> #include <linux/version.h> #include <linux/leds.h> - -#include <asm/gpio.h> +#include <linux/gpio.h> /* LEDS */ static struct gpio_led default_leds[] = {
include/asm-x86/gpio.h +21 -1
@@ -1,6 +1,26 @@#ifndef _ASM_I386_GPIO_H#define _ASM_I386_GPIO_H -#include <gpio.h> +#include <linux/errno.h> + +#ifdef CONFIG_X86_RDC321X +#include <asm/mach-rdc321x/gpio.h> +#endif + +#include <asm-generic/gpio.h> + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value +#define gpio_cansleep __gpio_cansleep + +static inline int gpio_to_irq (unsigned gpio) +{ +return -ENOSYS ; +} + +static inline int irq_to_gpio (unsigned irq) +{ +return -EINVAL ; +}#endif /* _ASM_I386_GPIO_H */
include/asm-x86/mach-rdc321x/gpio.h +3 -49
60 lines not on this page · raw message
include/asm-x86/mach-rdc321x/rdc321x_defs.h +0 -2
@@ -8,5 +8,3 @@#define RDC321X_GPIO_CTRL_REG2 0x84#define RDC321X_GPIO_DATA_REG1 0x4c#define RDC321X_GPIO_DATA_REG2 0x88 - -#define RDC321X_MAX_GPIO 58
Quoted 24 lines · On Wednesday 02 July 2008 04:57:41 David Brownell wrote:
More food for thought ...
This makes the rdc321x support switch over to using gpiolib, along with all of x86. Quick'n'dirty.
It's perhaps best done in conjunction with something to make GPIOLIB be user-configurable on systems where it's not already selected by platform code. The rdc321x stuff needs more working, but this is a start.
- Dave
--- arch/x86/Kconfig | 6 + arch/x86/mach-rdc321x/gpio.c | 107 ++++++++-------------------- arch/x86/mach-rdc321x/platform.c | 3 include/asm-x86/gpio.h | 22 +++++ include/asm-x86/mach-rdc321x/gpio.h | 52 ------------- include/asm-x86/mach-rdc321x/rdc321x_defs.h | 2 6 files changed, 62 insertions(+), 130 deletions(-)
arch/x86/Kconfig config GENERIC_HWEIGHT · line 93
Quoted 8 lines
arch/x86/Kconfig +4
-1@@ -87,7 +87,10 @@ config GENERIC_HWEIGHT def_bool y config GENERIC_GPIO - def_bool n + def_bool y + +config HAVE_GPIO_LIB + def_bool y
I think we should not unconditionally compile in gpiolib. See my other patch that converts the stuff to be user selectable.
(Too bad all my mail bounces at Daves mailfilter and this won't reach him... :/ )
Signature · 1 line
Greetings Michael.