[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42a5119e547685f171be6f91e476a9b595599cf9.camel@pengutronix.de>
Date: Fri, 09 May 2025 12:51:24 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Claudiu <claudiu.beznea@...on.dev>, bhelgaas@...gle.com,
lpieralisi@...nel.org, kw@...ux.com, manivannan.sadhasivam@...aro.org,
robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
geert+renesas@...der.be, magnus.damm@...il.com, mturquette@...libre.com,
sboyd@...nel.org, saravanak@...gle.com
Cc: linux-pci@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org, Claudiu
Beznea <claudiu.beznea.uj@...renesas.com>
Subject: Re: [PATCH 5/8] PCI: rzg3s-host: Add Initial PCIe Host Driver for
Renesas RZ/G3S SoC
Hi Claudiu,
On Mi, 2025-04-30 at 13:32 +0300, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
>
> The Renesas RZ/G3S features a PCIe IP that complies with the PCI Express
> Base Specification 4.0 and supports speeds of up to 5 GT/s. It functions
> only as a root complex, with a single-lane (x1) configuration. The
> controller includes Type 1 configuration registers, as well as IP
> specific registers (called AXI registers) required for various adjustments.
>
> Other Renesas RZ SoCs (e.g., RZ/G3E, RZ/V2H) share the same AXI registers
> but have both Root Complex and Endpoint capabilities. As a result, the PCIe
> host driver can be reused for these variants with minimal adjustments.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> ---
> MAINTAINERS | 8 +
> drivers/pci/controller/Kconfig | 7 +
> drivers/pci/controller/Makefile | 1 +
> drivers/pci/controller/pcie-rzg3s-host.c | 1561 ++++++++++++++++++++++
> 4 files changed, 1577 insertions(+)
> create mode 100644 drivers/pci/controller/pcie-rzg3s-host.c
>
[...]
> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> new file mode 100644
> index 000000000000..c3bce0acd57e
> --- /dev/null
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -0,0 +1,1561 @@
[...]
> +static int rzg3s_pcie_resets_bulk_set(int (*action)(int num, struct reset_control_bulk_data *rstcs),
> + struct reset_control **resets, u8 num_resets)
> +{
> + struct reset_control_bulk_data *data __free(kfree) =
> + kcalloc(num_resets, sizeof(*data), GFP_KERNEL);
> +
> + if (!data)
> + return -ENOMEM;
> +
> + for (u8 i = 0; i < num_resets; i++)
> + data[i].rstc = resets[i];
> +
> + return action(num_resets, data);
> +}
What is the purpose of this? Can't you just store struct
reset_control_bulk_data in struct rzg3s_pcie_host and call
reset_control_bulk_assert/deassert() directly?
> +static int
> +rzg3s_pcie_resets_init(struct device *dev, struct reset_control ***resets,
> + struct reset_control *(*action)(struct device *dev, const char *id),
> + const char * const *reset_names, u8 num_resets)
> +{
> + *resets = devm_kcalloc(dev, num_resets, sizeof(struct reset_control *), GFP_KERNEL);
> + if (!*resets)
> + return -ENOMEM;
> +
> + for (u8 i = 0; i < num_resets; i++) {
> + (*resets)[i] = action(dev, reset_names[i]);
> + if (IS_ERR((*resets)[i]))
> + return PTR_ERR((*resets)[i]);
> + }
> +
> + return 0;
> +}
Why not use devm_reset_control_bulk_get_exclusive() directly?
regards
Philipp
Powered by blists - more mailing lists