au1xxx_psc.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * Include file for Alchemy Semiconductor's Au1k CPU.
  5. *
  6. * Copyright 2004 Embedded Edge, LLC
  7. * dan@embeddededge.com
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  15. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  17. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  20. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * You should have received a copy of the GNU General Public License along
  26. * with this program; if not, write to the Free Software Foundation, Inc.,
  27. * 675 Mass Ave, Cambridge, MA 02139, USA.
  28. */
  29. /* Specifics for the Au1xxx Programmable Serial Controllers, first
  30. * seen in the AU1550 part.
  31. */
  32. #ifndef _AU1000_PSC_H_
  33. #define _AU1000_PSC_H_
  34. /*
  35. * The PSC select and control registers are common to all protocols.
  36. */
  37. #define PSC_SEL_OFFSET 0x00000000
  38. #define PSC_CTRL_OFFSET 0x00000004
  39. #define PSC_SEL_CLK_MASK (3 << 4)
  40. #define PSC_SEL_CLK_INTCLK (0 << 4)
  41. #define PSC_SEL_CLK_EXTCLK (1 << 4)
  42. #define PSC_SEL_CLK_SERCLK (2 << 4)
  43. #define PSC_SEL_PS_MASK 0x00000007
  44. #define PSC_SEL_PS_DISABLED 0
  45. #define PSC_SEL_PS_SPIMODE 2
  46. #define PSC_SEL_PS_I2SMODE 3
  47. #define PSC_SEL_PS_AC97MODE 4
  48. #define PSC_SEL_PS_SMBUSMODE 5
  49. #define PSC_CTRL_DISABLE 0
  50. #define PSC_CTRL_SUSPEND 2
  51. #define PSC_CTRL_ENABLE 3
  52. /* AC97 Registers. */
  53. #define PSC_AC97CFG_OFFSET 0x00000008
  54. #define PSC_AC97MSK_OFFSET 0x0000000c
  55. #define PSC_AC97PCR_OFFSET 0x00000010
  56. #define PSC_AC97STAT_OFFSET 0x00000014
  57. #define PSC_AC97EVNT_OFFSET 0x00000018
  58. #define PSC_AC97TXRX_OFFSET 0x0000001c
  59. #define PSC_AC97CDC_OFFSET 0x00000020
  60. #define PSC_AC97RST_OFFSET 0x00000024
  61. #define PSC_AC97GPO_OFFSET 0x00000028
  62. #define PSC_AC97GPI_OFFSET 0x0000002c
  63. /* AC97 Config Register. */
  64. #define PSC_AC97CFG_RT_MASK (3 << 30)
  65. #define PSC_AC97CFG_RT_FIFO1 (0 << 30)
  66. #define PSC_AC97CFG_RT_FIFO2 (1 << 30)
  67. #define PSC_AC97CFG_RT_FIFO4 (2 << 30)
  68. #define PSC_AC97CFG_RT_FIFO8 (3 << 30)
  69. #define PSC_AC97CFG_TT_MASK (3 << 28)
  70. #define PSC_AC97CFG_TT_FIFO1 (0 << 28)
  71. #define PSC_AC97CFG_TT_FIFO2 (1 << 28)
  72. #define PSC_AC97CFG_TT_FIFO4 (2 << 28)
  73. #define PSC_AC97CFG_TT_FIFO8 (3 << 28)
  74. #define PSC_AC97CFG_DD_DISABLE (1 << 27)
  75. #define PSC_AC97CFG_DE_ENABLE (1 << 26)
  76. #define PSC_AC97CFG_SE_ENABLE (1 << 25)
  77. #define PSC_AC97CFG_LEN_MASK (0xf << 21)
  78. #define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11)
  79. #define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
  80. #define PSC_AC97CFG_GE_ENABLE (1)
  81. /* Enable slots 3-12. */
  82. #define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
  83. #define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
  84. /*
  85. * The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
  86. * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the
  87. * arithmetic in the macro.
  88. */
  89. #define PSC_AC97CFG_SET_LEN(x) (((((x) - 2) / 2) & 0xf) << 21)
  90. #define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
  91. /* AC97 Mask Register. */
  92. #define PSC_AC97MSK_GR (1 << 25)
  93. #define PSC_AC97MSK_CD (1 << 24)
  94. #define PSC_AC97MSK_RR (1 << 13)
  95. #define PSC_AC97MSK_RO (1 << 12)
  96. #define PSC_AC97MSK_RU (1 << 11)
  97. #define PSC_AC97MSK_TR (1 << 10)
  98. #define PSC_AC97MSK_TO (1 << 9)
  99. #define PSC_AC97MSK_TU (1 << 8)
  100. #define PSC_AC97MSK_RD (1 << 5)
  101. #define PSC_AC97MSK_TD (1 << 4)
  102. #define PSC_AC97MSK_ALLMASK (PSC_AC97MSK_GR | PSC_AC97MSK_CD | \
  103. PSC_AC97MSK_RR | PSC_AC97MSK_RO | \
  104. PSC_AC97MSK_RU | PSC_AC97MSK_TR | \
  105. PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
  106. PSC_AC97MSK_RD | PSC_AC97MSK_TD)
  107. /* AC97 Protocol Control Register. */
  108. #define PSC_AC97PCR_RC (1 << 6)
  109. #define PSC_AC97PCR_RP (1 << 5)
  110. #define PSC_AC97PCR_RS (1 << 4)
  111. #define PSC_AC97PCR_TC (1 << 2)
  112. #define PSC_AC97PCR_TP (1 << 1)
  113. #define PSC_AC97PCR_TS (1 << 0)
  114. /* AC97 Status register (read only). */
  115. #define PSC_AC97STAT_CB (1 << 26)
  116. #define PSC_AC97STAT_CP (1 << 25)
  117. #define PSC_AC97STAT_CR (1 << 24)
  118. #define PSC_AC97STAT_RF (1 << 13)
  119. #define PSC_AC97STAT_RE (1 << 12)
  120. #define PSC_AC97STAT_RR (1 << 11)
  121. #define PSC_AC97STAT_TF (1 << 10)
  122. #define PSC_AC97STAT_TE (1 << 9)
  123. #define PSC_AC97STAT_TR (1 << 8)
  124. #define PSC_AC97STAT_RB (1 << 5)
  125. #define PSC_AC97STAT_TB (1 << 4)
  126. #define PSC_AC97STAT_DI (1 << 2)
  127. #define PSC_AC97STAT_DR (1 << 1)
  128. #define PSC_AC97STAT_SR (1 << 0)
  129. /* AC97 Event Register. */
  130. #define PSC_AC97EVNT_GR (1 << 25)
  131. #define PSC_AC97EVNT_CD (1 << 24)
  132. #define PSC_AC97EVNT_RR (1 << 13)
  133. #define PSC_AC97EVNT_RO (1 << 12)
  134. #define PSC_AC97EVNT_RU (1 << 11)
  135. #define PSC_AC97EVNT_TR (1 << 10)
  136. #define PSC_AC97EVNT_TO (1 << 9)
  137. #define PSC_AC97EVNT_TU (1 << 8)
  138. #define PSC_AC97EVNT_RD (1 << 5)
  139. #define PSC_AC97EVNT_TD (1 << 4)
  140. /* CODEC Command Register. */
  141. #define PSC_AC97CDC_RD (1 << 25)
  142. #define PSC_AC97CDC_ID_MASK (3 << 23)
  143. #define PSC_AC97CDC_INDX_MASK (0x7f << 16)
  144. #define PSC_AC97CDC_ID(x) (((x) & 0x03) << 23)
  145. #define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
  146. /* AC97 Reset Control Register. */
  147. #define PSC_AC97RST_RST (1 << 1)
  148. #define PSC_AC97RST_SNC (1 << 0)
  149. /* PSC in I2S Mode. */
  150. typedef struct psc_i2s {
  151. u32 psc_sel;
  152. u32 psc_ctrl;
  153. u32 psc_i2scfg;
  154. u32 psc_i2smsk;
  155. u32 psc_i2spcr;
  156. u32 psc_i2sstat;
  157. u32 psc_i2sevent;
  158. u32 psc_i2stxrx;
  159. u32 psc_i2sudf;
  160. } psc_i2s_t;
  161. #define PSC_I2SCFG_OFFSET 0x08
  162. #define PSC_I2SMASK_OFFSET 0x0C
  163. #define PSC_I2SPCR_OFFSET 0x10
  164. #define PSC_I2SSTAT_OFFSET 0x14
  165. #define PSC_I2SEVENT_OFFSET 0x18
  166. #define PSC_I2SRXTX_OFFSET 0x1C
  167. #define PSC_I2SUDF_OFFSET 0x20
  168. /* I2S Config Register. */
  169. #define PSC_I2SCFG_RT_MASK (3 << 30)
  170. #define PSC_I2SCFG_RT_FIFO1 (0 << 30)
  171. #define PSC_I2SCFG_RT_FIFO2 (1 << 30)
  172. #define PSC_I2SCFG_RT_FIFO4 (2 << 30)
  173. #define PSC_I2SCFG_RT_FIFO8 (3 << 30)
  174. #define PSC_I2SCFG_TT_MASK (3 << 28)
  175. #define PSC_I2SCFG_TT_FIFO1 (0 << 28)
  176. #define PSC_I2SCFG_TT_FIFO2 (1 << 28)
  177. #define PSC_I2SCFG_TT_FIFO4 (2 << 28)
  178. #define PSC_I2SCFG_TT_FIFO8 (3 << 28)
  179. #define PSC_I2SCFG_DD_DISABLE (1 << 27)
  180. #define PSC_I2SCFG_DE_ENABLE (1 << 26)
  181. #define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16)
  182. #define PSC_I2SCFG_WS(n) ((n & 0xFF) << 16)
  183. #define PSC_I2SCFG_WS_MASK (PSC_I2SCFG_WS(0x3F))
  184. #define PSC_I2SCFG_WI (1 << 15)
  185. #define PSC_I2SCFG_DIV_MASK (3 << 13)
  186. #define PSC_I2SCFG_DIV2 (0 << 13)
  187. #define PSC_I2SCFG_DIV4 (1 << 13)
  188. #define PSC_I2SCFG_DIV8 (2 << 13)
  189. #define PSC_I2SCFG_DIV16 (3 << 13)
  190. #define PSC_I2SCFG_BI (1 << 12)
  191. #define PSC_I2SCFG_BUF (1 << 11)
  192. #define PSC_I2SCFG_MLJ (1 << 10)
  193. #define PSC_I2SCFG_XM (1 << 9)
  194. /* The word length equation is simply LEN+1. */
  195. #define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
  196. #define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
  197. #define PSC_I2SCFG_LB (1 << 2)
  198. #define PSC_I2SCFG_MLF (1 << 1)
  199. #define PSC_I2SCFG_MS (1 << 0)
  200. /* I2S Mask Register. */
  201. #define PSC_I2SMSK_RR (1 << 13)
  202. #define PSC_I2SMSK_RO (1 << 12)
  203. #define PSC_I2SMSK_RU (1 << 11)
  204. #define PSC_I2SMSK_TR (1 << 10)
  205. #define PSC_I2SMSK_TO (1 << 9)
  206. #define PSC_I2SMSK_TU (1 << 8)
  207. #define PSC_I2SMSK_RD (1 << 5)
  208. #define PSC_I2SMSK_TD (1 << 4)
  209. #define PSC_I2SMSK_ALLMASK (PSC_I2SMSK_RR | PSC_I2SMSK_RO | \
  210. PSC_I2SMSK_RU | PSC_I2SMSK_TR | \
  211. PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
  212. PSC_I2SMSK_RD | PSC_I2SMSK_TD)
  213. /* I2S Protocol Control Register. */
  214. #define PSC_I2SPCR_RC (1 << 6)
  215. #define PSC_I2SPCR_RP (1 << 5)
  216. #define PSC_I2SPCR_RS (1 << 4)
  217. #define PSC_I2SPCR_TC (1 << 2)
  218. #define PSC_I2SPCR_TP (1 << 1)
  219. #define PSC_I2SPCR_TS (1 << 0)
  220. /* I2S Status register (read only). */
  221. #define PSC_I2SSTAT_RF (1 << 13)
  222. #define PSC_I2SSTAT_RE (1 << 12)
  223. #define PSC_I2SSTAT_RR (1 << 11)
  224. #define PSC_I2SSTAT_TF (1 << 10)
  225. #define PSC_I2SSTAT_TE (1 << 9)
  226. #define PSC_I2SSTAT_TR (1 << 8)
  227. #define PSC_I2SSTAT_RB (1 << 5)
  228. #define PSC_I2SSTAT_TB (1 << 4)
  229. #define PSC_I2SSTAT_DI (1 << 2)
  230. #define PSC_I2SSTAT_DR (1 << 1)
  231. #define PSC_I2SSTAT_SR (1 << 0)
  232. /* I2S Event Register. */
  233. #define PSC_I2SEVNT_RR (1 << 13)
  234. #define PSC_I2SEVNT_RO (1 << 12)
  235. #define PSC_I2SEVNT_RU (1 << 11)
  236. #define PSC_I2SEVNT_TR (1 << 10)
  237. #define PSC_I2SEVNT_TO (1 << 9)
  238. #define PSC_I2SEVNT_TU (1 << 8)
  239. #define PSC_I2SEVNT_RD (1 << 5)
  240. #define PSC_I2SEVNT_TD (1 << 4)
  241. /* PSC in SPI Mode. */
  242. typedef struct psc_spi {
  243. u32 psc_sel;
  244. u32 psc_ctrl;
  245. u32 psc_spicfg;
  246. u32 psc_spimsk;
  247. u32 psc_spipcr;
  248. u32 psc_spistat;
  249. u32 psc_spievent;
  250. u32 psc_spitxrx;
  251. } psc_spi_t;
  252. /* SPI Config Register. */
  253. #define PSC_SPICFG_RT_MASK (3 << 30)
  254. #define PSC_SPICFG_RT_FIFO1 (0 << 30)
  255. #define PSC_SPICFG_RT_FIFO2 (1 << 30)
  256. #define PSC_SPICFG_RT_FIFO4 (2 << 30)
  257. #define PSC_SPICFG_RT_FIFO8 (3 << 30)
  258. #define PSC_SPICFG_TT_MASK (3 << 28)
  259. #define PSC_SPICFG_TT_FIFO1 (0 << 28)
  260. #define PSC_SPICFG_TT_FIFO2 (1 << 28)
  261. #define PSC_SPICFG_TT_FIFO4 (2 << 28)
  262. #define PSC_SPICFG_TT_FIFO8 (3 << 28)
  263. #define PSC_SPICFG_DD_DISABLE (1 << 27)
  264. #define PSC_SPICFG_DE_ENABLE (1 << 26)
  265. #define PSC_SPICFG_CLR_BAUD(x) ((x) & ~((0x3f) << 15))
  266. #define PSC_SPICFG_SET_BAUD(x) (((x) & 0x3f) << 15)
  267. #define PSC_SPICFG_SET_DIV(x) (((x) & 0x03) << 13)
  268. #define PSC_SPICFG_DIV2 0
  269. #define PSC_SPICFG_DIV4 1
  270. #define PSC_SPICFG_DIV8 2
  271. #define PSC_SPICFG_DIV16 3
  272. #define PSC_SPICFG_BI (1 << 12)
  273. #define PSC_SPICFG_PSE (1 << 11)
  274. #define PSC_SPICFG_CGE (1 << 10)
  275. #define PSC_SPICFG_CDE (1 << 9)
  276. #define PSC_SPICFG_CLR_LEN(x) ((x) & ~((0x1f) << 4))
  277. #define PSC_SPICFG_SET_LEN(x) (((x-1) & 0x1f) << 4)
  278. #define PSC_SPICFG_LB (1 << 3)
  279. #define PSC_SPICFG_MLF (1 << 1)
  280. #define PSC_SPICFG_MO (1 << 0)
  281. /* SPI Mask Register. */
  282. #define PSC_SPIMSK_MM (1 << 16)
  283. #define PSC_SPIMSK_RR (1 << 13)
  284. #define PSC_SPIMSK_RO (1 << 12)
  285. #define PSC_SPIMSK_RU (1 << 11)
  286. #define PSC_SPIMSK_TR (1 << 10)
  287. #define PSC_SPIMSK_TO (1 << 9)
  288. #define PSC_SPIMSK_TU (1 << 8)
  289. #define PSC_SPIMSK_SD (1 << 5)
  290. #define PSC_SPIMSK_MD (1 << 4)
  291. #define PSC_SPIMSK_ALLMASK (PSC_SPIMSK_MM | PSC_SPIMSK_RR | \
  292. PSC_SPIMSK_RO | PSC_SPIMSK_TO | \
  293. PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
  294. PSC_SPIMSK_MD)
  295. /* SPI Protocol Control Register. */
  296. #define PSC_SPIPCR_RC (1 << 6)
  297. #define PSC_SPIPCR_SP (1 << 5)
  298. #define PSC_SPIPCR_SS (1 << 4)
  299. #define PSC_SPIPCR_TC (1 << 2)
  300. #define PSC_SPIPCR_MS (1 << 0)
  301. /* SPI Status register (read only). */
  302. #define PSC_SPISTAT_RF (1 << 13)
  303. #define PSC_SPISTAT_RE (1 << 12)
  304. #define PSC_SPISTAT_RR (1 << 11)
  305. #define PSC_SPISTAT_TF (1 << 10)
  306. #define PSC_SPISTAT_TE (1 << 9)
  307. #define PSC_SPISTAT_TR (1 << 8)
  308. #define PSC_SPISTAT_SB (1 << 5)
  309. #define PSC_SPISTAT_MB (1 << 4)
  310. #define PSC_SPISTAT_DI (1 << 2)
  311. #define PSC_SPISTAT_DR (1 << 1)
  312. #define PSC_SPISTAT_SR (1 << 0)
  313. /* SPI Event Register. */
  314. #define PSC_SPIEVNT_MM (1 << 16)
  315. #define PSC_SPIEVNT_RR (1 << 13)
  316. #define PSC_SPIEVNT_RO (1 << 12)
  317. #define PSC_SPIEVNT_RU (1 << 11)
  318. #define PSC_SPIEVNT_TR (1 << 10)
  319. #define PSC_SPIEVNT_TO (1 << 9)
  320. #define PSC_SPIEVNT_TU (1 << 8)
  321. #define PSC_SPIEVNT_SD (1 << 5)
  322. #define PSC_SPIEVNT_MD (1 << 4)
  323. /* Transmit register control. */
  324. #define PSC_SPITXRX_LC (1 << 29)
  325. #define PSC_SPITXRX_SR (1 << 28)
  326. /* SMBus Config Register. */
  327. #define PSC_SMBCFG_RT_MASK (3 << 30)
  328. #define PSC_SMBCFG_RT_FIFO1 (0 << 30)
  329. #define PSC_SMBCFG_RT_FIFO2 (1 << 30)
  330. #define PSC_SMBCFG_RT_FIFO4 (2 << 30)
  331. #define PSC_SMBCFG_RT_FIFO8 (3 << 30)
  332. #define PSC_SMBCFG_TT_MASK (3 << 28)
  333. #define PSC_SMBCFG_TT_FIFO1 (0 << 28)
  334. #define PSC_SMBCFG_TT_FIFO2 (1 << 28)
  335. #define PSC_SMBCFG_TT_FIFO4 (2 << 28)
  336. #define PSC_SMBCFG_TT_FIFO8 (3 << 28)
  337. #define PSC_SMBCFG_DD_DISABLE (1 << 27)
  338. #define PSC_SMBCFG_DE_ENABLE (1 << 26)
  339. #define PSC_SMBCFG_SET_DIV(x) (((x) & 0x03) << 13)
  340. #define PSC_SMBCFG_DIV2 0
  341. #define PSC_SMBCFG_DIV4 1
  342. #define PSC_SMBCFG_DIV8 2
  343. #define PSC_SMBCFG_DIV16 3
  344. #define PSC_SMBCFG_GCE (1 << 9)
  345. #define PSC_SMBCFG_SFM (1 << 8)
  346. #define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
  347. /* SMBus Mask Register. */
  348. #define PSC_SMBMSK_DN (1 << 30)
  349. #define PSC_SMBMSK_AN (1 << 29)
  350. #define PSC_SMBMSK_AL (1 << 28)
  351. #define PSC_SMBMSK_RR (1 << 13)
  352. #define PSC_SMBMSK_RO (1 << 12)
  353. #define PSC_SMBMSK_RU (1 << 11)
  354. #define PSC_SMBMSK_TR (1 << 10)
  355. #define PSC_SMBMSK_TO (1 << 9)
  356. #define PSC_SMBMSK_TU (1 << 8)
  357. #define PSC_SMBMSK_SD (1 << 5)
  358. #define PSC_SMBMSK_MD (1 << 4)
  359. #define PSC_SMBMSK_ALLMASK (PSC_SMBMSK_DN | PSC_SMBMSK_AN | \
  360. PSC_SMBMSK_AL | PSC_SMBMSK_RR | \
  361. PSC_SMBMSK_RO | PSC_SMBMSK_TO | \
  362. PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
  363. PSC_SMBMSK_MD)
  364. /* SMBus Protocol Control Register. */
  365. #define PSC_SMBPCR_DC (1 << 2)
  366. #define PSC_SMBPCR_MS (1 << 0)
  367. /* SMBus Status register (read only). */
  368. #define PSC_SMBSTAT_BB (1 << 28)
  369. #define PSC_SMBSTAT_RF (1 << 13)
  370. #define PSC_SMBSTAT_RE (1 << 12)
  371. #define PSC_SMBSTAT_RR (1 << 11)
  372. #define PSC_SMBSTAT_TF (1 << 10)
  373. #define PSC_SMBSTAT_TE (1 << 9)
  374. #define PSC_SMBSTAT_TR (1 << 8)
  375. #define PSC_SMBSTAT_SB (1 << 5)
  376. #define PSC_SMBSTAT_MB (1 << 4)
  377. #define PSC_SMBSTAT_DI (1 << 2)
  378. #define PSC_SMBSTAT_DR (1 << 1)
  379. #define PSC_SMBSTAT_SR (1 << 0)
  380. /* SMBus Event Register. */
  381. #define PSC_SMBEVNT_DN (1 << 30)
  382. #define PSC_SMBEVNT_AN (1 << 29)
  383. #define PSC_SMBEVNT_AL (1 << 28)
  384. #define PSC_SMBEVNT_RR (1 << 13)
  385. #define PSC_SMBEVNT_RO (1 << 12)
  386. #define PSC_SMBEVNT_RU (1 << 11)
  387. #define PSC_SMBEVNT_TR (1 << 10)
  388. #define PSC_SMBEVNT_TO (1 << 9)
  389. #define PSC_SMBEVNT_TU (1 << 8)
  390. #define PSC_SMBEVNT_SD (1 << 5)
  391. #define PSC_SMBEVNT_MD (1 << 4)
  392. #define PSC_SMBEVNT_ALLCLR (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | \
  393. PSC_SMBEVNT_AL | PSC_SMBEVNT_RR | \
  394. PSC_SMBEVNT_RO | PSC_SMBEVNT_TO | \
  395. PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
  396. PSC_SMBEVNT_MD)
  397. /* Transmit register control. */
  398. #define PSC_SMBTXRX_RSR (1 << 28)
  399. #define PSC_SMBTXRX_STP (1 << 29)
  400. #define PSC_SMBTXRX_DATAMASK 0xff
  401. /* SMBus protocol timers register. */
  402. #define PSC_SMBTMR_SET_TH(x) (((x) & 0x03) << 30)
  403. #define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
  404. #define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
  405. #define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
  406. #define PSC_SMBTMR_SET_SU(x) (((x) & 0x1f) << 10)
  407. #define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
  408. #define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
  409. #endif /* _AU1000_PSC_H_ */