summaryrefslogtreecommitdiff
path: root/Platform/Marvell/Documentation/Drivers/I2cDriver.txt
blob: 2f890de3dbfd4dbfeb6f0068ba22295efaa8846c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
1. Introduction
---------------
**MvI2cDxe** is a driver supporting I2C controller on Marvell SOCs boards.
It is connected through protocols to generic UEFI I2C stack, which exposes
IO functionality to drivers of specific devices on I2C bus.

2. MvI2cDxe driver design
--------------------------
MvI2cDxe produces several protocols from generic I2C stack:
 - EFI_I2C_MASTER_PROTOCOL,
 - EFI_I2C_ENUMERATE_PROTOCOL,
 - EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL
 - general-purpose EFI_DRIVER_BINDING_PROTOCOL.

  2.1 EFI_I2C_MASTER_PROTOCOL
  ---------------------------
  This is the most important protocol produced by MvI2cDxe. Following functions
  are implemented:

      ///
      /// Reset the I2C host controller.
      ///
      EFI_I2C_MASTER_PROTOCOL_RESET             Reset;

      ///
      /// Start an I2C transaction in master mode on the host controller.
      ///
      EFI_I2C_MASTER_PROTOCOL_START_REQUEST     StartRequest;

    StartRequest and Reset functions are used by I2cHost.
    These should **not** be used by I2C device drivers - required
    synchronization is not provided. Instead, members of EFI_I2C_IO_PROTOCOL
    should be used.

  2.2 EFI_I2C_BUS_CONFIGURATION_MANAGEMENT_PROTOCOL
  -------------------------------------------------
  The only function exposed via this protocol is MvI2cEnableConf. It is
  required by I2C stack in order to allow changing I2C bus configuration from
  device drivers.

  2.3 EFI_I2C_ENUMERATE_PROTOCOL
  ------------------------------
  Provides Enumerate function, which is used by I2cBus code as an iterator over
  devices on I2C bus.

    typedef
    EFI_STATUS
    (EFIAPI *EFI_I2C_ENUMERATE_PROTOCOL_ENUMERATE) (
      IN CONST EFI_I2C_ENUMERATE_PROTOCOL *This,
      IN OUT CONST EFI_I2C_DEVICE         **Device
    );

    ///
    /// Traverse the set of I2C devices on an I2C bus.  This routine
    /// returns the next I2C device on an I2C bus.
    ///
    EFI_I2C_ENUMERATE_PROTOCOL_ENUMERATE         Enumerate;

  MvI2cDevice creates EFI_I2C_DEVICE structure for every device on the bus.
  Due to the fact that hardware-based I2C enumeration isn't safe, information
  about attached devices should be provided through PCDs. After EFI_I2C_DEVICE
  structure is created and filled properly, it is returned to I2cBus. It is
  followed by attachment of I2C device driver.