diff options
Diffstat (limited to 'include/asm-arm/arch-ep93xx')
-rw-r--r-- | include/asm-arm/arch-ep93xx/gpio.h | 27 | ||||
-rw-r--r-- | include/asm-arm/arch-ep93xx/irqs.h | 6 |
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 fc1e57db5fac..cebb64be7e4b 100644 --- a/include/asm-arm/arch-ep93xx/gpio.h +++ b/include/asm-arm/arch-ep93xx/gpio.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7) | 28 | #define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7) |
29 | 29 | ||
30 | /* GPIO port C. */ | 30 | /* GPIO port C. */ |
31 | #define EP93XX_GPIO_LINE_C(x) ((x) + 16) | 31 | #define EP93XX_GPIO_LINE_C(x) ((x) + 40) |
32 | #define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0) | 32 | #define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0) |
33 | #define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1) | 33 | #define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1) |
34 | #define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2) | 34 | #define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2) |
@@ -61,7 +61,7 @@ | |||
61 | #define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7) | 61 | #define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7) |
62 | 62 | ||
63 | /* GPIO port F. */ | 63 | /* GPIO port F. */ |
64 | #define EP93XX_GPIO_LINE_F(x) ((x) + 40) | 64 | #define EP93XX_GPIO_LINE_F(x) ((x) + 16) |
65 | #define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0) | 65 | #define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0) |
66 | #define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1) | 66 | #define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1) |
67 | #define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2) | 67 | #define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2) |
@@ -93,11 +93,17 @@ | |||
93 | #define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6) | 93 | #define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6) |
94 | #define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7) | 94 | #define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7) |
95 | 95 | ||
96 | /* maximum value for gpio line identifiers */ | ||
97 | #define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7) | ||
98 | |||
99 | /* maximum value for irq capable line identifiers */ | ||
100 | #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) | ||
101 | |||
96 | /* new generic GPIO API - see Documentation/gpio.txt */ | 102 | /* new generic GPIO API - see Documentation/gpio.txt */ |
97 | 103 | ||
98 | static inline int gpio_request(unsigned gpio, const char *label) | 104 | static inline int gpio_request(unsigned gpio, const char *label) |
99 | { | 105 | { |
100 | if (gpio > EP93XX_GPIO_LINE_H(7)) | 106 | if (gpio > EP93XX_GPIO_LINE_MAX) |
101 | return -EINVAL; | 107 | return -EINVAL; |
102 | return 0; | 108 | return 0; |
103 | } | 109 | } |
@@ -116,29 +122,20 @@ void gpio_set_value(unsigned gpio, int value); | |||
116 | /* | 122 | /* |
117 | * Map GPIO A0..A7 (0..7) to irq 64..71, | 123 | * Map GPIO A0..A7 (0..7) to irq 64..71, |
118 | * B0..B7 (7..15) to irq 72..79, and | 124 | * B0..B7 (7..15) to irq 72..79, and |
119 | * F0..F7 (40..47) to irq 80..87. | 125 | * F0..F7 (16..24) to irq 80..87. |
120 | */ | 126 | */ |
121 | 127 | ||
122 | static inline int gpio_to_irq(unsigned gpio) | 128 | static inline int gpio_to_irq(unsigned gpio) |
123 | { | 129 | { |
124 | if (gpio <= EP93XX_GPIO_LINE_EGPIO15) | 130 | if (gpio <= EP93XX_GPIO_LINE_MAX_IRQ) |
125 | return 64 + gpio; | 131 | return 64 + gpio; |
126 | 132 | ||
127 | if (gpio >= EP93XX_GPIO_LINE_F(0) && gpio <= EP93XX_GPIO_LINE_F(7)) | ||
128 | return 80 + (gpio - EP93XX_GPIO_LINE_F(0)); | ||
129 | |||
130 | return -EINVAL; | 133 | return -EINVAL; |
131 | } | 134 | } |
132 | 135 | ||
133 | static inline int irq_to_gpio(unsigned irq) | 136 | static inline int irq_to_gpio(unsigned irq) |
134 | { | 137 | { |
135 | if (irq >= 64 && irq <= 79) | 138 | return irq - gpio_to_irq(0); |
136 | return irq - 64; | ||
137 | |||
138 | if (irq >= 80 && irq <= 87) | ||
139 | return (irq - 80) + EP93XX_GPIO_LINE_F(0); | ||
140 | |||
141 | return -EINVAL; | ||
142 | } | 139 | } |
143 | 140 | ||
144 | /* obsolete specific GPIO API */ | 141 | /* obsolete specific GPIO API */ |
diff --git a/include/asm-arm/arch-ep93xx/irqs.h b/include/asm-arm/arch-ep93xx/irqs.h index 2a8c63638c5e..53d4a68bfc88 100644 --- a/include/asm-arm/arch-ep93xx/irqs.h +++ b/include/asm-arm/arch-ep93xx/irqs.h | |||
@@ -67,12 +67,6 @@ | |||
67 | #define IRQ_EP93XX_SAI 60 | 67 | #define IRQ_EP93XX_SAI 60 |
68 | #define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff | 68 | #define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff |
69 | 69 | ||
70 | /* | ||
71 | * Map GPIO A0..A7 to irq 64..71, B0..B7 to 72..79, and | ||
72 | * F0..F7 to 80..87. | ||
73 | */ | ||
74 | #define IRQ_EP93XX_GPIO(x) (64 + (((x) + (((x) >> 2) & 8)) & 0x1f)) | ||
75 | |||
76 | #define NR_EP93XX_IRQS (64 + 24) | 70 | #define NR_EP93XX_IRQS (64 + 24) |
77 | 71 | ||
78 | #define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x)) | 72 | #define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x)) |