diff mbox series

[edk2,edk2-platforms,v1,34/38] Silicon/Hisilicon/D06: Add I2C Bus Exception deal function

Message ID 20180724070922.63362-35-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>


During the period of I2c accessing, if the board is reset
unexpectedly, and because the I2c client can not reset,
the SDA will be always pull down, then it cause I2C bus
Exception.

Follow the Hi1620 I2C FS chapter 1.8.2 design, add I2C
Bus Exception deal function. It will Config SCL and SDA
to GPIO, and set the reversal frequency of SCL to 10KHz.

The implementation of functions is in edk2-non-osi.

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/Include/Library/PlatformSysCtrlLib.h | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.17.0

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

Comments

Leif Lindholm Aug. 4, 2018, 3:18 p.m. UTC | #1
On Tue, Jul 24, 2018 at 03:09:18PM +0800, Ming Huang wrote:
> From: shaochangliang <shaochangliang@huawei.com>

> 

> During the period of I2c accessing, if the board is reset

> unexpectedly, and because the I2c client can not reset,

> the SDA will be always pull down, then it cause I2C bus

> Exception.

> 

> Follow the Hi1620 I2C FS chapter 1.8.2 design, add I2C

> Bus Exception deal function. It will Config SCL and SDA


'handle' sounds better than 'deal' here and in the function
names. Could they be changed?

> to GPIO, and set the reversal frequency of SCL to 10KHz.

> 

> The implementation of functions is in edk2-non-osi.

> 

> 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/Include/Library/PlatformSysCtrlLib.h | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h

> index cc60e213de..483c2c2d41 100644

> --- a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h

> +++ b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h

> @@ -106,4 +106,9 @@ VOID CloseClusterClock(UINTN CpuClusterBase);

>  VOID EnableClusterClock(UINTN CpuClusterBase);

>  VOID CloseSktClock (UINT8 Skt);

>  

> +EFI_STATUS EFIAPI DealI2cBusException(UINT32 Socket);

> +EFI_STATUS

> +EFIAPI

> +I2C_DealException(UINT32 Socket, UINT32 Port);


Drop the '_'.

Also if the first prototype is
HandleI2cBusException should this not be
HandleI2cException? (Putting the action in different places for the
two functions looks confusing.)

/
    Leif

> +

>  #endif

> -- 

> 2.17.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ming Huang Aug. 10, 2018, 2:19 a.m. UTC | #2
在 8/4/2018 11:18 PM, Leif Lindholm 写道:
> On Tue, Jul 24, 2018 at 03:09:18PM +0800, Ming Huang wrote:
>> From: shaochangliang <shaochangliang@huawei.com>
>>
>> During the period of I2c accessing, if the board is reset
>> unexpectedly, and because the I2c client can not reset,
>> the SDA will be always pull down, then it cause I2C bus
>> Exception.
>>
>> Follow the Hi1620 I2C FS chapter 1.8.2 design, add I2C
>> Bus Exception deal function. It will Config SCL and SDA
> 
> 'handle' sounds better than 'deal' here and in the function
> names. Could they be changed?

OK, change them in v2.

> 
>> to GPIO, and set the reversal frequency of SCL to 10KHz.
>>
>> The implementation of functions is in edk2-non-osi.
>>
>> 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/Include/Library/PlatformSysCtrlLib.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
>> index cc60e213de..483c2c2d41 100644
>> --- a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
>> +++ b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
>> @@ -106,4 +106,9 @@ VOID CloseClusterClock(UINTN CpuClusterBase);
>>  VOID EnableClusterClock(UINTN CpuClusterBase);
>>  VOID CloseSktClock (UINT8 Skt);
>>  
>> +EFI_STATUS EFIAPI DealI2cBusException(UINT32 Socket);
>> +EFI_STATUS
>> +EFIAPI
>> +I2C_DealException(UINT32 Socket, UINT32 Port);
> 
> Drop the '_'.
> 
> Also if the first prototype is
> HandleI2cBusException should this not be
> HandleI2cException? (Putting the action in different places for the
> two functions looks confusing.)

OK, change it in v2.
Thanks.

> 
> /
>     Leif
> 
>> +
>>  #endif
>> -- 
>> 2.17.0
>>
diff mbox series

Patch

diff --git a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
index cc60e213de..483c2c2d41 100644
--- a/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
+++ b/Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
@@ -106,4 +106,9 @@  VOID CloseClusterClock(UINTN CpuClusterBase);
 VOID EnableClusterClock(UINTN CpuClusterBase);
 VOID CloseSktClock (UINT8 Skt);
 
+EFI_STATUS EFIAPI DealI2cBusException(UINT32 Socket);
+EFI_STATUS
+EFIAPI
+I2C_DealException(UINT32 Socket, UINT32 Port);
+
 #endif