Commit 4200b16d58cd34ff8e1616d8ed77417f8fc44864

Authored by Marc Zyngier
1 parent 1fcf3a6edd

ARM: shmobile: convert to twd_local_timer_register() interface

Add support for the new smp_twd runtime registration interface
to the shmobile platforms, and remove the old compile-time support.

Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Showing 7 changed files with 18 additions and 38 deletions Side-by-side Diff

arch/arm/mach-shmobile/Makefile
... ... @@ -16,7 +16,6 @@
16 16 # SMP objects
17 17 smp-y := platsmp.o headsmp.o
18 18 smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o
19   -smp-$(CONFIG_LOCAL_TIMERS) += localtimer.o
20 19 smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o
21 20 smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o
22 21  
arch/arm/mach-shmobile/include/mach/common.h
... ... @@ -2,6 +2,8 @@
2 2 #define __ARCH_MACH_COMMON_H
3 3  
4 4 extern struct sys_timer shmobile_timer;
  5 +struct twd_local_timer;
  6 +void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
5 7 extern void shmobile_setup_console(void);
6 8 extern void shmobile_secondary_vector(void);
7 9 extern int shmobile_platform_cpu_kill(unsigned int cpu);
arch/arm/mach-shmobile/localtimer.c
1   -/*
2   - * SMP support for R-Mobile / SH-Mobile - local timer portion
3   - *
4   - * Copyright (C) 2010 Magnus Damm
5   - *
6   - * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
7   - *
8   - * This program is free software; you can redistribute it and/or modify
9   - * it under the terms of the GNU General Public License version 2 as
10   - * published by the Free Software Foundation.
11   - */
12   -#include <linux/init.h>
13   -#include <linux/smp.h>
14   -#include <linux/clockchips.h>
15   -#include <asm/smp_twd.h>
16   -#include <asm/localtimer.h>
17   -
18   -/*
19   - * Setup the local clock events for a CPU.
20   - */
21   -int __cpuinit local_timer_setup(struct clock_event_device *evt)
22   -{
23   - evt->irq = 29;
24   - twd_timer_setup(evt);
25   - return 0;
26   -}
arch/arm/mach-shmobile/platsmp.c
... ... @@ -17,7 +17,6 @@
17 17 #include <linux/smp.h>
18 18 #include <linux/io.h>
19 19 #include <asm/hardware/gic.h>
20   -#include <asm/localtimer.h>
21 20 #include <asm/mach-types.h>
22 21 #include <mach/common.h>
23 22  
arch/arm/mach-shmobile/smp-r8a7779.c
... ... @@ -64,6 +64,8 @@
64 64 static DEFINE_SPINLOCK(scu_lock);
65 65 static unsigned long tmp;
66 66  
  67 +static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
  68 +
67 69 static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
68 70 {
69 71 void __iomem *scu_base = scu_base_addr();
... ... @@ -82,11 +84,7 @@
82 84 {
83 85 void __iomem *scu_base = scu_base_addr();
84 86  
85   -#ifdef CONFIG_HAVE_ARM_TWD
86   - /* twd_base needs to be initialized before percpu_timer_setup() */
87   - twd_base = (void __iomem *)0xf0000600;
88   -#endif
89   -
  87 + shmobile_twd_init(&twd_local_timer);
90 88 return scu_get_core_count(scu_base);
91 89 }
92 90  
arch/arm/mach-shmobile/smp-sh73a0.c
... ... @@ -42,6 +42,8 @@
42 42 static DEFINE_SPINLOCK(scu_lock);
43 43 static unsigned long tmp;
44 44  
  45 +static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
  46 +
45 47 static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
46 48 {
47 49 void __iomem *scu_base = scu_base_addr();
... ... @@ -60,11 +62,7 @@
60 62 {
61 63 void __iomem *scu_base = scu_base_addr();
62 64  
63   -#ifdef CONFIG_HAVE_ARM_TWD
64   - /* twd_base needs to be initialized before percpu_timer_setup() */
65   - twd_base = (void __iomem *)0xf0000600;
66   -#endif
67   -
  65 + shmobile_twd_init(&twd_local_timer);
68 66 return scu_get_core_count(scu_base);
69 67 }
70 68  
arch/arm/mach-shmobile/timer.c
... ... @@ -20,6 +20,7 @@
20 20 */
21 21 #include <linux/platform_device.h>
22 22 #include <asm/mach/time.h>
  23 +#include <asm/smp_twd.h>
23 24  
24 25 static void __init shmobile_late_time_init(void)
25 26 {
... ... @@ -39,6 +40,15 @@
39 40 static void __init shmobile_timer_init(void)
40 41 {
41 42 late_time_init = shmobile_late_time_init;
  43 +}
  44 +
  45 +void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer)
  46 +{
  47 +#ifdef CONFIG_HAVE_ARM_TWD
  48 + int err = twd_local_timer_register(twd_local_timer);
  49 + if (err)
  50 + pr_err("twd_local_timer_register failed %d\n", err);
  51 +#endif
42 52 }
43 53  
44 54 struct sys_timer shmobile_timer = {