ARM: TWD: Consolidate local timers support
Subsystems (7)
PATCH 1/1 ARM: TWD: Consolidate local timers support
This greatly reduces amount of platform-specific code, and thus makes it easier to add local timers for new platforms.
Technically, it's not very nice to place machine-specific (i.e. local_timer_setup()) routine into the machine-agnostic code. But the true thing is: currently all machines want the same thing.
If machines will ever want something more complex, we may change the CONFIG_LOCAL_TIMERS ifdef to CONFIG_MACH_WANT_TWD_LOCAL_TIMER.
--- arch/arm/kernel/smp_twd.c | 14 +++++++++++ arch/arm/mach-omap2/Makefile | 1 - arch/arm/mach-omap2/timer-mpu.c | 34 --------------------------- arch/arm/mach-realview/Makefile | 1 - arch/arm/mach-realview/localtimer.c | 26 -------------------- arch/arm/mach-s5pv310/Makefile | 1 - arch/arm/mach-s5pv310/localtimer.c | 25 ------------------- arch/arm/mach-tegra/Makefile | 2 +- arch/arm/mach-tegra/localtimer.c | 25 ------------------- arch/arm/mach-ux500/Makefile | 1 - arch/arm/mach-ux500/localtimer.c | 28 ---------------------- arch/arm/mach-vexpress/Makefile | 1 - arch/arm/mach-vexpress/localtimer.c | 26 -------------------- arch/arm/plat-omap/include/plat/irqs-44xx.h | 1 + 14 files changed, 16 insertions(+), 170 deletions(-) delete mode 100644 arch/arm/mach-omap2/timer-mpu.c delete mode 100644 arch/arm/mach-realview/localtimer.c delete mode 100644 arch/arm/mach-s5pv310/localtimer.c delete mode 100644 arch/arm/mach-tegra/localtimer.c delete mode 100644 arch/arm/mach-ux500/localtimer.c delete mode 100644 arch/arm/mach-vexpress/localtimer.c
arch/arm/kernel/smp_twd.c +14 -0
@@ -19,8 +19,11 @@#include <linux/io.h> #include <asm/smp_twd.h> +#include <asm/localtimer.h> #include <asm/hardware/gic.h> +#include <mach/irqs.h> +/* set up by the platform code */ void __iomem *twd_base;
@@ -151,6 +154,17 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)clockevents_register_device (clk); } +#ifdef CONFIG_LOCAL_TIMERS +void __cpuinit local_timer_setup (struct clock_event_device *evt) +{ +if (!twd_base) +return ; + + evt->irq =IRQ_LOCALTIMER ; +twd_timer_setup (evt); +} +#endif +#ifdef CONFIG_HOTPLUG_CPU /* * take a local timer down
arch/arm/mach-omap2/Makefile +0 -1
@@ -22,7 +22,6 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o # SMP support ONLY available for OMAP4 obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o -obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o obj-$(CONFIG_ARCH_OMAP4) += omap44xx-smc.o omap4-common.o
arch/arm/mach-omap2/timer-mpu.c deleted +0 -34
@@ -1,34 +0,0 @@ -/* -* The MPU local timer source file. In OMAP4, both cortex-a9 cores have -* own timer in it's MPU domain. These timers will be driving the -* linux kernel SMP tick framework when active. These timers are not -* part of the wake up domain. -* -* Copyright (C) 2009 Texas Instruments, Inc. -* -* Author: -* Santosh Shilimkar <[email protected]> -* -* This file is based on arm realview smp platform file. -* Copyright (C) 2002 ARM Ltd. -* -* 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 <linux/init.h> -#include <linux/smp.h> -#include <linux/clockchips.h> -#include <asm/irq.h> -#include <asm/smp_twd.h> -#include <asm/localtimer.h> - -/* -* Setup the local clock events for a CPU. -*/ -void __cpuinit local_timer_setup (struct clock_event_device *evt) -{ - evt->irq =OMAP44XX_IRQ_LOCALTIMER ; -twd_timer_setup (evt); -} -
arch/arm/mach-realview/Makefile +0 -1
@@ -10,4 +10,3 @@ obj-$(CONFIG_MACH_REALVIEW_PBA8) += realview_pba8.o obj-$(CONFIG_MACH_REALVIEW_PBX) += realview_pbx.o obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o -obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
arch/arm/mach-realview/localtimer.c deleted +0 -26
@@ -1,26 +0,0 @@ -/* -* linux/arch/arm/mach-realview/localtimer.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 <linux/init.h> -#include <linux/smp.h> -#include <linux/clockchips.h> - -#include <asm/irq.h> -#include <asm/smp_twd.h> -#include <asm/localtimer.h> - -/* -* Setup the local clock events for a CPU. -*/ -void __cpuinit local_timer_setup (struct clock_event_device *evt) -{ - evt->irq =IRQ_LOCALTIMER ; -twd_timer_setup (evt); -}
arch/arm/mach-s5pv310/Makefile +0 -1
@@ -16,7 +16,6 @@ obj-$(CONFIG_CPU_S5PV310) += cpu.o init.o clock.o irq-combiner.o obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o time.o gpiolib.o irq-eint.o obj-$(CONFIG_SMP) += platsmp.o -obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o # machine support
arch/arm/mach-s5pv310/localtimer.c deleted +0 -25
@@ -1,25 +0,0 @@ -/* linux/arch/arm/mach-s5pv310/localtimer.c -* -* Cloned from linux/arch/arm/mach-realview/localtimer.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 <linux/clockchips.h> - -#include <asm/irq.h> -#include <asm/localtimer.h> - -/* -* Setup the local clock events for a CPU. -*/ -void __cpuinit local_timer_setup (struct clock_event_device *evt) -{ - evt->irq =IRQ_LOCALTIMER ; -twd_timer_setup (evt); -}
arch/arm/mach-tegra/Makefile +1 -1
@@ -10,7 +10,7 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clock.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_dvfs.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-t2-tables.o -obj-$(CONFIG_SMP) += platsmp.o localtimer.o headsmp.o +obj-$(CONFIG_SMP) += platsmp.o headsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
arch/arm/mach-tegra/localtimer.c deleted +0 -25
@@ -1,25 +0,0 @@ -/* -* arch/arm/mach-tegra/localtimer.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 <linux/init.h> -#include <linux/smp.h> -#include <linux/clockchips.h> -#include <asm/irq.h> -#include <asm/smp_twd.h> -#include <asm/localtimer.h> - -/* -* Setup the local clock events for a CPU. -*/ -void __cpuinit local_timer_setup (struct clock_event_device *evt) -{ - evt->irq =IRQ_LOCALTIMER ; -twd_timer_setup (evt); -}
arch/arm/mach-ux500/Makefile +0 -1
@@ -9,7 +9,6 @@ obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o obj-$(CONFIG_MACH_U5500) += board-u5500.o obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o -obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o obj-$(CONFIG_REGULATOR_AB8500) += board-mop500-regulators.o obj-$(CONFIG_U5500_MODEM_IRQ) += modem_irq.o obj-$(CONFIG_U5500_MBOX) += mbox.o
arch/arm/mach-ux500/localtimer.c deleted +0 -28
@@ -1,28 +0,0 @@ -/* -* Copyright (C) 2008-2009 ST-Ericsson -* Srinidhi Kasagar <[email protected]> -* -* This file is heavily based on relaview platform, almost a copy. -* -* Copyright (C) 2002 ARM Ltd. -* -* 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 <linux/init.h> -#include <linux/smp.h> -#include <linux/clockchips.h> - -#include <asm/irq.h> -#include <asm/smp_twd.h> -#include <asm/localtimer.h> - -/* -* Setup the local clock events for a CPU. -*/ -void __cpuinit local_timer_setup (struct clock_event_device *evt) -{ - evt->irq =IRQ_LOCALTIMER ; -twd_timer_setup (evt); -}
arch/arm/mach-vexpress/Makefile +0 -1
@@ -5,4 +5,3 @@ obj-y := v2m.o obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o obj-$(CONFIG_SMP) += platsmp.o -obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
arch/arm/mach-vexpress/localtimer.c deleted +0 -26
@@ -1,26 +0,0 @@ -/* -* linux/arch/arm/mach-vexpress/localtimer.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 <linux/init.h> -#include <linux/smp.h> -#include <linux/clockchips.h> - -#include <asm/smp_twd.h> -#include <asm/localtimer.h> -#include <mach/irqs.h> - -/* -* Setup the local clock events for a CPU. -*/ -void __cpuinit local_timer_setup (struct clock_event_device *evt) -{ - evt->irq =IRQ_LOCALTIMER ; -twd_timer_setup (evt); -}
arch/arm/plat-omap/include/plat/irqs-44xx.h +1 -0
@@ -22,6 +22,7 @@/* OMAP44XX IRQs numbers definitions */ #define OMAP44XX_IRQ_LOCALTIMER 29 +#define IRQ_LOCALTIMER OMAP44XX_IRQ_LOCALTIMER#define OMAP44XX_IRQ_LOCALWDT 30#define OMAP44XX_IRQ_GIC_START 32
Signature · 1 line
1.7.0.5
Quoted 6 lines · Anton Vorontsov
This greatly reduces amount of platform-specific code, and thus makes it easier to add local timers for new platforms.
Technically, it's not very nice to place machine-specific (i.e.
local_timer_setup()) routine into the machine-agnostic code. But the true thing is: currently all machines want the same thing.
I've just been talking to someone this week about (presumably) non-TWD local timers.
I suspect your patch is all part of the "lets try to get ARM building for every platform in the world in one kernel" but it's really painful to see carefully abstracted interfaces being trodden on by this argument
- which is just going to make things more difficult in the future.
Quoted 10 lines · Russell King - ARM Linux
Quoted 6 lines · Anton Vorontsov
This greatly reduces amount of platform-specific code, and thus makes it easier to add local timers for new platforms.
Technically, it's not very nice to place machine-specific (i.e.
local_timer_setup()) routine into the machine-agnostic code. But the true thing is: currently all machines want the same thing.I've just been talking to someone this week about (presumably) non-TWD local timers.
FYI, Cortex-A15 comes with some architected timers different from the current ones (specs publicly available in the same place as LPAE). We'll push some patches at some point.
Signature · 1 line
Catalin