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