ab4500.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. /*
  2. * Copyright (C) 2009 ST-Ericsson
  3. *
  4. * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2, as
  8. * published by the Free Software Foundation.
  9. *
  10. * AB4500 device core funtions, for client access
  11. */
  12. #ifndef MFD_AB4500_H
  13. #define MFD_AB4500_H
  14. #include <linux/device.h>
  15. /*
  16. * AB4500 bank addresses
  17. */
  18. #define AB4500_SYS_CTRL1_BLOCK 0x1
  19. #define AB4500_SYS_CTRL2_BLOCK 0x2
  20. #define AB4500_REGU_CTRL1 0x3
  21. #define AB4500_REGU_CTRL2 0x4
  22. #define AB4500_USB 0x5
  23. #define AB4500_TVOUT 0x6
  24. #define AB4500_DBI 0x7
  25. #define AB4500_ECI_AV_ACC 0x8
  26. #define AB4500_RESERVED 0x9
  27. #define AB4500_GPADC 0xA
  28. #define AB4500_CHARGER 0xB
  29. #define AB4500_GAS_GAUGE 0xC
  30. #define AB4500_AUDIO 0xD
  31. #define AB4500_INTERRUPT 0xE
  32. #define AB4500_RTC 0xF
  33. #define AB4500_MISC 0x10
  34. #define AB4500_DEBUG 0x12
  35. #define AB4500_PROD_TEST 0x13
  36. #define AB4500_OTP_EMUL 0x15
  37. /*
  38. * System control 1 register offsets.
  39. * Bank = 0x01
  40. */
  41. #define AB4500_TURNON_STAT_REG 0x0100
  42. #define AB4500_RESET_STAT_REG 0x0101
  43. #define AB4500_PONKEY1_PRESS_STAT_REG 0x0102
  44. #define AB4500_FSM_STAT1_REG 0x0140
  45. #define AB4500_FSM_STAT2_REG 0x0141
  46. #define AB4500_SYSCLK_REQ_STAT_REG 0x0142
  47. #define AB4500_USB_STAT1_REG 0x0143
  48. #define AB4500_USB_STAT2_REG 0x0144
  49. #define AB4500_STATUS_SPARE1_REG 0x0145
  50. #define AB4500_STATUS_SPARE2_REG 0x0146
  51. #define AB4500_CTRL1_REG 0x0180
  52. #define AB4500_CTRL2_REG 0x0181
  53. /*
  54. * System control 2 register offsets.
  55. * bank = 0x02
  56. */
  57. #define AB4500_CTRL3_REG 0x0200
  58. #define AB4500_MAIN_WDOG_CTRL_REG 0x0201
  59. #define AB4500_MAIN_WDOG_TIMER_REG 0x0202
  60. #define AB4500_LOW_BAT_REG 0x0203
  61. #define AB4500_BATT_OK_REG 0x0204
  62. #define AB4500_SYSCLK_TIMER_REG 0x0205
  63. #define AB4500_SMPSCLK_CTRL_REG 0x0206
  64. #define AB4500_SMPSCLK_SEL1_REG 0x0207
  65. #define AB4500_SMPSCLK_SEL2_REG 0x0208
  66. #define AB4500_SMPSCLK_SEL3_REG 0x0209
  67. #define AB4500_SYSULPCLK_CONF_REG 0x020A
  68. #define AB4500_SYSULPCLK_CTRL1_REG 0x020B
  69. #define AB4500_SYSCLK_CTRL_REG 0x020C
  70. #define AB4500_SYSCLK_REQ1_VALID_REG 0x020D
  71. #define AB4500_SYSCLK_REQ_VALID_REG 0x020E
  72. #define AB4500_SYSCTRL_SPARE_REG 0x020F
  73. #define AB4500_PAD_CONF_REG 0x0210
  74. /*
  75. * Regu control1 register offsets
  76. * Bank = 0x03
  77. */
  78. #define AB4500_REGU_SERIAL_CTRL1_REG 0x0300
  79. #define AB4500_REGU_SERIAL_CTRL2_REG 0x0301
  80. #define AB4500_REGU_SERIAL_CTRL3_REG 0x0302
  81. #define AB4500_REGU_REQ_CTRL1_REG 0x0303
  82. #define AB4500_REGU_REQ_CTRL2_REG 0x0304
  83. #define AB4500_REGU_REQ_CTRL3_REG 0x0305
  84. #define AB4500_REGU_REQ_CTRL4_REG 0x0306
  85. #define AB4500_REGU_MISC1_REG 0x0380
  86. #define AB4500_REGU_OTGSUPPLY_CTRL_REG 0x0381
  87. #define AB4500_REGU_VUSB_CTRL_REG 0x0382
  88. #define AB4500_REGU_VAUDIO_SUPPLY_REG 0x0383
  89. #define AB4500_REGU_CTRL1_SPARE_REG 0x0384
  90. /*
  91. * Regu control2 Vmod register offsets
  92. */
  93. #define AB4500_REGU_VMOD_REGU_REG 0x0440
  94. #define AB4500_REGU_VMOD_SEL1_REG 0x0441
  95. #define AB4500_REGU_VMOD_SEL2_REG 0x0442
  96. #define AB4500_REGU_CTRL_DISCH_REG 0x0443
  97. #define AB4500_REGU_CTRL_DISCH2_REG 0x0444
  98. /*
  99. * USB/ULPI register offsets
  100. * Bank : 0x5
  101. */
  102. #define AB4500_USB_LINE_STAT_REG 0x0580
  103. #define AB4500_USB_LINE_CTRL1_REG 0x0581
  104. #define AB4500_USB_LINE_CTRL2_REG 0x0582
  105. #define AB4500_USB_LINE_CTRL3_REG 0x0583
  106. #define AB4500_USB_LINE_CTRL4_REG 0x0584
  107. #define AB4500_USB_LINE_CTRL5_REG 0x0585
  108. #define AB4500_USB_OTG_CTRL_REG 0x0587
  109. #define AB4500_USB_OTG_STAT_REG 0x0588
  110. #define AB4500_USB_OTG_STAT_REG 0x0588
  111. #define AB4500_USB_CTRL_SPARE_REG 0x0589
  112. #define AB4500_USB_PHY_CTRL_REG 0x058A
  113. /*
  114. * TVOUT / CTRL register offsets
  115. * Bank : 0x06
  116. */
  117. #define AB4500_TVOUT_CTRL_REG 0x0680
  118. /*
  119. * DBI register offsets
  120. * Bank : 0x07
  121. */
  122. #define AB4500_DBI_REG1_REG 0x0700
  123. #define AB4500_DBI_REG2_REG 0x0701
  124. /*
  125. * ECI regsiter offsets
  126. * Bank : 0x08
  127. */
  128. #define AB4500_ECI_CTRL_REG 0x0800
  129. #define AB4500_ECI_HOOKLEVEL_REG 0x0801
  130. #define AB4500_ECI_DATAOUT_REG 0x0802
  131. #define AB4500_ECI_DATAIN_REG 0x0803
  132. /*
  133. * AV Connector register offsets
  134. * Bank : 0x08
  135. */
  136. #define AB4500_AV_CONN_REG 0x0840
  137. /*
  138. * Accessory detection register offsets
  139. * Bank : 0x08
  140. */
  141. #define AB4500_ACC_DET_DB1_REG 0x0880
  142. #define AB4500_ACC_DET_DB2_REG 0x0881
  143. /*
  144. * GPADC register offsets
  145. * Bank : 0x0A
  146. */
  147. #define AB4500_GPADC_CTRL1_REG 0x0A00
  148. #define AB4500_GPADC_CTRL2_REG 0x0A01
  149. #define AB4500_GPADC_CTRL3_REG 0x0A02
  150. #define AB4500_GPADC_AUTO_TIMER_REG 0x0A03
  151. #define AB4500_GPADC_STAT_REG 0x0A04
  152. #define AB4500_GPADC_MANDATAL_REG 0x0A05
  153. #define AB4500_GPADC_MANDATAH_REG 0x0A06
  154. #define AB4500_GPADC_AUTODATAL_REG 0x0A07
  155. #define AB4500_GPADC_AUTODATAH_REG 0x0A08
  156. #define AB4500_GPADC_MUX_CTRL_REG 0x0A09
  157. /*
  158. * Charger / status register offfsets
  159. * Bank : 0x0B
  160. */
  161. #define AB4500_CH_STATUS1_REG 0x0B00
  162. #define AB4500_CH_STATUS2_REG 0x0B01
  163. #define AB4500_CH_USBCH_STAT1_REG 0x0B02
  164. #define AB4500_CH_USBCH_STAT2_REG 0x0B03
  165. #define AB4500_CH_FSM_STAT_REG 0x0B04
  166. #define AB4500_CH_STAT_REG 0x0B05
  167. /*
  168. * Charger / control register offfsets
  169. * Bank : 0x0B
  170. */
  171. #define AB4500_CH_VOLT_LVL_REG 0x0B40
  172. /*
  173. * Charger / main control register offfsets
  174. * Bank : 0x0B
  175. */
  176. #define AB4500_MCH_CTRL1 0x0B80
  177. #define AB4500_MCH_CTRL2 0x0B81
  178. #define AB4500_MCH_IPT_CURLVL_REG 0x0B82
  179. #define AB4500_CH_WD_REG 0x0B83
  180. /*
  181. * Charger / USB control register offsets
  182. * Bank : 0x0B
  183. */
  184. #define AB4500_USBCH_CTRL1_REG 0x0BC0
  185. #define AB4500_USBCH_CTRL2_REG 0x0BC1
  186. #define AB4500_USBCH_IPT_CRNTLVL_REG 0x0BC2
  187. /*
  188. * RTC bank register offsets
  189. * Bank : 0xF
  190. */
  191. #define AB4500_RTC_SOFF_STAT_REG 0x0F00
  192. #define AB4500_RTC_CC_CONF_REG 0x0F01
  193. #define AB4500_RTC_READ_REQ_REG 0x0F02
  194. #define AB4500_RTC_WATCH_TSECMID_REG 0x0F03
  195. #define AB4500_RTC_WATCH_TSECHI_REG 0x0F04
  196. #define AB4500_RTC_WATCH_TMIN_LOW_REG 0x0F05
  197. #define AB4500_RTC_WATCH_TMIN_MID_REG 0x0F06
  198. #define AB4500_RTC_WATCH_TMIN_HI_REG 0x0F07
  199. #define AB4500_RTC_ALRM_MIN_LOW_REG 0x0F08
  200. #define AB4500_RTC_ALRM_MIN_MID_REG 0x0F09
  201. #define AB4500_RTC_ALRM_MIN_HI_REG 0x0F0A
  202. #define AB4500_RTC_STAT_REG 0x0F0B
  203. #define AB4500_RTC_BKUP_CHG_REG 0x0F0C
  204. #define AB4500_RTC_FORCE_BKUP_REG 0x0F0D
  205. #define AB4500_RTC_CALIB_REG 0x0F0E
  206. #define AB4500_RTC_SWITCH_STAT_REG 0x0F0F
  207. /*
  208. * PWM Out generators
  209. * Bank: 0x10
  210. */
  211. #define AB4500_PWM_OUT_CTRL1_REG 0x1060
  212. #define AB4500_PWM_OUT_CTRL2_REG 0x1061
  213. #define AB4500_PWM_OUT_CTRL3_REG 0x1062
  214. #define AB4500_PWM_OUT_CTRL4_REG 0x1063
  215. #define AB4500_PWM_OUT_CTRL5_REG 0x1064
  216. #define AB4500_PWM_OUT_CTRL6_REG 0x1065
  217. #define AB4500_PWM_OUT_CTRL7_REG 0x1066
  218. #define AB4500_I2C_PAD_CTRL_REG 0x1067
  219. #define AB4500_REV_REG 0x1080
  220. /**
  221. * struct ab4500
  222. * @spi: spi device structure
  223. * @tx_buf: transmit buffer
  224. * @rx_buf: receive buffer
  225. * @lock: sync primitive
  226. */
  227. struct ab4500 {
  228. struct spi_device *spi;
  229. unsigned long tx_buf[4];
  230. unsigned long rx_buf[4];
  231. struct mutex lock;
  232. };
  233. int ab4500_write(struct ab4500 *ab4500, unsigned char block,
  234. unsigned long addr, unsigned char data);
  235. int ab4500_read(struct ab4500 *ab4500, unsigned char block,
  236. unsigned long addr);
  237. #endif /* MFD_AB4500_H */