In 'MdeModulePkg\Bus\I2c\I2cDxe', since the following protocol is not installed:
gEfiI2cMasterProtocolGuid gEfiI2cEnumerateProtocolGuid gEfiI2cBusConfigurationManagementProtocolGuid So I refer to the example of \edk2-platforms\Silicon\Marvell\Drivers\I2c\MvI2cDxe and add the following related items Status = gBS->InstallMultipleProtocolInterfaces( &I2cMasterContext->Controller, &gEfiI2cMasterProtocolGuid, &I2cMasterContext->I2cMaster, &gEfiI2cEnumerateProtocolGuid, &I2cMasterContext->I2cEnumerate, &gEfiI2cBusConfigurationManagementProtocolGuid, &I2cMasterContext->I2cBusConf, &gEfiDevicePathProtocolGuid, (EFI_DEVICE_PATH_PROTOCOL *) DevicePath, NULL); In addition, use the following methods to obtain gI2CIO in the app, Status = gBS->LocateHandleBuffer( ByProtocol, &gEfiI2cIoProtocolGuid, NULL, &HandleCount, &I2CIOHandleBuffer ); for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { Status = gBS->HandleProtocol( I2CIOHandleBuffer[HandleIndex], &gEfiI2cIoProtocolGuid, (VOID**)&gI2CIO); } Then use the following methods to perform I2C IO operations. I2cIo->QueueRequest(I2cIo, 0, NULL, RequestPacket, NULL); But finally I saw the following message, and measured by LA, I2C IO did not send data: MvI2cDxe: wrong I2cStatus (00) after sending START condition message from MvI2cLockedStart ( IN I2C_MASTER_CONTEXT *I2cMasterContext, IN INT32 Mask, IN UINT8 Slave, IN UINTN Timeout ) { … I2cStatus = I2C_READ(I2cMasterContext, I2C_STATUS); if ((INT32)I2cStatus != Mask) { DEBUG((DEBUG_ERROR, "MvI2cDxe: wrong I2cStatus (%02x) after sending %sSTART condition\n", I2cStatus, Mask == I2C_STATUS_START ? "" : "repeated ")); return EFI_DEVICE_ERROR; } Where I2C_READ is defined as follows: STATIC UINT32 I2C_READ( IN I2C_MASTER_CONTEXT *I2cMasterContext, IN UINTN off) { return MmioRead32 (I2cMasterContext->BaseAddress + off); } My environment is as follows Platform: MinnowBoard max Code: edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg My questions are as follows: * In MinnowBoard, can MmioRead32 (I2cMasterContext->BaseAddress + off) IO operations be performed directly like MvI2cDxe? * How to set BaseAddress(host controller address) in MinnowBoard? * How to set Controller’s input clock frequency? * Are there other examples of the I2C master protocol for reference? Any advice is greatly appreciated! Thanks! -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94182): https://edk2.groups.io/g/devel/message/94182 Mute This Topic: https://groups.io/mt/93865390/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-