aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pasemi/setup.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-02-04 17:36:53 -0500
committerPaul Mackerras <paulus@samba.org>2007-02-06 22:03:22 -0500
commitc388cfebbf22acd2b6adf757b35e28d4be66ac7c (patch)
treedc367aa9c8dd94dddefad9062bf43ac16dcd1ea6 /arch/powerpc/platforms/pasemi/setup.c
parentf620be99e9355c41693f0c748ba9260f69278ee0 (diff)
[POWERPC] pasemi: SMP timebase sync
Timebase update is simple on PA6T, since global updates can be done from one core by writing to an SPR. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/pasemi/setup.c')
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index cabf7017c05e..2d9652b6acb3 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -48,13 +48,36 @@ static void pas_restart(char *cmd)
48} 48}
49 49
50#ifdef CONFIG_SMP 50#ifdef CONFIG_SMP
51static DEFINE_SPINLOCK(timebase_lock);
52
53static void __devinit pas_give_timebase(void)
54{
55 unsigned long tb;
56
57 spin_lock(&timebase_lock);
58 mtspr(SPRN_TBCTL, TBCTL_FREEZE);
59 tb = mftb();
60 mtspr(SPRN_TBCTL, TBCTL_UPDATE_LOWER | (tb & 0xffffffff));
61 mtspr(SPRN_TBCTL, TBCTL_UPDATE_UPPER | (tb >> 32));
62 mtspr(SPRN_TBCTL, TBCTL_RESTART);
63 spin_unlock(&timebase_lock);
64 pr_debug("pas_give_timebase: cpu %d gave tb %lx\n",
65 smp_processor_id(), tb);
66}
67
68static void __devinit pas_take_timebase(void)
69{
70 pr_debug("pas_take_timebase: cpu %d has tb %lx\n",
71 smp_processor_id(), mftb());
72}
73
51struct smp_ops_t pas_smp_ops = { 74struct smp_ops_t pas_smp_ops = {
52 .probe = smp_mpic_probe, 75 .probe = smp_mpic_probe,
53 .message_pass = smp_mpic_message_pass, 76 .message_pass = smp_mpic_message_pass,
54 .kick_cpu = smp_generic_kick_cpu, 77 .kick_cpu = smp_generic_kick_cpu,
55 .setup_cpu = smp_mpic_setup_cpu, 78 .setup_cpu = smp_mpic_setup_cpu,
56 .give_timebase = smp_generic_give_timebase, 79 .give_timebase = pas_give_timebase,
57 .take_timebase = smp_generic_take_timebase, 80 .take_timebase = pas_take_timebase,
58}; 81};
59#endif /* CONFIG_SMP */ 82#endif /* CONFIG_SMP */
60 83