aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/mach-ixp4xx/common.c48
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gpio.h79
3 files changed, 48 insertions, 81 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 36586dba6fa6..7a8660a2f262 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -556,7 +556,7 @@ config ARCH_IXP4XX
556 select ARCH_HAS_DMA_SET_COHERENT_MASK 556 select ARCH_HAS_DMA_SET_COHERENT_MASK
557 select CLKSRC_MMIO 557 select CLKSRC_MMIO
558 select CPU_XSCALE 558 select CPU_XSCALE
559 select GENERIC_GPIO 559 select ARCH_REQUIRE_GPIOLIB
560 select GENERIC_CLOCKEVENTS 560 select GENERIC_CLOCKEVENTS
561 select MIGHT_HAVE_PCI 561 select MIGHT_HAVE_PCI
562 select NEED_MACH_IO_H 562 select NEED_MACH_IO_H
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
110int gpio_to_irq(int gpio) 111static 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}
120EXPORT_SYMBOL(gpio_to_irq);
121 121
122int irq_to_gpio(unsigned int irq) 122int irq_to_gpio(unsigned int irq)
123{ 123{
@@ -383,12 +383,56 @@ static struct platform_device *ixp46x_devices[] __initdata = {
383unsigned long ixp4xx_exp_bus_size; 383unsigned long ixp4xx_exp_bus_size;
384EXPORT_SYMBOL(ixp4xx_exp_bus_size); 384EXPORT_SYMBOL(ixp4xx_exp_bus_size);
385 385
386static 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
393static 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
402static 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
411static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio,
412 int value)
413{
414 gpio_line_set(gpio, value);
415}
416
417static 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
386void __init ixp4xx_sys_init(void) 428void __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
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index 83d6b4ed60bb..ef37f2635b0e 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -1,79 +1,2 @@
1/* 1/* empty */
2 * arch/arm/mach-ixp4xx/include/mach/gpio.h
3 *
4 * IXP4XX GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Milan Svoboda <msvoboda@ra.rockwell.com>
7 * Based on PXA implementation by Philipp Zabel <philipp.zabel@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __ASM_ARCH_IXP4XX_GPIO_H
26#define __ASM_ARCH_IXP4XX_GPIO_H
27
28#include <linux/kernel.h>
29#include <mach/hardware.h>
30
31#define __ARM_GPIOLIB_COMPLEX
32
33static inline int gpio_request(unsigned gpio, const char *label)
34{
35 return 0;
36}
37
38static inline void gpio_free(unsigned gpio)
39{
40 might_sleep();
41
42 return;
43}
44
45static inline int gpio_direction_input(unsigned gpio)
46{
47 gpio_line_config(gpio, IXP4XX_GPIO_IN);
48 return 0;
49}
50
51static inline int gpio_direction_output(unsigned gpio, int level)
52{
53 gpio_line_set(gpio, level);
54 gpio_line_config(gpio, IXP4XX_GPIO_OUT);
55 return 0;
56}
57
58static inline int gpio_get_value(unsigned gpio)
59{
60 int value;
61
62 gpio_line_get(gpio, &value);
63
64 return value;
65}
66
67static inline void gpio_set_value(unsigned gpio, int value)
68{
69 gpio_line_set(gpio, value);
70}
71
72#include <asm-generic/gpio.h> /* cansleep wrappers */
73
74extern int gpio_to_irq(int gpio);
75#define gpio_to_irq gpio_to_irq
76extern int irq_to_gpio(unsigned int irq);
77
78#endif
79 2