From patchwork Thu Jan 6 17:59:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 459711 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p06HxkVo000725 for ; Thu, 6 Jan 2011 17:59:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752022Ab1AFR7x (ORCPT ); Thu, 6 Jan 2011 12:59:53 -0500 Received: from na3sys009aog106.obsmtp.com ([74.125.149.77]:57103 "EHLO na3sys009aog106.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751935Ab1AFR7w (ORCPT ); Thu, 6 Jan 2011 12:59:52 -0500 Received: from source ([74.125.83.51]) by na3sys009aob106.postini.com ([74.125.148.12]) with SMTP ID DSNKTSYDGARMCV7wjBU/7xo0oc2R+uLL6BwA@postini.com; Thu, 06 Jan 2011 09:59:52 PST Received: by mail-gw0-f51.google.com with SMTP id a18so6902038gwa.10 for ; Thu, 06 Jan 2011 09:59:52 -0800 (PST) Received: by 10.90.75.17 with SMTP id x17mr2272625aga.64.1294336791891; Thu, 06 Jan 2011 09:59:51 -0800 (PST) Received: from localhost (c-24-18-179-55.hsd1.wa.comcast.net [24.18.179.55]) by mx.google.com with ESMTPS id 35sm32465012ano.31.2011.01.06.09.59.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 06 Jan 2011 09:59:50 -0800 (PST) From: Kevin Hilman To: eduardo.valentin@nokia.com Cc: ext Russell King - ARM Linux , Tony Lindgren , Linux-OMAP , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/1] arm: omap: gpio: define .disable callback for gpio irq chip Organization: Texas Instruments, Inc. References: <1294250283-18182-1-git-send-email-eduardo.valentin@nokia.com> <20110105181918.GB8717@n2100.arm.linux.org.uk> <20110105192425.GA24729@besouro.research.nokia.com> <87aajfvstw.fsf@ti.com> <20110106062404.GA14141@besouro.research.nokia.com> Date: Thu, 06 Jan 2011 09:59:48 -0800 In-Reply-To: <20110106062404.GA14141@besouro.research.nokia.com> (Eduardo Valentin's message of "Thu, 6 Jan 2011 08:24:04 +0200") Message-ID: <878vyxx697.fsf@ti.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 06 Jan 2011 17:59:54 +0000 (UTC) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index ccf2660..1418423 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -977,34 +977,39 @@ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int ena static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) { unsigned long uninitialized_var(flags); + void __iomem *wake_status; + void __iomem *wake_clear; + void __iomem *wake_set; + + printk("KJH: %s: bank IRQ %d, GPIO %d enable=%d\n", __func__, + bank->irq, gpio, enable); switch (bank->method) { #ifdef CONFIG_ARCH_OMAP16XX case METHOD_MPUIO: case METHOD_GPIO_1610: - spin_lock_irqsave(&bank->lock, flags); - if (enable) - bank->suspend_wakeup |= (1 << gpio); - else - bank->suspend_wakeup &= ~(1 << gpio); - spin_unlock_irqrestore(&bank->lock, flags); + wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE; + wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; + wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; return 0; #endif #ifdef CONFIG_ARCH_OMAP2PLUS case METHOD_GPIO_24XX: - case METHOD_GPIO_44XX: + wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN; + wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; + wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; + if (bank->non_wakeup_gpios & (1 << gpio)) { printk(KERN_ERR "Unable to modify wakeup on " "non-wakeup GPIO%d\n", (bank - gpio_bank) * 32 + gpio); return -EINVAL; } - spin_lock_irqsave(&bank->lock, flags); - if (enable) - bank->suspend_wakeup |= (1 << gpio); - else - bank->suspend_wakeup &= ~(1 << gpio); - spin_unlock_irqrestore(&bank->lock, flags); + break; + case METHOD_GPIO_44XX: + wake_status = bank->base + OMAP4_GPIO_IRQWAKEN0; + wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0; + wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0; return 0; #endif default: @@ -1012,6 +1017,16 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) bank->method); return -EINVAL; } + + spin_lock_irqsave(&bank->lock, flags); + if (enable) + __raw_writel((1 << gpio), wake_set); + else + __raw_writel((1 << gpio), wake_clear); + + spin_unlock_irqrestore(&bank->lock, flags); + + return 0; } static void _reset_gpio(struct gpio_bank *bank, int gpio) @@ -1755,105 +1770,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) } #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS) -static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg) -{ - int i; - - if (!cpu_class_is_omap2() && !cpu_is_omap16xx()) - return 0; - - for (i = 0; i < gpio_bank_count; i++) { - struct gpio_bank *bank = &gpio_bank[i]; - void __iomem *wake_status; - void __iomem *wake_clear; - void __iomem *wake_set; - unsigned long flags; - - switch (bank->method) { -#ifdef CONFIG_ARCH_OMAP16XX - case METHOD_GPIO_1610: - wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE; - wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; - wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; - break; -#endif -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) - case METHOD_GPIO_24XX: - wake_status = bank->base + OMAP24XX_GPIO_WAKE_EN; - wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; - wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; - break; -#endif -#ifdef CONFIG_ARCH_OMAP4 - case METHOD_GPIO_44XX: - wake_status = bank->base + OMAP4_GPIO_IRQWAKEN0; - wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0; - wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0; - break; -#endif - default: - continue; - } - - spin_lock_irqsave(&bank->lock, flags); - bank->saved_wakeup = __raw_readl(wake_status); - __raw_writel(0xffffffff, wake_clear); - __raw_writel(bank->suspend_wakeup, wake_set); - spin_unlock_irqrestore(&bank->lock, flags); - } - - return 0; -} - -static int omap_gpio_resume(struct sys_device *dev) -{ - int i; - - if (!cpu_class_is_omap2() && !cpu_is_omap16xx()) - return 0; - - for (i = 0; i < gpio_bank_count; i++) { - struct gpio_bank *bank = &gpio_bank[i]; - void __iomem *wake_clear; - void __iomem *wake_set; - unsigned long flags; - - switch (bank->method) { -#ifdef CONFIG_ARCH_OMAP16XX - case METHOD_GPIO_1610: - wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; - wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; - break; -#endif -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) - case METHOD_GPIO_24XX: - wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA; - wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA; - break; -#endif -#ifdef CONFIG_ARCH_OMAP4 - case METHOD_GPIO_44XX: - wake_clear = bank->base + OMAP4_GPIO_IRQWAKEN0; - wake_set = bank->base + OMAP4_GPIO_IRQWAKEN0; - break; -#endif - default: - continue; - } - - spin_lock_irqsave(&bank->lock, flags); - __raw_writel(0xffffffff, wake_clear); - __raw_writel(bank->saved_wakeup, wake_set); - spin_unlock_irqrestore(&bank->lock, flags); - } - - return 0; -} static struct sysdev_class omap_gpio_sysclass = { .name = "gpio", - .suspend = omap_gpio_suspend, - .resume = omap_gpio_resume, }; static struct sys_device omap_gpio_device = {