Received: by 10.192.165.156 with SMTP id m28csp1490091imm; Wed, 11 Apr 2018 21:03:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Geq0xGiOP6K/wGw0UZcgUTQYq928g7w3lZONDnHAteFcnJbdqOHTxhtqSt9taxDRmFeyd X-Received: by 10.98.237.18 with SMTP id u18mr6268493pfh.78.1523505811255; Wed, 11 Apr 2018 21:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523505811; cv=none; d=google.com; s=arc-20160816; b=ko3b4ag/WYN+KE7hDHD0Cc9Liwpmxk9yyBn0Q7MRYFKoZN0+oQrK5HXcvmZlkNjLhJ lUUvncN9vtNIbTooS/8L6nDJDnC3iDpfVfRVkX08C4o2XXJI6ujro2IowtPl7VmaaGAO SIoJkB6M2jKy6ph0pYKkroii3jluPrHWbRnyDj7oPz4dUTm9t00oiHCrIlrmDmen0tml kJxK1enW6P1sdkTdWjuk/XMXSok9PkzfxSNePCXPJZpYizjkeMlxyejZ3PBjUJY5kpgV dDpI8HKx1LX29SAA3UQk4xENOIJ2tU8axc0Jx3KtnSXkwm0WykzLGLepMF63pnFRAbr1 1IQQ== 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=NS5iwODhCfacKfRX994p+gKOtE2Up09c+hSvzCE2k4U=; b=bQ+A2ksCUedp6Ynd0Y+FiN6HIqI6j2e3JAwtPy9BkDId3BfhiPpk2ohFlUw66VWV4c rRjOrZ3XbCj2tJKwnacn+/eaT1xlLT1OlD12syZTLeHrBcgqZJBSPcPE7NTGTwbqZKt7 Dnggkg7tnIl7j6K74+1pEwkNLmbY8tpvrYs9/sb0RtwTaVjd43MdxEw6zXMtCUJ+/G+l Cxe+fNdaJ7TBsYdLkm4VVJG7ZUC0D6W2Jzi0uIOCRqIzQhb9iZPrAZjgf2LOJ5QBUCDb ceQTztaLqMfSk6RhqieGkiU61pg9tOu7M6zmTDIQcbH62QUKVR8WVW68YdmgiOR7XQkT qHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VHfbNO9P; 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 o2-v6si2416237pls.161.2018.04.11.21.02.54; Wed, 11 Apr 2018 21:03:31 -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=VHfbNO9P; 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 S1752980AbeDLDzo (ORCPT + 99 others); Wed, 11 Apr 2018 23:55:44 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:16736 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912AbeDLDza (ORCPT ); Wed, 11 Apr 2018 23:55:30 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3C3tFwV005585; Wed, 11 Apr 2018 22:55:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1523505315; bh=SHwQ0Ukffqx8LCo5MRDC3DqQhHUwFviVW42Na8mfCMM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VHfbNO9PigDpHHNdr+mmtwNSuc+n0cVpy9mMnwSfjDRy+uEUCVLoXKw2fqXuxk/Lg t8yscF0UMY6W2/1ZeZPDVjRnB4FZkpBdAOw3ex3t3DdHAE3Phyd75MjD/SUPqXLk1n c5D5suerwISn6Em/ov/XInJPktA2q2rpyiZE6VoA= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3C3tEm2027272; Wed, 11 Apr 2018 22:55:14 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE100.ent.ti.com (10.64.6.21) 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:55:14 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE114.ent.ti.com (10.64.6.35) 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:55:14 -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 w3C3sQpt010150; Wed, 11 Apr 2018 22:55:11 -0500 From: Keerthy To: , , CC: , , , , , , , , Subject: [PATCH 12/14] OMAP: CLK: CLKSRC: Add suspend resume hooks Date: Thu, 12 Apr 2018 09:23:57 +0530 Message-ID: <1523505239-16229-13-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 Add the save and restore for clksrc as part of suspend and resume so that it saves the counter value and restores. This is needed in modes like rtc+ddr in self-refresh not doing this stalls the time. Signed-off-by: Keerthy --- arch/arm/mach-omap2/timer.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 4fb4dc2..35fef97 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c @@ -442,6 +442,38 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void) return ret; } +static unsigned int omap2_gptimer_clksrc_load; + +static void omap2_gptimer_clksrc_suspend(struct clocksource *unused) +{ + struct omap_hwmod *oh; + + omap2_gptimer_clksrc_load = + __omap_dm_timer_read_counter(&clksrc, OMAP_TIMER_NONPOSTED); + + oh = omap_hwmod_lookup(clocksource_gpt.name); + if (!oh) + return; + + omap_hwmod_idle(oh); +} + +static void omap2_gptimer_clksrc_resume(struct clocksource *unused) +{ + struct omap_hwmod *oh; + + oh = omap_hwmod_lookup(clocksource_gpt.name); + if (!oh) + return; + + omap_hwmod_enable(oh); + + __omap_dm_timer_load_start(&clksrc, + OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, + omap2_gptimer_clksrc_load, + OMAP_TIMER_NONPOSTED); +} + static void __init omap2_gptimer_clocksource_init(int gptimer_id, const char *fck_source, const char *property) @@ -451,6 +483,11 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id, clksrc.id = gptimer_id; clksrc.errata = omap_dm_timer_get_errata(); + if (soc_is_am43xx()) { + clocksource_gpt.suspend = omap2_gptimer_clksrc_suspend; + clocksource_gpt.resume = omap2_gptimer_clksrc_resume; + } + res = omap_dm_timer_init_one(&clksrc, fck_source, property, &clocksource_gpt.name, OMAP_TIMER_NONPOSTED); -- 1.9.1