6xx-suspend.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Enter and leave sleep state on chips with 6xx-style HID0
  3. * power management bits, which don't leave sleep state via reset.
  4. *
  5. * Author: Scott Wood <scottwood@freescale.com>
  6. *
  7. * Copyright (c) 2006-2007 Freescale Semiconductor, Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License version 2 as published
  11. * by the Free Software Foundation.
  12. */
  13. #include <asm/ppc_asm.h>
  14. #include <asm/reg.h>
  15. #include <asm/thread_info.h>
  16. #include <asm/asm-offsets.h>
  17. _GLOBAL(mpc6xx_enter_standby)
  18. mflr r4
  19. mfspr r5, SPRN_HID0
  20. rlwinm r5, r5, 0, ~(HID0_DOZE | HID0_NAP)
  21. oris r5, r5, HID0_SLEEP@h
  22. mtspr SPRN_HID0, r5
  23. isync
  24. lis r5, ret_from_standby@h
  25. ori r5, r5, ret_from_standby@l
  26. mtlr r5
  27. CURRENT_THREAD_INFO(r5, r1)
  28. lwz r6, TI_LOCAL_FLAGS(r5)
  29. ori r6, r6, _TLF_SLEEPING
  30. stw r6, TI_LOCAL_FLAGS(r5)
  31. mfmsr r5
  32. ori r5, r5, MSR_EE
  33. oris r5, r5, MSR_POW@h
  34. sync
  35. mtmsr r5
  36. isync
  37. 1: b 1b
  38. ret_from_standby:
  39. mfspr r5, SPRN_HID0
  40. rlwinm r5, r5, 0, ~HID0_SLEEP
  41. mtspr SPRN_HID0, r5
  42. mtlr r4
  43. blr