[PATCH 13/17] i3c: renesas: Update HW registers after SW computations are done
Frank Li
Frank.li at nxp.com
Fri May 22 12:48:21 PDT 2026
On Fri, May 22, 2026 at 01:18:11PM +0300, Claudiu Beznea wrote:
> From: Claudiu Beznea <claudiu.beznea.uj at bp.renesas.com>
>
> renesas_i3c_bus_init() performs a number of computations and software
> cache updates, interleaving them with hardware register writes. While
> this works today, it makes it harder to minimize the time the controller
> must remain powered when runtime PM is introduced.
>
> Perform all software computations and cache updates first, then update
> the hardware registers. This prepares for future runtime PM support.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj at bp.renesas.com>
> ---
Reviewed-by: Frank Li <Frank.Li at nxp.com>
> drivers/i3c/master/renesas-i3c.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
> index 865e67ac0fd2..631c9c5d8038 100644
> --- a/drivers/i3c/master/renesas-i3c.c
> +++ b/drivers/i3c/master/renesas-i3c.c
> @@ -550,10 +550,6 @@ static int renesas_i3c_bus_init(struct i3c_master_controller *m)
> if (!i3c->rate)
> return -EINVAL;
>
> - ret = renesas_i3c_reset(i3c);
> - if (ret)
> - return ret;
> -
> i2c_total_ticks = DIV_ROUND_UP(i3c->rate, bus->scl_rate.i2c);
> i3c_total_ticks = DIV_ROUND_UP(i3c->rate, bus->scl_rate.i3c);
>
> @@ -604,27 +600,31 @@ static int renesas_i3c_bus_init(struct i3c_master_controller *m)
> STDBR_SBRHO(double_SBR, od_high_ticks) |
> STDBR_SBRLP(pp_low_ticks) |
> STDBR_SBRHP(pp_high_ticks);
> - renesas_writel(i3c->regs, STDBR, i3c->i3c_STDBR);
>
> /* Extended Bit Rate setting */
> i3c->extbr = EXTBR_EBRLO(od_low_ticks) | EXTBR_EBRHO(od_high_ticks) |
> EXTBR_EBRLP(pp_low_ticks) | EXTBR_EBRHP(pp_high_ticks);
> - renesas_writel(i3c->regs, EXTBR, i3c->extbr);
> -
> - renesas_writel(i3c->regs, REFCKCTL, REFCKCTL_IREFCKS(cks));
> - i3c->refclk_div = cks;
> -
> - /* I3C hw init*/
> - renesas_i3c_hw_init(i3c);
>
> ret = i3c_master_get_free_addr(m, 0);
> if (ret < 0)
> return ret;
>
> + info.dyn_addr = ret;
> i3c->dyn_addr = ret;
> - renesas_writel(i3c->regs, MSDVAD, MSDVAD_MDYAD(ret) | MSDVAD_MDYADV);
> + i3c->refclk_div = cks;
> +
> + ret = renesas_i3c_reset(i3c);
> + if (ret)
> + return ret;
> +
> + renesas_writel(i3c->regs, STDBR, i3c->i3c_STDBR);
> + renesas_writel(i3c->regs, EXTBR, i3c->extbr);
> + renesas_writel(i3c->regs, REFCKCTL, REFCKCTL_IREFCKS(cks));
> + renesas_writel(i3c->regs, MSDVAD, MSDVAD_MDYAD(i3c->dyn_addr) | MSDVAD_MDYADV);
> +
> + /* I3C hw init*/
> + renesas_i3c_hw_init(i3c);
>
> - info.dyn_addr = ret;
> return i3c_master_set_info(&i3c->base, &info);
> }
>
> --
> 2.43.0
>
More information about the linux-i3c
mailing list