drivers/i2c/dw: Don't try to generate unselected speeds in ACPI table

When generating entries in SSDT for DesignWare I2C controllers, only
use the speed selected in the devicetree, instead of trying all of them.
This quiets a message which looks like a bug ("dw_i2c: bad counts"),
later on in this driver when checking rise/fall times.

BUG=b:137298661
BRANCH=none
TEST=Boot and verify that I2C controllers still function, and
the nastygram message is gone.

Change-Id: I07207ec95652e8af1a42bfe31214f61a183a134e
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34385
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Tim Wawrzynczak 2019-07-17 09:25:59 -06:00 committed by Martin Roth
parent 0bbb0fcf5f
commit ba0a3930d6
1 changed files with 7 additions and 17 deletions

View File

@ -817,14 +817,9 @@ void dw_i2c_acpi_fill_ssdt(struct device *dev)
const struct dw_i2c_bus_config *bcfg; const struct dw_i2c_bus_config *bcfg;
uintptr_t dw_i2c_addr; uintptr_t dw_i2c_addr;
struct dw_i2c_speed_config sgen; struct dw_i2c_speed_config sgen;
enum i2c_speed speeds[DW_I2C_SPEED_CONFIG_COUNT] = { int bus;
I2C_SPEED_STANDARD,
I2C_SPEED_FAST,
I2C_SPEED_FAST_PLUS,
I2C_SPEED_HIGH,
};
int i, bus;
const char *path; const char *path;
unsigned int speed;
if (!dev->enabled) if (!dev->enabled)
return; return;
@ -847,20 +842,15 @@ void dw_i2c_acpi_fill_ssdt(struct device *dev)
if (!path) if (!path)
return; return;
acpigen_write_scope(path); /* Ensure a default speed is available */
speed = (bcfg->speed == 0) ? I2C_SPEED_FAST : bcfg->speed;
/* Report timing values for the OS driver */ /* Report timing values for the OS driver */
for (i = 0; i < DW_I2C_SPEED_CONFIG_COUNT; i++) { if (dw_i2c_gen_speed_config(dw_i2c_addr, speed, bcfg, &sgen) >= 0) {
/* Generate speed config. */ acpigen_write_scope(path);
if (dw_i2c_gen_speed_config(dw_i2c_addr, speeds[i], bcfg,
&sgen) < 0)
continue;
/* Generate ACPI based on selected speed config */
dw_i2c_acpi_write_speed_config(&sgen); dw_i2c_acpi_write_speed_config(&sgen);
acpigen_pop_len();
} }
acpigen_pop_len();
} }
static int dw_i2c_dev_transfer(struct device *dev, static int dw_i2c_dev_transfer(struct device *dev,