diff options
author | Terry J. Opie <opiet@us.ibm.com> | 2011-08-05 08:51:38 -0500 |
---|---|---|
committer | Terry J. Opie <opiet@us.ibm.com> | 2011-08-15 13:57:29 -0500 |
commit | fa0113e4599fcca0c2d4c938c88d445d288a952a (patch) | |
tree | ca797228d6c31b9dcd3ed617f7a82e77d9e27138 /src/include | |
parent | b0ceda93e7d5b6b06465a5fcc0b261a52dad987d (diff) | |
download | talos-hostboot-fa0113e4599fcca0c2d4c938c88d445d288a952a.tar.gz talos-hostboot-fa0113e4599fcca0c2d4c938c88d445d288a952a.zip |
I2C Device Driver Skeleton
Change-Id: I0b092ea67e5bb8789378041c8c3a6a3f5cf3025e
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/242
Reviewed-by: Terry J. Opie <opiet@us.ibm.com>
Tested-by: Jenkins Server
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/usr/devicefw/driverif.H | 7 | ||||
-rw-r--r-- | src/include/usr/hbotcompid.H | 8 | ||||
-rw-r--r-- | src/include/usr/i2c/i2creasoncodes.H | 44 | ||||
-rw-r--r-- | src/include/usr/targeting/attributeenums.H | 1 | ||||
-rw-r--r-- | src/include/usr/targeting/attributestructs.H | 14 | ||||
-rw-r--r-- | src/include/usr/targeting/attributetraits.H | 8 |
6 files changed, 82 insertions, 0 deletions
diff --git a/src/include/usr/devicefw/driverif.H b/src/include/usr/devicefw/driverif.H index b4b2feee3..3f8759981 100644 --- a/src/include/usr/devicefw/driverif.H +++ b/src/include/usr/devicefw/driverif.H @@ -23,6 +23,7 @@ namespace DeviceFW { XSCOM = LAST_ACCESS_TYPE, FSISCOM, + I2C, LAST_DRIVER_ACCESS_TYPE }; @@ -54,6 +55,12 @@ namespace DeviceFW #define DEVICE_XSCOM_ADDRESS(i_address) \ DeviceFW::XSCOM, static_cast<uint64_t>((i_address)) + /** + * Construct the device addressing parameters for the I2C device ops. + */ + #define DEVICE_I2C_ADDRESS( i_address )\ + DeviceFW::I2C, static_cast<uint64_t>(( i_address )) + /** @class InvalidParameterType * @brief Unused type to cause compiler fails for invalid template types. diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H index 8567b41bc..f39479148 100644 --- a/src/include/usr/hbotcompid.H +++ b/src/include/usr/hbotcompid.H @@ -77,4 +77,12 @@ const compId_t PNOR_COMP_ID = 0x0600; const char PNOR_COMP_NAME[] = "pnor"; //@} +/** @name I2C + * I2C component + */ +//@{ +const compId_t I2C_COMP_ID = 0x0700; +const char I2C_COMP_NAME[] = "i2c"; +//@} + #endif diff --git a/src/include/usr/i2c/i2creasoncodes.H b/src/include/usr/i2c/i2creasoncodes.H new file mode 100644 index 000000000..d59ee13cc --- /dev/null +++ b/src/include/usr/i2c/i2creasoncodes.H @@ -0,0 +1,44 @@ +/** + * @file i2creasoncodes.H + * + * @brief Reason codes and module ids for the I2C device driver + * + */ +#ifndef __I2CREASONCODES_H +#define __I2CREASONCODES_H +// ----------------------------------------------- +// Includes +// ----------------------------------------------- +#include <hbotcompid.H> + +namespace I2C +{ + +/** +* @enum i2cModuleid +* +* @brief Module Ids used in created errorlogs. Indicates which +* functions an error log was created in. +* +*/ +enum i2cModuleId +{ + I2C_PERFORM_OP = 0x01, +}; + +/** + * @enum i2cReasonCode + * + * @brief Reasoncodes used to describe what errors are being indicated. + * + */ +enum i2cReasonCode +{ + I2C_INVALID_DATA_BUFFER = I2C_COMP_ID | 0x01, + I2C_INVALID_OP_TYPE = I2C_COMP_ID | 0x02, + +}; + +}; // end I2C + +#endif diff --git a/src/include/usr/targeting/attributeenums.H b/src/include/usr/targeting/attributeenums.H index 643d6d230..c4cd5c28a 100644 --- a/src/include/usr/targeting/attributeenums.H +++ b/src/include/usr/targeting/attributeenums.H @@ -46,6 +46,7 @@ enum ATTRIBUTE_ID ATTR_XSCOM_CHIP_INFO = 0x0A, ATTR_INBAND_SCOM_CHIP_INFO = 0x0B, ATTR_FSI_SCOM_CHIP_INFO = 0x0C, + ATTR_I2C_CHIP_INFO = 0x0D, ATTR_DUMMY_WO = 0xFD, ATTR_DUMMY_RO = 0xFE, diff --git a/src/include/usr/targeting/attributestructs.H b/src/include/usr/targeting/attributestructs.H index e24d5dc71..88e35add9 100644 --- a/src/include/usr/targeting/attributestructs.H +++ b/src/include/usr/targeting/attributestructs.H @@ -81,6 +81,20 @@ struct XscomChipInfo } PACKED; +/** + * @brief Structure which defines chip info necessary for I2C operations + * + * Structure which defines info necessary for I2C. Only applicable for + * chip targets which support I2C. Structure is read-only. + */ +struct I2cChipInfo +{ + uint32_t busSpeed; // Slave Device bus speed + uint16_t deviceAddr; // Slave Device address + uint8_t devicePort; // Slave Device Port location + uint8_t deviceMasterEng; // Master I2C engine slave is hung off of +} PACKED; + } // End namespace TARGETING #endif // TARG_ATTRIBUTESTRUCTS_H diff --git a/src/include/usr/targeting/attributetraits.H b/src/include/usr/targeting/attributetraits.H index b9931563a..75a4d14e5 100644 --- a/src/include/usr/targeting/attributetraits.H +++ b/src/include/usr/targeting/attributetraits.H @@ -155,6 +155,14 @@ class AttributeTraits<ATTR_XSCOM_CHIP_INFO> typedef XscomChipInfo Type; }; +template<> +class AttributeTraits<ATTR_I2C_CHIP_INFO> +{ + public: + enum { readable }; + typedef I2cChipInfo Type; +}; + } // End namespace TARGETING #endif // TARG_ATTRIBUTETRAITS_H |