skgei2c.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /******************************************************************************
  2. *
  3. * Name: skgei2c.h
  4. * Project: Gigabit Ethernet Adapters, TWSI-Module
  5. * Version: $Revision: 1.25 $
  6. * Date: $Date: 2003/10/20 09:06:05 $
  7. * Purpose: Special defines for TWSI
  8. *
  9. ******************************************************************************/
  10. /******************************************************************************
  11. *
  12. * (C)Copyright 1998-2002 SysKonnect.
  13. * (C)Copyright 2002-2003 Marvell.
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * The information in this file is provided "AS IS" without warranty.
  21. *
  22. ******************************************************************************/
  23. /*
  24. * SKGEI2C.H contains all SK-98xx specific defines for the TWSI handling
  25. */
  26. #ifndef _INC_SKGEI2C_H_
  27. #define _INC_SKGEI2C_H_
  28. /*
  29. * Macros to access the B2_I2C_CTRL
  30. */
  31. #define SK_I2C_CTL(IoC, flag, dev, dev_size, reg, burst) \
  32. SK_OUT32(IoC, B2_I2C_CTRL,\
  33. (flag ? 0x80000000UL : 0x0L) | \
  34. (((SK_U32)reg << 16) & I2C_ADDR) | \
  35. (((SK_U32)dev << 9) & I2C_DEV_SEL) | \
  36. (dev_size & I2C_DEV_SIZE) | \
  37. ((burst << 4) & I2C_BURST_LEN))
  38. #define SK_I2C_STOP(IoC) { \
  39. SK_U32 I2cCtrl; \
  40. SK_IN32(IoC, B2_I2C_CTRL, &I2cCtrl); \
  41. SK_OUT32(IoC, B2_I2C_CTRL, I2cCtrl | I2C_STOP); \
  42. }
  43. #define SK_I2C_GET_CTL(IoC, pI2cCtrl) SK_IN32(IoC, B2_I2C_CTRL, pI2cCtrl)
  44. /*
  45. * Macros to access the TWSI SW Registers
  46. */
  47. #define SK_I2C_SET_BIT(IoC, SetBits) { \
  48. SK_U8 OrgBits; \
  49. SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
  50. SK_OUT8(IoC, B2_I2C_SW, OrgBits | (SK_U8)(SetBits)); \
  51. }
  52. #define SK_I2C_CLR_BIT(IoC, ClrBits) { \
  53. SK_U8 OrgBits; \
  54. SK_IN8(IoC, B2_I2C_SW, &OrgBits); \
  55. SK_OUT8(IoC, B2_I2C_SW, OrgBits & ~((SK_U8)(ClrBits))); \
  56. }
  57. #define SK_I2C_GET_SW(IoC, pI2cSw) SK_IN8(IoC, B2_I2C_SW, pI2cSw)
  58. /*
  59. * define the possible sensor states
  60. */
  61. #define SK_SEN_IDLE 0 /* Idle: sensor not read */
  62. #define SK_SEN_VALUE 1 /* Value Read cycle */
  63. #define SK_SEN_VALEXT 2 /* Extended Value Read cycle */
  64. /*
  65. * Conversion factor to convert read Voltage sensor to milli Volt
  66. * Conversion factor to convert read Temperature sensor to 10th degree Celsius
  67. */
  68. #define SK_LM80_VT_LSB 22 /* 22mV LSB resolution */
  69. #define SK_LM80_TEMP_LSB 10 /* 1 degree LSB resolution */
  70. #define SK_LM80_TEMPEXT_LSB 5 /* 0.5 degree LSB resolution for ext. val. */
  71. /*
  72. * formula: counter = (22500*60)/(rpm * divisor * pulses/2)
  73. * assuming: 6500rpm, 4 pulses, divisor 1
  74. */
  75. #define SK_LM80_FAN_FAKTOR ((22500L*60)/(1*2))
  76. /*
  77. * Define sensor management data
  78. * Maximum is reached on Genesis copper dual port and Yukon-64
  79. * Board specific maximum is in pAC->I2c.MaxSens
  80. */
  81. #define SK_MAX_SENSORS 8 /* maximal no. of installed sensors */
  82. #define SK_MIN_SENSORS 5 /* minimal no. of installed sensors */
  83. /*
  84. * To watch the state machine (SM) use the timer in two ways
  85. * instead of one as hitherto
  86. */
  87. #define SK_TIMER_WATCH_SM 0 /* Watch the SM to finish in a spec. time */
  88. #define SK_TIMER_NEW_GAUGING 1 /* Start a new gauging when timer expires */
  89. /*
  90. * Defines for the individual thresholds
  91. */
  92. /* Temperature sensor */
  93. #define SK_SEN_TEMP_HIGH_ERR 800 /* Temperature High Err Threshold */
  94. #define SK_SEN_TEMP_HIGH_WARN 700 /* Temperature High Warn Threshold */
  95. #define SK_SEN_TEMP_LOW_WARN 100 /* Temperature Low Warn Threshold */
  96. #define SK_SEN_TEMP_LOW_ERR 0 /* Temperature Low Err Threshold */
  97. /* VCC which should be 5 V */
  98. #define SK_SEN_PCI_5V_HIGH_ERR 5588 /* Voltage PCI High Err Threshold */
  99. #define SK_SEN_PCI_5V_HIGH_WARN 5346 /* Voltage PCI High Warn Threshold */
  100. #define SK_SEN_PCI_5V_LOW_WARN 4664 /* Voltage PCI Low Warn Threshold */
  101. #define SK_SEN_PCI_5V_LOW_ERR 4422 /* Voltage PCI Low Err Threshold */
  102. /*
  103. * VIO may be 5 V or 3.3 V. Initialization takes two parts:
  104. * 1. Initialize lowest lower limit and highest higher limit.
  105. * 2. After the first value is read correct the upper or the lower limit to
  106. * the appropriate C constant.
  107. *
  108. * Warning limits are +-5% of the exepected voltage.
  109. * Error limits are +-10% of the expected voltage.
  110. */
  111. /* Bug fix AF: 16.Aug.2001: Correct the init base of LM80 sensor */
  112. #define SK_SEN_PCI_IO_5V_HIGH_ERR 5566 /* + 10% V PCI-IO High Err Threshold */
  113. #define SK_SEN_PCI_IO_5V_HIGH_WARN 5324 /* + 5% V PCI-IO High Warn Threshold */
  114. /* 5000 mVolt */
  115. #define SK_SEN_PCI_IO_5V_LOW_WARN 4686 /* - 5% V PCI-IO Low Warn Threshold */
  116. #define SK_SEN_PCI_IO_5V_LOW_ERR 4444 /* - 10% V PCI-IO Low Err Threshold */
  117. #define SK_SEN_PCI_IO_RANGE_LIMITER 4000 /* 4000 mV range delimiter */
  118. /* correction values for the second pass */
  119. #define SK_SEN_PCI_IO_3V3_HIGH_ERR 3850 /* + 15% V PCI-IO High Err Threshold */
  120. #define SK_SEN_PCI_IO_3V3_HIGH_WARN 3674 /* + 10% V PCI-IO High Warn Threshold */
  121. /* 3300 mVolt */
  122. #define SK_SEN_PCI_IO_3V3_LOW_WARN 2926 /* - 10% V PCI-IO Low Warn Threshold */
  123. #define SK_SEN_PCI_IO_3V3_LOW_ERR 2772 /* - 15% V PCI-IO Low Err Threshold */
  124. /*
  125. * VDD voltage
  126. */
  127. #define SK_SEN_VDD_HIGH_ERR 3630 /* Voltage ASIC High Err Threshold */
  128. #define SK_SEN_VDD_HIGH_WARN 3476 /* Voltage ASIC High Warn Threshold */
  129. #define SK_SEN_VDD_LOW_WARN 3146 /* Voltage ASIC Low Warn Threshold */
  130. #define SK_SEN_VDD_LOW_ERR 2970 /* Voltage ASIC Low Err Threshold */
  131. /*
  132. * PHY PLL 3V3 voltage
  133. */
  134. #define SK_SEN_PLL_3V3_HIGH_ERR 3630 /* Voltage PMA High Err Threshold */
  135. #define SK_SEN_PLL_3V3_HIGH_WARN 3476 /* Voltage PMA High Warn Threshold */
  136. #define SK_SEN_PLL_3V3_LOW_WARN 3146 /* Voltage PMA Low Warn Threshold */
  137. #define SK_SEN_PLL_3V3_LOW_ERR 2970 /* Voltage PMA Low Err Threshold */
  138. /*
  139. * VAUX (YUKON only)
  140. */
  141. #define SK_SEN_VAUX_3V3_HIGH_ERR 3630 /* Voltage VAUX High Err Threshold */
  142. #define SK_SEN_VAUX_3V3_HIGH_WARN 3476 /* Voltage VAUX High Warn Threshold */
  143. #define SK_SEN_VAUX_3V3_LOW_WARN 3146 /* Voltage VAUX Low Warn Threshold */
  144. #define SK_SEN_VAUX_3V3_LOW_ERR 2970 /* Voltage VAUX Low Err Threshold */
  145. #define SK_SEN_VAUX_0V_WARN_ERR 0 /* if VAUX not present */
  146. #define SK_SEN_VAUX_RANGE_LIMITER 1000 /* 1000 mV range delimiter */
  147. /*
  148. * PHY 2V5 voltage
  149. */
  150. #define SK_SEN_PHY_2V5_HIGH_ERR 2750 /* Voltage PHY High Err Threshold */
  151. #define SK_SEN_PHY_2V5_HIGH_WARN 2640 /* Voltage PHY High Warn Threshold */
  152. #define SK_SEN_PHY_2V5_LOW_WARN 2376 /* Voltage PHY Low Warn Threshold */
  153. #define SK_SEN_PHY_2V5_LOW_ERR 2222 /* Voltage PHY Low Err Threshold */
  154. /*
  155. * ASIC Core 1V5 voltage (YUKON only)
  156. */
  157. #define SK_SEN_CORE_1V5_HIGH_ERR 1650 /* Voltage ASIC Core High Err Threshold */
  158. #define SK_SEN_CORE_1V5_HIGH_WARN 1575 /* Voltage ASIC Core High Warn Threshold */
  159. #define SK_SEN_CORE_1V5_LOW_WARN 1425 /* Voltage ASIC Core Low Warn Threshold */
  160. #define SK_SEN_CORE_1V5_LOW_ERR 1350 /* Voltage ASIC Core Low Err Threshold */
  161. /*
  162. * FAN 1 speed
  163. */
  164. /* assuming: 6500rpm +-15%, 4 pulses,
  165. * warning at: 80 %
  166. * error at: 70 %
  167. * no upper limit
  168. */
  169. #define SK_SEN_FAN_HIGH_ERR 20000 /* FAN Speed High Err Threshold */
  170. #define SK_SEN_FAN_HIGH_WARN 20000 /* FAN Speed High Warn Threshold */
  171. #define SK_SEN_FAN_LOW_WARN 5200 /* FAN Speed Low Warn Threshold */
  172. #define SK_SEN_FAN_LOW_ERR 4550 /* FAN Speed Low Err Threshold */
  173. /*
  174. * Some Voltages need dynamic thresholds
  175. */
  176. #define SK_SEN_DYN_INIT_NONE 0 /* No dynamic init of thresholds */
  177. #define SK_SEN_DYN_INIT_PCI_IO 10 /* Init PCI-IO with new thresholds */
  178. #define SK_SEN_DYN_INIT_VAUX 11 /* Init VAUX with new thresholds */
  179. extern int SkLm80ReadSensor(SK_AC *pAC, SK_IOC IoC, SK_SENSOR *pSen);
  180. #endif /* n_INC_SKGEI2C_H */