From patchwork Wed Mar 29 01:57:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gerlach X-Patchwork-Id: 9650825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1183660349 for ; Wed, 29 Mar 2017 02:05:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 007F0284DC for ; Wed, 29 Mar 2017 02:05:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E81D4284DE; Wed, 29 Mar 2017 02:05:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9ACF1284DC for ; Wed, 29 Mar 2017 02:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cwggz7ZnszIdHews90xyKsYfvl3i7WCfNcg7X8k/yEY=; b=e3JjoPCznrJvrC 3Wu5ZVxCFEsudWNcKJjbYreWhrwPdMbnrLoat0RSFbcbxKbkhOZUi7hUMuHTYV2H0/bEUF09qjhxy 8lKba/MUHS1qQ5lAMDjv8rCvkbnb8HuMEQ9livmaMV9t0r1CvOK4WffYTu9kOal/iO5H8oRfiW0/D pSJcYfw9C89P8avOksJ+21hRRvkqmtgyJ3RJsvdvVx3p+F8tthCqkvnygpKO7Uzdg0X0wOumIEwWU wXBernRaaGqWcGxVsnq9aGHPIC6/Z/bgXWzhFFo/xjYnQOUMPJpCrDcYh8WwjoDtkA1DyNss+kK88 6sXrLsuDyMikJIxxEodQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ct2ze-0003gr-UA; Wed, 29 Mar 2017 02:05:50 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ct2wu-0001GP-Fp for linux-arm-kernel@bombadil.infradead.org; Wed, 29 Mar 2017 02:03:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HvUpeAJhhovAhHi/QANVNgXfURnBX/tzzOWOV1Wk48k=; b=d5EZsOnH5KWBJnUVWm9hI7sM0 68KhxQ0pIQmjEoOI5HwPl0BTFPnAJvW8R7/P/VlMlHIAkHYWSYU48BXyQMvJZmHyPJEHfvqzV7ksO IoJkCXgrU2ts0uQcOSKfya6iOaN6rnV/R8x8QIX4XZlbw3NH/rN5I+2QcJHlZIG1Jw713jzdI5/i0 AEYk2efve7vV0LCE5Xkfdp/F1yg06TRoPZG/mhKt9xrfhbBLMpI0kQFmSdmpMXMXaiR/F5C0LV79j FzFsgFWBKVLXvLwpKSqqmVv5U0XajBzsYmDYquFcaZqs8nZ1XxxI5ZzwCXPpurhD8AsBBeHZO9TrY ZBJ/NpCxA==; Received: from fllnx210.ext.ti.com ([198.47.19.17]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ct2tB-0000jz-Oh for linux-arm-kernel@lists.infradead.org; Wed, 29 Mar 2017 01:59:15 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v2T1wOPB016449; Tue, 28 Mar 2017 20:58:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1490752704; bh=JrRrA3Fd7UI0FaeRTcufOvUCnFaRZCzGdybzd4uTd8o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wUZ9ReHnvMfTRRNJQeK5mRVR8gs0ZNe7sODuF8nlNU28HzPGfgXDZ5Zr5LN4dFTdF CPTBtumOX2WUZ5D9ArDLtwFTDhc+aR3lvOYu6Po1xOWl7SSorRJwDDP8RI/qUJvM14 ptFzIYXvNs4nbq75bmXJ96jVlSEg1diB3E0JmHzs= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2T1wOoU029917; Tue, 28 Mar 2017 20:58:24 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Tue, 28 Mar 2017 20:58:24 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v2T1wOkE011327; Tue, 28 Mar 2017 20:58:24 -0500 Received: from localhost (uda0274052.am.dhcp.ti.com [128.247.83.19]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v2T1wN315416; Tue, 28 Mar 2017 20:58:23 -0500 (CDT) From: Dave Gerlach To: Tony Lindgren , Santosh Shilimkar , Russell King Subject: [PATCH 2/8] ARM: OMAP2+: timer: Add suspend-resume callbacks for clkevent device Date: Tue, 28 Mar 2017 20:57:55 -0500 Message-ID: <20170329015801.22240-3-d-gerlach@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170329015801.22240-1-d-gerlach@ti.com> References: <20170329015801.22240-1-d-gerlach@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170329_025910_124249_138C7E8B X-CRM114-Status: GOOD ( 13.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keerthy J , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dave Gerlach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP OMAP timer code registers two timers - one as clocksource and one as clockevent. Since AM33XX has only one usable timer in the WKUP domain one of the timers needs suspend-resume support to restore the configuration to pre-suspend state. commit adc78e6b9946 ("timekeeping: Add suspend and resume of clock event devices") introduced .suspend and .resume callbacks for clock event devices. Leverage these callbacks to have AM33XX clockevent timer behave properly across system suspend. Extend the use of the .suspend and .resume callbacks used by am335x clockevent to am437x as well. Signed-off-by: Dave Gerlach --- arch/arm/mach-omap2/timer.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 07dd692c4737..70670dfd7135 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c @@ -68,6 +68,9 @@ static struct omap_dm_timer clkev; static struct clock_event_device clockevent_gpt; +/* Clockevent hwmod for am335x and am437x suspend */ +static struct omap_hwmod *clockevent_gpt_hwmod; + #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER static unsigned long arch_timer_freq; @@ -125,6 +128,23 @@ static int omap2_gp_timer_set_periodic(struct clock_event_device *evt) return 0; } +static void omap_clkevt_idle(struct clock_event_device *unused) +{ + if (!clockevent_gpt_hwmod) + return; + + omap_hwmod_idle(clockevent_gpt_hwmod); +} + +static void omap_clkevt_unidle(struct clock_event_device *unused) +{ + if (!clockevent_gpt_hwmod) + return; + + omap_hwmod_enable(clockevent_gpt_hwmod); + __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); +} + static struct clock_event_device clockevent_gpt = { .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, @@ -358,6 +378,14 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, 3, /* Timer internal resynch latency */ 0xffffffff); + if (soc_is_am33xx() || soc_is_am43xx()) { + clockevent_gpt.suspend = omap_clkevt_idle; + clockevent_gpt.resume = omap_clkevt_unidle; + + clockevent_gpt_hwmod = + omap_hwmod_lookup(clockevent_gpt.name); + } + pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name, clkev.rate); }