From patchwork Sun Apr 16 20:27:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 97472 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1086974qgf; Sun, 16 Apr 2017 13:29:03 -0700 (PDT) X-Received: by 10.98.163.201 with SMTP id q70mr8517869pfl.217.1492374543263; Sun, 16 Apr 2017 13:29:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r75si8917811pfa.171.2017.04.16.13.29.03; Sun, 16 Apr 2017 13:29:03 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932211AbdDPU2v (ORCPT + 15 others); Sun, 16 Apr 2017 16:28:51 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36331 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756974AbdDPU2b (ORCPT ); Sun, 16 Apr 2017 16:28:31 -0400 Received: by mail-wm0-f45.google.com with SMTP id o81so23412880wmb.1 for ; Sun, 16 Apr 2017 13:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wipdq569jHpqS3N7kVupxntjoj4/S7lweRr/z4CFXtU=; b=e68Y4Kpmts3AdePR48dsHOjL4+ykr5tlOTiRTml7tpF7pGfR4N59HJrd1sM3wgPfBp TLz/Hf5n5lmCwriTkSgk72Ky9pG/GQwhpITJcEKE/Hkv/pRUr4aRX5GOdsvoIGSJMBfs PhNghiAXDmD6wzHuiv/sBXUq7Ab3vx3kwWLT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wipdq569jHpqS3N7kVupxntjoj4/S7lweRr/z4CFXtU=; b=IFLe5UlIlB4sEdc1PWUUNXNEs6zzWHct9G3wGZtw3hXK9HaoOZcrNZeXxuWtHpfEE2 EjRuuthWUl71OLKVIjhrRDphoAriIx4wG8UR9gz+r8aEbcH1PGCtrmMQB/6FaaOOZ43Q 9f1R+02jAE1pR6I7FzxBEtErnxi93f/idGdLyyKZUENhraVCnhDUa/okkOhTSSenW8Kz IpDLGw6Tk2tov0i/lrv/q6HACV6lkNJ4TDagMRKCbdTbh7w5HPj30KDC84sBVQzWjd/x ldfbebAGJ7HdxyIHcda9I/V7D1tXZKsCdqK3JC+WlAEvIxCmQGvRIr8ytGCfY8Oyy+UE fJmA== X-Gm-Message-State: AN3rC/6WW5J0v+hlfSdxOWzKQweQmW9ZDryLlmzvnpOyEepS0iIJWU9F Ez4t6xcsMbJipr5h X-Received: by 10.28.54.151 with SMTP id y23mr6748386wmh.90.1492374510348; Sun, 16 Apr 2017 13:28:30 -0700 (PDT) Received: from mai.lan ([2001:41d0:fe90:b800:20c0:6248:a385:db35]) by smtp.gmail.com with ESMTPSA id 81sm7732196wmj.9.2017.04.16.13.28.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 16 Apr 2017 13:28:29 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Russell King Subject: [PATCH 20/29] clocksource/drivers/orion: Add delay_timer implementation Date: Sun, 16 Apr 2017 22:27:10 +0200 Message-Id: <1492374441-23336-20-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492374441-23336-1-git-send-email-daniel.lezcano@linaro.org> References: <20170416202542.GV2078@mai> <1492374441-23336-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King Add an implementation for the ARM delay timer, which is used for udelay(). This provides less CPU dependent and more accurate delays - the CPU loop on Marvell Dove appears to calibrate to around 6% too short. Signed-off-by: Russell King Signed-off-by: Daniel Lezcano --- drivers/clocksource/time-orion.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.7.4 diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c index c4818a5..7eb2ab0 100644 --- a/drivers/clocksource/time-orion.c +++ b/drivers/clocksource/time-orion.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,21 @@ static void __iomem *timer_base; +static unsigned long notrace orion_read_timer(void) +{ + return ~readl(timer_base + TIMER0_VAL); +} + +static struct delay_timer orion_delay_timer = { + .read_current_timer = orion_read_timer, +}; + +static void orion_delay_timer_init(unsigned long rate) +{ + orion_delay_timer.freq = rate; + register_current_timer_delay(&orion_delay_timer); +} + /* * Free-running clocksource handling. */ @@ -168,6 +184,9 @@ static int __init orion_timer_init(struct device_node *np) clockevents_config_and_register(&orion_clkevt, rate, ORION_ONESHOT_MIN, ORION_ONESHOT_MAX); + + orion_delay_timer_init(rate); + return 0; } CLOCKSOURCE_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init);