lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <ZQ2PR01MB13076269AF954AF603B347D9E6A22@ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn>
Date: Mon, 8 Dec 2025 13:47:43 +0000
From: Hal Feng <hal.feng@...rfivetech.com>
To: Kevin Xie <kevin.xie@...rfivetech.com>, Lorenzo Pieralisi
	<lpieralisi@...nel.org>, Krzysztof WilczyƄski
	<kwilczynski@...nel.org>, Manivannan Sadhasivam <mani@...nel.org>, Bjorn
 Helgaas <bhelgaas@...gle.com>, Liam Girdwood <lgirdwood@...il.com>, Mark
 Brown <broonie@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Rob Herring
	<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Emil Renner
 Berthing <emil.renner.berthing@...onical.com>, Heinrich Schuchardt
	<heinrich.schuchardt@...onical.com>, E Shattow <e@...eshell.de>, Bjorn
 Helgaas <helgaas@...nel.org>
CC: "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v1] PCI: starfive: Use regulator APIs instead of GPIO APIs
 to control the 3V3 power supply of PCIe slots

> On 04.12.25 14:50, Hal Feng wrote:
> The "enable-gpio" property is obtained to control the 3V3 power supply of
> PCIe slots but it is not documented in the dt-bindings and using GPIO APIs is
> not a standard method to control PCIe slot power, so use "vpcie3v3-supply"
> property and regulator APIs to replace them.
> 
> This change will break the DTs which add "enable-gpio" or "enable-gpios"
> property under the node with compatible "starfive,jh7110-pcie".
> Fortunately, there are no such DTs in the upstream mainline, so this change
> has no impact on the upstream mainline.
> If you have used "enable-gpio" or "enable-gpios" property in your
> downstream DTs, please update it with "vpcie3v3-supply" after applying this
> commit.
> 
> Acked-by: Kevin Xie <kevin.xie@...rfivetech.com>
> Signed-off-by: Hal Feng <hal.feng@...rfivetech.com>

Hi, Bjorn, Manivannan and the other PCI maintainers,

Could you please pick up this patch for the coming v6.19rc? So the VisionFive 2 Lite board
can be fully supported in v6.19. If anything needed to change, please let me know and I am
willing to send v2 in time. Thanks.

Best regards,
Hal

> ---
> 
> This patch is derived from the reply of Manivannan [1].
> And the previous version is [2].
> 
> Changes since [2]:
> - Improve the commit messages. Add description to explain the impact of
>   this patch.
> - Remove the Fixes tag and the Tested-by tag.
> 
> [1]
> https://lore.kernel.org/all/xxswzi4v6gpuqbe3cczj2yjmprhvln26fl5ligsp5vkiog
> rnwk@...fxivaps6j/
> [2] https://lore.kernel.org/all/20251125075604.69370-2-
> hal.feng@...rfivetech.com/
> 
> ---
>  drivers/pci/controller/plda/pcie-starfive.c | 25 ++++++++++++---------
>  1 file changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/controller/plda/pcie-starfive.c
> b/drivers/pci/controller/plda/pcie-starfive.c
> index 3caf53c6c082..298036c3e7f9 100644
> --- a/drivers/pci/controller/plda/pcie-starfive.c
> +++ b/drivers/pci/controller/plda/pcie-starfive.c
> @@ -55,7 +55,7 @@ struct starfive_jh7110_pcie {
>  	struct reset_control *resets;
>  	struct clk_bulk_data *clks;
>  	struct regmap *reg_syscon;
> -	struct gpio_desc *power_gpio;
> +	struct regulator *vpcie3v3;
>  	struct gpio_desc *reset_gpio;
>  	struct phy *phy;
> 
> @@ -153,11 +153,13 @@ static int starfive_pcie_parse_dt(struct
> starfive_jh7110_pcie *pcie,
>  		return dev_err_probe(dev, PTR_ERR(pcie->reset_gpio),
>  				     "failed to get perst-gpio\n");
> 
> -	pcie->power_gpio = devm_gpiod_get_optional(dev, "enable",
> -						   GPIOD_OUT_LOW);
> -	if (IS_ERR(pcie->power_gpio))
> -		return dev_err_probe(dev, PTR_ERR(pcie->power_gpio),
> -				     "failed to get power-gpio\n");
> +	pcie->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
> +	if (IS_ERR(pcie->vpcie3v3)) {
> +		if (PTR_ERR(pcie->vpcie3v3) != -ENODEV)
> +			return dev_err_probe(dev, PTR_ERR(pcie->vpcie3v3),
> +					     "failed to get vpcie3v3
> regulator\n");
> +		pcie->vpcie3v3 = NULL;
> +	}
> 
>  	return 0;
>  }
> @@ -270,8 +272,8 @@ static void starfive_pcie_host_deinit(struct
> plda_pcie_rp *plda)
>  		container_of(plda, struct starfive_jh7110_pcie, plda);
> 
>  	starfive_pcie_clk_rst_deinit(pcie);
> -	if (pcie->power_gpio)
> -		gpiod_set_value_cansleep(pcie->power_gpio, 0);
> +	if (pcie->vpcie3v3)
> +		regulator_disable(pcie->vpcie3v3);
>  	starfive_pcie_disable_phy(pcie);
>  }
> 
> @@ -304,8 +306,11 @@ static int starfive_pcie_host_init(struct plda_pcie_rp
> *plda)
>  	if (ret)
>  		return ret;
> 
> -	if (pcie->power_gpio)
> -		gpiod_set_value_cansleep(pcie->power_gpio, 1);
> +	if (pcie->vpcie3v3) {
> +		ret = regulator_enable(pcie->vpcie3v3);
> +		if (ret)
> +			dev_err_probe(dev, ret, "failed to enable vpcie3v3
> regulator\n");
> +	}
> 
>  	if (pcie->reset_gpio)
>  		gpiod_set_value_cansleep(pcie->reset_gpio, 1);
> 
> base-commit: b2c27842ba853508b0da00187a7508eb3a96c8f7
> --
> 2.43.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ