On Tue, Jul 24, 2018 at 03:09:01PM +0800, Ming Huang wrote:
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)
- {
'{' on previous line.
I2cControlReg.bits.spedd = I2C_100KB_SPEED;
- }
- else
'else' on previous line.
- {
'{' on previous line.
/ Leif
I2cControlReg.bits.spedd = I2C_400KB_SPEED;
spedd? That looks as a typo in the struct definition. It should probably be Speed.
Can you please provide a separate patch for that preceding this one?
/ Leif
- } I2cControlReg.bits.restart_en = 1; I2cControlReg.bits.slave_disable = 1; I2C_REG_WRITE(Base + I2C_CON_OFFSET,I2cControlReg.Val32);
-- 2.17.0