11. Introduction 2--------------- 3**MvI2cDxe** is a driver supporting I2C controller on Marvell SOCs boards. 4It is connected through protocols to generic UEFI I2C stack, which exposes 5IO functionality to drivers of specific devices on I2C bus. 6 72. MvI2cDxe driver design 8-------------------------- 9MvI2cDxe produces several protocols from generic I2C stack: 10 - EFI_I2C_MASTER_PROTOCOL, 11 - EFI_I2C_ENUMERATE_PROTOCOL, 12 - EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL 13 - general-purpose EFI_DRIVER_BINDING_PROTOCOL. 14 15 2.1 EFI_I2C_MASTER_PROTOCOL 16 --------------------------- 17 This is the most important protocol produced by MvI2cDxe. Following functions 18 are implemented: 19 20 /// 21 /// Reset the I2C host controller. 22 /// 23 EFI_I2C_MASTER_PROTOCOL_RESET Reset; 24 25 /// 26 /// Start an I2C transaction in master mode on the host controller. 27 /// 28 EFI_I2C_MASTER_PROTOCOL_START_REQUEST StartRequest; 29 30 StartRequest and Reset functions are used by I2cHost. 31 These should **not** be used by I2C device drivers - required 32 synchronization is not provided. Instead, members of EFI_I2C_IO_PROTOCOL 33 should be used. 34 35 2.2 EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL 36 ------------------------------------------------- 37 The only function exposed via this protocol is MvI2cEnableConf. It is 38 required by I2C stack in order to allow changing I2C bus configuration from 39 device drivers. 40 41 2.3 EFI_I2C_ENUMERATE_PROTOCOL 42 ------------------------------ 43 Provides Enumerate function, which is used by I2cBus code as an iterator over 44 devices on I2C bus. 45 46 typedef 47 EFI_STATUS 48 (EFIAPI *EFI_I2C_ENUMERATE_PROTOCOL_ENUMERATE) ( 49 IN CONST EFI_I2C_ENUMERATE_PROTOCOL *This, 50 IN OUT CONST EFI_I2C_DEVICE **Device 51 ); 52 53 /// 54 /// Traverse the set of I2C devices on an I2C bus. This routine 55 /// returns the next I2C device on an I2C bus. 56 /// 57 EFI_I2C_ENUMERATE_PROTOCOL_ENUMERATE Enumerate; 58 59 MvI2cDevice creates EFI_I2C_DEVICE structure for every device on the bus. 60 Due to the fact that hardware-based I2C enumeration isn't safe, information 61 about attached devices should be provided through PCDs. After EFI_I2C_DEVICE 62 structure is created and filled properly, it is returned to I2cBus. It is 63 followed by attachment of I2C device driver. 64 65