From patchwork Fri Jul 17 05:11:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51218 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8652322A28 for ; Fri, 17 Jul 2015 05:13:06 +0000 (UTC) Received: by lbbvz8 with SMTP id vz8sf22878846lbb.2 for ; Thu, 16 Jul 2015 22:13:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=mQQ0pEO9mXQvj9uA3SRCV0vX9V70+krC4UKLq33XiA0=; b=kEK6v1IqEnbzV8yMG+8HwoIk0pAX6kf+r70wkKi4xtQNbG9FjHsG/SW9s4OjYseRtY qmfVjOmcuZdEcvauUtilhB6bc4mAXB60xketeB6i5fB2+yy8r8xHDh2Wn1YAa9ezlErR ceAOmrpJ8D4/mfcugYl8QjwqTjDKpsoDLGGrBNwzaJM8q2h6noD0I0vi4D6Hq+S8OxXq 76pqCrz3KVMSk4YF6AZ2y4G78Ei1oZia1NpSpLbdhHDpFTf5F3SCndWFjXGY770MNmY/ BJuqLdJygARYWRpcuDWiNBuwTqDjxza/vU9/V3Ni4Q+QSBLt7Mu6+FRg0VkH+ggzOmCY xIEg== X-Gm-Message-State: ALoCoQlXuyOWRPNlOBnej5mc1pNH3Xqw4m4cKgQIELn7wRTnbajwMHl/eUda1zrikwh7C7NmPOAT X-Received: by 10.152.6.103 with SMTP id z7mr6617054laz.8.1437109985547; Thu, 16 Jul 2015 22:13:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.1 with SMTP id o1ls478489lao.12.gmail; Thu, 16 Jul 2015 22:13:05 -0700 (PDT) X-Received: by 10.152.6.130 with SMTP id b2mr13032856laa.78.1437109985308; Thu, 16 Jul 2015 22:13:05 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id g10si8844753laf.177.2015.07.16.22.13.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:13:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lagx9 with SMTP id x9so55005743lag.1 for ; Thu, 16 Jul 2015 22:13:05 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr13000615laf.32.1437109985211; Thu, 16 Jul 2015 22:13:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp668556lbb; Thu, 16 Jul 2015 22:13:04 -0700 (PDT) X-Received: by 10.66.100.233 with SMTP id fb9mr25299389pab.128.1437109981863; Thu, 16 Jul 2015 22:13:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dn2si16701042pdb.54.2015.07.16.22.13.00; Thu, 16 Jul 2015 22:13:01 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756824AbbGQFMd (ORCPT + 28 others); Fri, 17 Jul 2015 01:12:33 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:34710 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962AbbGQFM2 (ORCPT ); Fri, 17 Jul 2015 01:12:28 -0400 Received: by pdbbh15 with SMTP id bh15so10301650pdb.1 for ; Thu, 16 Jul 2015 22:12:27 -0700 (PDT) X-Received: by 10.66.66.172 with SMTP id g12mr25785393pat.74.1437109947892; Thu, 16 Jul 2015 22:12:27 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id im7sm9698636pbc.25.2015.07.16.22.12.26 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:12:27 -0700 (PDT) From: Viresh Kumar To: arm@kernel.org, olof@lixom.net Cc: linaro-kernel@lists.linaro.org, arnd.bergmann@linaro.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 11/18] ARM/netx/time: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:41:05 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Migrate netx driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED. We aren't writing zero twice on the control register for shutdown or resume state now. Cc: Russell King Signed-off-by: Viresh Kumar --- arch/arm/mach-netx/time.c | 61 +++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c index 5fb2a590ec17..054a8a61e379 100644 --- a/arch/arm/mach-netx/time.c +++ b/arch/arm/mach-netx/time.c @@ -34,40 +34,40 @@ #define TIMER_CLOCKEVENT 0 #define TIMER_CLOCKSOURCE 1 -static void netx_set_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static inline void timer_shutdown(struct clock_event_device *evt) { - u32 tmode; - /* disable timer */ writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); +} + +static int netx_shutdown(struct clock_event_device *evt) +{ + timer_shutdown(evt); + + return 0; +} + +static int netx_set_oneshot(struct clock_event_device *evt) +{ + u32 tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN; + + timer_shutdown(evt); + writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT)); + writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT)); - tmode = NETX_GPIO_COUNTER_CTRL_RST_EN | - NETX_GPIO_COUNTER_CTRL_IRQ_EN | - NETX_GPIO_COUNTER_CTRL_RUN; - break; - - case CLOCK_EVT_MODE_ONESHOT: - writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT)); - tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN | - NETX_GPIO_COUNTER_CTRL_RUN; - break; - - default: - WARN(1, "%s: unhandled mode %d\n", __func__, mode); - /* fall through */ - - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_RESUME: - tmode = 0; - break; - } + return 0; +} +static int netx_set_periodic(struct clock_event_device *evt) +{ + u32 tmode = NETX_GPIO_COUNTER_CTRL_RST_EN | + NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN; + + timer_shutdown(evt); + writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT)); writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); + + return 0; } static int netx_set_next_event(unsigned long evt, @@ -81,7 +81,10 @@ static struct clock_event_device netx_clockevent = { .name = "netx-timer" __stringify(TIMER_CLOCKEVENT), .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, .set_next_event = netx_set_next_event, - .set_mode = netx_set_mode, + .set_state_shutdown = netx_shutdown, + .set_state_periodic = netx_set_periodic, + .set_state_oneshot = netx_set_oneshot, + .tick_resume = netx_shutdown, }; /*