summaryrefslogtreecommitdiff
path: root/drivers/sk98lin/ski2c.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-10-15 23:53:47 +0000
committerwdenk <wdenk>2003-10-15 23:53:47 +0000
commit42d1f0394bef0624fc9664714d54bb137931d6a6 (patch)
tree892a4130507484d25faf9a72e019cf88cfb3e3d9 /drivers/sk98lin/ski2c.c
parent2d5b561e2bfdee8552a99b2cf93016cce2a74895 (diff)
downloadu-boot-imx-42d1f0394bef0624fc9664714d54bb137931d6a6.zip
u-boot-imx-42d1f0394bef0624fc9664714d54bb137931d6a6.tar.gz
u-boot-imx-42d1f0394bef0624fc9664714d54bb137931d6a6.tar.bz2
* Patches by Xianghua Xiao, 15 Oct 2003:
- Added Motorola CPU 8540/8560 support (cpu/85xx) - Added Motorola MPC8540ADS board support (board/mpc8540ads) - Added Motorola MPC8560ADS board support (board/mpc8560ads) * Minor code cleanup
Diffstat (limited to 'drivers/sk98lin/ski2c.c')
-rw-r--r--drivers/sk98lin/ski2c.c162
1 files changed, 81 insertions, 81 deletions
diff --git a/drivers/sk98lin/ski2c.c b/drivers/sk98lin/ski2c.c
index b262f29..2ab635a 100644
--- a/drivers/sk98lin/ski2c.c
+++ b/drivers/sk98lin/ski2c.c
@@ -29,178 +29,178 @@
* Revision 1.57 2003/01/28 09:17:38 rschmidt
* Fixed handling for sensors on YUKON Fiber.
* Editorial changes.
- *
+ *
* Revision 1.56 2002/12/19 14:20:41 rschmidt
* Added debugging code in SkI2cWait().
* Replaced all I2C-write operations with function SkI2cWrite().
* Fixed compiler warning because of uninitialized 'Time' in SkI2cEvent().
* Editorial changes.
- *
+ *
* Revision 1.55 2002/10/15 07:23:55 rschmidt
* Added setting of the GIYukon32Bit bool variable to distinguish
* 32-bit adapters.
* Editorial changes (TWSI).
- *
+ *
* Revision 1.54 2002/08/13 09:05:06 rschmidt
* Added new thresholds if VAUX is not available (GIVauxAvail).
* Merged defines for PHY PLL 3V3 voltage (A and B).
* Editorial changes.
- *
+ *
* Revision 1.53 2002/08/08 11:04:53 rwahl
* Added missing comment for revision 1.51
- *
+ *
* Revision 1.52 2002/08/08 10:09:02 jschmalz
* Sensor init state caused wrong error log entry
- *
+ *
* Revision 1.51 2002/08/06 09:43:03 jschmalz
* Extensions and changes for Yukon
- *
+ *
* Revision 1.50 2002/08/02 12:09:22 rschmidt
* Added support for YUKON sensors.
* Editorial changes.
- *
+ *
* Revision 1.49 2002/07/30 11:07:52 rschmidt
* Replaced MaxSens init by update for Copper in SkI2cInit1(),
* because it was already initialized in SkI2cInit0().
* Editorial changes.
- *
+ *
* Revision 1.48 2001/08/16 12:44:33 afischer
* LM80 sensor init values corrected
- *
+ *
* Revision 1.47 2001/04/05 11:38:09 rassmann
* Set SenState to idle in SkI2cWaitIrq().
* Changed error message in SkI2cWaitIrq().
- *
+ *
* Revision 1.46 2001/04/02 14:03:35 rassmann
* Changed pAC to IoC in SK_IN32().
- *
+ *
* Revision 1.45 2001/03/21 12:12:49 rassmann
* Resetting I2C_READY interrupt in SkI2cInit1().
- *
+ *
* Revision 1.44 2000/08/07 15:49:03 gklug
* Fix: SK_INFAST only in NetWare driver.
- *
+ *
* Revision 1.43 2000/08/03 14:28:17 rassmann
* Added function to wait for I2C being ready before resetting the board.
* Replaced one duplicate "out of range" message with correct one.
- *
+ *
* Revision 1.42 1999/11/22 13:35:12 cgoos
* Changed license header to GPL.
- *
+ *
* Revision 1.41 1999/09/14 14:11:30 malthoff
* The 1000BT Dual Link adapter has got only one Fan.
* The second Fan has been removed.
- *
+ *
* Revision 1.40 1999/05/27 13:37:27 malthoff
* Set divisor of 1 for fan count calculation.
- *
+ *
* Revision 1.39 1999/05/20 14:54:43 malthoff
* I2c.DummyReads is not used in Diagnostics.
- *
+ *
* Revision 1.38 1999/05/20 09:20:56 cgoos
* Changes for 1000Base-T (up to 9 sensors and fans).
- *
+ *
* Revision 1.37 1999/03/25 15:11:36 gklug
* fix: reset error flag if sensor reads correct value
- *
+ *
* Revision 1.36 1999/01/07 14:11:16 gklug
* fix: break added
- *
+ *
* Revision 1.35 1999/01/05 15:31:49 gklug
* fix: CLEAR STAT command is now added correctly
- *
+ *
* Revision 1.34 1998/12/01 13:45:16 gklug
* fix: introduced Init level, because we don't need reinits
- *
+ *
* Revision 1.33 1998/11/09 14:54:25 malthoff
* Modify I2C Transfer Timeout handling for Diagnostics.
- *
+ *
* Revision 1.32 1998/11/03 06:54:35 gklug
* fix: Need dummy reads at the beginning to init sensors
*
* Revision 1.31 1998/11/03 06:42:42 gklug
* fix: select correctVIO range only if between warning levels
- *
+ *
* Revision 1.30 1998/11/02 07:36:53 gklug
* fix: Error should not include WARNING message
- *
+ *
* Revision 1.29 1998/10/30 15:07:43 malthoff
* Disable 'I2C does not compelete' error log for diagnostics.
- *
+ *
* Revision 1.28 1998/10/22 09:48:11 gklug
* fix: SysKonnectFileId typo
- *
+ *
* Revision 1.27 1998/10/20 09:59:46 gklug
* add: parameter to SkOsGetTime
- *
+ *
* Revision 1.26 1998/10/09 06:10:59 malthoff
* Remove ID_sccs by SysKonnectFileId.
- *
+ *
* Revision 1.25 1998/09/08 12:40:26 gklug
* fix: syntax error in if clause
- *
+ *
* Revision 1.24 1998/09/08 12:19:42 gklug
* chg: INIT Level checking
- *
+ *
* Revision 1.23 1998/09/08 07:37:20 gklug
* fix: log error if PCI_IO voltage sensor could not be initialized
- *
+ *
* Revision 1.22 1998/09/04 08:30:03 malthoff
* Bugfixes during SK_DIAG testing:
* - correct NS2BCLK() macro
* - correct SkI2cSndDev()
* - correct SkI2cWait() loop waiting for an event
- *
+ *
* Revision 1.21 1998/08/27 14:46:01 gklug
* chg: if-then-else replaced by switch
*
* Revision 1.20 1998/08/27 14:40:07 gklug
* test: integral types
- *
+ *
* Revision 1.19 1998/08/25 07:51:54 gklug
* fix: typos for compiling
- *
+ *
* Revision 1.18 1998/08/25 06:12:24 gklug
* add: count errors and warnings
* fix: check not the sensor state but the ErrFlag!
- *
+ *
* Revision 1.17 1998/08/25 05:56:48 gklug
* add: CheckSensor function
- *
+ *
* Revision 1.16 1998/08/20 11:41:10 gklug
* chg: omit STRCPY macro by using char * as Sensor Description
- *
+ *
* Revision 1.15 1998/08/20 11:37:35 gklug
* chg: change Ioc to IoC
- *
+ *
* Revision 1.14 1998/08/20 11:32:52 gklug
* fix: Para compile error
- *
+ *
* Revision 1.13 1998/08/20 11:27:41 gklug
* fix: Compile bugs with new awrning constants
- *
+ *
* Revision 1.12 1998/08/20 08:53:05 gklug
* fix: compiler errors
* add: Threshold values
- *
+ *
* Revision 1.11 1998/08/19 12:39:22 malthoff
* Compiler Fix: Some names have changed.
- *
+ *
* Revision 1.10 1998/08/19 12:20:56 gklug
* fix: remove struct from C files (see CCC)
- *
+ *
* Revision 1.9 1998/08/19 06:28:46 malthoff
* SkOsGetTime returns SK_U64 now.
- *
+ *
* Revision 1.8 1998/08/17 13:53:33 gklug
* fix: Parameter of event function and its result
- *
+ *
* Revision 1.7 1998/08/17 07:02:15 malthoff
* Modify the functions for accessing the I2C SW Registers.
* Modify SkI2cWait().
* Put Lm80RcvReg into sklm80.c
* Remove Compiler Errors.
- *
+ *
* Revision 1.6 1998/08/14 07:13:20 malthoff
* remove pAc with pAC
* remove smc with pAC
@@ -473,7 +473,7 @@ SK_IOC IoC) /* I/O Context */
SkDgWaitTime(IoC, NS2BCLK(T_CLK_HIGH));
SK_I2C_GET_SW(IoC, &I2cSwCtrl);
-
+
Bit = (I2cSwCtrl & I2C_DATA) ? 1 : 0;
I2C_CLK_LOW(IoC);
@@ -615,19 +615,19 @@ int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */
SK_U32 I2cCtrl;
StartTime = SkOsGetTime(pAC);
-
+
do {
CurrentTime = SkOsGetTime(pAC);
if (CurrentTime - StartTime > SK_TICKS_PER_SEC / 8) {
-
+
SK_I2C_STOP(IoC);
#ifndef SK_DIAG
SK_ERR_LOG(pAC, SK_ERRCL_SW, SKERR_I2C_E002, SKERR_I2C_E002MSG);
#endif /* !SK_DIAG */
return(1);
}
-
+
SK_I2C_GET_CTL(IoC, &I2cCtrl);
#ifdef xYUKON_DBG
@@ -637,7 +637,7 @@ int Event) /* complete event to wait for (I2C_READ or I2C_WRITE) */
return(1);
}
#endif /* YUKON_DBG */
-
+
} while ((I2cCtrl & I2C_FLAG) == (SK_U32)Event << 31);
return(0);
@@ -696,7 +696,7 @@ int I2cBurst) /* I2C Burst Flag */
{
SK_OUT32(IoC, B2_I2C_DATA, I2cData);
SK_I2C_CTL(IoC, I2C_WRITE, I2cDev, I2cReg, I2cBurst);
-
+
return(SkI2cWait(pAC, IoC, I2C_WRITE));
} /* SkI2cWrite*/
@@ -719,11 +719,11 @@ int I2cBurst) /* I2C Burst Flag */
SK_OUT32(IoC, B2_I2C_DATA, 0);
SK_I2C_CTL(IoC, I2C_READ, I2cDev, I2cReg, I2cBurst);
-
+
if (SkI2cWait(pAC, IoC, I2C_READ) != 0) {
w_print("%s\n", SKERR_I2C_E002MSG);
}
-
+
SK_IN32(IoC, B2_I2C_DATA, &Data);
return(Data);
} /* SkI2cRead */
@@ -747,10 +747,10 @@ SK_IOC IoC, /* I/O Context */
SK_SENSOR *pSen) /* Sensor to be read */
{
if (pSen->SenRead != NULL) {
- return((*pSen->SenRead)(pAC, IoC, pSen));
+ return((*pSen->SenRead)(pAC, IoC, pSen));
}
else
- return(0); /* no success */
+ return(0); /* no success */
} /* SkI2cReadSensor*/
/*
@@ -763,10 +763,10 @@ SK_AC *pAC) /* Adapter Context */
/* Begin with first sensor */
pAC->I2c.CurrSens = 0;
-
+
/* Begin with timeout control for state machine */
pAC->I2c.TimerMode = SK_TIMER_WATCH_STATEMACHINE;
-
+
/* Set sensor number to zero */
pAC->I2c.MaxSens = 0;
@@ -840,32 +840,32 @@ SK_IOC IoC) /* I/O Context */
if ((I2cSwCtrl & I2C_DATA) == 0) {
/* this is a 32-Bit board */
pAC->GIni.GIYukon32Bit = SK_TRUE;
- return(0);
+ return(0);
}
/* Check for 64 Bit Yukon without sensors */
if (SkI2cWrite(pAC, IoC, 0, LM80_ADDR, LM80_CFG, 0) != 0) {
- return(0);
+ return(0);
}
(void)SkI2cWrite(pAC, IoC, 0xff, LM80_ADDR, LM80_IMSK_1, 0);
-
+
(void)SkI2cWrite(pAC, IoC, 0xff, LM80_ADDR, LM80_IMSK_2, 0);
-
+
(void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, LM80_FAN_CTRL, 0);
-
+
(void)SkI2cWrite(pAC, IoC, 0, LM80_ADDR, LM80_TEMP_CTRL, 0);
-
+
(void)SkI2cWrite(pAC, IoC, LM80_CFG_START, LM80_ADDR, LM80_CFG, 0);
-
+
/*
* MaxSens has to be updated here, because PhyType is not
* set when performing Init Level 0
*/
pAC->I2c.MaxSens = 5;
-
+
pPrt = &pAC->GIni.GP[0];
-
+
if (pAC->GIni.GIGenesis) {
if (pPrt->PhyType == SK_PHY_BCOM) {
if (pAC->GIni.GIMacsFound == 1) {
@@ -879,7 +879,7 @@ SK_IOC IoC) /* I/O Context */
else {
pAC->I2c.MaxSens += 3;
}
-
+
for (i = 0; i < pAC->I2c.MaxSens; i++) {
switch (i) {
case 0:
@@ -1022,10 +1022,10 @@ SK_IOC IoC) /* I/O Context */
#ifndef SK_DIAG
pAC->I2c.DummyReads = pAC->I2c.MaxSens;
#endif /* !SK_DIAG */
-
+
/* Clear I2C IRQ */
SK_OUT32(IoC, B2_I2C_IRQ, I2C_CLR_IRQ);
-
+
/* Now we are I/O initialized */
pAC->I2c.InitLevel = SK_INIT_IO;
return(0);
@@ -1156,7 +1156,7 @@ SK_SENSOR *pSen)
/* Check the Value against the thresholds. First: Error Thresholds */
TooHigh = (pSen->SenValue > pSen->SenThreErrHigh);
TooLow = (pSen->SenValue < pSen->SenThreErrLow);
-
+
IsError = SK_FALSE;
if (TooHigh || TooLow) {
/* Error condition is satisfied */
@@ -1229,7 +1229,7 @@ SK_SENSOR *pSen)
/* 2nd: Warning thresholds */
TooHigh = (pSen->SenValue > pSen->SenThreWarnHigh);
TooLow = (pSen->SenValue < pSen->SenThreWarnLow);
-
+
if (!IsError && (TooHigh || TooLow)) {
/* Error condition is satisfied */
DoTrapSend = SK_TRUE;
@@ -1307,7 +1307,7 @@ SK_SENSOR *pSen)
*/
if (pSen->SenInit == SK_SEN_DYN_INIT_PCI_IO) {
- pSen->SenInit = SK_SEN_DYN_INIT_NONE;
+ pSen->SenInit = SK_SEN_DYN_INIT_NONE;
if (pSen->SenValue > SK_SEN_PCI_IO_RANGE_LIMITER) {
/* 5V PCI-IO Voltage */
@@ -1320,12 +1320,12 @@ SK_SENSOR *pSen)
pSen->SenThreErrHigh = SK_SEN_PCI_IO_3V3_HIGH_ERR;
}
}
-
+
#if 0
/* Dynamic thresholds also for VAUX of LM80 sensor */
if (pSen->SenInit == SK_SEN_DYN_INIT_VAUX) {
- pSen->SenInit = SK_SEN_DYN_INIT_NONE;
+ pSen->SenInit = SK_SEN_DYN_INIT_NONE;
/* 3.3V VAUX Voltage */
if (pSen->SenValue > SK_SEN_VAUX_RANGE_LIMITER) {
@@ -1410,17 +1410,17 @@ SK_EVPARA Para) /* Event specific Parameter */
ParaLocal.Para64 = (SK_U64)0;
pAC->I2c.TimerMode = SK_TIMER_NEW_GAUGING;
-
+
SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, Time,
SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
}
- else {
+ else {
/* Start Timer */
ParaLocal.Para64 = (SK_U64)0;
pAC->I2c.TimerMode = SK_TIMER_WATCH_STATEMACHINE;
- SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, SK_I2C_TIM_WATCH,
+ SkTimerStart(pAC, IoC, &pAC->I2c.SenTimer, SK_I2C_TIM_WATCH,
SKGE_I2C, SK_I2CEV_TIM, ParaLocal);
}
break;