From 793283f013116f450aa0bb39155ba876a83c2dfd Mon Sep 17 00:00:00 2001 From: Christian Geddes Date: Wed, 14 Aug 2019 17:00:55 -0500 Subject: Update ocmb i2c driver to send address in read command sequence As part of the register read operation to a ocmb card the spec tells us to perform 2 commands. The first command is a REGISTER_LATCH cmd which includes the address of the register you want to read. The 2nd cmd is a REGISTER_READ command which, according to the spec does not require the address to be sent again. We found during bringup that the gemini cards were expecting the address to be sent along with the REGISTER_READ cmd as well as with the REGISTER_LATCH cmd. Cronus was doing this in their code so they did not see this problem. As these address bits will be ignored by explorer cards (per the spec) it should be benign the include them with the REGISTER_READ cmd. Change-Id: Ifcade18a290355432df43c0c3e58d6575f1f25b5 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/82249 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Louis Stermole Reviewed-by: STEPHEN GLANCY Dev-Ready: STEPHEN GLANCY Reviewed-by: Jennifer A Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/82257 Reviewed-by: RAJA DAS --- .../procedures/hwp/memory/lib/i2c/exp_i2c.H | 65 ++++++++++++---------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c.H index 68d25da4..9d415e92 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c/exp_i2c.H @@ -422,7 +422,7 @@ inline fapi2::ReturnCode fw_reg_write(const fapi2::Target l_cmd_vector; - std::vector l_be_vector; + std::vector l_byte_vector; uint32_t l_input_data = static_cast(i_data_buffer); @@ -434,21 +434,20 @@ inline fapi2::ReturnCode fw_reg_write(const fapi2::Target::iterator it = l_be_vector.begin(); it != l_be_vector.end(); ++it) + for(const auto l_byte : l_byte_vector) { - l_cmd_vector.push_back(*it); + l_cmd_vector.push_back(l_byte); } - l_be_vector.clear(); - forceBE(l_input_data, l_be_vector); + l_byte_vector.clear(); + forceBE(l_input_data, l_byte_vector); // Byte 6:9 = Data - - for(std::vector::iterator it = l_be_vector.begin(); it != l_be_vector.end(); ++it) + for(const auto l_byte : l_byte_vector) { - l_cmd_vector.push_back(*it); + l_cmd_vector.push_back(l_byte); } // Use fapi2 putI2c interface to execute command @@ -479,13 +478,13 @@ inline fapi2::ReturnCode fw_reg_read(const fapi2::Target l_cmd_vector; - std::vector l_tmp_vector; + std::vector l_byte_vector; // Flush o_data_buffer w/ all 0's to avoid stale data o_data_buffer.flush<0>(); // Force the address to be BE - forceBE(i_addr, l_tmp_vector); + forceBE(i_addr, l_byte_vector); // Build the cmd vector for the Read l_cmd_vector.push_back(FW_REG_ADDR_LATCH); // Byte 0 = 0x03 (FW_REG_ADDR_LATCH) @@ -496,9 +495,9 @@ inline fapi2::ReturnCode fw_reg_read(const fapi2::Target::iterator it = l_tmp_vector.begin(); it != l_tmp_vector.end(); ++it) + for(const auto l_byte : l_byte_vector) { - l_cmd_vector.push_back(*it); + l_cmd_vector.push_back(l_byte); } // Use fapi2 putI2c interface to execute command @@ -511,36 +510,44 @@ inline fapi2::ReturnCode fw_reg_read(const fapi2::Target