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