sleep.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * sleep mode for CSR SiRFprimaII
  3. *
  4. * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
  5. *
  6. * Licensed under GPLv2 or later.
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/ptrace.h>
  10. #include <asm/assembler.h>
  11. #include "pm.h"
  12. #define DENALI_CTL_22_OFF 0x58
  13. #define DENALI_CTL_112_OFF 0x1c0
  14. .text
  15. ENTRY(sirfsoc_finish_suspend)
  16. @ r5: mem controller
  17. ldr r0, =sirfsoc_memc_base
  18. ldr r5, [r0]
  19. @ r6: pwrc base offset
  20. ldr r0, =sirfsoc_pwrc_base
  21. ldr r6, [r0]
  22. @ r7: rtc iobrg controller
  23. ldr r0, =sirfsoc_rtciobrg_base
  24. ldr r7, [r0]
  25. @ Read the power control register and set the
  26. @ sleep force bit.
  27. add r0, r6, #SIRFSOC_PWRC_PDN_CTRL
  28. bl __sirfsoc_rtc_iobrg_readl
  29. orr r0,r0,#SIRFSOC_PWR_SLEEPFORCE
  30. add r1, r6, #SIRFSOC_PWRC_PDN_CTRL
  31. bl sirfsoc_rtc_iobrg_pre_writel
  32. mov r1, #0x1
  33. @ read the MEM ctl register and set the self
  34. @ refresh bit
  35. ldr r2, [r5, #DENALI_CTL_22_OFF]
  36. orr r2, r2, #0x1
  37. @ Following code has to run from cache since
  38. @ the RAM is going to self refresh mode
  39. .align 5
  40. str r2, [r5, #DENALI_CTL_22_OFF]
  41. 1:
  42. ldr r4, [r5, #DENALI_CTL_112_OFF]
  43. tst r4, #0x1
  44. bne 1b
  45. @ write SLEEPFORCE through rtc iobridge
  46. str r1, [r7]
  47. @ wait rtc io bridge sync
  48. 1:
  49. ldr r3, [r7]
  50. tst r3, #0x01
  51. bne 1b
  52. b .