From patchwork Fri Nov 15 08:47:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 3187261 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 CE2639F3AE for ; Fri, 15 Nov 2013 08:51:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FD8B208E8 for ; Fri, 15 Nov 2013 08:51:35 +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 38916208E7 for ; Fri, 15 Nov 2013 08:51:34 +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 1VhF68-0006lC-Tu; Fri, 15 Nov 2013 08:49:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhF5m-0001bU-Ki; Fri, 15 Nov 2013 08:49:30 +0000 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhF52-0001Ut-7d for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2013 08:48:45 +0000 Received: by mail-wg0-f43.google.com with SMTP id n12so3152635wgh.34 for ; Fri, 15 Nov 2013 00:48:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+64HsiiRxfW0xhyZ7nfX4ZsmrT4qe1FUjIpbl4wn2DA=; b=imxcUOSBVcApy9NT8oDjsIhzWeLT6A+fYDC8i1KSywIAQPzN/aR5OoaQD0W2UkU6N2 T18lFWOX1YghiS9+xh3MPA3uyOIHHO7v83y+G/jxPE0Ubl3Ym2RPxVV0JXh28xx2HypP U1sFMIVzzBDs15nM8zTJjWSCPgOYrNFUOMBADqtpT3MzOrXsH6HnLDzeSm29dgcyTULr fJWMjYwvdAoJtRy+J8J772gnOB2DsPJg25dSDh27s0M7hzt8TOCmdXgzd0l6FNeusRLA 4QTmejV+TDnOdXyAKCE//nQR3qg+aw1PbIr6GmePsgifcfLjVj4o7y7pCu+GpWX+iId0 0Ngg== X-Received: by 10.180.73.6 with SMTP id h6mr6619608wiv.1.1384505305383; Fri, 15 Nov 2013 00:48:25 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id qc10sm2856890wic.9.2013.11.15.00.48.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2013 00:48:24 -0800 (PST) From: Dmitry Eremin-Solenikov To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org Subject: [PATCH 5/9] ARM: sa1100: add platform functions to handle PWER settings Date: Fri, 15 Nov 2013 12:47:56 +0400 Message-Id: <1384505280-25389-6-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1384505280-25389-1-git-send-email-dbaryshkov@gmail.com> References: <1384505280-25389-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131115_034844_539479_8847FEB5 X-CRM114-Status: GOOD ( 12.47 ) X-Spam-Score: 0.5 (/) Cc: Linus Walleij , Russell King , Dmitry Artamonow 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=-1.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SUSPICIOUS_RECIPS, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no 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 PWER settings logically belongs neither to GPIO nor to system IRQ code. Add special functions to handle PWER (for GPIO and for system IRQs) from platform code. Signed-off-by: Dmitry Eremin-Solenikov --- arch/arm/mach-sa1100/generic.c | 21 +++++++++++++++++++++ arch/arm/mach-sa1100/generic.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index c2718f0..702f18c 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c @@ -421,3 +421,24 @@ void sa1110_mb_enable(void) local_irq_restore(flags); } +int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on) +{ + if (on) + PWER |= 1 << gpio; + else + PWER &= ~(1 << gpio); + + return 0; +} + +int sa11x0_sc_set_wake(unsigned int irq, unsigned int on) +{ + if (irq != IRQ_RTCAlrm) + return -EINVAL; + + if (on) + PWER |= PWER_RTC; + else + PWER &= ~PWER_RTC; + return 0; +} diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h index 0b68b95..39753c4 100644 --- a/arch/arm/mach-sa1100/generic.h +++ b/arch/arm/mach-sa1100/generic.h @@ -11,6 +11,8 @@ extern void __init sa1100_map_io(void); extern void __init sa1100_init_irq(void); extern void sa11x0_restart(enum reboot_mode, const char *); extern void sa11x0_init_late(void); +extern int sa11x0_gpio_set_wake(unsigned int gpio, unsigned int on); +extern int sa11x0_sc_set_wake(unsigned int irq, unsigned int on); #define SET_BANK(__nr,__start,__size) \ mi->bank[__nr].start = (__start), \