From patchwork Thu Feb 2 14:45:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 9552095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 47891604A7 for ; Thu, 2 Feb 2017 14:53:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A88F27DF9 for ; Thu, 2 Feb 2017 14:53:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F7D828477; Thu, 2 Feb 2017 14:53:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DED5F27DF9 for ; Thu, 2 Feb 2017 14:53:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cZIlT-0005lS-5w; Thu, 02 Feb 2017 14:53:35 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cZIeJ-0000sb-GW for linux-arm-kernel@lists.infradead.org; Thu, 02 Feb 2017 14:46:26 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id C8A2C20E9A; Thu, 2 Feb 2017 15:45:28 +0100 (CET) Received: from localhost (unknown [88.191.26.124]) by mail.free-electrons.com (Postfix) with ESMTPSA id A30F820C37; Thu, 2 Feb 2017 15:45:28 +0100 (CET) From: Alexandre Belloni To: Nicolas Ferre Subject: [PATCH 12/13] ARM: at91: pm: use C functions for standby Date: Thu, 2 Feb 2017 15:45:22 +0100 Message-Id: <20170202144523.11706-13-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170202144523.11706-1-alexandre.belloni@free-electrons.com> References: <20170202144523.11706-1-alexandre.belloni@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170202_064612_501373_C0F47C53 X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Ludovic Desroches , Alexandre Belloni , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When going to standby, there is no point calling the assembly function at91_pm_suspend_in_sram(). It does exactly the same operations as the C standby functions. This allows to remove a few loads and tests in the suspend/resume path. Signed-off-by: Alexandre Belloni --- arch/arm/mach-at91/pm.c | 8 +++++--- arch/arm/mach-at91/pm.h | 4 +--- arch/arm/mach-at91/pm_data-offsets.c | 1 - arch/arm/mach-at91/pm_suspend.S | 14 -------------- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 553bcfc5545e..1992ad8b1c3d 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -125,12 +125,13 @@ extern u32 at91_pm_suspend_in_sram_sz; static void at91_pm_suspend(suspend_state_t state) { - pm_data.mode = (state == PM_SUSPEND_MEM) ? AT91_PM_SLOW_CLOCK : 0; - flush_cache_all(); outer_disable(); - at91_suspend_sram_fn(&pm_data); + if (state == PM_SUSPEND_MEM) + at91_suspend_sram_fn(&pm_data); + else + pm_data.standby(); outer_resume(); } @@ -342,6 +343,7 @@ static __init void at91_dt_ramc(void) ramc = of_id->data; if (!standby) standby = ramc->standby; + pm_data.standby = standby; pm_data.memctrl = ramc->memctrl; idx++; diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index fc0f7d048187..2317e39248b7 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h @@ -21,15 +21,13 @@ #define AT91_MEMCTRL_SDRAMC 1 #define AT91_MEMCTRL_DDRSDR 2 -#define AT91_PM_SLOW_CLOCK 0x01 - #ifndef __ASSEMBLY__ struct at91_pm_data { void __iomem *pmc; void __iomem *ramc[2]; unsigned long uhp_udp_mask; unsigned int memctrl; - unsigned int mode; + void (*standby)(void); }; #endif diff --git a/arch/arm/mach-at91/pm_data-offsets.c b/arch/arm/mach-at91/pm_data-offsets.c index 30302cb16df0..c4e6d648644f 100644 --- a/arch/arm/mach-at91/pm_data-offsets.c +++ b/arch/arm/mach-at91/pm_data-offsets.c @@ -8,6 +8,5 @@ int main(void) DEFINE(PM_DATA_RAMC0, offsetof(struct at91_pm_data, ramc[0])); DEFINE(PM_DATA_RAMC1, offsetof(struct at91_pm_data, ramc[1])); DEFINE(PM_DATA_MEMCTRL, offsetof(struct at91_pm_data, memctrl)); - DEFINE(PM_DATA_MODE, offsetof(struct at91_pm_data, mode)); return 0; } diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index 3ee282c051e0..a8b32faaea5b 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -94,10 +94,6 @@ ENTRY(at91_pm_suspend_in_sram) mov r0, #SRAMC_SELF_FRESH_ACTIVE bl at91_sramc_self_refresh - ldr r0, [pm_data, #PM_DATA_MODE] - tst r0, #AT91_PM_SLOW_CLOCK - beq skip_disable_main_clock - ldr pmc, [pm_data, #PM_DATA_PMC] /* Save Master clock setting */ @@ -126,18 +122,9 @@ ENTRY(at91_pm_suspend_in_sram) orr tmp1, tmp1, #AT91_PMC_KEY str tmp1, [pmc, #AT91_CKGR_MOR] -skip_disable_main_clock: - ldr pmc, [pm_data, #PM_DATA_PMC] - /* Wait for interrupt */ at91_cpu_idle - ldr r0, [pm_data, #PM_DATA_MODE] - tst r0, #AT91_PM_SLOW_CLOCK - beq skip_enable_main_clock - - ldr pmc, [pm_data, #PM_DATA_PMC] - /* Turn on the main oscillator */ ldr tmp1, [pmc, #AT91_CKGR_MOR] orr tmp1, tmp1, #AT91_PMC_MOSCEN @@ -166,7 +153,6 @@ skip_disable_main_clock: wait_mckrdy -skip_enable_main_clock: /* Exit the self-refresh mode */ mov r0, #SRAMC_SELF_FRESH_EXIT bl at91_sramc_self_refresh