From patchwork Thu Jun 18 10:54:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50001 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 65C5A228CC for ; Thu, 18 Jun 2015 10:55:52 +0000 (UTC) Received: by labsp1 with SMTP id sp1sf20485510lab.3 for ; Thu, 18 Jun 2015 03:55:51 -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=ZCpXzJetz+fPV+58NIdtaJGg2/H227qVlvRnmdeCS0U=; b=k52ETM8RxCqGmElQMkMz/G7Jhmw9QHnJW+ZE0pu5xpQrdslSChXISey6MimsOJEvz6 ojb04RKO6pTQ11guEFGRNyDL6/R/j0JoGqEsDGOXll4pESzv3C1z2IVwhwRb5/NaR7BV nw5peBqdLofkoROwdSAFy0NRwknlAEj1/gRKS8gUpOoLiBM2eQggQKQpmXpOpeIu4iTg OUnpn3wnedASfNNQn6tUjSeFuWxfEPBBuaTk/rzDQqA8VX2SEon5weXQxgo93SVJ784J tQSKxGyGOY5L6CqkZqbZsj6uboLzQRK4CaYrVZOyQ7E5dfFeO3zWczgiGJiPemkRCub8 2O8g== X-Gm-Message-State: ALoCoQmmoe1gaSx0ZUckMQXmTy5adi4jORRgOAxzDCvcT2WPP0QdMXucX3hBBAHz2Oj3OM5FVWJp X-Received: by 10.112.55.104 with SMTP id r8mr9474376lbp.18.1434624951394; Thu, 18 Jun 2015 03:55:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.161 with SMTP id jp1ls410549lab.96.gmail; Thu, 18 Jun 2015 03:55:51 -0700 (PDT) X-Received: by 10.152.7.65 with SMTP id h1mr12445267laa.33.1434624951217; Thu, 18 Jun 2015 03:55:51 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id dw10si6182381lbd.67.2015.06.18.03.55.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:55:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbti3 with SMTP id ti3so49705775lbb.1 for ; Thu, 18 Jun 2015 03:55:51 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr7163060lbb.35.1434624951120; Thu, 18 Jun 2015 03:55:51 -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 hn6csp1094534lbb; Thu, 18 Jun 2015 03:55:50 -0700 (PDT) X-Received: by 10.68.69.48 with SMTP id b16mr20004381pbu.144.1434624948769; Thu, 18 Jun 2015 03:55:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ho8si309867pbc.209.2015.06.18.03.55.46; Thu, 18 Jun 2015 03:55:48 -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 S932114AbbFRKzc (ORCPT + 30 others); Thu, 18 Jun 2015 06:55:32 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:34577 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754139AbbFRKzI (ORCPT ); Thu, 18 Jun 2015 06:55:08 -0400 Received: by pdbki1 with SMTP id ki1so64217864pdb.1 for ; Thu, 18 Jun 2015 03:55:07 -0700 (PDT) X-Received: by 10.68.136.42 with SMTP id px10mr20317975pbb.19.1434624907334; Thu, 18 Jun 2015 03:55:07 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id jd4sm7638538pbd.46.2015.06.18.03.55.06 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:55:06 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Oleksij Rempel Subject: [PATCH 01/41] clocksource: asm9260: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:15 +0530 Message-Id: <57ae9434bbb7218961c3ad45a26fbe1fffe40cbd.1434622147.git.viresh.kumar@linaro.org> 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.217.182 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 asm9260 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. Cc: Oleksij Rempel Signed-off-by: Viresh Kumar --- drivers/clocksource/asm9260_timer.c | 61 ++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c index 4c2ba59897e8..67ff6f2abf19 100644 --- a/drivers/clocksource/asm9260_timer.c +++ b/drivers/clocksource/asm9260_timer.c @@ -120,38 +120,49 @@ static int asm9260_timer_set_next_event(unsigned long delta, return 0; } -static void asm9260_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int asm9260_timer_shutdown(struct clock_event_device *evt) { /* stop timer0 */ writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + return 0; +} + +static int asm9260_timer_set_oneshot(struct clock_event_device *evt) +{ + /* stop timer0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + + /* enable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + SET_REG); + return 0; +} - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* disable reset and stop on match */ - writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), - priv.base + HW_MCR + CLR_REG); - /* configure match count for TC0 */ - writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); - /* enable TC0 */ - writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); - break; - case CLOCK_EVT_MODE_ONESHOT: - /* enable reset and stop on match */ - writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), - priv.base + HW_MCR + SET_REG); - break; - default: - break; - } +static int asm9260_timer_set_periodic(struct clock_event_device *evt) +{ + /* stop timer0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); + + /* disable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + CLR_REG); + /* configure match count for TC0 */ + writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + return 0; } static struct clock_event_device event_dev = { - .name = DRIVER_NAME, - .rating = 200, - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_next_event = asm9260_timer_set_next_event, - .set_mode = asm9260_timer_set_mode, + .name = DRIVER_NAME, + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = asm9260_timer_set_next_event, + .set_state_shutdown = asm9260_timer_shutdown, + .set_state_periodic = asm9260_timer_set_periodic, + .set_state_oneshot = asm9260_timer_set_oneshot, + .tick_resume = asm9260_timer_shutdown, }; static irqreturn_t asm9260_timer_interrupt(int irq, void *dev_id)