peci: Clear status after command completion

Per the flow charts for PECI programming guide, clear the status
register after the command has completed.

Ref: IT5570E V0.3.2 datasheet
Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-02-17 13:50:43 -07:00
committed by Jeremy Soller
parent 3dde812dba
commit 4567f99015

View File

@@ -301,12 +301,17 @@ bool peci_get_temp(int16_t *data) {
uint8_t status = HOSTAR;
if (status & 0xEC) {
ERROR("peci_get_temp: hardware error: 0x%02X\n", status);
// Clear status
HOSTAR = HOSTAR;
return false;
} else {
// Read two byte temperature data if finished successfully
uint8_t low = HORDDR;
uint8_t high = HORDDR;
*data = (((int16_t)high << 8) | (int16_t)low);
// Clear status
HOSTAR = HOSTAR;
return true;
}
}
@@ -352,11 +357,16 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
uint8_t status = HOSTAR;
if (status & 0xEC) {
ERROR("peci_wr_pkg_config: hardware error: 0x%02X\n", status);
// Clear status
HOSTAR = HOSTAR;
return -(0x1000 | status);
}
uint8_t cc = HORDDR;
// Clear status
HOSTAR = HOSTAR;
if (cc == 0x40) {
TRACE("peci_wr_pkg_config: command successful\n");
return cc;