pm-r8a7740.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * r8a7740 power management support
  3. *
  4. * Copyright (C) 2012 Renesas Solutions Corp.
  5. * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/console.h>
  12. #include <linux/io.h>
  13. #include <linux/suspend.h>
  14. #include "common.h"
  15. #include "pm-rmobile.h"
  16. #define SYSC_BASE IOMEM(0xe6180000)
  17. #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
  18. static int r8a7740_pd_a3sm_suspend(void)
  19. {
  20. /*
  21. * The A3SM domain contains the CPU core and therefore it should
  22. * only be turned off if the CPU is not in use.
  23. */
  24. return -EBUSY;
  25. }
  26. static int r8a7740_pd_a3sp_suspend(void)
  27. {
  28. /*
  29. * Serial consoles make use of SCIF hardware located in A3SP,
  30. * keep such power domain on if "no_console_suspend" is set.
  31. */
  32. return console_suspend_enabled ? 0 : -EBUSY;
  33. }
  34. static int r8a7740_pd_d4_suspend(void)
  35. {
  36. /*
  37. * The D4 domain contains the Coresight-ETM hardware block and
  38. * therefore it should only be turned off if the debug module is
  39. * not in use.
  40. */
  41. return -EBUSY;
  42. }
  43. static struct rmobile_pm_domain r8a7740_pm_domains[] = {
  44. {
  45. .genpd.name = "A4LC",
  46. .base = SYSC_BASE,
  47. .bit_shift = 1,
  48. }, {
  49. .genpd.name = "A4MP",
  50. .base = SYSC_BASE,
  51. .bit_shift = 2,
  52. }, {
  53. .genpd.name = "D4",
  54. .base = SYSC_BASE,
  55. .bit_shift = 3,
  56. .gov = &pm_domain_always_on_gov,
  57. .suspend = r8a7740_pd_d4_suspend,
  58. }, {
  59. .genpd.name = "A4R",
  60. .base = SYSC_BASE,
  61. .bit_shift = 5,
  62. }, {
  63. .genpd.name = "A3RV",
  64. .base = SYSC_BASE,
  65. .bit_shift = 6,
  66. }, {
  67. .genpd.name = "A4S",
  68. .base = SYSC_BASE,
  69. .bit_shift = 10,
  70. .no_debug = true,
  71. }, {
  72. .genpd.name = "A3SP",
  73. .base = SYSC_BASE,
  74. .bit_shift = 11,
  75. .gov = &pm_domain_always_on_gov,
  76. .no_debug = true,
  77. .suspend = r8a7740_pd_a3sp_suspend,
  78. }, {
  79. .genpd.name = "A3SM",
  80. .base = SYSC_BASE,
  81. .bit_shift = 12,
  82. .gov = &pm_domain_always_on_gov,
  83. .suspend = r8a7740_pd_a3sm_suspend,
  84. }, {
  85. .genpd.name = "A3SG",
  86. .base = SYSC_BASE,
  87. .bit_shift = 13,
  88. }, {
  89. .genpd.name = "A4SU",
  90. .base = SYSC_BASE,
  91. .bit_shift = 20,
  92. },
  93. };
  94. void __init r8a7740_init_pm_domains(void)
  95. {
  96. rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
  97. pm_genpd_add_subdomain_names("A4R", "A3RV");
  98. pm_genpd_add_subdomain_names("A4S", "A3SP");
  99. pm_genpd_add_subdomain_names("A4S", "A3SM");
  100. pm_genpd_add_subdomain_names("A4S", "A3SG");
  101. }
  102. #endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
  103. #ifdef CONFIG_SUSPEND
  104. static int r8a7740_enter_suspend(suspend_state_t suspend_state)
  105. {
  106. cpu_do_idle();
  107. return 0;
  108. }
  109. static void r8a7740_suspend_init(void)
  110. {
  111. shmobile_suspend_ops.enter = r8a7740_enter_suspend;
  112. }
  113. #else
  114. static void r8a7740_suspend_init(void) {}
  115. #endif
  116. void __init r8a7740_pm_init(void)
  117. {
  118. r8a7740_suspend_init();
  119. }