[POWERPC] Fix sleep on powerbook 3400
authorPaul Mackerras <paulus@samba.org>
Wed, 19 Dec 2007 11:45:31 +0000 (22:45 +1100)
committerPaul Mackerras <paulus@samba.org>
Wed, 19 Dec 2007 11:45:31 +0000 (22:45 +1100)
commit887ef35ae4eb269839e0f296b132edc15477db1c
treea4912dbf2aadf46c8ecee495bb9a854727b99e5c
parent98f6740ea6d532550c4010960fcead2c32bd56f5
[POWERPC] Fix sleep on powerbook 3400

Sleep on the powerbook 3400 has been broken since the change that made
powerbook_sleep_3400 call pmac_suspend_devices(), which disables
interrupts.  There are a couple of loops in powerbook_sleep_3400 that
depend on interrupts being enabled, and in fact it has to have
interrupts enabled at the point of going to sleep since it is an
interrupt from the PMU that wakes it up.

This fixes it by using pmu_wait_complete() instead of a spinloop, and
by explicitly enabling interrupts before putting the CPU into sleep
mode (which is OK since all interrupts except the PMU interrupt have
been disabled at the interrupt controller by this stage).

This changes the logic so that it keeps putting the CPU into sleep mode
until the completion of the interrupt transaction from the PMU that
signals the end of sleep.  Also, we now call pmu_unlock() before sleep
so that the via_pmu_interrupt() code can process the interrupt event
from the PMU properly.

Now that generic code saves and restores PCI state, it is no longer
necessary to do that here.  Thus pbook_pci_save/restore and related
functions are no longer necessary, so this removes them.

Lastly, this moves the ioremap of the memory controller to init code
rather than doing it on every sleep/wakeup cycle.

Signed-off-by: Paul Mackerras <paulus@samba.org>
drivers/macintosh/via-pmu.c