spm.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #ifndef _MT_SPM_
  32. #define _MT_SPM_
  33. #include <platform/mt_reg_base.h>
  34. #include <platform/mt_typedefs.h>
  35. #define SPM_BASE SLEEP_BASE
  36. /**************************************
  37. * Define and Declare
  38. **************************************/
  39. #define SPM_REG(offset) (SPM_BASE + offset)
  40. #define POWERON_CONFIG_EN SPM_REG(0x000)
  41. #define PWR_STATUS SPM_REG(0x180)
  42. #define PWR_STATUS_2ND SPM_REG(0x184)
  43. #define DIS_PWR_CON SPM_REG(0x30C)
  44. #define AUDIO_PWR_CON SPM_REG(0x314)
  45. #define MD1_PWR_CON SPM_REG(0x320)
  46. #define MD_SRAM_ISO_CON SPM_REG(0x394)
  47. #define MD_EXTRA_PWR_CON SPM_REG(0x398)
  48. #define INFRACFG_REG(offset) (INFRACFG_AO_BASE + offset)
  49. #define INFRA_TOPAXI_PROTECTEN (INFRACFG_AO_BASE + 0x0220)
  50. #define INFRA_TOPAXI_PROTECTEN_STA1 (INFRACFG_AO_BASE + 0x0228)
  51. #define INFRA_TOPAXI_PROTECTEN_1 (INFRACFG_AO_BASE + 0x0250)
  52. #define INFRA_TOPAXI_PROTECTEN_STA1_1 (INFRACFG_AO_BASE + 0x0258)
  53. #define INFRA_TOPAXI_PROTECTEN_SET (INFRACFG_AO_BASE + 0x2A0)
  54. #define INFRA_TOPAXI_PROTECTEN_CLR (INFRACFG_AO_BASE + 0x2A4)
  55. #define INFRA_TOPAXI_PROTECTEN_1_SET (INFRACFG_AO_BASE + 0x2A8)
  56. #define INFRA_TOPAXI_PROTECTEN_1_CLR (INFRACFG_AO_BASE + 0x2AC)
  57. /* SMI COMMON */
  58. #define SMI_COMMON_REG(offset) (SMI_COMMON_BASE + offset)
  59. #define SMI_COMMON_SMI_CLAMP SMI_COMMON_REG(0x03C0)
  60. #define SMI_COMMON_SMI_CLAMP_SET SMI_COMMON_REG(0x03C4)
  61. #define SMI_COMMON_SMI_CLAMP_CLR SMI_COMMON_REG(0x03C8)
  62. #define CKGEN_REG(offset) (CKSYS_BASE + offset)
  63. #define CLK_MODE CKGEN_REG(0x0000)
  64. /**************************************
  65. * Macro and Inline
  66. **************************************/
  67. #define spm_read(addr) DRV_Reg32(addr)
  68. #define spm_write(addr, val) DRV_WriteReg32(addr, val)
  69. #define SPM_PROJECT_CODE 0xB16
  70. /* Define MTCMOS power control */
  71. #define PWR_RST_B (0x1 << 0)
  72. #define PWR_ISO (0x1 << 1)
  73. #define PWR_ON (0x1 << 2)
  74. #define PWR_ON_2ND (0x1 << 3)
  75. #define PWR_CLK_DIS (0x1 << 4)
  76. /* Define MTCMOS Bus Protect Mask */
  77. #define MD1_PROT_STEP1_0_MASK ((0x1 << 7))
  78. #define MD1_PROT_STEP1_0_ACK_MASK ((0x1 << 7))
  79. #define MD1_PROT_STEP2_0_MASK ((0x1 << 3) \
  80. |(0x1 << 4))
  81. #define MD1_PROT_STEP2_0_ACK_MASK ((0x1 << 3) \
  82. |(0x1 << 4))
  83. #define MD1_PROT_STEP2_1_MASK ((0x1 << 6))
  84. #define MD1_PROT_STEP2_1_ACK_MASK ((0x1 << 6))
  85. #define DIS_PROT_STEP1_0_MASK ((0x1 << 19) \
  86. |(0x1 << 20) \
  87. |(0x1 << 30) \
  88. |(0x1 << 31))
  89. #define DIS_PROT_STEP1_0_ACK_MASK ((0x1 << 19) \
  90. |(0x1 << 20) \
  91. |(0x1 << 30) \
  92. |(0x1 << 31))
  93. #define DIS_PROT_STEP2_0_MASK ((0x1 << 16) \
  94. |(0x1 << 17))
  95. #define DIS_PROT_STEP2_0_ACK_MASK ((0x1 << 16) \
  96. |(0x1 << 17))
  97. #define DIS_PROT_STEP3_0_MASK ((0x1 << 10) \
  98. |(0x1 << 11))
  99. #define DIS_PROT_STEP3_0_ACK_MASK ((0x1 << 10) \
  100. |(0x1 << 11))
  101. #define DIS_PROT_STEP4_0_MASK ((0x1 << 1) \
  102. |(0x1 << 2))
  103. #define DIS_PROT_STEP4_0_ACK_MASK ((0x1 << 1) \
  104. |(0x1 << 2))
  105. /* Define Non-CPU SRAM Mask */
  106. #define MD1_SRAM_PDN (0x1 << 8)
  107. #define MD1_SRAM_PDN_ACK (0x0 << 12)
  108. #define MD1_SRAM_PDN_ACK_BIT0 (0x1 << 12)
  109. #define DIS_SRAM_PDN (0x1 << 8)
  110. #define DIS_SRAM_PDN_ACK (0x1 << 12)
  111. #define DIS_SRAM_PDN_ACK_BIT0 (0x1 << 12)
  112. /* Define MTCMOS Power Status Mask */
  113. #define MD1_PWR_STA_MASK (0x1 << 0)
  114. #define DIS_PWR_STA_MASK (0x1 << 5)
  115. #define STA_POWER_DOWN 0
  116. #define STA_POWER_ON 1
  117. extern int spm_mtcmos_ctrl_md1(int state);
  118. extern int spm_mtcmos_ctrl_dis(int state);
  119. extern int spm_mtcmos_ctrl_audio(int state);
  120. #endif