skylake: Support common LPSS I2C driver

Hardware / Coreboot - Duncan Laurie [chromium.org] - 9 June 2016 11:40 UTC

Support the common Intel LPSS I2C driver for the 6 I2C bus controllers that are present on the Skylake-LP PCH with a 120 mHz clock. The required lpss_i2c_base_address() method is implemented separately for
verstage/romstage and ramstage environments.

This provides methods to convert to and from "struct device" and the I2C controller bus number for that device. These are used to provide support for the "I2C Bus Operations" that are present in the coreboot devicetree.

To support the I2C controller before ramstage an early init function is provided to do minimal initializaiton of the PCI device and assign a temporary base address for use before memory. The final base address is assigned during device enumeration and used during ramstage.

Because it is usually not necessary to enable I2C controllers before ramstage a config register for the devicetree is provided to perform early initialization of this controller. In addition the bus speed can be set in the devicetree and that speed will be applied when the device is initialized. If not provided the default speed is set to I2C_SPEED_FAST.

This was tested with the google/chell mainboard by reading and writing from the trackpad and codec devices during both verstage and ramstage.

Change-Id: Ia0270adfaf2843a3be4e00c732c85401a3401ef5

4001f24 skylake: Support common LPSS I2C driver
src/soc/intel/skylake/Kconfig | 5 ++
src/soc/intel/skylake/chip.h | 5 ++
src/soc/intel/skylake/i2c.c | 50 +++++++++++++
src/soc/intel/skylake/include/soc/iomap.h | 3 +
src/soc/intel/skylake/include/soc/pci_devs.h | 29 ++++++++
src/soc/intel/skylake/include/soc/romstage.h | 1 +
src/soc/intel/skylake/romstage/Makefile.inc | 2 +
src/soc/intel/skylake/romstage/i2c.c | 97 ++++++++++++++++++++++++++
src/soc/intel/skylake/romstage/romstage.c | 1 +
9 files changed, 193 insertions(+)

Upstream: review.coreboot.org


  • Share