Re: [PATCH v4 2/2] PCI: EIC7700: Add Eswin PCIe host controller driver

Philipp Zabel
2025-10-30T08:43:43Z

On Do, 2025-10-30 at 16:31 +0800, zhangsenchuan@eswincomputing.com
wrote:
> From: Senchuan Zhang <zhangsenchuan@eswincomputing.com>
>
> Add driver for the Eswin EIC7700 PCIe host controller, which is based on
> the DesignWare PCIe core, IP revision 6.00a. The PCIe Gen.3 controller
> supports a data rate of 8 GT/s and 4 channels, support INTX and MSI
> interrupts.
>
> Signed-off-by: Yu Ning <ningyu@eswincomputing.com>
> Signed-off-by: Yanghui Ou <ouyanghui@eswincomputing.com>
> Signed-off-by: Senchuan Zhang <zhangsenchuan@eswincomputing.com>
> ---
> drivers/pci/controller/dwc/Kconfig | 11 +
> drivers/pci/controller/dwc/Makefile | 1 +
> drivers/pci/controller/dwc/pcie-eic7700.c | 462 ++++++++++++++++++++++
> 3 files changed, 474 insertions(+)
> create mode 100644 drivers/pci/controller/dwc/pcie-eic7700.c
>
[...]
> diff --git a/drivers/pci/controller/dwc/pcie-eic7700.c b/drivers/pci/controller/dwc/pcie-eic7700.c
> new file mode 100644
> index 000000000000..0016dd0be743
> --- /dev/null
> +++ b/drivers/pci/controller/dwc/pcie-eic7700.c
> @@ -0,0 +1,462 @@
[...]
> +static int eswin_pcie_deassert(struct eswin_pcie *pcie)
> +{
> + int ret;
> +
> + ret = reset_control_deassert(pcie->cfg_rst);
> + if (ret) {
> + dev_err(pcie->pci.dev, "Failed to deassert CFG#");
> + return ret;
> + }
> +
> + ret = reset_control_deassert(pcie->powerup_rst);
> + if (ret) {
> + dev_err(pcie->pci.dev, "Failed to deassert POWERUP#");
> + goto err_powerup;
> + }
> +
> + return 0;
> +
> +err_powerup:
> + reset_control_assert(pcie->cfg_rst);
> +
> + return ret;
> +}
> +
> +static void eswin_pcie_assert(struct eswin_pcie *pcie)
> +{
> + reset_control_assert(pcie->powerup_rst);
> + reset_control_assert(pcie->cfg_rst);
> +}

These look like cfg and powerup resets could be controlled together via
reset_control_bulk_assert/deassert().

[...]
> +static int eswin_pcie_parse_port(struct eswin_pcie *pcie,
> + struct device_node *node)
> +{ return -ENOMEM;
[...]
> + port->perst = of_reset_control_get(node, "perst");

Please use of_reset_control_get_exclusive() directly.

[...]
> +static int eswin_pcie_probe(struct platform_device *pdev)
> +{
[...]
> + pcie->powerup_rst = devm_reset_control_get(&pdev->dev, "powerup");
> + if (IS_ERR(pcie->powerup_rst))
> + return dev_err_probe(dev, PTR_ERR(pcie->powerup_rst),
> + "Failed to get powerup reset\n");
> +
> + pcie->cfg_rst = devm_reset_control_get(&pdev->dev, "dbi");
> + if (IS_ERR(pcie->cfg_rst))
> + return dev_err_probe(dev, PTR_ERR(pcie->cfg_rst),
> + "Failed to get dbi reset\n");

Please use devm_reset_control_get_exclusive() directly.

Alternatively, you could get powerup and cfg/dbi resets in bulk via
devm_reset_control_bulk_get_exclusive().

regards
Philipp