From patchwork Tue Oct 15 16:42:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 3046621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5D4CA9F2B6 for ; Tue, 15 Oct 2013 16:44:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45B672042A for ; Tue, 15 Oct 2013 16:44:04 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2E2520426 for ; Tue, 15 Oct 2013 16:44:02 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VW7ix-0000ri-0I; Tue, 15 Oct 2013 16:43:59 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VW7iu-00066g-KZ; Tue, 15 Oct 2013 16:43:56 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VW7ip-00065g-VK for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2013 16:43:54 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MUP0040JYG4YUC0@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2013 17:43:25 +0100 (BST) X-AuditID: cbfec7f4-b7f0a6d000007b1b-9e-525d70adc9ca Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 77.B4.31515.DA07D525; Tue, 15 Oct 2013 17:43:25 +0100 (BST) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MUP00FGNYGAQZ20@eusync4.samsung.com>; Tue, 15 Oct 2013 17:43:24 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] ARM: exynos: Allow wake-up using GIC interrupts Date: Tue, 15 Oct 2013 18:42:50 +0200 Message-id: <1381855370-7500-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.3.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJJMWRmVeSWpSXmKPExsVy+t/xa7prC2KDDBbdZrL4O+kYu8XZZQfZ LHoXXGWzONv0ht1i0+NrrBYzzu9jsrh9mdfi1PXPbBbrZ7xmsXjyaBuzA5dHS3MPm8fvX5MY PWY3XGTxuHNtD5vH5iX1HldONLF69G1ZxejxeZNcAEcUl01Kak5mWWqRvl0CV8bGXR4Fp0Uq 1qzfzt7AeEugi5GTQ0LARKJzViMThC0mceHeerYuRi4OIYGljBJ9bT+ZIJw+Jokj+z6xg1Sx CahJfG54xAZiiwioSnxuW8AOUsQs8JhJYtqja0AJDg5hAQeJ81sdQGpYgGpOblnDAmLzCjhK /Hr+hR1im4LEsi9rmScwci9gZFjFKJpamlxQnJSea6hXnJhbXJqXrpecn7uJERJcX3YwLj5m dYhRgINRiYf3RFRskBBrYllxZe4hRgkOZiUR3sRYoBBvSmJlVWpRfnxRaU5q8SFGJg5OqQZG g3y+i29an1wQcQmT5d1beWeL7KvAgPJfwYK9lvolt05InZ2stIc54oKUwz7jpRV222r4/ycG Kqtv3iY0q2S59sPdXpllrtHKSyf+PKZ7nUvaKeg664uG923Xnfx2/vWIFlfNXl+w/9yTQ9ui +BVialiYZql0J/LsluviXGiyZIXI5RNJIteVWIozEg21mIuKEwG2iPp9DAIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131015_124352_088095_E9B279B5 X-CRM114-Status: GOOD ( 16.68 ) X-Spam-Score: -7.4 (-------) Cc: Kukjin Kim , Russell King - ARM Linux , Arnd Bergmann , Tomasz Figa , Doug Anderson , Kyungmin Park , Olof Johansson , Vikas Sajjan , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch restores the ability to receive wake-up events from internal GIC interrupts, e.g. RTC tick or alarm interrupts. Signed-off-by: Tomasz Figa Signed-off-by: Kyungmin Park --- arch/arm/mach-exynos/include/mach/pm-core.h | 1 - arch/arm/mach-exynos/pm.c | 55 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h index 2b00833..be112ce 100644 --- a/arch/arm/mach-exynos/include/mach/pm-core.h +++ b/arch/arm/mach-exynos/include/mach/pm-core.h @@ -66,7 +66,6 @@ static inline void samsung_pm_saved_gpios(void) /* Compatibility definitions to make plat-samsung/pm.c compile */ #define IRQ_EINT_BIT(x) 1 -#define s3c_irqwake_intallow 0 #define s3c_irqwake_eintallow 0 #endif /* __ASM_ARCH_PM_CORE_H */ diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index c679db5..1f24e7f 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -212,14 +212,69 @@ static struct subsys_interface exynos_pm_interface = { .add_dev = exynos_pm_add, }; +struct exynos_wkup_irq { + unsigned int hwirq; + u32 mask; +}; + +static const struct exynos_wkup_irq exynos4_wkup_irq[] = { + { 76, BIT(1) }, /* RTC alarm */ + { 77, BIT(2) }, /* RTC tick */ + { /* sentinel */ }, +}; + +static const struct exynos_wkup_irq exynos5250_wkup_irq[] = { + { 75, BIT(1) }, /* RTC alarm */ + { 76, BIT(2) }, /* RTC tick */ + { /* sentinel */ }, +}; + +unsigned long s3c_irqwake_intallow; + +int s3c_irq_wake(struct irq_data *data, unsigned int state) +{ + const struct exynos_wkup_irq *wkup_irq; + + if (soc_is_exynos5250()) + wkup_irq = exynos5250_wkup_irq; + else + wkup_irq = exynos4_wkup_irq; + + while (wkup_irq->mask) { + if (wkup_irq->hwirq == data->hwirq) { + if (!state) + s3c_irqwake_intmask |= wkup_irq->mask; + else + s3c_irqwake_intmask &= ~wkup_irq->mask; + return 0; + } + ++wkup_irq; + } + + return -ENOENT; +} + static __init int exynos_pm_drvinit(void) { + const struct exynos_wkup_irq *wkup_irq; struct clk *pll_base; unsigned int tmp; if (soc_is_exynos5440()) return 0; + if (soc_is_exynos5250()) + wkup_irq = exynos5250_wkup_irq; + else + wkup_irq = exynos4_wkup_irq; + + while (wkup_irq->mask) { + s3c_irqwake_intallow |= wkup_irq->mask; + ++wkup_irq; + } + + gic_arch_extn.irq_set_wake = s3c_irq_wake; + s3c_pm_init(); /* All wakeup disable */