Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/55088 )
Change subject: drivers/i2c/designware: Report I2C timings for additional bus speeds ......................................................................
drivers/i2c/designware: Report I2C timings for additional bus speeds
Since the OS provides its own driver for the I2C controller it can chose to use a bus speed other than the one used at coreboot runtime. In this case it would be good to provide a way how the needed bus timings are communicated to the OS, since these are very board-specific and there is no way that the OS can know them other than read the appropriate ACPI reported timings. This patch adds some code to report additional bus speed timings if there are some defined in the devicetree.
Change-Id: If921e0613864660dc1bb8d7c1b30fb9db8ac655d Signed-off-by: Werner Zeh werner.zeh@siemens.com --- M src/drivers/i2c/designware/dw_i2c.c 1 file changed, 9 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/55088/1
diff --git a/src/drivers/i2c/designware/dw_i2c.c b/src/drivers/i2c/designware/dw_i2c.c index 2e2d20d..4d97a38 100644 --- a/src/drivers/i2c/designware/dw_i2c.c +++ b/src/drivers/i2c/designware/dw_i2c.c @@ -803,7 +803,7 @@ struct dw_i2c_speed_config sgen; int bus; const char *path; - unsigned int speed; + unsigned int speed, i;
bus = dw_i2c_soc_dev_to_bus(dev);
@@ -826,12 +826,17 @@ /* Ensure a default speed is available */ speed = (bcfg->speed == 0) ? I2C_SPEED_FAST : bcfg->speed;
- /* Report timing values for the OS driver */ + /* Report currently used timing values for the OS driver */ + acpigen_write_scope(path); if (dw_i2c_gen_speed_config(dw_i2c_addr, speed, bcfg, &sgen) >= 0) { - acpigen_write_scope(path); dw_i2c_acpi_write_speed_config(&sgen); - acpigen_pop_len(); } + /* Now check if there are more speed settings available and report them as well. */ + for (i = 0; i < DW_I2C_SPEED_CONFIG_COUNT; i++) { + if (bcfg->speed_config[i].speed && speed != bcfg->speed_config[i].speed ) + dw_i2c_acpi_write_speed_config(&bcfg->speed_config[i]); + } + acpigen_pop_len(); }
static int dw_i2c_dev_transfer(struct device *dev,