From patchwork Fri Jul 17 05:10:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51212 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 01A6022A28 for ; Fri, 17 Jul 2015 05:12:21 +0000 (UTC) Received: by wgwk7 with SMTP id k7sf23442262wgw.0 for ; Thu, 16 Jul 2015 22:12:20 -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=fa3LjiNsrus3NZVXXX4tNZlSdqe47++4atPTuFqAGbM=; b=l5UR+vn73vQ5eXJ8D7YIvmvcns+kT7pDD996PkOK7VfDvTJUNYZ/DZUdZJ5ra0Gz0v AmVLLk4ofjTs9RVQBG8Sp/evP/KgA4Kz3ygcpJYecFRgQs5V0mpM+cL+l9nj2F3QbIvt 7QIR1CaDfbjWygCj8Z1/qk50poy6yJBrUfN9JR/oXZInsW8oFz+AtO/5JAUavcGtOfMl tXKcMHzJokQuz5gqQ56UeOLCg6LMd/87wcbTADAdR4YePaInwCbDC136igtOUe3a9U1f vmRumO/z8P1XpNwo1u19h40TT5i+vRbIjXFgcQRFPeAEG+7mXowXJVVhX0F+tKey5i6R i3eQ== X-Gm-Message-State: ALoCoQmxiBWs9/FYNuksjCHb9zsjPFDcJaKxH2/JLlQVcJ57H2XfVFoA4fkvuZQSCqapxXptwmMd X-Received: by 10.112.188.233 with SMTP id gd9mr6723347lbc.12.1437109940233; Thu, 16 Jul 2015 22:12:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.168 with SMTP id kz8ls387692lac.105.gmail; Thu, 16 Jul 2015 22:12:20 -0700 (PDT) X-Received: by 10.152.116.39 with SMTP id jt7mr12558531lab.82.1437109940058; Thu, 16 Jul 2015 22:12:20 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id p8si8893554laf.10.2015.07.16.22.12.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbyj8 with SMTP id yj8so55227614lbb.0 for ; Thu, 16 Jul 2015 22:12:20 -0700 (PDT) X-Received: by 10.152.5.197 with SMTP id u5mr11626578lau.76.1437109939939; Thu, 16 Jul 2015 22:12: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 hn6csp668303lbb; Thu, 16 Jul 2015 22:12:18 -0700 (PDT) X-Received: by 10.70.91.12 with SMTP id ca12mr4858824pdb.135.1437109936190; Thu, 16 Jul 2015 22:12:16 -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.15; Thu, 16 Jul 2015 22:12:16 -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 S1756320AbbGQFMC (ORCPT + 28 others); Fri, 17 Jul 2015 01:12:02 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:35261 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755714AbbGQFL6 (ORCPT ); Fri, 17 Jul 2015 01:11:58 -0400 Received: by pdrg1 with SMTP id g1so55666934pdr.2 for ; Thu, 16 Jul 2015 22:11:58 -0700 (PDT) X-Received: by 10.70.129.102 with SMTP id nv6mr25928803pdb.55.1437109918252; Thu, 16 Jul 2015 22:11:58 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id w9sm9651857pbs.82.2015.07.16.22.11.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:11:57 -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 , Hans Ulli Kroll , linux-kernel@vger.kernel.org (open list), Russell King Subject: [PATCH 05/18] ARM/gemini/time: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:40:59 +0530 Message-Id: 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.176 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 gemini 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. Acked-by: Hans Ulli Kroll Signed-off-by: Viresh Kumar --- arch/arm/mach-gemini/time.c | 69 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-gemini/time.c b/arch/arm/mach-gemini/time.c index 0a63c4d25b64..b57d367d21f1 100644 --- a/arch/arm/mach-gemini/time.c +++ b/arch/arm/mach-gemini/time.c @@ -59,49 +59,48 @@ static int gemini_timer_set_next_event(unsigned long cycles, return 0; } -static void gemini_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int gemini_timer_shutdown(struct clock_event_device *evt) +{ + u32 cr; + + /* + * Disable also for oneshot: the set_next() call will arm the timer + * instead. + */ + cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); + cr &= ~TIMER_2_CR_ENABLE; + cr &= ~TIMER_2_CR_INT; + writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); + return 0; +} + +static int gemini_timer_set_periodic(struct clock_event_device *evt) { u32 period = DIV_ROUND_CLOSEST(tick_rate, HZ); u32 cr; - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* Start the timer */ - writel(period, - TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE))); - writel(period, - TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE))); - cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); - cr |= TIMER_2_CR_ENABLE; - cr |= TIMER_2_CR_INT; - writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); - break; - case CLOCK_EVT_MODE_ONESHOT: - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_RESUME: - /* - * Disable also for oneshot: the set_next() call will - * arm the timer instead. - */ - cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); - cr &= ~TIMER_2_CR_ENABLE; - cr &= ~TIMER_2_CR_INT; - writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); - break; - default: - break; - } + /* Start the timer */ + writel(period, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE))); + writel(period, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE))); + cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); + cr |= TIMER_2_CR_ENABLE; + cr |= TIMER_2_CR_INT; + writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); + return 0; } /* Use TIMER2 as clock event */ static struct clock_event_device gemini_clockevent = { - .name = "TIMER2", - .rating = 300, /* Reasonably fast and accurate clock event */ - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_next_event = gemini_timer_set_next_event, - .set_mode = gemini_timer_set_mode, + .name = "TIMER2", + /* Reasonably fast and accurate clock event */ + .rating = 300, + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = gemini_timer_set_next_event, + .set_state_shutdown = gemini_timer_shutdown, + .set_state_periodic = gemini_timer_set_periodic, + .set_state_oneshot = gemini_timer_shutdown, + .tick_resume = gemini_timer_shutdown, }; /*