From patchwork Fri Jul 17 05:11:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51214 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BAECB22A28 for ; Fri, 17 Jul 2015 05:12:26 +0000 (UTC) Received: by lbvb1 with SMTP id b1sf22818114lbv.3 for ; Thu, 16 Jul 2015 22:12:25 -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:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:mime-version :content-type:content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=zKQMl8q0QGMvh3PVqRSWiBdunguI57slkXOpNJD/ZNA=; b=QBo58ZqqRnnBdv/aiNsQRBOMgpE8QmMJROC3mJopH9X/P24GVizy4N0vn9CwgsTBM6 wMM059UKf5RECq0Q+2dq2aGoNh8FJQTfVlLorWMHdrlYjdbZaepe3FBGOjs0M4yiJDmh LIXwG/4SPembtAQBCGr7bnrlramt3aF5AHfezeNSMabNNB23Rfv6j0t4u8XDsFm/ooPh N780JywLFGroZ3p/VTR1iFQqFcIU3jAnQtwq0KuFAKHT/LiKVQP54IskfRgLRuvnjdbX iEF8+4UDfrYI09IwBRKPl7hUHTvXbwRZbflqWRsHKySWTQq5+FVvWbHgDzRcyN9bgz/f nEJA== X-Gm-Message-State: ALoCoQk5LKFtKR1wsbzLtOrspuIhiGquoBhUapOv9oOuPoa20gVMFwRuFChJnr8KoMq3yulP/cjL X-Received: by 10.113.11.3 with SMTP id ee3mr6561829lbd.9.1437109945723; Thu, 16 Jul 2015 22:12:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.232 with SMTP id d8ls461646lab.13.gmail; Thu, 16 Jul 2015 22:12:25 -0700 (PDT) X-Received: by 10.152.21.5 with SMTP id r5mr5011138lae.107.1437109945409; Thu, 16 Jul 2015 22:12:25 -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 l1si8852405lbj.175.2015.07.16.22.12.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:12:25 -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 lbbzr7 with SMTP id zr7so55249983lbb.1 for ; Thu, 16 Jul 2015 22:12:25 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr12382426lbc.41.1437109945281; Thu, 16 Jul 2015 22:12:25 -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 hn6csp668334lbb; Thu, 16 Jul 2015 22:12:24 -0700 (PDT) X-Received: by 10.66.63.99 with SMTP id f3mr26231478pas.6.1437109938270; Thu, 16 Jul 2015 22:12:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nm5si16574979pbc.166.2015.07.16.22.12.17; Thu, 16 Jul 2015 22:12:18 -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 S1756634AbbGQFMK (ORCPT + 28 others); Fri, 17 Jul 2015 01:12:10 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:36344 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756537AbbGQFMG (ORCPT ); Fri, 17 Jul 2015 01:12:06 -0400 Received: by pdjr16 with SMTP id r16so56299678pdj.3 for ; Thu, 16 Jul 2015 22:12:06 -0700 (PDT) X-Received: by 10.70.37.144 with SMTP id y16mr25698320pdj.86.1437109926118; Thu, 16 Jul 2015 22:12:06 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id w9sm9652323pbs.82.2015.07.16.22.12.04 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:12:05 -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 , Imre Kaloz , =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= , linux-kernel@vger.kernel.org (open list), Russell King Subject: [PATCH 07/18] ARM/ixp4xx/timer: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:41:01 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 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 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 Acked-by: Krzysztof HaƂasa 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)