Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/51122 )
Change subject: gfx dp_aux: Add I2C_{Read,Write}_Byte procedures ......................................................................
gfx dp_aux: Add I2C_{Read,Write}_Byte procedures
These will be used to switch LSPCON modes in subsequent commits.
Change-Id: Ib66b073691282d0c89710b0591484d4123e039b7 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M common/hw-gfx-dp_aux_ch.adb M common/hw-gfx-dp_aux_ch.ads 2 files changed, 50 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/22/51122/1
diff --git a/common/hw-gfx-dp_aux_ch.adb b/common/hw-gfx-dp_aux_ch.adb index b8eb510..7406d5e 100644 --- a/common/hw-gfx-dp_aux_ch.adb +++ b/common/hw-gfx-dp_aux_ch.adb @@ -371,6 +371,42 @@
----------------------------------------------------------------------------
+ procedure I2C_Write_Byte + (Port : in T; + Address : in I2C.Transfer_Address; + Offset : in Word8; + Value : in Word8; + Success : out Boolean) + is + Index_Payload : constant DP_Defs.Aux_Payload := (Offset, Value, others => 16#00#); + + Length : constant I2C.Transfer_Length := 1; + Data : constant I2C.Transfer_Data := (Value, others => 16#00#); + begin + Do_I2C_Write (Port, Address, 1 + Length, Index_Payload, Success); + end I2C_Write_Byte; + + procedure I2C_Read_Byte + (Port : in T; + Address : in I2C.Transfer_Address; + Offset : in Word8; + Value : out Word8; + Success : out Boolean) + is + Index_Payload : constant DP_Defs.Aux_Payload := (Offset, others => 16#00#); + + Length : I2C.Transfer_Length := 1; + Data : I2C.Transfer_Data := (others => 16#00#); + begin + Do_I2C_Write (Port, Address, 1, Index_Payload, Success); + + if Success then + Do_I2C_Read (Port, Address, Length, Data, Success); + Success := Success and Length = 1; + end if; + Value := Data (0); + end I2C_Read_Byte; + procedure I2C_Read (Port : in T; Address : in I2C.Transfer_Address; diff --git a/common/hw-gfx-dp_aux_ch.ads b/common/hw-gfx-dp_aux_ch.ads index 85fddd0..78709a8 100644 --- a/common/hw-gfx-dp_aux_ch.ads +++ b/common/hw-gfx-dp_aux_ch.ads @@ -45,6 +45,20 @@
----------------------------------------------------------------------------
+ procedure I2C_Write_Byte + (Port : in T; + Address : in I2C.Transfer_Address; + Offset : in Word8; + Value : in Word8; + Success : out Boolean); + + procedure I2C_Read_Byte + (Port : in T; + Address : in I2C.Transfer_Address; + Offset : in Word8; + Value : out Word8; + Success : out Boolean); + procedure I2C_Read (Port : in T; Address : in I2C.Transfer_Address;