Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932556AbbFFD7O (ORCPT ); Fri, 5 Jun 2015 23:59:14 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:33183 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752119AbbFFD6Q (ORCPT ); Fri, 5 Jun 2015 23:58:16 -0400 From: Hans Ulli Kroll To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll Subject: [PATCH 6/6] ARM:Gemini:add timer3 as sched_clock_source Date: Sat, 6 Jun 2015 05:57:28 +0200 Message-Id: <1433563048-21922-7-git-send-email-ulli.kroll@googlemail.com> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1433563048-21922-1-git-send-email-ulli.kroll@googlemail.com> References: <1433563048-21922-1-git-send-email-ulli.kroll@googlemail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1848 Lines: 63 This patch is based on openwrt patch found in target/linux/gemini/patches-3.18/160-gemini-timers.patch It setups a free running timer (timer3) for scheduler clock Signed-off-by: Hans Ulli Kroll --- arch/arm/mach-gemini/time.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/mach-gemini/time.c b/arch/arm/mach-gemini/time.c index 29ec2c3..e419dd4 100644 --- a/arch/arm/mach-gemini/time.c +++ b/arch/arm/mach-gemini/time.c @@ -15,6 +15,8 @@ #include #include #include +#include + /* * Register definitions for the timers @@ -58,6 +60,11 @@ static unsigned int tick_rate; +static u64 notrace gemini_read_sched_clock(void) +{ + return readl(TIMER_COUNT(GEMINI_TIMER3_BASE)); +} + static int gemini_timer_set_next_event(unsigned long cycles, struct clock_event_device *evt) { @@ -196,6 +203,19 @@ void __init gemini_timer_init(void) TIMER_CR); /* + * Setup free-running clocksource timer (interrupts + * disabled.) + */ + writel(0, TIMER_COUNT(GEMINI_TIMER3_BASE)); + writel(0, TIMER_LOAD(GEMINI_TIMER3_BASE)); + writel(0, TIMER_MATCH1(GEMINI_TIMER3_BASE)); + writel(0, TIMER_MATCH2(GEMINI_TIMER3_BASE)); + clocksource_mmio_init(TIMER_COUNT(GEMINI_TIMER3_BASE), + "gemini_clocksource", tick_rate, + 300, 32, clocksource_mmio_readl_up); + sched_clock_register(gemini_read_sched_clock, 32, tick_rate); + + /* * Setup clockevent timer (interrupt-driven.) */ writel(0, TIMER_COUNT(GEMINI_TIMER1_BASE)); -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/