From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Prabhakar <prabhakar.csengg@gmail.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Claudiu Beznea" <claudiu.beznea.uj@bp.renesas.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>
Cc: linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v3 4/4] PCI: rzg3s-host: Add support for RZ/V2H(P) SoC
Date: Tue, 2 Jun 2026 11:00:49 +0300 [thread overview]
Message-ID: <86e80877-b860-4b93-a5ae-a416840eb393@tuxon.dev> (raw)
In-Reply-To: <20260520164823.436992-5-prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi, Prabhakar,
On 5/20/26 19:48, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Add support for the RZ/V2H(P) SoC PCIe controllers to the rzg3s-host
> driver.
>
> The RZ/V2H(P) SoC features two independent PCIe controllers that share
> four physical lanes. The hardware supports two configuration modes:
> single x4 mode where the first controller uses all four lanes, or dual
> x2 mode where both controllers use two lanes each.
>
> Introduce a setup_lanes() function pointer to configure the PCIe lanes
> based on the hardware instance. Implement rzv2h_pcie_setup_lanes() to
> detect the configuration at boot time and program the lane mode via the
> system controller.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v2->v3:
> - Parsed controller-id from the "renesas,sysc" property instead of
> using linux,pci-domain.
>
> v1->v2:
> - Updated commit message.
> - Added locks to protect shared lane configuration state and
> prevent concurrent access issues during probe.
> - Added cleanup action to release lanes on driver removal.
> - Reconfigured RZG3S_SYSC_FUNC_ID_LINK_MASTER in resume path.
> - Renamed num_channels to num_pcie_controllers for clarity.
> ---
> drivers/pci/controller/pcie-rzg3s-host.c | 180 +++++++++++++++++++++++
> 1 file changed, 180 insertions(+)
>
> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index edb49af7429a..15879b2c0bd2 100644
[ ...]
> +static int rzv2h_pcie_setup_lanes(struct rzg3s_pcie_host *host)
> +{
> + struct device_node *np = host->dev->of_node;
> + u32 num_lanes;
> + int ret;
> +
> + ret = of_property_read_u32(np, "num-lanes", &num_lanes);
> + if (ret)
> + return ret;
> +
> + /*
> + * RZ/V2H(P) supports up to 4 lanes, but only in single x4 mode
> + * for the first controller. Dual x2 mode is supported with 2
> + * lanes for both controllers.
> + */
> + if (num_lanes != 4 && num_lanes != 2)
> + return -EINVAL;
> +
> + if (host->controller_id == RZG3S_PCIE_CONTROLLER_ID_1 && num_lanes > 2)
> + return -EINVAL;
> +
> + guard(spinlock)(&rzv2h_lane_lock);
> + if (rzv2h_num_total_lanes + num_lanes > RZV2H_PCIE_MAX_LANES)
> + return -EINVAL;
> +
> + ret = rzg3s_sysc_config_func(host->sysc, RZG3S_SYSC_FUNC_ID_LINK_MASTER,
> + num_lanes == 2 ?
> + RZG3S_SYSC_LINK_MODE_DUAL_X2 :
> + RZG3S_SYSC_LINK_MODE_SINGLE_X4);
> + if (!ret) {
I personally would prefer:
if (ret)
return ret;
> + rzv2h_num_total_lanes += num_lanes;
> + host->num_lanes = num_lanes;
> + }
> +
> + return ret;
And return 0 here. Up to you.
w/ or w/o that addressed:
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested it on RZ/G3S:
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Thank you,
Claudiu
next prev parent reply other threads:[~2026-06-02 8:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 16:48 [PATCH v3 0/4] Add PCIe " Prabhakar
2026-05-20 16:48 ` [PATCH v3 1/4] dt-bindings: PCI: renesas,r9a08g045-pcie: Add RZ/V2H(P) support Prabhakar
2026-06-01 23:22 ` Rob Herring (Arm)
2026-06-02 7:58 ` Claudiu Beznea
2026-05-20 16:48 ` [PATCH v3 2/4] PCI: rzg3s-host: Use shared reset controls for power domain resets Prabhakar
2026-06-02 7:58 ` Claudiu Beznea
2026-05-20 16:48 ` [PATCH v3 3/4] PCI: rzg3s-host: Prepare System Controller handling for multiple controllers Prabhakar
2026-06-02 7:59 ` Claudiu Beznea
2026-05-20 16:48 ` [PATCH v3 4/4] PCI: rzg3s-host: Add support for RZ/V2H(P) SoC Prabhakar
2026-06-02 8:00 ` Claudiu Beznea [this message]
2026-06-02 19:41 ` Lad, Prabhakar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86e80877-b860-4b93-a5ae-a416840eb393@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=bhelgaas@google.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mani@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®