From patchwork Thu Jun 16 19:06:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 888412 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5GJBkG2015596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Jun 2011 19:12:07 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXHyJ-0004HJ-BV; Thu, 16 Jun 2011 19:11:20 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QXHyF-0004jk-94; Thu, 16 Jun 2011 19:11:15 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QXHy5-0004gc-Tw for linux-arm-kernel@canuck.infradead.org; Thu, 16 Jun 2011 19:11:06 +0000 Received: from service87.mimecast.com ([94.185.240.25]) by casper.infradead.org with smtp (Exim 4.76 #1 (Red Hat Linux)) id 1QXHy3-0001Ru-Cj for linux-arm-kernel@lists.infradead.org; Thu, 16 Jun 2011 19:11:04 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 16 Jun 2011 20:07:49 +0100 Received: from localhost.localdomain ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 16 Jun 2011 20:06:56 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 13/16] ARM: local timers: remove smp_twd from arch/arm Date: Thu, 16 Jun 2011 20:06:41 +0100 Message-Id: <1308251204-16719-14-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1308251204-16719-1-git-send-email-marc.zyngier@arm.com> References: <1308251204-16719-1-git-send-email-marc.zyngier@arm.com> X-OriginalArrivalTime: 16 Jun 2011 19:06:56.0092 (UTC) FILETIME=[8F5D91C0:01CC2C58] X-MC-Unique: 111061620074904001 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110616_201103_611871_232D97E7 X-CRM114-Status: GOOD ( 19.47 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2-r929478 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [94.185.240.25 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Thomas Gleixner , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 16 Jun 2011 19:12:07 +0000 (UTC) There is no in-tree user of arch/arm/kernel/smp_twd.c, as they've been all converted to driver/clocksource/arm_smp_twd.c. Shed a tear, and get rid of it. Signed-off-by: Marc Zyngier --- arch/arm/Kconfig | 8 -- arch/arm/include/asm/localtimer.h | 10 --- arch/arm/include/asm/smp_twd.h | 28 ------- arch/arm/kernel/Makefile | 1 - arch/arm/kernel/smp_twd.c | 163 ------------------------------------- 5 files changed, 0 insertions(+), 210 deletions(-) delete mode 100644 arch/arm/include/asm/smp_twd.h delete mode 100644 arch/arm/kernel/smp_twd.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index dafb20a..f3c1124 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1370,13 +1370,6 @@ config HAVE_ARM_SCU help This option enables support for the ARM system coherency unit -config HAVE_ARM_TWD - bool - depends on SMP - select TICK_ONESHOT - help - This options enables support for the ARM timer and watchdog unit - choice prompt "Memory split" default VMSPLIT_3G @@ -1417,7 +1410,6 @@ config LOCAL_TIMERS bool "Use local timer interrupts" depends on SMP && !LOCAL_TIMER_DEVICES default y - select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT) help Enable support for local timers on SMP platforms, rather then the legacy IPI broadcast method. Local timers allows the system diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h index 5c8acb4..74af2cd 100644 --- a/arch/arm/include/asm/localtimer.h +++ b/arch/arm/include/asm/localtimer.h @@ -26,22 +26,12 @@ irqreturn_t percpu_timer_handler(int irq, void *dev_id); #ifdef CONFIG_LOCAL_TIMERS -#ifdef CONFIG_HAVE_ARM_TWD - -#include "smp_twd.h" - -#define local_timer_ack() twd_timer_ack() - -#else - /* * Platform provides this to acknowledge a local timer IRQ. * Returns true if the local timer IRQ is to be processed. */ int local_timer_ack(void); -#endif - /* * Setup a local timer interrupt for a CPU. */ diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h deleted file mode 100644 index fed9981..0000000 --- a/arch/arm/include/asm/smp_twd.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASMARM_SMP_TWD_H -#define __ASMARM_SMP_TWD_H - -#define TWD_TIMER_LOAD 0x00 -#define TWD_TIMER_COUNTER 0x04 -#define TWD_TIMER_CONTROL 0x08 -#define TWD_TIMER_INTSTAT 0x0C - -#define TWD_WDOG_LOAD 0x20 -#define TWD_WDOG_COUNTER 0x24 -#define TWD_WDOG_CONTROL 0x28 -#define TWD_WDOG_INTSTAT 0x2C -#define TWD_WDOG_RESETSTAT 0x30 -#define TWD_WDOG_DISABLE 0x34 - -#define TWD_TIMER_CONTROL_ENABLE (1 << 0) -#define TWD_TIMER_CONTROL_ONESHOT (0 << 1) -#define TWD_TIMER_CONTROL_PERIODIC (1 << 1) -#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2) - -struct clock_event_device; - -extern void __iomem *twd_base; - -int twd_timer_ack(void); -void twd_timer_setup(struct clock_event_device *); - -#endif diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index a5b31af..c6c6d8b 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -33,7 +33,6 @@ obj-$(CONFIG_PM_SLEEP) += sleep.o obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o obj-$(CONFIG_SMP) += smp.o smp_tlb.o obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o -obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c deleted file mode 100644 index aa99656..0000000 --- a/arch/arm/kernel/smp_twd.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * linux/arch/arm/kernel/smp_twd.c - * - * Copyright (C) 2002 ARM Ltd. - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* set up by the platform code */ -void __iomem *twd_base; - -static unsigned long twd_timer_rate; -static DEFINE_PER_CPU(bool, irq_reqd); - -static void twd_set_mode(enum clock_event_mode mode, - struct clock_event_device *clk) -{ - unsigned long ctrl; - - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* timer load already set up */ - ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE - | TWD_TIMER_CONTROL_PERIODIC; - __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD); - break; - case CLOCK_EVT_MODE_ONESHOT: - /* period set, and timer enabled in 'next_event' hook */ - ctrl = TWD_TIMER_CONTROL_IT_ENABLE | TWD_TIMER_CONTROL_ONESHOT; - break; - case CLOCK_EVT_MODE_UNUSED: - disable_irq(clk->irq); - /* fall through */ - case CLOCK_EVT_MODE_SHUTDOWN: - default: - ctrl = 0; - } - - __raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL); -} - -static int twd_set_next_event(unsigned long evt, - struct clock_event_device *unused) -{ - unsigned long ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL); - - ctrl |= TWD_TIMER_CONTROL_ENABLE; - - __raw_writel(evt, twd_base + TWD_TIMER_COUNTER); - __raw_writel(ctrl, twd_base + TWD_TIMER_CONTROL); - - return 0; -} - -/* - * local_timer_ack: checks for a local timer interrupt. - * - * If a local timer interrupt has occurred, acknowledge and return 1. - * Otherwise, return 0. - */ -int twd_timer_ack(void) -{ - if (__raw_readl(twd_base + TWD_TIMER_INTSTAT)) { - __raw_writel(1, twd_base + TWD_TIMER_INTSTAT); - return 1; - } - - return 0; -} - -static void __cpuinit twd_calibrate_rate(void) -{ - unsigned long count; - u64 waitjiffies; - - /* - * If this is the first time round, we need to work out how fast - * the timer ticks - */ - if (twd_timer_rate == 0) { - printk(KERN_INFO "Calibrating local timer... "); - - /* Wait for a tick to start */ - waitjiffies = get_jiffies_64() + 1; - - while (get_jiffies_64() < waitjiffies) - udelay(10); - - /* OK, now the tick has started, let's get the timer going */ - waitjiffies += 5; - - /* enable, no interrupt or reload */ - __raw_writel(0x1, twd_base + TWD_TIMER_CONTROL); - - /* maximum value */ - __raw_writel(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER); - - while (get_jiffies_64() < waitjiffies) - udelay(10); - - count = __raw_readl(twd_base + TWD_TIMER_COUNTER); - - twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5); - - printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, - (twd_timer_rate / 1000000) % 100); - } -} - -/* - * Setup the local clock events for a CPU. - */ -void __cpuinit twd_timer_setup(struct clock_event_device *clk) -{ - int err; - bool *reqd; - - twd_calibrate_rate(); - - clk->name = "local_timer"; - clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | - CLOCK_EVT_FEAT_C3STOP; - clk->rating = 350; - clk->set_mode = twd_set_mode; - clk->set_next_event = twd_set_next_event; - clk->shift = 20; - clk->mult = div_sc(twd_timer_rate, NSEC_PER_SEC, clk->shift); - clk->max_delta_ns = clockevent_delta2ns(0xffffffff, clk); - clk->min_delta_ns = clockevent_delta2ns(0xf, clk); - - reqd = &__get_cpu_var(irq_reqd); - if (!*reqd) { - err = request_irq(clk->irq, percpu_timer_handler, - IRQF_PERCPU | IRQF_NOBALANCING | IRQF_TIMER, - clk->name, clk); - if (err) { - pr_err("%s: can't register interrupt %d on cpu %d (%d)\n", - clk->name, clk->irq, smp_processor_id(), err); - return; - } - - *reqd = true; - } else - enable_irq(clk->irq); - - clockevents_register_device(clk); -}