diff options
author | eric miao <eric.miao@marvell.com> | 2008-03-03 00:20:20 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 06:29:03 -0400 |
commit | 0e037bbb4a639fff01cebf552db19237ec688678 (patch) | |
tree | 64e182e2ab0295b3d5b9501ca92521d32b2554e2 | |
parent | dfa1067996390dfd4b1ce449676500fab4980ce2 (diff) |
[ARM] pxa: introduce GPIO_CHIP() macro to clean up the definitions
Signed-off-by: eric miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-pxa/gpio.c | 66 |
1 files changed, 18 insertions, 48 deletions
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c index 8638dd7dd076..37b5b83fe240 100644 --- a/arch/arm/mach-pxa/gpio.c +++ b/arch/arm/mach-pxa/gpio.c | |||
@@ -129,56 +129,26 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
129 | __raw_writel(mask, pxa->regbase + GPCR_OFFSET); | 129 | __raw_writel(mask, pxa->regbase + GPCR_OFFSET); |
130 | } | 130 | } |
131 | 131 | ||
132 | #define GPIO_CHIP(_n) \ | ||
133 | [_n] = { \ | ||
134 | .regbase = GPIO##_n##_BASE, \ | ||
135 | .chip = { \ | ||
136 | .label = "gpio-" #_n, \ | ||
137 | .direction_input = pxa_gpio_direction_input, \ | ||
138 | .direction_output = pxa_gpio_direction_output, \ | ||
139 | .get = pxa_gpio_get, \ | ||
140 | .set = pxa_gpio_set, \ | ||
141 | .base = (_n) * 32, \ | ||
142 | .ngpio = 32, \ | ||
143 | }, \ | ||
144 | } | ||
145 | |||
132 | static struct pxa_gpio_chip pxa_gpio_chip[] = { | 146 | static struct pxa_gpio_chip pxa_gpio_chip[] = { |
133 | [0] = { | 147 | GPIO_CHIP(0), |
134 | .regbase = GPIO0_BASE, | 148 | GPIO_CHIP(1), |
135 | .chip = { | 149 | GPIO_CHIP(2), |
136 | .label = "gpio-0", | ||
137 | .direction_input = pxa_gpio_direction_input, | ||
138 | .direction_output = pxa_gpio_direction_output, | ||
139 | .get = pxa_gpio_get, | ||
140 | .set = pxa_gpio_set, | ||
141 | .base = 0, | ||
142 | .ngpio = 32, | ||
143 | }, | ||
144 | }, | ||
145 | [1] = { | ||
146 | .regbase = GPIO1_BASE, | ||
147 | .chip = { | ||
148 | .label = "gpio-1", | ||
149 | .direction_input = pxa_gpio_direction_input, | ||
150 | .direction_output = pxa_gpio_direction_output, | ||
151 | .get = pxa_gpio_get, | ||
152 | .set = pxa_gpio_set, | ||
153 | .base = 32, | ||
154 | .ngpio = 32, | ||
155 | }, | ||
156 | }, | ||
157 | [2] = { | ||
158 | .regbase = GPIO2_BASE, | ||
159 | .chip = { | ||
160 | .label = "gpio-2", | ||
161 | .direction_input = pxa_gpio_direction_input, | ||
162 | .direction_output = pxa_gpio_direction_output, | ||
163 | .get = pxa_gpio_get, | ||
164 | .set = pxa_gpio_set, | ||
165 | .base = 64, | ||
166 | .ngpio = 32, /* 21 for PXA25x */ | ||
167 | }, | ||
168 | }, | ||
169 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) | 150 | #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) |
170 | [3] = { | 151 | GPIO_CHIP(3), |
171 | .regbase = GPIO3_BASE, | ||
172 | .chip = { | ||
173 | .label = "gpio-3", | ||
174 | .direction_input = pxa_gpio_direction_input, | ||
175 | .direction_output = pxa_gpio_direction_output, | ||
176 | .get = pxa_gpio_get, | ||
177 | .set = pxa_gpio_set, | ||
178 | .base = 96, | ||
179 | .ngpio = 32, | ||
180 | }, | ||
181 | }, | ||
182 | #endif | 152 | #endif |
183 | }; | 153 | }; |
184 | 154 | ||