Skip to content

Commit 3952cf8

Browse files
vitor-soares-snpsbbrezillon
authored andcommitted
i3c: master: dw: reattach device on first available location of address table
For today the reattach function only update the device address on the controller. Update the location to the first available too, will optimize the enumeration process avoiding additional checks to keep the available positions on address table consecutive. Signed-off-by: Vitor Soares <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Signed-off-by: Boris Brezillon <[email protected]>
1 parent 3c67166 commit 3952cf8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/i3c/master/dw-i3c-master.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,22 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
899899
struct dw_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
900900
struct i3c_master_controller *m = i3c_dev_get_master(dev);
901901
struct dw_i3c_master *master = to_dw_i3c_master(m);
902+
int pos;
903+
904+
pos = dw_i3c_master_get_free_pos(master);
905+
906+
if (data->index > pos && pos > 0) {
907+
writel(0,
908+
master->regs +
909+
DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
910+
911+
master->addrs[data->index] = 0;
912+
master->free_pos |= BIT(data->index);
913+
914+
data->index = pos;
915+
master->addrs[pos] = dev->info.dyn_addr;
916+
master->free_pos &= ~BIT(pos);
917+
}
902918

903919
writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr),
904920
master->regs +

0 commit comments

Comments
 (0)