Modified: trunk/arch/blackfin/include/asm/cdef_misc.h (8258 => 8259)
--- trunk/arch/blackfin/include/asm/cdef_misc.h 2010-01-29 02:54:42 UTC (rev 8258)
+++ trunk/arch/blackfin/include/asm/cdef_misc.h 2010-01-29 03:43:00 UTC (rev 8259)
@@ -37,20 +37,26 @@
#define SUPPLE_0_WAKEUP ((IRQ_SUPPLE_0 - (IRQ_CORETMR + 1)) % 32)
static __inline__ void bfin_iwr_set_pll(unsigned long *iwr0,
- unsigned long *iwr1, unsigned long *iwr2,
- unsigned long off)
+ unsigned long *iwr1, unsigned long *iwr2)
{
+#ifdef CONFIG_SMP
+ unsigned long SICA_SICB_OFF =
+ ((bfin_read_DSPID() & 0xff) ? 0x1000 : 0);
+#else
+# define SICA_SICB_OFF 0
+#endif
+
#ifdef SIC_IWR0
- *iwr0 = bfin_read32(SIC_IWR0 + off);
+ *iwr0 = bfin_read32(SIC_IWR0 + SICA_SICB_OFF);
#ifdef SIC_IWR1
- *iwr1 = bfin_read32(SIC_IWR1 + off);
+ *iwr1 = bfin_read32(SIC_IWR1 + SICA_SICB_OFF);
#ifdef SIC_IWR2
*iwr2 = bfin_read32(SIC_IWR2);
bfin_write32(SIC_IWR2, 0);
#endif
- bfin_write32(SIC_IWR1 + off, 0);
+ bfin_write32(SIC_IWR1 + SICA_SICB_OFF, 0);
#endif
- bfin_write32(SIC_IWR0 + off, IWR_ENABLE(0));
+ bfin_write32(SIC_IWR0 + SICA_SICB_OFF, IWR_ENABLE(0));
#else
*iwr0 = bfin_read32(SIC_IWR);
bfin_write32(SIC_IWR, IWR_ENABLE(0));
@@ -60,24 +66,35 @@
#if defined(CONFIG_HOTPLUG_CPU) || \
(defined(CONFIG_CPU_VOLTAGE) && defined(CONFIG_SMP))
static __inline__ void bfin_iwr_set_sup0(unsigned long *iwr0,
- unsigned long *iwr1, unsigned long *iwr2,
- unsigned long off)
+ unsigned long *iwr1, unsigned long *iwr2)
{
- *iwr0 = bfin_read32(SIC_IWR0 + off);
- *iwr1 = bfin_read32(SIC_IWR1 + off);
- bfin_write32(SIC_IWR0 + off, 0);
- bfin_write32(SIC_IWR1 + off, IWR_ENABLE(SUPPLE_0_WAKEUP));
+#ifdef CONFIG_SMP
+ unsigned long SICA_SICB_OFF =
+ ((bfin_read_DSPID() & 0xff) ? 0x1000 : 0);
+#else
+# define SICA_SICB_OFF 0
+#endif
+ *iwr0 = bfin_read32(SIC_IWR0 + SICA_SICB_OFF);
+ *iwr1 = bfin_read32(SIC_IWR1 + SICA_SICB_OFF);
+ bfin_write32(SIC_IWR0 + SICA_SICB_OFF, 0);
+ bfin_write32(SIC_IWR1 + SICA_SICB_OFF, IWR_ENABLE(SUPPLE_0_WAKEUP));
}
#endif
static __inline__ void bfin_iwr_restore(unsigned long iwr0,
- unsigned long iwr1, unsigned long iwr2,
- unsigned long off)
+ unsigned long iwr1, unsigned long iwr2)
{
+#ifdef CONFIG_SMP
+ unsigned long SICA_SICB_OFF =
+ ((bfin_read_DSPID() & 0xff) ? 0x1000 : 0);
+#else
+# define SICA_SICB_OFF 0
+#endif
+
#ifdef SIC_IWR0
- bfin_write32(SIC_IWR0 + off, iwr0);
+ bfin_write32(SIC_IWR0 + SICA_SICB_OFF, iwr0);
#ifdef SIC_IWR1
- bfin_write32(SIC_IWR1 + off, iwr1);
+ bfin_write32(SIC_IWR1 + SICA_SICB_OFF, iwr1);
#ifdef SIC_IWR2
bfin_write32(SIC_IWR2, iwr2);
#endif
@@ -92,19 +109,18 @@
{
unsigned long flags = 0;
unsigned long iwr0, iwr1, iwr2;
- unsigned long off = (bfin_read_DSPID() & 0xff) ? 0x1000 : 0;
if (val == bfin_read_PLL_CTL())
return;
local_irq_save_hw(flags);
- bfin_iwr_set_pll(&iwr0, &iwr1, &iwr2, off);
+ bfin_iwr_set_pll(&iwr0, &iwr1, &iwr2);
bfin_write16(PLL_CTL, val);
SSYNC();
asm("IDLE;");
- bfin_iwr_restore(iwr0, iwr1, iwr2, off);
+ bfin_iwr_restore(iwr0, iwr1, iwr2);
local_irq_restore_hw(flags);
}
@@ -113,19 +129,18 @@
{
unsigned long flags = 0;
unsigned long iwr0, iwr1, iwr2;
- unsigned long off = (bfin_read_DSPID() & 0xff) ? 0x1000 : 0;
if (val == bfin_read_VR_CTL())
return;
local_irq_save_hw(flags);
- bfin_iwr_set_pll(&iwr0, &iwr1, &iwr2, off);
+ bfin_iwr_set_pll(&iwr0, &iwr1, &iwr2);
bfin_write16(VR_CTL, val);
SSYNC();
asm("IDLE;");
- bfin_iwr_restore(iwr0, iwr1, iwr2, off);
+ bfin_iwr_restore(iwr0, iwr1, iwr2);
local_irq_restore_hw(flags);
}
Modified: trunk/arch/blackfin/mach-bf561/hotplug.c (8258 => 8259)
--- trunk/arch/blackfin/mach-bf561/hotplug.c 2010-01-29 02:54:42 UTC (rev 8258)
+++ trunk/arch/blackfin/mach-bf561/hotplug.c 2010-01-29 03:43:00 UTC (rev 8259)
@@ -13,7 +13,6 @@
void platform_cpu_die(void)
{
unsigned long iwr;
- unsigned long off = smp_processor_id() ? 0x1000 : 0;
hotplug_coreb = 1;
/* disable core timer */
@@ -24,7 +23,7 @@
SSYNC();
/* set CoreB wakeup by ipi0, iwr will be discarded */
- bfin_iwr_set_sup0(&iwr, &iwr, &iwr, off);
+ bfin_iwr_set_sup0(&iwr, &iwr, &iwr);
SSYNC();
coreb_die();
Modified: trunk/arch/blackfin/mach-common/dpmc.c (8258 => 8259)
--- trunk/arch/blackfin/mach-common/dpmc.c 2010-01-29 02:54:42 UTC (rev 8258)
+++ trunk/arch/blackfin/mach-common/dpmc.c 2010-01-29 03:43:00 UTC (rev 8259)
@@ -61,47 +61,62 @@
}
#ifdef CONFIG_CPU_FREQ
-static void bfin_core_idle(void *info)
+# ifdef CONFIG_SMP
+static void bfin_idle_this_cpu(void *info)
{
unsigned long flags = 0;
unsigned long iwr0, iwr1, iwr2;
unsigned int cpu = smp_processor_id();
- unsigned long off = cpu ? 0x1000 : 0;
local_irq_save_hw(flags);
- bfin_iwr_set_sup0(&iwr0, &iwr1, &iwr2, off);
+ bfin_iwr_set_sup0(&iwr0, &iwr1, &iwr2);
platform_clear_ipi(cpu, IRQ_SUPPLE_0);
SSYNC();
asm("IDLE;");
- bfin_iwr_restore(iwr0, iwr1, iwr2, off);
+ bfin_iwr_restore(iwr0, iwr1, iwr2);
local_irq_restore_hw(flags);
}
-static int
-vreg_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
+static void bfin_idle_cpu(void)
{
- struct cpufreq_freqs *freq = data;
+ smp_call_function(bfin_idle_this_cpu, NULL, 0);
+}
+
+static void bfin_wakeup_cpu(void)
+{
unsigned int cpu;
unsigned int this_cpu = smp_processor_id();
cpumask_t mask = cpu_online_map;
+
cpu_clear(this_cpu, mask);
+ for_each_cpu_mask(cpu, mask)
+ platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0);
+}
- if (((struct cpufreq_freqs *)data)->cpu != CPUFREQ_CPU)
+# else
+static void bfin_idle_cpu(void) {}
+static void bfin_wakeup_cpu(void) {}
+# endif
+
+static int
+vreg_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
+{
+ struct cpufreq_freqs *freq = data;
+
+ if (freq->cpu != CPUFREQ_CPU)
return 0;
if (val == CPUFREQ_PRECHANGE && freq->old < freq->new) {
- smp_call_function(bfin_core_idle, NULL, 0);
+ bfin_idle_cpu();
bfin_set_vlev(bfin_get_vlev(freq->new));
udelay(pdata->vr_settling_time); /* Wait until Volatge settled */
- for_each_cpu_mask(cpu, mask)
- platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0);
+ bfin_wakeup_cpu();
} else if (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) {
- smp_call_function(bfin_core_idle, NULL, 0);
+ bfin_idle_cpu();
bfin_set_vlev(bfin_get_vlev(freq->new));
- for_each_cpu_mask(cpu, mask)
- platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0);
+ bfin_wakeup_cpu();
}
return 0;