From 3dde812dbae8eef6ac43cda50b744d19a325a6ca Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Fri, 17 Feb 2023 13:38:51 -0700 Subject: [PATCH] peci: Check FINISH for completed transaction Per the IT5570E datasheet, FINISH should be used to check if a transaction completed, not HOBY. > For the polling mode, software continues reading the Host Status > Register to check whether the transaction is completed or not (the > Finish bit in the Host Status Register will be set when the > transaction is completed). Ref: IT5570E V0.3.2 datasheet Signed-off-by: Tim Crawford --- src/board/system76/common/peci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/board/system76/common/peci.c b/src/board/system76/common/peci.c index f05b4c9..3a8ca06 100644 --- a/src/board/system76/common/peci.c +++ b/src/board/system76/common/peci.c @@ -295,8 +295,8 @@ bool peci_get_temp(int16_t *data) { // Start transaction HOCTLR |= 1; - // Wait for completion - while (HOSTAR & 1) {} + // Wait for command completion + while (!(HOSTAR & BIT(1))) {} uint8_t status = HOSTAR; if (status & 0xEC) { @@ -346,8 +346,8 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) { // Start transaction HOCTLR |= 1; - // Wait for completion - while (HOSTAR & 1) {} + // Wait for command completion + while (!(HOSTAR & BIT(1))) {} uint8_t status = HOSTAR; if (status & 0xEC) {