This patch series remove the devices that fail during
pre_assign_dyn_addr() and were being sent on DEFSVLS command.
With the change above, during the i3c_master_add_i3c_dev_locked() is
necessary to check if the device has i3c_boardinfo and try to assign the
i3c_dev_boardinfo->init_dyn_addr if there no oldev. This change will
allow to describe in DT device with preferable dynamic address but without
static address.
Change in v2:
- Move out detach/free the i3c_dev_desc from pre_assign_dyn_addr()
- Change i3c_master_search_i3c_boardinfo(newdev) to
i3c_master_init_i3c_dev_boardinfo(newdev)
- Add fixes, stable tags on patch 2
- Add a note for no guarantee of 'assigned-address' use
Vitor Soares (5):
i3c: master: detach and free device if pre_assign_dyn_addr() fails
i3c: master: make sure ->boardinfo is initialized in
add_i3c_dev_locked()
dt-bindings: i3c: make 'assigned-address' valid if static address == 0
dt-bindings: i3c: add a note for no guarantee of 'assigned-address' use
i3c: master: dw: reattach device on first available location of
address table
Documentation/devicetree/bindings/i3c/i3c.txt | 15 ++++++--
drivers/i3c/master.c | 49 ++++++++++++++++++++++-----
drivers/i3c/master/dw-i3c-master.c | 16 +++++++++
3 files changed, 68 insertions(+), 12 deletions(-)
--
2.7.4
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]>
---
Change in v2:
- Add Boris rb-tag
drivers/i3c/master/dw-i3c-master.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 1d83c97..62261ac 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -898,6 +898,22 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
struct dw_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev);
struct i3c_master_controller *m = i3c_dev_get_master(dev);
struct dw_i3c_master *master = to_dw_i3c_master(m);
+ int pos;
+
+ pos = dw_i3c_master_get_free_pos(master);
+
+ if (data->index > pos && pos > 0) {
+ writel(0,
+ master->regs +
+ DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
+
+ master->addrs[data->index] = 0;
+ master->free_pos |= BIT(data->index);
+
+ data->index = pos;
+ master->addrs[pos] = dev->info.dyn_addr;
+ master->free_pos &= ~BIT(pos);
+ }
writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr),
master->regs +
--
2.7.4
By default, the framework will try to assign the 'assigned-address' to the
device but if the address is already in use the device dynamic address
will be different.
Signed-off-by: Vitor Soares <[email protected]>
---
Documentation/devicetree/bindings/i3c/i3c.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/i3c/i3c.txt b/Documentation/devicetree/bindings/i3c/i3c.txt
index c851e75..e777f09 100644
--- a/Documentation/devicetree/bindings/i3c/i3c.txt
+++ b/Documentation/devicetree/bindings/i3c/i3c.txt
@@ -98,7 +98,9 @@ Required properties
Optional properties
-------------------
-- assigned-address: dynamic address to be assigned to this device.
+- assigned-address: dynamic address to be assigned to this device. The framework
+ will try to assign this dynamic address but if something
+ fails the device dynamic address will be different.
Example:
--
2.7.4
On Tue, 3 Sep 2019 12:35:53 +0200, Vitor Soares wrote:
> By default, the framework will try to assign the 'assigned-address' to the
> device but if the address is already in use the device dynamic address
> will be different.
>
> Signed-off-by: Vitor Soares <[email protected]>
> ---
> Documentation/devicetree/bindings/i3c/i3c.txt | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Rob Herring <[email protected]>