diff options
author | Michael Buesch <mb@bu3sch.de> | 2008-07-25 04:46:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:30 -0400 |
commit | 7444a72effa632fcd8edc566f880d96fe213c73b (patch) | |
tree | 89d3e70c22751a6b00091df2b4dce7202eb3b1f5 | |
parent | ff1d5c2f0268f4e32103536e2e65480b5b7b6530 (diff) |
gpiolib: allow user-selection
This patch adds functionality to the gpio-lib subsystem to make it
possible to enable the gpio-lib code even if the architecture code didn't
request to get it built in.
The archtitecture code does still need to implement the gpiolib accessor
functions in its asm/gpio.h file. This patch adds the implementations for
x86 and PPC.
With these changes it is possible to run generic GPIO expansion cards on
every architecture that implements the trivial wrapper functions. Support
for more architectures can easily be added.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Brownell <david-b@pacbell.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/gpio.txt | 12 | ||||
-rw-r--r-- | arch/arm/Kconfig | 8 | ||||
-rw-r--r-- | arch/avr32/Kconfig | 2 | ||||
-rw-r--r-- | arch/mips/Kconfig | 2 | ||||
-rw-r--r-- | arch/powerpc/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/52xx/Kconfig | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/Kconfig | 2 | ||||
-rw-r--r-- | arch/x86/Kconfig | 1 | ||||
-rw-r--r-- | drivers/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpio/Kconfig | 33 | ||||
-rw-r--r-- | drivers/gpio/Makefile | 2 | ||||
-rw-r--r-- | drivers/i2c/chips/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mfd/Kconfig | 4 | ||||
-rw-r--r-- | drivers/of/Kconfig | 2 | ||||
-rw-r--r-- | include/asm-generic/gpio.h | 2 | ||||
-rw-r--r-- | include/asm-mips/mach-generic/gpio.h | 2 | ||||
-rw-r--r-- | include/asm-powerpc/gpio.h | 4 | ||||
-rw-r--r-- | include/asm-x86/gpio.h | 56 |
18 files changed, 116 insertions, 23 deletions
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 8b69811a9642..18022e249c53 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -389,11 +389,21 @@ either NULL or the label associated with that GPIO when it was requested. | |||
389 | 389 | ||
390 | Platform Support | 390 | Platform Support |
391 | ---------------- | 391 | ---------------- |
392 | To support this framework, a platform's Kconfig will "select HAVE_GPIO_LIB" | 392 | To support this framework, a platform's Kconfig will "select" either |
393 | ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB | ||
393 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines | 394 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines |
394 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). | 395 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). |
395 | They may also want to provide a custom value for ARCH_NR_GPIOS. | 396 | They may also want to provide a custom value for ARCH_NR_GPIOS. |
396 | 397 | ||
398 | ARCH_REQUIRE_GPIOLIB means that the gpio-lib code will always get compiled | ||
399 | into the kernel on that architecture. | ||
400 | |||
401 | ARCH_WANT_OPTIONAL_GPIOLIB means the gpio-lib code defaults to off and the user | ||
402 | can enable it and build it into the kernel optionally. | ||
403 | |||
404 | If neither of these options are selected, the platform does not support | ||
405 | GPIOs through GPIO-lib and the code cannot be enabled by the user. | ||
406 | |||
397 | Trivial implementations of those functions can directly use framework | 407 | Trivial implementations of those functions can directly use framework |
398 | code, which always dispatches through the gpio_chip: | 408 | code, which always dispatches through the gpio_chip: |
399 | 409 | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 6fb4f03369f2..dabb015aa40b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -268,7 +268,7 @@ config ARCH_EP93XX | |||
268 | select GENERIC_GPIO | 268 | select GENERIC_GPIO |
269 | select HAVE_CLK | 269 | select HAVE_CLK |
270 | select HAVE_CLK | 270 | select HAVE_CLK |
271 | select HAVE_GPIO_LIB | 271 | select ARCH_REQUIRE_GPIOLIB |
272 | help | 272 | help |
273 | This enables support for the Cirrus EP93xx series of CPUs. | 273 | This enables support for the Cirrus EP93xx series of CPUs. |
274 | 274 | ||
@@ -447,7 +447,7 @@ config ARCH_PXA | |||
447 | select ARCH_MTD_XIP | 447 | select ARCH_MTD_XIP |
448 | select GENERIC_GPIO | 448 | select GENERIC_GPIO |
449 | select HAVE_CLK | 449 | select HAVE_CLK |
450 | select HAVE_GPIO_LIB | 450 | select ARCH_REQUIRE_GPIOLIB |
451 | select GENERIC_TIME | 451 | select GENERIC_TIME |
452 | select GENERIC_CLOCKEVENTS | 452 | select GENERIC_CLOCKEVENTS |
453 | select TICK_ONESHOT | 453 | select TICK_ONESHOT |
@@ -479,7 +479,7 @@ config ARCH_SA1100 | |||
479 | select GENERIC_CLOCKEVENTS | 479 | select GENERIC_CLOCKEVENTS |
480 | select HAVE_CLK | 480 | select HAVE_CLK |
481 | select TICK_ONESHOT | 481 | select TICK_ONESHOT |
482 | select HAVE_GPIO_LIB | 482 | select ARCH_REQUIRE_GPIOLIB |
483 | help | 483 | help |
484 | Support for StrongARM 11x0 based boards. | 484 | Support for StrongARM 11x0 based boards. |
485 | 485 | ||
@@ -522,7 +522,7 @@ config ARCH_OMAP | |||
522 | bool "TI OMAP" | 522 | bool "TI OMAP" |
523 | select GENERIC_GPIO | 523 | select GENERIC_GPIO |
524 | select HAVE_CLK | 524 | select HAVE_CLK |
525 | select HAVE_GPIO_LIB | 525 | select ARCH_REQUIRE_GPIOLIB |
526 | select GENERIC_TIME | 526 | select GENERIC_TIME |
527 | select GENERIC_CLOCKEVENTS | 527 | select GENERIC_CLOCKEVENTS |
528 | help | 528 | help |
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index df4adefedb42..7c239a916275 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -88,7 +88,7 @@ config PLATFORM_AT32AP | |||
88 | select SUBARCH_AVR32B | 88 | select SUBARCH_AVR32B |
89 | select MMU | 89 | select MMU |
90 | select PERFORMANCE_COUNTERS | 90 | select PERFORMANCE_COUNTERS |
91 | select HAVE_GPIO_LIB | 91 | select ARCH_REQUIRE_GPIOLIB |
92 | select GENERIC_ALLOCATOR | 92 | select GENERIC_ALLOCATOR |
93 | 93 | ||
94 | # | 94 | # |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b9c754f4070c..b4c4eaa5dd26 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -713,7 +713,7 @@ config CSRC_SB1250 | |||
713 | 713 | ||
714 | config GPIO_TXX9 | 714 | config GPIO_TXX9 |
715 | select GENERIC_GPIO | 715 | select GENERIC_GPIO |
716 | select HAVE_GPIO_LIB | 716 | select ARCH_REQUIRE_GPIOLIB |
717 | bool | 717 | bool |
718 | 718 | ||
719 | config CFE | 719 | config CFE |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index de6b49cd6be8..fe88418167c5 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -110,6 +110,7 @@ config PPC | |||
110 | default y | 110 | default y |
111 | select HAVE_DYNAMIC_FTRACE | 111 | select HAVE_DYNAMIC_FTRACE |
112 | select HAVE_FTRACE | 112 | select HAVE_FTRACE |
113 | select ARCH_WANT_OPTIONAL_GPIOLIB | ||
113 | select HAVE_IDE | 114 | select HAVE_IDE |
114 | select HAVE_IOREMAP_PROT | 115 | select HAVE_IOREMAP_PROT |
115 | select HAVE_EFFICIENT_UNALIGNED_ACCESS | 116 | select HAVE_EFFICIENT_UNALIGNED_ACCESS |
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig index d664b1bce381..ccbd4958412e 100644 --- a/arch/powerpc/platforms/52xx/Kconfig +++ b/arch/powerpc/platforms/52xx/Kconfig | |||
@@ -48,6 +48,6 @@ config PPC_MPC5200_BUGFIX | |||
48 | config PPC_MPC5200_GPIO | 48 | config PPC_MPC5200_GPIO |
49 | bool "MPC5200 GPIO support" | 49 | bool "MPC5200 GPIO support" |
50 | depends on PPC_MPC52xx | 50 | depends on PPC_MPC52xx |
51 | select HAVE_GPIO_LIB | 51 | select ARCH_REQUIRE_GPIOLIB |
52 | help | 52 | help |
53 | Enable gpiolib support for mpc5200 based boards | 53 | Enable gpiolib support for mpc5200 based boards |
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/arch/powerpc/sysdev/qe_lib/Kconfig index 4bb18f57901e..1ce546462be5 100644 --- a/arch/powerpc/sysdev/qe_lib/Kconfig +++ b/arch/powerpc/sysdev/qe_lib/Kconfig | |||
@@ -29,7 +29,7 @@ config QE_GPIO | |||
29 | bool "QE GPIO support" | 29 | bool "QE GPIO support" |
30 | depends on QUICC_ENGINE | 30 | depends on QUICC_ENGINE |
31 | select GENERIC_GPIO | 31 | select GENERIC_GPIO |
32 | select HAVE_GPIO_LIB | 32 | select ARCH_REQUIRE_GPIOLIB |
33 | help | 33 | help |
34 | Say Y here if you're going to use hardware that connects to the | 34 | Say Y here if you're going to use hardware that connects to the |
35 | QE GPIOs. | 35 | QE GPIOs. |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 66f3ab05b18c..e3cba0b45600 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -23,6 +23,7 @@ config X86 | |||
23 | select HAVE_OPROFILE | 23 | select HAVE_OPROFILE |
24 | select HAVE_IOREMAP_PROT | 24 | select HAVE_IOREMAP_PROT |
25 | select HAVE_KPROBES | 25 | select HAVE_KPROBES |
26 | select ARCH_WANT_OPTIONAL_GPIOLIB if !X86_RDC321X | ||
26 | select HAVE_KRETPROBES | 27 | select HAVE_KRETPROBES |
27 | select HAVE_DYNAMIC_FTRACE | 28 | select HAVE_DYNAMIC_FTRACE |
28 | select HAVE_FTRACE | 29 | select HAVE_FTRACE |
diff --git a/drivers/Makefile b/drivers/Makefile index 808e0ae66aa8..54ec5e718c0e 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | # Rewritten to use lists instead of if-statements. | 5 | # Rewritten to use lists instead of if-statements. |
6 | # | 6 | # |
7 | 7 | ||
8 | obj-$(CONFIG_HAVE_GPIO_LIB) += gpio/ | 8 | obj-y += gpio/ |
9 | obj-$(CONFIG_PCI) += pci/ | 9 | obj-$(CONFIG_PCI) += pci/ |
10 | obj-$(CONFIG_PARISC) += parisc/ | 10 | obj-$(CONFIG_PARISC) += parisc/ |
11 | obj-$(CONFIG_RAPIDIO) += rapidio/ | 11 | obj-$(CONFIG_RAPIDIO) += rapidio/ |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index de202dbe5300..5a355f829167 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -2,15 +2,40 @@ | |||
2 | # GPIO infrastructure and expanders | 2 | # GPIO infrastructure and expanders |
3 | # | 3 | # |
4 | 4 | ||
5 | config HAVE_GPIO_LIB | 5 | config ARCH_WANT_OPTIONAL_GPIOLIB |
6 | bool | 6 | bool |
7 | help | 7 | help |
8 | Select this config option from the architecture Kconfig, if | ||
9 | it is possible to use gpiolib on the architecture, but let the | ||
10 | user decide whether to actually build it or not. | ||
11 | Select this instead of ARCH_REQUIRE_GPIOLIB, if your architecture does | ||
12 | not depend on GPIOs being available, but rather let the user | ||
13 | decide whether he needs it or not. | ||
14 | |||
15 | config ARCH_REQUIRE_GPIOLIB | ||
16 | bool | ||
17 | select GPIOLIB | ||
18 | help | ||
8 | Platforms select gpiolib if they use this infrastructure | 19 | Platforms select gpiolib if they use this infrastructure |
9 | for all their GPIOs, usually starting with ones integrated | 20 | for all their GPIOs, usually starting with ones integrated |
10 | into SOC processors. | 21 | into SOC processors. |
22 | Selecting this from the architecture code will cause the gpiolib | ||
23 | code to always get built in. | ||
24 | |||
25 | |||
26 | |||
27 | menuconfig GPIOLIB | ||
28 | bool "GPIO Support" | ||
29 | depends on ARCH_WANT_OPTIONAL_GPIOLIB || ARCH_REQUIRE_GPIOLIB | ||
30 | select GENERIC_GPIO | ||
31 | help | ||
32 | This enables GPIO support through the generic GPIO library. | ||
33 | You only need to enable this, if you also want to enable | ||
34 | one or more of the GPIO expansion card drivers below. | ||
35 | |||
36 | If unsure, say N. | ||
11 | 37 | ||
12 | menu "GPIO Support" | 38 | if GPIOLIB |
13 | depends on HAVE_GPIO_LIB | ||
14 | 39 | ||
15 | config DEBUG_GPIO | 40 | config DEBUG_GPIO |
16 | bool "Debug GPIO calls" | 41 | bool "Debug GPIO calls" |
@@ -116,4 +141,4 @@ config GPIO_MCP23S08 | |||
116 | SPI driver for Microchip MCP23S08 I/O expander. This provides | 141 | SPI driver for Microchip MCP23S08 I/O expander. This provides |
117 | a GPIO interface supporting inputs and outputs. | 142 | a GPIO interface supporting inputs and outputs. |
118 | 143 | ||
119 | endmenu | 144 | endif |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index eeb2f2b20282..8c45948d1fe7 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG | 3 | ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG |
4 | 4 | ||
5 | obj-$(CONFIG_HAVE_GPIO_LIB) += gpiolib.o | 5 | obj-$(CONFIG_GPIOLIB) += gpiolib.o |
6 | 6 | ||
7 | obj-$(CONFIG_GPIO_MAX7301) += max7301.o | 7 | obj-$(CONFIG_GPIO_MAX7301) += max7301.o |
8 | obj-$(CONFIG_GPIO_MCP23S08) += mcp23s08.o | 8 | obj-$(CONFIG_GPIO_MCP23S08) += mcp23s08.o |
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 50e0a4653741..a95cb9465d65 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig | |||
@@ -126,7 +126,7 @@ config ISP1301_OMAP | |||
126 | 126 | ||
127 | config TPS65010 | 127 | config TPS65010 |
128 | tristate "TPS6501x Power Management chips" | 128 | tristate "TPS6501x Power Management chips" |
129 | depends on HAVE_GPIO_LIB | 129 | depends on GPIOLIB |
130 | default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK | 130 | default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK |
131 | help | 131 | help |
132 | If you say yes here you get support for the TPS6501x series of | 132 | If you say yes here you get support for the TPS6501x series of |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index bac9e973ece0..1f57a99fd968 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -36,7 +36,7 @@ config MFD_ASIC3 | |||
36 | 36 | ||
37 | config HTC_EGPIO | 37 | config HTC_EGPIO |
38 | bool "HTC EGPIO support" | 38 | bool "HTC EGPIO support" |
39 | depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM | 39 | depends on GENERIC_HARDIRQS && GPIOLIB && ARM |
40 | help | 40 | help |
41 | This driver supports the CPLD egpio chip present on | 41 | This driver supports the CPLD egpio chip present on |
42 | several HTC phones. It provides basic support for input | 42 | several HTC phones. It provides basic support for input |
@@ -52,7 +52,7 @@ config HTC_PASIC3 | |||
52 | 52 | ||
53 | config MFD_TC6393XB | 53 | config MFD_TC6393XB |
54 | bool "Support Toshiba TC6393XB" | 54 | bool "Support Toshiba TC6393XB" |
55 | depends on HAVE_GPIO_LIB | 55 | depends on GPIOLIB |
56 | select MFD_CORE | 56 | select MFD_CORE |
57 | help | 57 | help |
58 | Support for Toshiba Mobile IO Controller TC6393XB | 58 | Support for Toshiba Mobile IO Controller TC6393XB |
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 3a7a11a75fb4..1d7ec3129349 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig | |||
@@ -4,7 +4,7 @@ config OF_DEVICE | |||
4 | 4 | ||
5 | config OF_GPIO | 5 | config OF_GPIO |
6 | def_bool y | 6 | def_bool y |
7 | depends on OF && PPC_OF && HAVE_GPIO_LIB | 7 | depends on OF && PPC_OF && GPIOLIB |
8 | help | 8 | help |
9 | OpenFirmware GPIO accessors | 9 | OpenFirmware GPIO accessors |
10 | 10 | ||
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 1beff5166e53..a3034d20ebd5 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | #ifdef CONFIG_HAVE_GPIO_LIB | 6 | #ifdef CONFIG_GPIOLIB |
7 | 7 | ||
8 | #include <linux/compiler.h> | 8 | #include <linux/compiler.h> |
9 | 9 | ||
diff --git a/include/asm-mips/mach-generic/gpio.h b/include/asm-mips/mach-generic/gpio.h index e6b376bd9d06..b4e70208da64 100644 --- a/include/asm-mips/mach-generic/gpio.h +++ b/include/asm-mips/mach-generic/gpio.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __ASM_MACH_GENERIC_GPIO_H | 1 | #ifndef __ASM_MACH_GENERIC_GPIO_H |
2 | #define __ASM_MACH_GENERIC_GPIO_H | 2 | #define __ASM_MACH_GENERIC_GPIO_H |
3 | 3 | ||
4 | #ifdef CONFIG_HAVE_GPIO_LIB | 4 | #ifdef CONFIG_GPIOLIB |
5 | #define gpio_get_value __gpio_get_value | 5 | #define gpio_get_value __gpio_get_value |
6 | #define gpio_set_value __gpio_set_value | 6 | #define gpio_set_value __gpio_set_value |
7 | #define gpio_cansleep __gpio_cansleep | 7 | #define gpio_cansleep __gpio_cansleep |
diff --git a/include/asm-powerpc/gpio.h b/include/asm-powerpc/gpio.h index 77ad3a890f30..ea04632399d8 100644 --- a/include/asm-powerpc/gpio.h +++ b/include/asm-powerpc/gpio.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <asm-generic/gpio.h> | 18 | #include <asm-generic/gpio.h> |
19 | 19 | ||
20 | #ifdef CONFIG_HAVE_GPIO_LIB | 20 | #ifdef CONFIG_GPIOLIB |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * We don't (yet) implement inlined/rapid versions for on-chip gpios. | 23 | * We don't (yet) implement inlined/rapid versions for on-chip gpios. |
@@ -51,6 +51,6 @@ static inline int irq_to_gpio(unsigned int irq) | |||
51 | return -EINVAL; | 51 | return -EINVAL; |
52 | } | 52 | } |
53 | 53 | ||
54 | #endif /* CONFIG_HAVE_GPIO_LIB */ | 54 | #endif /* CONFIG_GPIOLIB */ |
55 | 55 | ||
56 | #endif /* __ASM_POWERPC_GPIO_H */ | 56 | #endif /* __ASM_POWERPC_GPIO_H */ |
diff --git a/include/asm-x86/gpio.h b/include/asm-x86/gpio.h index ff87fca0caf9..116e9147fe66 100644 --- a/include/asm-x86/gpio.h +++ b/include/asm-x86/gpio.h | |||
@@ -1,6 +1,62 @@ | |||
1 | /* | ||
2 | * Generic GPIO API implementation for x86. | ||
3 | * | ||
4 | * Derived from the generic GPIO API for powerpc: | ||
5 | * | ||
6 | * Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
7 | * | ||
8 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | */ | ||
15 | |||
1 | #ifndef _ASM_I386_GPIO_H | 16 | #ifndef _ASM_I386_GPIO_H |
2 | #define _ASM_I386_GPIO_H | 17 | #define _ASM_I386_GPIO_H |
3 | 18 | ||
19 | #ifdef CONFIG_X86_RDC321X | ||
4 | #include <gpio.h> | 20 | #include <gpio.h> |
21 | #else /* CONFIG_X86_RDC321X */ | ||
22 | |||
23 | #include <asm-generic/gpio.h> | ||
24 | |||
25 | #ifdef CONFIG_GPIOLIB | ||
26 | |||
27 | /* | ||
28 | * Just call gpiolib. | ||
29 | */ | ||
30 | static inline int gpio_get_value(unsigned int gpio) | ||
31 | { | ||
32 | return __gpio_get_value(gpio); | ||
33 | } | ||
34 | |||
35 | static inline void gpio_set_value(unsigned int gpio, int value) | ||
36 | { | ||
37 | __gpio_set_value(gpio, value); | ||
38 | } | ||
39 | |||
40 | static inline int gpio_cansleep(unsigned int gpio) | ||
41 | { | ||
42 | return __gpio_cansleep(gpio); | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | * Not implemented, yet. | ||
47 | */ | ||
48 | static inline int gpio_to_irq(unsigned int gpio) | ||
49 | { | ||
50 | return -ENOSYS; | ||
51 | } | ||
52 | |||
53 | static inline int irq_to_gpio(unsigned int irq) | ||
54 | { | ||
55 | return -EINVAL; | ||
56 | } | ||
57 | |||
58 | #endif /* CONFIG_GPIOLIB */ | ||
59 | |||
60 | #endif /* CONFIG_X86_RDC321X */ | ||
5 | 61 | ||
6 | #endif /* _ASM_I386_GPIO_H */ | 62 | #endif /* _ASM_I386_GPIO_H */ |