sleep-sh7372.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * sh7372 lowlevel sleep code for "Core Standby Mode"
  3. *
  4. * Copyright (C) 2011 Magnus Damm
  5. *
  6. * In "Core Standby Mode" the ARM core is off, but L2 cache is still on
  7. *
  8. * Based on mach-omap2/sleep34xx.S
  9. *
  10. * (C) Copyright 2007 Texas Instruments
  11. * Karthik Dasu <karthik-dp@ti.com>
  12. *
  13. * (C) Copyright 2004 Texas Instruments, <www.ti.com>
  14. * Richard Woodruff <r-woodruff2@ti.com>
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License as
  18. * published by the Free Software Foundation; either version 2 of
  19. * the License, or (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  29. * MA 02111-1307 USA
  30. */
  31. #include <linux/linkage.h>
  32. #include <linux/init.h>
  33. #include <asm/memory.h>
  34. #include <asm/assembler.h>
  35. #if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
  36. .align 12
  37. .text
  38. .global sh7372_resume_core_standby_sysc
  39. sh7372_resume_core_standby_sysc:
  40. ldr pc, 1f
  41. .align 2
  42. .globl sh7372_cpu_resume
  43. sh7372_cpu_resume:
  44. 1: .space 4
  45. #define SPDCR 0xe6180008
  46. /* A3SM & A4S power down */
  47. .global sh7372_do_idle_sysc
  48. sh7372_do_idle_sysc:
  49. mov r8, r0 /* sleep mode passed in r0 */
  50. /*
  51. * Clear the SCTLR.C bit to prevent further data cache
  52. * allocation. Clearing SCTLR.C would make all the data accesses
  53. * strongly ordered and would not hit the cache.
  54. */
  55. mrc p15, 0, r0, c1, c0, 0
  56. bic r0, r0, #(1 << 2) @ Disable the C bit
  57. mcr p15, 0, r0, c1, c0, 0
  58. isb
  59. /*
  60. * Clean and invalidate data cache again.
  61. */
  62. ldr r1, kernel_flush
  63. blx r1
  64. /* disable L2 cache in the aux control register */
  65. mrc p15, 0, r10, c1, c0, 1
  66. bic r10, r10, #2
  67. mcr p15, 0, r10, c1, c0, 1
  68. isb
  69. /*
  70. * The kernel doesn't interwork: v7_flush_dcache_all in particluar will
  71. * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled.
  72. * This sequence switches back to ARM. Note that .align may insert a
  73. * nop: bx pc needs to be word-aligned in order to work.
  74. */
  75. THUMB( .thumb )
  76. THUMB( .align )
  77. THUMB( bx pc )
  78. THUMB( nop )
  79. .arm
  80. /* Data memory barrier and Data sync barrier */
  81. dsb
  82. dmb
  83. /* SYSC power down */
  84. ldr r0, =SPDCR
  85. str r8, [r0]
  86. 1:
  87. b 1b
  88. .align 2
  89. kernel_flush:
  90. .word v7_flush_dcache_all
  91. #endif