sleep-sh7372.S 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_a3sm
  39. sh7372_resume_core_standby_a3sm:
  40. ldr pc, 1f
  41. 1: .long cpu_resume - PAGE_OFFSET + PLAT_PHYS_OFFSET
  42. .global sh7372_do_idle_a3sm
  43. sh7372_do_idle_a3sm:
  44. /*
  45. * Clear the SCTLR.C bit to prevent further data cache
  46. * allocation. Clearing SCTLR.C would make all the data accesses
  47. * strongly ordered and would not hit the cache.
  48. */
  49. mrc p15, 0, r0, c1, c0, 0
  50. bic r0, r0, #(1 << 2) @ Disable the C bit
  51. mcr p15, 0, r0, c1, c0, 0
  52. isb
  53. /* disable L2 cache in the aux control register */
  54. mrc p15, 0, r10, c1, c0, 1
  55. bic r10, r10, #2
  56. mcr p15, 0, r10, c1, c0, 1
  57. /*
  58. * Invalidate data cache again.
  59. */
  60. ldr r1, kernel_flush
  61. blx r1
  62. /*
  63. * The kernel doesn't interwork: v7_flush_dcache_all in particluar will
  64. * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled.
  65. * This sequence switches back to ARM. Note that .align may insert a
  66. * nop: bx pc needs to be word-aligned in order to work.
  67. */
  68. THUMB( .thumb )
  69. THUMB( .align )
  70. THUMB( bx pc )
  71. THUMB( nop )
  72. .arm
  73. /* Data memory barrier and Data sync barrier */
  74. dsb
  75. dmb
  76. #define SPDCR 0xe6180008
  77. #define A3SM (1 << 12)
  78. /* A3SM power down */
  79. ldr r0, =SPDCR
  80. ldr r1, =A3SM
  81. str r1, [r0]
  82. 1:
  83. b 1b
  84. kernel_flush:
  85. .word v7_flush_dcache_all
  86. #endif