From patchwork Mon Jul 6 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: 50720 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 25BC9218EA for ; Mon, 6 Jul 2015 10:58:20 +0000 (UTC) Received: by wipp2 with SMTP id p2sf30592060wip.2 for ; Mon, 06 Jul 2015 03:58:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:in-reply-to:references:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe:cc :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list; bh=cbTpJnDp7XhtBG4uvKXnr0QgLDpY09s2NulmaNd2Im8=; b=Uqolo/yiY6USqWBr/gsM40FbwcAbRyAgXZR5UfXcrr4LvKwgYuQXJLM7y6eRH81WCT 3ryEBNxvaSQItuVYS64EXc9eOdqBMj5l4cJ7A+qaD8WYqzWq+B1UjKwAn2R28R9CKvqJ jTR17CG745Gx8pbofhFC61gYvsN6FSo9pXD7HCX+M7ZtF5FYYlVoEIQTMvS/GwSR7n1k ysCzkkJcZqdB//+dJD5NICjauESpwJah6DbA8p9GJ92594Zayyl9FncFVhx/tIxKKAvx xDn4MOAexHEy+2rf6s+6LO6DJpifWRtvbm4hWIxkKB8ckyIc+0S42Hfc0+mHiS/QGkdb j/fg== X-Gm-Message-State: ALoCoQltctO+qgedUSoU9ecndvVI9Hgd83vjYyZI2bxZFHBj9CT5dsvlicyDDih4ocEmg61Q2Zxu X-Received: by 10.112.85.69 with SMTP id f5mr30244696lbz.23.1436180299433; Mon, 06 Jul 2015 03:58:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.38 with SMTP id lt6ls689058lac.50.gmail; Mon, 06 Jul 2015 03:58:19 -0700 (PDT) X-Received: by 10.152.1.40 with SMTP id 8mr49430096laj.56.1436180299163; Mon, 06 Jul 2015 03:58:19 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id dx9si14935395lac.160.2015.07.06.03.58.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lazt12 with SMTP id t12so4717815laz.2 for ; Mon, 06 Jul 2015 03:58:19 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr49360698lal.35.1436180299058; Mon, 06 Jul 2015 03:58:19 -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 hn6csp1643157lbb; Mon, 6 Jul 2015 03:58:17 -0700 (PDT) X-Received: by 10.66.66.202 with SMTP id h10mr103617544pat.145.1436180297217; Mon, 06 Jul 2015 03:58:17 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id am4si28516402pad.93.2015.07.06.03.58.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZC457-0006OH-5t; Mon, 06 Jul 2015 10:57:01 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZC44Z-0005aK-07 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 10:56:27 +0000 Received: by pactm7 with SMTP id tm7so93858930pac.2 for ; Mon, 06 Jul 2015 03:56:06 -0700 (PDT) X-Received: by 10.68.69.6 with SMTP id a6mr2612834pbu.132.1436180166403; Mon, 06 Jul 2015 03:56:06 -0700 (PDT) Received: from localhost ([122.171.186.190]) by mx.google.com with ESMTPSA id fr2sm17852966pdb.22.2015.07.06.03.56.04 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 03:56:05 -0700 (PDT) From: Viresh Kumar To: linux-arm-kernel@lists.infradead.org, Daniel Lezcano , linux@arm.linux.org.uk, arnd.bergmann@linaro.org, olof@lixom.net Subject: [PATCH 08/18] ARM/ks8695/time: Migrate to new 'set-state' interface Date: Mon, 6 Jul 2015 16:24:15 +0530 Message-Id: <71a71657890f6b0aca50fd90f877668ccd796c1f.1436178990.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150706_035627_072059_21C5439B X-CRM114-Status: GOOD ( 15.76 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.54 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.220.54 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: linaro-kernel@lists.linaro.org, Kevin Hilman , Viresh Kumar , arm@kernel.org, Greg Ungerer , Thomas Gleixner MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.43 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 Migrate ks8695 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. There is nothing to be done for oneshot or shutdown states and so are not implemented. Cc: Greg Ungerer Signed-off-by: Viresh Kumar --- arch/arm/mach-ks8695/time.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c index a197874bf382..18eb0fbd8d82 100644 --- a/arch/arm/mach-ks8695/time.c +++ b/arch/arm/mach-ks8695/time.c @@ -54,28 +54,25 @@ /* Timer0 Timeout Counter Register */ #define T0TC_WATCHDOG (0xff) /* Enable watchdog mode */ -static void ks8695_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int ks8695_set_periodic(struct clock_event_device *evt) { + u32 rate = DIV_ROUND_CLOSEST(KS8695_CLOCK_RATE, HZ); + u32 half = DIV_ROUND_CLOSEST(rate, 2); u32 tmcon; - if (mode == CLOCK_EVT_FEAT_PERIODIC) { - u32 rate = DIV_ROUND_CLOSEST(KS8695_CLOCK_RATE, HZ); - u32 half = DIV_ROUND_CLOSEST(rate, 2); - - /* Disable timer 1 */ - tmcon = readl_relaxed(KS8695_TMR_VA + KS8695_TMCON); - tmcon &= ~TMCON_T1EN; - writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); + /* Disable timer 1 */ + tmcon = readl_relaxed(KS8695_TMR_VA + KS8695_TMCON); + tmcon &= ~TMCON_T1EN; + writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); - /* Both registers need to count down */ - writel_relaxed(half, KS8695_TMR_VA + KS8695_T1TC); - writel_relaxed(half, KS8695_TMR_VA + KS8695_T1PD); + /* Both registers need to count down */ + writel_relaxed(half, KS8695_TMR_VA + KS8695_T1TC); + writel_relaxed(half, KS8695_TMR_VA + KS8695_T1PD); - /* Re-enable timer1 */ - tmcon |= TMCON_T1EN; - writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); - } + /* Re-enable timer1 */ + tmcon |= TMCON_T1EN; + writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); + return 0; } static int ks8695_set_next_event(unsigned long cycles, @@ -102,11 +99,13 @@ static int ks8695_set_next_event(unsigned long cycles, } static struct clock_event_device clockevent_ks8695 = { - .name = "ks8695_t1tc", - .rating = 300, /* Reasonably fast and accurate clock event */ - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .set_next_event = ks8695_set_next_event, - .set_mode = ks8695_set_mode, + .name = "ks8695_t1tc", + /* Reasonably fast and accurate clock event */ + .rating = 300, + .features = CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_PERIODIC, + .set_next_event = ks8695_set_next_event, + .set_state_periodic = ks8695_set_periodic, }; /*