Subject: Re: [PATCH 4/5] powerpc/85xx: Add suspend/resume support

From: Anton Vorontsov <[email-masked]>
Date: Fri, 28 Aug 2009 19:15:37 +0400

On Fri, Aug 28, 2009 at 12:38:51AM -0500, Kumar Gala wrote:
> 
> On Aug 27, 2009, at 12:30 PM, Anton Vorontsov wrote:
> 
> >This patch adds suspend/resume support for MPC8540-compatible and
> >MPC8569 CPUs.
> >
> >MPC8540-compatible PMCs are trivial: we just write SLP bit into PM
> >control and status register.
> >
> >MPC8569 is a bit trickier, QE turns off during suspend and so on
> >resume we must reload QE microcode firmware and reset QE.
> >
> >So far we don't support Deep Sleep mode as found in newer MPC85xx
> >CPUs (i.e. MPC8536). It can be relatively easy implemented though,
> >and for it we reserve 'mem' suspend type.
> >
> >Signed-off-by: Anton Vorontsov <[email-masked]>
> >---
> >arch/powerpc/Kconfig                  |    2 +-
> >arch/powerpc/platforms/85xx/Makefile  |    1 +
> >arch/powerpc/platforms/85xx/suspend.c |  115
> >+++++++++++++++++++++++++++++++++
> >3 files changed, 117 insertions(+), 1 deletions(-)
> >create mode 100644 arch/powerpc/platforms/85xx/suspend.c
> 
> How did you test this?

--- Prerequisites:

1. Following patches should be applied in addition:

   rtc: Set wakeup capability for I2C and SPI RTC drivers
   [5/5] ucc_geth: Implement suspend/resume and Wake-On-LAN support
   [4/5] ucc_geth: Remove UGETH_MAGIC_PACKET Kconfig symbol and code
   [3/5] ucc_geth: Factor out MAC initialization steps into a call
   [2/5] powerpc/qe: Implement qe_alive_during_sleep() helper function
   [1/5] ucc_geth: Fix NULL pointer dereference in uec_get_ethtool_stats()

2. QE microcode should be placed into /lib/firmware/, i.e.
   wget http://opensource.freescale.com/firmware/fsl_qe_ucode_8569_10.zip
   unzip fsl_qe_ucode_8569_10.zip
   cp fsl_qe_ucode_8569_10.bin /<nfsroot>/lib/firmware/fsl_qe_ucode_8569.bin

--- Wakeup on RTC alarm:

# cd /sys/class/rtc/rtc0/
# echo $(( `cat since_epoch` + 10 )) > wakealarm
# echo standby > /sys/power/state
mpc85xx-pmc e00e0080.power: firmware: requesting fsl_qe_ucode_8569.bin
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.02 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.

The board is now suspended, CPU asserted ASLEEP signal that is
reflected by the ASLEEP LED on the board (the LED is near UEC2
port). 10 seconds later the board will wakeup:

qe-firmware: firmware 'MPC8569 QE Microcode Rel_B6900155' for 8569 V1.0
qe-firmware: uploading microcode 'MPC8569 QE Microcode Rel_B69001' version 1.0.0
pci 0000:00:00.0: enabling device (0106 -> 0107)
Restarting tasks ... done.
PHY: mdio@e0082120:07 - Link is Up - 100/Full

--- Wakeup on PHY/link changes (no magic packet support in MPC8569, as
    QE turns off during sleep):

# ethtool -s eth0 wol p
# echo standby > /sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.00 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.

To wakeup, trigger the PHY interrupt (e.g. pull out the ethernet
cable from eth0):

qe-firmware: firmware 'MPC8569 QE Microcode Rel_B6900155' for 8569 V1.0
qe-firmware: uploading microcode 'MPC8569 QE Microcode Rel_B69001' version 1.0.0
pci 0000:00:00.0: enabling device (0106 -> 0107)
Restarting tasks ... done.

UCC magic packet detection was tested on MPC8360E-MDS boards
(ethtool -s eth0 wol g), I'll send power management support
patches for 83xx QE boards soon.

Thanks,

-- 
Anton Vorontsov
email: [email-masked]
irc://irc.freenode.net/bd2