Thread (22 messages) 22 messages, 2 authors, 2026-02-18

Re: [PATCH v5 10/16] PCI: rzg3s-host: Add SoC-specific configuration and initialization callbacks

From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Date: 2026-02-18 09:46:48
Also in: linux-clk, linux-pci, linux-renesas-soc

Hi, John,

On 2/10/26 13:30, John Madieu wrote:
Add optional cfg_pre_init, cfg_post_init, and cfg_deinit callbacks
to handle SoC-specific configuration methods. While RZ/G3S uses the Linux
reset framework with dedicated reset lines, other SoC variants like RZ/G3E
control configuration resets through PCIe AXI registers.

As Linux reset bulk API gracefully handles optional NULL reset lines
(num_cfg_resets = 0 for RZ/G3E), the driver continues to use the standard
reset framework when reset lines are available, while custom callbacks
are only invoked when provided.

This provides a balanced pattern where:
- RZ/G3S: Uses reset framework only, no callbacks needed
- RZ/G3E: Sets num_cfg_resets=0, provides cfg_pre_init/cfg_post_init/cfg_deinit
- In addition to that, RZ/G3E requires explicit cfg reset and clock turned off
   to put the PCIe IP in a known state.

Add cfg_pre_init, cfg_post_init, and cfg_deinit callbacks to support
custom configuration mechanism in preparation to RZ/G3E PCIe support.

Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
---

Changes:

v5:
  - Roerder got labels as per Claudiu's requirements

v4: No changes

v3: No changes

v2:
  - Renamed callbacks as per Claudiu's comments
  - Reworded goto labels to be consistents with callbacks

  drivers/pci/controller/pcie-rzg3s-host.c | 59 +++++++++++++++++-------
  1 file changed, 42 insertions(+), 17 deletions(-)
[ ... ]
quoted hunk ↗ jump to hunk
@@ -1662,15 +1686,15 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
  
  	clk_disable_unprepare(port->refclk);
  
-	ret = reset_control_bulk_assert(data->num_cfg_resets,
-					host->cfg_resets);
+	/* SoC-specific de-initialization */
+	ret = data->config_deinit(host);
  	if (ret)
  		goto refclk_restore;
  
  	ret = reset_control_bulk_assert(data->num_power_resets,
  					host->power_resets);
  	if (ret)
-		goto cfg_resets_restore;
+		goto config_reinit;
  
  	ret = regmap_update_bits(sysc->regmap, sysc->info->rst_rsm_b.offset,
  				 sysc->info->rst_rsm_b.mask,
@@ -1684,9 +1708,8 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
  power_resets_restore:
  	reset_control_bulk_deassert(data->num_power_resets,
  				    host->power_resets);
-cfg_resets_restore:
-	reset_control_bulk_deassert(data->num_cfg_resets,
-				    host->cfg_resets);
+config_reinit:
If I'm not wrong, you need this, here, as well:

	if (data->config_pre_init)
		data->config_pre_init(host);

Thank you,
Claudiu
quoted hunk ↗ jump to hunk
+	data->config_post_init(host);
  refclk_restore:
  	clk_prepare_enable(port->refclk);
  	pm_runtime_resume_and_get(dev);
@@ -1755,6 +1778,8 @@ static const struct rzg3s_pcie_soc_data rzg3s_soc_data = {
  	.num_power_resets = ARRAY_SIZE(rzg3s_soc_power_resets),
  	.cfg_resets = rzg3s_soc_cfg_resets,
  	.num_cfg_resets = ARRAY_SIZE(rzg3s_soc_cfg_resets),
+	.config_post_init = rzg3s_config_post_init,
+	.config_deinit = rzg3s_config_deinit,
  	.init_phy = rzg3s_soc_pcie_init_phy,
  	.sysc_info = {
  		.rst_rsm_b = {
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help