From patchwork Thu Apr 15 10:50:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 12205123 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 416FDC433ED for ; Thu, 15 Apr 2021 10:58:13 +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 B9C2861158 for ; Thu, 15 Apr 2021 10:58:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9C2861158 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=9ffm6H2HsYoasnn7MvrCoe1I3SpdoXsn7APYN1+LqLo=; b=G7N0W1qjPSU99naNKI35qsxo1 0XgiAKL6iWYSmXI1qd6qE795dHIwosz1C9oh5XmTn22/56/tebyTiyfbpJ7w6Mauz2aJwue0hZy1L N1gHXZAqKCLJ8MR0kTAsS/aaGF3jJBj2LNmfWR2Iq5POs2emUjL/r/57h6O4EzZbgO+lHX9SzjWEB dQwfdoUdJ+qf6v4ZBuFt1UGge0L3ubVMENYxOW4mBezPPg3CmuQm3Gd7vfEXFekHbUPbpg1ZKGehe GZW6LgHLtqbUxaQf0KX4dGQYeJ3djBPmver6zyNYjUCKzxJUglNRFBMFTa34zQEwIzgcA43fHrQeM jkEQg+oKQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWzfT-00FpPu-Ob; Thu, 15 Apr 2021 10:56:16 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWzbA-00FnoW-UL for linux-arm-kernel@desiato.infradead.org; Thu, 15 Apr 2021 10:51:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Sender:Reply-To:Content-ID:Content-Description; bh=ZYtQESFM05L1IeEy7UzLlU9iLq9vUu7ukqR4wba4pwU=; b=fz10fB/OkIH30KHwZ1RCfkts0E T5qVUjgGfxc8VJTMo+KYPSO0o1asCuZ68zkNU0kigyVxIuCjfkKAkfK5gixZ3c0+s8x5yVzisl11T 2b8cqOp3BzzqX5qS6GW3wxf200Uc8C+P9HUGQt4w5nUKcXcrIabpF+QaOzbjAYeMdkVgVX4by9Hyu InlC2c8fE/SDyDIDLrBvoTX86Cp5YKJ7PrRbkTp2d7YuvLTbwOXBHvFG0TJDZmy70Q0bEvt9jB+/q 0RZMMNRwPWAlaqLKF/AXb9Pq7IZfV5pfrXeMTMYDwdJgave1wZriJJAfa8ITG/Sf3VxNmGCnofK2E EWKG9SUA==; Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWzb8-008V3p-GR for linux-arm-kernel@lists.infradead.org; Thu, 15 Apr 2021 10:51:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1618483906; x=1650019906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZrJGxZJvEsXnK5zB0VRt/gBq8pnNGDq/w4qYrIFNpWY=; b=1MOU4lz1McEUoqvqeu2Gw8ywhG6clundDj/JYXlouHpcVbwNXy2/j94O cr2QCYfGt5NcNI0s1tmueOKmUwmIn6T7AvyLU0TkLaPyVtQxMTr5aECQf vTymXnLTjzWQsFzlSXgfaDCbN/Ues+XA82uSdxnG9SnpmQsow8TCAj9Ow SU+vV4ts4QoOkv0rugj/VNJW4i90g3XDZe39vtK3aYymLZItiCmzNTfkL qwwT06uErYFDIYe+d+SUgd8TgCKJJU2f69AJerKlahOfmP4zN3ZbJNhh8 OYkfPKV4KGxzw7hBRjLh+P9xyBC0eUzeUi+5tZLTQ5Tnr2Oz/wUQxy5k3 w==; IronPort-SDR: MuQG7/VF1NckePtkTd6/wRHWnb4BSWtkV2FncQ2V6eVsufhnePDwBwpl83XGkF68TAxAnivJs1 /KdwnPJw9Sq/zREUO7Jiobu48vU7lqetWzmY+AkKUvRyFhFms4FDTbRmrtl+tDxQFHLMa/SiqZ 5XnUVvgfCM6A5CuK9rwRsRLc8kTbhrXNnCW2EE+bHhOu0N2JjiPti0EK6UyIbjPEKXD2Y+H+fn 0sFM+JwhjF3qSzbdHiPVOZBBj/EbopVO6sEvo2Z9tkLEXOO+5Xsz2F2s5Bf6sGsIRNLT8g0EYW ZpU= X-IronPort-AV: E=Sophos;i="5.82,223,1613458800"; d="scan'208";a="117122142" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Apr 2021 03:51:45 -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; Thu, 15 Apr 2021 03:51:45 -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; Thu, 15 Apr 2021 03:51:39 -0700 From: Claudiu Beznea To: , , , , CC: , , , Claudiu Beznea Subject: [PATCH v3 14/24] ARM: at91: pm: add support for 2.5V LDO regulator control Date: Thu, 15 Apr 2021 13:50:00 +0300 Message-ID: <20210415105010.569620-15-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210415105010.569620-1-claudiu.beznea@microchip.com> References: <20210415105010.569620-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-20210415_035146_578170_215ABFD1 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.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support to disable/enable 2.5V LDO regulator when entering/exiting any ULP mode. Signed-off-by: Claudiu Beznea --- arch/arm/mach-at91/pm.h | 1 + arch/arm/mach-at91/pm_suspend.S | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 666474088d55..53bdc9000e44 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h @@ -13,6 +13,7 @@ #include #include #include +#include #define AT91_MEMCTRL_MC 0 #define AT91_MEMCTRL_SDRAMC 1 diff --git a/arch/arm/mach-at91/pm_suspend.S b/arch/arm/mach-at91/pm_suspend.S index 8b0b8619ee8a..9c9e08fd8300 100644 --- a/arch/arm/mach-at91/pm_suspend.S +++ b/arch/arm/mach-at91/pm_suspend.S @@ -83,6 +83,29 @@ tmp3 .req r6 .endm +/** + * Set state for 2.5V low power regulator + * @ena: 0 - disable regulator + * 1 - enable regulator + * + * Side effects: overwrites r7, r8, r9, r10 + */ + .macro at91_2_5V_reg_set_low_power ena +#ifdef CONFIG_SOC_SAMA7 + ldr r7, .sfrbu + mov r8, #\ena + ldr r9, [r7, #AT91_SFRBU_25LDOCR] + orr r9, r9, #AT91_SFRBU_25LDOCR_LP + cmp r8, #1 + beq lp_done_\ena + bic r9, r9, #AT91_SFRBU_25LDOCR_LP +lp_done_\ena: + ldr r10, =AT91_SFRBU_25LDOCR_LDOANAKEY + orr r9, r9, r10 + str r9, [r7, #AT91_SFRBU_25LDOCR] +#endif + .endm + .text .arm @@ -906,6 +929,9 @@ save_mck: at91_plla_disable + /* Enable low power mode for 2.5V regulator. */ + at91_2_5V_reg_set_low_power 1 + ldr tmp3, .pm_mode cmp tmp3, #AT91_PM_ULP1 beq ulp1_mode @@ -918,6 +944,9 @@ ulp1_mode: b ulp_exit ulp_exit: + /* Disable low power mode for 2.5V regulator. */ + at91_2_5V_reg_set_low_power 0 + ldr pmc, .pmc_base at91_plla_enable