[coreboot-gerrit] Change in coreboot[master]: superio/ite/common: Make PECI a themal mode

Vagiz Tarkhanov (Code Review) gerrit at coreboot.org
Tue Oct 17 20:40:21 CEST 2017


Vagiz Tarkhanov has uploaded this change for review. ( https://review.coreboot.org/22076


Change subject: superio/ite/common: Make PECI a themal mode
......................................................................

superio/ite/common: Make PECI a themal mode

Instead of setting "peci_tmpin" in the devicetree, THERMAL_PECI is now
a mode of TMPIN like THERMAL_RESISTOR and THERMAL_DIODE.
Since the logic to set temperature offsets and limits is in the function
that sets thermal modes, it makes sense to treat PECI as yet another
mode.

As of this commit, there are no boards that actually use peci_tmpin from
ite/common. There are three boards that have a similar device tree
option, but those boards use it8772f, which implements all superio
functions on its own.

The first user will probably be Gigabyte GA-Z77-DS3H.

Change-Id: I39da50c124ad767f8681302733cf004622975e81
Signed-off-by: Vagiz Trakhanov <rakkin at autistici.org>
---
M src/superio/ite/common/env_ctrl.c
M src/superio/ite/common/env_ctrl_chip.h
2 files changed, 11 insertions(+), 21 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/22076/1

diff --git a/src/superio/ite/common/env_ctrl.c b/src/superio/ite/common/env_ctrl.c
index 696285f..4531bb5 100644
--- a/src/superio/ite/common/env_ctrl.c
+++ b/src/superio/ite/common/env_ctrl.c
@@ -64,13 +64,10 @@
 }
 
 /*
- * Setup External Temperature to read via PECI into TMPINx register
+ * Setup PECI interface
  */
-static void enable_peci(const u16 base, const u8 tmpin)
+static void enable_peci(const u16 base)
 {
-	if (tmpin == 0 || tmpin > ITE_EC_TMPIN_CNT)
-		return;
-
 	/* Enable PECI interface */
 	ite_ec_write(base, ITE_EC_INTERFACE_SELECT,
 			   ITE_EC_INTERFACE_SEL_PECI |
@@ -88,14 +85,10 @@
 	ite_ec_write(base, ITE_EC_EXTEMP_CONTROL,
 			   ITE_EC_EXTEMP_CTRL_AUTO_4HZ |
 			   ITE_EC_EXTEMP_CTRL_AUTO_START);
-
-	/* External Temperature reported in TMPINx register */
-	ite_ec_write(base, ITE_EC_ADC_TEMP_CHANNEL_ENABLE,
-			   (tmpin & 3) << 6);
 }
 
 /*
- * Set up External Temperature to read via thermal diode/resistor
+ * Set up External Temperature to read via PECI or thermal diode/resistor
  * into TMPINx register
  */
 static void enable_tmpin(const u16 base, const u8 tmpin,
@@ -106,6 +99,10 @@
 	reg = ite_ec_read(base, ITE_EC_ADC_TEMP_CHANNEL_ENABLE);
 
 	switch (conf->mode) {
+	case THERMAL_PECI:
+		enable_peci(base);
+		reg |= ITE_EC_ADC_TEMP_EXT_REPORTS_TO(tmpin);
+		break;
 	case THERMAL_DIODE:
 		reg |= ITE_EC_ADC_TEMP_DIODE_MODE(tmpin);
 		break;
@@ -240,9 +237,6 @@
 	fan_ctl |= ITE_EC_FAN_CTL_POLARITY_HIGH;
 	ite_ec_write(base, ITE_EC_FAN_CTL_MODE, fan_ctl);
 
-	/* Enable PECI if configured */
-	enable_peci(base, conf->peci_tmpin);
-
 	/* Enable HWM if configured */
 	for (i = 0; i < ITE_EC_TMPIN_CNT; ++i)
 		enable_tmpin(base, i + 1, &conf->tmpin[i]);
@@ -259,6 +253,7 @@
 	 * busy state. Therefore, check the status and terminate
 	 * processes if needed.
 	 */
-	if (conf->peci_tmpin != 0)
-		extemp_force_idle_status(base);
+	for (i = 0; i < ITE_EC_TMPIN_CNT; ++i)
+		if (conf->tmpin[i].mode == THERMAL_PECI)
+			extemp_force_idle_status(base);
 }
diff --git a/src/superio/ite/common/env_ctrl_chip.h b/src/superio/ite/common/env_ctrl_chip.h
index a535af6..a3c6ae4 100644
--- a/src/superio/ite/common/env_ctrl_chip.h
+++ b/src/superio/ite/common/env_ctrl_chip.h
@@ -26,6 +26,7 @@
 	THERMAL_MODE_DISABLED = 0,
 	THERMAL_DIODE,
 	THERMAL_RESISTOR,
+	THERMAL_PECI,
 };
 
 struct ite_ec_thermal_config {
@@ -76,12 +77,6 @@
 };
 
 struct ite_ec_config {
-	/*
-	 * Enable external temperature sensor to use PECI GetTemp()
-	 * command and store in register TMPIN 1, 2, or 3.
-	 */
-	u8 peci_tmpin;
-
 	/*
 	 * Enable reading of voltage pins VINx.
 	 */

-- 
To view, visit https://review.coreboot.org/22076
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I39da50c124ad767f8681302733cf004622975e81
Gerrit-Change-Number: 22076
Gerrit-PatchSet: 1
Gerrit-Owner: Vagiz Tarkhanov <rakkin at autistici.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171017/c79183b6/attachment.html>


More information about the coreboot-gerrit mailing list