Skip to content

Commit 57b3eb6

Browse files
XenuIsWatchinghenrikbrixandersen
authored andcommitted
drivers: i3c: cdns: fix rr slot lookup when dyn is 0
When attaching a device, it should look up if the dynamic addr is already attached only, and not by the static addr. Signed-off-by: Ryan McClelland <[email protected]>
1 parent bf1e996 commit 57b3eb6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/i3c/i3c_cdns.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ static int cdns_i3c_master_get_rr_slot(const struct device *dev, uint8_t dyn_add
20012001
rr_idx = i - 1;
20022002
if (activedevs & BIT(rr_idx)) {
20032003
rr = sys_read32(config->base + DEV_ID_RR0(rr_idx));
2004-
if ((rr & DEV_ID_RR0_IS_I3C) && DEV_ID_RR0_GET_DEV_ADDR(rr) == dyn_addr) {
2004+
if ((rr & DEV_ID_RR0_IS_I3C) && (DEV_ID_RR0_GET_DEV_ADDR(rr) == dyn_addr)) {
20052005
return rr_idx;
20062006
}
20072007
}
@@ -2025,8 +2025,7 @@ static int cdns_i3c_attach_device(const struct device *dev, struct i3c_device_de
20252025
const struct cdns_i3c_config *config = dev->config;
20262026
struct cdns_i3c_data *data = dev->data;
20272027

2028-
int slot = cdns_i3c_master_get_rr_slot(dev, desc->dynamic_addr ? desc->dynamic_addr
2029-
: desc->static_addr);
2028+
int slot = cdns_i3c_master_get_rr_slot(dev, desc->dynamic_addr);
20302029

20312030
if (slot < 0) {
20322031
LOG_ERR("%s: no space for i3c device: %s", dev->name, desc->dev->name);

0 commit comments

Comments
 (0)