Skip to content

Commit c4a70b4

Browse files
XenuIsWatchingcfriedt
authored andcommitted
drivers: i3c: cdns: handle ibi len of 0
Section 4.3.7.3.6 of the I3C v1.2 specification states that a value of 0 for the max ibi size indicates an unlimited payload size. Set it to the max it can be configured for. Signed-off-by: Ryan McClelland <[email protected]>
1 parent b18a70e commit c4a70b4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/i3c/i3c_cdns.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,18 @@ static int cdns_i3c_controller_ibi_enable(const struct device *dev, struct i3c_d
10881088
sir_cfg = SIR_MAP_DEV_ROLE(I3C_BCR_DEVICE_ROLE(target->bcr)) |
10891089
SIR_MAP_DEV_DA(target->dynamic_addr);
10901090
if (i3c_ibi_has_payload(target)) {
1091-
sir_cfg |= SIR_MAP_DEV_PL(target->data_length.max_ibi);
1091+
/*
1092+
* the I3C spec says that a len of 0x00, means no limit, but the cdns i3c doesn't
1093+
* reconigize stops when loading a new word in the FIFO, so if multiple ibis come in
1094+
* quick succession, then they may be all in the same fifo word and may not be read
1095+
* correctly.
1096+
*/
1097+
if (target->data_length.max_ibi == 0x00) {
1098+
sir_cfg |= SIR_MAP_DEV_PL(
1099+
MIN(SIR_MAP_PL_MAX, CONFIG_I3C_IBI_MAX_PAYLOAD_SIZE));
1100+
} else {
1101+
sir_cfg |= SIR_MAP_DEV_PL(target->data_length.max_ibi);
1102+
}
10921103
} else {
10931104
/* Set to 1 for MDB */
10941105
sir_cfg |= SIR_MAP_DEV_PL(1);

0 commit comments

Comments
 (0)