skgei2c.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /******************************************************************************
  2. *
  3. * Name: skgei2c.h
  4. * Project: GEnesis, PCI Gigabit Ethernet Adapter
  5. * Version: $Revision: 1.23 $
  6. * Date: $Date: 2002/12/19 14:34:27 $
  7. * Purpose: Special GEnesis defines for TWSI
  8. *
  9. ******************************************************************************/
  10. /******************************************************************************
  11. *
  12. * (C)Copyright 1998-2002 SysKonnect GmbH.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * The information in this file is provided "AS IS" without warranty.
  20. *
  21. ******************************************************************************/
  22. /******************************************************************************
  23. *
  24. * History:
  25. *
  26. * $Log: skgei2c.h,v $
  27. * Revision 1.23 2002/12/19 14:34:27 rschmidt
  28. * Added cast in macros SK_I2C_SET_BIT() and SK_I2C_CLR_BIT()
  29. * Editorial changes (TWSI)
  30. *
  31. * Revision 1.22 2002/10/14 16:45:56 rschmidt
  32. * Editorial changes (TWSI)
  33. *
  34. * Revision 1.21 2002/08/13 08:42:24 rschmidt
  35. * Changed define for SK_MIN_SENSORS back to 5
  36. * Merged defines for PHY PLL 3V3 voltage (A and B)
  37. * Editorial changes
  38. *
  39. * Revision 1.20 2002/08/06 09:43:56 jschmalz
  40. * Extensions and changes for Yukon
  41. *
  42. * Revision 1.19 2002/08/02 12:00:08 rschmidt
  43. * Added defines for YUKON sensors
  44. * Editorial changes
  45. *
  46. * Revision 1.18 2001/08/16 12:44:33 afischer
  47. * LM80 sensor init values corrected
  48. *
  49. * Revision 1.17 1999/11/22 13:55:25 cgoos
  50. * Changed license header to GPL.
  51. *
  52. * Revision 1.16 1999/11/12 08:24:10 malthoff
  53. * Change voltage warning and error limits
  54. * (warning +-5%, error +-10%).
  55. *
  56. * Revision 1.15 1999/09/14 14:14:43 malthoff
  57. * The 1000BT Dual Link adapter has got only one Fan.
  58. * The second Fan has been removed.
  59. *
  60. * Revision 1.14 1999/05/27 13:40:50 malthoff
  61. * Fan Divisor = 1. Assuming fan with 6500 rpm.
  62. *
  63. * Revision 1.13 1999/05/20 14:56:55 malthoff
  64. * Bug Fix: Missing brace in SK_LM80_FAN_FAKTOR.
  65. *
  66. * Revision 1.12 1999/05/20 09:22:00 cgoos
  67. * Changes for 1000Base-T (Fan sensors).
  68. *
  69. * Revision 1.11 1998/10/14 05:57:22 cgoos
  70. * Fixed compilation warnings.
  71. *
  72. * Revision 1.10 1998/09/04 08:37:00 malthoff
  73. * bugfix: correct the SK_I2C_GET_CTL() macro.
  74. *
  75. * Revision 1.9 1998/08/25 06:10:03 gklug
  76. * add: thresholds for all sensors
  77. *
  78. * Revision 1.8 1998/08/20 11:37:42 gklug
  79. * chg: change Ioc to IoC
  80. *
  81. * Revision 1.7 1998/08/20 08:53:11 gklug
  82. * fix: compiler errors
  83. * add: Threshold values
  84. *
  85. * Revision 1.6 1998/08/17 11:37:09 malthoff
  86. * Bugfix in SK_I2C_CTL macro. The parameter 'dev'
  87. * has to be shifted 9 bits.
  88. *
  89. * Revision 1.5 1998/08/17 06:52:21 malthoff
  90. * Remove unrequired macros.
  91. * Add macros for accessing TWSI SW register.
  92. *
  93. * Revision 1.4 1998/08/13 08:30:18 gklug
  94. * add: conversion factors for read values
  95. * add: new state SEN_VALEXT to read extension value of temperature sensor
  96. *
  97. * Revision 1.3 1998/08/12 13:37:56 gklug
  98. * rmv: error numbers and messages
  99. *
  100. * Revision 1.2 1998/08/11 07:54:38 gklug
  101. * add: sensor states for GE sensors
  102. * add: Macro to access TWSI hardware register
  103. * chg: Error messages for TWSI errors
  104. *
  105. * Revision 1.1 1998/07/17 11:27:56 gklug
  106. * Created.
  107. *
  108. *
  109. *
  110. ******************************************************************************/
  111. /*
  112. * SKGEI2C.H contains all SK-98xx specific defines for the TWSI handling
  113. */
  114. #ifndef _INC_SKGEI2C_H_
  115. #define _INC_SKGEI2C_H_
  116. /*
  117. * Macros to access the B2_I2C_CTRL
  118. */
  119. #define SK_I2C_CTL(IoC, flag, dev, reg, burst) \
  120. SK_OUT32(IoC, B2_I2C_CTRL,\
  121. (flag ? 0x80000000UL : 0x0L) | \
  122. (((SK_U32) reg << 16) & I2C_ADDR) | \
  123. (((SK_U32) dev << 9) & I2C_DEV_SEL) | \
  124. (( burst << 4) & I2C_BURST_LEN))
  125. #define SK_I2C_STOP(IoC) { \
  126. SK_U32 I2cCtrl; \
  127. SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \
  128. SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \
  129. }
  130. #define SK_I2C_GET_CTL(IoC, pI2cCtrl) SK_IN32(IoC, B2_I2C_CTRL, pI2cCtrl)
  131. /*
  132. * Macros to access the TWSI SW Registers
  133. */
  134. #define SK_I2C_SET_BIT(IoC, SetBits) { \
  135. SK_U8 OrgBits; \
  136. SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
  137. SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SK_U8)(SetBits)); \
  138. }
  139. #define SK_I2C_CLR_BIT(IoC, ClrBits) { \
  140. SK_U8 OrgBits; \
  141. SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
  142. SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~((SK_U8)(ClrBits))); \
  143. }
  144. #define SK_I2C_GET_SW(IoC, pI2cSw) SK_IN8(IoC, B2_I2C_SW, pI2cSw)
  145. /*
  146. * define the possible sensor states
  147. */
  148. #define SK_SEN_IDLE 0 /* Idle: sensor not read */
  149. #define SK_SEN_VALUE 1 /* Value Read cycle */
  150. #define SK_SEN_VALEXT 2 /* Extended Value Read cycle */
  151. /*
  152. * Conversion factor to convert read Voltage sensor to milli Volt
  153. * Conversion factor to convert read Temperature sensor to 10th degree Celsius
  154. */
  155. #define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */
  156. #define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */
  157. #define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for the
  158. * extension value
  159. */
  160. #define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
  161. /* formula: counter = (22500*60)/(rpm * divisor * pulses/2)
  162. * assuming: 6500rpm, 4 pulses, divisor 1
  163. */
  164. /*
  165. * Define sensor management data
  166. * Maximum is reached on copperfield with dual Broadcom.
  167. * Board specific maximum is in pAC->I2c.MaxSens
  168. */
  169. #define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */
  170. #define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */
  171. /*
  172. * To watch the statemachine (JS) use the timer in two ways instead of one as hitherto
  173. */
  174. #define SK_TIMER_WATCH_STATEMACHINE 0 /* Watch the statemachine to finish in a specific time */
  175. #define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
  176. /*
  177. * Defines for the individual Thresholds
  178. */
  179. /* Temperature sensor */
  180. #define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
  181. #define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
  182. #define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
  183. #define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
  184. /* VCC which should be 5 V */
  185. #define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
  186. #define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
  187. #define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
  188. #define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
  189. /*
  190. * VIO may be 5 V or 3.3 V. Initialization takes two parts:
  191. * 1. Initialize lowest lower limit and highest higher limit.
  192. * 2. After the first value is read correct the upper or the lower limit to
  193. * the appropriate C constant.
  194. *
  195. * Warning limits are +-5% of the exepected voltage.
  196. * Error limits are +-10% of the expected voltage.
  197. */
  198. /* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
  199. #define SK_SEN_PCI_IO_5V_HIGH_ERR 5566 /* + 10% V PCI-IO High Err Threshold */
  200. #define SK_SEN_PCI_IO_5V_HIGH_WARN 5324 /* + 5% V PCI-IO High Warn Threshold */
  201. /* 5000 mVolt */
  202. #define SK_SEN_PCI_IO_5V_LOW_WARN 4686 /* - 5% V PCI-IO Low Warn Threshold */
  203. #define SK_SEN_PCI_IO_5V_LOW_ERR 4444 /* - 10% V PCI-IO Low Err Threshold */
  204. #define SK_SEN_PCI_IO_RANGE_LIMITER 4000 /* 4000 mV range delimiter */
  205. /* correction values for the second pass */
  206. #define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
  207. #define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
  208. /* 3300 mVolt */
  209. #define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
  210. #define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
  211. /*
  212. * VDD voltage
  213. */
  214. #define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
  215. #define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
  216. #define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
  217. #define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
  218. /*
  219. * PHY PLL 3V3 voltage
  220. */
  221. #define SK_SEN_PLL_3V3_HIGH_ERR 3630 /* Voltage PMA High Err Threshold */
  222. #define SK_SEN_PLL_3V3_HIGH_WARN 3476 /* Voltage PMA High Warn Threshold */
  223. #define SK_SEN_PLL_3V3_LOW_WARN 3146 /* Voltage PMA Low Warn Threshold */
  224. #define SK_SEN_PLL_3V3_LOW_ERR 2970 /* Voltage PMA Low Err Threshold */
  225. /*
  226. * VAUX (YUKON only)
  227. */
  228. #define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */
  229. #define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */
  230. #define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */
  231. #define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */
  232. #define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */
  233. #define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
  234. /*
  235. * PHY 2V5 voltage
  236. */
  237. #define SK_SEN_PHY_2V5_HIGH_ERR 2750 /* Voltage PHY High Err Threshold */
  238. #define SK_SEN_PHY_2V5_HIGH_WARN 2640 /* Voltage PHY High Warn Threshold */
  239. #define SK_SEN_PHY_2V5_LOW_WARN 2376 /* Voltage PHY Low Warn Threshold */
  240. #define SK_SEN_PHY_2V5_LOW_ERR 2222 /* Voltage PHY Low Err Threshold */
  241. /*
  242. * ASIC Core 1V5 voltage (YUKON only)
  243. */
  244. #define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */
  245. #define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */
  246. #define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */
  247. #define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */
  248. /*
  249. * FAN 1 speed
  250. */
  251. /* assuming: 6500rpm +-15%, 4 pulses,
  252. * warning at: 80 %
  253. * error at: 70 %
  254. * no upper limit
  255. */
  256. #define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
  257. #define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
  258. #define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
  259. #define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
  260. /*
  261. * Some Voltages need dynamic thresholds
  262. */
  263. #define SK_SEN_DYN_INIT_NONE 0 /* No dynamic init of thresholds */
  264. #define SK_SEN_DYN_INIT_PCI_IO 10 /* Init PCI-IO with new thresholds */
  265. #define SK_SEN_DYN_INIT_VAUX 11 /* Init VAUX with new thresholds */
  266. extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
  267. #endif /* n_INC_SKGEI2C_H */