From patchwork Mon Jul 6 10:54:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50719 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 65FAC218EA for ; Mon, 6 Jul 2015 10:58:14 +0000 (UTC) Received: by wguu7 with SMTP id u7sf48820400wgu.0 for ; Mon, 06 Jul 2015 03:58:13 -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=9VygXNDApi12mNPPT79/HnFTknv47bKcRl0COcj6cv4=; b=YuWPKO+1gHUSAVzzXSm384qEfaQ7x9Dl11hPM9obbfj98kI2iEMhVoFFgW3NwFjbKZ oez4LLfN0Vmy0fDtmEkI13CyXRW3OrbY2ISRlV4vbXZkgVWOF+6ZZJ6AFMw0lofk5y+o c4PsutLXLQiD45ZdEUMi2LXQvp4DZHeVn0nd17ykXmvJjLb+hNZCUknH+PxLdiuQeW6Z yWBM+B+tEbc9uM8LnRXw2UgqlOBoX1T+AqykyhYNnlj9MbYboJs4YgTNcKid7Gs7eTvA ZiyMJWR5el5EVgjRzm1IWUpsy9YLzj4f0b/PZh/m+CkbLs392ADfIP03TrK69TgEYoih xkrA== X-Gm-Message-State: ALoCoQmcUAf2rvurBBdkkXqpzlZJDnXMIXWQ9snjosu2SVHMprIb2FmalnDwLIikOv/8Iih3uiDM X-Received: by 10.180.36.242 with SMTP id t18mr1868770wij.3.1436180293752; Mon, 06 Jul 2015 03:58:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.224.162 with SMTP id rd2ls639503lac.84.gmail; Mon, 06 Jul 2015 03:58:13 -0700 (PDT) X-Received: by 10.112.48.68 with SMTP id j4mr47694104lbn.60.1436180293455; Mon, 06 Jul 2015 03:58:13 -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 zo2si14954522lbb.103.2015.07.06.03.58.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:58:13 -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 laar3 with SMTP id r3so150061830laa.0 for ; Mon, 06 Jul 2015 03:58:13 -0700 (PDT) X-Received: by 10.152.1.40 with SMTP id 8mr49429739laj.56.1436180293149; Mon, 06 Jul 2015 03:58:13 -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 hn6csp1643106lbb; Mon, 6 Jul 2015 03:58:12 -0700 (PDT) X-Received: by 10.66.66.197 with SMTP id h5mr106176421pat.29.1436180291495; Mon, 06 Jul 2015 03:58:11 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id cy7si28476254pdb.189.2015.07.06.03.58.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:58:11 -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 1ZC44y-0006Dk-5P; Mon, 06 Jul 2015 10:56:52 +0000 Received: from mail-pd0-f175.google.com ([209.85.192.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZC44U-0005Y9-Ax for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 10:56:22 +0000 Received: by pddu5 with SMTP id u5so16725221pdd.3 for ; Mon, 06 Jul 2015 03:56:01 -0700 (PDT) X-Received: by 10.68.251.35 with SMTP id zh3mr10751858pbc.166.1436180161406; Mon, 06 Jul 2015 03:56:01 -0700 (PDT) Received: from localhost ([122.171.186.190]) by mx.google.com with ESMTPSA id pz9sm17805454pbb.93.2015.07.06.03.55.59 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 03:56:00 -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 07/18] ARM/ixp4xx/timer: Migrate to new 'set-state' interface Date: Mon, 6 Jul 2015 16:24:14 +0530 Message-Id: <33e74a50c268fb18e80116443f603d1c205f1c0c.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_035622_413270_68FE8DD0 X-CRM114-Status: GOOD ( 14.97 ) 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.192.175 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.175 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] 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, Krzysztof Halasa , Thomas Gleixner , Imre Kaloz 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.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 Migrate ixp4xx 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. NOTE: ixp4xx_set_{oneshot|periodic} don't perform read operation on 'IXP4XX_OSRT1' register anymore. Cc: Imre Kaloz Cc: Krzysztof Halasa Signed-off-by: Viresh Kumar --- arch/arm/mach-ixp4xx/common.c | 68 +++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 8537d4c41e34..70773b948e7e 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -521,43 +521,55 @@ static int ixp4xx_set_next_event(unsigned long evt, return 0; } -static void ixp4xx_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int ixp4xx_shutdown(struct clock_event_device *evt) { unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK; unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK; - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK; - opts = IXP4XX_OST_ENABLE; - break; - case CLOCK_EVT_MODE_ONESHOT: - /* period set by 'set next_event' */ - osrt = 0; - opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT; - break; - case CLOCK_EVT_MODE_SHUTDOWN: - opts &= ~IXP4XX_OST_ENABLE; - break; - case CLOCK_EVT_MODE_RESUME: - opts |= IXP4XX_OST_ENABLE; - break; - case CLOCK_EVT_MODE_UNUSED: - default: - osrt = opts = 0; - break; - } + opts &= ~IXP4XX_OST_ENABLE; + *IXP4XX_OSRT1 = osrt | opts; + return 0; +} +static int ixp4xx_set_oneshot(struct clock_event_device *evt) +{ + unsigned long opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT; + unsigned long osrt = 0; + + /* period set by 'set next_event' */ *IXP4XX_OSRT1 = osrt | opts; + return 0; +} + +static int ixp4xx_set_periodic(struct clock_event_device *evt) +{ + unsigned long opts = IXP4XX_OST_ENABLE; + unsigned long osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK; + + *IXP4XX_OSRT1 = osrt | opts; + return 0; +} + +static int ixp4xx_resume(struct clock_event_device *evt) +{ + unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK; + unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK; + + opts |= IXP4XX_OST_ENABLE; + *IXP4XX_OSRT1 = osrt | opts; + return 0; } static struct clock_event_device clockevent_ixp4xx = { - .name = "ixp4xx timer1", - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .rating = 200, - .set_mode = ixp4xx_set_mode, - .set_next_event = ixp4xx_set_next_event, + .name = "ixp4xx timer1", + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .rating = 200, + .set_state_shutdown = ixp4xx_shutdown, + .set_state_periodic = ixp4xx_set_periodic, + .set_state_oneshot = ixp4xx_set_oneshot, + .tick_resume = ixp4xx_resume, + .set_next_event = ixp4xx_set_next_event, }; static void __init ixp4xx_clockevent_init(void)