From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f99.google.com (mail-oo1-f99.google.com [209.85.161.99]) (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 504C63ABD83 for ; Wed, 29 Jul 2026 20:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.99 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785356070; cv=none; b=pZoRr2aV9A4pa/gUHmUcyw0GRrZICMv/aIQBqegrdwQS6MDHcdIybia5AbKe4/2Sz6/qcYftVoRzzU8SUmQXPORMNIwywiwhAhIdTIFt9yfIC62/SZeUkXbkfIjTUbk96kDO7dN+ju2UxR9LCkhYWbbvwI5TE+XC27QPxPn2nn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785356070; c=relaxed/simple; bh=dNibn9+fRRxAz+bSl+iGvhTZbe1S1JvPG2WY/u6Qyeg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Aq/gaAPQle2hVWxaVHL/q0Q3EYMLDQq+9WISWvp4hlhQSCYp+q96HXQjU1VP/ieAdedv3xJy4X7XD/0UbHbsUGWsXKR5fC7UuQAPPMY7+imcIUFFNMzzhfUDHTFHTmGxydFv5OyiZ4OowCK3fdgH76SxyXXSxp3hvKahJZwqShc= 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=KLAT7xGN; arc=none smtp.client-ip=209.85.161.99 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="KLAT7xGN" Received: by mail-oo1-f99.google.com with SMTP id 006d021491bc7-6ab0223a3d3so782331eaf.3 for ; Wed, 29 Jul 2026 13:14:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785356068; x=1785960868; 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=Q8cg7db2G8jIu7Q9xqei7Xa543QGG7fv2VU1Z8dI/3U=; b=plzo6i7EmJcP9m7Ef+EJv7HI+FK9cYOwXqdCJxuDZeV4KiMTT0cz9ymzVnb/ZyX4iK xRrj8xn1xYOlmXROsCaV/NqVlufBS7i4Ktm3wD0DoxVGvevGNHZ7G6VwnTb4knKwyx9/ r9lo7+Mzh55EKdPhKAaqmsUkruGOz0ikmO7ieLyTyrAsmnpVzqnqQN1FzloH+euGDvH4 VmwOJCJZfuUB8GupsDGfUXxkUow2mfpROHpHuvAh8QYScF7Fqv34qf6VR0kxERjzX/aS /xobUbfZerOWSLS9UyS6WeUfQKB4gr/h+YVLwLSZ0/jlejkOVpRDjIBOxQgL6zXFL93P mjtQ== X-Forwarded-Encrypted: i=1; AHgh+Rr7iGfIIa0h1QE/qzMstypr2oZP/bDICiBMgtXAWGRQitaXgpb5wdGzMoAa5L3z1NVmdynma9BP18y9dp4=@vger.kernel.org X-Gm-Message-State: AOJu0YzyYlNLVmLnmwGh9mrXSxh9WOjRjDglK1bUmWC5vYZ5fnr0VhI1 SikLHjhPKrB8/t3EktlRWH6H1knUMGm6ySdS1VgIQMysYUGjGY6lgJ7N5wgdtC07gtrpUG92Btv xRosrB/NRd/N+yHBQ+5ciPVOiBeZV3oNMVRdJnh1fZAA70EIpdt91XJo2G4XvqGzwzzYgXzaNy+ boQsqvbp/j/rug3X0xXldmE1jsblEYgr3PW2tWH/hlXo59GYIk4imno/tTc5Cl5bt+g5ZE9ZQsa JzABKOeo/QFDLIA X-Gm-Gg: AR+sD10FRj4HGwWeIkn6ini5Nd2Ldo7OwF+Py2bFaS6wb0tpCG/4flAiyA36NUuGa9D jWsC39dbYT7r45cwGKVHgnsEhdrtudOxS0Bf4AqlnEyWMiY+nspZtv3RLQf95wjIowyuSmjuL7a 06vwqjyr2Cyl85mJKdleQ0+OkfCZ/k9Izq/tFlg9bxbxtRildeqbc3MarlkR6//OsGz1GyljFjv qj7rCCpBiGtl6kP/GAD7UaGuEYapK4fdw3OKY/HGWJ5nfRGBTTg9xx2+X68dJvFWSUe3jICnFKc KwbOHXN1jcRMQQAyytzrEk/y6JZGtjhmPi0ZryvBoyTWKgrUAIT3D7Za6X3mEuQHfarT3KCYA8Y xWOOhaVQlpzR3yJHAMudGS/2aWjlX2Xl4aT6NyVvmNqmDMkCRgNoggj+SeelvnK/n/EbkD4ESvL 3rrMr0WF5ykidwYOEdA76xac9XL+oBvUO6 X-Received: by 2002:a05:6820:308c:b0:6aa:df4e:e373 with SMTP id 006d021491bc7-6ac96ddbcd9mr3964851eaf.62.1785356067939; Wed, 29 Jul 2026 13:14:27 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-26.dlp.protect.broadcom.com. [144.49.247.26]) by smtp-relay.gmail.com with ESMTPS id 006d021491bc7-6aca5451407sm202311eaf.27.2026.07.29.13.14.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2026 13:14:27 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-907e49dbae8so12453526d6.0 for ; Wed, 29 Jul 2026 13:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1785356066; x=1785960866; 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=Q8cg7db2G8jIu7Q9xqei7Xa543QGG7fv2VU1Z8dI/3U=; b=KLAT7xGN3zCGZ0XuY/1YFG3dwgTEk/fgJRRQa9Wzqu/x21cQZXM8rc7C51NzVTstKB Yod+MxN/3f8/b0eVCVOuCSTzKCWmhYKG9Ni28Vn8wpi1IaYailKx9gpxdCRvOce9OVSs N/wZtWSEUhwjDoWheOoO83VnVJyexcuNVQ880= X-Forwarded-Encrypted: i=1; AHgh+Rq/bO96zsl/2wQbQ0zvI9eijYFKD63pEdfX6wljJ0FmFZKrz/79cJkT56Bsi/1feVLB95glm0svOgBlKL8=@vger.kernel.org X-Received: by 2002:ad4:5f05:0:b0:8e9:f62b:8fa0 with SMTP id 6a1803df08f44-908302562d3mr3904206d6.53.1785356066509; Wed, 29 Jul 2026 13:14:26 -0700 (PDT) X-Received: by 2002:ad4:5f05:0:b0:8e9:f62b:8fa0 with SMTP id 6a1803df08f44-908302562d3mr3903896d6.53.1785356066008; Wed, 29 Jul 2026 13:14:26 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-9081dd8cb0dsm32033066d6.48.2026.07.29.13.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 13:14:25 -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 v5 0/2] mmc: core: Keep the card powered across suspend when firmware needs it live Date: Wed, 29 Jul 2026 16:14:18 -0400 Message-Id: <20260729201420.4047677-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 v5. 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. 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. (e)MMC has no per-function driver to make the dynamic sdio_set_host_pm_flags() request SDIO uses, so this reads pm_caps -- the DT-derived, fixed platform characteristic -- not pm_flags. - 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. - Reset the host to its initial bus state (mmc_set_clock() + mmc_set_initial_state(), the same helpers _mmc_hw_reset() uses for a non-power-cycle reset) before marking the card suspended. - 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 (2): dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO mmc: core: Honor keep-power-in-suspend for (e)MMC in suspend/resume .../bindings/mmc/mmc-controller-common.yaml | 7 ++++- drivers/mmc/core/mmc.c | 30 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) -- 2.34.1