mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pengpeng Hou <hppiscas@163.com>
To: Adrian Hunter <adrian.hunter@intel.com>, Ulf Hansson <ulfh@kernel.org>
Cc: Pengpeng Hou <hppiscas@163.com>,
	linux-mmc@vger.kernel.org,
	Ben Chuang <ben.chuang@genesyslogic.com.tw>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mmc: sdhci-pci-gli: Fail runtime resume on PLL timeout
Date: Sun,  6 Sep 2026 11:39:47 +0800	[thread overview]
Message-ID: <20260906033947.85078-1-hppiscas@163.com> (raw)

gl9763e_runtime_resume() logs when the internal clock never becomes
stable but still enables the card clock and reports runtime-resume
success.

Return the poll timeout before enabling the card clock. Clear the
PLL-enable bit so a failed resume leaves the clock state matching runtime
suspend. Low-power negotiation remains enabled for the suspended device.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: d607667bb8fa ("mmc: sdhci-pci-gli: Add runtime PM for GL9763E")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
 drivers/mmc/host/sdhci-pci-gli.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c
index b55618566d65..17717b54e08c 100644
--- a/drivers/mmc/host/sdhci-pci-gli.c
+++ b/drivers/mmc/host/sdhci-pci-gli.c
@@ -1888,6 +1888,7 @@ static int gl9763e_runtime_resume(struct sdhci_pci_chip *chip)
 	struct sdhci_pci_slot *slot = chip->slots[0];
 	struct sdhci_host *host = slot->host;
 	u16 clock;
+	int ret;
 
 	if (host->mmc->ios.power_mode != MMC_POWER_ON)
 		return 0;
@@ -1899,11 +1900,18 @@ static int gl9763e_runtime_resume(struct sdhci_pci_chip *chip)
 	sdhci_writew(host, clock, SDHCI_CLOCK_CONTROL);
 
 	/* Wait max 150 ms */
-	if (read_poll_timeout(sdhci_readw, clock, (clock & SDHCI_CLOCK_INT_STABLE),
-			      1000, 150000, false, host, SDHCI_CLOCK_CONTROL)) {
+	ret = read_poll_timeout(sdhci_readw, clock,
+				(clock & SDHCI_CLOCK_INT_STABLE),
+				1000, 150000, false, host,
+				SDHCI_CLOCK_CONTROL);
+	if (ret) {
 		pr_err("%s: PLL clock never stabilised.\n",
 		       mmc_hostname(host->mmc));
 		sdhci_dumpregs(host);
+
+		clock &= ~SDHCI_CLOCK_PLL_EN;
+		sdhci_writew(host, clock, SDHCI_CLOCK_CONTROL);
+		return ret;
 	}
 
 	clock |= SDHCI_CLOCK_CARD_EN;
-- 
2.50.1 (Apple Git-155)


             reply	other threads:[~2026-09-06  3:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06  3:39 Pengpeng Hou [this message]
2026-09-07  9:16 ` BenChuang[莊智量]
2026-09-09  9:04   ` Adrian Hunter

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=20260906033947.85078-1-hppiscas@163.com \
    --to=hppiscas@163.com \
    --cc=adrian.hunter@intel.com \
    --cc=ben.chuang@genesyslogic.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulfh@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®