Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330346
b: refs/heads/master
c: bf34526
h: refs/heads/master
v: v3
  • Loading branch information
Zhao Chenhui authored and Kumar Gala committed Sep 12, 2012
1 parent befe7e9 commit 8612c1f
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae5cab476342bc7311945cf89d5cbd8d57f4a5a9
refs/heads/master: bf34526374a334ddfafaed73b0d8bf7eb4dea833
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/include/asm/fsl_guts.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ struct ccsr_guts {
__be32 dmuxcr; /* 0x.0068 - DMA Mux Control Register */
u8 res06c[0x70 - 0x6c];
__be32 devdisr; /* 0x.0070 - Device Disable Control */
#define CCSR_GUTS_DEVDISR_TB1 0x00001000
#define CCSR_GUTS_DEVDISR_TB0 0x00004000
__be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */
u8 res078[0x7c - 0x78];
__be32 pmjcr; /* 0x.007c - 4 Power Management Jog Control Register */
Expand Down
82 changes: 82 additions & 0 deletions trunk/arch/powerpc/platforms/85xx/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <asm/mpic.h>
#include <asm/cacheflush.h>
#include <asm/dbell.h>
#include <asm/fsl_guts.h>

#include <sysdev/fsl_soc.h>
#include <sysdev/mpic.h>
Expand All @@ -41,6 +42,64 @@ struct epapr_spin_table {
u32 pir;
};

static struct ccsr_guts __iomem *guts;
static u64 timebase;
static int tb_req;
static int tb_valid;

static void mpc85xx_timebase_freeze(int freeze)
{
uint32_t mask;

mask = CCSR_GUTS_DEVDISR_TB0 | CCSR_GUTS_DEVDISR_TB1;
if (freeze)
setbits32(&guts->devdisr, mask);
else
clrbits32(&guts->devdisr, mask);

in_be32(&guts->devdisr);
}

static void mpc85xx_give_timebase(void)
{
unsigned long flags;

local_irq_save(flags);

while (!tb_req)
barrier();
tb_req = 0;

mpc85xx_timebase_freeze(1);
timebase = get_tb();
mb();
tb_valid = 1;

while (tb_valid)
barrier();

mpc85xx_timebase_freeze(0);

local_irq_restore(flags);
}

static void mpc85xx_take_timebase(void)
{
unsigned long flags;

local_irq_save(flags);

tb_req = 1;
while (!tb_valid)
barrier();

set_tb(timebase >> 32, timebase & 0xffffffff);
isync();
tb_valid = 0;

local_irq_restore(flags);
}

static int __init
smp_85xx_kick_cpu(int nr)
{
Expand Down Expand Up @@ -228,6 +287,16 @@ smp_85xx_setup_cpu(int cpu_nr)
doorbell_setup_this_cpu();
}

static const struct of_device_id mpc85xx_smp_guts_ids[] = {
{ .compatible = "fsl,mpc8572-guts", },
{ .compatible = "fsl,p1020-guts", },
{ .compatible = "fsl,p1021-guts", },
{ .compatible = "fsl,p1022-guts", },
{ .compatible = "fsl,p1023-guts", },
{ .compatible = "fsl,p2020-guts", },
{},
};

void __init mpc85xx_smp_init(void)
{
struct device_node *np;
Expand All @@ -249,6 +318,19 @@ void __init mpc85xx_smp_init(void)
smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
}

np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids);
if (np) {
guts = of_iomap(np, 0);
of_node_put(np);
if (!guts) {
pr_err("%s: Could not map guts node address\n",
__func__);
return;
}
smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
}

smp_ops = &smp_85xx_ops;

#ifdef CONFIG_KEXEC
Expand Down

0 comments on commit 8612c1f

Please sign in to comment.