i2c: npcx: Loosen requirements for target registration

Allow NPCX_I2C_ERROR_RECOVERY as a valid state when registering a
target.

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2025-05-21 09:26:57 -06:00 committed by Benjamin Cabé
parent 270c98bc23
commit 6c73b5813f

View File

@ -1237,9 +1237,13 @@ int npcx_i2c_ctrl_target_register(const struct device *i2c_dev,
int addr_idx;
/* A transiaction is ongoing */
if (data->oper_state != NPCX_I2C_IDLE) {
if (data->oper_state != NPCX_I2C_IDLE && data->oper_state != NPCX_I2C_ERROR_RECOVERY) {
LOG_ERR("Reg TGT in err state: %d", data->oper_state);
return -EBUSY;
}
if (data->oper_state == NPCX_I2C_ERROR_RECOVERY) {
LOG_WRN("Reg TGT in Recovery");
}
/* Find valid smbaddr location */
avail_addr_slot = find_lsb_set(~i2c_tgt_mask) - 1;