From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f226.google.com (mail-pf1-f226.google.com [209.85.210.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 348B742AFB4 for ; Tue, 4 Aug 2026 20:38:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.226 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785875907; cv=none; b=ky9SZCG6pY5giGLt52m8E5E8FfvGjxSnkEh9bB4YV3s46txVRF4xgKBUG93OtFugJqYjpo8DASmwxGSZ8BmTh6OXtZGZRixS8guMnQwuyq45WW5hQf2CL/0REl9Uks7+k5le11+vxj8V8cpKkAuE+tVGET3t3jk0ofxbDF3PRGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785875907; c=relaxed/simple; bh=R5Qnv70P5N/IFzuqDWY904MEeXroycu6O4z9BGFiyQ4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=cz4ppiA5FxHpyxMK7/flA++RVkMmspZ5iii3INrwX+9CAl/JYZ+wHulFFngv5iKtH6skT534m5NgmP0AlalzMh4MrdmtPDxcI0D+N+3+t3EW7jG2kc1ESeTWvQ3dIeCHaayl8pY0AzMuKBXHcoB4XF8qsHTr1Bbsm6PIO67SkZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=RLNLoRYM; arc=none smtp.client-ip=209.85.210.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RLNLoRYM" Received: by mail-pf1-f226.google.com with SMTP id d2e1a72fcca58-8487214ad2bso388026b3a.1 for ; Tue, 04 Aug 2026 13:38:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785875905; x=1786480705; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=RifdID+ubAjNrEP9gKUm/CCi/duq76C23UHVDTetxoc=; b=OE1IhVJykC3/EpPpcBIZq3RYFRE30BNk3Gf9h4Oiot8I5i9QEgoOVvUf3H/wraHIWT sy4g+cy8mgs6gsM/r0JDl74ChtgHDP7dOqW0F0vzEWKlLoRT6oWLdMA8jRTweVaENROF FyJDWJ3z8j9Epc9tyJBCyagxP7oD/qk5/eDwwHA8drJHXw1mEyIDIIDcXOeB9ZVUTnnZ xwwKyqHhpyiudxU19mzIdG0+wXzjy964Wi++tDRQd/w7lz9knRT7/AyEVIpgU1kOS6Jo Rj0XsBZ+VDiqqM2v/OzemHjdsJJLYEuTM+XK3GpMZq/4F1Ti8FfnKcp6FCOKQjjR8L+t iaMg== X-Forwarded-Encrypted: i=1; AHgh+RqvcClK7viJwAuEH8qQjHZE5c0DDGz5+efqvUHCL7PCFy0vwia9Iu2wkVRWPmbEyozp2j4deXjntRPq/DE=@vger.kernel.org X-Gm-Message-State: AOJu0YyO6U9krOJCQBhQsuRIUZ6ZJyI3Cd7fXNdiKJ3f+MgFmNbovMzs YIN3/0SIfVpEMp1VRN/cCQUZxZxCc+HxePjK8zMacD1XdVQku19tec6fUThE5FcdeItJCzdOEBL jMcGDM1RJCkw/hhb2aOHpw1DAHSTnV/xvafJvn3trqH/Q+6wBOn6cG2JeW+FGxKO0XKgD9CRrFS mwOrhH9CfY9wlF6uJzAjyrCiEN25z3Y0GPh/LF3eH+anvLBb6KxRcBIdyzUCgtg016oFfgVvkt7 rEnZrTkd7lC6XbD X-Gm-Gg: AR+sD13hnrjFCRDB8xI0R80t61nQDHS0zTntHJyglodOetbWhnc9rsxpOyGnrGvoRvd qId8QZT8cJGBItsIKAol5IHA844abgNB1S4aNlAiwdC0s7OWcXlhsS4kIwUANY2ewHBUZ2TyEl2 ImxvD9GowhQ6qZWYK8718+P4FOdU2qEcak4LcRSwVvhAg9C5pQWiIDOCUxu4Hc2rIvMrcPrPzd9 Q/5Q8a4Fu31WYVy9fT5jiTmg2o6tSX/G2VmqpTP1LNNK5UpCqeltZd0yh1EAIAaTBDls0FMUDDl 9saSZTdE4bFRvO4dRwQdc9kxdGDDT/3RSCdTlMsFj5ZNBMKKF2i1o1C40Avk7izdct5wXtsmvxL VJRZZnK9apwql+QWLqqWMP4HLGUTaxs3m0KxZtk8mi3Nfx5e4vyJ8vi1BPa5xy0JmePWPxBs+IS AkDn2yKy1XfGmg3tGufdmCt+0OCBSEdaQU X-Received: by 2002:a05:6a00:3996:b0:84e:5e4:b9a2 with SMTP id d2e1a72fcca58-84f2e0edf09mr1321239b3a.36.1785875905461; Tue, 04 Aug 2026 13:38:25 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-27.dlp.protect.broadcom.com. [144.49.247.27]) by smtp-relay.gmail.com with ESMTPS id d2e1a72fcca58-84f2e2d874dsm67627b3a.2.2026.08.04.13.38.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2026 13:38:25 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-930a098ea19so30637385a.1 for ; Tue, 04 Aug 2026 13:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1785875904; x=1786480704; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=RifdID+ubAjNrEP9gKUm/CCi/duq76C23UHVDTetxoc=; b=RLNLoRYMP7UjAE/aw19tImWOtEMwjA/Qx0swy+fgPpDbQ9hBU3K7yIYHyhGy2YUUIK 9N/igmTab9grxLVwoNTXFAWjIL/9h70m0TwW8IOMRk6sPYmhs0+JagCZXjwpZk09zR+v MRlx3Gx6Iyy1XInr5L2yKgOnt9KwOxzyBqv3M= X-Forwarded-Encrypted: i=1; AHgh+RooxWuAxO/EBt9qwggOfh2MUmlXdL8SoCs+tIVUsAROnlhWXb6XMmx1SgXiZ4sJixKYgeDv4Eox6HEq+TQ=@vger.kernel.org X-Received: by 2002:a05:620a:8012:b0:936:4955:e5ef with SMTP id af79cd13be357-9364955e630mr106755885a.22.1785875904040; Tue, 04 Aug 2026 13:38:24 -0700 (PDT) X-Received: by 2002:a05:620a:8012:b0:936:4955:e5ef with SMTP id af79cd13be357-9364955e630mr106749285a.22.1785875903436; Tue, 04 Aug 2026 13:38:23 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9364a52dbeesm11089085a.30.2026.08.04.13.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2026 13:38:23 -0700 (PDT) From: Kamal Dasu To: Ulf Hansson Cc: Kamal Dasu , Florian Fainelli , Wolfram Sang , Oleksij Rempel , Avri Altman , Pedro Demarchi Gomes , Erick Shepherd , Adrian Hunter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 0/3] mmc: core: Keep the card powered across suspend when firmware needs it live Date: Tue, 4 Aug 2026 16:38:15 -0400 Message-Id: <20260804203818.881765-1-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e This is v6, and grows from two patches to three per Ulf's review. 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. Changes in v6: - Split keeping the card powered and needing a reset before reuse into two independent DT properties, per Ulf: extending keep-power-in-suspend beyond SDIO (patch 1) no longer carries any brcmstb-specific rationale, and a new reset-card-at-resume property (patch 2) covers that instead. brcmstb sets both; SDIO's existing keep-power-in-suspend users are unaffected. - Patch 3 (the driver patch) reflects the split: the mmc_set_clock()/mmc_set_initial_state() reset moved out of the suspend-side fast path and into _mmc_resume(), gated on the new MMC_CAP2_RESET_AT_RESUME, matching reset-card-at-resume's name and description. - Also per Ulf (raised on v4, applies equally to v5): dropped the mention of sdio_set_host_pm_flags() and how Linux's SDIO stack happens to expose this at runtime from the binding description -- that's a software implementation detail, not a hardware/platform description. Changes in v5: - Patch 1: added Krzysztof's Reviewed-by. - Patch 2: only set host->pm_flags |= MMC_PM_KEEP_POWER after mmc_deselect_cards() succeeds, instead of unconditionally before it. Otherwise, if the deselect fails, the card is never marked suspended, _mmc_resume() takes its early exit, and the flag never gets cleared -- leaking it for the rest of uptime. Changes in v4: - Dropped the no-mmc-poweroff-suspend DT property and MMC_CAP2_NO_POWEROFF_SUSPEND host capability entirely. Krzysztof pointed out they described exactly the same contract as the existing keep-power-in-suspend property (don't power off the card across suspend/resume). Extended keep-power-in-suspend's scope beyond SDIO instead, and reworked _mmc_suspend() to check host->pm_caps & MMC_PM_KEEP_POWER directly rather than adding a new capability. - Gated the fast path on pm_type == MMC_POWEROFF_SUSPEND; it was previously unconditional, so it wrongly skipped the required power-off/notify handling during shutdown, unbind and undervoltage as well. - Set/clear host->pm_flags |= MMC_PM_KEEP_POWER around the suspend/ resume, mirroring the SDIO convention, so host drivers can tell power was preserved if they need to. Changes in v3: - Reworked the fix in _mmc_suspend() (drivers/mmc/core/mmc.c) to skip the poweroff-notify/sleep/power-off sequence entirely. - Renamed no-mmc-sleep/MMC_CAP2_NO_SLEEP_CMD to no-mmc-poweroff-suspend/MMC_CAP2_NO_POWEROFF_SUSPEND. Changes in v2: - Replaced v1's card-level MMC_QUIRK_BROKEN_SLEEP quirk with a host capability and matching DT property, per Ulf's suggestion. - Added Reported-by/Closes tags crediting Florian. Kamal Dasu (3): dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO dt-bindings: mmc: Add reset-card-at-resume property mmc: core: Honor keep-power-in-suspend/reset-card-at-resume for (e)MMC .../bindings/mmc/mmc-controller-common.yaml | 9 ++++++- drivers/mmc/core/host.c | 2 ++ drivers/mmc/core/mmc.c | 33 ++++++++++++++++++++++ include/linux/mmc/host.h | 1 + 4 files changed, 44 insertions(+), 1 deletion(-) -- 2.34.1