Re: [PATCH v2 3/3] i3c: dw: Preserve DAT entry bits when restoring addresses

Frank Li
2025-11-21T17:11:01Z

On Fri, Nov 21, 2025 at 02:21:50PM +0800, adrianhoyin.ng@altera.com wrote:
> From: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
>
> Update dw_i3c_master_restore_addrs() to preserve existing bits in each
> Device Address Table (DAT) entry when restoring addresses. This prevents
> overwriting configuration bits during PM runtime resumes.
>
> Signed-off-by: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
> ---
> drivers/i3c/master/dw-i3c-master.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index c43eba615d8a..ac3c2d3136d0 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1718,11 +1718,13 @@ static void dw_i3c_master_restore_addrs(struct dw_i3c_master *master)
> if (master->free_pos & BIT(pos))
> continue;
>
> + reg_val = readl(master->regs + DEV_ADDR_TABLE_LOC(master->datstartaddr, pos));
> +
> if (master->devs[pos].is_i2c_addr)
> - reg_val = DEV_ADDR_TABLE_LEGACY_I2C_DEV |
> + reg_val |= DEV_ADDR_TABLE_LEGACY_I2C_DEV |
> DEV_ADDR_TABLE_STATIC_ADDR(master->devs[pos].addr);

Suppose need clean addr field of reg_val before |=

address value may be wrong if addr feild is not 0 in DAT. Or you can make
sure it is zero.

Frank

> else
> - reg_val = DEV_ADDR_TABLE_DYNAMIC_ADDR(master->devs[pos].addr);
> + reg_val |= DEV_ADDR_TABLE_DYNAMIC_ADDR(master->devs[pos].addr);
>
> writel(reg_val, master->regs + DEV_ADDR_TABLE_LOC(master->datstartaddr, pos));
> }
> --
> 2.49.GIT
>