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