sleep-tegra20.S 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "sleep.h"
  23. #include "flowctrl.h"
  24. #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PM_SLEEP)
  25. /*
  26. * tegra20_hotplug_shutdown(void)
  27. *
  28. * puts the current cpu in reset
  29. * should never return
  30. */
  31. ENTRY(tegra20_hotplug_shutdown)
  32. /* Put this CPU down */
  33. cpu_id r0
  34. bl tegra20_cpu_shutdown
  35. mov pc, lr @ should never get here
  36. ENDPROC(tegra20_hotplug_shutdown)
  37. /*
  38. * tegra20_cpu_shutdown(int cpu)
  39. *
  40. * r0 is cpu to reset
  41. *
  42. * puts the specified CPU in wait-for-event mode on the flow controller
  43. * and puts the CPU in reset
  44. * can be called on the current cpu or another cpu
  45. * if called on the current cpu, does not return
  46. * MUST NOT BE CALLED FOR CPU 0.
  47. *
  48. * corrupts r0-r3, r12
  49. */
  50. ENTRY(tegra20_cpu_shutdown)
  51. cmp r0, #0
  52. moveq pc, lr @ must not be called for CPU 0
  53. cpu_to_halt_reg r1, r0
  54. ldr r3, =TEGRA_FLOW_CTRL_VIRT
  55. mov r2, #FLOW_CTRL_WAITEVENT | FLOW_CTRL_JTAG_RESUME
  56. str r2, [r3, r1] @ put flow controller in wait event mode
  57. ldr r2, [r3, r1]
  58. isb
  59. dsb
  60. movw r1, 0x1011
  61. mov r1, r1, lsl r0
  62. ldr r3, =TEGRA_CLK_RESET_VIRT
  63. str r1, [r3, #0x340] @ put slave CPU in reset
  64. isb
  65. dsb
  66. cpu_id r3
  67. cmp r3, r0
  68. beq .
  69. mov pc, lr
  70. ENDPROC(tegra20_cpu_shutdown)
  71. #endif