aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-01-12 18:35:04 -0500
committerTony Lindgren <tony@atomide.com>2008-02-08 13:37:59 -0500
commitd11ac9791b87efb24506b6391a965b789385157c (patch)
tree02b612a8768bd774f9bec9abe1d6bdc7dc5befbf /arch/arm/plat-omap
parent5492fb1a46ada0d1e89eb580c2a56db8924e3141 (diff)
ARM: OMAP: Get rid of unnecessary ifdefs in GPIO code
Just use cpu_is_omapXXXX() instead. This does not increase object size. Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/gpio.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 7dd50a43fbcf..c233ebd7639a 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -221,51 +221,35 @@ static int gpio_bank_count;
221 221
222static inline struct gpio_bank *get_gpio_bank(int gpio) 222static inline struct gpio_bank *get_gpio_bank(int gpio)
223{ 223{
224#ifdef CONFIG_ARCH_OMAP15XX
225 if (cpu_is_omap15xx()) { 224 if (cpu_is_omap15xx()) {
226 if (OMAP_GPIO_IS_MPUIO(gpio)) 225 if (OMAP_GPIO_IS_MPUIO(gpio))
227 return &gpio_bank[0]; 226 return &gpio_bank[0];
228 return &gpio_bank[1]; 227 return &gpio_bank[1];
229 } 228 }
230#endif
231#if defined(CONFIG_ARCH_OMAP16XX)
232 if (cpu_is_omap16xx()) { 229 if (cpu_is_omap16xx()) {
233 if (OMAP_GPIO_IS_MPUIO(gpio)) 230 if (OMAP_GPIO_IS_MPUIO(gpio))
234 return &gpio_bank[0]; 231 return &gpio_bank[0];
235 return &gpio_bank[1 + (gpio >> 4)]; 232 return &gpio_bank[1 + (gpio >> 4)];
236 } 233 }
237#endif
238#ifdef CONFIG_ARCH_OMAP730
239 if (cpu_is_omap730()) { 234 if (cpu_is_omap730()) {
240 if (OMAP_GPIO_IS_MPUIO(gpio)) 235 if (OMAP_GPIO_IS_MPUIO(gpio))
241 return &gpio_bank[0]; 236 return &gpio_bank[0];
242 return &gpio_bank[1 + (gpio >> 5)]; 237 return &gpio_bank[1 + (gpio >> 5)];
243 } 238 }
244#endif
245#ifdef CONFIG_ARCH_OMAP24XX
246 if (cpu_is_omap24xx()) 239 if (cpu_is_omap24xx())
247 return &gpio_bank[gpio >> 5]; 240 return &gpio_bank[gpio >> 5];
248#endif
249#ifdef CONFIG_ARCH_OMAP34XX
250 if (cpu_is_omap34xx()) 241 if (cpu_is_omap34xx())
251 return &gpio_bank[gpio >> 5]; 242 return &gpio_bank[gpio >> 5];
252#endif
253} 243}
254 244
255static inline int get_gpio_index(int gpio) 245static inline int get_gpio_index(int gpio)
256{ 246{
257#ifdef CONFIG_ARCH_OMAP730
258 if (cpu_is_omap730()) 247 if (cpu_is_omap730())
259 return gpio & 0x1f; 248 return gpio & 0x1f;
260#endif
261#ifdef CONFIG_ARCH_OMAP24XX
262 if (cpu_is_omap24xx()) 249 if (cpu_is_omap24xx())
263 return gpio & 0x1f; 250 return gpio & 0x1f;
264#endif
265#ifdef CONFIG_ARCH_OMAP34XX
266 if (cpu_is_omap34xx()) 251 if (cpu_is_omap34xx())
267 return gpio & 0x1f; 252 return gpio & 0x1f;
268#endif
269 return gpio & 0x0f; 253 return gpio & 0x0f;
270} 254}
271 255
@@ -273,33 +257,21 @@ static inline int gpio_valid(int gpio)
273{ 257{
274 if (gpio < 0) 258 if (gpio < 0)
275 return -1; 259 return -1;
276#ifndef CONFIG_ARCH_OMAP24XX 260 if (cpu_class_is_omap1() && OMAP_GPIO_IS_MPUIO(gpio)) {
277 if (OMAP_GPIO_IS_MPUIO(gpio)) {
278 if (gpio >= OMAP_MAX_GPIO_LINES + 16) 261 if (gpio >= OMAP_MAX_GPIO_LINES + 16)
279 return -1; 262 return -1;
280 return 0; 263 return 0;
281 } 264 }
282#endif
283#ifdef CONFIG_ARCH_OMAP15XX
284 if (cpu_is_omap15xx() && gpio < 16) 265 if (cpu_is_omap15xx() && gpio < 16)
285 return 0; 266 return 0;
286#endif
287#if defined(CONFIG_ARCH_OMAP16XX)
288 if ((cpu_is_omap16xx()) && gpio < 64) 267 if ((cpu_is_omap16xx()) && gpio < 64)
289 return 0; 268 return 0;
290#endif
291#ifdef CONFIG_ARCH_OMAP730
292 if (cpu_is_omap730() && gpio < 192) 269 if (cpu_is_omap730() && gpio < 192)
293 return 0; 270 return 0;
294#endif
295#ifdef CONFIG_ARCH_OMAP24XX
296 if (cpu_is_omap24xx() && gpio < 128) 271 if (cpu_is_omap24xx() && gpio < 128)
297 return 0; 272 return 0;
298#endif
299#ifdef CONFIG_ARCH_OMAP34XX
300 if (cpu_is_omap34xx() && gpio < 160) 273 if (cpu_is_omap34xx() && gpio < 160)
301 return 0; 274 return 0;
302#endif
303 return -1; 275 return -1;
304} 276}
305 277
@@ -1393,27 +1365,22 @@ static int __init _omap_gpio_init(void)
1393 spin_lock_init(&bank->lock); 1365 spin_lock_init(&bank->lock);
1394 if (bank_is_mpuio(bank)) 1366 if (bank_is_mpuio(bank))
1395 omap_writew(0xFFFF, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_MASKIT); 1367 omap_writew(0xFFFF, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_MASKIT);
1396#ifdef CONFIG_ARCH_OMAP15XX 1368 if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) {
1397 if (bank->method == METHOD_GPIO_1510) {
1398 __raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK); 1369 __raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK);
1399 __raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS); 1370 __raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS);
1400 } 1371 }
1401#endif 1372 if (cpu_is_omap16xx() && bank->method == METHOD_GPIO_1610) {
1402#if defined(CONFIG_ARCH_OMAP16XX)
1403 if (bank->method == METHOD_GPIO_1610) {
1404 __raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1); 1373 __raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1);
1405 __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1); 1374 __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1);
1406 __raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG); 1375 __raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG);
1407 } 1376 }
1408#endif 1377 if (cpu_is_omap730() && bank->method == METHOD_GPIO_730) {
1409#ifdef CONFIG_ARCH_OMAP730
1410 if (bank->method == METHOD_GPIO_730) {
1411 __raw_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK); 1378 __raw_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK);
1412 __raw_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS); 1379 __raw_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS);
1413 1380
1414 gpio_count = 32; /* 730 has 32-bit GPIOs */ 1381 gpio_count = 32; /* 730 has 32-bit GPIOs */
1415 } 1382 }
1416#endif 1383
1417#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1384#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1418 if (bank->method == METHOD_GPIO_24XX) { 1385 if (bank->method == METHOD_GPIO_24XX) {
1419 static const u32 non_wakeup_gpios[] = { 1386 static const u32 non_wakeup_gpios[] = {
@@ -1450,14 +1417,12 @@ static int __init _omap_gpio_init(void)
1450 if (cpu_is_omap16xx()) 1417 if (cpu_is_omap16xx())
1451 omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL); 1418 omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL);
1452 1419
1453#if defined(CONFIG_ARCH_OMAP24XX)
1454 /* Enable autoidle for the OCP interface */ 1420 /* Enable autoidle for the OCP interface */
1455 if (cpu_is_omap24xx()) 1421 if (cpu_is_omap24xx())
1456 omap_writel(1 << 0, 0x48019010); 1422 omap_writel(1 << 0, 0x48019010);
1457#elif defined(CONFIG_ARCH_OMAP34XX)
1458 if (cpu_is_omap34xx()) 1423 if (cpu_is_omap34xx())
1459 omap_writel(1 << 0, 0x48306814); 1424 omap_writel(1 << 0, 0x48306814);
1460#endif 1425
1461 return 0; 1426 return 0;
1462} 1427}
1463 1428