mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kamal Dasu <kamal.dasu@broadcom.com>
To: linux-mmc@vger.kernel.org, Ulf Hansson <ulfh@kernel.org>
Cc: Kamal Dasu <kamal.dasu@broadcom.com>,
	Ulf Hansson <ulf.hansson@oss.qualcomm.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	Shawn Lin <shawn.lin@linux.dev>
Subject: [PATCH v14 0/6] mmc: core: Keep the card powered across suspend when firmware needs it live
Date: Wed, 25 Nov 2026 13:20:47 -0500	[thread overview]
Message-ID: <20261125182053.3915833-1-kamal.dasu@broadcom.com> (raw)

Background: on brcmstb boards with a Kioxia 016G01 eMMC, firmware accesses the
card directly during resume from Suspend-to-DRAM, before the kernel's own
resume path runs, in order to load boot code using hard wired logic that is not
field updatable. The card needs to stay powered and responsive for that access
to succeed, and since it is never power-cycled, it also needs to be reset
before the kernel reuses it after resume.

v13: https://lore.kernel.org/linux-mmc/20261113211143.3759154-1-kamal.dasu@broadcom.com/

Changes in v14:
	- Patch 6: Clear MMC_PM_KEEP_POWER in mmc_host_class_complete() when
	MMC_CAP2_RESET_AT_RESUME is set. The flag is set in
	mmc_host_class_prepare() but was only cleared in mmc_resume(), so it
	stayed set if system suspend was aborted after prepare (reported by
	Sashiko).
	- Patches 1-5: No changes.
	- Tested with CQE enabled.

Review feedback addressed so far, including Sashiko's AI review comments:
	- v14, patch 6: MMC_PM_KEEP_POWER is set in mmc_host_class_prepare()
	and was only cleared in mmc_resume(). It is now also cleared in
	mmc_host_class_complete(), so it doesn't stay set after an aborted
	system suspend.
	- v13, patch 3: CQE is turned off explicitly when the card is kept
	powered, as the cache flush may not send any command that does so.
	- v12, patch 6: An error from _mmc_hw_reset() in mmc_resume() is
	propagated instead of being dropped.
	- v12, patch 6: reset-card-at-resume without keep-power-in-suspend
	makes the host probe fail in mmc_validate_host_caps(), instead of only
	warning, as the card would otherwise be powered off and system suspend
	refused (Ulf).
	- v11, patch 6: The host is claimed around the card reset in
	mmc_resume(), as it sends commands to the card.
	- Earlier series, before Ulf's rework: Sashiko noted that the DT schema
	allowed reset-card-at-resume without keep-power-in-suspend. Patch 2
	keeps the "dependencies" entry that enforces the pairing.

Tested on a brcmstb board with a Kioxia 016G01 eMMC, running S3 suspend/resume
(pml -d) with the DT properties set as below:

  keep-power-in-suspend  reset-card-at-resume  Result
  no                     no                    board resets on resume
  yes                    no                    board resets on resume
  no                     yes                   host probe fails with -EINVAL
  yes                    yes                   resumes, card re-enumerated

Kamal Dasu (2):
  dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO
  dt-bindings: mmc: Add reset-card-at-resume property

Ulf Hansson (4):
  mmc: core: Add option to keep an eMMC powered on at system suspend
  mmc: core: Split sdio_set_host_pm_flags()
  mmc: core: Move and split reset functions for eMMC
  mmc: core: Add support for resetting an eMMC at system resume

 .../bindings/mmc/mmc-controller-common.yaml   |  10 +-
 drivers/mmc/core/core.c                       |  10 ++
 drivers/mmc/core/core.h                       |   1 +
 drivers/mmc/core/host.c                       |  26 ++++
 drivers/mmc/core/mmc.c                        | 111 ++++++++++++------
 drivers/mmc/core/sdio_io.c                    |   7 +-
 include/linux/mmc/host.h                      |   1 +
 7 files changed, 123 insertions(+), 43 deletions(-)


             reply	other threads:[~2026-11-25 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 18:20 Kamal Dasu [this message]
2026-11-25 18:20 ` [PATCH v14 1/6] dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO Kamal Dasu
2026-11-25 18:20 ` [PATCH v14 2/6] dt-bindings: mmc: Add reset-card-at-resume property Kamal Dasu
2026-11-25 18:20 ` [PATCH v14 3/6] mmc: core: Add option to keep an eMMC powered on at system suspend Kamal Dasu
2026-11-25 18:20 ` [PATCH v14 4/6] mmc: core: Split sdio_set_host_pm_flags() Kamal Dasu
2026-11-25 18:20 ` [PATCH v14 5/6] mmc: core: Move and split reset functions for eMMC Kamal Dasu
2026-11-25 18:20 ` [PATCH v14 6/6] mmc: core: Add support for resetting an eMMC at system resume Kamal Dasu

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=20261125182053.3915833-1-kamal.dasu@broadcom.com \
    --to=kamal.dasu@broadcom.com \
    --cc=adrian.hunter@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=shawn.lin@linux.dev \
    --cc=ulf.hansson@oss.qualcomm.com \
    --cc=ulfh@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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®