pm8921_hw.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above
  10. * copyright notice, this list of conditions and the following
  11. * disclaimer in the documentation and/or other materials provided
  12. * with the distribution.
  13. * * Neither the name of Code Aurora Forum, Inc. nor the names of its
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  18. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  21. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  24. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  26. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  27. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #define PBL_ACCESS_2 0x005
  30. #define PBL_ACCESS_2_ENUM_TIMER_STOP (1 << 1)
  31. #define SYS_CONFIG_2 0x007
  32. #define SYS_CONFIG_2_BOOT_DONE (1 << 6)
  33. #define SYS_CONFIG_2_ADAPTIVE_BOOT_DISABLE (1 << 7)
  34. #define PM8921_LDO_REG_BASE 0x0AE
  35. #define PM8921_LDO_CTRL_REG(id) (PM8921_LDO_REG_BASE + (2 * (id-1)))
  36. #define PM8921_LDO_TEST_REG(id) (PM8921_LDO_CTRL_REG(id) + 1)
  37. /* Bit offsets LDO CTRL register */
  38. #define PM8921_LDO_CTRL_REG_ENABLE 7
  39. #define PM8921_LDO_CTRL_REG_PULL_DOWN 6
  40. #define PM8921_LDO_CTRL_REG_POWER_MODE 5
  41. #define PM8921_LDO_CTRL_REG_VOLTAGE 0
  42. /* Bit offsets LDO Test register */
  43. #define PM8921_LDO_TEST_REG_BANK_SEL 4
  44. #define PM8921_LDO_TEST_REG_RW 7
  45. #define PM8921_LDO_TEST_REG_BANK2_RANGE_SEL 2
  46. #define PM8921_LDO_TEST_REG_BANK2_FINE_STEP 1
  47. #define PM8921_LDO_TEST_REG_BANK4_RANGE_EXT 0
  48. #define GPIO_CNTL_BASE 0x150
  49. #define GPIO_CNTL(n) (GPIO_CNTL_BASE + n)
  50. /* GPIO Bank register programming */
  51. #define PM_GPIO_BANK_MASK 0x70
  52. #define PM_GPIO_BANK_SHIFT 4
  53. #define PM_GPIO_WRITE 0x80
  54. /* Bank 0 */
  55. #define PM_GPIO_VIN_MASK 0x0E
  56. #define PM_GPIO_VIN_SHIFT 1
  57. #define PM_GPIO_MODE_ENABLE 0x01
  58. /* Bank 1 */
  59. #define PM_GPIO_MODE_MASK 0x0C
  60. #define PM_GPIO_MODE_SHIFT 2
  61. #define PM_GPIO_OUT_BUFFER_OPEN_DRAIN 0x02
  62. #define PM_GPIO_OUT_INVERT 0x01
  63. #define PM_GPIO_MODE_OFF 3
  64. #define PM_GPIO_MODE_OUTPUT 2
  65. #define PM_GPIO_MODE_INPUT 0
  66. #define PM_GPIO_MODE_BOTH 1
  67. /* Bank 2 */
  68. #define PM_GPIO_PULL_MASK 0x0E
  69. #define PM_GPIO_PULL_SHIFT 1
  70. /* Bank 3 */
  71. #define PM_GPIO_OUT_STRENGTH_MASK 0x0C
  72. #define PM_GPIO_OUT_STRENGTH_SHIFT 2
  73. #define PM_GPIO_PIN_ENABLE 0x00
  74. #define PM_GPIO_PIN_DISABLE 0x01
  75. /* Bank 4 */
  76. #define PM_GPIO_FUNC_MASK 0x0E
  77. #define PM_GPIO_FUNC_SHIFT 1
  78. /* Bank 5 */
  79. #define PM_GPIO_NON_INT_POL_INV 0x08
  80. /* PON CTRL 1 register */
  81. #define PM8921_PON_CTRL_1_REG 0x01C
  82. #define PON_CTRL_1_PULL_UP_MASK 0xE0
  83. #define PON_CTRL_1_USB_PWR_EN 0x10
  84. #define PON_CTRL_1_WD_EN_MASK 0x08
  85. #define PON_CTRL_1_WD_EN_RESET 0x08
  86. #define PON_CTRL_1_WD_EN_PWR_OFF 0x00
  87. /* SLEEP CTRL register */
  88. #define PM8921_SLEEP_CTRL_REG 0x10A
  89. #define SLEEP_CTRL_SMPL_EN_MASK 0x04
  90. #define SLEEP_CTRL_SMPL_EN_RESET 0x04
  91. #define SLEEP_CTRL_SMPL_EN_PWR_OFF 0x00
  92. #define IRQ_BLOCK_SEL_USR_ADDR 0x1C0
  93. #define IRQ_STATUS_RT_USR_ADDR 0x1C3
  94. #define PM8921_LVS_REG_BASE 0x060
  95. #define PM8921_LVS_CTRL_REG(id) (PM8921_LVS_REG_BASE + (2 * (id-1)))
  96. #define PM8921_LVS_TEST_REG(id) (PM8921_LVS_CTRL_REG(id) + 1)
  97. #define PM8921_LVS_100_CTRL_SW_EN (1 << 7)
  98. #define PM8921_LVS_100_CTRL_SLEEP_B_IGNORE (1 << 4)
  99. #define PM8921_LVS_100_TEST_VOUT_OK (1 << 6)
  100. #define PM8921_MPP_REG_BASE 0x050
  101. #define PM8921_MPP_CTRL_REG(id) (PM8921_MPP_REG_BASE + (id-1))
  102. #define PM8921_MPP_CTRL_DIGITAL_OUTPUT (1 << 5)
  103. #define PM8921_MPP_CTRL_VIO_1 (1 << 2)
  104. #define PM8921_MPP_CTRL_OUTPUT_HIGH (1 << 0)