Add back ixp4xx gpiolib (fixes ftbfs on ixp4xx)
svn path=/dists/trunk/linux-2.6/; revision=18473
This commit is contained in:
parent
3ea67e909b
commit
c351fac8d7
|
@ -18,6 +18,7 @@ linux-2.6 (3.2-1~experimental.1) UNRELEASED; urgency=low
|
|||
|
||||
[ Arnaud Patard ]
|
||||
* disable tomoyo and apparmor to allow kernel image to fit into flash.
|
||||
* add back ixp4xx gpiolib patch
|
||||
|
||||
-- Ben Hutchings <ben@decadent.org.uk> Mon, 02 Jan 2012 02:55:28 +0000
|
||||
|
||||
|
|
|
@ -0,0 +1,158 @@
|
|||
From: Imre Kaloz <kaloz@openwrt.org>
|
||||
Subject: [RFC/PATCH] ARM: ixp4xx gpiolib support
|
||||
Date: Mon, 5 Sep 2011 14:49:51 +0200
|
||||
|
||||
This patch adds gpiolib support for the IXP4xx platform
|
||||
|
||||
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
||||
---
|
||||
arch/arm/Kconfig | 2 +-
|
||||
arch/arm/mach-ixp4xx/common.c | 39 +++++++++++++++++++++++++
|
||||
arch/arm/mach-ixp4xx/include/mach/gpio.h | 46 ++++++++++--------------------
|
||||
3 files changed, 55 insertions(+), 32 deletions(-)
|
||||
|
||||
Index: source_armel_none/arch/arm/Kconfig
|
||||
===================================================================
|
||||
--- source_armel_none.orig/arch/arm/Kconfig 2012-01-07 20:47:15.000000000 +0100
|
||||
+++ source_armel_none/arch/arm/Kconfig 2012-01-07 20:51:00.390593917 +0100
|
||||
@@ -520,7 +520,7 @@ config ARCH_IXP4XX
|
||||
depends on MMU
|
||||
select CLKSRC_MMIO
|
||||
select CPU_XSCALE
|
||||
- select GENERIC_GPIO
|
||||
+ select ARCH_REQUIRE_GPIOLIB
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select HAVE_SCHED_CLOCK
|
||||
select MIGHT_HAVE_PCI
|
||||
Index: source_armel_none/arch/arm/mach-ixp4xx/common.c
|
||||
===================================================================
|
||||
--- source_armel_none.orig/arch/arm/mach-ixp4xx/common.c 2012-01-07 20:47:15.000000000 +0100
|
||||
+++ source_armel_none/arch/arm/mach-ixp4xx/common.c 2012-01-07 20:51:00.390593917 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <asm/page.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/sched_clock.h>
|
||||
+#include <asm/gpio.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/mach/irq.h>
|
||||
@@ -376,12 +377,50 @@ static struct platform_device *ixp46x_de
|
||||
unsigned long ixp4xx_exp_bus_size;
|
||||
EXPORT_SYMBOL(ixp4xx_exp_bus_size);
|
||||
|
||||
+static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
|
||||
+{
|
||||
+ gpio_line_config(gpio, IXP4XX_GPIO_IN);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
|
||||
+{
|
||||
+ gpio_line_set(gpio, level);
|
||||
+ gpio_line_config(gpio, IXP4XX_GPIO_OUT);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
||||
+{
|
||||
+ int value;
|
||||
+
|
||||
+ gpio_line_get(gpio, &value);
|
||||
+ return value;
|
||||
+}
|
||||
+
|
||||
+static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
|
||||
+{
|
||||
+ gpio_line_set(gpio, value);
|
||||
+}
|
||||
+
|
||||
+static struct gpio_chip ixp4xx_gpio_chip = {
|
||||
+ .label = "IXP4XX_GPIO_CHIP",
|
||||
+ .direction_input = ixp4xx_gpio_direction_input,
|
||||
+ .direction_output = ixp4xx_gpio_direction_output,
|
||||
+ .get = ixp4xx_gpio_get_value,
|
||||
+ .set = ixp4xx_gpio_set_value,
|
||||
+ .base = 0,
|
||||
+ .ngpio = 16,
|
||||
+};
|
||||
+
|
||||
void __init ixp4xx_sys_init(void)
|
||||
{
|
||||
ixp4xx_exp_bus_size = SZ_16M;
|
||||
|
||||
platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices));
|
||||
|
||||
+ gpiochip_add(&ixp4xx_gpio_chip);
|
||||
+
|
||||
if (cpu_is_ixp46x()) {
|
||||
int region;
|
||||
|
||||
Index: source_armel_none/arch/arm/mach-ixp4xx/include/mach/gpio.h
|
||||
===================================================================
|
||||
--- source_armel_none.orig/arch/arm/mach-ixp4xx/include/mach/gpio.h 2012-01-07 20:47:15.000000000 +0100
|
||||
+++ source_armel_none/arch/arm/mach-ixp4xx/include/mach/gpio.h 2012-01-07 20:51:00.390593917 +0100
|
||||
@@ -27,49 +27,33 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <mach/hardware.h>
|
||||
+#include <asm-generic/gpio.h> /* cansleep wrappers */
|
||||
|
||||
#define __ARM_GPIOLIB_COMPLEX
|
||||
|
||||
-static inline int gpio_request(unsigned gpio, const char *label)
|
||||
-{
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static inline void gpio_free(unsigned gpio)
|
||||
-{
|
||||
- might_sleep();
|
||||
-
|
||||
- return;
|
||||
-}
|
||||
-
|
||||
-static inline int gpio_direction_input(unsigned gpio)
|
||||
-{
|
||||
- gpio_line_config(gpio, IXP4XX_GPIO_IN);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static inline int gpio_direction_output(unsigned gpio, int level)
|
||||
-{
|
||||
- gpio_line_set(gpio, level);
|
||||
- gpio_line_config(gpio, IXP4XX_GPIO_OUT);
|
||||
- return 0;
|
||||
-}
|
||||
+#define NR_BUILTIN_GPIO 16
|
||||
|
||||
static inline int gpio_get_value(unsigned gpio)
|
||||
{
|
||||
- int value;
|
||||
-
|
||||
- gpio_line_get(gpio, &value);
|
||||
-
|
||||
- return value;
|
||||
+ if (gpio < NR_BUILTIN_GPIO)
|
||||
+ {
|
||||
+ int value;
|
||||
+ gpio_line_get(gpio, &value);
|
||||
+ return value;
|
||||
+ }
|
||||
+ else
|
||||
+ return __gpio_get_value(gpio);
|
||||
}
|
||||
|
||||
static inline void gpio_set_value(unsigned gpio, int value)
|
||||
{
|
||||
- gpio_line_set(gpio, value);
|
||||
+ if (gpio < NR_BUILTIN_GPIO)
|
||||
+ gpio_line_set(gpio, value);
|
||||
+ else
|
||||
+ __gpio_set_value(gpio, value);
|
||||
}
|
||||
|
||||
-#include <asm-generic/gpio.h> /* cansleep wrappers */
|
||||
+#define gpio_cansleep __gpio_cansleep
|
||||
|
||||
extern int gpio_to_irq(int gpio);
|
||||
#define gpio_to_irq gpio_to_irq
|
Loading…
Reference in New Issue