From nobody Tue Sep 29 13:19:46 2026 Received: from mail-yw1-f225.google.com (mail-yw1-f225.google.com [209.85.128.225]) (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 103733E3C49 for ; Fri, 7 Aug 2026 20:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786132896; cv=none; b=a/vGDxCnrVHt4cYUAIfmBsjAjgdhYrSML85HjV3Rr1W7QG0Ki/Vfpc2GhOdqh9sGv0LhLuANSmPriHj7zH4TsdxuGzxlN/YKuTxYz8ufzMC7pPj4K8fxmPI3SySYyJFCxhtCIUOklUksXJRPx/kxX5co65dyeFqSQMqrLzrlRo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786132896; c=relaxed/simple; bh=fi9UglUsWL14hbGRB6OZdcqhciF+dibx2nkLntu+QWs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=i730rklF8ahRUL6I87Cjlg1Hh8ICq1umUOAVoiKyEe484jI6GcAy/UEV9zKwh+8xjf4EoaCc3f1kyvzIQeZiHacz2vQ3brYyYmZpMSpPRGPUgi+TS+4c53p53Pq4tCxZZJWNXj/XNbq+lo34EK3SBsJVGpS9hqjiEXBUD2WZ8W8= 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=LNHPIPki; arc=none smtp.client-ip=209.85.128.225 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="LNHPIPki" Received: by mail-yw1-f225.google.com with SMTP id 00721157ae682-82011c59e66so67533287b3.0 for ; Fri, 07 Aug 2026 13:01:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786132892; x=1786737692; h=content-transfer-encoding:mime-version:references:in-reply-to :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=frEqhqTY4YyOiZv5F5GY+l0M2IOOmrFEYWVkjKDi394=; b=EW4pSefMmg13NOz4+aBY1t/PcHaUDvi9SjJPS0vOa5b0cnvlrV8t/FOD73W0JFMuEG JqX31vnW6G/IBocph2W2/ov/ByZeyzgl4F9t2JyzS9dlpSuMX374M7GHbdzMksYVcojv mB9Nwnw9xsUXYlJW7r72+3nqjh+5q5r77Q+yDHfGKBMed3KeVX1ITvBziagNCnrFZcKe JCS1LvfbBjZYzmvjwmUqyAGoD66ToXaVrH+u5U1UdsN62ZeCIr4WHSGsqAZZG6UxcdcF FY1MCcdDTGP8b3ec73ponUSFc4mHgGbKZdfPLam7I+WjbVikph608zgjAB1MLvO2YN5S VoRw== X-Forwarded-Encrypted: i=1; AHgh+RqlmwV5yYEOl3yGpJwYUQ/aOIOQM3oCQS9pAeDdlJvtNAdGfpnSeRyfbzUpD28qKeZAJNmxTY3D6y3jrnY=@vger.kernel.org X-Gm-Message-State: AOJu0YyDhf37ZLo/cEmdBS+SAHmCoGqVQiPm30dH61c3oG6iXgNBw0I5 yPFFroSF5cZU+jdZFtKJ8eUT0glzJIJla3lrwSC/SqQ+24q1O+H7f189FjU7Ki0/sci3PkTyHP5 pfjXmnDjaVhs6R1lX6qQIsRW5oaF+V52JPxWlANWYfzbgEnJIgpQd5+mhJBofdYtl5HDCnWYI3b 5raOZ4YPhjFFr4A0kI+E9jSGW98ka1gqNbQHowqSQTRhxxu/qMSdd+VEIw7Y8HggoIDN0Zt/c1f CL6JuwSd7WICSXU X-Gm-Gg: AR+sD10o6r6B34DbwM7LU2w2iggpdiL+wDLs1S2NfN6RDKDB6p/kSh2IFJH2Cj/4652 cY8YjYgkhh47QxsTDYRbAATvLScBeQKimRtXuy6xlFjPzifdTyOqoDb5dLPyeiFhGIHDAizIPYW c9u8m/ef2Cea9NqMzeXrc2K4pG3vrUhZ94waSC+LRgONMZI10h2hVaa8r3ytQAXcBFfPial7I/s V82CzmH5ulZCzGGuAfCIUxdu6t6n/VlaLUPrdr9bT11Awx9g2uE3GP4+h/+c5t5Xlhyk9Q5JHm9 aH3EZ/eAIaBjDUrQz/vhnW0w03EhYgdwsyMLirfAAvw9uSmCFxRuqbRQpcO1cZlrCaakGthJQGd KAFuIFnCSP951HgGh1XKeL5kVGxERjNh15mTzh5/H52a0P+aWoK77Fl9l/5m3nTv9tB9dxxrWPK dGUoU+NNDFNNpOvOvTHfL7U8SceC+svgkl X-Received: by 2002:a05:690c:45ca:b0:80b:bfee:c427 with SMTP id 00721157ae682-8201f0b1362mr161063097b3.13.1786132892247; Fri, 07 Aug 2026 13:01:32 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-20.dlp.protect.broadcom.com. [144.49.247.20]) by smtp-relay.gmail.com with ESMTPS id 956f58d0204a3-66acae67f25sm171805d50.19.2026.08.07.13.01.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2026 13:01:32 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-92e4f946461so390117985a.2 for ; Fri, 07 Aug 2026 13:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1786132891; x=1786737691; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=frEqhqTY4YyOiZv5F5GY+l0M2IOOmrFEYWVkjKDi394=; b=LNHPIPkilSl4iP7DqzuRNuo+gZF4Vc92FPDtO482YdzYoBpLikIzkvUvdJ79trfwOk /UFrliTBPp+kTXCRKNBt+y37uBss3i5nwa5fZAMZy/wzVxHJh8s1v6eb2Op40xTXCIMC KMrF3flVsciTLfLmxzojkUy98BvRD0hO1Lo2c= X-Forwarded-Encrypted: i=1; AHgh+RoQnI7n34JmafRB7Bg8OPXl8R6xGvbhp12xsnaULyri/FQljLLIJ9sOsdBcNrt/C2m1DjiUazoMpPIaYiI=@vger.kernel.org X-Received: by 2002:a05:620a:8010:b0:92e:7a3c:add7 with SMTP id af79cd13be357-9364921c0ddmr2287898285a.27.1786132891381; Fri, 07 Aug 2026 13:01:31 -0700 (PDT) X-Received: by 2002:a05:620a:8010:b0:92e:7a3c:add7 with SMTP id af79cd13be357-9364921c0ddmr2287880185a.27.1786132890663; Fri, 07 Aug 2026 13:01:30 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9366dc51b43sm225839185a.0.2026.08.07.13.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 13:01:28 -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, Krzysztof Kozlowski Subject: [PATCH v8 1/3] dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO Date: Fri, 7 Aug 2026 16:01:19 -0400 Message-Id: <20260807200121.2590202-2-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260807200121.2590202-1-kamal.dasu@broadcom.com> References: <20260807200121.2590202-1-kamal.dasu@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e Content-Type: text/plain; charset="utf-8" keep-power-in-suspend is currently documented as SDIO-only, but the requirement it describes -- preserving card power across a suspend/resume cycle -- applies just as well to any card type. Drop the SDIO-only restriction so eMMC and SD platforms can use it too. Signed-off-by: Kamal Dasu Reviewed-by: Krzysztof Kozlowski --- Changes in v8: - No change. Changes in v7: - Added Krzysztof's Reviewed-by. Changes in v6: - Split into a separate, minimal patch per Ulf: just extend keep-power-in-suspend's scope, with no brcmstb/firmware-specific rationale in its description. That rationale now lives in the new reset-card-at-resume property instead (patch 2/3), and the two are set together on brcmstb rather than folded into one property. - Also per Ulf (applies to v4 and v5 alike): dropped the mention of sdio_set_host_pm_flags() and how Linux's SDIO stack happens to expose this at runtime -- that's a software implementation detail, not a hardware/platform description. Changes in v5: - Added Krzysztof's Reviewed-by. Changes in v4: - Dropped no-mmc-poweroff-suspend entirely and extended keep-power-in-suspend instead, per Krzysztof: the two properties described the same "don't power off across suspend/resume" contract. Changes in v3: - Renamed from no-mmc-sleep; dropped S_A_TIMEOUT framing per Ulf. Changes in v2: - New patch, replacing v1's card-level quirk, per Ulf. Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller-common.ya= ml b/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml index 3d7195e9461c..c18bf0d6a56e 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml @@ -291,7 +291,7 @@ properties: keep-power-in-suspend: $ref: /schemas/types.yaml#/definitions/flag description: - SDIO only. Preserves card power during a suspend/resume cycle. + Preserves card power during a suspend/resume cycle. =20 wakeup-source: $ref: /schemas/types.yaml#/definitions/flag --=20 2.34.1 From nobody Tue Sep 29 13:19:46 2026 Received: from mail-vk1-f227.google.com (mail-vk1-f227.google.com [209.85.221.227]) (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 EF5EF3D5C2C for ; Fri, 7 Aug 2026 20:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786132902; cv=none; b=N/A0yU8EuXUFrOm7USnNsxQ3Bx7PVSajq8iLBvuyaQqxUXTlymvXqb1vDV4nAjG00nyt5ac8twX/OYnYD9ioUhBuVv5NT/0wJo0gL9a5UK6w1FxRKweb+1ZfZrxL7+wCKSAHTET+r/ImE1KZ6PTUDpH9OjZ9OZkb2G2FxCM+snQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786132902; c=relaxed/simple; bh=vr/9876nQ9Yqa2p62Al3XaX5d9J+sOFIuHlt/3IXgHE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dTF6jA1aJJpUWz7o8l2pRWamAGGTRNYqlOxQzkzMQCFNGvCOGcQ+2OjwZga8uhJZsVCUkdHeBKCZjd/P7FfQcFyj2zjSDzcoKmfqrCMyxG4/9Qh0wHhkeixV3rRbfmUzQvee3TdlfqhxEZadUyr7AG60wnPb0kNyNTzRFl1SP7U= 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=aARHbHSP; arc=none smtp.client-ip=209.85.221.227 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="aARHbHSP" Received: by mail-vk1-f227.google.com with SMTP id 71dfb90a1353d-5bf95ade656so1311735e0c.1 for ; Fri, 07 Aug 2026 13:01:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786132900; x=1786737700; h=content-transfer-encoding:mime-version:references:in-reply-to :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=GUobKnTJDW6OHCpTnuG5AIhSRJPdO7KkwqnQ+2e+QDs=; b=YW0Zk02CqgDRFzmyCNAuhAdndWN0lgMLIFRQX88rTnpTYrt99+9eJgLxTvU8uA/+mn RcpMxyXniKkrNl0tpw6lFh22exaFCspL1ZfdNA5s5W3AL0D101h/Lavj02iRRw41f+o0 3rMh7bkGJfpzBADsnH6DmBvypJjqcCQmsWvmqT/SDUu44VnmqOQy3A91xV02Hktbf61I IWHZRhjPnT/t1ZqjbWE7Ny/C0HIfyTwNZkdM+su+E+owCX6w3rNxyYtihZlwXpqHXRn4 epyuIUTPWicC8Lj/SqJyZgmWE/QDv75AspjELsApOTEpthdYzX9LGJQbPx79kqmB1b0K muww== X-Forwarded-Encrypted: i=1; AHgh+RownnKoUzhbnxIMeYKjhb605asFp6rWly4ny2h5/b3KAPhpQ+SB/CWN5zuWqrvTY8O6b/wfFujfr6Duh2Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwzhvCAGHaEVdwFtPqeBBQPHRDo6N/V/qZRAwXl6WFVPHN5pcpS VJ1RSw+QZPiIETgO4pKRmOtx4QgnMcbsJZBe+e54bAsZoETiY4rjzYBppnu1aUluVyGJQyQVUlZ y5W0MAan/snIqOz4AQ0RTLpqFcMQsaE53laZG0iHONJodObviBqK+vvEQvMCyQxNM0kjg7BD7RC 1ulD3BSUCp9nqI04TGt6JuIuJ6vtg8uR32psiqOjXnQ1lF/2KZs57IRxt9yam4DQvjvT+1J2pB1 Q5PibvmbhOffJF1 X-Gm-Gg: AR+sD13F/QEoDyyXE2nq7DYIEwPv+PUku+sR9UWDeCOk2TPdkW+sfYzp2wNY4kQBGxR +KqljA6OJQ+59LSWoGFAicbNpvZVBohhBCSCN4V3ZFgBWcFk0QKSgocUqZlMPZ/6vzbQdf8M6rF XD1VVHQlyu7y/QfuYXtOc6fNMqgITvhpApHWPxnOtijtOv8iN7forzV/7Mg4ZzT1verXO/9mH92 mhE04ToA91A4/v92g+m2qbfFEtkI5jnL8xfz6hhwhIQyGMMjlTtWscXvi8PXa2IP3HzJ8xXvy5Q Fsj/xU6TeFz/Hkj/ADCwzh+zVu2g9Uk4b3rcf8ad+HeYopW9LR0Ij/7w10h97bSxs70BcNHIQ9i 62qxUXyRoNaSqeDL5UAGLs7coOufvYGgpmGwsOVjlzEElCEVBQMEhTlQ74FoNENi/KU3h/eSOKu vYohAeWXngR0jJ4Ld9oMUAzXILfVCd8A== X-Received: by 2002:a05:6122:32c8:b0:5bf:a6dc:e631 with SMTP id 71dfb90a1353d-5c4095ad02emr752319e0c.14.1786132899520; Fri, 07 Aug 2026 13:01:39 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-0.dlp.protect.broadcom.com. [144.49.247.0]) by smtp-relay.gmail.com with ESMTPS id 71dfb90a1353d-5c40b167d8dsm524618e0c.7.2026.08.07.13.01.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2026 13:01:39 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-930a098ea19so423406685a.1 for ; Fri, 07 Aug 2026 13:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1786132898; x=1786737698; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GUobKnTJDW6OHCpTnuG5AIhSRJPdO7KkwqnQ+2e+QDs=; b=aARHbHSP9Nln5FSWL23V1aPIp7cgZpK55smAoujqOSMoOVK0eYbhBkFVRMrbwVXnuA NCDhknxV5/WgsgDRhU6X5qnowMEM9/MXqR7DAOWjdx+QIilP9zWJQzFgdhvBPVJvsptq jXNTlF8Y4nv4sWUGw/jeK0HMIGb4mNrHIqi3I= X-Forwarded-Encrypted: i=1; AHgh+RrhJm6xmck3PoFLUwpTme8GMz85uQaw674LWN5UNUP75I8iO1pJKSYndjd8NszPGTB2xWt2nMB6FqvyLZE=@vger.kernel.org X-Received: by 2002:a05:620a:440b:b0:930:b19a:9d5e with SMTP id af79cd13be357-93671b4bd40mr603679685a.1.1786132898280; Fri, 07 Aug 2026 13:01:38 -0700 (PDT) X-Received: by 2002:a05:620a:440b:b0:930:b19a:9d5e with SMTP id af79cd13be357-93671b4bd40mr603663485a.1.1786132897374; Fri, 07 Aug 2026 13:01:37 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9366dc51b43sm225839185a.0.2026.08.07.13.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 13:01:36 -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, Krzysztof Kozlowski Subject: [PATCH v8 2/3] dt-bindings: mmc: Add reset-card-at-resume property Date: Fri, 7 Aug 2026 16:01:20 -0400 Message-Id: <20260807200121.2590202-3-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260807200121.2590202-1-kamal.dasu@broadcom.com> References: <20260807200121.2590202-1-kamal.dasu@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e Content-Type: text/plain; charset="utf-8" On some platforms, firmware or other hardware accesses the card during suspend/resume, before the kernel's own resume path has run, leaving the card in a state the kernel can no longer assume it knows. Add a flag property so such boards can tell the mmc core the card needs to be reset before it can be used again. This is expected to be paired with keep-power-in-suspend on boards whose firmware needs the card to stay powered and live throughout suspend: since the card is never power-cycled, nothing else would force it back to a known state on resume. Signed-off-by: Kamal Dasu Reviewed-by: Krzysztof Kozlowski --- Changes in v8: - Sashiko's AI review of v7 pointed out this property's own description says it's "expected to be paired with keep-power-in-suspend", and patch 3/3 now enforces exactly that pairing in the driver, but nothing enforced it in the schema -- a DT could set reset-card-at-resume alone and still pass dt_binding_check. Rob Herring asked for this to be addressed on the list. Added a dependencies entry requiring keep-power-in-suspend whenever reset-card-at-resume is present. Changes in v7: - No other change here; patch 3/3 now requires this property alongside keep-power-in-suspend for (e)MMC rather than treating them as fully independent in the driver -- see that patch's changelog. Changes in v6: - New patch, per Ulf's suggestion: rather than fold "needs a reset at resume" into keep-power-in-suspend's own meaning, describe it as its own independent property, so the two can be combined only where actually needed (brcmstb sets both; SDIO's existing keep-power-in-suspend users are unaffected and set neither this nor a reset). Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml | 8 +++++= +++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller-common.ya= ml b/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml index c18bf0d6a56e..c51e9184384d 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml @@ -293,6 +293,13 @@ properties: description: Preserves card power during a suspend/resume cycle. =20 + reset-card-at-resume: + $ref: /schemas/types.yaml#/definitions/flag + description: + The HW/FW may have accessed the card during suspend/resume, + leaving it in an unknown state. Hence, before the card can be + used, it must be reset. + wakeup-source: $ref: /schemas/types.yaml#/definitions/flag description: @@ -361,5 +368,6 @@ patternProperties: dependencies: cd-debounce-delay-ms: [ cd-gpios ] fixed-emmc-driver-type: [ non-removable ] + reset-card-at-resume: [ keep-power-in-suspend ] =20 additionalProperties: true --=20 2.34.1 From nobody Tue Sep 29 13:19:46 2026 Received: from mail-ot1-f99.google.com (mail-ot1-f99.google.com [209.85.210.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 BB5CD3D6CCF for ; Fri, 7 Aug 2026 20:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786132912; cv=none; b=dDqf2YFpB9/jB75mnL9NP1+KpfeKQiMzbsYqfLXQXqjVfaW0EcgkNXi/2g3cYq1rGV4J8gt4ai7/vcIEsebOtffHUWnwy9wVGdm6v3ycUyeLlp7SJvezPJfhDrzjsa5SIBYipErrAQKf9V32MlmaCRdhk6qMSPLUmO2cqb2GRjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786132912; c=relaxed/simple; bh=Q9BLlmOTz2usbyq8ka3liaH9eyUOVuZYmb+fmUCD8Os=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QrctaEYS3i0YplmyjL6gNEJJmoSw5y1/nIZadjZS9Mgd1zvUrPrFSuD3wYn7OfvJalaHIS6IqycDEpjuUqoYqqES1HrR5Fim8XO2oQI6Vo7zXFGNfz21Wk/Yr4ZFRq7J3IzQwlvxjIRd1ofm3tn3GI4aYVvWwjggOjVCZTYZ3ls= 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=dXKSagOB; arc=none smtp.client-ip=209.85.210.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="dXKSagOB" Received: by mail-ot1-f99.google.com with SMTP id 46e09a7af769-7eb63dbd229so1757785a34.1 for ; Fri, 07 Aug 2026 13:01:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786132905; x=1786737705; h=content-transfer-encoding:mime-version:references:in-reply-to :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=TGz4vR3Ngz/jd/dVhW6F3Rli+5agAyjyjU7MO0KJQBU=; b=ptHkW2Z8MAam4TvPUVsPWbuh2CvrJfC4pe9T8ElbouJQnfRtPpxYMAUgdtfmkOj31G 5OctRjHFiHIc4QS8f6sqAEbHtnyaKOKTbdKvCiTTCSBxV6gjet0pCWPlpuFE/XqTJeML zaP777ox1+yCtGw4b5LLrPR/e6olplrdEjyWV2GxHQCueo5gBk42vWaoc0hEyh0WIbNp 5zZSGXqhjh2fwj/Wgtl9tWBtnp7OTlvIl8+52Hm6k4FQp6BqSgQ0MWYQdv86PxNnkw6W LuP3nPZqSL3MxE9JMo44i2U5LybsRe4hX1abFo2wFGfHvZO2KEm2VsiPO2pUjjMJgyN6 86eQ== X-Forwarded-Encrypted: i=1; AHgh+RqgdwNq6gCY6p48KT86fZfOWmuYLt2hhgr8SMOOjOUun/nPixFdVHyTZHBxaZRKJ6a/1JsYnznj4+Km7e8=@vger.kernel.org X-Gm-Message-State: AOJu0YzpRHzMRy5NUnBzTL94M9mzl0RnMUQbdKlRMhhrBFCI0CEXJQct CD0AbQEXX7vatvu419+IZ50MPscftlI13ZGPQd8IUFhhytHFn6u2X+4V2oxUCL24xyBlTsFBNlh HQexaus1b7kJ0SB4O4OUxdoPSt+WtI/ptSqxvOhZJ8ZfRB1bxHNXiuRbUpzRIUxMveUirSNakNU JNdhd2cqsm6CMPBLVZkN9hseQ3djE/rM8moNiHWxblHya3URIOH0c4UN2vcDkUG/oXRoeaI4XSA ZUiuKPhkhS4gwCw X-Gm-Gg: AR+sD10H/4pZfkZWvOJ+enrzg1IJg8MUjkTkUpN8rBMp2Wtw7B0HFIWVw+Eu69tr+C7 U9DS8RPF0jIN+P1sYXmwea7VxFX09A51HfL2yhZ515JmWnax3rw1+922JGy3aH/u+QvgeDzyLK8 HWEGWglOeiKMR3zn0701BFTtvBOiZd1kckh6wviyeQ6+ylEHWEnoXmJacEu7+7q1fWIKIkJceEo G7X5Q1ZFhL8R0kngZLjCjbA8joK/7tzzc9zrGbhkwBX1Rvo9RACxvUp6gMzIiVIfaMa1NXLuwAm +4pz3pWsRu6zZNmEvFUI0FW8x2WEXxd4aoRzPBUn+8wva8SIbHD2l9/1mSFlOOszaVw71lWnEHN WOWvFLiSNSyIWgMkuaNlYqZyEfoGDD3JOm6YRp1X+FGiQ6sBGTAk1IWhvsskmclHGsHzoUQRqkY kSPKHXrOZErw/NB4G49O2iEyKQWCTKp2IP X-Received: by 2002:a05:6830:398d:b0:7dc:e78b:158 with SMTP id 46e09a7af769-7f36c1659fbmr373474a34.4.1786132905146; Fri, 07 Aug 2026 13:01:45 -0700 (PDT) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-25.dlp.protect.broadcom.com. [144.49.247.25]) by smtp-relay.gmail.com with ESMTPS id 46e09a7af769-7f35b7e4eb4sm233760a34.7.2026.08.07.13.01.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Aug 2026 13:01:45 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-930b571432fso200454085a.0 for ; Fri, 07 Aug 2026 13:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1786132904; x=1786737704; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TGz4vR3Ngz/jd/dVhW6F3Rli+5agAyjyjU7MO0KJQBU=; b=dXKSagOBq11xcAuGq4ueg0VOh7HSVpVNLREy3YD+5ZP/aK7NU5juWrUvZ/b/JDrGTo wTohI/PL6Qup3egn9qZfB6Vvrwx6B1rtljLCZaXqp7Ha/BYaZ1o8jxFVPLrSuMn6aJft D07Hn8whNm9rdYEBlrA2VFR+piKrZXloh+Dh0= X-Forwarded-Encrypted: i=1; AHgh+RpmK14ZU0ga08J8VNsDX5lruIX/vImGXewyKYtRLWoc1rwO01hpp5W5ESY7ypnV/2g/rCnBoKVop3UvZMs=@vger.kernel.org X-Received: by 2002:a05:620a:2304:20b0:934:ac0a:8bb1 with SMTP id af79cd13be357-9367b5e6d5emr117684685a.8.1786132903602; Fri, 07 Aug 2026 13:01:43 -0700 (PDT) X-Received: by 2002:a05:620a:2304:20b0:934:ac0a:8bb1 with SMTP id af79cd13be357-9367b5e6d5emr117672985a.8.1786132902883; Fri, 07 Aug 2026 13:01:42 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9366dc51b43sm225839185a.0.2026.08.07.13.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 13:01:42 -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 v8 3/3] mmc: core: Honor keep-power-in-suspend and reset-card-at-resume for (e)MMC Date: Fri, 7 Aug 2026 16:01:21 -0400 Message-Id: <20260807200121.2590202-4-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260807200121.2590202-1-kamal.dasu@broadcom.com> References: <20260807200121.2590202-1-kamal.dasu@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e Content-Type: text/plain; charset="utf-8" On some platforms, firmware accesses the (e)MMC card directly during resume from Suspend-to-DRAM, before the kernel's own resume path has run, in order to load boot code. This requires the card to remain powered and responsive throughout suspend: putting it to sleep, sending it a power-off notification, or removing its supply is not safe, since firmware needs to talk to a live card. Since the card is never power-cycled, nothing else resets it back to a known state before the kernel reuses it after resume. keep-power-in-suspend / MMC_PM_KEEP_POWER already exist for the first part, but are only consumed in the SDIO suspend/resume path (mmc_sdio_suspend()/mmc_sdio_resume()), gated on a per-function runtime request via sdio_set_host_pm_flags(). (e)MMC has no equivalent function-driver layer to make that request, and the requirement here is a fixed platform characteristic rather than a per-cycle one, so _mmc_suspend() checks host->pm_caps directly instead of pm_flags. reset-card-at-resume covers the second part: when set, _mmc_resume() resets the host to its initial bus state the same way _mmc_hw_reset() does for a non-power-cycle reset, before mmc_power_up() and mmc_init_card() re-identify the card. _mmc_suspend()'s fast path requires both MMC_PM_KEEP_POWER and MMC_CAP2_RESET_AT_RESUME to be set. Keeping the card powered without also resetting it at resume is not safe for this driver: skipping mmc_power_off() leaves power_mode at MMC_POWER_ON, so mmc_power_up() no-ops in _mmc_resume(), and without an explicit reset first, mmc_init_card() runs against whatever bus speed/width was active before suspend instead of the initial state it expects. Conversely, _mmc_resume()'s reset checks pm_flags rather than the MMC_CAP2_RESET_AT_RESUME capability directly, since pm_flags is only set when the fast path actually ran -- the only time power_mode is guaranteed to still be MMC_POWER_ON, and so the only time resetting the bus before mmc_power_up() is both necessary and safe. Without that check, MMC_CAP2_RESET_AT_RESUME set on its own would drive the clock and bus lines while the card's supply is still off following a normal mmc_power_off(). The fast path also leaves the card marked suspended without powering it off, so _mmc_suspend()'s pre-existing early exit for an already-suspended card can no longer assume there is nothing left to do: a shutdown, unbind or undervoltage event can still arrive before the card's next real access lazily triggers _mmc_resume() via runtime PM, and those events need the normal power-off sequence regardless. Reselect the card and continue into that sequence in that case, instead of returning early and silently skipping mmc_poweroff_notify() and mmc_power_off(). host->pm_flags is set alongside marking the card suspended, and cleared in _mmc_resume(), so host controller resume handlers can tell power was preserved if they need to. Reported-by: Florian Fainelli Closes: https://lore.kernel.org/r/20260413180551.3683969-1-florian.fainelli= @broadcom.com/ Signed-off-by: Kamal Dasu --- Changes in v8: - Sashiko's AI review of v7 found a High severity issue: the keep-power fast path marks the card suspended without powering it off, but the pre-existing early exit at the top of _mmc_suspend() (for an already-suspended card) doesn't know that -- it just returns immediately regardless of pm_type. Since the system-resume path only re-enables runtime PM rather than calling _mmc_resume() directly (that happens lazily, via runtime PM, on the card's next real access), a shutdown, unbind or undervoltage event landing before that next access would hit the early exit and silently skip mmc_poweroff_notify()/mmc_power_off() entirely. Fixed by reselecting the card and continuing into the normal power-off sequence whenever the card is suspended via our fast path but pm_type isn't a plain suspend, instead of a bare early exit. Calling _mmc_resume() itself from here isn't an option, since _mmc_suspend() already holds the host claim. Changes in v7: - Sashiko's AI review of v6 found two real, complementary bugs in treating MMC_PM_KEEP_POWER and MMC_CAP2_RESET_AT_RESUME as fully independent in this driver: * keep-power-in-suspend without reset-card-at-resume: confirmed on hardware to hang -- _mmc_resume()'s mmc_power_up() no-ops since power_mode never left MMC_POWER_ON, so mmc_init_card() runs at the pre-suspend bus speed and CMD1 times out. * reset-card-at-resume without keep-power-in-suspend: the reset block ran mmc_set_clock()/mmc_set_initial_state() ahead of mmc_power_up(), while power_mode was still MMC_POWER_OFF from a normal suspend-time mmc_power_off() -- driving the clock and bus lines before the card's supply is enabled. Fixed by requiring both capabilities together for the suspend fast path, and checking pm_flags (not the raw capability) for the resume-side reset, so it only ever runs when power was actually kept this cycle. Verified on hardware: the keep-power-in-suspend- without-reset-card-at-resume case now correctly falls through to a normal power-off/power-on cycle instead of hanging, and the paired-capability case is unaffected (still hardware-verified, now with an extra confirmation run after this fix). Changes in v6: - Reworked around Ulf's two-property split: dropped the unconditional mmc_set_clock()/mmc_set_initial_state() reset from the suspend-side fast path, and instead perform it in _mmc_resume(), gated on the new MMC_CAP2_RESET_AT_RESUME (from reset-card-at-resume), matching the property's name and description ("before the card can be used, it must be reset"). - No longer touches MMC_CAP2_NO_POWEROFF_SUSPEND/no-mmc-poweroff- suspend at all -- that capability and property are gone, per the v4 rework; this patch only adds MMC_CAP2_RESET_AT_RESUME. Changes in v5: - Only set host->pm_flags |=3D 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: - Gated the fast path on pm_type =3D=3D 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 |=3D MMC_PM_KEEP_POWER around the suspend/ resume, mirroring the SDIO convention, so host controller resume handlers can tell power was preserved and perform a soft resume sequence instead of assuming power was lost. - Dropped MMC_CAP2_NO_POWEROFF_SUSPEND and the no-mmc-poweroff- suspend DT property entirely. Reuse keep-power-in-suspend / MMC_PM_KEEP_POWER instead, per Krzysztof's point that the new property described the same contract as the existing one. _mmc_suspend() now checks host->pm_caps directly rather than pm_flags, since (e)MMC has no per-function driver to make the dynamic sdio_set_host_pm_flags()-style request SDIO uses. Changes in v3: - Reworked _mmc_suspend() to skip poweroff-notify/sleep/power-off entirely, not just SLEEP, per Ulf. - Renamed to MMC_CAP2_NO_POWEROFF_SUSPEND/no-mmc-poweroff-suspend. Changes in v2: - Replaced the card-level MMC_QUIRK_BROKEN_SLEEP quirk with a host capability, per Ulf. - Added Reported-by/Closes crediting Florian. drivers/mmc/core/host.c | 2 ++ drivers/mmc/core/mmc.c | 71 ++++++++++++++++++++++++++++++++++++++++++++= ++-- include/linux/mmc/host.h | 1 + 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index b7ce3137d452..1622f7846441 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -400,6 +400,8 @@ int mmc_of_parse(struct mmc_host *host) if (device_property_read_bool(dev, "no-mmc-hs400")) host->caps2 &=3D ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V | MMC_CAP2_HS400_ES); + if (device_property_read_bool(dev, "reset-card-at-resume")) + host->caps2 |=3D MMC_CAP2_RESET_AT_RESUME; =20 /* Must be after "non-removable" check */ if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) = =3D=3D 0) { diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 05444ecf3909..a081907bbcf5 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -2144,8 +2144,28 @@ static int _mmc_suspend(struct mmc_host *host, enum = mmc_poweroff_type pm_type) =20 mmc_claim_host(host); =20 - if (mmc_card_suspended(host->card)) - goto out; + if (mmc_card_suspended(host->card)) { + /* + * Nothing to do for a redundant suspend call. Otherwise, the + * card can only still be marked suspended here because the + * keep-power fast path below left it powered and merely + * deselected -- reselect it and continue into the normal + * power-off sequence below, since shutdown, unbind and + * undervoltage need mmc_power_off() regardless of how the + * card got here. + */ + if (pm_type =3D=3D MMC_POWEROFF_SUSPEND || + !(host->pm_flags & MMC_PM_KEEP_POWER)) + goto out; + + if (!mmc_host_is_spi(host)) { + err =3D mmc_select_card(host->card); + if (err) + goto out; + } + mmc_card_clr_suspended(host->card); + host->pm_flags &=3D ~MMC_PM_KEEP_POWER; + } =20 /* * For the undervoltage case, we care more about device integrity. @@ -2157,6 +2177,33 @@ static int _mmc_suspend(struct mmc_host *host, enum = mmc_poweroff_type pm_type) goto out; } =20 + /* + * Keep the card powered across an actual suspend; shutdown, unbind + * and undervoltage still need the normal power-off path below, + * since they aren't guaranteed a subsequent _mmc_resume(). + * + * Check pm_caps, not pm_flags: unlike SDIO, (e)MMC has no + * per-function driver to request this via + * sdio_set_host_pm_flags(), so it's a fixed platform trait here. + * + * Require MMC_CAP2_RESET_AT_RESUME too: without it, _mmc_resume() + * has no way to bring the host back to a state mmc_init_card() can + * use, since mmc_power_up() no-ops when power_mode is already + * MMC_POWER_ON. Keeping power without also resetting at resume is + * not a safe combination for this driver. + */ + if (pm_type =3D=3D MMC_POWEROFF_SUSPEND && + (host->pm_caps & MMC_PM_KEEP_POWER) && + (host->caps2 & MMC_CAP2_RESET_AT_RESUME)) { + if (!mmc_host_is_spi(host)) + err =3D mmc_deselect_cards(host); + if (!err) { + host->pm_flags |=3D MMC_PM_KEEP_POWER; + mmc_card_set_suspended(host->card); + } + goto out; + } + if (mmc_card_can_poweroff_notify(host->card) && mmc_host_can_poweroff_notify(host, pm_type)) err =3D mmc_poweroff_notify(host->card, notify_type); @@ -2217,9 +2264,29 @@ static int _mmc_resume(struct mmc_host *host) if (!mmc_card_suspended(host->card)) goto out; =20 + /* + * Firmware or other hardware may have accessed the card while it + * stayed powered through suspend, leaving it in a state the kernel + * can no longer assume it knows. Reset the host to its initial bus + * state like _mmc_hw_reset() does for a non-power-cycle reset, + * before mmc_init_card() re-identifies the card. + * + * Check pm_flags, not the MMC_CAP2_RESET_AT_RESUME capability + * directly: pm_flags only ends up set here when _mmc_suspend() + * actually took the keep-power fast path this cycle, which is the + * only time power_mode is guaranteed to still be MMC_POWER_ON (and + * so the only time this reset is both necessary and safe to do + * before mmc_power_up() touches the bus). + */ + if (host->pm_flags & MMC_PM_KEEP_POWER) { + mmc_set_clock(host, host->f_init); + mmc_set_initial_state(host); + } + mmc_power_up(host, host->card->ocr); err =3D mmc_init_card(host, host->card->ocr, host->card); mmc_card_clr_suspended(host->card); + host->pm_flags &=3D ~MMC_PM_KEEP_POWER; =20 out: mmc_release_host(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ba84f02c2a10..14a407a9f9b7 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -463,6 +463,7 @@ struct mmc_host { #define MMC_CAP2_CRYPTO 0 #endif #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT en= try at a non-standard location */ +#define MMC_CAP2_RESET_AT_RESUME (1 << 29) /* Card must be reset before us= e at resume */ =20 bool uhs2_sd_tran; /* UHS-II flag for SD_TRAN state */ bool uhs2_app_cmd; /* UHS-II flag for APP command */ --=20 2.34.1