From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD2153EB810 for ; Tue, 2 Jun 2026 13:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780406956; cv=none; b=AqeRRW8WLvmmVfz9yf5S66Ok+Tfd+QSakyQwtrsUEN7M6ijjJwCKVyRtbVUW/aewCLj79uEOzkrfx/Xn6WJR72sqdyR7DayIPiCbrfsT4Ut82otPTqVJ+YyL6wEaHqVmOji+zk/nd67ifJNpA2gmnfyqA4FQb5jUy7hBqktsGLE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780406956; c=relaxed/simple; bh=Z6hPJ9X3KC/kpsiAsKJjOMy2UkVUH8G4KAynEwxrbPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pRJpF5BGbWLmidxdpQF2nB3nHZ+ppVZWFqdqr3Oj1l/LzSxvNheBJay/zVuSAwxVAy/pooLuH/GhgR8/LcyroqiyuDmCVzvUCY/8NoBO3pzPwEGD1xVKQLKIIQvSRk/nkjG5wRUvKmW16nrv2xTSG09vJ9u7s5nFtZ1RORZxh0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g0Rqm/cy; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g0Rqm/cy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 655DD1F00898; Tue, 2 Jun 2026 13:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780406955; bh=6yM2kI910zG9k3FdoXLV2c3FsWERxQ03lj2XknHEPAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g0Rqm/cyw0BXMqEg/vd10++W5AYij+XmQztJ/ex1B0Qo+N8wY8RiPXHOYMAsDURaA rwDm1P4eYnNKfO3Ce2AUXnKYIrQdSYXqGIGN7AhoRfTVBCZA18evzbu9EG2In8v4Oh K+02w6KlwB0rw6vCjNnxTYMu0SKwH+OYOqDx6okChb7oXTw6qMk/zGYWtkxBdLhKvW f8zqXSOigjABSfSXF4AA77tL/UNzcLFJsuqEuSE1hA1YtqhKSSpslW9sAHA821dKiw m8wsDHJhZiy2pPyJ2DdqsG+f0mY04mUDNHFQKZPlrncuFE7+Pmw2eMfxzJoILiWptU tPF0Hz3UXROSQ== From: Claudiu Beznea To: wsa+renesas@sang-engineering.com, tommaso.merciai.xr@bp.renesas.com, alexandre.belloni@bootlin.com, Frank.Li@nxp.com, p.zabel@pengutronix.de Cc: claudiu.beznea@kernel.org, claudiu.beznea@tuxon.dev, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH v2 13/17] i3c: renesas: Update HW registers after SW computations are done Date: Tue, 2 Jun 2026 16:28:20 +0300 Message-ID: <20260602132824.3541151-14-claudiu.beznea@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260602132824.3541151-1-claudiu.beznea@kernel.org> References: <20260602132824.3541151-1-claudiu.beznea@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea 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. Reviewed-by: Frank Li Signed-off-by: Claudiu Beznea --- Changes in v2: - collected tags 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 6725b7fe5392..9ffb4a9d1e46 100644 --- a/drivers/i3c/master/renesas-i3c.c +++ b/drivers/i3c/master/renesas-i3c.c @@ -557,10 +557,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); @@ -611,27 +607,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