From patchwork Tue Aug 4 11:07:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 11700257 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCB656C1 for ; Tue, 4 Aug 2020 11:09:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC6DA206DA for ; Tue, 4 Aug 2020 11:09:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u5iNGcxy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="KxT03f1P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC6DA206DA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=1KwY0qoYLKq13N6eHDGJTGRZADAbGG65Od2edhdbhJw=; b=u5iNGcxyuoZQx6nl0nRZXONR4 v1u80PPy8YC+gyuOPhBOZB70nONHMTRZN4lXQwQXkjFZLbzTGDN+xoD6kQDOnXOYySNNs2fgnEpBF 6COESKBnw0jzsAJthEXoxXhPheyexvReewmCDzllSoyl09mcQP81V4fLbdVU4vb2a17qHcCbEC7Bw O2XS+TvrppzjQjO74Yx40PJyGgJbnQKl0m/4hxO28e9spimGzhCI6QiL5howgpGNHaaoeGIxxLUBp 62veE7MPsw7opImPcpj9FVjyhJ8aaBP35JGJSnqJchM6rK3y/ah3K1w/SgdqYy3YmubCARxRRIVpH Yqlj3qXjA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2unP-0003wY-W2; Tue, 04 Aug 2020 11:07:52 +0000 Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2unM-0003vr-Bo for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 11:07:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596539268; x=1628075268; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=gzaQqXpc5xoNczZO0vYLciqB0KCCTpW7igvgI29mYeM=; b=KxT03f1PQgjnEcHrpVbkSgGHCClPNasYTFeCgavRasn/ADpyn5EyRm8M V4O2rFlTce54Pur3bwCKW6WNergVSznk3CXOXFNja7GV6wH50wVm7luAw ptfkSwmBwWErVF6KL8kcfmcQrpm4ZTILYC38/6NHuX1jc2Plev0+4PAso zkwmEhh7ogvcAlbtw8mwCU5xufcwiwHy6ivMUtTMRiyEbGb2MCT2R6NDO K6025y8SCaBIQRcrpakVIOdg6tZj+MeEKSVfOsU9qllZShQwPYT2DIVEt 8s/KPzrpyQoNwxPs6gnajKDGOfpfcWj4TfpMguOF17pZaWTPgkA3NsWb9 w==; IronPort-SDR: DO28IYxIPdyOZNEpHZhQvc00vFAUYwKh+8RNxLZUCLyNJzC6BZi732EE80XiAYJAdM54R9qJM+ JQ3QCjB73d5GGN2baumXn1bcu9PMiyOaUpO8y/QT/Ubs0peQgErX9tb7DVVBQL+Llpo1xGK3yb QZtUuk2Fut643hM5HkJITWHN6kER/LLwH5JrN/mronoRZ5f1NEMe/GqPhc4cYtVv6PcHlVCVf/ 3hKbheA3ixhwRMWbIP9H5PUq8lmtB69Fu1H6DlYtbad0bdCUKSojLmMHN8Wi/NleCXGGgf8dWO TT8= X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="21673291" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2020 04:07:46 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 4 Aug 2020 04:07:43 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 4 Aug 2020 04:07:40 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH v2 1/3] ARM: at91: pm: add support for ULP0 fast wakeup Date: Tue, 4 Aug 2020 14:07:36 +0300 Message-ID: <1596539258-20719-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596539258-20719-1-git-send-email-claudiu.beznea@microchip.com> References: <1596539258-20719-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-20200804_070748_561193_5766DDD8 X-CRM114-Status: GOOD ( 15.22 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.154.253 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [216.71.154.253 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org ULP0 fast improves suspend/resume time with few milliseconds the drawback being the power consumption. The mean values measured for suspend/resume time are as follows (measured on SAMA5D2 Xplained board), ULP0 compared with fast ULP0: - ulp0 fast: suspend time: 169 ms, resume time: 216 ms - ulp0 : suspend time: 197 ms, resume time: 258 ms Current consumption while suspended (measured on SAMA5D2 Xplained board): - ulp0 fast: 730uA - ulp0 : 270uA Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 9 +++++---- arch/arm/mach-at91/pm.h | 5 +++-- arch/arm/mach-at91/pm_suspend.S | 41 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 074bde64064e..04fdcbd57100 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -51,10 +51,11 @@ static struct at91_soc_pm soc_pm = { }; static const match_table_t pm_modes __initconst = { - { AT91_PM_STANDBY, "standby" }, - { AT91_PM_ULP0, "ulp0" }, - { AT91_PM_ULP1, "ulp1" }, - { AT91_PM_BACKUP, "backup" }, + { AT91_PM_STANDBY, "standby" }, + { AT91_PM_ULP0, "ulp0" }, + { AT91_PM_ULP0_FAST, "ulp0-fast" }, + { AT91_PM_ULP1, "ulp1" }, + { AT91_PM_BACKUP, "backup" }, { -1, NULL }, }; diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 218e8d1a30fb..bfb260be371e 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h @@ -19,8 +19,9 @@ #define AT91_PM_STANDBY 0x00 #define AT91_PM_ULP0 0x01 -#define AT91_PM_ULP1 0x02 -#define AT91_PM_BACKUP 0x03 +#define AT91_PM_ULP0_FAST 0x02 +#define AT91_PM_ULP1 0x03 +#define AT91_PM_BACKUP 0x04 #ifndef __ASSEMBLY__ struct at91_pm_data { diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index be9764e8d3fa..0184de05c1be 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -164,7 +164,22 @@ ENDPROC(at91_backup_mode) .macro at91_pm_ulp0_mode ldr pmc, .pmc_base + ldr tmp2, .pm_mode + ldr tmp3, .mckr_offset + + /* Check if ULP0 fast variant has been requested. */ + cmp tmp2, #AT91_PM_ULP0_FAST + bne 0f + + /* Set highest prescaler for power saving */ + ldr tmp1, [pmc, tmp3] + bic tmp1, tmp1, #AT91_PMC_PRES + orr tmp1, tmp1, #AT91_PMC_PRES_64 + str tmp1, [pmc, tmp3] + wait_mckrdy + b 1f +0: /* Turn off the crystal oscillator */ ldr tmp1, [pmc, #AT91_CKGR_MOR] bic tmp1, tmp1, #AT91_PMC_MOSCEN @@ -192,7 +207,18 @@ ENDPROC(at91_backup_mode) /* Wait for interrupt */ 1: at91_cpu_idle - /* Restore RC oscillator state */ + /* Check if ULP0 fast variant has been requested. */ + cmp tmp2, #AT91_PM_ULP0_FAST + bne 5f + + /* Set lowest prescaler for fast resume. */ + ldr tmp1, [pmc, tmp3] + bic tmp1, tmp1, #AT91_PMC_PRES + str tmp1, [pmc, tmp3] + wait_mckrdy + b 6f + +5: /* Restore RC oscillator state */ ldr tmp1, .saved_osc_status tst tmp1, #AT91_PMC_MOSCRCS beq 4f @@ -216,6 +242,7 @@ ENDPROC(at91_backup_mode) str tmp1, [pmc, #AT91_CKGR_MOR] wait_moscrdy +6: .endm /** @@ -473,23 +500,29 @@ ENDPROC(at91_backup_mode) ENTRY(at91_ulp_mode) ldr pmc, .pmc_base ldr tmp2, .mckr_offset + ldr tmp3, .pm_mode /* Save Master clock setting */ ldr tmp1, [pmc, tmp2] str tmp1, .saved_mckr /* - * Set the Master clock source to slow clock + * Set master clock source to: + * - MAINCK if using ULP0 fast variant + * - slow clock, otherwise */ bic tmp1, tmp1, #AT91_PMC_CSS + cmp tmp3, #AT91_PM_ULP0_FAST + bne save_mck + orr tmp1, tmp1, #AT91_PMC_CSS_MAIN +save_mck: str tmp1, [pmc, tmp2] wait_mckrdy at91_plla_disable - ldr r0, .pm_mode - cmp r0, #AT91_PM_ULP1 + cmp tmp3, #AT91_PM_ULP1 beq ulp1_mode at91_pm_ulp0_mode From patchwork Tue Aug 4 11:07:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 11700259 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04A556C1 for ; Tue, 4 Aug 2020 11:09:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8AD4206DA for ; Tue, 4 Aug 2020 11:09:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qcSk28ql"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="QFK9mL2U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8AD4206DA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=ihyKBcYEk+n2v8RFeLupvvXCwvYmuJGtscHPoAT0DdU=; b=qcSk28ql9jCc+Tyz0IuLIXVGV dkK9FWzuFe+M4qqjoMEYjxv4SABI7dJ1YVGfTwWhhvUXnJ0K6udq5+/8EOjzSqyfp2zXpz3rhrRmo 4raPm/eDR02mQHt3BvuMyJFchX/D7kJt6zaqam9AO/9szF/3lqwiUrMYoNts+w/MLlx4FLsQVryyN hlCdjjces1OJlbM1R+kpHE4xKRWtqjxt0NDOXqhRNhBEuF2v4n2hm3w0QEabXIGrmAOdmz8MhhoIb IR3hloz5/SeBzT03hMJC2n5xpMYaH6Ibkcd5g3id+1BPiqVxHPWnuKDCphcv9YYRiJTxRNbvhjpho l/ZkW8w7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2unR-0003xF-Q5; Tue, 04 Aug 2020 11:07:53 +0000 Received: from esa5.microchip.iphmx.com ([216.71.150.166]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2unP-0003wX-ED for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 11:07:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596539271; x=1628075271; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=9MZm1UgGj5YfcCP0VMF+3w2gb07kbO63MeiK9RsdE18=; b=QFK9mL2UlDzzBeALfrEvd3cWI3yTEvQG5+EI74JRO3hXStq1c4graBgB JGhkZdEWyXeuAnbZhgFir5H4oolmm7XyVAU7qFo9fU7cJCZ7L8esrXt29 ccjZx3oLfUWQT32AW+zvlHnB0d72OzihrYY9OqA5oyn11WyhaAjhTcnt4 FVJz9UNX5vxHDDABt5NTqEJA8F/OidYqq8U5Gm30w+/BK66QWw6LAjCnZ RYm4P4oVr/raLhjQAhWo0m+n5uEN0Lk+A3LlZ546QxX7pcy+0iXBL9ABF J5D1c2M/wMlxguHV4Ravwcdj7IH/PqFAR74+7JrG2l5VRqs6TjtztYDcT w==; IronPort-SDR: G3RFLD4EIj2ByIIYUM/qul8oVr4dLrl8smZ9sJ2fxGNhlgkYj6Hh/5xl1NOCTjzib826OwVtEU FMOikc+ZuwiahmdbARcnDwbniYe0OXZzISYXBI2+BaXev6IbRDxmcHF23CRrYFBgYyftBXqi5Q abDWKyVQqPa94z4ebWAsQ4lKLJkSEQpEEbuQGuiQ9crLFTcOKdZCePY/QUmBBbW9I5TGT5gcxB lJALgRJqMVg9Pn4Y8++8Qyfv5kjpi/K1vVLU63rb+dQRBzQfxIbnLAbN1v3T5y90Yf044lvCD8 7p0= X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="85764513" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2020 04:07:50 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 4 Aug 2020 04:07:46 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 4 Aug 2020 04:07:44 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH v2 2/3] ARM: at91: pm: add per soc validation of pm modes Date: Tue, 4 Aug 2020 14:07:37 +0300 Message-ID: <1596539258-20719-3-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596539258-20719-1-git-send-email-claudiu.beznea@microchip.com> References: <1596539258-20719-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-20200804_070751_745188_19C21B20 X-CRM114-Status: GOOD ( 17.32 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.150.166 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [216.71.150.166 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Not all SoCs supports all the PM mode. User may end up settings, e.g. backup mode, on a non SAMA5D2 device, but the mode to not be valid. If backup mode is used on a devices not supporting it there will be no way of resuming other than rebooting. Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 04fdcbd57100..51902c4c9bb4 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -785,6 +785,51 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = { { /* sentinel */ }, }; +static void __init at91_pm_modes_validate(const int *modes, int len) +{ + u8 i, standby = 0, suspend = 0; + int mode; + + for (i = 0; i < len; i++) { + if (standby && suspend) + break; + + if (modes[i] == soc_pm.data.standby_mode && !standby) { + standby = 1; + continue; + } + + if (modes[i] == soc_pm.data.suspend_mode && !suspend) { + suspend = 1; + continue; + } + } + + if (!standby) { + if (soc_pm.data.suspend_mode == AT91_PM_STANDBY) + mode = AT91_PM_ULP0; + else + mode = AT91_PM_STANDBY; + + pr_warn("AT91: PM: %s mode not supported! Using %s.\n", + pm_modes[soc_pm.data.standby_mode].pattern, + pm_modes[mode].pattern); + soc_pm.data.standby_mode = mode; + } + + if (!suspend) { + if (soc_pm.data.standby_mode == AT91_PM_ULP0) + mode = AT91_PM_STANDBY; + else + mode = AT91_PM_ULP0; + + pr_warn("AT91: PM: %s mode not supported! Using %s.\n", + pm_modes[soc_pm.data.suspend_mode].pattern, + pm_modes[mode].pattern); + soc_pm.data.suspend_mode = mode; + } +} + static void __init at91_pm_init(void (*pm_idle)(void)) { struct device_node *pmc_np; @@ -823,9 +868,14 @@ static void __init at91_pm_init(void (*pm_idle)(void)) void __init at91rm9200_pm_init(void) { + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0 + }; + if (!IS_ENABLED(CONFIG_SOC_AT91RM9200)) return; + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); at91_dt_ramc(); /* @@ -838,9 +888,14 @@ void __init at91rm9200_pm_init(void) void __init sam9x60_pm_init(void) { + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1, + }; + if (!IS_ENABLED(CONFIG_SOC_SAM9X60)) return; + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); at91_pm_modes_init(); at91_dt_ramc(); at91_pm_init(at91sam9x60_idle); @@ -851,14 +906,19 @@ void __init sam9x60_pm_init(void) void __init at91sam9_pm_init(void) { + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0, + }; + if (!IS_ENABLED(CONFIG_SOC_AT91SAM9)) return; + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); at91_dt_ramc(); at91_pm_init(at91sam9_idle); } -void __init sama5_pm_init(void) +static void __init sama5_pm(void) { if (!IS_ENABLED(CONFIG_SOC_SAMA5)) return; @@ -867,13 +927,32 @@ void __init sama5_pm_init(void) at91_pm_init(NULL); } +void __init sama5_pm_init(void) +{ + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, + }; + + if (!IS_ENABLED(CONFIG_SOC_SAMA5)) + return; + + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); + sama5_pm(); +} + void __init sama5d2_pm_init(void) { + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1, + AT91_PM_BACKUP, + }; + if (!IS_ENABLED(CONFIG_SOC_SAMA5D2)) return; + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); at91_pm_modes_init(); - sama5_pm_init(); + sama5_pm(); soc_pm.ws_ids = sama5d2_ws_ids; soc_pm.config_shdwc_ws = at91_sama5d2_config_shdwc_ws; From patchwork Tue Aug 4 11:07:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 11700255 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0ECF13B6 for ; Tue, 4 Aug 2020 11:09:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90875206DA for ; Tue, 4 Aug 2020 11:09:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AG5TK51l"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="nv0J10VE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90875206DA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=+vlv9KTZUJScVfscxQ9SKCBafEPIfAn22gZm+VTx9fg=; b=AG5TK51lgzmv8Q5/Dz3pxLgIO fiapdWrW/meRdNwuvH4KvcLZf2STLFbKubFQ7YU276us2AmClmT+b8rkKcCvg8zt2jbv1vqSCZ5Xc sUN3kOnDCfpEbsdJOllz3t7llvliF04DfRT/dG8JUBuuE/s2PzeNuV9WaSt43qG8tCkrX0PAXsiXV 2f5lb8CuC+2YPq9oklCP0GlQwyRsJK1dceDsLOTopt8ddWSHKVLWDMeUKMPSpJkJtIFPjujh0g+l/ mb66j/vuqu184i+tNDKwApkwOFJOsQES7Do1uEY+57ckeaJLM3m11sWfzUj8wENtZELL02e/Uu+ln LzUojxq1A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2unX-0003yE-L8; Tue, 04 Aug 2020 11:07:59 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2unV-0003xa-7c for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 11:07:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1596539277; x=1628075277; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=cABTCBkYCZRK9yGKmo95ajZBgIwDxSEMc4wqVo78+9g=; b=nv0J10VE3FM0DAKl8qFHm5BkmqyI7ML9CuTkBFXh5DFEGT/M4dngVTP8 XRY3j+eYl57WD4vRD0eoEOevDJGS84oq5TPDLr36zlLhYRkemNzSEIbye OLxblvWwDOhNpxCAIuRVo0Hyq47xEFFskr4kN/U4DQrpchf3gkDubp9Sf R+cJyjfONPg1tjzr9eh+5MCyGExHiZPCH/hvnCLjZLn7nsgdbihhah3W6 9G1+2i/vGY4Uqo7WNDUdyup+dCCdTzNEKyWvyt19URK7D7k6cnZaTDOAa h7aBssY7TWNU45G5UMTSY47LsrbPrhQiQ2Z2l+0XWwbrRe5OOKhn0sw4x A==; IronPort-SDR: U5FIzf9eO09nF7yxc2ErkzzGE+AyObXpRESQoG2nHrvOCj3mowVlPyl3AJgPqJsgXNgpVHObcy dwUQ33U/IkHESI15DQYWNd8k3EEwpXDNutIm54JQEANsiC7mqasE1TvgvAbUm+dGzBX42TwnMr 5LxG6C3Ou7qqIAXyJle+qFT0fR1Q8uKVGo/QgSOoBQIaXbO88dnSrHdrncvVd1dbRaPpQr7R9P jn2q6ytoEfLkcNbAZk7hDAJLgoF3Bmwtgc0dmCJwaVArv8oxHzXG5DWcVv2szkBEv5MFiBAMZ/ U5w= X-IronPort-AV: E=Sophos;i="5.75,433,1589266800"; d="scan'208";a="86626294" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2020 04:07:54 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 4 Aug 2020 04:07:49 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Tue, 4 Aug 2020 04:07:47 -0700 From: Claudiu Beznea To: , , , Subject: [PATCH v2 3/3] ARM: at91: pm: of_node_put() after its usage Date: Tue, 4 Aug 2020 14:07:38 +0300 Message-ID: <1596539258-20719-4-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596539258-20719-1-git-send-email-claudiu.beznea@microchip.com> References: <1596539258-20719-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-20200804_070757_424860_0B4B4DD9 X-CRM114-Status: GOOD ( 11.26 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.153.233 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Put node after it has been used. Fixes: 13f16017d3e3f ("ARM: at91: pm: Tie the USB clock mask to the pmc") Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 51902c4c9bb4..e332c6b1548c 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -841,6 +841,7 @@ static void __init at91_pm_init(void (*pm_idle)(void)) pmc_np = of_find_matching_node_and_match(NULL, atmel_pmc_ids, &of_id); soc_pm.data.pmc = of_iomap(pmc_np, 0); + of_node_put(pmc_np); if (!soc_pm.data.pmc) { pr_err("AT91: PM not supported, PMC not found\n"); return;