aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair Buxton <a.j.buxton@gmail.com>2009-09-23 13:56:19 -0400
committerAlistair Buxton <a.j.buxton@gmail.com>2009-10-07 18:13:59 -0400
commitb718aa810b50e0d988d8b83f1011865b19b17491 (patch)
treee056c48f823daa1907e5f6a810eda15a4008b89f
parentd8723ae2a416473f8e974baadcb6acb7f8b0b485 (diff)
OMAP7XX: GPIO: Remove duplicate omap850 code
This patch is part of a series which unifies all duplicated code between omap730 and omap850. All cpu checks are converted to cpu_is_omap7xx() and CONFIG_ARCH_OMAP850 is added to all CONFIG_ARCH_OMAP730 checks. Signed-off-by: Alistair Buxton <a.j.buxton@gmail.com> Reviewed-by: Zebediah C. McClure <zmc@lurian.net>
-rw-r--r--arch/arm/plat-omap/gpio.c133
1 files changed, 14 insertions, 119 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 71ebd7fcfea1..665ca050183f 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -83,22 +83,6 @@
83#define OMAP730_GPIO_INT_MASK 0x10 83#define OMAP730_GPIO_INT_MASK 0x10
84#define OMAP730_GPIO_INT_STATUS 0x14 84#define OMAP730_GPIO_INT_STATUS 0x14
85 85
86/*
87 * OMAP850 specific GPIO registers
88 */
89#define OMAP850_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbc000)
90#define OMAP850_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbc800)
91#define OMAP850_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbd000)
92#define OMAP850_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbd800)
93#define OMAP850_GPIO5_BASE OMAP1_IO_ADDRESS(0xfffbe000)
94#define OMAP850_GPIO6_BASE OMAP1_IO_ADDRESS(0xfffbe800)
95#define OMAP850_GPIO_DATA_INPUT 0x00
96#define OMAP850_GPIO_DATA_OUTPUT 0x04
97#define OMAP850_GPIO_DIR_CONTROL 0x08
98#define OMAP850_GPIO_INT_CONTROL 0x0c
99#define OMAP850_GPIO_INT_MASK 0x10
100#define OMAP850_GPIO_INT_STATUS 0x14
101
102#define OMAP1_MPUIO_VBASE OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE) 86#define OMAP1_MPUIO_VBASE OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE)
103 87
104/* 88/*
@@ -216,7 +200,6 @@ struct gpio_bank {
216#define METHOD_GPIO_1510 1 200#define METHOD_GPIO_1510 1
217#define METHOD_GPIO_1610 2 201#define METHOD_GPIO_1610 2
218#define METHOD_GPIO_730 3 202#define METHOD_GPIO_730 3
219#define METHOD_GPIO_850 4
220#define METHOD_GPIO_24XX 5 203#define METHOD_GPIO_24XX 5
221 204
222#ifdef CONFIG_ARCH_OMAP16XX 205#ifdef CONFIG_ARCH_OMAP16XX
@@ -236,7 +219,7 @@ static struct gpio_bank gpio_bank_1510[2] = {
236}; 219};
237#endif 220#endif
238 221
239#ifdef CONFIG_ARCH_OMAP730 222#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
240static struct gpio_bank gpio_bank_730[7] = { 223static struct gpio_bank gpio_bank_730[7] = {
241 { OMAP1_MPUIO_VBASE, INT_730_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO }, 224 { OMAP1_MPUIO_VBASE, INT_730_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
242 { OMAP730_GPIO1_BASE, INT_730_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_730 }, 225 { OMAP730_GPIO1_BASE, INT_730_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_730 },
@@ -248,19 +231,6 @@ static struct gpio_bank gpio_bank_730[7] = {
248}; 231};
249#endif 232#endif
250 233
251#ifdef CONFIG_ARCH_OMAP850
252static struct gpio_bank gpio_bank_850[7] = {
253 { OMAP1_MPUIO_VBASE, INT_850_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
254 { OMAP850_GPIO1_BASE, INT_850_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_850 },
255 { OMAP850_GPIO2_BASE, INT_850_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_850 },
256 { OMAP850_GPIO3_BASE, INT_850_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_850 },
257 { OMAP850_GPIO4_BASE, INT_850_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_850 },
258 { OMAP850_GPIO5_BASE, INT_850_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_850 },
259 { OMAP850_GPIO6_BASE, INT_850_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_850 },
260};
261#endif
262
263
264#ifdef CONFIG_ARCH_OMAP24XX 234#ifdef CONFIG_ARCH_OMAP24XX
265 235
266static struct gpio_bank gpio_bank_242x[4] = { 236static struct gpio_bank gpio_bank_242x[4] = {
@@ -402,16 +372,11 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
402 reg += OMAP1610_GPIO_DIRECTION; 372 reg += OMAP1610_GPIO_DIRECTION;
403 break; 373 break;
404#endif 374#endif
405#ifdef CONFIG_ARCH_OMAP730 375#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
406 case METHOD_GPIO_730: 376 case METHOD_GPIO_730:
407 reg += OMAP730_GPIO_DIR_CONTROL; 377 reg += OMAP730_GPIO_DIR_CONTROL;
408 break; 378 break;
409#endif 379#endif
410#ifdef CONFIG_ARCH_OMAP850
411 case METHOD_GPIO_850:
412 reg += OMAP850_GPIO_DIR_CONTROL;
413 break;
414#endif
415#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 380#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
416 case METHOD_GPIO_24XX: 381 case METHOD_GPIO_24XX:
417 reg += OMAP24XX_GPIO_OE; 382 reg += OMAP24XX_GPIO_OE;
@@ -469,7 +434,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
469 l = 1 << gpio; 434 l = 1 << gpio;
470 break; 435 break;
471#endif 436#endif
472#ifdef CONFIG_ARCH_OMAP730 437#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
473 case METHOD_GPIO_730: 438 case METHOD_GPIO_730:
474 reg += OMAP730_GPIO_DATA_OUTPUT; 439 reg += OMAP730_GPIO_DATA_OUTPUT;
475 l = __raw_readl(reg); 440 l = __raw_readl(reg);
@@ -479,16 +444,6 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
479 l &= ~(1 << gpio); 444 l &= ~(1 << gpio);
480 break; 445 break;
481#endif 446#endif
482#ifdef CONFIG_ARCH_OMAP850
483 case METHOD_GPIO_850:
484 reg += OMAP850_GPIO_DATA_OUTPUT;
485 l = __raw_readl(reg);
486 if (enable)
487 l |= 1 << gpio;
488 else
489 l &= ~(1 << gpio);
490 break;
491#endif
492#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 447#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
493 case METHOD_GPIO_24XX: 448 case METHOD_GPIO_24XX:
494 if (enable) 449 if (enable)
@@ -537,16 +492,11 @@ static int _get_gpio_datain(struct gpio_bank *bank, int gpio)
537 reg += OMAP1610_GPIO_DATAIN; 492 reg += OMAP1610_GPIO_DATAIN;
538 break; 493 break;
539#endif 494#endif
540#ifdef CONFIG_ARCH_OMAP730 495#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
541 case METHOD_GPIO_730: 496 case METHOD_GPIO_730:
542 reg += OMAP730_GPIO_DATA_INPUT; 497 reg += OMAP730_GPIO_DATA_INPUT;
543 break; 498 break;
544#endif 499#endif
545#ifdef CONFIG_ARCH_OMAP850
546 case METHOD_GPIO_850:
547 reg += OMAP850_GPIO_DATA_INPUT;
548 break;
549#endif
550#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 500#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
551 case METHOD_GPIO_24XX: 501 case METHOD_GPIO_24XX:
552 reg += OMAP24XX_GPIO_DATAIN; 502 reg += OMAP24XX_GPIO_DATAIN;
@@ -588,16 +538,11 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio)
588 reg += OMAP1610_GPIO_DATAOUT; 538 reg += OMAP1610_GPIO_DATAOUT;
589 break; 539 break;
590#endif 540#endif
591#ifdef CONFIG_ARCH_OMAP730 541#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
592 case METHOD_GPIO_730: 542 case METHOD_GPIO_730:
593 reg += OMAP730_GPIO_DATA_OUTPUT; 543 reg += OMAP730_GPIO_DATA_OUTPUT;
594 break; 544 break;
595#endif 545#endif
596#ifdef CONFIG_ARCH_OMAP850
597 case METHOD_GPIO_850:
598 reg += OMAP850_GPIO_DATA_OUTPUT;
599 break;
600#endif
601#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 546#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
602 defined(CONFIG_ARCH_OMAP4) 547 defined(CONFIG_ARCH_OMAP4)
603 case METHOD_GPIO_24XX: 548 case METHOD_GPIO_24XX:
@@ -797,7 +742,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
797 __raw_writel(1 << gpio, bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA); 742 __raw_writel(1 << gpio, bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA);
798 break; 743 break;
799#endif 744#endif
800#ifdef CONFIG_ARCH_OMAP730 745#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
801 case METHOD_GPIO_730: 746 case METHOD_GPIO_730:
802 reg += OMAP730_GPIO_INT_CONTROL; 747 reg += OMAP730_GPIO_INT_CONTROL;
803 l = __raw_readl(reg); 748 l = __raw_readl(reg);
@@ -809,18 +754,6 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
809 goto bad; 754 goto bad;
810 break; 755 break;
811#endif 756#endif
812#ifdef CONFIG_ARCH_OMAP850
813 case METHOD_GPIO_850:
814 reg += OMAP850_GPIO_INT_CONTROL;
815 l = __raw_readl(reg);
816 if (trigger & IRQ_TYPE_EDGE_RISING)
817 l |= 1 << gpio;
818 else if (trigger & IRQ_TYPE_EDGE_FALLING)
819 l &= ~(1 << gpio);
820 else
821 goto bad;
822 break;
823#endif
824#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 757#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
825 defined(CONFIG_ARCH_OMAP4) 758 defined(CONFIG_ARCH_OMAP4)
826 case METHOD_GPIO_24XX: 759 case METHOD_GPIO_24XX:
@@ -897,16 +830,11 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
897 reg += OMAP1610_GPIO_IRQSTATUS1; 830 reg += OMAP1610_GPIO_IRQSTATUS1;
898 break; 831 break;
899#endif 832#endif
900#ifdef CONFIG_ARCH_OMAP730 833#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
901 case METHOD_GPIO_730: 834 case METHOD_GPIO_730:
902 reg += OMAP730_GPIO_INT_STATUS; 835 reg += OMAP730_GPIO_INT_STATUS;
903 break; 836 break;
904#endif 837#endif
905#ifdef CONFIG_ARCH_OMAP850
906 case METHOD_GPIO_850:
907 reg += OMAP850_GPIO_INT_STATUS;
908 break;
909#endif
910#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 838#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
911 case METHOD_GPIO_24XX: 839 case METHOD_GPIO_24XX:
912 reg += OMAP24XX_GPIO_IRQSTATUS1; 840 reg += OMAP24XX_GPIO_IRQSTATUS1;
@@ -971,20 +899,13 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
971 mask = 0xffff; 899 mask = 0xffff;
972 break; 900 break;
973#endif 901#endif
974#ifdef CONFIG_ARCH_OMAP730 902#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
975 case METHOD_GPIO_730: 903 case METHOD_GPIO_730:
976 reg += OMAP730_GPIO_INT_MASK; 904 reg += OMAP730_GPIO_INT_MASK;
977 mask = 0xffffffff; 905 mask = 0xffffffff;
978 inv = 1; 906 inv = 1;
979 break; 907 break;
980#endif 908#endif
981#ifdef CONFIG_ARCH_OMAP850
982 case METHOD_GPIO_850:
983 reg += OMAP850_GPIO_INT_MASK;
984 mask = 0xffffffff;
985 inv = 1;
986 break;
987#endif
988#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 909#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
989 case METHOD_GPIO_24XX: 910 case METHOD_GPIO_24XX:
990 reg += OMAP24XX_GPIO_IRQENABLE1; 911 reg += OMAP24XX_GPIO_IRQENABLE1;
@@ -1044,7 +965,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
1044 l = gpio_mask; 965 l = gpio_mask;
1045 break; 966 break;
1046#endif 967#endif
1047#ifdef CONFIG_ARCH_OMAP730 968#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
1048 case METHOD_GPIO_730: 969 case METHOD_GPIO_730:
1049 reg += OMAP730_GPIO_INT_MASK; 970 reg += OMAP730_GPIO_INT_MASK;
1050 l = __raw_readl(reg); 971 l = __raw_readl(reg);
@@ -1054,16 +975,6 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
1054 l |= gpio_mask; 975 l |= gpio_mask;
1055 break; 976 break;
1056#endif 977#endif
1057#ifdef CONFIG_ARCH_OMAP850
1058 case METHOD_GPIO_850:
1059 reg += OMAP850_GPIO_INT_MASK;
1060 l = __raw_readl(reg);
1061 if (enable)
1062 l &= ~(gpio_mask);
1063 else
1064 l |= gpio_mask;
1065 break;
1066#endif
1067#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 978#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1068 case METHOD_GPIO_24XX: 979 case METHOD_GPIO_24XX:
1069 if (enable) 980 if (enable)
@@ -1249,14 +1160,10 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1249 if (bank->method == METHOD_GPIO_1610) 1160 if (bank->method == METHOD_GPIO_1610)
1250 isr_reg = bank->base + OMAP1610_GPIO_IRQSTATUS1; 1161 isr_reg = bank->base + OMAP1610_GPIO_IRQSTATUS1;
1251#endif 1162#endif
1252#ifdef CONFIG_ARCH_OMAP730 1163#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
1253 if (bank->method == METHOD_GPIO_730) 1164 if (bank->method == METHOD_GPIO_730)
1254 isr_reg = bank->base + OMAP730_GPIO_INT_STATUS; 1165 isr_reg = bank->base + OMAP730_GPIO_INT_STATUS;
1255#endif 1166#endif
1256#ifdef CONFIG_ARCH_OMAP850
1257 if (bank->method == METHOD_GPIO_850)
1258 isr_reg = bank->base + OMAP850_GPIO_INT_STATUS;
1259#endif
1260#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1167#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
1261 if (bank->method == METHOD_GPIO_24XX) 1168 if (bank->method == METHOD_GPIO_24XX)
1262 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1; 1169 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1;
@@ -1527,9 +1434,6 @@ static int gpio_is_input(struct gpio_bank *bank, int mask)
1527 case METHOD_GPIO_730: 1434 case METHOD_GPIO_730:
1528 reg += OMAP730_GPIO_DIR_CONTROL; 1435 reg += OMAP730_GPIO_DIR_CONTROL;
1529 break; 1436 break;
1530 case METHOD_GPIO_850:
1531 reg += OMAP850_GPIO_DIR_CONTROL;
1532 break;
1533 case METHOD_GPIO_24XX: 1437 case METHOD_GPIO_24XX:
1534 reg += OMAP24XX_GPIO_OE; 1438 reg += OMAP24XX_GPIO_OE;
1535 break; 1439 break;
@@ -1695,21 +1599,13 @@ static int __init _omap_gpio_init(void)
1695 (rev >> 4) & 0x0f, rev & 0x0f); 1599 (rev >> 4) & 0x0f, rev & 0x0f);
1696 } 1600 }
1697#endif 1601#endif
1698#ifdef CONFIG_ARCH_OMAP730 1602#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
1699 if (cpu_is_omap730()) { 1603 if (cpu_is_omap7xx()) {
1700 printk(KERN_INFO "OMAP730 GPIO hardware\n"); 1604 printk(KERN_INFO "OMAP7XX GPIO hardware\n");
1701 gpio_bank_count = 7; 1605 gpio_bank_count = 7;
1702 gpio_bank = gpio_bank_730; 1606 gpio_bank = gpio_bank_730;
1703 } 1607 }
1704#endif 1608#endif
1705#ifdef CONFIG_ARCH_OMAP850
1706 if (cpu_is_omap850()) {
1707 printk(KERN_INFO "OMAP850 GPIO hardware\n");
1708 gpio_bank_count = 7;
1709 gpio_bank = gpio_bank_850;
1710 }
1711#endif
1712
1713#ifdef CONFIG_ARCH_OMAP24XX 1609#ifdef CONFIG_ARCH_OMAP24XX
1714 if (cpu_is_omap242x()) { 1610 if (cpu_is_omap242x()) {
1715 int rev; 1611 int rev;
@@ -2160,8 +2056,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
2160 2056
2161 if (bank_is_mpuio(bank)) 2057 if (bank_is_mpuio(bank))
2162 gpio = OMAP_MPUIO(0); 2058 gpio = OMAP_MPUIO(0);
2163 else if (cpu_class_is_omap2() || cpu_is_omap730() || 2059 else if (cpu_class_is_omap2() || cpu_is_omap7xx())
2164 cpu_is_omap850())
2165 bankwidth = 32; 2060 bankwidth = 32;
2166 2061
2167 for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) { 2062 for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) {