mc34vr500_pmic.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2016 Freescale Semiconductor, Inc.
  4. * Hou Zhiqiang <Zhiqiang.Hou@freescale.com>
  5. */
  6. #ifndef __MC34VR500_H_
  7. #define __MC34VR500_H_
  8. #include <power/pmic.h>
  9. #define MC34VR500_I2C_ADDR 0x08
  10. /* Drivers name */
  11. #define MC34VR500_REGULATOR_DRIVER "mc34vr500_regulator"
  12. /* Register map */
  13. enum {
  14. MC34VR500_DEVICEID = 0x00,
  15. MC34VR500_SILICONREVID = 0x03,
  16. MC34VR500_FABID,
  17. MC34VR500_INTSTAT0,
  18. MC34VR500_INTMASK0,
  19. MC34VR500_INTSENSE0,
  20. MC34VR500_INTSTAT1,
  21. MC34VR500_INTMASK1,
  22. MC34VR500_INTSENSE1,
  23. MC34VR500_INTSTAT4 = 0x11,
  24. MC34VR500_INTMASK4,
  25. MC34VR500_INTSENSE4,
  26. MC34VR500_PWRCTL = 0x1B,
  27. MC34VR500_SW1VOLT = 0x2E,
  28. MC34VR500_SW1STBY,
  29. MC34VR500_SW1OFF,
  30. MC34VR500_SW1MODE,
  31. MC34VR500_SW1CONF,
  32. MC34VR500_SW2VOLT,
  33. MC34VR500_SW2STBY,
  34. MC34VR500_SW2OFF,
  35. MC34VR500_SW2MODE,
  36. MC34VR500_SW2CONF,
  37. MC34VR500_SW3VOLT = 0x3C,
  38. MC34VR500_SW3STBY,
  39. MC34VR500_SW3OFF,
  40. MC34VR500_SW3MODE,
  41. MC34VR500_SW3CONF,
  42. MC34VR500_SW4VOLT = 0x4A,
  43. MC34VR500_SW4STBY,
  44. MC34VR500_SW4OFF,
  45. MC34VR500_SW4MODE,
  46. MC34VR500_SW4CONF,
  47. MC34VR500_REFOUTCRTRL = 0x6A,
  48. MC34VR500_LDO1CTL = 0x6D,
  49. MC34VR500_LDO2CTL,
  50. MC34VR500_LDO3CTL,
  51. MC34VR500_LDO4CTL,
  52. MC34VR500_LDO5CTL,
  53. MC34VR500_PAGE_REGISTER = 0x7F,
  54. /* Internal RAM */
  55. MC34VR500_SW1_VOLT = 0xA8,
  56. MC34VR500_SW1_SEQ,
  57. MC34VR500_SW1_CONFIG,
  58. MC34VR500_SW2_VOLT = 0xAC,
  59. MC34VR500_SW2_SEQ,
  60. MC34VR500_SW2_CONFIG,
  61. MC34VR500_SW3_VOLT = 0xB0,
  62. MC34VR500_SW3_SEQ,
  63. MC34VR500_SW3_CONFIG,
  64. MC34VR500_SW4_VOLT = 0xB8,
  65. MC34VR500_SW4_SEQ,
  66. MC34VR500_SW4_CONFIG,
  67. MC34VR500_REFOUT_SEQ = 0xC4,
  68. MC34VR500_LDO1_VOLT = 0xCC,
  69. MC34VR500_LDO1_SEQ,
  70. MC34VR500_LDO2_VOLT = 0xD0,
  71. MC34VR500_LDO2_SEQ,
  72. MC34VR500_LDO3_VOLT = 0xD4,
  73. MC34VR500_LDO3_SEQ,
  74. MC34VR500_LDO4_VOLT = 0xD8,
  75. MC34VR500_LDO4_SEQ,
  76. MC34VR500_LDO5_VOLT = 0xDC,
  77. MC34VR500_LDO5_SEQ,
  78. MC34VR500_PU_CONFIG1 = 0xE0,
  79. MC34VR500_TBB_POR = 0xE4,
  80. MC34VR500_PWRGD_EN = 0xE8,
  81. MC34VR500_NUM_OF_REGS,
  82. };
  83. /* Registor offset based on SWxVOLT register */
  84. #define MC34VR500_VOLT_OFFSET 0
  85. #define MC34VR500_STBY_OFFSET 1
  86. #define MC34VR500_OFF_OFFSET 2
  87. #define MC34VR500_MODE_OFFSET 3
  88. #define MC34VR500_CONF_OFFSET 4
  89. #define SW_MODE_MASK 0xf
  90. #define SW_MODE_SHIFT 0
  91. #define LDO_VOL_MASK 0xf
  92. #define LDO_EN (1 << 4)
  93. #define LDO_MODE_SHIFT 4
  94. #define LDO_MODE_MASK (1 << 4)
  95. #define LDO_MODE_OFF 0
  96. #define LDO_MODE_ON 1
  97. #define REFOUTEN (1 << 4)
  98. /*
  99. * Regulator Mode Control
  100. *
  101. * OFF: The regulator is switched off and the output voltage is discharged.
  102. * PFM: In this mode, the regulator is always in PFM mode, which is useful
  103. * at light loads for optimized efficiency.
  104. * PWM: In this mode, the regulator is always in PWM mode operation
  105. * regardless of load conditions.
  106. * APS: In this mode, the regulator moves automatically between pulse
  107. * skipping mode and PWM mode depending on load conditions.
  108. *
  109. * SWxMODE[3:0]
  110. * Normal Mode | Standby Mode | value
  111. * OFF OFF 0x0
  112. * PWM OFF 0x1
  113. * PFM OFF 0x3
  114. * APS OFF 0x4
  115. * PWM PWM 0x5
  116. * PWM APS 0x6
  117. * APS APS 0x8
  118. * APS PFM 0xc
  119. * PWM PFM 0xd
  120. */
  121. #define OFF_OFF 0x0
  122. #define PWM_OFF 0x1
  123. #define PFM_OFF 0x3
  124. #define APS_OFF 0x4
  125. #define PWM_PWM 0x5
  126. #define PWM_APS 0x6
  127. #define APS_APS 0x8
  128. #define APS_PFM 0xc
  129. #define PWM_PFM 0xd
  130. enum swx {
  131. SW1 = 0,
  132. SW2,
  133. SW3,
  134. SW4,
  135. };
  136. int mc34vr500_get_sw_volt(uint8_t sw);
  137. int mc34vr500_set_sw_volt(uint8_t sw, int sw_volt);
  138. int power_mc34vr500_init(unsigned char bus);
  139. #endif /* __MC34VR500_PMIC_H_ */