aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEero Nurkkala <ext-eero.nurkkala@nokia.com>2009-08-28 13:51:36 -0400
committerTony Lindgren <tony@atomide.com>2009-08-28 13:51:36 -0400
commit82dbb9d39f58e3d12b5903764901df5fec759daf (patch)
treea08cd7f70a69e70df94e37fc1df6ea062a6ec61c
parent79e44c952cec025295b3f0fd0ff2a875689b98c4 (diff)
OMAP: GPIO: Avoid generating extra IRQs
It is possible for GPIO IRQ lines configured with falling edge triggering only to get IRQs at the rising edge upon the exit of offmode. And vice versa. Prevent such IRQs to arrive by generating the IRQ obeying the detection scheme. Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/plat-omap/gpio.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index b55b4adffbe7..7c70a6afcf66 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1895,7 +1895,7 @@ void omap2_gpio_resume_after_retention(void)
1895 return; 1895 return;
1896 for (i = 0; i < gpio_bank_count; i++) { 1896 for (i = 0; i < gpio_bank_count; i++) {
1897 struct gpio_bank *bank = &gpio_bank[i]; 1897 struct gpio_bank *bank = &gpio_bank[i];
1898 u32 l; 1898 u32 l, gen, gen0, gen1;
1899 1899
1900 if (!(bank->enabled_non_wakeup_gpios)) 1900 if (!(bank->enabled_non_wakeup_gpios))
1901 continue; 1901 continue;
@@ -1916,14 +1916,33 @@ void omap2_gpio_resume_after_retention(void)
1916#endif 1916#endif
1917 l ^= bank->saved_datain; 1917 l ^= bank->saved_datain;
1918 l &= bank->non_wakeup_gpios; 1918 l &= bank->non_wakeup_gpios;
1919 if (l) { 1919
1920 /*
1921 * No need to generate IRQs for the rising edge for gpio IRQs
1922 * configured with falling edge only; and vice versa.
1923 */
1924 gen0 = l & bank->saved_fallingdetect;
1925 gen0 &= bank->saved_datain;
1926
1927 gen1 = l & bank->saved_risingdetect;
1928 gen1 &= ~(bank->saved_datain);
1929
1930 /* FIXME: Consider GPIO IRQs with level detections properly! */
1931 gen = l & (~(bank->saved_fallingdetect) &
1932 ~(bank->saved_risingdetect));
1933 /* Consider all GPIO IRQs needed to be updated */
1934 gen |= gen0 | gen1;
1935
1936 if (gen) {
1920 u32 old0, old1; 1937 u32 old0, old1;
1921#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ 1938#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
1922 defined(CONFIG_ARCH_OMAP4) 1939 defined(CONFIG_ARCH_OMAP4)
1923 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0); 1940 old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
1924 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1); 1941 old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
1925 __raw_writel(old0 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT0); 1942 __raw_writel(old0 | gen, bank->base +
1926 __raw_writel(old1 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT1); 1943 OMAP24XX_GPIO_LEVELDETECT0);
1944 __raw_writel(old1 | gen, bank->base +
1945 OMAP24XX_GPIO_LEVELDETECT1);
1927 __raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0); 1946 __raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
1928 __raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1); 1947 __raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1);
1929#endif 1948#endif