Index: linux-work/init/calibrate.c =================================================================== --- linux-work.orig/init/calibrate.c 2005-03-15 12:00:12.000000000 +1100 +++ linux-work/init/calibrate.c 2005-04-22 13:41:16.000000000 +1000 @@ -24,7 +24,7 @@ */ #define LPS_PREC 8 -void __devinit calibrate_delay(void) +void calibrate_delay(void) { unsigned long ticks, loopbit; int lps_precision = LPS_PREC; Index: linux-work/arch/ppc/platforms/pmac_cpufreq.c =================================================================== --- linux-work.orig/arch/ppc/platforms/pmac_cpufreq.c 2005-04-05 17:46:01.000000000 +1000 +++ linux-work/arch/ppc/platforms/pmac_cpufreq.c 2005-04-22 14:01:51.000000000 +1000 @@ -46,7 +46,7 @@ * but this is an __init function ! So you MUST go edit * init/main.c to make it non-init before enabling DEBUG_FREQ */ -#undef DEBUG_FREQ +#define DEBUG_FREQ /* * There is a problem with the core cpufreq code on SMP kernels, @@ -56,6 +56,12 @@ #warning "WARNING, CPUFREQ not recommended on SMP kernels" #endif +#ifdef DEBUG_FREQ +#define DBG(fmt...) printk(fmt) +#else +#define DBG(fmt...) +#endif + extern void low_choose_7447a_dfs(int dfs); extern void low_choose_750fx_pll(int pll); extern void low_sleep_handler(void); @@ -220,6 +226,7 @@ /* If ramping up, set voltage first */ if (low_speed == 0) { + DBG("ramping voltage up ...\n"); pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05); /* Delay is way too big but it's ok, we schedule */ local_delay(10); @@ -230,6 +237,8 @@ if (low_speed == ((gpio & 0x01) == 0)) goto skip; + DBG("starting slewing process ...\n"); + pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, frequency_gpio, low_speed ? 0x04 : 0x05); udelay(200); @@ -239,9 +248,13 @@ local_delay(1); gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, slew_done_gpio, 0); } while((gpio & 0x02) == 0); + + DBG("slewing done\n"); skip: /* If ramping down, set voltage last */ if (low_speed == 1) { + DBG("ramping voltage down\n"); + pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04); /* Delay is way too big but it's ok, we schedule */ local_delay(10); @@ -358,15 +371,21 @@ freqs.new = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq; freqs.cpu = smp_processor_id(); - if (freqs.old == freqs.new) - return 0; + DBG("cpufreq_pmac: switching to mode: %d, notify: %d\n", + speed_mode, notify); + if (freqs.old == freqs.new) { + DBG("same freq, skipping\n"); + return 0; + } + DBG("switching...\n"); if (notify) cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); if (speed_mode == PMAC_CPU_LOW_SPEED && cpu_has_feature(CPU_FTR_L3CR)) { l3cr = _get_L3CR(); if (l3cr & L3CR_L3E) { + DBG("turning off L3 cache, prev: %lx\n", l3cr); prev_l3cr = l3cr; _set_L3CR(0); } @@ -375,12 +394,15 @@ if (speed_mode == PMAC_CPU_HIGH_SPEED && cpu_has_feature(CPU_FTR_L3CR)) { l3cr = _get_L3CR(); - if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr) + if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr) { + DBG("turning on L3 cache, value: %lx\n", prev_l3cr); _set_L3CR(prev_l3cr); + } } if (notify) cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); cur_freq = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq; + DBG("cur freq is now: %u\n", cur_freq); return 0; } @@ -456,6 +478,8 @@ */ no_schedule = 1; sleep_freq = cur_freq; + DBG("cpufreq_pmac: suspending cur=%u, low: %u\n", + cur_freq, low_freq); if (cur_freq == low_freq) do_set_cpu_speed(PMAC_CPU_HIGH_SPEED, 0); return 0; @@ -469,6 +493,8 @@ else cur_freq = 0; + DBG("cpufreq_pmac: resuming cur=%u\n", cur_freq); + /* We don't, hrm... we don't really know our speed here, best * is that we force a switch to whatever it was, which is * probably high speed due to our suspend() routine @@ -487,7 +513,9 @@ .init = pmac_cpufreq_cpu_init, .suspend = pmac_cpufreq_suspend, .resume = pmac_cpufreq_resume, +#ifndef DEBUG_FREQ .flags = CPUFREQ_PM_NO_WARN, +#endif .name = "powermac", .owner = THIS_MODULE, }; @@ -518,6 +546,11 @@ if (slew_done_gpio_np) slew_done_gpio = read_gpio(slew_done_gpio_np); + DBG("got gpios: v=%x (%02x), f=%x (%02x), s=%x (%02x)\n", + voltage_gpio, (u32)pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, voltage_gpio, 0), + frequency_gpio, (u32)pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0), + slew_done_gpio, (u32)pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, slew_done_gpio, 0)); + /* If we use the frequency GPIOs, calculate the min/max speeds based * on the bus frequencies */ @@ -548,12 +581,14 @@ */ if (low_freq < 98000000) low_freq = 101000000; - + + DBG("bus frequencies: low=%u, hi=%u\n", low_freq, hi_freq); + /* Convert those to CPU core clocks */ low_freq = (low_freq * (*ratio)) / 2000; hi_freq = (hi_freq * (*ratio)) / 2000; - /* Now we get the frequencies, we read the GPIO to see what is out current + /* Now we get the frequencies, we read the GPIO to see what is our current * speed */ rc = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0); @@ -663,30 +698,38 @@ if (!cpunode) goto out; + DBG("pmac_cpufreq: hello !\n"); + /* Get current cpu clock freq */ value = (u32 *)get_property(cpunode, "clock-frequency", NULL); if (!value) goto out; cur_freq = (*value) / 1000; + DBG("pmac_cpufreq: clock-frequency property: %u\n", cur_freq); + /* Check for 7447A based MacRISC3 */ if (machine_is_compatible("MacRISC3") && get_property(cpunode, "dynamic-power-step", NULL) && PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { + DBG("pmac_cpufreq: Initing for 7447A\n"); pmac_cpufreq_init_7447A(cpunode); /* Check for other MacRISC3 machines */ } else if (machine_is_compatible("PowerBook3,4") || machine_is_compatible("PowerBook3,5") || machine_is_compatible("MacRISC3")) { + DBG("pmac_cpufreq: Initing for MacRISC3\n"); pmac_cpufreq_init_MacRISC3(cpunode); /* Else check for iBook2 500/600 */ } else if (machine_is_compatible("PowerBook4,1")) { + DBG("pmac_cpufreq: Initing for older iBook G3\n"); hi_freq = cur_freq; low_freq = 400000; set_speed_proc = pmu_set_cpu_speed; } /* Else check for TiPb 400 & 500 */ else if (machine_is_compatible("PowerBook3,2")) { + DBG("pmac_cpufreq: Initing for older tipb\n"); /* We only know about the 400 MHz and the 500Mhz model * they both have 300 MHz as low frequency */ @@ -697,8 +740,10 @@ set_speed_proc = pmu_set_cpu_speed; } /* Else check for 750FX */ - else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) + else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) { + DBG("pmac_cpufreq: Initing for 750fx\n"); pmac_cpufreq_init_750FX(cpunode); + } out: if (set_speed_proc == NULL) return -ENODEV;