diff mbox series

[edk2,edk2-platforms,v1,17/38] Silicon/Hisilicon/D06: Optimize HNS config CDR post time

Message ID 20180724070922.63362-18-ming.huang@linaro.org
State New
Headers show
Series Upload for D06 platform | expand

Commit Message

Ming Huang July 24, 2018, 7:09 a.m. UTC
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(-)

-- 
2.17.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Aug. 3, 2018, 1:30 p.m. UTC | #1
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

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ming Huang Aug. 8, 2018, 2:54 p.m. UTC | #2
在 8/3/2018 9:30 PM, Leif Lindholm 写道:
> 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.

All comments above will apply in v2.
Thanks.

> 
> /
>     Leif
> 
>> +        I2cControlReg.bits.spedd = I2C_400KB_SPEED;
> 
> spedd?
> That looks as a typo in the struct definition.
> It should probably be Speed.
> 

Yes, it should be Speed.

> Can you please provide a separate patch for that preceding this one?

OK, do it in v2.
Thanks.

> 
> /
>     Leif
> 
>> +    }
>>      I2cControlReg.bits.restart_en = 1;
>>      I2cControlReg.bits.slave_disable = 1;
>>      I2C_REG_WRITE(Base + I2C_CON_OFFSET,I2cControlReg.Val32);
>> -- 
>> 2.17.0
>>
diff mbox series

Patch

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);