From 4668ba77eaf0418eac37fe67ba06a450d3eafe88 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Wed, 9 Nov 2016 17:09:40 -0600 Subject: soc/intel/common/lpss_i2c: simplify API and use common config structure The apollolake and skylake had duplicate stanzas of code for initializing the i2c buses. Additionally, they also had very similar structures for providing settings for the i2c speed control. Introduce a new struct lpss_i2c_bus_config and utilize it in both apollolake and skylake thereby removing the need for SoC-specific structres. The new structure is used for initializing a bus fully as the lpss i2c API is simplified in that lpss_i2c_init() is only required to be called. The struct lpss_i2c_bus_config structure is passed in for both initializing and filling in the SSDT information. The formerly exposed functions are made static to reduce the external API exposure. BUG=chrome-os-partner:58889 Change-Id: Ib4fa8a7a4de052da75c778a7658741a5a8e0e6b9 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/17348 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie --- src/soc/intel/skylake/bootblock/i2c.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/soc/intel/skylake/bootblock') diff --git a/src/soc/intel/skylake/bootblock/i2c.c b/src/soc/intel/skylake/bootblock/i2c.c index 64b1fb57e7..92ca861dcb 100644 --- a/src/soc/intel/skylake/bootblock/i2c.c +++ b/src/soc/intel/skylake/bootblock/i2c.c @@ -46,8 +46,6 @@ static void i2c_early_init_bus(unsigned bus) { ROMSTAGE_CONST struct soc_intel_skylake_config *config; ROMSTAGE_CONST struct device *tree_dev; - const struct lpss_i2c_speed_config *sptr; - enum i2c_speed speed; pci_devfn_t dev; int devfn; uintptr_t base; @@ -86,17 +84,7 @@ static void i2c_early_init_bus(unsigned bus) write32(reg, value); /* Initialize the controller */ - speed = config->i2c[bus].speed ? : I2C_SPEED_FAST; - lpss_i2c_init(bus, speed); - - /* Apply custom speed config if it has been set by the board */ - for (value = 0; value < LPSS_I2C_SPEED_CONFIG_COUNT; value++) { - sptr = &config->i2c[bus].speed_config[value]; - if (sptr->speed == speed) { - lpss_i2c_set_speed_config(bus, sptr); - break; - } - } + lpss_i2c_init(bus, &config->i2c[bus]); } void i2c_early_init(void) -- cgit v1.2.3