From patchwork Tue Jul 17 08:26:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10528361 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 580D26020A for ; Tue, 17 Jul 2018 08:28:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5022728AA2 for ; Tue, 17 Jul 2018 08:28:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43A3C28B7C; Tue, 17 Jul 2018 08:28:11 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 DC9D128AA2 for ; Tue, 17 Jul 2018 08:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jjCcB3gniUhkHXMvXxihqk0aR94oLLdQXioTcTqGYVs=; b=a6ByU5KXHFAHfr dDguyZt9DlLY961Uuff55C+HqMXT182Tk8rQVsDFLr+GI8BfSz34iNX+9TdHmbzem1qJyU6yBy5bg xvhjhSK0PqKJ53GP0D+8gslbuUl4POXzic1SJ/u5nwLGpVrEW8wOysJzfSCJRWsTJlWH7x6w7wpoY Q6xxVYqVNXJeNhKlnIULm5EQZDoIM07ECrypqRajinVjaMG7Dm3L765UHZX25rotlC6k30jL85N1v LbABVFWOovlAVM7wrZXPjAkQoPQLe3Mld1TJV4cu2oLXKMrJn8XKZu6BFqbyPIoJkuTGiptDxtqx7 wtjDY6GV9CV5G+x8vd/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffLL5-0007rZ-GY; Tue, 17 Jul 2018 08:28:07 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffLKR-00070N-99 for linux-arm-kernel@lists.infradead.org; Tue, 17 Jul 2018 08:27:29 +0000 X-IronPort-AV: E=Sophos;i="5.51,365,1526367600"; d="scan'208";a="16320157" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Jul 2018 01:27:15 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Tue, 17 Jul 2018 01:27:14 -0700 From: Claudiu Beznea To: , , , , Subject: [PATCH 1/4] ARM: at91: pm: Use ULP0 naming instead of slow clock Date: Tue, 17 Jul 2018 11:26:54 +0300 Message-ID: <1531816017-31986-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531816017-31986-1-git-send-email-claudiu.beznea@microchip.com> References: <1531816017-31986-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180717_012727_376696_01022F23 X-CRM114-Status: GOOD ( 12.35 ) 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: Claudiu Beznea , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org 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 Switch to use ULP0 naming instead of slow clock naming for power modes, to be as closed as possible to datasheet. This commit does the necessary renaming and macro addition to be as close as possible to the namings from [1]. [1] https://lore.kernel.org/lkml/1470650705-31418-3-git-send-email-wenyou.yang@atmel.com Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 18 +++++++++--------- arch/arm/mach-at91/pm.h | 3 ++- arch/arm/mach-at91/pm_suspend.S | 12 ++++++------ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 849014c01cf4..d43f00a715d7 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -40,15 +40,15 @@ extern void at91_pinctrl_gpio_resume(void); #endif static const match_table_t pm_modes __initconst = { - { 0, "standby" }, - { AT91_PM_SLOW_CLOCK, "ulp0" }, + { AT91_PM_STANDBY, "standby" }, + { AT91_PM_ULP0, "ulp0" }, { AT91_PM_BACKUP, "backup" }, { -1, NULL }, }; static struct at91_pm_data pm_data = { - .standby_mode = 0, - .suspend_mode = AT91_PM_SLOW_CLOCK, + .standby_mode = AT91_PM_STANDBY, + .suspend_mode = AT91_PM_ULP0, }; #define at91_ramc_read(id, field) \ @@ -145,7 +145,7 @@ static int at91_pm_verify_clocks(void) */ int at91_suspend_entering_slow_clock(void) { - return (pm_data.mode >= AT91_PM_SLOW_CLOCK); + return (pm_data.mode >= AT91_PM_ULP0); } EXPORT_SYMBOL(at91_suspend_entering_slow_clock); @@ -186,7 +186,7 @@ static void at91_pm_suspend(suspend_state_t state) * event sources; and reduces DRAM power. But otherwise it's identical to * PM_SUSPEND_ON: cpu idle, and nothing fancy done with main or cpu clocks. * - * AT91_PM_SLOW_CLOCK is like STANDBY plus slow clock mode, so drivers must + * AT91_PM_ULP0 is like STANDBY plus slow clock mode, so drivers must * suspend more deeply, the master clock switches to the clk32k and turns off * the main oscillator * @@ -204,7 +204,7 @@ static int at91_pm_enter(suspend_state_t state) /* * Ensure that clocks are in a valid state. */ - if ((pm_data.mode >= AT91_PM_SLOW_CLOCK) && + if (pm_data.mode >= AT91_PM_ULP0 && !at91_pm_verify_clocks()) goto error; @@ -546,9 +546,9 @@ static void __init at91_pm_backup_init(void) pm_data.sfrbu = NULL; if (pm_data.standby_mode == AT91_PM_BACKUP) - pm_data.standby_mode = AT91_PM_SLOW_CLOCK; + pm_data.standby_mode = AT91_PM_ULP0; if (pm_data.suspend_mode == AT91_PM_BACKUP) - pm_data.suspend_mode = AT91_PM_SLOW_CLOCK; + pm_data.suspend_mode = AT91_PM_ULP0; } struct pmc_info { diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index f95d31496f08..c44eaf17db86 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h @@ -21,7 +21,8 @@ #define AT91_MEMCTRL_SDRAMC 1 #define AT91_MEMCTRL_DDRSDR 2 -#define AT91_PM_SLOW_CLOCK 0x01 +#define AT91_PM_STANDBY 0x00 +#define AT91_PM_ULP0 0x01 #define AT91_PM_BACKUP 0x02 #ifndef __ASSEMBLY__ diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index daca91feea6a..821322d1a64d 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -112,8 +112,8 @@ ENTRY(at91_pm_suspend_in_sram) bl at91_sramc_self_refresh ldr r0, .pm_mode - cmp r0, #AT91_PM_SLOW_CLOCK - beq slow_clock + cmp r0, #AT91_PM_ULP0 + beq ulp0_mode cmp r0, #AT91_PM_BACKUP beq backup_mode @@ -122,8 +122,8 @@ ENTRY(at91_pm_suspend_in_sram) at91_cpu_idle b exit_suspend -slow_clock: - bl at91_slowck_mode +ulp0_mode: + bl at91_ulp0_mode b exit_suspend backup_mode: bl at91_backup_mode @@ -151,7 +151,7 @@ ENTRY(at91_backup_mode) str tmp1, [r0, #0] ENDPROC(at91_backup_mode) -ENTRY(at91_slowck_mode) +ENTRY(at91_ulp0_mode) ldr pmc, .pmc_base /* Save Master clock setting */ @@ -212,7 +212,7 @@ ENTRY(at91_slowck_mode) wait_mckrdy mov pc, lr -ENDPROC(at91_slowck_mode) +ENDPROC(at91_ulp0_mode) /* * void at91_sramc_self_refresh(unsigned int is_active)