From: shaochangliang shaochangliang@huawei.com
Use I2C 400KB speed for config CDR
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shaochangliang shaochangliang@huawei.com Signed-off-by: Ming Huang ming.huang@linaro.org Signed-off-by: Heyi Guo heyi.guo@linaro.org --- Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c index fa8c510f36..8d87336375 100644 --- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c +++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c @@ -28,6 +28,9 @@ #include "I2CLibInternal.h" #include "I2CHw.h"
+#define I2C_100KB_SPEED 0x1 +#define I2C_400KB_SPEED 0x2 + VOID I2C_Delay(UINT32 ulCount) { MicroSecondDelay(ulCount); @@ -149,7 +152,14 @@ I2CInit(UINT32 Socket, UINT32 Port, SPEED_MODE SpeedMode)
I2C_REG_READ(Base + I2C_CON_OFFSET, I2cControlReg.Val32); I2cControlReg.bits.master = 1; - I2cControlReg.bits.spedd = 0x1; + if(Normal == SpeedMode) + { + I2cControlReg.bits.spedd = I2C_100KB_SPEED; + } + else + { + I2cControlReg.bits.spedd = I2C_400KB_SPEED; + } I2cControlReg.bits.restart_en = 1; I2cControlReg.bits.slave_disable = 1; I2C_REG_WRITE(Base + I2C_CON_OFFSET,I2cControlReg.Val32);