diff options
author | Richard Cochran <richardcochran@gmail.com> | 2012-05-23 12:19:51 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-05-23 15:22:43 -0400 |
commit | 9dde0ae3769875ec1370cb316e50c54b57d52c1a (patch) | |
tree | c0d7967cd121cddf66ebeff5777007f557f86065 /arch/arm/mach-ixp4xx/common.c | |
parent | 76e10d158efb6d4516018846f60c2ab5501900bc (diff) |
ixp4xx: fix compilation by adding gpiolib support
Once again, ixp4xx no longer even compiles. This patch fixes the issue
by converting over to gpiolib. This patch was first made by Imre and
posted by Marc, and I added in Russell's suggestion to empty the gpio
header file.
This fix should also go for 3.1, 3.2, 3.3, and 3.4.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-ixp4xx/common.c')
-rw-r--r-- | arch/arm/mach-ixp4xx/common.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index ebbd7fc90eb4..a9f80943d01f 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/clockchips.h> | 28 | #include <linux/clockchips.h> |
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | #include <linux/gpio.h> | ||
31 | 32 | ||
32 | #include <mach/udc.h> | 33 | #include <mach/udc.h> |
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
@@ -107,7 +108,7 @@ static signed char irq2gpio[32] = { | |||
107 | 7, 8, 9, 10, 11, 12, -1, -1, | 108 | 7, 8, 9, 10, 11, 12, -1, -1, |
108 | }; | 109 | }; |
109 | 110 | ||
110 | int gpio_to_irq(int gpio) | 111 | static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) |
111 | { | 112 | { |
112 | int irq; | 113 | int irq; |
113 | 114 | ||
@@ -117,7 +118,6 @@ int gpio_to_irq(int gpio) | |||
117 | } | 118 | } |
118 | return -EINVAL; | 119 | return -EINVAL; |
119 | } | 120 | } |
120 | EXPORT_SYMBOL(gpio_to_irq); | ||
121 | 121 | ||
122 | int irq_to_gpio(unsigned int irq) | 122 | int irq_to_gpio(unsigned int irq) |
123 | { | 123 | { |
@@ -383,12 +383,56 @@ static struct platform_device *ixp46x_devices[] __initdata = { | |||
383 | unsigned long ixp4xx_exp_bus_size; | 383 | unsigned long ixp4xx_exp_bus_size; |
384 | EXPORT_SYMBOL(ixp4xx_exp_bus_size); | 384 | EXPORT_SYMBOL(ixp4xx_exp_bus_size); |
385 | 385 | ||
386 | static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | ||
387 | { | ||
388 | gpio_line_config(gpio, IXP4XX_GPIO_IN); | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, | ||
394 | int level) | ||
395 | { | ||
396 | gpio_line_set(gpio, level); | ||
397 | gpio_line_config(gpio, IXP4XX_GPIO_OUT); | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | ||
403 | { | ||
404 | int value; | ||
405 | |||
406 | gpio_line_get(gpio, &value); | ||
407 | |||
408 | return value; | ||
409 | } | ||
410 | |||
411 | static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, | ||
412 | int value) | ||
413 | { | ||
414 | gpio_line_set(gpio, value); | ||
415 | } | ||
416 | |||
417 | static struct gpio_chip ixp4xx_gpio_chip = { | ||
418 | .label = "IXP4XX_GPIO_CHIP", | ||
419 | .direction_input = ixp4xx_gpio_direction_input, | ||
420 | .direction_output = ixp4xx_gpio_direction_output, | ||
421 | .get = ixp4xx_gpio_get_value, | ||
422 | .set = ixp4xx_gpio_set_value, | ||
423 | .to_irq = ixp4xx_gpio_to_irq, | ||
424 | .base = 0, | ||
425 | .ngpio = 16, | ||
426 | }; | ||
427 | |||
386 | void __init ixp4xx_sys_init(void) | 428 | void __init ixp4xx_sys_init(void) |
387 | { | 429 | { |
388 | ixp4xx_exp_bus_size = SZ_16M; | 430 | ixp4xx_exp_bus_size = SZ_16M; |
389 | 431 | ||
390 | platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); | 432 | platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); |
391 | 433 | ||
434 | gpiochip_add(&ixp4xx_gpio_chip); | ||
435 | |||
392 | if (cpu_is_ixp46x()) { | 436 | if (cpu_is_ixp46x()) { |
393 | int region; | 437 | int region; |
394 | 438 | ||