diff options
| author | Ani Bagepalli <abagepa@us.ibm.com> | 2014-09-29 17:16:44 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-10-22 21:11:07 -0500 |
| commit | c928dcb161d02921ceff4f2c10801334da8f41ee (patch) | |
| tree | 22fed87dfdd9abb968a29ed7064fc4e49df2ad56 /src/usr/i2c/test | |
| parent | 3b3b3a82d88f9008b5c36818670c45ad003943e8 (diff) | |
| download | talos-hostboot-c928dcb161d02921ceff4f2c10801334da8f41ee.tar.gz talos-hostboot-c928dcb161d02921ceff4f2c10801334da8f41ee.zip | |
Force I2C reset/unlock
This commit add a method to manually toggle the clock and data lines
to reset the I2C bus that is locked. This method will also reset the
slave I2C chips.
Change-Id: I6353dd24f86ca9b0a649875b11bae47035887c84
RTC:97439
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13659
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/i2c/test')
| -rwxr-xr-x | src/usr/i2c/test/i2ctest.H | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/usr/i2c/test/i2ctest.H b/src/usr/i2c/test/i2ctest.H index f19edde02..f33ec1824 100755 --- a/src/usr/i2c/test/i2ctest.H +++ b/src/usr/i2c/test/i2ctest.H @@ -912,6 +912,92 @@ class I2CTest: public CxxTest::TestSuite fails, num_ops ); } + void testI2cForceReset(void) + { + + + errlHndl_t err = NULL; + + do + { + I2C::misc_args_t io_args; + + uint64_t data = 0x0; + + // Get the Proc Target + TARGETING::TargetService& tS = TARGETING::targetService(); + TARGETING::Target* procTarget = NULL; + tS.masterProcChipTargetHandle( procTarget ); + assert( procTarget != NULL ); + + // reset the target and then try a read + if(procTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional) + { + TRACFCOMP( g_trac_i2c, + " testI2cForceReset- functional good path" ); + io_args.engine = 0x0; + io_args.port = 0x0; + //get engine lock attr for engine 0 + //prevents sbe update test fails + + mutex_t * engineLock = NULL; + engineLock = + procTarget->getHbMutexAttr<TARGETING::ATTR_I2C_ENGINE_MUTEX_0>(); + + (void)mutex_lock( engineLock ); + + //force reset + err = I2C::i2cReset(procTarget, + io_args, + I2C::FORCE_UNLOCK_RESET); + + (void) mutex_unlock( engineLock ); + + //if there was an error for a reason commit it + if(err) + { + errlCommit( err,I2C_COMP_ID ); + delete err; err = NULL; + } + + nanosleep( 0, 100); + + //read + size_t data_size = 8; + err = deviceOp( DeviceFW::READ, + procTarget, + &data, + data_size, + DEVICE_I2C_ADDRESS( 0, + 0, + 0xAC ) ); + + } + + + + + if(err) + { + TS_FAIL("testI2cForceReset failed err detected"); + errlCommit( err,I2C_COMP_ID ); + delete err; err = NULL; + break; + } + + if(data == 0) + { + //there should be some data + TS_FAIL("testI2cForceReset failed data read is 0"); + break; + } + + + }while(0); + + + } + }; #endif |

