pmu.c 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. /*
  2. * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
  3. * http://www.samsung.com/
  4. *
  5. * EXYNOS - CPU PMU(Power Management Unit) support
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/io.h>
  12. #include <linux/of.h>
  13. #include <linux/of_address.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/delay.h>
  16. #include <linux/notifier.h>
  17. #include <linux/reboot.h>
  18. #include "exynos-pmu.h"
  19. #include "regs-pmu.h"
  20. #define PMU_TABLE_END (-1U)
  21. struct exynos_pmu_conf {
  22. unsigned int offset;
  23. u8 val[NUM_SYS_POWERDOWN];
  24. };
  25. struct exynos_pmu_data {
  26. const struct exynos_pmu_conf *pmu_config;
  27. const struct exynos_pmu_conf *pmu_config_extra;
  28. void (*pmu_init)(void);
  29. void (*powerdown_conf)(enum sys_powerdown);
  30. void (*powerdown_conf_extra)(enum sys_powerdown);
  31. };
  32. struct exynos_pmu_context {
  33. struct device *dev;
  34. const struct exynos_pmu_data *pmu_data;
  35. };
  36. static void __iomem *pmu_base_addr;
  37. static struct exynos_pmu_context *pmu_context;
  38. static inline void pmu_raw_writel(u32 val, u32 offset)
  39. {
  40. writel_relaxed(val, pmu_base_addr + offset);
  41. }
  42. static inline u32 pmu_raw_readl(u32 offset)
  43. {
  44. return readl_relaxed(pmu_base_addr + offset);
  45. }
  46. static struct exynos_pmu_conf exynos3250_pmu_config[] = {
  47. /* { .offset = offset, .val = { AFTR, W-AFTR, SLEEP } */
  48. { EXYNOS3_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
  49. { EXYNOS3_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  50. { EXYNOS3_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  51. { EXYNOS3_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
  52. { EXYNOS3_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  53. { EXYNOS3_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  54. { EXYNOS3_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  55. { EXYNOS3_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  56. { EXYNOS3_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  57. { EXYNOS3_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
  58. { EXYNOS3_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x3} },
  59. { EXYNOS3_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  60. { EXYNOS3_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  61. { EXYNOS3_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  62. { EXYNOS3_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  63. { EXYNOS3_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  64. { EXYNOS3_LPDDR_PHY_DLL_LOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  65. { EXYNOS3_CMU_ACLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  66. { EXYNOS3_CMU_SCLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  67. { EXYNOS3_CMU_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  68. { EXYNOS3_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  69. { EXYNOS3_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  70. { EXYNOS3_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  71. { EXYNOS3_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  72. { EXYNOS3_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  73. { EXYNOS3_UPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  74. { EXYNOS3_EPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  75. { EXYNOS3_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  76. { EXYNOS3_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  77. { EXYNOS3_CMU_CLKSTOP_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  78. { EXYNOS3_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  79. { EXYNOS3_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  80. { EXYNOS3_CMU_CLKSTOP_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  81. { EXYNOS3_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  82. { EXYNOS3_CMU_CLKSTOP_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  83. { EXYNOS3_CMU_RESET_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  84. { EXYNOS3_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  85. { EXYNOS3_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  86. { EXYNOS3_CMU_RESET_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  87. { EXYNOS3_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  88. { EXYNOS3_CMU_RESET_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  89. { EXYNOS3_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  90. { EXYNOS3_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  91. { EXYNOS3_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x3} },
  92. { EXYNOS3_TOP_BUS_COREBLK_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  93. { EXYNOS3_TOP_RETENTION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  94. { EXYNOS3_TOP_PWR_COREBLK_SYS_PWR_REG, { 0x3, 0x3, 0x3} },
  95. { EXYNOS3_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  96. { EXYNOS3_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  97. { EXYNOS3_LOGIC_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  98. { EXYNOS3_OSCCLK_GATE_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  99. { EXYNOS3_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  100. { EXYNOS3_PAD_RETENTION_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  101. { EXYNOS3_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  102. { EXYNOS3_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  103. { EXYNOS3_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  104. { EXYNOS3_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  105. { EXYNOS3_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  106. { EXYNOS3_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  107. { EXYNOS3_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  108. { EXYNOS3_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  109. { EXYNOS3_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  110. { EXYNOS3_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  111. { EXYNOS3_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  112. { EXYNOS3_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  113. { EXYNOS3_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  114. { EXYNOS3_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  115. { EXYNOS3_EXT_REGULATOR_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  116. { EXYNOS3_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  117. { EXYNOS3_GPIO_MODE_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  118. { EXYNOS3_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  119. { EXYNOS3_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  120. { EXYNOS3_TOP_ASB_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  121. { EXYNOS3_TOP_ASB_ISOLATION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  122. { EXYNOS3_CAM_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  123. { EXYNOS3_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  124. { EXYNOS3_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  125. { EXYNOS3_LCD0_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  126. { EXYNOS3_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  127. { EXYNOS3_MAUDIO_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  128. { EXYNOS3_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  129. { PMU_TABLE_END,},
  130. };
  131. static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
  132. /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
  133. { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
  134. { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
  135. { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
  136. { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
  137. { S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } },
  138. { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
  139. { S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } },
  140. { S5P_L2_0_LOWPWR, { 0x2, 0x2, 0x3 } },
  141. { S5P_L2_1_LOWPWR, { 0x2, 0x2, 0x3 } },
  142. { S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
  143. { S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
  144. { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
  145. { S5P_APLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  146. { S5P_MPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  147. { S5P_VPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  148. { S5P_EPLL_SYSCLK_LOWPWR, { 0x1, 0x1, 0x0 } },
  149. { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x1, 0x0 } },
  150. { S5P_CMU_RESET_GPSALIVE_LOWPWR, { 0x1, 0x1, 0x0 } },
  151. { S5P_CMU_CLKSTOP_CAM_LOWPWR, { 0x1, 0x1, 0x0 } },
  152. { S5P_CMU_CLKSTOP_TV_LOWPWR, { 0x1, 0x1, 0x0 } },
  153. { S5P_CMU_CLKSTOP_MFC_LOWPWR, { 0x1, 0x1, 0x0 } },
  154. { S5P_CMU_CLKSTOP_G3D_LOWPWR, { 0x1, 0x1, 0x0 } },
  155. { S5P_CMU_CLKSTOP_LCD0_LOWPWR, { 0x1, 0x1, 0x0 } },
  156. { S5P_CMU_CLKSTOP_LCD1_LOWPWR, { 0x1, 0x1, 0x0 } },
  157. { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  158. { S5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x1, 0x0 } },
  159. { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x1, 0x0 } },
  160. { S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x1, 0x0 } },
  161. { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x1, 0x0 } },
  162. { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x1, 0x0 } },
  163. { S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x1, 0x0 } },
  164. { S5P_CMU_RESET_LCD1_LOWPWR, { 0x1, 0x1, 0x0 } },
  165. { S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  166. { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x1, 0x0 } },
  167. { S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } },
  168. { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } },
  169. { S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } },
  170. { S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
  171. { S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  172. { S5P_MODIMIF_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  173. { S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  174. { S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  175. { S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  176. { S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  177. { S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  178. { S5P_PCIE_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  179. { S5P_SATA_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  180. { S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } },
  181. { S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  182. { S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } },
  183. { S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } },
  184. { S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } },
  185. { S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } },
  186. { S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } },
  187. { S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } },
  188. { S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } },
  189. { S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } },
  190. { S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
  191. { S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
  192. { S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } },
  193. { S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } },
  194. { S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  195. { S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } },
  196. { S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } },
  197. { S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } },
  198. { S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } },
  199. { S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } },
  200. { S5P_LCD1_LOWPWR, { 0x7, 0x0, 0x0 } },
  201. { S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } },
  202. { S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } },
  203. { S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } },
  204. { PMU_TABLE_END,},
  205. };
  206. static const struct exynos_pmu_conf exynos4x12_pmu_config[] = {
  207. { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
  208. { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
  209. { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
  210. { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
  211. { S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } },
  212. { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
  213. { S5P_ISP_ARM_LOWPWR, { 0x1, 0x0, 0x0 } },
  214. { S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR, { 0x0, 0x0, 0x0 } },
  215. { S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR, { 0x0, 0x0, 0x0 } },
  216. { S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } },
  217. { S5P_L2_0_LOWPWR, { 0x0, 0x0, 0x3 } },
  218. /* XXX_OPTION register should be set other field */
  219. { S5P_ARM_L2_0_OPTION, { 0x10, 0x10, 0x0 } },
  220. { S5P_L2_1_LOWPWR, { 0x0, 0x0, 0x3 } },
  221. { S5P_ARM_L2_1_OPTION, { 0x10, 0x10, 0x0 } },
  222. { S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
  223. { S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
  224. { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
  225. { S5P_DRAM_FREQ_DOWN_LOWPWR, { 0x1, 0x1, 0x1 } },
  226. { S5P_DDRPHY_DLLOFF_LOWPWR, { 0x1, 0x1, 0x1 } },
  227. { S5P_LPDDR_PHY_DLL_LOCK_LOWPWR, { 0x1, 0x1, 0x1 } },
  228. { S5P_CMU_ACLKSTOP_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  229. { S5P_CMU_SCLKSTOP_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  230. { S5P_CMU_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } },
  231. { S5P_APLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  232. { S5P_MPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  233. { S5P_VPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  234. { S5P_EPLL_SYSCLK_LOWPWR, { 0x1, 0x1, 0x0 } },
  235. { S5P_MPLLUSER_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  236. { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x0, 0x0 } },
  237. { S5P_CMU_RESET_GPSALIVE_LOWPWR, { 0x1, 0x0, 0x0 } },
  238. { S5P_CMU_CLKSTOP_CAM_LOWPWR, { 0x1, 0x0, 0x0 } },
  239. { S5P_CMU_CLKSTOP_TV_LOWPWR, { 0x1, 0x0, 0x0 } },
  240. { S5P_CMU_CLKSTOP_MFC_LOWPWR, { 0x1, 0x0, 0x0 } },
  241. { S5P_CMU_CLKSTOP_G3D_LOWPWR, { 0x1, 0x0, 0x0 } },
  242. { S5P_CMU_CLKSTOP_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } },
  243. { S5P_CMU_CLKSTOP_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
  244. { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, { 0x1, 0x0, 0x0 } },
  245. { S5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
  246. { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x0, 0x0 } },
  247. { S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x0, 0x0 } },
  248. { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x0, 0x0 } },
  249. { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x0, 0x0 } },
  250. { S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } },
  251. { S5P_CMU_RESET_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
  252. { S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  253. { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
  254. { S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } },
  255. { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } },
  256. { S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } },
  257. { S5P_TOP_BUS_COREBLK_LOWPWR, { 0x3, 0x0, 0x0 } },
  258. { S5P_TOP_RETENTION_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } },
  259. { S5P_TOP_PWR_COREBLK_LOWPWR, { 0x3, 0x0, 0x3 } },
  260. { S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
  261. { S5P_OSCCLK_GATE_LOWPWR, { 0x1, 0x0, 0x1 } },
  262. { S5P_LOGIC_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } },
  263. { S5P_OSCCLK_GATE_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } },
  264. { S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  265. { S5P_ONENAND_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  266. { S5P_HSI_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  267. { S5P_HSI_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  268. { S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  269. { S5P_G2D_ACP_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  270. { S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  271. { S5P_USBOTG_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  272. { S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  273. { S5P_HSMMC_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  274. { S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  275. { S5P_CSSYS_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  276. { S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  277. { S5P_SECSS_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  278. { S5P_ROTATOR_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
  279. { S5P_ROTATOR_MEM_OPTION, { 0x10, 0x10, 0x0 } },
  280. { S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } },
  281. { S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  282. { S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } },
  283. { S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } },
  284. { S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } },
  285. { S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } },
  286. { S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } },
  287. { S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } },
  288. { S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR,{ 0x1, 0x0, 0x0 } },
  289. { S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } },
  290. { S5P_PAD_ISOLATION_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  291. { S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } },
  292. { S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
  293. { S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
  294. { S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } },
  295. { S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } },
  296. { S5P_GPIO_MODE_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
  297. { S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
  298. { S5P_TOP_ASB_RESET_LOWPWR, { 0x1, 0x1, 0x1 } },
  299. { S5P_TOP_ASB_ISOLATION_LOWPWR, { 0x1, 0x0, 0x1 } },
  300. { S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } },
  301. { S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } },
  302. { S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } },
  303. { S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } },
  304. { S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } },
  305. { S5P_ISP_LOWPWR, { 0x7, 0x0, 0x0 } },
  306. { S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } },
  307. { S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } },
  308. { S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } },
  309. { S5P_CMU_SYSCLK_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
  310. { S5P_CMU_SYSCLK_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
  311. { PMU_TABLE_END,},
  312. };
  313. static const struct exynos_pmu_conf exynos4412_pmu_config[] = {
  314. { S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } },
  315. { S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } },
  316. { S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } },
  317. { S5P_ARM_CORE3_LOWPWR, { 0x0, 0x0, 0x2 } },
  318. { S5P_DIS_IRQ_CORE3, { 0x0, 0x0, 0x0 } },
  319. { S5P_DIS_IRQ_CENTRAL3, { 0x0, 0x0, 0x0 } },
  320. { PMU_TABLE_END,},
  321. };
  322. static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
  323. /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
  324. { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
  325. { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  326. { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  327. { EXYNOS5_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
  328. { EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  329. { EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  330. { EXYNOS5_FSYS_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  331. { EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  332. { EXYNOS5_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  333. { EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  334. { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  335. { EXYNOS5_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
  336. { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x3, 0x3, 0x3} },
  337. { EXYNOS5_ARM_L2_OPTION, { 0x10, 0x10, 0x0 } },
  338. { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  339. { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  340. { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  341. { EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  342. { EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  343. { EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  344. { EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  345. { EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  346. { EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  347. { EXYNOS5_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  348. { EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  349. { EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  350. { EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  351. { EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  352. { EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  353. { EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  354. { EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  355. { EXYNOS5_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  356. { EXYNOS5_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  357. { EXYNOS5_TOP_PWR_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
  358. { EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  359. { EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  360. { EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
  361. { EXYNOS5_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  362. { EXYNOS5_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  363. { EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  364. { EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  365. { EXYNOS5_USBOTG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  366. { EXYNOS5_G2D_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  367. { EXYNOS5_USBDRD_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  368. { EXYNOS5_SDMMC_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  369. { EXYNOS5_CSSYS_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  370. { EXYNOS5_SECSS_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  371. { EXYNOS5_ROTATOR_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  372. { EXYNOS5_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  373. { EXYNOS5_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  374. { EXYNOS5_JPEG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  375. { EXYNOS5_JPEG_MEM_OPTION, { 0x10, 0x10, 0x0} },
  376. { EXYNOS5_HSI_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  377. { EXYNOS5_MCUIOP_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  378. { EXYNOS5_SATA_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  379. { EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  380. { EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  381. { EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  382. { EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  383. { EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  384. { EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  385. { EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  386. { EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  387. { EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  388. { EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  389. { EXYNOS5_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  390. { EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  391. { EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  392. { EXYNOS5_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  393. { EXYNOS5_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  394. { EXYNOS5_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  395. { EXYNOS5_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  396. { EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  397. { EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  398. { EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  399. { EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  400. { EXYNOS5_GSCL_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  401. { EXYNOS5_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  402. { EXYNOS5_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  403. { EXYNOS5_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  404. { EXYNOS5_DISP1_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  405. { EXYNOS5_MAU_SYS_PWR_REG, { 0x7, 0x7, 0x0} },
  406. { EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  407. { EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  408. { EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  409. { EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  410. { EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  411. { EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  412. { EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  413. { EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  414. { EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  415. { EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  416. { EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  417. { EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  418. { EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  419. { EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  420. { EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  421. { EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  422. { EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  423. { EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  424. { PMU_TABLE_END,},
  425. };
  426. static struct exynos_pmu_conf exynos5420_pmu_config[] = {
  427. /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
  428. { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  429. { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  430. { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  431. { EXYNOS5_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  432. { EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  433. { EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  434. { EXYNOS5420_ARM_CORE2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  435. { EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  436. { EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  437. { EXYNOS5420_ARM_CORE3_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  438. { EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  439. { EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  440. { EXYNOS5420_KFC_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  441. { EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  442. { EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  443. { EXYNOS5420_KFC_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  444. { EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  445. { EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  446. { EXYNOS5420_KFC_CORE2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  447. { EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  448. { EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  449. { EXYNOS5420_KFC_CORE3_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  450. { EXYNOS5420_DIS_IRQ_KFC_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  451. { EXYNOS5420_DIS_IRQ_KFC_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  452. { EXYNOS5_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  453. { EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  454. { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  455. { EXYNOS5420_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  456. { EXYNOS5420_KFC_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  457. { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  458. { EXYNOS5420_KFC_L2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  459. { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  460. { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  461. { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  462. { EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  463. { EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  464. { EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  465. { EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  466. { EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  467. { EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  468. { EXYNOS5_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  469. { EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  470. { EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  471. { EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  472. { EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  473. { EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  474. { EXYNOS5420_DPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  475. { EXYNOS5420_IPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  476. { EXYNOS5420_KPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  477. { EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  478. { EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  479. { EXYNOS5420_RPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  480. { EXYNOS5420_SPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  481. { EXYNOS5_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  482. { EXYNOS5_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
  483. { EXYNOS5_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x0} },
  484. { EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  485. { EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  486. { EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
  487. { EXYNOS5_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  488. { EXYNOS5_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
  489. { EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  490. { EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  491. { EXYNOS5420_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
  492. { EXYNOS5420_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
  493. { EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  494. { EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  495. { EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  496. { EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  497. { EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  498. { EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  499. { EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  500. { EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  501. { EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  502. { EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  503. { EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  504. { EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  505. { EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  506. { EXYNOS5_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  507. { EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  508. { EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  509. { EXYNOS5_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  510. { EXYNOS5_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  511. { EXYNOS5_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  512. { EXYNOS5_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  513. { EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  514. { EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  515. { EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
  516. { EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
  517. { EXYNOS5_GSCL_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  518. { EXYNOS5_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  519. { EXYNOS5_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  520. { EXYNOS5_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  521. { EXYNOS5420_DISP1_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  522. { EXYNOS5420_MAU_SYS_PWR_REG, { 0x7, 0x7, 0x0} },
  523. { EXYNOS5420_G2D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  524. { EXYNOS5420_MSC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  525. { EXYNOS5420_FSYS_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  526. { EXYNOS5420_FSYS2_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  527. { EXYNOS5420_PSGEN_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  528. { EXYNOS5420_PERIC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  529. { EXYNOS5420_WCORE_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
  530. { EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  531. { EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  532. { EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  533. { EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  534. { EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  535. { EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  536. { EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  537. { EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  538. { EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  539. { EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  540. { EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  541. { EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  542. { EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  543. { EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  544. { EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  545. { EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  546. { EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  547. { EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  548. { EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  549. { EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  550. { EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  551. { EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  552. { EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  553. { EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  554. { EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  555. { EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  556. { EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  557. { EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  558. { EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  559. { EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  560. { EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  561. { EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  562. { EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  563. { EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  564. { EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  565. { EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  566. { EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  567. { EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
  568. { PMU_TABLE_END,},
  569. };
  570. static unsigned int const exynos3250_list_feed[] = {
  571. EXYNOS3_ARM_CORE_OPTION(0),
  572. EXYNOS3_ARM_CORE_OPTION(1),
  573. EXYNOS3_ARM_CORE_OPTION(2),
  574. EXYNOS3_ARM_CORE_OPTION(3),
  575. EXYNOS3_ARM_COMMON_OPTION,
  576. EXYNOS3_TOP_PWR_OPTION,
  577. EXYNOS3_CORE_TOP_PWR_OPTION,
  578. S5P_CAM_OPTION,
  579. S5P_MFC_OPTION,
  580. S5P_G3D_OPTION,
  581. S5P_LCD0_OPTION,
  582. S5P_ISP_OPTION,
  583. };
  584. static void exynos3250_powerdown_conf_extra(enum sys_powerdown mode)
  585. {
  586. unsigned int i;
  587. unsigned int tmp;
  588. /* Enable only SC_FEEDBACK */
  589. for (i = 0; i < ARRAY_SIZE(exynos3250_list_feed); i++) {
  590. tmp = pmu_raw_readl(exynos3250_list_feed[i]);
  591. tmp &= ~(EXYNOS3_OPTION_USE_SC_COUNTER);
  592. tmp |= EXYNOS3_OPTION_USE_SC_FEEDBACK;
  593. pmu_raw_writel(tmp, exynos3250_list_feed[i]);
  594. }
  595. if (mode != SYS_SLEEP)
  596. return;
  597. pmu_raw_writel(XUSBXTI_DURATION, EXYNOS3_XUSBXTI_DURATION);
  598. pmu_raw_writel(XXTI_DURATION, EXYNOS3_XXTI_DURATION);
  599. pmu_raw_writel(EXT_REGULATOR_DURATION, EXYNOS3_EXT_REGULATOR_DURATION);
  600. pmu_raw_writel(EXT_REGULATOR_COREBLK_DURATION,
  601. EXYNOS3_EXT_REGULATOR_COREBLK_DURATION);
  602. }
  603. static unsigned int const exynos5_list_both_cnt_feed[] = {
  604. EXYNOS5_ARM_CORE0_OPTION,
  605. EXYNOS5_ARM_CORE1_OPTION,
  606. EXYNOS5_ARM_COMMON_OPTION,
  607. EXYNOS5_GSCL_OPTION,
  608. EXYNOS5_ISP_OPTION,
  609. EXYNOS5_MFC_OPTION,
  610. EXYNOS5_G3D_OPTION,
  611. EXYNOS5_DISP1_OPTION,
  612. EXYNOS5_MAU_OPTION,
  613. EXYNOS5_TOP_PWR_OPTION,
  614. EXYNOS5_TOP_PWR_SYSMEM_OPTION,
  615. };
  616. static unsigned int const exynos5_list_disable_wfi_wfe[] = {
  617. EXYNOS5_ARM_CORE1_OPTION,
  618. EXYNOS5_FSYS_ARM_OPTION,
  619. EXYNOS5_ISP_ARM_OPTION,
  620. };
  621. static unsigned int const exynos5420_list_disable_pmu_reg[] = {
  622. EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,
  623. EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,
  624. EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,
  625. EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,
  626. EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,
  627. EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,
  628. EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,
  629. EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,
  630. EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,
  631. EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,
  632. EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,
  633. EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,
  634. EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,
  635. EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,
  636. EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,
  637. EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,
  638. EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,
  639. EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,
  640. EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,
  641. EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,
  642. EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,
  643. EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,
  644. EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,
  645. EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,
  646. EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,
  647. EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,
  648. EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,
  649. EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,
  650. EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,
  651. EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,
  652. EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,
  653. EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,
  654. EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,
  655. EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,
  656. EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
  657. };
  658. static void exynos_power_off(void)
  659. {
  660. unsigned int tmp;
  661. pr_info("Power down.\n");
  662. tmp = pmu_raw_readl(EXYNOS_PS_HOLD_CONTROL);
  663. tmp ^= (1 << 8);
  664. pmu_raw_writel(tmp, EXYNOS_PS_HOLD_CONTROL);
  665. /* Wait a little so we don't give a false warning below */
  666. mdelay(100);
  667. pr_err("Power down failed, please power off system manually.\n");
  668. while (1)
  669. ;
  670. }
  671. void exynos5420_powerdown_conf(enum sys_powerdown mode)
  672. {
  673. u32 this_cluster;
  674. this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
  675. /*
  676. * set the cluster id to IROM register to ensure that we wake
  677. * up with the current cluster.
  678. */
  679. pmu_raw_writel(this_cluster, EXYNOS_IROM_DATA2);
  680. }
  681. static void exynos5_powerdown_conf(enum sys_powerdown mode)
  682. {
  683. unsigned int i;
  684. unsigned int tmp;
  685. /*
  686. * Enable both SC_FEEDBACK and SC_COUNTER
  687. */
  688. for (i = 0; i < ARRAY_SIZE(exynos5_list_both_cnt_feed); i++) {
  689. tmp = pmu_raw_readl(exynos5_list_both_cnt_feed[i]);
  690. tmp |= (EXYNOS5_USE_SC_FEEDBACK |
  691. EXYNOS5_USE_SC_COUNTER);
  692. pmu_raw_writel(tmp, exynos5_list_both_cnt_feed[i]);
  693. }
  694. /*
  695. * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
  696. */
  697. tmp = pmu_raw_readl(EXYNOS5_ARM_COMMON_OPTION);
  698. tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
  699. pmu_raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION);
  700. /*
  701. * Disable WFI/WFE on XXX_OPTION
  702. */
  703. for (i = 0; i < ARRAY_SIZE(exynos5_list_disable_wfi_wfe); i++) {
  704. tmp = pmu_raw_readl(exynos5_list_disable_wfi_wfe[i]);
  705. tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE |
  706. EXYNOS5_OPTION_USE_STANDBYWFI);
  707. pmu_raw_writel(tmp, exynos5_list_disable_wfi_wfe[i]);
  708. }
  709. }
  710. void exynos_sys_powerdown_conf(enum sys_powerdown mode)
  711. {
  712. unsigned int i;
  713. const struct exynos_pmu_data *pmu_data = pmu_context->pmu_data;
  714. if (pmu_data->powerdown_conf)
  715. pmu_data->powerdown_conf(mode);
  716. if (pmu_data->pmu_config) {
  717. for (i = 0; (pmu_data->pmu_config[i].offset != PMU_TABLE_END); i++)
  718. pmu_raw_writel(pmu_data->pmu_config[i].val[mode],
  719. pmu_data->pmu_config[i].offset);
  720. }
  721. if (pmu_data->powerdown_conf_extra)
  722. pmu_data->powerdown_conf_extra(mode);
  723. if (pmu_data->pmu_config_extra) {
  724. for (i = 0; pmu_data->pmu_config_extra[i].offset != PMU_TABLE_END; i++)
  725. pmu_raw_writel(pmu_data->pmu_config_extra[i].val[mode],
  726. pmu_data->pmu_config_extra[i].offset);
  727. }
  728. }
  729. static void exynos3250_pmu_init(void)
  730. {
  731. unsigned int value;
  732. /*
  733. * To prevent from issuing new bus request form L2 memory system
  734. * If core status is power down, should be set '1' to L2 power down
  735. */
  736. value = pmu_raw_readl(EXYNOS3_ARM_COMMON_OPTION);
  737. value |= EXYNOS3_OPTION_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
  738. pmu_raw_writel(value, EXYNOS3_ARM_COMMON_OPTION);
  739. /* Enable USE_STANDBY_WFI for all CORE */
  740. pmu_raw_writel(S5P_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
  741. /*
  742. * Set PSHOLD port for output high
  743. */
  744. value = pmu_raw_readl(S5P_PS_HOLD_CONTROL);
  745. value |= S5P_PS_HOLD_OUTPUT_HIGH;
  746. pmu_raw_writel(value, S5P_PS_HOLD_CONTROL);
  747. /*
  748. * Enable signal for PSHOLD port
  749. */
  750. value = pmu_raw_readl(S5P_PS_HOLD_CONTROL);
  751. value |= S5P_PS_HOLD_EN;
  752. pmu_raw_writel(value, S5P_PS_HOLD_CONTROL);
  753. }
  754. static void exynos5250_pmu_init(void)
  755. {
  756. unsigned int value;
  757. /*
  758. * When SYS_WDTRESET is set, watchdog timer reset request
  759. * is ignored by power management unit.
  760. */
  761. value = pmu_raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE);
  762. value &= ~EXYNOS5_SYS_WDTRESET;
  763. pmu_raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE);
  764. value = pmu_raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST);
  765. value &= ~EXYNOS5_SYS_WDTRESET;
  766. pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST);
  767. }
  768. static void exynos5420_pmu_init(void)
  769. {
  770. unsigned int value;
  771. int i;
  772. /*
  773. * Set the CMU_RESET, CMU_SYSCLK and CMU_CLKSTOP registers
  774. * for local power blocks to Low initially as per Table 8-4:
  775. * "System-Level Power-Down Configuration Registers".
  776. */
  777. for (i = 0; i < ARRAY_SIZE(exynos5420_list_disable_pmu_reg); i++)
  778. pmu_raw_writel(0, exynos5420_list_disable_pmu_reg[i]);
  779. /* Enable USE_STANDBY_WFI for all CORE */
  780. pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
  781. value = pmu_raw_readl(EXYNOS_L2_OPTION(0));
  782. value &= ~EXYNOS5_USE_RETENTION;
  783. pmu_raw_writel(value, EXYNOS_L2_OPTION(0));
  784. value = pmu_raw_readl(EXYNOS_L2_OPTION(1));
  785. value &= ~EXYNOS5_USE_RETENTION;
  786. pmu_raw_writel(value, EXYNOS_L2_OPTION(1));
  787. /*
  788. * If L2_COMMON is turned off, clocks related to ATB async
  789. * bridge are gated. Thus, when ISP power is gated, LPI
  790. * may get stuck.
  791. */
  792. value = pmu_raw_readl(EXYNOS5420_LPI_MASK);
  793. value |= EXYNOS5420_ATB_ISP_ARM;
  794. pmu_raw_writel(value, EXYNOS5420_LPI_MASK);
  795. value = pmu_raw_readl(EXYNOS5420_LPI_MASK1);
  796. value |= EXYNOS5420_ATB_KFC;
  797. pmu_raw_writel(value, EXYNOS5420_LPI_MASK1);
  798. /* Prevent issue of new bus request from L2 memory */
  799. value = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
  800. value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
  801. pmu_raw_writel(value, EXYNOS5420_ARM_COMMON_OPTION);
  802. value = pmu_raw_readl(EXYNOS5420_KFC_COMMON_OPTION);
  803. value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
  804. pmu_raw_writel(value, EXYNOS5420_KFC_COMMON_OPTION);
  805. /* This setting is to reduce suspend/resume time */
  806. pmu_raw_writel(DUR_WAIT_RESET, EXYNOS5420_LOGIC_RESET_DURATION3);
  807. /* Serialized CPU wakeup of Eagle */
  808. pmu_raw_writel(SPREAD_ENABLE, EXYNOS5420_ARM_INTR_SPREAD_ENABLE);
  809. pmu_raw_writel(SPREAD_USE_STANDWFI,
  810. EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI);
  811. pmu_raw_writel(0x1, EXYNOS5420_UP_SCHEDULER);
  812. pr_info("EXYNOS5420 PMU initialized\n");
  813. }
  814. static int pmu_restart_notify(struct notifier_block *this,
  815. unsigned long code, void *unused)
  816. {
  817. pmu_raw_writel(0x1, EXYNOS_SWRESET);
  818. return NOTIFY_DONE;
  819. }
  820. static const struct exynos_pmu_data exynos3250_pmu_data = {
  821. .pmu_config = exynos3250_pmu_config,
  822. .pmu_init = exynos3250_pmu_init,
  823. .powerdown_conf_extra = exynos3250_powerdown_conf_extra,
  824. };
  825. static const struct exynos_pmu_data exynos4210_pmu_data = {
  826. .pmu_config = exynos4210_pmu_config,
  827. };
  828. static const struct exynos_pmu_data exynos4212_pmu_data = {
  829. .pmu_config = exynos4x12_pmu_config,
  830. };
  831. static const struct exynos_pmu_data exynos4412_pmu_data = {
  832. .pmu_config = exynos4x12_pmu_config,
  833. .pmu_config_extra = exynos4412_pmu_config,
  834. };
  835. static const struct exynos_pmu_data exynos5250_pmu_data = {
  836. .pmu_config = exynos5250_pmu_config,
  837. .pmu_init = exynos5250_pmu_init,
  838. .powerdown_conf = exynos5_powerdown_conf,
  839. };
  840. static struct exynos_pmu_data exynos5420_pmu_data = {
  841. .pmu_config = exynos5420_pmu_config,
  842. .pmu_init = exynos5420_pmu_init,
  843. .powerdown_conf = exynos5420_powerdown_conf,
  844. };
  845. /*
  846. * PMU platform driver and devicetree bindings.
  847. */
  848. static const struct of_device_id exynos_pmu_of_device_ids[] = {
  849. {
  850. .compatible = "samsung,exynos3250-pmu",
  851. .data = &exynos3250_pmu_data,
  852. }, {
  853. .compatible = "samsung,exynos4210-pmu",
  854. .data = &exynos4210_pmu_data,
  855. }, {
  856. .compatible = "samsung,exynos4212-pmu",
  857. .data = &exynos4212_pmu_data,
  858. }, {
  859. .compatible = "samsung,exynos4412-pmu",
  860. .data = &exynos4412_pmu_data,
  861. }, {
  862. .compatible = "samsung,exynos5250-pmu",
  863. .data = &exynos5250_pmu_data,
  864. }, {
  865. .compatible = "samsung,exynos5420-pmu",
  866. .data = &exynos5420_pmu_data,
  867. },
  868. { /*sentinel*/ },
  869. };
  870. /*
  871. * Exynos PMU restart notifier, handles restart functionality
  872. */
  873. static struct notifier_block pmu_restart_handler = {
  874. .notifier_call = pmu_restart_notify,
  875. .priority = 128,
  876. };
  877. static int exynos_pmu_probe(struct platform_device *pdev)
  878. {
  879. const struct of_device_id *match;
  880. struct device *dev = &pdev->dev;
  881. struct resource *res;
  882. int ret;
  883. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  884. pmu_base_addr = devm_ioremap_resource(dev, res);
  885. if (IS_ERR(pmu_base_addr))
  886. return PTR_ERR(pmu_base_addr);
  887. pmu_context = devm_kzalloc(&pdev->dev,
  888. sizeof(struct exynos_pmu_context),
  889. GFP_KERNEL);
  890. if (!pmu_context) {
  891. dev_err(dev, "Cannot allocate memory.\n");
  892. return -ENOMEM;
  893. }
  894. pmu_context->dev = dev;
  895. match = of_match_node(exynos_pmu_of_device_ids, dev->of_node);
  896. pmu_context->pmu_data = match->data;
  897. if (pmu_context->pmu_data->pmu_init)
  898. pmu_context->pmu_data->pmu_init();
  899. platform_set_drvdata(pdev, pmu_context);
  900. ret = register_restart_handler(&pmu_restart_handler);
  901. if (ret)
  902. dev_warn(dev, "can't register restart handler err=%d\n", ret);
  903. pm_power_off = exynos_power_off;
  904. dev_dbg(dev, "Exynos PMU Driver probe done\n");
  905. return 0;
  906. }
  907. static struct platform_driver exynos_pmu_driver = {
  908. .driver = {
  909. .name = "exynos-pmu",
  910. .owner = THIS_MODULE,
  911. .of_match_table = exynos_pmu_of_device_ids,
  912. },
  913. .probe = exynos_pmu_probe,
  914. };
  915. static int __init exynos_pmu_init(void)
  916. {
  917. return platform_driver_register(&exynos_pmu_driver);
  918. }
  919. postcore_initcall(exynos_pmu_init);