standby.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * PXA27x standby mode
  3. *
  4. * Author: David Burrage
  5. *
  6. * 2005 (c) MontaVista Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #include <linux/linkage.h>
  12. #include <asm/assembler.h>
  13. #include <mach/hardware.h>
  14. #include <mach/pxa2xx-regs.h>
  15. .text
  16. #ifdef CONFIG_PXA27x
  17. ENTRY(pxa_cpu_standby)
  18. ldr r0, =PSSR
  19. mov r1, #(PSSR_PH | PSSR_STS)
  20. mov r2, #PWRMODE_STANDBY
  21. mov r3, #UNCACHED_PHYS_0 @ Read mem context in.
  22. ldr ip, [r3]
  23. b 1f
  24. .align 5
  25. 1: mcr p14, 0, r2, c7, c0, 0 @ put the system into Standby
  26. str r1, [r0] @ make sure PSSR_PH/STS are clear
  27. ret lr
  28. #endif
  29. #ifdef CONFIG_PXA3xx
  30. #define PXA3_MDCNFG 0x0000
  31. #define PXA3_MDCNFG_DMCEN (1 << 30)
  32. #define PXA3_DDR_HCAL 0x0060
  33. #define PXA3_DDR_HCAL_HCRNG 0x1f
  34. #define PXA3_DDR_HCAL_HCPROG (1 << 28)
  35. #define PXA3_DDR_HCAL_HCEN (1 << 31)
  36. #define PXA3_DMCIER 0x0070
  37. #define PXA3_DMCIER_EDLP (1 << 29)
  38. #define PXA3_DMCISR 0x0078
  39. #define PXA3_RCOMP 0x0100
  40. #define PXA3_RCOMP_SWEVAL (1 << 31)
  41. ENTRY(pm_enter_standby_start)
  42. mov r1, #0xf6000000 @ DMEMC_REG_BASE (PXA3_MDCNFG)
  43. add r1, r1, #0x00100000
  44. /*
  45. * Preload the TLB entry for accessing the dynamic memory
  46. * controller registers. Note that page table lookups will
  47. * fail until the dynamic memory controller has been
  48. * reinitialised - and that includes MMU page table walks.
  49. * This also means that only the dynamic memory controller
  50. * can be reliably accessed in the code following standby.
  51. */
  52. ldr r2, [r1] @ Dummy read PXA3_MDCNFG
  53. mcr p14, 0, r0, c7, c0, 0
  54. .rept 8
  55. nop
  56. .endr
  57. ldr r0, [r1, #PXA3_DDR_HCAL] @ Clear (and wait for) HCEN
  58. bic r0, r0, #PXA3_DDR_HCAL_HCEN
  59. str r0, [r1, #PXA3_DDR_HCAL]
  60. 1: ldr r0, [r1, #PXA3_DDR_HCAL]
  61. tst r0, #PXA3_DDR_HCAL_HCEN
  62. bne 1b
  63. ldr r0, [r1, #PXA3_RCOMP] @ Initiate RCOMP
  64. orr r0, r0, #PXA3_RCOMP_SWEVAL
  65. str r0, [r1, #PXA3_RCOMP]
  66. mov r0, #~0 @ Clear interrupts
  67. str r0, [r1, #PXA3_DMCISR]
  68. ldr r0, [r1, #PXA3_DMCIER] @ set DMIER[EDLP]
  69. orr r0, r0, #PXA3_DMCIER_EDLP
  70. str r0, [r1, #PXA3_DMCIER]
  71. ldr r0, [r1, #PXA3_DDR_HCAL] @ clear HCRNG, set HCPROG, HCEN
  72. bic r0, r0, #PXA3_DDR_HCAL_HCRNG
  73. orr r0, r0, #PXA3_DDR_HCAL_HCEN | PXA3_DDR_HCAL_HCPROG
  74. str r0, [r1, #PXA3_DDR_HCAL]
  75. 1: ldr r0, [r1, #PXA3_DMCISR]
  76. tst r0, #PXA3_DMCIER_EDLP
  77. beq 1b
  78. ldr r0, [r1, #PXA3_MDCNFG] @ set PXA3_MDCNFG[DMCEN]
  79. orr r0, r0, #PXA3_MDCNFG_DMCEN
  80. str r0, [r1, #PXA3_MDCNFG]
  81. 1: ldr r0, [r1, #PXA3_MDCNFG]
  82. tst r0, #PXA3_MDCNFG_DMCEN
  83. beq 1b
  84. ldr r0, [r1, #PXA3_DDR_HCAL] @ set PXA3_DDR_HCAL[HCRNG]
  85. orr r0, r0, #2 @ HCRNG
  86. str r0, [r1, #PXA3_DDR_HCAL]
  87. ldr r0, [r1, #PXA3_DMCIER] @ Clear the interrupt
  88. bic r0, r0, #0x20000000
  89. str r0, [r1, #PXA3_DMCIER]
  90. ret lr
  91. ENTRY(pm_enter_standby_end)
  92. #endif