From patchwork Mon Jul 6 10:54:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50728 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3080E218EA for ; Mon, 6 Jul 2015 11:00:20 +0000 (UTC) Received: by wipp2 with SMTP id p2sf30610351wip.2 for ; Mon, 06 Jul 2015 04:00: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=VHuBwM18dbPXoLFan9KMF0N1djeIyru9d4PQPbyQ2iQ=; b=NKs4HSE1Ot9E+ShKNmWlB813CqKm34rH6WRSrhZZGyxwIovpOVIHQsL0epQmu4cVbW LwQdJIwSGflp02zHE9PBG6cZEJzDIwW0c4zZphjvuI8O95aEW8EEGt5K2TiqWuv1nFwE mn9D8yS9Q600NkPrD5XnhcNW5jH2Un5VEzpmFrMwSG23GKrceaa9dy3r9GO7xSAcxLKi Wsjnp7S+0aNEBdR3HFgDBe9AzFRDv2Al9GYeIg/e3OlGLCGIh7XId/7ILY3UKjyyjIlb l+z7x3U77QpQXfge4xhl8TnjqIUgerGmDTam8AnmSBBVikwM82QK9Bmm5eOrgdfORKC9 aeAQ== X-Gm-Message-State: ALoCoQnoSC6V1eiRUXdOCiAEaQG9qZBzqRTbu/h8m6l81jrZJKbGVPhxLaVW7ilgHKpV835Z8Q4q X-Received: by 10.180.105.226 with SMTP id gp2mr28081885wib.1.1436180419532; Mon, 06 Jul 2015 04:00:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.230 with SMTP id y6ls727168lae.20.gmail; Mon, 06 Jul 2015 04:00:19 -0700 (PDT) X-Received: by 10.153.7.133 with SMTP id dc5mr48270194lad.17.1436180419250; Mon, 06 Jul 2015 04:00:19 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id jo7si14939892lab.155.2015.07.06.04.00.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 04:00:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagc2 with SMTP id c2so149844732lag.3 for ; Mon, 06 Jul 2015 04:00:19 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr28599305lbb.29.1436180418862; Mon, 06 Jul 2015 04:00:18 -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 hn6csp1644236lbb; Mon, 6 Jul 2015 04:00:17 -0700 (PDT) X-Received: by 10.67.7.199 with SMTP id de7mr102557467pad.107.1436180417822; Mon, 06 Jul 2015 04:00:17 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id bk7si28545410pdb.11.2015.07.06.04.00.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 04:00: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 1ZC46Z-0000Pc-0U; Mon, 06 Jul 2015 10:58:31 +0000 Received: from mail-pa0-f51.google.com ([209.85.220.51]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZC45D-00068h-8h for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 10:57:07 +0000 Received: by pacgz10 with SMTP id gz10so20068258pac.3 for ; Mon, 06 Jul 2015 03:56:46 -0700 (PDT) X-Received: by 10.70.118.73 with SMTP id kk9mr105342193pdb.150.1436180206702; Mon, 06 Jul 2015 03:56:46 -0700 (PDT) Received: from localhost ([122.171.186.190]) by mx.google.com with ESMTPSA id pj4sm17829438pbb.29.2015.07.06.03.56.44 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 03:56:45 -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 16/18] ARM/w90x900/time: Migrate to new 'set-state' interface Date: Mon, 6 Jul 2015 16:24:23 +0530 Message-Id: <284231e6d982e4f71f64aa24a6b26e1b02216f6e.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_035707_353814_56CA5A2F X-CRM114-Status: GOOD ( 14.19 ) 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.51 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.51 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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, Wan ZongShun , Viresh Kumar , arm@kernel.org, Thomas Gleixner , Kevin Hilman 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.45 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 w90x900 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: Wan ZongShun Signed-off-by: Viresh Kumar --- arch/arm/mach-w90x900/time.c | 51 ++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c index 9230d3725599..cd1966ec9143 100644 --- a/arch/arm/mach-w90x900/time.c +++ b/arch/arm/mach-w90x900/time.c @@ -48,31 +48,32 @@ static unsigned int timer0_load; -static void nuc900_clockevent_setmode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int nuc900_clockevent_shutdown(struct clock_event_device *evt) { - unsigned int val; + unsigned int val = __raw_readl(REG_TCSR0) & ~(0x03 << 27); - val = __raw_readl(REG_TCSR0); - val &= ~(0x03 << 27); + __raw_writel(val, REG_TCSR0); + return 0; +} + +static int nuc900_clockevent_set_oneshot(struct clock_event_device *evt) +{ + unsigned int val = __raw_readl(REG_TCSR0) & ~(0x03 << 27); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - __raw_writel(timer0_load, REG_TICR0); - val |= (PERIOD | COUNTEN | INTEN | PRESCALE); - break; + val |= (ONESHOT | COUNTEN | INTEN | PRESCALE); - case CLOCK_EVT_MODE_ONESHOT: - val |= (ONESHOT | COUNTEN | INTEN | PRESCALE); - break; + __raw_writel(val, REG_TCSR0); + return 0; +} - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_RESUME: - break; - } +static int nuc900_clockevent_set_periodic(struct clock_event_device *evt) +{ + unsigned int val = __raw_readl(REG_TCSR0) & ~(0x03 << 27); + __raw_writel(timer0_load, REG_TICR0); + val |= (PERIOD | COUNTEN | INTEN | PRESCALE); __raw_writel(val, REG_TCSR0); + return 0; } static int nuc900_clockevent_setnextevent(unsigned long evt, @@ -90,11 +91,15 @@ static int nuc900_clockevent_setnextevent(unsigned long evt, } static struct clock_event_device nuc900_clockevent_device = { - .name = "nuc900-timer0", - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = nuc900_clockevent_setmode, - .set_next_event = nuc900_clockevent_setnextevent, - .rating = 300, + .name = "nuc900-timer0", + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_state_shutdown = nuc900_clockevent_shutdown, + .set_state_periodic = nuc900_clockevent_set_periodic, + .set_state_oneshot = nuc900_clockevent_set_oneshot, + .tick_resume = nuc900_clockevent_shutdown, + .set_next_event = nuc900_clockevent_setnextevent, + .rating = 300, }; /*IRQ handler for the timer*/