summaryrefslogtreecommitdiffstats
path: root/src/usr/i2c/i2c.C
diff options
context:
space:
mode:
authorMike Baiocchi <baiocchi@us.ibm.com>2015-04-28 08:41:53 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-05-12 16:33:19 -0500
commitfb435ee4a4148135b4290eada784da8fa802e8d3 (patch)
tree970b49a4fdc74abe94905b209c7173928d6ba62e /src/usr/i2c/i2c.C
parent70fc635abb02e22af3206092f4be94d082d66e54 (diff)
downloadblackbird-hostboot-fb435ee4a4148135b4290eada784da8fa802e8d3.tar.gz
blackbird-hostboot-fb435ee4a4148135b4290eada784da8fa802e8d3.zip
Improve I2C Master Setup By Checking Master State
Before setting up the I2C Masters for PHYP there is now a check that the engine is in a good state. If it is in a bad state, an I2C reset is issued in an attempt to recover the master before setting it up. Change-Id: Ib023366fc416bb9d5de9fcd0b885c879f22b918f CQ: SW295172 Backport: release-fips830 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17524 Tested-by: Jenkins Server Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/i2c/i2c.C')
-rwxr-xr-xsrc/usr/i2c/i2c.C65
1 files changed, 64 insertions, 1 deletions
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index 098d217c3..76d9c6444 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -2732,8 +2732,71 @@ errlHndl_t i2cProcessActiveMasters ( i2cProcessType i_processType,
}
break;
}
+
+
+
case I2C_OP_SETUP:
{
+ // Check that engine is in a good state - this
+ // function looks for errors and that all previous
+ // commands are complete
+ err = i2cWaitForCmdComp(tgt,
+ io_args );
+
+ if( err )
+ {
+ TRACFCOMP(g_trac_i2c, ERR_MRK
+ "i2cProcessActiveMasters: Error from "
+ "i2cWaitForCmdComp tgt=0x%X, engine=%d. "
+ "Will reset",
+ TARGETING::get_huid(tgt), engine);
+
+ // Reset to recover the engine
+ errlHndl_t err_reset = NULL;
+ err_reset = i2cReset ( tgt, io_args,
+ FORCE_UNLOCK_RESET);
+
+ if( err_reset )
+ {
+ TRACFCOMP( g_trac_i2c,ERR_MRK
+ "i2cProcessActiveMasters: Error reseting"
+ " tgt=0x%X, engine=%d",
+ TARGETING::get_huid(tgt), engine);
+
+
+ // commit reset error and previous error
+ // with the same plid
+ err_reset->plid(err->plid());
+ TRACFCOMP(g_trac_i2c,
+ "i2cProcessActiveMasters: comitting err"
+ "(eid=0x%X) and err_reset(eid=0x%X) "
+ "with plid 0x%X",
+ err->eid(), err_reset->eid(),
+ err->plid());
+
+ errlCommit( err_reset,
+ I2C_COMP_ID );
+
+ errlCommit( err,
+ I2C_COMP_ID );
+
+ // Don't continue or break-need mutex unlock
+ }
+ else
+ {
+ // The reset recovered the engine, so
+ // just delete the original error log
+ TRACFCOMP(g_trac_i2c,
+ "i2cProcessActiveMasters: Reset worked "
+ "so deleting previous err "
+ "eid=0x%X and plid=0x%X",
+ err->eid(), err->plid());
+ delete err;
+ err = NULL;
+ }
+ }
+
+ // Set Mode Register
mode_reg_t mode;
mode.value = 0x0;
@@ -2752,7 +2815,7 @@ errlHndl_t i2cProcessActiveMasters ( i2cProcessType i_processType,
{
TRACFCOMP( g_trac_i2c,
ERR_MRK"i2cProcessActiveMasters:"
- " Error reading from"
+ " Error setting mode for"
" Processor, engine: %d",
engine );
OpenPOWER on IntegriCloud