aboutsummaryrefslogtreecommitdiff
path: root/include/asm-arm/arch-ep93xx
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-arm/arch-ep93xx')
-rw-r--r--include/asm-arm/arch-ep93xx/gpio.h27
-rw-r--r--include/asm-arm/arch-ep93xx/irqs.h6
2 files changed, 12 insertions, 21 deletions
diff --git a/include/asm-arm/arch-ep93xx/gpio.h b/include/asm-arm/arch-ep93xx/gpio.h
index fc1e57db5fa..cebb64be7e4 100644
--- a/include/asm-arm/arch-ep93xx/gpio.h
+++ b/include/asm-arm/arch-ep93xx/gpio.h
@@ -28,7 +28,7 @@
#define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7)
/* GPIO port C. */
-#define EP93XX_GPIO_LINE_C(x) ((x) + 16)
+#define EP93XX_GPIO_LINE_C(x) ((x) + 40)
#define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0)
#define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1)
#define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2)
@@ -61,7 +61,7 @@
#define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7)
/* GPIO port F. */
-#define EP93XX_GPIO_LINE_F(x) ((x) + 40)
+#define EP93XX_GPIO_LINE_F(x) ((x) + 16)
#define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0)
#define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1)
#define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2)
@@ -93,11 +93,17 @@
#define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6)
#define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7)
+/* maximum value for gpio line identifiers */
+#define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7)
+
+/* maximum value for irq capable line identifiers */
+#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
+
/* new generic GPIO API - see Documentation/gpio.txt */
static inline int gpio_request(unsigned gpio, const char *label)
{
- if (gpio > EP93XX_GPIO_LINE_H(7))
+ if (gpio > EP93XX_GPIO_LINE_MAX)
return -EINVAL;
return 0;
}
@@ -116,29 +122,20 @@ void gpio_set_value(unsigned gpio, int value);
/*
* Map GPIO A0..A7 (0..7) to irq 64..71,
* B0..B7 (7..15) to irq 72..79, and
- * F0..F7 (40..47) to irq 80..87.
+ * F0..F7 (16..24) to irq 80..87.
*/
static inline int gpio_to_irq(unsigned gpio)
{
- if (gpio <= EP93XX_GPIO_LINE_EGPIO15)
+ if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ)
return 64 + gpio;
- if (gpio >= EP93XX_GPIO_LINE_F(0) && gpio <= EP93XX_GPIO_LINE_F(7))
- return 80 + (gpio - EP93XX_GPIO_LINE_F(0));
-
return -EINVAL;
}
static inline int irq_to_gpio(unsigned irq)
{
- if (irq >= 64 && irq <= 79)
- return irq - 64;
-
- if (irq >= 80 && irq <= 87)
- return (irq - 80) + EP93XX_GPIO_LINE_F(0);
-
- return -EINVAL;
+ return irq - gpio_to_irq(0);
}
/* obsolete specific GPIO API */
diff --git a/include/asm-arm/arch-ep93xx/irqs.h b/include/asm-arm/arch-ep93xx/irqs.h
index 2a8c63638c5..53d4a68bfc8 100644
--- a/include/asm-arm/arch-ep93xx/irqs.h
+++ b/include/asm-arm/arch-ep93xx/irqs.h
@@ -67,12 +67,6 @@
#define IRQ_EP93XX_SAI 60
#define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff
-/*
- * Map GPIO A0..A7 to irq 64..71, B0..B7 to 72..79, and
- * F0..F7 to 80..87.
- */
-#define IRQ_EP93XX_GPIO(x) (64 + (((x) + (((x) >> 2) & 8)) & 0x1f))
-
#define NR_EP93XX_IRQS (64 + 24)
#define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x))