coreboot/src/drivers/i2c
Duncan Laurie 08d309c6e0 UPSTREAM: i2c: Add a generic i2c driver
This adds a generic I2C driver that can be described in the devicetree
and used to generate ACPI objects in the SSDT based on the information
provided in the config registers.

The I2C bus can be configured and the device can provide an interrupt and
wake capability to the OS.  A configuration option allows for a GPIO to
be provided that will be checked to determine if the device is preset on
the board before including it in the generated SSDT.

The driver is generic enough to be used for basic I2C devices that do
not have special configuration needs such as touchpads, touchscreens,
sensors, some audio codec/amplifiers, etc.

Sample usage for a touchpad device:

device pci 15.1 on
  chip drivers/i2c/generic
    register "hid" = ""ELAN0000""
    register "desc" = "ELAN Touchpad"
    register "irq" = "IRQ_EDGE_LOW(GPP_B3_IRQ)"
    register "wake" = "GPE0_DW0_05"
    device i2c 15.0 on end
  end
end

Will result in the following code in the SSDT:

Scope (\_SB.PCI0.I2C1) {
  Device (D015) {
    Name (_HID, "ELAN0000")
    Name (_UID, 0)
    Name (_S0W, 4)
    Name (_PRW, Package () { 5, 3 })
    Method (_STA) { Return (0x0f) }
    Name (_CRS, ResourceTemplate () {
      I2cSerialBus (0x15, ControllerInitiated, 400000, AddressingMode7Bit,
                    "\\_S.PCI0.I2C1", 0, ResourceConsumer)
      Interrupt (ResourceConsumer, Edge, ActiveLow) { 51 }
    })
  }
}

Change-Id: Ib32055720835b70e91ede5e4028ecd91894d70d5
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/15016
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/349064
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
2016-06-02 14:06:33 -07:00
..
adm1026 drivers: Use DEVICE_NOOP macro over dummy symbol 2014-11-01 21:14:07 +01:00
adm1027 drivers: Use DEVICE_NOOP macro over dummy symbol 2014-11-01 21:14:07 +01:00
adt7463 tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
at24rf08c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
generic UPSTREAM: i2c: Add a generic i2c driver 2016-06-02 14:06:33 -07:00
i2cmux devicetree: Discriminate device ops scan_bus() 2015-06-04 11:19:01 +02:00
i2cmux2 devicetree: Discriminate device ops scan_bus() 2015-06-04 11:19:01 +02:00
lm63 drivers: Use DEVICE_NOOP macro over dummy symbol 2014-11-01 21:14:07 +01:00
nau8825 UPSTREAM: nau8825: Add driver for I2C codec 2016-06-02 14:06:27 -07:00
rtd2132 tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
tpm tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
w83793 tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
w83795 tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
ww_ring vboot: split class in library and stage 2015-04-30 15:39:53 +02:00