diff --git a/drivers/peci/peci_mchp_xec.c b/drivers/peci/peci_mchp_xec.c index e6cc1aab2da..9925844e892 100644 --- a/drivers/peci/peci_mchp_xec.c +++ b/drivers/peci/peci_mchp_xec.c @@ -242,6 +242,7 @@ static int peci_xec_transfer(struct device *dev, struct peci_msg *msg) ARG_UNUSED(dev); int ret; PECI_Type *base = peci_xec_config.base; + u8_t err_val = base->ERROR; ret = peci_xec_write(dev, msg); if (ret) { @@ -264,7 +265,7 @@ static int peci_xec_transfer(struct device *dev, struct peci_msg *msg) } /* Check for error conditions and perform bus recovery if necessary */ - if (base->ERROR) { + if (err_val) { if (base->ERROR & MCHP_PECI_ERR_RDOV) { LOG_WRN("Read buffer is not empty\n"); } @@ -281,6 +282,11 @@ static int peci_xec_transfer(struct device *dev, struct peci_msg *msg) return -EIO; } + /* ERROR is a clear-on-write register, need to clear errors occurred + * at the end of a transaction. + */ + base->ERROR = err_val; + return 0; }