diff mbox series

i3c: master: dw-i3c-master: fix i3c_attach/reatach

Message ID 2e33e1f72db978f77ced019ae085c972050ca4e9.1547040890.git.vitor.soares@synopsys.com (mailing list archive)
State Superseded
Headers show
Series i3c: master: dw-i3c-master: fix i3c_attach/reatach | expand

Commit Message

Vitor Soares Jan. 9, 2019, 2:58 p.m. UTC
This patch fix i3c attach/reatach functions.

During the i3c_attach the driver doesn't threat the static address used for
SETDASA CCC command.

During the i3c_reatach the driver doesn't update master->addrs[data->index] with
new address if old_dyn_addr = 0.

Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
---
 drivers/i3c/master/dw-i3c-master.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Boris Brezillon Jan. 9, 2019, 5:48 p.m. UTC | #1
On Wed,  9 Jan 2019 15:58:05 +0100
Vitor Soares <vitor.soares@synopsys.com> wrote:

> This patch fix i3c attach/reatach functions.
> 
> During the i3c_attach the driver doesn't threat the static address used for

					   ^treat?

> SETDASA CCC command.

Or maybe

"
During the i3c_attach the driver *ignores* the static address used for ...
"

> 
> During the i3c_reatach the driver doesn't update master->addrs[data->index] with

		 ^reattach

> new address if old_dyn_addr = 0.
> 

Missing Fixes tag here:

Fixes: 1dd728f5d4d4 ("i3c: master: Add driver for Synopsys DesignWare IP")

> Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
> ---
>  drivers/i3c/master/dw-i3c-master.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index b532e2c..b84acbc 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -901,9 +901,6 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
>  	       master->regs +
>  	       DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
>  
> -	if (!old_dyn_addr)
> -		return 0;
> -
>  	master->addrs[data->index] = dev->info.dyn_addr;
>  
>  	return 0;
> @@ -925,11 +922,11 @@ static int dw_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev)
>  		return -ENOMEM;
>  
>  	data->index = pos;
> -	master->addrs[pos] = dev->info.dyn_addr;
> +	master->addrs[pos] = dev->info.dyn_addr ?: dev->info.static_addr;

						^ add a space between '?' and ':'

>  	master->free_pos &= ~BIT(pos);
>  	i3c_dev_set_master_data(dev, data);
>  
> -	writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr),
> +	writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(master->addrs[pos]),
>  	       master->regs +
>  	       DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
>
Vitor Soares Jan. 10, 2019, 3:16 p.m. UTC | #2
Hi Boris,

On 09/01/19 17:48, Boris Brezillon wrote:
> On Wed,  9 Jan 2019 15:58:05 +0100
> Vitor Soares <vitor.soares@synopsys.com> wrote:
>
>> This patch fix i3c attach/reatach functions.
>>
>> During the i3c_attach the driver doesn't threat the static address used for
> 					   ^treat?
>
>> SETDASA CCC command.
> Or maybe
>
> "
> During the i3c_attach the driver *ignores* the static address used for ...
> "
>
>> During the i3c_reatach the driver doesn't update master->addrs[data->index] with
> 		 ^reattach
>
>> new address if old_dyn_addr = 0.
>>
> Missing Fixes tag here:
>
> Fixes: 1dd728f5d4d4 ("i3c: master: Add driver for Synopsys DesignWare IP")
>
>> Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
>> ---
>>  drivers/i3c/master/dw-i3c-master.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
>> index b532e2c..b84acbc 100644
>> --- a/drivers/i3c/master/dw-i3c-master.c
>> +++ b/drivers/i3c/master/dw-i3c-master.c
>> @@ -901,9 +901,6 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
>>  	       master->regs +
>>  	       DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
>>  
>> -	if (!old_dyn_addr)
>> -		return 0;
>> -
>>  	master->addrs[data->index] = dev->info.dyn_addr;
>>  
>>  	return 0;
>> @@ -925,11 +922,11 @@ static int dw_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev)
>>  		return -ENOMEM;
>>  
>>  	data->index = pos;
>> -	master->addrs[pos] = dev->info.dyn_addr;
>> +	master->addrs[pos] = dev->info.dyn_addr ?: dev->info.static_addr;
> 						^ add a space between '?' and ':'
>
>>  	master->free_pos &= ~BIT(pos);
>>  	i3c_dev_set_master_data(dev, data);
>>  
>> -	writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr),
>> +	writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(master->addrs[pos]),
>>  	       master->regs +
>>  	       DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
>>  

Thanks for your feedback. I will fix it and resend.

Best regards,
Vitor Soares
diff mbox series

Patch

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index b532e2c..b84acbc 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -901,9 +901,6 @@  static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev,
 	       master->regs +
 	       DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));
 
-	if (!old_dyn_addr)
-		return 0;
-
 	master->addrs[data->index] = dev->info.dyn_addr;
 
 	return 0;
@@ -925,11 +922,11 @@  static int dw_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev)
 		return -ENOMEM;
 
 	data->index = pos;
-	master->addrs[pos] = dev->info.dyn_addr;
+	master->addrs[pos] = dev->info.dyn_addr ?: dev->info.static_addr;
 	master->free_pos &= ~BIT(pos);
 	i3c_dev_set_master_data(dev, data);
 
-	writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr),
+	writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(master->addrs[pos]),
 	       master->regs +
 	       DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));