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 X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F85BC433ED for ; Fri, 9 Apr 2021 11:18:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEB05610FC for ; Fri, 9 Apr 2021 11:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234135AbhDILSX (ORCPT ); Fri, 9 Apr 2021 07:18:23 -0400 Received: from esa.microchip.iphmx.com ([68.232.154.123]:50958 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234113AbhDILSG (ORCPT ); Fri, 9 Apr 2021 07:18:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1617967074; x=1649503074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1EEQphPvvifx5tT1d9lrbbNwiHANmvdL/6HrlgcCol8=; b=d6vz6UYQ0jZ7kKcPmUETa65J/5Xy+lIwBpmoo+7Y6ObI7j0MxyIhp8kp i7DIFLgM4XZYCqs0uQzms1IsC6R0aM4yDFqYOUH7Ju0+7lxC1MvrVyFYW 4PcOoVbOhCGeac7dIDo94nxbOI/Dbe6lZGTLA3oRviWnDjO9wKG70XEfX CLWkpuyXzbuVXOneMory/sldizDh4wCQXe6T6eGvlabThl0KIvRAT3Q/P bMqVW8IpJyoWpp8b+qMYzpdRL1AAvNUPepTRA6qSkdettIXYfTWWIogLK okur8YjbGkWvK46ltfNlufSYHjTeF+YacvegHeORtEX6CqmnALngpKOJm w==; IronPort-SDR: IOjV5b+AdlRqR9ESUsr69GTBNFVbd4RNZ2INpImewqaGKUXAcLEuIUuF3g8J6GhSS/cz+Vo8OW K30KShDBv7kbs3tVeGgu/rNfZHRT0XtnIF9rvNa9AKhkDteRzbkJNc7EwEkniWviCXM/FXva79 ivp66VwpVEI/Eq7rRPmAvdxlt49UFBDCxsj7FxBJK0cOYo42b3IbxXTXrx/v/9UFPsR1EftXDv 3uMjVkFV+0auyGkoJ6fcuNTqCv1CUGEIqVlssmIrgCE/4xstgYpFMG6zXtwbs3h2MIo2CYd8Ja fP8= X-IronPort-AV: E=Sophos;i="5.82,209,1613458800"; d="scan'208";a="50565938" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Apr 2021 04:17:53 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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.2; Fri, 9 Apr 2021 04:17:53 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Fri, 9 Apr 2021 04:17:48 -0700 From: Claudiu Beznea To: , , , , CC: , , , Claudiu Beznea Subject: [PATCH v2 20/24] ARM: at91: pm: add backup mode support for SAMA7G5 Date: Fri, 9 Apr 2021 14:13:41 +0300 Message-ID: <20210409111345.294472-21-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210409111345.294472-1-claudiu.beznea@microchip.com> References: <20210409111345.294472-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adapt at91_pm_backup_init() to work for SAMA7G5. Also, set the LPM pin to shutdown controller. This will signal to PMIC that it needs to switch to the state corresponding to backup mode. Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 3 ++- arch/arm/mach-at91/pm_suspend.S | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 91b4014d2e10..fcb20272d65d 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -729,7 +729,8 @@ static int __init at91_pm_backup_init(void) struct platform_device *pdev; int ret = -ENODEV, located = 0; - if (!IS_ENABLED(CONFIG_SOC_SAMA5D2)) + if (!IS_ENABLED(CONFIG_SOC_SAMA5D2) && + !IS_ENABLED(CONFIG_SOC_SAMA7G5)) return -EPERM; if (!at91_is_pm_mode_active(AT91_PM_BACKUP)) diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index 7396e18dd7e5..cbd61a3bcab1 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -106,6 +106,12 @@ lp_done_\ena: #endif .endm + .macro at91_backup_set_lpm reg +#ifdef CONFIG_SOC_SAMA7 + orr \reg, \reg, #0x200000 +#endif + .endm + .text .arm @@ -989,6 +995,7 @@ ulp_exit: ldr r0, .shdwc mov tmp1, #0xA5000000 add tmp1, tmp1, #0x1 + at91_backup_set_lpm tmp1 str tmp1, [r0, #0] .endm -- 2.25.1 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 X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42783C433B4 for ; Fri, 9 Apr 2021 11:26:14 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 2F25A6113A for ; Fri, 9 Apr 2021 11:26:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F25A6113A 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=f1lBmo2xH1G033cojoMt5Tnm/aLWHHCtlZLZTMQYMV0=; b=CbSVH1L1pYRpb7cEDEOtIxFw2 amWygzgAO33UDN2/kuYD16Z+ZaIz1Wh2JmLb0VhbixXwLvj5CCpPjhYY7tbrale5aJ2pJ8CcX+jiB D7UrKVpxChYN7ws0PE1x8O9JVpXr75IA/FFfEu+KGsS6QOrTyH4bgiIwiAIUDpRvnuAwGl1Z6cyuq gTcQHwAe6EOyxQd7u1K+xbvuwn4at0hYHyDG5xaR64RsyGLkDUmG2uZjd9RsQEckRoNhRFSUzU/P9 5D4ki++1l/EMZznuv/hNx01IV17CmD9VkAtaOXHOkriNa2R0a2P+B41itdluGHzES3SylJ4wQKKpA kob4q1gMA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUpFS-000aha-9H; Fri, 09 Apr 2021 11:24:27 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUp99-000YMq-2b for linux-arm-kernel@lists.infradead.org; Fri, 09 Apr 2021 11:17:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1617967074; x=1649503074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1EEQphPvvifx5tT1d9lrbbNwiHANmvdL/6HrlgcCol8=; b=d6vz6UYQ0jZ7kKcPmUETa65J/5Xy+lIwBpmoo+7Y6ObI7j0MxyIhp8kp i7DIFLgM4XZYCqs0uQzms1IsC6R0aM4yDFqYOUH7Ju0+7lxC1MvrVyFYW 4PcOoVbOhCGeac7dIDo94nxbOI/Dbe6lZGTLA3oRviWnDjO9wKG70XEfX CLWkpuyXzbuVXOneMory/sldizDh4wCQXe6T6eGvlabThl0KIvRAT3Q/P bMqVW8IpJyoWpp8b+qMYzpdRL1AAvNUPepTRA6qSkdettIXYfTWWIogLK okur8YjbGkWvK46ltfNlufSYHjTeF+YacvegHeORtEX6CqmnALngpKOJm w==; IronPort-SDR: IOjV5b+AdlRqR9ESUsr69GTBNFVbd4RNZ2INpImewqaGKUXAcLEuIUuF3g8J6GhSS/cz+Vo8OW K30KShDBv7kbs3tVeGgu/rNfZHRT0XtnIF9rvNa9AKhkDteRzbkJNc7EwEkniWviCXM/FXva79 ivp66VwpVEI/Eq7rRPmAvdxlt49UFBDCxsj7FxBJK0cOYo42b3IbxXTXrx/v/9UFPsR1EftXDv 3uMjVkFV+0auyGkoJ6fcuNTqCv1CUGEIqVlssmIrgCE/4xstgYpFMG6zXtwbs3h2MIo2CYd8Ja fP8= X-IronPort-AV: E=Sophos;i="5.82,209,1613458800"; d="scan'208";a="50565938" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Apr 2021 04:17:53 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) 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.2; Fri, 9 Apr 2021 04:17:53 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Fri, 9 Apr 2021 04:17:48 -0700 From: Claudiu Beznea To: , , , , CC: , , , Claudiu Beznea Subject: [PATCH v2 20/24] ARM: at91: pm: add backup mode support for SAMA7G5 Date: Fri, 9 Apr 2021 14:13:41 +0300 Message-ID: <20210409111345.294472-21-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210409111345.294472-1-claudiu.beznea@microchip.com> References: <20210409111345.294472-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210409_121756_120411_14D51730 X-CRM114-Status: GOOD ( 11.17 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Adapt at91_pm_backup_init() to work for SAMA7G5. Also, set the LPM pin to shutdown controller. This will signal to PMIC that it needs to switch to the state corresponding to backup mode. Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.c | 3 ++- arch/arm/mach-at91/pm_suspend.S | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 91b4014d2e10..fcb20272d65d 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -729,7 +729,8 @@ static int __init at91_pm_backup_init(void) struct platform_device *pdev; int ret = -ENODEV, located = 0; - if (!IS_ENABLED(CONFIG_SOC_SAMA5D2)) + if (!IS_ENABLED(CONFIG_SOC_SAMA5D2) && + !IS_ENABLED(CONFIG_SOC_SAMA7G5)) return -EPERM; if (!at91_is_pm_mode_active(AT91_PM_BACKUP)) diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index 7396e18dd7e5..cbd61a3bcab1 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -106,6 +106,12 @@ lp_done_\ena: #endif .endm + .macro at91_backup_set_lpm reg +#ifdef CONFIG_SOC_SAMA7 + orr \reg, \reg, #0x200000 +#endif + .endm + .text .arm @@ -989,6 +995,7 @@ ulp_exit: ldr r0, .shdwc mov tmp1, #0xA5000000 add tmp1, tmp1, #0x1 + at91_backup_set_lpm tmp1 str tmp1, [r0, #0] .endm -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel