From patchwork Thu Aug 30 11:50:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10581607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6C0E5A4 for ; Thu, 30 Aug 2018 11:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B530C2B37D for ; Thu, 30 Aug 2018 11:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A79B32B60E; Thu, 30 Aug 2018 11:56:25 +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,RCVD_IN_DNSWL_NONE 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 217AC2B37D for ; Thu, 30 Aug 2018 11:56:25 +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=K23fMeNC4nh/D6AxMgaCRVAhuVSuaz56dbvu3Z5l37I=; b=BcZ+HxjeJ2ogjj oIlIYtTnqHRILcAGWbrGlshyq6+Pei3bh32t8R+nim8JfARCTfm3J0UjHKvJGgBhjmcQugUMRQh8A PaLR4Z3/ojg/wJ7CL3s+o2zwogbhbHig+07Ja5sJVye1dlohwVPVEKMgJjIrggXdm8mFNAHU2tRtI mkfvXJa+ogMtQUitn5yalCQtrI9diEIJmT1mtmbhQV+4jGxnQPi79WYotjdqpDRgW/IIZSxrXttNk gqS0+MJRjvbMNh3W6sxrFGQAaJcQ9mM2Swx4FlE9RDySmnsevJRCd2M6U4/PkCtpWwj27UCuVLYnw ba/CgNNSBZMPpvWAszqQ==; 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 1fvLYg-0006u4-67; Thu, 30 Aug 2018 11:56:18 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTG-0003IO-20 for linux-arm-kernel@lists.infradead.org; Thu, 30 Aug 2018 11:51:19 +0000 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="19080214" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 04:50:30 -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; Thu, 30 Aug 2018 04:50:29 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH 1/6] power: reset: at91-poweroff: switch to slow clock before shutdown Date: Thu, 30 Aug 2018 14:50:06 +0300 Message-ID: <1535629811-13403-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535629811-13403-1-git-send-email-claudiu.beznea@microchip.com> References: <1535629811-13403-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-20180830_045042_249739_A1F7D75E X-CRM114-Status: GOOD ( 15.73 ) 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-pm@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 The SAMA5D2 NRST input signal is resynchronized with the SLCK clock and it can take up to 2 SLCK cycles (about 90us) for the internal reset to be effective. During this delay, the VDDCORE current consumption may still be high (application-dependent) with the VDDCORE regulator already OFF. Under such conditions, VDDCORE may operate below its operating range leading to potential register corruption. To prevent such situation, it is recommended to decrease significantly the power consumption of the device once the voltage regulator is turned-off. This can be achieved by operating the device at a much lower low frequency. To solve this switch the master clock to slock clock just before writing shutdown command to shutdown controller. Signed-off-by: Claudiu Beznea Suggested-by: Patrice Vilchez --- arch/arm/mach-at91/pm_suspend.S | 8 ++++ drivers/power/reset/at91-sama5d2_shdwc.c | 66 ++++++++++++++++++++++++++++---- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index a7c6ae13c945..bfe1c4d06901 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -149,6 +149,14 @@ exit_suspend: ENDPROC(at91_pm_suspend_in_sram) ENTRY(at91_backup_mode) + /* Switch the master clock source to slow clock. */ + ldr pmc, .pmc_base + ldr tmp1, [pmc, #AT91_PMC_MCKR] + bic tmp1, tmp1, #AT91_PMC_CSS + str tmp1, [pmc, #AT91_PMC_MCKR] + + wait_mckrdy + /*BUMEN*/ ldr r0, .sfr mov tmp1, #0x1 diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index 0206cce328b3..dd6297bd7b6a 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -70,6 +71,7 @@ struct shdwc_config { struct shdwc { const struct shdwc_config *cfg; void __iomem *at91_shdwc_base; + void __iomem *pmc_base; }; /* @@ -108,6 +110,12 @@ static void __init at91_wakeup_status(struct platform_device *pdev) static void at91_poweroff(void) { + /* Switch the master clock source to slow clock. */ + writel(readl(at91_shdwc->pmc_base + AT91_PMC_MCKR) & ~AT91_PMC_CSS, + at91_shdwc->pmc_base + AT91_PMC_MCKR); + while (!(readl(at91_shdwc->pmc_base + AT91_PMC_SR) & AT91_PMC_MCKRDY)) + ; + writel(AT91_SHDW_KEY | AT91_SHDW_SHDW, at91_shdwc->at91_shdwc_base + AT91_SHDW_CR); } @@ -123,6 +131,16 @@ static void at91_lpddr_poweroff(void) /* Power down SDRAM0 */ " str %1, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t" + + /* Switch the master clock source to slow clock. */ + " ldr r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t" + " bic r6, r6, #" __stringify(AT91_PMC_CSS) "\n\t" + " str r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t" + /* Wait for clock switch. */ + "1: ldr r6, [%4, #" __stringify(AT91_PMC_SR) "]\n\t" + " tst r6, #" __stringify(AT91_PMC_MCKRDY) "\n\t" + " beq 1b\n\t" + /* Shutdown CPU */ " str %3, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" @@ -131,7 +149,8 @@ static void at91_lpddr_poweroff(void) : "r" (mpddrc_base), "r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF), "r" (at91_shdwc->at91_shdwc_base), - "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW) + "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW), + "r" (at91_shdwc->pmc_base) : "r6"); } @@ -276,26 +295,53 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) at91_shdwc_dt_configure(pdev); - pm_power_off = at91_poweroff; + np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-pmc"); + if (!np) { + ret = -ENODEV; + goto clk_disable; + } + + at91_shdwc->pmc_base = of_iomap(np, 0); + of_node_put(np); + + if (!at91_shdwc->pmc_base) { + ret = -ENOMEM; + goto clk_disable; + } np = of_find_compatible_node(NULL, NULL, "atmel,sama5d3-ddramc"); - if (!np) - return 0; + if (!np) { + ret = -ENODEV; + goto unmap; + } mpddrc_base = of_iomap(np, 0); of_node_put(np); - if (!mpddrc_base) - return 0; + if (!mpddrc_base) { + ret = -ENOMEM; + goto unmap; + } + + pm_power_off = at91_poweroff; ddr_type = readl(mpddrc_base + AT91_DDRSDRC_MDR) & AT91_DDRSDRC_MD; if ((ddr_type == AT91_DDRSDRC_MD_LPDDR2) || - (ddr_type == AT91_DDRSDRC_MD_LPDDR3)) + (ddr_type == AT91_DDRSDRC_MD_LPDDR3)) { pm_power_off = at91_lpddr_poweroff; - else + } else { iounmap(mpddrc_base); + mpddrc_base = NULL; + } return 0; + +unmap: + iounmap(at91_shdwc->pmc_base); +clk_disable: + clk_disable_unprepare(sclk); + + return ret; } static int __exit at91_shdwc_remove(struct platform_device *pdev) @@ -310,6 +356,10 @@ static int __exit at91_shdwc_remove(struct platform_device *pdev) writel(0, shdw->at91_shdwc_base + AT91_SHDW_MR); writel(0, shdw->at91_shdwc_base + AT91_SHDW_WUIR); + if (mpddrc_base) + iounmap(mpddrc_base); + iounmap(shdw->pmc_base); + clk_disable_unprepare(sclk); return 0; From patchwork Thu Aug 30 11:50:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10581599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 199EE920 for ; Thu, 30 Aug 2018 11:53:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05CCE2B2C7 for ; Thu, 30 Aug 2018 11:53:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA9BB2B37D; Thu, 30 Aug 2018 11:53: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,RCVD_IN_DNSWL_NONE 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 785A52B2C7 for ; Thu, 30 Aug 2018 11:53:11 +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=0kyTTSgruXSjPAGVXupBjoYu2VCQJDo4vcCGt/pN/v8=; b=nqEiG1XXOTpXdl f3Zndpr+XbWcsTwLDNopmCt+OdS+oMyEdvfE/7RDmt/oxoSXfP0TzMytEzFnzPkxKMcdnSFEcKA9m LWE2XwDLyhO/rKH0K2+fT5VV3v1b2PAlZcCVLjirz2VxUbkfztZig238Y+dKxcM7tTV46pRTHbPEd qM/X247lcYNu8EVdPMl11uNRUgeAPb7t3sAHBJewkEccgHUzS1Ofn4aEM0ZuEbVlveN554A7Rpl7o nEZ0/qikO3cLcCwIW4KzCqqaBtLU+uX+SuEq6QuRjAbh/U+wJ2YNIwSwjVp///hDVanBmKG6YZk/0 G0++Wq67ZdhKNrc9PfrA==; 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 1fvLVV-0004EJ-Sz; Thu, 30 Aug 2018 11:53:01 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTQ-0003RI-La for linux-arm-kernel@bombadil.infradead.org; Thu, 30 Aug 2018 11:50:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uQ6CViW2fwy3GnTw3JBs73aa04LdnE2Eqd1ILMVhnFU=; b=Q2oJYYTxXf8Ze9pCMcaLbJidb WGolDpBnVB3agT0WkfMIaTR+LhzgUhmQFywkrnDBq3C1L8SPTm70w1xUL5QFYH9AYW5oL6GtFtaIk ESUdNDbn6PprE1hzDN08vfBb7HfPzDbLuiPhiCywjJEQ9ZbBaP/dBCkJMa/GVJxux1XTnwVNox1Mb DfhoqbQscQCT+CY8TG509xoB/vKj7LgQPDqrwe+UzKb1V+5k8qafTjVtCRAko7qWLoCxnAzsovZtD tZ/2bIngrZvtfjWHuxLbo6mMp7j0LZ4BpruLmLVug2PUE6Zrw/gWD2eLr2sZR+/bHYOpQ0oC9Ao4a QNq48eLhA==; Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTN-0008Qq-LX for linux-arm-kernel@lists.infradead.org; Thu, 30 Aug 2018 11:50:50 +0000 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="19080216" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 04:50:33 -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; Thu, 30 Aug 2018 04:50:32 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH 2/6] power: reset: at91-poweroff: use only one poweroff function Date: Thu, 30 Aug 2018 14:50:07 +0300 Message-ID: <1535629811-13403-3-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535629811-13403-1-git-send-email-claudiu.beznea@microchip.com> References: <1535629811-13403-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-20180830_075049_879475_9CA2C81B X-CRM114-Status: GOOD ( 11.50 ) 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-pm@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 Use only one poweroff function for sama5d2 and adapt it to work for both scenarios (having LPDDR or not). Signed-off-by: Claudiu Beznea --- drivers/power/reset/at91-sama5d2_shdwc.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index dd6297bd7b6a..94ad79d0d82e 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -110,18 +110,6 @@ static void __init at91_wakeup_status(struct platform_device *pdev) static void at91_poweroff(void) { - /* Switch the master clock source to slow clock. */ - writel(readl(at91_shdwc->pmc_base + AT91_PMC_MCKR) & ~AT91_PMC_CSS, - at91_shdwc->pmc_base + AT91_PMC_MCKR); - while (!(readl(at91_shdwc->pmc_base + AT91_PMC_SR) & AT91_PMC_MCKRDY)) - ; - - writel(AT91_SHDW_KEY | AT91_SHDW_SHDW, - at91_shdwc->at91_shdwc_base + AT91_SHDW_CR); -} - -static void at91_lpddr_poweroff(void) -{ asm volatile( /* Align to cache lines */ ".balign 32\n\t" @@ -130,16 +118,18 @@ static void at91_lpddr_poweroff(void) " ldr r6, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" /* Power down SDRAM0 */ + " tst %0, #0\n\t" + " beq 1f\n\t" " str %1, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t" /* Switch the master clock source to slow clock. */ - " ldr r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t" + "1: ldr r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t" " bic r6, r6, #" __stringify(AT91_PMC_CSS) "\n\t" " str r6, [%4, #" __stringify(AT91_PMC_MCKR) "]\n\t" /* Wait for clock switch. */ - "1: ldr r6, [%4, #" __stringify(AT91_PMC_SR) "]\n\t" + "2: ldr r6, [%4, #" __stringify(AT91_PMC_SR) "]\n\t" " tst r6, #" __stringify(AT91_PMC_MCKRDY) "\n\t" - " beq 1b\n\t" + " beq 2b\n\t" /* Shutdown CPU */ " str %3, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t" @@ -326,10 +316,8 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) pm_power_off = at91_poweroff; ddr_type = readl(mpddrc_base + AT91_DDRSDRC_MDR) & AT91_DDRSDRC_MD; - if ((ddr_type == AT91_DDRSDRC_MD_LPDDR2) || - (ddr_type == AT91_DDRSDRC_MD_LPDDR3)) { - pm_power_off = at91_lpddr_poweroff; - } else { + if (ddr_type != AT91_DDRSDRC_MD_LPDDR2 && + ddr_type != AT91_DDRSDRC_MD_LPDDR3) { iounmap(mpddrc_base); mpddrc_base = NULL; } @@ -348,8 +336,7 @@ static int __exit at91_shdwc_remove(struct platform_device *pdev) { struct shdwc *shdw = platform_get_drvdata(pdev); - if (pm_power_off == at91_poweroff || - pm_power_off == at91_lpddr_poweroff) + if (pm_power_off == at91_poweroff) pm_power_off = NULL; /* Reset values to disable wake-up features */ From patchwork Thu Aug 30 11:50:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10581597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15737920 for ; Thu, 30 Aug 2018 11:52:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 049CF2AF9E for ; Thu, 30 Aug 2018 11:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECA022AFA4; Thu, 30 Aug 2018 11:52:29 +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,RCVD_IN_DNSWL_NONE 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 65ECF2AF9E for ; Thu, 30 Aug 2018 11:52:29 +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=ltJUYG77IZHfcZK93L6LQo9kQPPg9uvT6Thqx/04NMU=; b=AMOvHgkdHr8RSm OjNzVkhV//W818Sscd2pguqt90Wtbe0zCRpUuUw2mlngeactIO6EKYtRcuZhj/V4UbKjlA+OzAblv 8zYjPQ9Opvbu58Ze4YxjTzGOXBWUWBOzgIMYJDdexdaSobiyMMDlmoCynH6CPcW4m1dG28y2ELPja tcbJSU4MRDwOoBTsjYPMPeEdshkowPvSmfm5hKZlfxOYBYAfPGgReyvBsrHF/mPxRQ0DRRE4fId4s z9p9Si6Xt/ub9/n2zO+7csNYWzunD+RxGvziDVuucRlxHlv6IAC1o3udxk5dUmlSuFSVabX+Fx2om ZafHz7ENpsnUiyyC5fjA==; 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 1fvLUr-0003wZ-19; Thu, 30 Aug 2018 11:52:21 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTR-0003Rm-8s for linux-arm-kernel@bombadil.infradead.org; Thu, 30 Aug 2018 11:50:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kUQCkcXyRoAsrcUHX+qDEhnhmNdNoFHhssuZN3jXSmA=; b=sMh/hZnpibQveFdG9D3/0/rS5 UmZhUqrdiwrwgUMsHZBf0ZYWZzknPFL0/rJyQ2qd+e0xRzKMjjzrxfg7opNa/h9zWYPjJwhzYmCxA wFyvwdzSZyTLHfKDlfw20dHMNABPuDfBhBTgokcyBYDPr/xwdCGpRjva/aK9k4/949LBAMRFjkc8D HtBRTXVcVY0KGJvlBHyehpCpATDzNC6YDhXD5m8n6q28mKKytFXyQ4YdLygrkh2z+bgwe6XaMGytF NclTT5BaBWQgKHfIkLOJ12yrOLtz5CL7V3EKqpmZzZzuHUA6v1Yl1135xIAH1FvQ9ULSvi7tbnj54 +edjS9b1g==; Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTO-0008Qw-Mh for linux-arm-kernel@lists.infradead.org; Thu, 30 Aug 2018 11:50:51 +0000 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="19080218" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 04:50:36 -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; Thu, 30 Aug 2018 04:50:35 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH 3/6] power: reset: at91-poweroff: make mpddrc_base part of struct shdwc Date: Thu, 30 Aug 2018 14:50:08 +0300 Message-ID: <1535629811-13403-4-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535629811-13403-1-git-send-email-claudiu.beznea@microchip.com> References: <1535629811-13403-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-20180830_075050_887634_E96182DB X-CRM114-Status: GOOD ( 12.58 ) 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-pm@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 Make mpddrc_base part of struct shdwc since there is also only one instance of struct shdwc *at91_shdwc in system and to have all data specific to SHDWC grouped together. Signed-off-by: Claudiu Beznea --- drivers/power/reset/at91-sama5d2_shdwc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index 94ad79d0d82e..c9994103248e 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -71,6 +71,7 @@ struct shdwc_config { struct shdwc { const struct shdwc_config *cfg; void __iomem *at91_shdwc_base; + void __iomem *mpddrc_base; void __iomem *pmc_base; }; @@ -80,7 +81,6 @@ struct shdwc { */ static struct shdwc *at91_shdwc; static struct clk *sclk; -static void __iomem *mpddrc_base; static const unsigned long long sdwc_dbc_period[] = { 0, 3, 32, 512, 4096, 32768, @@ -136,7 +136,7 @@ static void at91_poweroff(void) " b .\n\t" : - : "r" (mpddrc_base), + : "r" (at91_shdwc->mpddrc_base), "r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF), "r" (at91_shdwc->at91_shdwc_base), "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW), @@ -305,21 +305,22 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) goto unmap; } - mpddrc_base = of_iomap(np, 0); + at91_shdwc->mpddrc_base = of_iomap(np, 0); of_node_put(np); - if (!mpddrc_base) { + if (!at91_shdwc->mpddrc_base) { ret = -ENOMEM; goto unmap; } pm_power_off = at91_poweroff; - ddr_type = readl(mpddrc_base + AT91_DDRSDRC_MDR) & AT91_DDRSDRC_MD; + ddr_type = readl(at91_shdwc->mpddrc_base + AT91_DDRSDRC_MDR) & + AT91_DDRSDRC_MD; if (ddr_type != AT91_DDRSDRC_MD_LPDDR2 && ddr_type != AT91_DDRSDRC_MD_LPDDR3) { - iounmap(mpddrc_base); - mpddrc_base = NULL; + iounmap(at91_shdwc->mpddrc_base); + at91_shdwc->mpddrc_base = NULL; } return 0; @@ -343,8 +344,8 @@ static int __exit at91_shdwc_remove(struct platform_device *pdev) writel(0, shdw->at91_shdwc_base + AT91_SHDW_MR); writel(0, shdw->at91_shdwc_base + AT91_SHDW_WUIR); - if (mpddrc_base) - iounmap(mpddrc_base); + if (shdw->mpddrc_base) + iounmap(shdw->mpddrc_base); iounmap(shdw->pmc_base); clk_disable_unprepare(sclk); From patchwork Thu Aug 30 11:50:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10581603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 964E95A4 for ; Thu, 30 Aug 2018 11:54:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 855562B5D1 for ; Thu, 30 Aug 2018 11:54:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78A7B2B612; Thu, 30 Aug 2018 11:54:44 +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,RCVD_IN_DNSWL_NONE autolearn=ham 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 CF88C2B5D1 for ; Thu, 30 Aug 2018 11:54:43 +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=OwqyMLIc3aSRAsPyWItrYKWsjEphx9sG8ONDScccbGc=; b=IyA3dqZ7yqossl vqpIxqNPoRw0OX6QG9F4YY3nj/nsObufPbhQDrcxKx+rp10OngLiRdsrRbcOjJGBHL0Mhi2EeSynW DGzXtn3QH3+TF80yyogjYFFC8Mrx0MVoICJez07R73YvxP1B4qpwbXMdC3zT5JL6vBxWcP4HLpbit 4iQsa4NEvs5d5wHY0oGU9ciW6Y1FRYnovdE2icmAsnv+OST3QRjCp4hlfpNvQJCBiyBaVKjM5h7CR XCpgS+fr/4LiffMo0446cxCew73kYKMITHYI1KbckiNIm1AkkrWhbtvMYj5GfT6Y2bJMekFcMb7k+ 8W6+15hszDaVQKDJK/sQ==; 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 1fvLWt-0004vN-Jh; Thu, 30 Aug 2018 11:54:27 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTS-0003Rm-PI for linux-arm-kernel@bombadil.infradead.org; Thu, 30 Aug 2018 11:50:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4n2Szb4mtDXHuCL+cbNgCIQEndOgXLIl5up3rtkHccs=; b=h9X67IlNyuWd+fsnfIAvFhZAd KH3F/mfzyCOVrbiiNUyNFdRTe5upC06C+a4CULaxHOYov93Y1cMfkWrsGQzONBilLBlYIQwExzXES ekL+1HYXrUBFwiQkVUhx3hinOLbPq2acpOY4VI+qTz5U9FKyObyp/pjsSrJ78U/nuP90GjBIVJf2t cZVGVcFl+K15mLar7FKX6vC5bBuKvbjkzAvVCThwO/r+bPFgsBj84MWHtyezwAu7huyBXatGk6tzZ nWWSRwz0PLs3hWjDgHVaXBHVSG0FofZhHtirWLHRCvWCGkptSJhmOP+7MbqGjTigaSjVAo7t3gprJ Orm5YOmbw==; Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTQ-0008R2-7M for linux-arm-kernel@lists.infradead.org; Thu, 30 Aug 2018 11:50:52 +0000 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="18692641" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 04:50:39 -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; Thu, 30 Aug 2018 04:50:39 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH 4/6] power: reset: at91-poweroff: make sclk part of struct shdwc Date: Thu, 30 Aug 2018 14:50:09 +0300 Message-ID: <1535629811-13403-5-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535629811-13403-1-git-send-email-claudiu.beznea@microchip.com> References: <1535629811-13403-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-20180830_075052_434493_0F03C52E X-CRM114-Status: GOOD ( 12.22 ) 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-pm@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 Make sclk part of struct shdwc to have all the data specific to SHDWC grouped together in one structure. Signed-off-by: Claudiu Beznea --- drivers/power/reset/at91-sama5d2_shdwc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index c9994103248e..945b41b4086a 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -70,6 +70,7 @@ struct shdwc_config { struct shdwc { const struct shdwc_config *cfg; + struct clk *sclk; void __iomem *at91_shdwc_base; void __iomem *mpddrc_base; void __iomem *pmc_base; @@ -80,7 +81,6 @@ struct shdwc { * since pm_power_off itself is global. */ static struct shdwc *at91_shdwc; -static struct clk *sclk; static const unsigned long long sdwc_dbc_period[] = { 0, 3, 32, 512, 4096, 32768, @@ -271,11 +271,11 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node); at91_shdwc->cfg = match->data; - sclk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(sclk)) - return PTR_ERR(sclk); + at91_shdwc->sclk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(at91_shdwc->sclk)) + return PTR_ERR(at91_shdwc->sclk); - ret = clk_prepare_enable(sclk); + ret = clk_prepare_enable(at91_shdwc->sclk); if (ret) { dev_err(&pdev->dev, "Could not enable slow clock\n"); return ret; @@ -328,7 +328,7 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) unmap: iounmap(at91_shdwc->pmc_base); clk_disable: - clk_disable_unprepare(sclk); + clk_disable_unprepare(at91_shdwc->sclk); return ret; } @@ -348,7 +348,7 @@ static int __exit at91_shdwc_remove(struct platform_device *pdev) iounmap(shdw->mpddrc_base); iounmap(shdw->pmc_base); - clk_disable_unprepare(sclk); + clk_disable_unprepare(shdw->sclk); return 0; } From patchwork Thu Aug 30 11:50:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10581601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68F785A4 for ; Thu, 30 Aug 2018 11:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 553EC2B37D for ; Thu, 30 Aug 2018 11:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46B082B60E; Thu, 30 Aug 2018 11:53:58 +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,RCVD_IN_DNSWL_NONE 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 258602B37D for ; Thu, 30 Aug 2018 11:53:57 +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=gqvBWFilo/66/vIVQ5iFejgcUn8U8EDRyqnlUYWFzNU=; b=H1E28Viui8gmRi b8ux7e4BPDgU4lVBA6SnYf9ZuVAwQfl2pjDIS3I0MKiRa3api4hN67vmCpj4prljeD23wfww6Jwie 98BkIl7HnMKSRmnrpYRl3a5xCguGyAj6kXRZYXUbXTyYCme62N8tngiXjXyHKbkrtylELbbOQtCo0 mENV1V+lajwc+sjH0pvWPfNq83Mu8oG8G514/jmEflc3DYUJYWyhjHtZdR40hfsw1Q/0FAHiLvoq2 kfPo6lRIrp7badzFPP588Z6iahHRWScKgooiusE60jlLrkzEmBE8cE0l/p75e8T6qTzRXanIFiNBY +COkJufceesASm0pxCkw==; 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 1fvLWC-0004f3-Oy; Thu, 30 Aug 2018 11:53:44 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTS-0003RI-9A for linux-arm-kernel@bombadil.infradead.org; Thu, 30 Aug 2018 11:50:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LA+7KrhQVR9q4W3rqes5m1CQaYjaHqFPfhdvbUyN1ck=; b=USmntJsmj4bmKwDtwtzEWvXpf DlOZU1pLIPfXFsle9+CMetWSUpeD4QIXQBHQusYc1lYp1CBmBsticgouhXIyR+e4gJqzsZd5Ong8q ct0k4Q5WvYlg7WvGvhvoIPIif0E7SEwktVrbb038QAgcowjIO37UpwK9vyFcgxDuyPw3QV9TetLUB gE1oRfAR8ROCTstxk45aIXOHAY06KvZsvBj8F9e+qNW+tcVC6Y4itYi9DkBw4YVoqvtlNj37Ke2QZ Ogsrvb8uvyEv5zxv/2I4k53u+QAfcMSP5f7wlt6N7hfb4DcAnh9jz+MGMPks7Bw3M7vntzQCSyDVf xLS8efr3Q==; Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTO-0008Qq-Sf for linux-arm-kernel@lists.infradead.org; Thu, 30 Aug 2018 11:50:51 +0000 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="19080227" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 04:50:42 -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; Thu, 30 Aug 2018 04:50:41 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH 5/6] power: reset: at91-poweroff: rename at91_shdwc_base member of struct shdwc Date: Thu, 30 Aug 2018 14:50:10 +0300 Message-ID: <1535629811-13403-6-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535629811-13403-1-git-send-email-claudiu.beznea@microchip.com> References: <1535629811-13403-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-20180830_075051_093180_7EFE510F X-CRM114-Status: GOOD ( 12.55 ) 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-pm@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 Rename at91_shdwc_base member of struct shdwc to shdwc_base. There is already an "at91" string in at91_shdwc object. Signed-off-by: Claudiu Beznea --- drivers/power/reset/at91-sama5d2_shdwc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index 945b41b4086a..ad6e2796690a 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -71,7 +71,7 @@ struct shdwc_config { struct shdwc { const struct shdwc_config *cfg; struct clk *sclk; - void __iomem *at91_shdwc_base; + void __iomem *shdwc_base; void __iomem *mpddrc_base; void __iomem *pmc_base; }; @@ -92,7 +92,7 @@ static void __init at91_wakeup_status(struct platform_device *pdev) u32 reg; char *reason = "unknown"; - reg = readl(shdw->at91_shdwc_base + AT91_SHDW_SR); + reg = readl(shdw->shdwc_base + AT91_SHDW_SR); dev_dbg(&pdev->dev, "%s: status = %#x\n", __func__, reg); @@ -138,7 +138,7 @@ static void at91_poweroff(void) : : "r" (at91_shdwc->mpddrc_base), "r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF), - "r" (at91_shdwc->at91_shdwc_base), + "r" (at91_shdwc->shdwc_base), "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW), "r" (at91_shdwc->pmc_base) : "r6"); @@ -222,10 +222,10 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev) mode |= SHDW_RTCWKEN(shdw->cfg); dev_dbg(&pdev->dev, "%s: mode = %#x\n", __func__, mode); - writel(mode, shdw->at91_shdwc_base + AT91_SHDW_MR); + writel(mode, shdw->shdwc_base + AT91_SHDW_MR); input = at91_shdwc_get_wakeup_input(pdev, np); - writel(input, shdw->at91_shdwc_base + AT91_SHDW_WUIR); + writel(input, shdw->shdwc_base + AT91_SHDW_WUIR); } static const struct shdwc_config sama5d2_shdwc_config = { @@ -262,10 +262,10 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, at91_shdwc); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - at91_shdwc->at91_shdwc_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(at91_shdwc->at91_shdwc_base)) { + at91_shdwc->shdwc_base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(at91_shdwc->shdwc_base)) { dev_err(&pdev->dev, "Could not map reset controller address\n"); - return PTR_ERR(at91_shdwc->at91_shdwc_base); + return PTR_ERR(at91_shdwc->shdwc_base); } match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node); @@ -341,8 +341,8 @@ static int __exit at91_shdwc_remove(struct platform_device *pdev) pm_power_off = NULL; /* Reset values to disable wake-up features */ - writel(0, shdw->at91_shdwc_base + AT91_SHDW_MR); - writel(0, shdw->at91_shdwc_base + AT91_SHDW_WUIR); + writel(0, shdw->shdwc_base + AT91_SHDW_MR); + writel(0, shdw->shdwc_base + AT91_SHDW_WUIR); if (shdw->mpddrc_base) iounmap(shdw->mpddrc_base); From patchwork Thu Aug 30 11:50:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10581609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B6F8920 for ; Thu, 30 Aug 2018 11:57:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 289BE2B37D for ; Thu, 30 Aug 2018 11:57:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AED32B60E; Thu, 30 Aug 2018 11:57:31 +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,RCVD_IN_DNSWL_NONE autolearn=ham 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 A14972B37D for ; Thu, 30 Aug 2018 11:57:30 +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=pW4XAdX//YB+FMBRykdKnq3ERM3y0cdsyYMmnW/DiSs=; b=BkrS3rBw6ITRFE DKOBbjsQWS/YVYgJgBwfqqLgGcXfChGXODDMS3DFrIrStl/DePmCnrq7TPq9fiX9bMk6L4hdTQMHR xc2Cw6M4H/Gt9b5OKzejGy3s8MVgaKLYdAv1vianyR0vlrs+panlc2jau3Ka11SVD68hAkXTl/ydb dFG6HtQNZ3F+EJmJ8HMRfsc7G6lwXFHU97pDwBj6ppFTH9EiLXd+hJCp3VW02WfPW8e0sI2fT/Q/q q+gbGhmgyR7bSiSDQ8rDR/IvNfj5WQeiJtGW1tS5KtEt9BKFziF38SHfMNQdBS167tshzlb/Zs6Tf 1uGUTQGXF1WRESQSj1cQ==; 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 1fvLZZ-0007It-DD; Thu, 30 Aug 2018 11:57:13 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvLTV-0003PT-2I for linux-arm-kernel@lists.infradead.org; Thu, 30 Aug 2018 11:51:23 +0000 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="18692646" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Aug 2018 04:50:45 -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; Thu, 30 Aug 2018 04:50:45 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH 6/6] power: reset: at91-poweroff: do not procede if at91_shdwc is allocated Date: Thu, 30 Aug 2018 14:50:11 +0300 Message-ID: <1535629811-13403-7-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535629811-13403-1-git-send-email-claudiu.beznea@microchip.com> References: <1535629811-13403-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-20180830_045057_182669_50F196F7 X-CRM114-Status: UNSURE ( 8.88 ) X-CRM114-Notice: Please train this message. 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-pm@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 There should be only one instance of struct shdwc in the system. This is referenced through at91_shdwc. Return in probe if at91_shdwc is already allocated. Signed-off-by: Claudiu Beznea --- drivers/power/reset/at91-sama5d2_shdwc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index ad6e2796690a..2b686c55b717 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -255,6 +255,9 @@ static int __init at91_shdwc_probe(struct platform_device *pdev) if (!pdev->dev.of_node) return -ENODEV; + if (at91_shdwc) + return -EBUSY; + at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL); if (!at91_shdwc) return -ENOMEM;