• Benjamin Herrenschmidt's avatar
    [PATCH] ppc32: Fix nasty sleep/wakeup problem · 0086b5ec
    Benjamin Herrenschmidt authored
    Despite all the care lately in making the powermac sleep/wakeup as
    robust as possible, there is still a nasty related to the use of cpufreq
    on PMU based machines.  Unfortunately, it affects paulus old powerbook
    so I have to fix it :)
    
    We didn't manage to understand what is precisely going on, it leads to
    memory corruption and might have to do with RAM not beeing properly
    refreshed when a cpufreq transition is done right before the sleep.
    
    The best workaround (and less intrusive at this point) we could come up
    with is included in this patch.  We basically do _not_ force a switch to
    high speed on suspend anymore (that is what is causing the problem) on
    those machines.  We still force a speed switch on wakeup (since we don't
    know what speed we are coming back from sleep at, and that seems to work
    fine).
    
    Since, during this short interval, the actual CPU speed might be
    incorrect, we also hack around by multiplying loops_per_jiffy by 2 (max
    speed factor on those machines) during early wakeup stage to make sure
    udelay's during that time aren't too short.
    
    For after 2.6.12, we'll change udelay implementation to use the CPU
    timebase (which is always constant) instead like we do on ppc64 and thus
    get rid of all those problems.
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    0086b5ec
pmac_cpufreq.c 18.6 KB