Martin Roth has uploaded this change for review. ( https://review.coreboot.org/28904
Change subject: soc/amd/stoneyridge: Allow mainboard to update I2C at runtime ......................................................................
soc/amd/stoneyridge: Allow mainboard to update I2C at runtime
The I2C values are typically set in devicetree.cb, but there's an issue where the values need to change between board versions. This allows the mainboard to update the settings at runtime.
BUG=B:110984023 TEST= See that I2C is set correctly on each version.
Change-Id: Id00c352a04b3d7845027882bcfcee09518787067 Signed-off-by: Martin Roth martinroth@chromium.org --- M src/soc/amd/stoneyridge/i2c.c M src/soc/amd/stoneyridge/include/soc/southbridge.h 2 files changed, 17 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/28904/1
diff --git a/src/soc/amd/stoneyridge/i2c.c b/src/soc/amd/stoneyridge/i2c.c index b90e5d7..beac139 100644 --- a/src/soc/amd/stoneyridge/i2c.c +++ b/src/soc/amd/stoneyridge/i2c.c @@ -56,18 +56,24 @@ return dev->chip_info; }
+void __weak mb_update_i2c(unsigned int bus, const struct dw_i2c_bus_config **i2c_vals) {} + const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus) { const struct soc_amd_stoneyridge_config *config; - + const struct dw_i2c_bus_config *i2c_vals; if (bus >= ARRAY_SIZE(i2c_bus_address)) return NULL;
config = get_soc_config(); if (config == NULL) return NULL; + i2c_vals = &config->i2c[bus];
- return &config->i2c[bus]; + /* Allow mainboard to update the i2c bus settings */ + mb_update_i2c(bus, &i2c_vals); + + return i2c_vals; }
const char *i2c_acpi_name(const struct device *dev) diff --git a/src/soc/amd/stoneyridge/include/soc/southbridge.h b/src/soc/amd/stoneyridge/include/soc/southbridge.h index a3c4c7c..40e988e 100644 --- a/src/soc/amd/stoneyridge/include/soc/southbridge.h +++ b/src/soc/amd/stoneyridge/include/soc/southbridge.h @@ -556,4 +556,13 @@ /* Initialize all the i2c buses that are not marked with early init. */ void i2c_soc_init(void);
+/** + * @brief Allow the mainboard to update i2c values + * + * @param i2c_vals = pointer to the i2c value structure + * + * @return none + */ +void mb_update_i2c(unsigned int bus, const struct dw_i2c_bus_config **i2c_vals); + #endif /* __STONEYRIDGE_H__ */