sleep-t20.S 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
  3. * Copyright (c) 2011, Google, Inc.
  4. *
  5. * Author: Colin Cross <ccross@android.com>
  6. * Gary King <gking@nvidia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms and conditions of the GNU General Public License,
  10. * version 2, as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include <linux/linkage.h>
  21. #include <asm/assembler.h>
  22. #include <mach/iomap.h>
  23. #include "sleep.h"
  24. #include "flowctrl.h"
  25. #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PM_SLEEP)
  26. /*
  27. * tegra20_hotplug_shutdown(void)
  28. *
  29. * puts the current cpu in reset
  30. * should never return
  31. */
  32. ENTRY(tegra20_hotplug_shutdown)
  33. /* Turn off SMP coherency */
  34. exit_smp r4, r5
  35. /* Put this CPU down */
  36. cpu_id r0
  37. bl tegra20_cpu_shutdown
  38. mov pc, lr @ should never get here
  39. ENDPROC(tegra20_hotplug_shutdown)
  40. /*
  41. * tegra20_cpu_shutdown(int cpu)
  42. *
  43. * r0 is cpu to reset
  44. *
  45. * puts the specified CPU in wait-for-event mode on the flow controller
  46. * and puts the CPU in reset
  47. * can be called on the current cpu or another cpu
  48. * if called on the current cpu, does not return
  49. * MUST NOT BE CALLED FOR CPU 0.
  50. *
  51. * corrupts r0-r3, r12
  52. */
  53. ENTRY(tegra20_cpu_shutdown)
  54. cmp r0, #0
  55. moveq pc, lr @ must not be called for CPU 0
  56. cpu_to_halt_reg r1, r0
  57. ldr r3, =TEGRA_FLOW_CTRL_VIRT
  58. mov r2, #FLOW_CTRL_WAITEVENT | FLOW_CTRL_JTAG_RESUME
  59. str r2, [r3, r1] @ put flow controller in wait event mode
  60. ldr r2, [r3, r1]
  61. isb
  62. dsb
  63. movw r1, 0x1011
  64. mov r1, r1, lsl r0
  65. ldr r3, =TEGRA_CLK_RESET_VIRT
  66. str r1, [r3, #0x340] @ put slave CPU in reset
  67. isb
  68. dsb
  69. cpu_id r3
  70. cmp r3, r0
  71. beq .
  72. mov pc, lr
  73. ENDPROC(tegra20_cpu_shutdown)
  74. #endif