<p>Martin Roth has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/28904">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/amd/stoneyridge: Allow mainboard to update I2C at runtime<br><br>The I2C values are typically set in devicetree.cb, but there's an issue<br>where the values need to change between board versions.  This allows<br>the mainboard to update the settings at runtime.<br><br>BUG=B:110984023<br>TEST= See that I2C is set correctly on each version.<br><br>Change-Id: Id00c352a04b3d7845027882bcfcee09518787067<br>Signed-off-by: Martin Roth <martinroth@chromium.org><br>---<br>M src/soc/amd/stoneyridge/i2c.c<br>M src/soc/amd/stoneyridge/include/soc/southbridge.h<br>2 files changed, 17 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/28904/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/amd/stoneyridge/i2c.c b/src/soc/amd/stoneyridge/i2c.c</span><br><span>index b90e5d7..beac139 100644</span><br><span>--- a/src/soc/amd/stoneyridge/i2c.c</span><br><span>+++ b/src/soc/amd/stoneyridge/i2c.c</span><br><span>@@ -56,18 +56,24 @@</span><br><span>   return dev->chip_info;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void __weak mb_update_i2c(unsigned int bus, const struct dw_i2c_bus_config **i2c_vals) {}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> const struct dw_i2c_bus_config *dw_i2c_get_soc_cfg(unsigned int bus)</span><br><span> {</span><br><span>         const struct soc_amd_stoneyridge_config *config;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+      const struct dw_i2c_bus_config *i2c_vals;</span><br><span>    if (bus >= ARRAY_SIZE(i2c_bus_address))</span><br><span>           return NULL;</span><br><span> </span><br><span>     config = get_soc_config();</span><br><span>   if (config == NULL)</span><br><span>          return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  i2c_vals = &config->i2c[bus];</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-        return &config->i2c[bus];</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Allow mainboard to update the i2c bus settings */</span><br><span style="color: hsl(120, 100%, 40%);">+  mb_update_i2c(bus, &i2c_vals);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  return i2c_vals;</span><br><span> }</span><br><span> </span><br><span> const char *i2c_acpi_name(const struct device *dev)</span><br><span>diff --git a/src/soc/amd/stoneyridge/include/soc/southbridge.h b/src/soc/amd/stoneyridge/include/soc/southbridge.h</span><br><span>index a3c4c7c..40e988e 100644</span><br><span>--- a/src/soc/amd/stoneyridge/include/soc/southbridge.h</span><br><span>+++ b/src/soc/amd/stoneyridge/include/soc/southbridge.h</span><br><span>@@ -556,4 +556,13 @@</span><br><span> /* Initialize all the i2c buses that are not marked with early init. */</span><br><span> void i2c_soc_init(void);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/**</span><br><span style="color: hsl(120, 100%, 40%);">+ * @brief Allow the mainboard to update i2c values</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * @param i2c_vals = pointer to the i2c value structure</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * @return none</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void mb_update_i2c(unsigned int bus, const struct dw_i2c_bus_config **i2c_vals);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #endif /* __STONEYRIDGE_H__ */</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/28904">change 28904</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/28904"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id00c352a04b3d7845027882bcfcee09518787067 </div>
<div style="display:none"> Gerrit-Change-Number: 28904 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Martin Roth <martinroth@google.com> </div>