twl6030.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * (C) Copyright 2010
  3. * Texas Instruments, <www.ti.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <i2c.h>
  25. /* I2C chip addresses */
  26. #define TWL6030_CHIP_PM 0x48
  27. #define TWL6030_CHIP_USB 0x49
  28. #define TWL6030_CHIP_ADC 0x49
  29. #define TWL6030_CHIP_CHARGER 0x49
  30. #define TWL6030_CHIP_PWM 0x49
  31. /* Battery CHARGER REGISTERS */
  32. #define CONTROLLER_INT_MASK 0xE0
  33. #define CONTROLLER_CTRL1 0xE1
  34. #define CONTROLLER_WDG 0xE2
  35. #define CONTROLLER_STAT1 0xE3
  36. #define CHARGERUSB_INT_STATUS 0xE4
  37. #define CHARGERUSB_INT_MASK 0xE5
  38. #define CHARGERUSB_STATUS_INT1 0xE6
  39. #define CHARGERUSB_STATUS_INT2 0xE7
  40. #define CHARGERUSB_CTRL1 0xE8
  41. #define CHARGERUSB_CTRL2 0xE9
  42. #define CHARGERUSB_CTRL3 0xEA
  43. #define CHARGERUSB_STAT1 0xEB
  44. #define CHARGERUSB_VOREG 0xEC
  45. #define CHARGERUSB_VICHRG 0xED
  46. #define CHARGERUSB_CINLIMIT 0xEE
  47. #define CHARGERUSB_CTRLLIMIT1 0xEF
  48. /* CHARGERUSB_VICHRG */
  49. #define CHARGERUSB_VICHRG_500 0x4
  50. #define CHARGERUSB_VICHRG_1500 0xE
  51. /* CHARGERUSB_CINLIMIT */
  52. #define CHARGERUSB_CIN_LIMIT_100 0x1
  53. #define CHARGERUSB_CIN_LIMIT_300 0x5
  54. #define CHARGERUSB_CIN_LIMIT_500 0x9
  55. #define CHARGERUSB_CIN_LIMIT_NONE 0xF
  56. /* CONTROLLER_INT_MASK */
  57. #define MVAC_FAULT (1 << 6)
  58. #define MAC_EOC (1 << 5)
  59. #define MBAT_REMOVED (1 << 4)
  60. #define MFAULT_WDG (1 << 3)
  61. #define MBAT_TEMP (1 << 2)
  62. #define MVBUS_DET (1 << 1)
  63. #define MVAC_DET (1 << 0)
  64. /* CHARGERUSB_INT_MASK */
  65. #define MASK_MCURRENT_TERM (1 << 3)
  66. #define MASK_MCHARGERUSB_STAT (1 << 2)
  67. #define MASK_MCHARGERUSB_THMREG (1 << 1)
  68. #define MASK_MCHARGERUSB_FAULT (1 << 0)
  69. /* CHARGERUSB_VOREG */
  70. #define CHARGERUSB_VOREG_3P52 0x01
  71. #define CHARGERUSB_VOREG_4P0 0x19
  72. #define CHARGERUSB_VOREG_4P2 0x23
  73. #define CHARGERUSB_VOREG_4P76 0x3F
  74. /* CHARGERUSB_CTRL2 */
  75. #define CHARGERUSB_CTRL2_VITERM_50 (0 << 5)
  76. #define CHARGERUSB_CTRL2_VITERM_100 (1 << 5)
  77. #define CHARGERUSB_CTRL2_VITERM_150 (2 << 5)
  78. /* CONTROLLER_CTRL1 */
  79. #define CONTROLLER_CTRL1_EN_CHARGER (1 << 4)
  80. #define CONTROLLER_CTRL1_SEL_CHARGER (1 << 3)
  81. #define VUSB_CFG_STATE 0xA2
  82. #define MISC2 0xE5
  83. void twl6030_init_battery_charging(void);
  84. void twl6030_usb_device_settings(void);