mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] power: sequencing: pcie-m2: Drive the Key E SDIO_RESET# signal
@ 2026-10-26 11:38 William Bright
  2026-10-26 12:46 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 3+ messages in thread
From: William Bright @ 2026-10-26 11:38 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bartosz Golaszewski
  Cc: linux-pci, linux-pm, linux-kernel, William Bright

The pcie-m2-e-connector binding describes sdio-reset-gpios, but the
driver never requested it, so the line was left to pinctrl or to its
reset state.

Request it asserted, like W_DISABLE1# and W_DISABLE2#, deassert it once
the connector supplies are enabled and assert it again before they are
disabled. The card is then held in reset through power-up, and the
line is never driven high into an unpowered card.

Signed-off-by: William Bright <william.bright@imd-tec.com>
---
The pcie-m2-e-connector binding describes sdio-reset-gpios, but the
driver never requested it. This holds the card in SDIO reset until the
connector supplies are enabled, and asserts it again before they are
disabled, matching how W_DISABLE1# and W_DISABLE2# are handled.
---
 drivers/power/sequencing/pwrseq-pcie-m2.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
index cafa642a4b6b..5f5a116063da 100644
--- a/drivers/power/sequencing/pwrseq-pcie-m2.c
+++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
@@ -39,6 +39,7 @@ struct pwrseq_pcie_m2_ctx {
 	struct notifier_block nb;
 	struct gpio_desc *w_disable1_gpio;
 	struct gpio_desc *w_disable2_gpio;
+	struct gpio_desc *sdio_reset_gpio;
 	struct device *dev;
 	struct list_head pci_devices;
 	struct mutex list_lock;
@@ -47,13 +48,23 @@ struct pwrseq_pcie_m2_ctx {
 static int pwrseq_pcie_m2_vregs_enable(struct pwrseq_device *pwrseq)
 {
 	struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
+	int ret;
+
+	ret = regulator_bulk_enable(ctx->num_vregs, ctx->regs);
+	if (ret)
+		return ret;
 
-	return regulator_bulk_enable(ctx->num_vregs, ctx->regs);
+	return gpiod_set_value_cansleep(ctx->sdio_reset_gpio, 0);
 }
 
 static int pwrseq_pcie_m2_vregs_disable(struct pwrseq_device *pwrseq)
 {
 	struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
+	int ret;
+
+	ret = gpiod_set_value_cansleep(ctx->sdio_reset_gpio, 1);
+	if (ret)
+		return ret;
 
 	return regulator_bulk_disable(ctx->num_vregs, ctx->regs);
 }
@@ -562,6 +573,13 @@ static int pwrseq_pcie_m2_probe(struct platform_device *pdev)
 		goto err_free_regulators;
 	}
 
+	ctx->sdio_reset_gpio = devm_gpiod_get_optional(dev, "sdio-reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(ctx->sdio_reset_gpio)) {
+		ret = dev_err_probe(dev, PTR_ERR(ctx->sdio_reset_gpio),
+				     "Failed to get the SDIO_RESET# GPIO\n");
+		goto err_free_regulators;
+	}
+
 	config.parent = dev;
 	config.owner = THIS_MODULE;
 	config.drvdata = ctx;

---
base-commit: 1a0586064ee1fbcefe49b6382ee17a236c590879
change-id: 20261026-pwrseq-pcie-m2-sdio-reset-015492a846ad

Best regards,
--  
William Bright <william.bright@imd-tec.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: sequencing: pcie-m2: Drive the Key E SDIO_RESET# signal
  2026-10-26 11:38 [PATCH] power: sequencing: pcie-m2: Drive the Key E SDIO_RESET# signal William Bright
@ 2026-10-26 12:46 ` Manivannan Sadhasivam
  2026-10-26 13:56   ` William Bright
  0 siblings, 1 reply; 3+ messages in thread
From: Manivannan Sadhasivam @ 2026-10-26 12:46 UTC (permalink / raw)
  To: William Bright; +Cc: Bartosz Golaszewski, linux-pci, linux-pm, linux-kernel

On Mon, Oct 26, 2026 at 11:38:38AM +0000, William Bright wrote:
> The pcie-m2-e-connector binding describes sdio-reset-gpios, but the
> driver never requested it, so the line was left to pinctrl or to its
> reset state.

Do we have SDIO pwrseq consumer driver in mainline?

> 
> Request it asserted, like W_DISABLE1# and W_DISABLE2#, deassert it once
> the connector supplies are enabled and assert it again before they are
> disabled. The card is then held in reset through power-up, and the
> line is never driven high into an unpowered card.
> 
> Signed-off-by: William Bright <william.bright@imd-tec.com>
> ---
> The pcie-m2-e-connector binding describes sdio-reset-gpios, but the
> driver never requested it. This holds the card in SDIO reset until the
> connector supplies are enabled, and asserts it again before they are
> disabled, matching how W_DISABLE1# and W_DISABLE2# are handled.
> ---
>  drivers/power/sequencing/pwrseq-pcie-m2.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c
> index cafa642a4b6b..5f5a116063da 100644
> --- a/drivers/power/sequencing/pwrseq-pcie-m2.c
> +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c
> @@ -39,6 +39,7 @@ struct pwrseq_pcie_m2_ctx {
>  	struct notifier_block nb;
>  	struct gpio_desc *w_disable1_gpio;
>  	struct gpio_desc *w_disable2_gpio;
> +	struct gpio_desc *sdio_reset_gpio;
>  	struct device *dev;
>  	struct list_head pci_devices;
>  	struct mutex list_lock;
> @@ -47,13 +48,23 @@ struct pwrseq_pcie_m2_ctx {
>  static int pwrseq_pcie_m2_vregs_enable(struct pwrseq_device *pwrseq)
>  {
>  	struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
> +	int ret;
> +
> +	ret = regulator_bulk_enable(ctx->num_vregs, ctx->regs);
> +	if (ret)
> +		return ret;
>  
> -	return regulator_bulk_enable(ctx->num_vregs, ctx->regs);
> +	return gpiod_set_value_cansleep(ctx->sdio_reset_gpio, 0);

You should not add GPIO control to the pwrseq_pcie_m2_vregs_{enable/disable}()
callbacks. You should create a new 'sdio-enable' and populate
pwrseq_unit_data->enable/disable callbacks for the SDIO_RESET# control.

Please take a look at the 'pcie-enable' unit and W_DISABLE1/2# GPIO control.

But before that, you should explain how the SDIO consumer driver is making use
of pwrseq.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: sequencing: pcie-m2: Drive the Key E SDIO_RESET# signal
  2026-10-26 12:46 ` Manivannan Sadhasivam
@ 2026-10-26 13:56   ` William Bright
  0 siblings, 0 replies; 3+ messages in thread
From: William Bright @ 2026-10-26 13:56 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Bartosz Golaszewski, linux-pci, linux-pm, linux-kernel

On Mon, Oct 26, 2026 at 06:16:38PM +0530, Manivannan Sadhasivam wrote:
> 
> Do we have SDIO pwrseq consumer driver in mainline?
> 
> 

No. MMC still uses its own mmc-pwrseq framework.

> You should not add GPIO control to the pwrseq_pcie_m2_vregs_{enable/disable}()
> callbacks. You should create a new 'sdio-enable' and populate
> pwrseq_unit_data->enable/disable callbacks for the SDIO_RESET# control.

An sdio-enable unit wouldn't ever be called until MMC gains a consumer.
Should I add the unit anyway, or drop this patch until an SDIO user
exists? Maybe I should switch to working on this first? But it looks to
be quite a big task.

> Please take a look at the 'pcie-enable' unit and W_DISABLE1/2# GPIO control.
> 
> But before that, you should explain how the SDIO consumer driver is making use
> of pwrseq.
> 
> - Mani
> 
> -- 
> மணிவண்ணன் சதாசிவம்k

Regards

Will

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-26 13:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 11:38 [PATCH] power: sequencing: pcie-m2: Drive the Key E SDIO_RESET# signal William Bright
2026-10-26 12:46 ` Manivannan Sadhasivam
2026-10-26 13:56   ` William Bright

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®