sleep.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * arch/arm/mach-tegra/sleep.S
  3. *
  4. * Copyright (c) 2010-2011, NVIDIA Corporation.
  5. * Copyright (c) 2011, Google, Inc.
  6. *
  7. * Author: Colin Cross <ccross@android.com>
  8. * Gary King <gking@nvidia.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  18. * more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  23. */
  24. #include <linux/linkage.h>
  25. #include <asm/assembler.h>
  26. #include <asm/cache.h>
  27. #include <asm/cp15.h>
  28. #include <asm/hardware/cache-l2x0.h>
  29. #include "iomap.h"
  30. #include "flowctrl.h"
  31. #include "sleep.h"
  32. #ifdef CONFIG_PM_SLEEP
  33. /*
  34. * tegra_disable_clean_inv_dcache
  35. *
  36. * disable, clean & invalidate the D-cache
  37. *
  38. * Corrupted registers: r1-r3, r6, r8, r9-r11
  39. */
  40. ENTRY(tegra_disable_clean_inv_dcache)
  41. stmfd sp!, {r0, r4-r5, r7, r9-r11, lr}
  42. dmb @ ensure ordering
  43. /* Disable the D-cache */
  44. mrc p15, 0, r2, c1, c0, 0
  45. bic r2, r2, #CR_C
  46. mcr p15, 0, r2, c1, c0, 0
  47. isb
  48. /* Flush the D-cache */
  49. bl v7_flush_dcache_louis
  50. /* Trun off coherency */
  51. exit_smp r4, r5
  52. ldmfd sp!, {r0, r4-r5, r7, r9-r11, pc}
  53. ENDPROC(tegra_disable_clean_inv_dcache)
  54. /*
  55. * tegra_sleep_cpu_finish(unsigned long v2p)
  56. *
  57. * enters suspend in LP2 by turning off the mmu and jumping to
  58. * tegra?_tear_down_cpu
  59. */
  60. ENTRY(tegra_sleep_cpu_finish)
  61. /* Flush and disable the L1 data cache */
  62. bl tegra_disable_clean_inv_dcache
  63. mov32 r6, tegra_tear_down_cpu
  64. ldr r1, [r6]
  65. add r1, r1, r0
  66. mov32 r3, tegra_shut_off_mmu
  67. add r3, r3, r0
  68. mov r0, r1
  69. mov pc, r3
  70. ENDPROC(tegra_sleep_cpu_finish)
  71. /*
  72. * tegra_shut_off_mmu
  73. *
  74. * r0 = physical address to jump to with mmu off
  75. *
  76. * called with VA=PA mapping
  77. * turns off MMU, icache, dcache and branch prediction
  78. */
  79. .align L1_CACHE_SHIFT
  80. .pushsection .idmap.text, "ax"
  81. ENTRY(tegra_shut_off_mmu)
  82. mrc p15, 0, r3, c1, c0, 0
  83. movw r2, #CR_I | CR_Z | CR_C | CR_M
  84. bic r3, r3, r2
  85. dsb
  86. mcr p15, 0, r3, c1, c0, 0
  87. isb
  88. #ifdef CONFIG_CACHE_L2X0
  89. /* Disable L2 cache */
  90. mov32 r4, TEGRA_ARM_PERIF_BASE + 0x3000
  91. mov r5, #0
  92. str r5, [r4, #L2X0_CTRL]
  93. #endif
  94. mov pc, r0
  95. ENDPROC(tegra_shut_off_mmu)
  96. .popsection
  97. #endif