aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/gpio.c')
-rw-r--r--arch/arm/plat-omap/gpio.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index c09b3d9bcd3b..0fb0e58fec93 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -177,12 +177,12 @@ struct gpio_bank {
177 u16 irq; 177 u16 irq;
178 u16 virtual_irq_start; 178 u16 virtual_irq_start;
179 int method; 179 int method;
180#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 180#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2) || \
181 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4) 181 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
182 u32 suspend_wakeup; 182 u32 suspend_wakeup;
183 u32 saved_wakeup; 183 u32 saved_wakeup;
184#endif 184#endif
185#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 185#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
186 defined(CONFIG_ARCH_OMAP4) 186 defined(CONFIG_ARCH_OMAP4)
187 u32 non_wakeup_gpios; 187 u32 non_wakeup_gpios;
188 u32 enabled_non_wakeup_gpios; 188 u32 enabled_non_wakeup_gpios;
@@ -248,7 +248,7 @@ static struct gpio_bank gpio_bank_7xx[7] = {
248}; 248};
249#endif 249#endif
250 250
251#ifdef CONFIG_ARCH_OMAP24XX 251#ifdef CONFIG_ARCH_OMAP2
252 252
253static struct gpio_bank gpio_bank_242x[4] = { 253static struct gpio_bank gpio_bank_242x[4] = {
254 { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, 254 { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
@@ -426,7 +426,7 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
426 reg += OMAP7XX_GPIO_DIR_CONTROL; 426 reg += OMAP7XX_GPIO_DIR_CONTROL;
427 break; 427 break;
428#endif 428#endif
429#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 429#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
430 case METHOD_GPIO_24XX: 430 case METHOD_GPIO_24XX:
431 reg += OMAP24XX_GPIO_OE; 431 reg += OMAP24XX_GPIO_OE;
432 break; 432 break;
@@ -493,7 +493,7 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
493 l &= ~(1 << gpio); 493 l &= ~(1 << gpio);
494 break; 494 break;
495#endif 495#endif
496#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 496#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
497 case METHOD_GPIO_24XX: 497 case METHOD_GPIO_24XX:
498 if (enable) 498 if (enable)
499 reg += OMAP24XX_GPIO_SETDATAOUT; 499 reg += OMAP24XX_GPIO_SETDATAOUT;
@@ -546,7 +546,7 @@ static int _get_gpio_datain(struct gpio_bank *bank, int gpio)
546 reg += OMAP7XX_GPIO_DATA_INPUT; 546 reg += OMAP7XX_GPIO_DATA_INPUT;
547 break; 547 break;
548#endif 548#endif
549#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 549#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
550 case METHOD_GPIO_24XX: 550 case METHOD_GPIO_24XX:
551 reg += OMAP24XX_GPIO_DATAIN; 551 reg += OMAP24XX_GPIO_DATAIN;
552 break; 552 break;
@@ -592,7 +592,7 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio)
592 reg += OMAP7XX_GPIO_DATA_OUTPUT; 592 reg += OMAP7XX_GPIO_DATA_OUTPUT;
593 break; 593 break;
594#endif 594#endif
595#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 595#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
596 defined(CONFIG_ARCH_OMAP4) 596 defined(CONFIG_ARCH_OMAP4)
597 case METHOD_GPIO_24XX: 597 case METHOD_GPIO_24XX:
598 reg += OMAP24XX_GPIO_DATAOUT; 598 reg += OMAP24XX_GPIO_DATAOUT;
@@ -684,7 +684,7 @@ void omap_set_gpio_debounce_time(int gpio, int enc_time)
684} 684}
685EXPORT_SYMBOL(omap_set_gpio_debounce_time); 685EXPORT_SYMBOL(omap_set_gpio_debounce_time);
686 686
687#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 687#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
688 defined(CONFIG_ARCH_OMAP4) 688 defined(CONFIG_ARCH_OMAP4)
689static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, 689static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio,
690 int trigger) 690 int trigger)
@@ -856,7 +856,7 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
856 goto bad; 856 goto bad;
857 break; 857 break;
858#endif 858#endif
859#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 859#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
860 defined(CONFIG_ARCH_OMAP4) 860 defined(CONFIG_ARCH_OMAP4)
861 case METHOD_GPIO_24XX: 861 case METHOD_GPIO_24XX:
862 set_24xx_gpio_triggering(bank, gpio, trigger); 862 set_24xx_gpio_triggering(bank, gpio, trigger);
@@ -937,7 +937,7 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
937 reg += OMAP7XX_GPIO_INT_STATUS; 937 reg += OMAP7XX_GPIO_INT_STATUS;
938 break; 938 break;
939#endif 939#endif
940#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 940#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
941 case METHOD_GPIO_24XX: 941 case METHOD_GPIO_24XX:
942 reg += OMAP24XX_GPIO_IRQSTATUS1; 942 reg += OMAP24XX_GPIO_IRQSTATUS1;
943 break; 943 break;
@@ -954,7 +954,7 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
954 __raw_writel(gpio_mask, reg); 954 __raw_writel(gpio_mask, reg);
955 955
956 /* Workaround for clearing DSP GPIO interrupts to allow retention */ 956 /* Workaround for clearing DSP GPIO interrupts to allow retention */
957#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 957#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
958 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2; 958 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2;
959#endif 959#endif
960#if defined(CONFIG_ARCH_OMAP4) 960#if defined(CONFIG_ARCH_OMAP4)
@@ -1008,7 +1008,7 @@ static u32 _get_gpio_irqbank_mask(struct gpio_bank *bank)
1008 inv = 1; 1008 inv = 1;
1009 break; 1009 break;
1010#endif 1010#endif
1011#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1011#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
1012 case METHOD_GPIO_24XX: 1012 case METHOD_GPIO_24XX:
1013 reg += OMAP24XX_GPIO_IRQENABLE1; 1013 reg += OMAP24XX_GPIO_IRQENABLE1;
1014 mask = 0xffffffff; 1014 mask = 0xffffffff;
@@ -1077,7 +1077,7 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
1077 l |= gpio_mask; 1077 l |= gpio_mask;
1078 break; 1078 break;
1079#endif 1079#endif
1080#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1080#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
1081 case METHOD_GPIO_24XX: 1081 case METHOD_GPIO_24XX:
1082 if (enable) 1082 if (enable)
1083 reg += OMAP24XX_GPIO_SETIRQENABLE1; 1083 reg += OMAP24XX_GPIO_SETIRQENABLE1;
@@ -1131,7 +1131,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
1131 spin_unlock_irqrestore(&bank->lock, flags); 1131 spin_unlock_irqrestore(&bank->lock, flags);
1132 return 0; 1132 return 0;
1133#endif 1133#endif
1134#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1134#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
1135 defined(CONFIG_ARCH_OMAP4) 1135 defined(CONFIG_ARCH_OMAP4)
1136 case METHOD_GPIO_24XX: 1136 case METHOD_GPIO_24XX:
1137 if (bank->non_wakeup_gpios & (1 << gpio)) { 1137 if (bank->non_wakeup_gpios & (1 << gpio)) {
@@ -1227,7 +1227,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
1227 __raw_writel(1 << offset, reg); 1227 __raw_writel(1 << offset, reg);
1228 } 1228 }
1229#endif 1229#endif
1230#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1230#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
1231 defined(CONFIG_ARCH_OMAP4) 1231 defined(CONFIG_ARCH_OMAP4)
1232 if (bank->method == METHOD_GPIO_24XX) { 1232 if (bank->method == METHOD_GPIO_24XX) {
1233 /* Disable wake-up during idle for dynamic tick */ 1233 /* Disable wake-up during idle for dynamic tick */
@@ -1286,7 +1286,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
1286 if (bank->method == METHOD_GPIO_7XX) 1286 if (bank->method == METHOD_GPIO_7XX)
1287 isr_reg = bank->base + OMAP7XX_GPIO_INT_STATUS; 1287 isr_reg = bank->base + OMAP7XX_GPIO_INT_STATUS;
1288#endif 1288#endif
1289#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1289#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
1290 if (bank->method == METHOD_GPIO_24XX) 1290 if (bank->method == METHOD_GPIO_24XX)
1291 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1; 1291 isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1;
1292#endif 1292#endif
@@ -1756,7 +1756,7 @@ static int __init _omap_gpio_init(void)
1756 bank_size = SZ_2K; 1756 bank_size = SZ_2K;
1757 } 1757 }
1758#endif 1758#endif
1759#ifdef CONFIG_ARCH_OMAP24XX 1759#ifdef CONFIG_ARCH_OMAP2
1760 if (cpu_is_omap242x()) { 1760 if (cpu_is_omap242x()) {
1761 gpio_bank_count = 4; 1761 gpio_bank_count = 4;
1762 gpio_bank = gpio_bank_242x; 1762 gpio_bank = gpio_bank_242x;
@@ -1809,7 +1809,7 @@ static int __init _omap_gpio_init(void)
1809 gpio_count = 32; /* 7xx has 32-bit GPIOs */ 1809 gpio_count = 32; /* 7xx has 32-bit GPIOs */
1810 } 1810 }
1811 1811
1812#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1812#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
1813 defined(CONFIG_ARCH_OMAP4) 1813 defined(CONFIG_ARCH_OMAP4)
1814 if (bank->method == METHOD_GPIO_24XX) { 1814 if (bank->method == METHOD_GPIO_24XX) {
1815 static const u32 non_wakeup_gpios[] = { 1815 static const u32 non_wakeup_gpios[] = {
@@ -1903,7 +1903,7 @@ static int __init _omap_gpio_init(void)
1903 return 0; 1903 return 0;
1904} 1904}
1905 1905
1906#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 1906#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2) || \
1907 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4) 1907 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
1908static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg) 1908static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
1909{ 1909{
@@ -1927,7 +1927,7 @@ static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
1927 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; 1927 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1928 break; 1928 break;
1929#endif 1929#endif
1930#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1930#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
1931 case METHOD_GPIO_24XX: 1931 case METHOD_GPIO_24XX:
1932 wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN; 1932 wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN;
1933 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1933 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
@@ -1975,7 +1975,7 @@ static int omap_gpio_resume(struct sys_device *dev)
1975 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; 1975 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
1976 break; 1976 break;
1977#endif 1977#endif
1978#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 1978#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
1979 case METHOD_GPIO_24XX: 1979 case METHOD_GPIO_24XX:
1980 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; 1980 wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
1981 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; 1981 wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
@@ -2013,7 +2013,7 @@ static struct sys_device omap_gpio_device = {
2013 2013
2014#endif 2014#endif
2015 2015
2016#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 2016#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX) || \
2017 defined(CONFIG_ARCH_OMAP4) 2017 defined(CONFIG_ARCH_OMAP4)
2018 2018
2019static int workaround_enabled; 2019static int workaround_enabled;
@@ -2030,7 +2030,7 @@ void omap2_gpio_prepare_for_retention(void)
2030 2030
2031 if (!(bank->enabled_non_wakeup_gpios)) 2031 if (!(bank->enabled_non_wakeup_gpios))
2032 continue; 2032 continue;
2033#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2033#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
2034 bank->saved_datain = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN); 2034 bank->saved_datain = __raw_readl(bank->base + OMAP24XX_GPIO_DATAIN);
2035 l1 = __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT); 2035 l1 = __raw_readl(bank->base + OMAP24XX_GPIO_FALLINGDETECT);
2036 l2 = __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT); 2036 l2 = __raw_readl(bank->base + OMAP24XX_GPIO_RISINGDETECT);
@@ -2045,7 +2045,7 @@ void omap2_gpio_prepare_for_retention(void)
2045 bank->saved_risingdetect = l2; 2045 bank->saved_risingdetect = l2;
2046 l1 &= ~bank->enabled_non_wakeup_gpios; 2046 l1 &= ~bank->enabled_non_wakeup_gpios;
2047 l2 &= ~bank->enabled_non_wakeup_gpios; 2047 l2 &= ~bank->enabled_non_wakeup_gpios;
2048#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2048#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
2049 __raw_writel(l1, bank->base + OMAP24XX_GPIO_FALLINGDETECT); 2049 __raw_writel(l1, bank->base + OMAP24XX_GPIO_FALLINGDETECT);
2050 __raw_writel(l2, bank->base + OMAP24XX_GPIO_RISINGDETECT); 2050 __raw_writel(l2, bank->base + OMAP24XX_GPIO_RISINGDETECT);
2051#endif 2051#endif
@@ -2074,7 +2074,7 @@ void omap2_gpio_resume_after_retention(void)
2074 2074
2075 if (!(bank->enabled_non_wakeup_gpios)) 2075 if (!(bank->enabled_non_wakeup_gpios))
2076 continue; 2076 continue;
2077#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2077#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
2078 __raw_writel(bank->saved_fallingdetect, 2078 __raw_writel(bank->saved_fallingdetect,
2079 bank->base + OMAP24XX_GPIO_FALLINGDETECT); 2079 bank->base + OMAP24XX_GPIO_FALLINGDETECT);
2080 __raw_writel(bank->saved_risingdetect, 2080 __raw_writel(bank->saved_risingdetect,
@@ -2113,7 +2113,7 @@ void omap2_gpio_resume_after_retention(void)
2113 2113
2114 if (gen) { 2114 if (gen) {
2115 u32 old0, old1; 2115 u32 old0, old1;
2116#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 2116#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP34XX)
2117 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0); 2117 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
2118 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); 2118 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
2119 __raw_writel(old0 | gen, bank->base + 2119 __raw_writel(old0 | gen, bank->base +
@@ -2240,7 +2240,7 @@ static int __init omap_gpio_sysinit(void)
2240 2240
2241 mpuio_init(); 2241 mpuio_init();
2242 2242
2243#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 2243#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2) || \
2244 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4) 2244 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
2245 if (cpu_is_omap16xx() || cpu_class_is_omap2()) { 2245 if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
2246 if (ret == 0) { 2246 if (ret == 0) {
@@ -2300,7 +2300,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
2300/* FIXME for at least omap2, show pullup/pulldown state */ 2300/* FIXME for at least omap2, show pullup/pulldown state */
2301 2301
2302 irqstat = irq_desc[irq].status; 2302 irqstat = irq_desc[irq].status;
2303#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX) || \ 2303#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2) || \
2304 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4) 2304 defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP4)
2305 if (is_in && ((bank->suspend_wakeup & mask) 2305 if (is_in && ((bank->suspend_wakeup & mask)
2306 || irqstat & IRQ_TYPE_SENSE_MASK)) { 2306 || irqstat & IRQ_TYPE_SENSE_MASK)) {