From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1763BC433EF for ; Fri, 15 Oct 2021 07:51:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB52B61151 for ; Fri, 15 Oct 2021 07:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235020AbhJOHyB (ORCPT ); Fri, 15 Oct 2021 03:54:01 -0400 Received: from esa.microchip.iphmx.com ([68.232.153.233]:51060 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbhJOHxx (ORCPT ); Fri, 15 Oct 2021 03:53:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1634284307; x=1665820307; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=PJaL5ZGcehf0Yo81gLvYooEFbaQry5SGcgGgkYKmjJA=; b=j1cuovyE1TzhDiD4qaLAplRj/1smR3rAbiF8S3lKlKdnxzVnXGOhdC2i lN6tTE54/X4LuVrCPH/nu1urA8jFAN/whhyv7HZA0Fv8vSRjPCGtH8wgF B4tHh3OTJRZytkfBg0WXZg+Hok+ecinZaitNOZTtjwic99aT7Cb2CRKEO NNM8IsG8Jl7vA48SmeJv6E6ElOshJJ13y3il3+rgiv92wbrp/EHVBYQWO W4Tjoswt19Nc/VdrkTPf8uDvil0k8BXcddFsk/VYge6h8+w+LbufNKuu8 /qFRzpGXsldWBwj+hzag14e/WYxKSzlr2o4ybFDxRhwsKDoTt8eRfM96L g==; IronPort-SDR: cxxJ4FHyPPHpE2CbklUp+OjoN/ddtgC/YY6mQhvj93zLshVn93n0Cl+O2S0HHqsc2hKSQHrMho cwM6nik3MIAQmBco4t+oFKgGsB3zTrZ+NiPdjyvm6NGUV5BWiDW4pOMCLVmcTXSSZqlBMvglC8 bVBNwzuy5gATiCLGvYRfi1upIcqfja51os9ZrPeuRPCsCuyM1C5JQoVI2GdibGDjMHcKiIUPon aPjlaPnLCtxs3bj5CvxMqSXOS3YopQBrw2INzsKoVnn3EcvMYOpxd52VYTLIbFO9O7bkbmWUd+ 2a0rHNNoAqIjwwrXarX4JhWh X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="148207732" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Oct 2021 00:51:47 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 15 Oct 2021 00:51:47 -0700 Received: from [10.12.67.94] (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 15 Oct 2021 00:51:45 -0700 Subject: Re: [PATCH v5 02/15] clk: at91: pmc: execute suspend/resume only for backup mode To: Claudiu Beznea , , , , CC: , , References: <20211011112719.3951784-1-claudiu.beznea@microchip.com> <20211011112719.3951784-3-claudiu.beznea@microchip.com> From: Nicolas Ferre Organization: microchip Message-ID: Date: Fri, 15 Oct 2021 09:51:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20211011112719.3951784-3-claudiu.beznea@microchip.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/10/2021 at 13:27, Claudiu Beznea wrote: > Before going to backup mode architecture specific PM code sets the first > word in securam (file arch/arm/mach-at91/pm.c, function at91_pm_begin()). > Thus take this into account when suspending/resuming clocks. This will > avoid executing unnecessary instructions when suspending to non backup > modes. > > Signed-off-by: Claudiu Beznea Ok to do it like this: Acked-by: Nicolas Ferre > --- > drivers/clk/at91/pmc.c | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index b2806946a77a..517973062719 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -110,13 +111,35 @@ struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, > } > > #ifdef CONFIG_PM > + > +/* Address in SECURAM that say if we suspend to backup mode. */ > +static void __iomem *at91_pmc_backup_suspend; > + > static int at91_pmc_suspend(void) > { > + unsigned int backup; > + > + if (!at91_pmc_backup_suspend) > + return 0; > + > + backup = readl_relaxed(at91_pmc_backup_suspend); > + if (!backup) > + return 0; > + > return clk_save_context(); > } > > static void at91_pmc_resume(void) > { > + unsigned int backup; > + > + if (!at91_pmc_backup_suspend) > + return; > + > + backup = readl_relaxed(at91_pmc_backup_suspend); > + if (!backup) > + return; > + > clk_restore_context(); > } > > @@ -144,6 +167,22 @@ static int __init pmc_register_ops(void) > } > of_node_put(np); > > + np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam"); > + if (!np) > + return -ENODEV; > + > + if (!of_device_is_available(np)) { > + of_node_put(np); > + return -ENODEV; > + } > + of_node_put(np); > + > + at91_pmc_backup_suspend = of_iomap(np, 0); > + if (!at91_pmc_backup_suspend) { > + pr_warn("%s(): unable to map securam\n", __func__); > + return -ENOMEM; > + } > + > register_syscore_ops(&pmc_syscore_ops); > > return 0; > -- Nicolas Ferre From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F85C433FE for ; Fri, 15 Oct 2021 07:53:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AA5726115C for ; Fri, 15 Oct 2021 07:53:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AA5726115C Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=92nRKYhLFCnjxlih7j7JOUbQQVeWhF1QQXmPPytz3aY=; b=tzGl1JuvG0IdRjMPPrwUby75A6 V4rwWUoRNu8O5jw7lFCWkUjst+wENlPch85THgQEwRhZDCkyl/1fwkMBvEyAOY4n6t9xR/qf1qc9e OhQmJZJ2v7V5kAZCTOhcj4DcM1Ls5fZqUbsCemJUiby+UnoNmy/98FJ4J7Fg3X4IX7MBTkYmq9mr6 GFvkM4DdGGBtxb9w6/Im8q+SaomZo+mD89fBmNyiCGzGW0EPbdmjz4WQZhNQzu5vHdp/6p4U5/OSM SFFSG5dOe7yuhOytwirP5yxYm/+tI+HUasav1lsRAuxlum7fuTi4g0ziz37Am6rakbTai5U5GoPkD oNbdHkXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbI0S-005lYE-Ur; Fri, 15 Oct 2021 07:51:57 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbI0K-005lWQ-57 for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 07:51:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1634284308; x=1665820308; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=PJaL5ZGcehf0Yo81gLvYooEFbaQry5SGcgGgkYKmjJA=; b=R5ba3mFxQV98BUcL6AcB6HixQbH9UZ6HDlX/SSSxzTt4lKHwg+F8F8BR ZYBQghCBpSmjLupfMQAhbl91irf0o7XruaXAFaJceiV1Y3N4A83G50x21 d3K+BhVr/zS1Ux1Oh24ZRgTX6E11jQVoRvzVD1tm/4RMLGAqeHzXlj+37 rXXqqv/GvwzbKOkMQSqYuTjnvgTafMcqYOpY0s8xUsGMO3w8ELESpesGa 6NZ+CMiEEfj9VIvpwUkPeHwsdPbeR4/SuiDV6UHE9wTMUFJ6OYSwsYOSM HvxDGl0ypr65knmFQybM6NfZob4sWZIXM+bFXzTqfcWv7YTp6O8XK1876 A==; IronPort-SDR: cxxJ4FHyPPHpE2CbklUp+OjoN/ddtgC/YY6mQhvj93zLshVn93n0Cl+O2S0HHqsc2hKSQHrMho cwM6nik3MIAQmBco4t+oFKgGsB3zTrZ+NiPdjyvm6NGUV5BWiDW4pOMCLVmcTXSSZqlBMvglC8 bVBNwzuy5gATiCLGvYRfi1upIcqfja51os9ZrPeuRPCsCuyM1C5JQoVI2GdibGDjMHcKiIUPon aPjlaPnLCtxs3bj5CvxMqSXOS3YopQBrw2INzsKoVnn3EcvMYOpxd52VYTLIbFO9O7bkbmWUd+ 2a0rHNNoAqIjwwrXarX4JhWh X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="148207732" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Oct 2021 00:51:47 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 15 Oct 2021 00:51:47 -0700 Received: from [10.12.67.94] (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 15 Oct 2021 00:51:45 -0700 Subject: Re: [PATCH v5 02/15] clk: at91: pmc: execute suspend/resume only for backup mode To: Claudiu Beznea , , , , CC: , , References: <20211011112719.3951784-1-claudiu.beznea@microchip.com> <20211011112719.3951784-3-claudiu.beznea@microchip.com> From: Nicolas Ferre Organization: microchip Message-ID: Date: Fri, 15 Oct 2021 09:51:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20211011112719.3951784-3-claudiu.beznea@microchip.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211015_005148_260645_548AFB8D X-CRM114-Status: GOOD ( 20.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 11/10/2021 at 13:27, Claudiu Beznea wrote: > Before going to backup mode architecture specific PM code sets the first > word in securam (file arch/arm/mach-at91/pm.c, function at91_pm_begin()). > Thus take this into account when suspending/resuming clocks. This will > avoid executing unnecessary instructions when suspending to non backup > modes. > > Signed-off-by: Claudiu Beznea Ok to do it like this: Acked-by: Nicolas Ferre > --- > drivers/clk/at91/pmc.c | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index b2806946a77a..517973062719 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -110,13 +111,35 @@ struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem, > } > > #ifdef CONFIG_PM > + > +/* Address in SECURAM that say if we suspend to backup mode. */ > +static void __iomem *at91_pmc_backup_suspend; > + > static int at91_pmc_suspend(void) > { > + unsigned int backup; > + > + if (!at91_pmc_backup_suspend) > + return 0; > + > + backup = readl_relaxed(at91_pmc_backup_suspend); > + if (!backup) > + return 0; > + > return clk_save_context(); > } > > static void at91_pmc_resume(void) > { > + unsigned int backup; > + > + if (!at91_pmc_backup_suspend) > + return; > + > + backup = readl_relaxed(at91_pmc_backup_suspend); > + if (!backup) > + return; > + > clk_restore_context(); > } > > @@ -144,6 +167,22 @@ static int __init pmc_register_ops(void) > } > of_node_put(np); > > + np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam"); > + if (!np) > + return -ENODEV; > + > + if (!of_device_is_available(np)) { > + of_node_put(np); > + return -ENODEV; > + } > + of_node_put(np); > + > + at91_pmc_backup_suspend = of_iomap(np, 0); > + if (!at91_pmc_backup_suspend) { > + pr_warn("%s(): unable to map securam\n", __func__); > + return -ENOMEM; > + } > + > register_syscore_ops(&pmc_syscore_ops); > > return 0; > -- Nicolas Ferre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel