<p>Vagiz Tarkhanov has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22076">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">superio/ite/common: Make PECI a themal mode<br><br>Instead of setting "peci_tmpin" in the devicetree, THERMAL_PECI is now<br>a mode of TMPIN like THERMAL_RESISTOR and THERMAL_DIODE.<br>Since the logic to set temperature offsets and limits is in the function<br>that sets thermal modes, it makes sense to treat PECI as yet another<br>mode.<br><br>As of this commit, there are no boards that actually use peci_tmpin from<br>ite/common. There are three boards that have a similar device tree<br>option, but those boards use it8772f, which implements all superio<br>functions on its own.<br><br>The first user will probably be Gigabyte GA-Z77-DS3H.<br><br>Change-Id: I39da50c124ad767f8681302733cf004622975e81<br>Signed-off-by: Vagiz Trakhanov <rakkin@autistici.org><br>---<br>M src/superio/ite/common/env_ctrl.c<br>M src/superio/ite/common/env_ctrl_chip.h<br>2 files changed, 11 insertions(+), 21 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/22076/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c<br>index 696285f..4531bb5 100644<br>--- a/src/superio/ite/common/env_ctrl.c<br>+++ b/src/superio/ite/common/env_ctrl.c<br>@@ -64,13 +64,10 @@<br> }<br> <br> /*<br>- * Setup External Temperature to read via PECI into TMPINx register<br>+ * Setup PECI interface<br>  */<br>-static void enable_peci(const u16 base, const u8 tmpin)<br>+static void enable_peci(const u16 base)<br> {<br>-   if (tmpin == 0 || tmpin > ITE_EC_TMPIN_CNT)<br>-               return;<br>-<br>    /* Enable PECI interface */<br>   ite_ec_write(base, ITE_EC_INTERFACE_SELECT,<br>                      ITE_EC_INTERFACE_SEL_PECI |<br>@@ -88,14 +85,10 @@<br>   ite_ec_write(base, ITE_EC_EXTEMP_CONTROL,<br>                        ITE_EC_EXTEMP_CTRL_AUTO_4HZ |<br>                         ITE_EC_EXTEMP_CTRL_AUTO_START);<br>-<br>-        /* External Temperature reported in TMPINx register */<br>-       ite_ec_write(base, ITE_EC_ADC_TEMP_CHANNEL_ENABLE,<br>-                      (tmpin & 3) << 6);<br> }<br> <br> /*<br>- * Set up External Temperature to read via thermal diode/resistor<br>+ * Set up External Temperature to read via PECI or thermal diode/resistor<br>  * into TMPINx register<br>  */<br> static void enable_tmpin(const u16 base, const u8 tmpin,<br>@@ -106,6 +99,10 @@<br>   reg = ite_ec_read(base, ITE_EC_ADC_TEMP_CHANNEL_ENABLE);<br> <br>   switch (conf->mode) {<br>+     case THERMAL_PECI:<br>+           enable_peci(base);<br>+           reg |= ITE_EC_ADC_TEMP_EXT_REPORTS_TO(tmpin);<br>+                break;<br>        case THERMAL_DIODE:<br>           reg |= ITE_EC_ADC_TEMP_DIODE_MODE(tmpin);<br>             break;<br>@@ -240,9 +237,6 @@<br>   fan_ctl |= ITE_EC_FAN_CTL_POLARITY_HIGH;<br>      ite_ec_write(base, ITE_EC_FAN_CTL_MODE, fan_ctl);<br> <br>- /* Enable PECI if configured */<br>-      enable_peci(base, conf->peci_tmpin);<br>-<br>    /* Enable HWM if configured */<br>        for (i = 0; i < ITE_EC_TMPIN_CNT; ++i)<br>             enable_tmpin(base, i + 1, &conf->tmpin[i]);<br>@@ -259,6 +253,7 @@<br>        * busy state. Therefore, check the status and terminate<br>       * processes if needed.<br>        */<br>-  if (conf->peci_tmpin != 0)<br>-                extemp_force_idle_status(base);<br>+      for (i = 0; i < ITE_EC_TMPIN_CNT; ++i)<br>+            if (conf->tmpin[i].mode == THERMAL_PECI)<br>+                  extemp_force_idle_status(base);<br> }<br>diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h<br>index a535af6..a3c6ae4 100644<br>--- a/src/superio/ite/common/env_ctrl_chip.h<br>+++ b/src/superio/ite/common/env_ctrl_chip.h<br>@@ -26,6 +26,7 @@<br>       THERMAL_MODE_DISABLED = 0,<br>    THERMAL_DIODE,<br>        THERMAL_RESISTOR,<br>+    THERMAL_PECI,<br> };<br> <br> struct ite_ec_thermal_config {<br>@@ -76,12 +77,6 @@<br> };<br> <br> struct ite_ec_config {<br>-  /*<br>-    * Enable external temperature sensor to use PECI GetTemp()<br>-   * command and store in register TMPIN 1, 2, or 3.<br>-    */<br>-  u8 peci_tmpin;<br>-<br>     /*<br>     * Enable reading of voltage pins VINx.<br>        */<br></pre><p>To view, visit <a href="https://review.coreboot.org/22076">change 22076</a>. To unsubscribe, 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/22076"/><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: I39da50c124ad767f8681302733cf004622975e81 </div>
<div style="display:none"> Gerrit-Change-Number: 22076 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vagiz Tarkhanov <rakkin@autistici.org> </div>