summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorman James <njames@us.ibm.com>2014-11-10 09:23:22 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-12-03 09:42:26 -0600
commit1033b6f27ae04e22b2daccaff459b0266cb87c03 (patch)
tree979f15801eefde6d1b2be39c169e2cce45e1482d
parente6b7b30e1722ea948c090bf757e04510517ff890 (diff)
downloadtalos-hostboot-1033b6f27ae04e22b2daccaff459b0266cb87c03.tar.gz
talos-hostboot-1033b6f27ae04e22b2daccaff459b0266cb87c03.zip
Added I2c slave addresses.
Addresses are pulled from MRW. If 0x0, I2c slave is disabled. Change-Id: I02292052fedcb78d3e5fb4c624d562520079a6a7 RTC: 115636 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14414 Tested-by: Jenkins Server Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/usr/hwpf/hwp/chip_attributes.xml10
-rwxr-xr-xsrc/usr/hwpf/hwp/include/common_scom_addresses.H6
-rw-r--r--src/usr/hwpf/hwp/nest_chiplets/proc_chiplet_scominit/proc_chiplet_scominit.C67
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types.xml16
-rw-r--r--src/usr/targeting/common/xmltohb/target_types.xml1
5 files changed, 100 insertions, 0 deletions
diff --git a/src/usr/hwpf/hwp/chip_attributes.xml b/src/usr/hwpf/hwp/chip_attributes.xml
index 28020f143..09f6eecd9 100644
--- a/src/usr/hwpf/hwp/chip_attributes.xml
+++ b/src/usr/hwpf/hwp/chip_attributes.xml
@@ -220,6 +220,16 @@
</attribute>
<!-- ********************************************************************* -->
<attribute>
+ <id>ATTR_I2C_SLAVE_ADDRESS</id>
+ <targetType>TARGET_TYPE_PROC_CHIP</targetType>
+ <description>
+ Defines I2C slave address
+ </description>
+ <valueType>uint8</valueType>
+ <platInit/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
<id>ATTR_TARGET_SCOMABLE</id>
<targetType>TARGET_TYPE_PROC_CHIP,TARGET_TYPE_MEMBUF_CHIP,TARGET_TYPE_EX_CHIPLET,TARGET_TYPE_MCS_CHIPLET,TARGET_TYPE_XBUS_ENDPOINT,TARGET_TYPE_ABUS_ENDPOINT,TARGET_TYPE_MBA_CHIPLET</targetType>
<description>
diff --git a/src/usr/hwpf/hwp/include/common_scom_addresses.H b/src/usr/hwpf/hwp/include/common_scom_addresses.H
index d5a2d35f4..8a37e56f4 100755
--- a/src/usr/hwpf/hwp/include/common_scom_addresses.H
+++ b/src/usr/hwpf/hwp/include/common_scom_addresses.H
@@ -285,6 +285,12 @@ CONST_UINT64_T( TP_CLK_ADJ_SET_0x010F0016 , ULL(0x010F0016) );
CONST_UINT64_T( ECCB_ECC_ADDR_REG_0x000C0004 , ULL(0x000C0004) );
//------------------------------------------------------------------------------
+// I2C SLAVE REGISTERS
+//------------------------------------------------------------------------------
+
+CONST_UINT64_T( I2C_SLAVE_CONFIG_REG_0x000D0000 , ULL(0x000D0000) );
+
+//------------------------------------------------------------------------------
// I2C MASTER (MEMS0)
//------------------------------------------------------------------------------
CONST_UINT64_T( I2CMS_MEMS0_CONTROL_0x000A0000 , ULL(0x000A0000) );
diff --git a/src/usr/hwpf/hwp/nest_chiplets/proc_chiplet_scominit/proc_chiplet_scominit.C b/src/usr/hwpf/hwp/nest_chiplets/proc_chiplet_scominit/proc_chiplet_scominit.C
index 722c2424d..d49b010f6 100644
--- a/src/usr/hwpf/hwp/nest_chiplets/proc_chiplet_scominit/proc_chiplet_scominit.C
+++ b/src/usr/hwpf/hwp/nest_chiplets/proc_chiplet_scominit/proc_chiplet_scominit.C
@@ -70,6 +70,7 @@ fapi::ReturnCode proc_chiplet_scominit(const fapi::Target & i_target)
uint8_t master_mcs_pos = 0xFF;
fapi::Target master_mcs;
uint8_t enable_xbus_resonant_clocking = 0x0;
+ uint8_t i2c_slave_address = 0x0;
ecmdDataBufferBase data(64);
ecmdDataBufferBase cfam_data(32);
@@ -270,6 +271,70 @@ fapi::ReturnCode proc_chiplet_scominit(const fapi::Target & i_target)
PROC_CHIPLET_SCOMINIT_NX_IF, PROC_CHIPLET_SCOMINIT_CXA_IF, PROC_CHIPLET_SCOMINIT_AS_IF);
}
+ // conditionally enable I2C Slave
+ rc = FAPI_ATTR_GET(ATTR_I2C_SLAVE_ADDRESS,
+ &i_target,
+ i2c_slave_address);
+ if (!rc.ok())
+ {
+ FAPI_ERR("proc_chiplet_scominit: Error querying ATTR_I2C_SLAVE_ADDRESS on %s",
+ i_target.toEcmdString());
+ break;
+ }
+ rc = fapiGetScom(i_target,
+ I2C_SLAVE_CONFIG_REG_0x000D0000,
+ data);
+ if (!rc.ok())
+ {
+ FAPI_ERR("proc_chiplet_scominit: fapiGetScom error (I2C_SLAVE_CONFIG_REG_0x000D0000) on %s",
+ i_target.toEcmdString());
+ break;
+ }
+ if (i2c_slave_address)
+ {
+ FAPI_DBG("proc_chiplet_scominit: I2C Slave enabled (%s) address = %d",
+ i_target.toEcmdString(),i2c_slave_address);
+
+ //set I2C address
+ rc_ecmd |= data.insert(i2c_slave_address,0,7);
+
+ // disable error state. when this is enabled and there
+ // is an error from I2CS it locks up the I2CS and no
+ // more operations are allowed unless cleared
+ // through FSI. Not good for a FSPless system.
+ rc_ecmd |= data.clearBit(23);
+
+ // enable I2C interface
+ rc_ecmd |= data.setBit(21);
+
+ }
+ else
+ {
+ FAPI_DBG("proc_chiplet_scominit: I2C Slave disabled (%s)",
+ i_target.toEcmdString());
+
+ // disable I2C interface when attribute = 0x0
+ rc_ecmd |= data.clearBit(21);
+ }
+
+ if (rc_ecmd)
+ {
+ FAPI_ERR("proc_chiplet_scominit: Error 0x%x setting I2C Slave register data buffer",
+ rc_ecmd);
+ rc.setEcmdError(rc_ecmd);
+ break;
+ }
+
+ rc = fapiPutScom(i_target,
+ I2C_SLAVE_CONFIG_REG_0x000D0000,
+ data);
+ if (!rc.ok())
+ {
+ FAPI_ERR("proc_chiplet_scominit: fapiPutScom error (I2C_SLAVE_CONFIG_REG_0x000D0000) on %s",
+ i_target.toEcmdString());
+ break;
+ }
+
// conditionally enable resonant clocking for XBUS
rc = FAPI_ATTR_GET(ATTR_CHIP_EC_FEATURE_XBUS_RESONANT_CLK_VALID,
&i_target,
@@ -281,6 +346,7 @@ fapi::ReturnCode proc_chiplet_scominit(const fapi::Target & i_target)
break;
}
+
if (enable_xbus_resonant_clocking)
{
FAPI_DBG("proc_chiplet_scominit: Enabling XBUS resonant clocking");
@@ -348,6 +414,7 @@ fapi::ReturnCode proc_chiplet_scominit(const fapi::Target & i_target)
break;
}
+
// determine set of functional MCS chiplets
rc = fapiGetChildChiplets(i_target,
fapi::TARGET_TYPE_MCS_CHIPLET,
diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index dda04e4ed..33ea22772 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -964,6 +964,22 @@ ID for the sensor number returned with the elog. -->
</attribute>
<attribute>
+ <id>I2C_SLAVE_ADDRESS</id>
+ <description>I2C Slave Address</description>
+ <simpleType>
+ <uint8_t>
+ <default>0x00</default>
+ </uint8_t>
+ </simpleType>
+ <persistency>non-volatile</persistency>
+ <readable/>
+ <hwpfToHbAttrMap>
+ <id>ATTR_I2C_SLAVE_ADDRESS</id>
+ <macro>DIRECT</macro>
+ </hwpfToHbAttrMap>
+</attribute>
+
+<attribute>
<id>FSI_SLAVE_CASCADE</id>
<description>Slave cascade position</description>
<simpleType>
diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml
index 421993a90..5ff314e05 100644
--- a/src/usr/targeting/common/xmltohb/target_types.xml
+++ b/src/usr/targeting/common/xmltohb/target_types.xml
@@ -605,6 +605,7 @@
<attribute><id>PROC_PCIE_IOP_TX_FFE_GEN1</id></attribute>
<attribute><id>PROC_PCIE_IOP_TX_FFE_GEN2</id></attribute>
+ <attribute><id>I2C_SLAVE_ADDRESS</id></attribute>
</targetType>
<targetType>
OpenPOWER on IntegriCloud