From patchwork Sun Dec 15 04:28:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 3349931 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 A46F19F314 for ; Sun, 15 Dec 2013 04:31:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D289D200EC for ; Sun, 15 Dec 2013 04:31:05 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD1D7200EB for ; Sun, 15 Dec 2013 04:31:04 +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 1Vs3Kx-0005H9-HG; Sun, 15 Dec 2013 04:29:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vs3Kf-0001jT-VY; Sun, 15 Dec 2013 04:29:34 +0000 Received: from mail-ee0-x235.google.com ([2a00:1450:4013:c00::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vs3K2-0001eI-Tw for linux-arm-kernel@lists.infradead.org; Sun, 15 Dec 2013 04:28:56 +0000 Received: by mail-ee0-f53.google.com with SMTP id b57so1568773eek.12 for ; Sat, 14 Dec 2013 20:28:33 -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=ICETtka+GTl22lgp8iwsYcY+paJRBClAA5NH+RSVH/A=; b=SD08ULRvfOQfC4iR8mDVmvfPCkWTz/eF7BuLR1F4Zn2rn3lxEgAp5jZc2KcCKbTyCG jwNrzTUHsIC603qJ9CJPErzG67311Ch7w1wyWec+RRmRsuSBhddEDi+oDkzHU5T7fBKX WWbCdB+svn0cGimUdcIGbQSjCvSXsXaekHQtmnt+AUj598bgo8SljXnS97aa/Q2mXYlX 3YiP1EBDshpDfGoRHMHLrOPQlYR8m41viZKxlkvkn3J4UyTSTipLf9T61CYYCGBR2m2p uFjQ2DGMteHdDLtTIOgTzOZSvoNb0njNhEVi0xTmRMpgLmqdbt833tyJNbISKDwltcQ0 FAVA== X-Received: by 10.14.101.4 with SMTP id a4mr10158908eeg.28.1387081713112; Sat, 14 Dec 2013 20:28:33 -0800 (PST) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id n1sm25702696eep.20.2013.12.14.20.28.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 14 Dec 2013 20:28:32 -0800 (PST) From: Dmitry Eremin-Solenikov To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 03/10] ARM: sa1100: add platform functions to handle PWER settings Date: Sun, 15 Dec 2013 08:28:10 +0400 Message-Id: <1387081697-21841-4-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1387081697-21841-1-git-send-email-dbaryshkov@gmail.com> References: <1387081697-21841-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131214_232855_144788_A8223AC5 X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: -2.0 (--) 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=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 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 d4ea142..002fe6b 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c @@ -410,3 +410,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 0d92e11..a002b95 100644 --- a/arch/arm/mach-sa1100/generic.h +++ b/arch/arm/mach-sa1100/generic.h @@ -12,6 +12,8 @@ extern void __init sa1100_init_irq(void); extern void __init sa1100_init_gpio(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), \