drivers: i3c: mcux: send 7h7e on first transfer or after stop

Makes the i3c_mcux driver consistent with the i3c_cdns driver.

Signed-off-by: Mike J. Chen <mjchen@google.com>
This commit is contained in:
Mike J. Chen 2023-10-16 17:09:52 -07:00 committed by Carles Cufí
parent 16f4861741
commit 7c1884ae9b

View file

@ -1071,6 +1071,7 @@ static int mcux_i3c_transfer(const struct device *dev,
I3C_Type *base = config->base; I3C_Type *base = config->base;
uint32_t intmask; uint32_t intmask;
int ret; int ret;
bool send_broadcast = true;
if (target->dynamic_addr == 0U) { if (target->dynamic_addr == 0U) {
ret = -EINVAL; ret = -EINVAL;
@ -1121,12 +1122,32 @@ static int mcux_i3c_transfer(const struct device *dev,
} }
} }
/*
* Send broadcast header on first transfer or after a STOP,
* unless flag is set not to.
*/
if (!(msgs[i].flags & I3C_MSG_NBCH) && (send_broadcast)) {
ret = mcux_i3c_request_emit_start(base, I3C_BROADCAST_ADDR,
false, false, 0);
if (ret < 0) {
LOG_ERR("emit start of broadcast addr failed, error (%d)",
ret);
goto out_xfer_i3c_stop_unlock;
}
send_broadcast = false;
}
ret = mcux_i3c_do_one_xfer(base, dev_data, target->dynamic_addr, false, ret = mcux_i3c_do_one_xfer(base, dev_data, target->dynamic_addr, false,
msgs[i].buf, msgs[i].len, msgs[i].buf, msgs[i].len,
is_read, emit_start, emit_stop, no_ending); is_read, emit_start, emit_stop, no_ending);
if (ret < 0) { if (ret < 0) {
goto out_xfer_i3c_stop_unlock; goto out_xfer_i3c_stop_unlock;
} }
if (emit_stop) {
/* After a STOP, send broadcast header before next msg */
send_broadcast = true;
}
} }
ret = 0; ret = 0;