Received: by 10.192.165.156 with SMTP id m28csp1490055imm; Wed, 11 Apr 2018 21:03:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Cx8hMcYoCIoKTWNli3Asm2IMD+i6/QJuWHNNgxhzQguns5gzViNMNsFCuxOfSjuyR6rrd X-Received: by 10.99.109.203 with SMTP id i194mr5549946pgc.314.1523505808551; Wed, 11 Apr 2018 21:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523505808; cv=none; d=google.com; s=arc-20160816; b=jKIaFk95W0fyUunZzUNxilLXC0ECmOa4vnJrYptErFOj8N46GF/9PSj6YFi46Bi1Cg rk8RxbulF/NCTP67hFh7fTz9zTRCV/jGLvCX8o5izfqRVW2zi7kU5t9qSJcw7WZui63a 1G61KS4HC/yPg/36DI82t5AZx/qg4SOAs9yoCcflPl2mCZxfFLl8wMSSLFp0lIsVYPYE S7zdcGcQ8U0ZYFp+uy8G1PtINwcYLRAxAlCP73eo5jLH2P0Chk+6GFFRyrSn2fTE5PNe zgsAVpWb8dS+9VT1MMKqqNeMu7Gm/qY77Y92GkUdcsW7xmjzw19IrmQJsm/LmOaLgnk9 TgbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=9ZWdlSnSE0wTRKC3yP+4ivOrvEPyZdqWmhgmCjfNxfA=; b=HLg0HXSNl7OYcVo0DFiFoAXhwAUSOEijHLS/ddBkolm3PnFVDpZPX9LT8CMrcgBHzQ 6rTNSuwuKAi9ABh5XC5PIaYU05VK57jGFhDpBK+rhVfhybQaWN0uCnfxyGsHJ/TmIBht HEnT/7k+Hqh6GpihXwmwC4d+eO0b3+1a+gRzpvuejz0MaHU2AwwzSdiMG68GsucSKmgf b9jRTEdBrWOc05ApYFV9liY5Aqo4aF7OUHX/vT3syvwN8dDba5UAqEnaCMCO5h21UN+R UutoDn1D1+pWDupB6wJ1BL7hK9blH70sgoofUahASAJJ3uixHlUsW/uQ16X3+a1RdVH5 orLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zO+52yOI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si1958669pfl.151.2018.04.11.21.02.51; Wed, 11 Apr 2018 21:03:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zO+52yOI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752820AbeDLDzS (ORCPT + 99 others); Wed, 11 Apr 2018 23:55:18 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:32700 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752745AbeDLDzP (ORCPT ); Wed, 11 Apr 2018 23:55:15 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3C3srrK017579; Wed, 11 Apr 2018 22:54:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1523505293; bh=bg/swrFvW+5g6wOwC7QdtPcjvpjrgXM5/OuZSbm9Qto=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=zO+52yOIGyeXPZIbMgs+G+aUYdLAtXOR2/pxXismMzKoBxZmFkEwGIRtyn3R/vL0o trcTxTpLZpq5L1ykqItCYKmilYW1UBM8vpAe/ysA2NTUpTGZdJyxSn+cf9MTAcMPtb DAQ3XQOXFQ647qbZs7bWLyxFtuEyI5JQpT83iS/8= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3C3sqC9026309; Wed, 11 Apr 2018 22:54:52 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 11 Apr 2018 22:54:52 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 11 Apr 2018 22:54:52 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3C3sQpn010150; Wed, 11 Apr 2018 22:54:49 -0500 From: Keerthy To: , , CC: , , , , , , , , , Russ Dill Subject: [PATCH 06/14] ARM: AM33XX: Add functions to save/restore am33xx control registers. Date: Thu, 12 Apr 2018 09:23:51 +0530 Message-ID: <1523505239-16229-7-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523505239-16229-1-git-send-email-j-keerthy@ti.com> References: <1523505239-16229-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russ Dill These registers are part of the wkup domain and are lost during RTC only suspend and also hibernation, so storing/restoring their state is necessary. Signed-off-by: Russ Dill Signed-off-by: Keerthy --- arch/arm/mach-omap2/control.c | 84 +++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/control.h | 52 +++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 180da403..d92aa9a 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -619,8 +619,92 @@ void __init omap3_ctrl_init(void) omap3_ctrl_setup_d2d_padconf(); } + #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ +#if defined(CONFIG_SOC_AM33XX) && defined(CONFIG_PM) +static unsigned long am33xx_control_reg_offsets[] = { + AM33XX_CONTROL_SYSCONFIG_OFFSET, + AM33XX_CONTROL_STATUS_OFFSET, + AM33XX_CONTROL_CORTEX_VBBLDO_CTRL_OFFSET, + AM33XX_CONTROL_CORE_SLDO_CTRL_OFFSET, + AM33XX_CONTROL_MPU_SLDO_CTRL_OFFSET, + AM33XX_CONTROL_CLK32KDIVRATIO_CTRL_OFFSET, + AM33XX_CONTROL_BANDGAP_CTRL_OFFSET, + AM33XX_CONTROL_BANDGAP_TRIM_OFFSET, + AM33XX_CONTROL_PLL_CLKINPULOW_CTRL_OFFSET, + AM33XX_CONTROL_MOSC_CTRL_OFFSET, + AM33XX_CONTROL_RCOSC_CTRL_OFFSET, + AM33XX_CONTROL_DEEPSLEEP_CTRL_OFFSET, + AM33XX_CONTROL_INIT_PRIORITY_0_OFFSET, + AM33XX_CONTROL_INIT_PRIORITY_1_OFFSET, + AM33XX_CONTROL_MMU_CFG_OFFSET, + AM33XX_CONTROL_TPTC_CFG_OFFSET, + AM33XX_CONTROL_USB_CTRL0_OFFSET, + AM33XX_CONTROL_USB_CTRL1_OFFSET, + AM33XX_CONTROL_USB_WKUP_CTRL_OFFSET, + AM33XX_CONTROL_MREQPRIO_0_OFFSET, + AM33XX_CONTROL_MREQPRIO_1_OFFSET, + AM33XX_CONTROL_HW_EVENT_SEL_GRP1_OFFSET, + AM33XX_CONTROL_HW_EVENT_SEL_GRP2_OFFSET, + AM33XX_CONTROL_HW_EVENT_SEL_GRP3_OFFSET, + AM33XX_CONTROL_HW_EVENT_SEL_GRP4_OFFSET, + AM33XX_CONTROL_SMRT_CTRL_OFFSET, + AM33XX_CONTROL_MPUSS_HW_DEBUG_SEL_OFFSET, + AM33XX_CONTROL_VREF_CTRL_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_0_3_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_4_7_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_8_11_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_12_15_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_16_19_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_20_23_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_24_27_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_28_31_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_32_35_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_36_39_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_40_43_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_44_47_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_48_51_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_52_55_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_56_59_OFFSET, + AM33XX_CONTROL_TPCC_EVT_MUX_60_63_OFFSET, + AM33XX_CONTROL_TIMER_EVT_CAPT_OFFSET, + AM33XX_CONTROL_ECAP_EVT_CAPT_OFFSET, + AM33XX_CONTROL_ADC_EVT_CAPT_OFFSET, + AM33XX_CONTROL_RESET_ISO_OFFSET, +}; + +static u32 am33xx_control_vals[ARRAY_SIZE(am33xx_control_reg_offsets)]; + +/** + * am33xx_control_save_context - Save the wakeup domain registers + * + * Save the wkup domain registers + */ +void am33xx_control_save_context(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(am33xx_control_reg_offsets); i++) + am33xx_control_vals[i] = + omap_ctrl_readl(am33xx_control_reg_offsets[i]); +} + +/** + * am33xx_control_restore_context - Restore the wakeup domain registers + * + * Restore the wkup domain registers + */ +void am33xx_control_restore_context(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(am33xx_control_reg_offsets); i++) + omap_ctrl_writel(am33xx_control_vals[i], + am33xx_control_reg_offsets[i]); +} +#endif /* CONFIG_SOC_AM33XX && CONFIG_PM */ + struct control_init_data { int index; void __iomem *mem; diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h index ec406bc..4c50199 100644 --- a/arch/arm/mach-omap2/control.h +++ b/arch/arm/mach-omap2/control.h @@ -409,6 +409,56 @@ #define AM33XX_DEV_FEATURE 0x604 #define AM33XX_SGX_MASK BIT(29) +/* Additional AM33XX CONTROL registers */ +#define AM33XX_CONTROL_SYSCONFIG_OFFSET 0x0010 +#define AM33XX_CONTROL_STATUS_OFFSET 0x0040 +#define AM33XX_CONTROL_CORTEX_VBBLDO_CTRL_OFFSET 0x041c +#define AM33XX_CONTROL_CORE_SLDO_CTRL_OFFSET 0x0428 +#define AM33XX_CONTROL_MPU_SLDO_CTRL_OFFSET 0x042c +#define AM33XX_CONTROL_CLK32KDIVRATIO_CTRL_OFFSET 0x0444 +#define AM33XX_CONTROL_BANDGAP_CTRL_OFFSET 0x0448 +#define AM33XX_CONTROL_BANDGAP_TRIM_OFFSET 0x044c +#define AM33XX_CONTROL_PLL_CLKINPULOW_CTRL_OFFSET 0x0458 +#define AM33XX_CONTROL_MOSC_CTRL_OFFSET 0x0468 +#define AM33XX_CONTROL_RCOSC_CTRL_OFFSET 0x046c +#define AM33XX_CONTROL_DEEPSLEEP_CTRL_OFFSET 0x0470 +#define AM33XX_CONTROL_INIT_PRIORITY_0_OFFSET 0x0608 +#define AM33XX_CONTROL_INIT_PRIORITY_1_OFFSET 0x060c +#define AM33XX_CONTROL_MMU_CFG_OFFSET 0x0610 +#define AM33XX_CONTROL_TPTC_CFG_OFFSET 0x0614 +#define AM33XX_CONTROL_USB_CTRL0_OFFSET 0x0620 +#define AM33XX_CONTROL_USB_CTRL1_OFFSET 0x0628 +#define AM33XX_CONTROL_USB_WKUP_CTRL_OFFSET 0x0648 +#define AM33XX_CONTROL_MREQPRIO_0_OFFSET 0x0670 +#define AM33XX_CONTROL_MREQPRIO_1_OFFSET 0x0674 +#define AM33XX_CONTROL_HW_EVENT_SEL_GRP1_OFFSET 0x0690 +#define AM33XX_CONTROL_HW_EVENT_SEL_GRP2_OFFSET 0x0694 +#define AM33XX_CONTROL_HW_EVENT_SEL_GRP3_OFFSET 0x0698 +#define AM33XX_CONTROL_HW_EVENT_SEL_GRP4_OFFSET 0x069c +#define AM33XX_CONTROL_SMRT_CTRL_OFFSET 0x06a0 +#define AM33XX_CONTROL_MPUSS_HW_DEBUG_SEL_OFFSET 0x06a4 +#define AM33XX_CONTROL_VREF_CTRL_OFFSET 0x0e14 +#define AM33XX_CONTROL_TPCC_EVT_MUX_0_3_OFFSET 0x0f90 +#define AM33XX_CONTROL_TPCC_EVT_MUX_4_7_OFFSET 0x0f94 +#define AM33XX_CONTROL_TPCC_EVT_MUX_8_11_OFFSET 0x0f98 +#define AM33XX_CONTROL_TPCC_EVT_MUX_12_15_OFFSET 0x0f9c +#define AM33XX_CONTROL_TPCC_EVT_MUX_16_19_OFFSET 0x0fa0 +#define AM33XX_CONTROL_TPCC_EVT_MUX_20_23_OFFSET 0x0fa4 +#define AM33XX_CONTROL_TPCC_EVT_MUX_24_27_OFFSET 0x0fa8 +#define AM33XX_CONTROL_TPCC_EVT_MUX_28_31_OFFSET 0x0fac +#define AM33XX_CONTROL_TPCC_EVT_MUX_32_35_OFFSET 0x0fb0 +#define AM33XX_CONTROL_TPCC_EVT_MUX_36_39_OFFSET 0x0fb4 +#define AM33XX_CONTROL_TPCC_EVT_MUX_40_43_OFFSET 0x0fb8 +#define AM33XX_CONTROL_TPCC_EVT_MUX_44_47_OFFSET 0x0fbc +#define AM33XX_CONTROL_TPCC_EVT_MUX_48_51_OFFSET 0x0fc0 +#define AM33XX_CONTROL_TPCC_EVT_MUX_52_55_OFFSET 0x0fc4 +#define AM33XX_CONTROL_TPCC_EVT_MUX_56_59_OFFSET 0x0fc8 +#define AM33XX_CONTROL_TPCC_EVT_MUX_60_63_OFFSET 0x0fcc +#define AM33XX_CONTROL_TIMER_EVT_CAPT_OFFSET 0x0fd0 +#define AM33XX_CONTROL_ECAP_EVT_CAPT_OFFSET 0x0fd4 +#define AM33XX_CONTROL_ADC_EVT_CAPT_OFFSET 0x0fd8 +#define AM33XX_CONTROL_RESET_ISO_OFFSET 0x1000 + /* CONTROL OMAP STATUS register to identify OMAP3 features */ #define OMAP3_CONTROL_OMAP_STATUS 0x044c @@ -467,6 +517,8 @@ int omap2_control_base_init(void); int omap_control_init(void); void omap2_set_globals_control(void __iomem *ctrl); +extern void am33xx_control_save_context(void); +extern void am33xx_control_restore_context(void); void __init omap3_control_legacy_iomap_init(void); #else #define omap_ctrl_readb(x) 0 -- 1.9.1