otp.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * include/linux/mfd/wm831x/otp.h -- OTP interface for WM831x
  3. *
  4. * Copyright 2009 Wolfson Microelectronics PLC.
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. */
  14. #ifndef __MFD_WM831X_OTP_H__
  15. #define __MFD_WM831X_OTP_H__
  16. int wm831x_otp_init(struct wm831x *wm831x);
  17. void wm831x_otp_exit(struct wm831x *wm831x);
  18. /*
  19. * R30720 (0x7800) - Unique ID 1
  20. */
  21. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  22. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  23. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  24. /*
  25. * R30721 (0x7801) - Unique ID 2
  26. */
  27. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  28. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  29. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  30. /*
  31. * R30722 (0x7802) - Unique ID 3
  32. */
  33. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  34. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  35. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  36. /*
  37. * R30723 (0x7803) - Unique ID 4
  38. */
  39. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  40. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  41. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  42. /*
  43. * R30724 (0x7804) - Unique ID 5
  44. */
  45. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  46. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  47. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  48. /*
  49. * R30725 (0x7805) - Unique ID 6
  50. */
  51. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  52. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  53. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  54. /*
  55. * R30726 (0x7806) - Unique ID 7
  56. */
  57. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  58. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  59. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  60. /*
  61. * R30727 (0x7807) - Unique ID 8
  62. */
  63. #define WM831X_UNIQUE_ID_MASK 0xFFFF /* UNIQUE_ID - [15:0] */
  64. #define WM831X_UNIQUE_ID_SHIFT 0 /* UNIQUE_ID - [15:0] */
  65. #define WM831X_UNIQUE_ID_WIDTH 16 /* UNIQUE_ID - [15:0] */
  66. /*
  67. * R30728 (0x7808) - Factory OTP ID
  68. */
  69. #define WM831X_OTP_FACT_ID_MASK 0xFFFE /* OTP_FACT_ID - [15:1] */
  70. #define WM831X_OTP_FACT_ID_SHIFT 1 /* OTP_FACT_ID - [15:1] */
  71. #define WM831X_OTP_FACT_ID_WIDTH 15 /* OTP_FACT_ID - [15:1] */
  72. #define WM831X_OTP_FACT_FINAL 0x0001 /* OTP_FACT_FINAL */
  73. #define WM831X_OTP_FACT_FINAL_MASK 0x0001 /* OTP_FACT_FINAL */
  74. #define WM831X_OTP_FACT_FINAL_SHIFT 0 /* OTP_FACT_FINAL */
  75. #define WM831X_OTP_FACT_FINAL_WIDTH 1 /* OTP_FACT_FINAL */
  76. /*
  77. * R30729 (0x7809) - Factory OTP 1
  78. */
  79. #define WM831X_DC3_TRIM_MASK 0xF000 /* DC3_TRIM - [15:12] */
  80. #define WM831X_DC3_TRIM_SHIFT 12 /* DC3_TRIM - [15:12] */
  81. #define WM831X_DC3_TRIM_WIDTH 4 /* DC3_TRIM - [15:12] */
  82. #define WM831X_DC2_TRIM_MASK 0x0FC0 /* DC2_TRIM - [11:6] */
  83. #define WM831X_DC2_TRIM_SHIFT 6 /* DC2_TRIM - [11:6] */
  84. #define WM831X_DC2_TRIM_WIDTH 6 /* DC2_TRIM - [11:6] */
  85. #define WM831X_DC1_TRIM_MASK 0x003F /* DC1_TRIM - [5:0] */
  86. #define WM831X_DC1_TRIM_SHIFT 0 /* DC1_TRIM - [5:0] */
  87. #define WM831X_DC1_TRIM_WIDTH 6 /* DC1_TRIM - [5:0] */
  88. /*
  89. * R30730 (0x780A) - Factory OTP 2
  90. */
  91. #define WM831X_CHIP_ID_MASK 0xFFFF /* CHIP_ID - [15:0] */
  92. #define WM831X_CHIP_ID_SHIFT 0 /* CHIP_ID - [15:0] */
  93. #define WM831X_CHIP_ID_WIDTH 16 /* CHIP_ID - [15:0] */
  94. /*
  95. * R30731 (0x780B) - Factory OTP 3
  96. */
  97. #define WM831X_OSC_TRIM_MASK 0x0780 /* OSC_TRIM - [10:7] */
  98. #define WM831X_OSC_TRIM_SHIFT 7 /* OSC_TRIM - [10:7] */
  99. #define WM831X_OSC_TRIM_WIDTH 4 /* OSC_TRIM - [10:7] */
  100. #define WM831X_BG_TRIM_MASK 0x0078 /* BG_TRIM - [6:3] */
  101. #define WM831X_BG_TRIM_SHIFT 3 /* BG_TRIM - [6:3] */
  102. #define WM831X_BG_TRIM_WIDTH 4 /* BG_TRIM - [6:3] */
  103. #define WM831X_LPBG_TRIM_MASK 0x0007 /* LPBG_TRIM - [2:0] */
  104. #define WM831X_LPBG_TRIM_SHIFT 0 /* LPBG_TRIM - [2:0] */
  105. #define WM831X_LPBG_TRIM_WIDTH 3 /* LPBG_TRIM - [2:0] */
  106. /*
  107. * R30732 (0x780C) - Factory OTP 4
  108. */
  109. #define WM831X_CHILD_I2C_ADDR_MASK 0x00FE /* CHILD_I2C_ADDR - [7:1] */
  110. #define WM831X_CHILD_I2C_ADDR_SHIFT 1 /* CHILD_I2C_ADDR - [7:1] */
  111. #define WM831X_CHILD_I2C_ADDR_WIDTH 7 /* CHILD_I2C_ADDR - [7:1] */
  112. #define WM831X_CH_AW 0x0001 /* CH_AW */
  113. #define WM831X_CH_AW_MASK 0x0001 /* CH_AW */
  114. #define WM831X_CH_AW_SHIFT 0 /* CH_AW */
  115. #define WM831X_CH_AW_WIDTH 1 /* CH_AW */
  116. /*
  117. * R30733 (0x780D) - Factory OTP 5
  118. */
  119. #define WM831X_CHARGE_TRIM_MASK 0x003F /* CHARGE_TRIM - [5:0] */
  120. #define WM831X_CHARGE_TRIM_SHIFT 0 /* CHARGE_TRIM - [5:0] */
  121. #define WM831X_CHARGE_TRIM_WIDTH 6 /* CHARGE_TRIM - [5:0] */
  122. /*
  123. * R30736 (0x7810) - Customer OTP ID
  124. */
  125. #define WM831X_OTP_AUTO_PROG 0x8000 /* OTP_AUTO_PROG */
  126. #define WM831X_OTP_AUTO_PROG_MASK 0x8000 /* OTP_AUTO_PROG */
  127. #define WM831X_OTP_AUTO_PROG_SHIFT 15 /* OTP_AUTO_PROG */
  128. #define WM831X_OTP_AUTO_PROG_WIDTH 1 /* OTP_AUTO_PROG */
  129. #define WM831X_OTP_CUST_ID_MASK 0x7FFE /* OTP_CUST_ID - [14:1] */
  130. #define WM831X_OTP_CUST_ID_SHIFT 1 /* OTP_CUST_ID - [14:1] */
  131. #define WM831X_OTP_CUST_ID_WIDTH 14 /* OTP_CUST_ID - [14:1] */
  132. #define WM831X_OTP_CUST_FINAL 0x0001 /* OTP_CUST_FINAL */
  133. #define WM831X_OTP_CUST_FINAL_MASK 0x0001 /* OTP_CUST_FINAL */
  134. #define WM831X_OTP_CUST_FINAL_SHIFT 0 /* OTP_CUST_FINAL */
  135. #define WM831X_OTP_CUST_FINAL_WIDTH 1 /* OTP_CUST_FINAL */
  136. /*
  137. * R30759 (0x7827) - DBE CHECK DATA
  138. */
  139. #define WM831X_DBE_VALID_DATA_MASK 0xFFFF /* DBE_VALID_DATA - [15:0] */
  140. #define WM831X_DBE_VALID_DATA_SHIFT 0 /* DBE_VALID_DATA - [15:0] */
  141. #define WM831X_DBE_VALID_DATA_WIDTH 16 /* DBE_VALID_DATA - [15:0] */
  142. #endif