From nobody Sat Oct 3 03:45:33 2026 Received: from mail-pg1-f226.google.com (mail-pg1-f226.google.com [209.85.215.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 91BF13FB04E for ; Wed, 5 Aug 2026 22:25:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785968714; cv=none; b=gvWXwhOjnH6hUUZs++WZ6pxTaOlYpnf6CkIPKLhsA9jzZOcNCFH3QHtmpmtFstV4nGEYMU/i5wRFwNI1KXljKQkH/dQX/mbIeVLI8R3/EWjF5VMTlwIxXS/ck1JhktkqicHLrhNiJ1zcF9vrqKrEjJ9MvqTs2A4M/fh5TuPn5sI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785968714; c=relaxed/simple; bh=Qlzp5E9i+GZFM+UIin+Fmma2xkNpBqV2cfN3Yxh2qbU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b4GgE3N7qaEsdqHwLBHfurfPn/tfwMgv+aKzWW1LhCicext/Bf2HRAcIh8YqWi9s8yAl6mOXxv6I0Ux4kX8QTieOHX4T9cuCb8ymLEB3LJkL2u1PLgVZu9o8UXTZCQ8G+qkqXbqr9P6s+/kw1vHUEZWzNWDCj6uS55V4CgUG5SE= 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=Wo+hJTKi; arc=none smtp.client-ip=209.85.215.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="Wo+hJTKi" Received: by mail-pg1-f226.google.com with SMTP id 41be03b00d2f7-c9c26a5fb98so246407a12.0 for ; Wed, 05 Aug 2026 15:25:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785968713; x=1786573513; 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=9n0fizxp33zjg5nu+cX3jmQFUDtRl3HBk7n7rSIUnuM=; b=VmauPrQh80XHuwS/bmvEOIVwjQeJoqjAGpyn6DNb84uC6I74sbq9U3p0nDpXpfuxEu EDVyT35fMtkqVzWT6Vg/oR7u2sQNyYJGLrfK92FGNGXalm+bXwa8rtbfYgbJZGj1KhkE mWyvk5qkLdIHXqZiu8lksfM8iWpf7bVfj4NU65mtsM7mqu/YnBrp8vQS3yp72IbLuZiU TykvIgCdpUGUkI4J40tyB5JcN66lCxtCTMg0o+bXm+32grIr/Nqq6v6SkeLDJ/vc0ru6 wcGhWTFh7Cgwjvi5tjIAeA3g0ULkQoQU/INxMIJKrF7gGOd1ROoVQowJdAvNM09wrJVz fo5Q== X-Forwarded-Encrypted: i=1; AHgh+RrYPfCWq2/BP+bdIDqHEl31xS05XSjegrI6bCX8T3ppoOc3PGKe4W24g4tevqqL6sFRQvxpkEP0Mu26/tU=@vger.kernel.org X-Gm-Message-State: AOJu0YxJna4xDiXXaG1c5QOY9A/HeTxT10H3llFuMnmyTE7PFbM5u6Tl nN/LSLi+08chnyBzMEwyCrXyC5cJoahkltQnbWtcE/Q1XKSFHNjlQvHDi+35YU5kPe+o1ww9dH0 WdK4mt0xplQquOJRkO/4vvdrYfKjxvoxUWAUgWJqmiooVZPa98gAPxO+A9f0r/ahZO5ly/50o3e I07C0/ckJZY5/4aIy9QAHT+3Qh6c8DqKDm0pez3+FJNnnfxsR4VhyTgXAVGEagdFy0Niqd3/pI3 qIg/8cae05lryL+ X-Gm-Gg: AR+sD13xVGl8pLFvBP5H99CCkaiupu7jusUA8MtyhMkZahrI6Vk8sidYTgV6vD0Tjxa unTOw1NQ0gvb4TAfEG5jB48zA53XxrQF8efyttK12Ijo7t98gCYZ6GF1tU5nehcUFGkVBbPkIA2 nfgL2Vl+E5pQHL+hDyKm2/Qsow0Qm+8QNc8pL4pQ2YMQgls336C8wvmRk+McgQeEQzIBvDTXh7b JUT6gPLu2Ph0xczhDjIeesQM9ueDuieNwq8ow3Dm+Skw0++w+KC7p9twYbL9ilgJWKWIuVHvBGj MGg/luHGjThycijpccBjRHd29igcvbRoGMv6DGx7c8+YVLNxMEHT28SzamFb15bo+xI1aavSNwH Qs77Lmrv5lc9xoiqqTeUD7zjT6+VvwnKOioGErMYNZsMRPvNwkDPa7HVxUrlJBof88jnCL9hyGp 6kyZtizHwVqmvPqJmagfVpQrfzLTt9Fg/R X-Received: by 2002:a05:6a20:7f95:b0:39c:4e62:b843 with SMTP id adf61e73a8af0-3cb9c1c7178mr2400907637.10.1785968712696; Wed, 05 Aug 2026 15:25:12 -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 41be03b00d2f7-cbe707d6170sm1167096a12.1.2026.08.05.15.25.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2026 15:25:12 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-38dbe39ce62so295592a91.0 for ; Wed, 05 Aug 2026 15:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1785968711; x=1786573511; 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=9n0fizxp33zjg5nu+cX3jmQFUDtRl3HBk7n7rSIUnuM=; b=Wo+hJTKi5S/OEp8+1JSqQdkV4pBH6kEhUFNEreC/KacQXVPfMcJysi9RxX9VDG8PKy gz0sNDXPWNp91Uu3Yc4MvhPeBh6fQVrl9EIiZnomAVZr1IvGsXQYGcVeeS/6VWrmafL+ Z7rkdW7QUqIAyNF2O+oaUI7teLY4F/sHFpIgE= X-Forwarded-Encrypted: i=1; AHgh+Ro44KrxCgw+hB7DMIHeAp/UATxqxRaZFe1xJjnGaYqfMxf3AS2QxbaJG/blAYUCtTHMaVNrd45SMeNUgtc=@vger.kernel.org X-Received: by 2002:a17:90b:2ec4:b0:36b:de66:92c3 with SMTP id 98e67ed59e1d1-39083aba06emr1307744a91.10.1785968710837; Wed, 05 Aug 2026 15:25:10 -0700 (PDT) X-Received: by 2002:a17:90b:2ec4:b0:36b:de66:92c3 with SMTP id 98e67ed59e1d1-39083aba06emr1307710a91.10.1785968710335; Wed, 05 Aug 2026 15:25:10 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3158676f579sm18526160eec.20.2026.08.05.15.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 15:25:09 -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 v7 1/3] dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO Date: Wed, 5 Aug 2026 18:24:58 -0400 Message-Id: <20260805222500.2567801-2-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260805222500.2567801-1-kamal.dasu@broadcom.com> References: <20260805222500.2567801-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 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. wakeup-source: $ref: /schemas/types.yaml#/definitions/flag -- 2.34.1 From nobody Sat Oct 3 03:45:33 2026 Received: from mail-pj1-f100.google.com (mail-pj1-f100.google.com [209.85.216.100]) (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 C5F093F823F for ; Wed, 5 Aug 2026 22:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785968718; cv=none; b=LzJ859joVEjE6G9Butn6tlZEea6XM3rrpp/vvhZXmLyMaT9lnYok3RgvdxNTb6S2liXy3niqJLI8QuvyUflJMelMU6WW8JkNl7tVLy366H9kNb/VXVunty+uGJFtxH5I0YuDorSpi0tjF5FqQlsLW/LLv9O2YWHZ2SkTth2Tn/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785968718; c=relaxed/simple; bh=6qwL+yfFZcESUNF5HiWRkDnZTCmWLZVhdGnov/uFMbE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oA6DZZru3j4I+alITI9f8jOT2OJQzy9Ubsi1bcRgXrPhupOftF8PFQ8pYDq7bSO3GxJxuvC2+5a7TCtFslDY6i72+r2ANoxg+sgZHRtC0FPNLVt1VJvUBxS6ad6KJkjMtFd7O8ydKEj3pwBsLRJu3frOKvk3An156fxyL4+VmKw= 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=erIc+Auj; arc=none smtp.client-ip=209.85.216.100 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="erIc+Auj" Received: by mail-pj1-f100.google.com with SMTP id 98e67ed59e1d1-383b4a3755fso1526751a91.3 for ; Wed, 05 Aug 2026 15:25:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785968716; x=1786573516; 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=aR+KeTjwxOC6HIctWVlnauptoumuvtPEgsVHqo6aA/w=; b=HIO//bmU3Hqa5mBbviSFzk84JemANWKa6Yk1ZnlI1D5GC/dcHTT4kwkLT2iozVL3Yt OIcMPa2vmLSsfU+6NkVcAYWcNCofcwj7tDbCpqmZBLwnsBSbnI/xVpBAzc8eEZ+46zHN 6+cOZXrP4DpSRNgzySdvW8y8TRzh6WpphHzdE+EmoYXCg18fkTVBQJpSwrzleNmJO+TW w4Rj3xOg/xu+YYSj1G7jg5eee9OUzd5vvWnrN6JkXFMyQBhUHVHbpqWuMrqQqgXRH73c yjVbeQJGlgcyjR793klbVIc4TFBN0fqs9MgVNU0X87bkbtOKqrG9h8weqC//EjzhUzou ejOw== X-Forwarded-Encrypted: i=1; AHgh+RovngMlPLsyLSqLF2zXpUOVqtbxt4CIeR+4vBVgVVHS+3JKGVXdcKIr7k90xvVs09225KGQOmppytPBxz4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxs0T+YF5+YglAOND5jHePlmQNK2NVky+lUHuvb5P0zibgLV6KA ZOPkF9B2wuLNdFcZYV49D1SvyUJrfItNjdeCxgVM1Jm5Yn7Qac8yhJ4mtYIvDIhIn1ovjSAV/VU k7tVTI5EA3Qb8q2fIneICSC6QSppssoR3SNQimBBcwgk1r89XCIh7DGiHnOXFU0wQTMFGhL8Ezc jSfiTJoJz0XR/vpby38R5KNQ90Q8B4XyX4F3AyS8VUyayezlnBi/AWAviuB9vheCxVYycShUmbG daksBDXNQ/EqgBK X-Gm-Gg: AR+sD12s+/MR3T5rsN+eZgQNZ5e4I7KJADjsrh23sASf1iUp/xuinxoQ2g8YljhMau5 wrXmucCUb/Y2qed1yBqCuQCQs1e1bS++wFG53O9d3ErJlU8523b9XxZB/PLG66smsOISSDOpIHG EeUE6RFJT93beXfC8/haPefRB3nPIGzCQXVVED6I/V6AUJjwI8eNlhsH7UuGlO3FT+Ta9U/LHPL YAHMkglo11oMCnYSvcaCEMjdRBypUOqKpGdqegz08i9MBt0h4GyJC4y8twj1MwQDekKhyXWvCfd iPG6jwzJfSoa3llh54wjsA/jpS1l04xUCrdFvIXGGKoAcY5Nl7uCITkMlLQpAru3DIKtEm0DF/A ve/sm10dJTXUWkgH2ywqnbd2Xv7UtO2ejbFZ0A3vlHt+h03pj0oq+dXNCcyU7e/bIHJJx0TKTt+ HdS33MGeoh3sB9rtDSpGf2RXG/1z0QfjPp X-Received: by 2002:a17:90b:4b87:b0:37f:c2a8:ce45 with SMTP id 98e67ed59e1d1-3903c537d5fmr9276550a91.4.1785968716020; Wed, 05 Aug 2026 15:25:16 -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 98e67ed59e1d1-39085ee6b3dsm145005a91.4.2026.08.05.15.25.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2026 15:25:16 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2caf4173b1cso26469685ad.3 for ; Wed, 05 Aug 2026 15:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1785968714; x=1786573514; 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=aR+KeTjwxOC6HIctWVlnauptoumuvtPEgsVHqo6aA/w=; b=erIc+Auj8TsMWxfKzO/qaB51lq+FRDe2ySmLtB1kkmg+4NheD+WSCR3CPWQZutvjv0 ep+xGAGy/3M1uAp8CHxrTkvzieik/ORrfYzr2gPAPXa69jGgG2CFr0hObhyD7BARbgX3 DrAcb0+gaRMFb8UQInSZ7iKg3fMJZTKoUOInA= X-Forwarded-Encrypted: i=1; AHgh+RqBUxmD9hWYAurcIN09QbR7Ew2b6LhOQtZrFYdITGJ29hSl4E+zR7GCbBZpFST5Y/05vMeaMsAPp+FfjnY=@vger.kernel.org X-Received: by 2002:a17:902:f644:b0:2c9:b2c1:13ec with SMTP id d9443c01a7336-2d0ca756f9bmr18188735ad.11.1785968714400; Wed, 05 Aug 2026 15:25:14 -0700 (PDT) X-Received: by 2002:a17:902:f644:b0:2c9:b2c1:13ec with SMTP id d9443c01a7336-2d0ca756f9bmr18188235ad.11.1785968714061; Wed, 05 Aug 2026 15:25:14 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3158676f579sm18526160eec.20.2026.08.05.15.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 15:25:13 -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 v7 2/3] dt-bindings: mmc: Add reset-card-at-resume property Date: Wed, 5 Aug 2026 18:24:59 -0400 Message-Id: <20260805222500.2567801-3-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260805222500.2567801-1-kamal.dasu@broadcom.com> References: <20260805222500.2567801-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 v7: - Added Krzysztof's Reviewed-by. - 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 | 7 +++++= ++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller-common.ya= ml b/Documentation/devicetree/bindings/mmc/mmc-controller-common.yaml index c18bf0d6a56e..6929969ed5a2 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. + 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: -- 2.34.1 From nobody Sat Oct 3 03:45:33 2026 Received: from mail-pj1-f100.google.com (mail-pj1-f100.google.com [209.85.216.100]) (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 C44AF3F39D0 for ; Wed, 5 Aug 2026 22:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785968724; cv=none; b=OEq2EwnXwwFwYZEGVimWgp6Rg/tSbXLglgpzrrihnherCpbrTvs7affQx6YYrAvX0KaUIzIez4LZWuWHzSHPD+DTwxhSuMhP5lRdWJjlRf7trizYgKmoox8MVeRInzEgD2C2ircmjwxl356p/jLGK09Ph6D5/VGT4jdsIK3JDZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785968724; c=relaxed/simple; bh=//9sionMhS4M7t/0Wt1MxqBaL/YEZe85CEZFIpJbxGI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CFBDbFSPHMT60GWvu5EKw1VXFcJDC6VsnerVJz+yNBbiU7TpeD4dhymlyQKAc2wrOQvlhzwCVVjGKTSNu+rmvIA0IY6RdENP6GB+cCdi0djLxgdaynm3cimyxqg1Da+NFUOqHufgh+9W94Wfj6covzThMcZnz2gbSXKC8Xp2h0A= 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=YShYhabf; arc=none smtp.client-ip=209.85.216.100 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="YShYhabf" Received: by mail-pj1-f100.google.com with SMTP id 98e67ed59e1d1-3900e39d935so1470062a91.0 for ; Wed, 05 Aug 2026 15:25:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785968721; x=1786573521; 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=3Youi575tAxYNiwgXr28Lc52i2LD/cKBdFtczF6a874=; b=dTwmYvEHAv+l3vBGY/EfbauPDA3uiJaD6yvM5YFcW1EMsi46o7yv6k5P0EGo2RC8W8 55SonrrnIUzHmAIZYSPDOT8t6PaXyhREibWOphG/vwo0WgtclKvy3p7ZLX4PDnHVOb4Q rvKmwB/3qWZcEpyNvRb65ydCN0ruAEFO4+ItwI7YgSfxR24mM2SOnQnMufv9GBGHGTzE a3w/hvTJKMuc0U/NrCAjcTXzqDnK4IIRhWFxZiEYEWBjlo1XlkwCPYcSDxEec2ONaKoo CmztI+l+MDHkeBligjOS0sRbgTteAFRDcyPOh7nk4NI7jhr/Y0daTZqLXEVvxktRnl0X iI0A== X-Forwarded-Encrypted: i=1; AHgh+RoyM1j3lR+U0eVyzeRlhkl5Vsp2CjqBFTTr2m46pDYkqWcGU3OVWzHW6O+StaDfZ12IWeA8E8c4gO92O/E=@vger.kernel.org X-Gm-Message-State: AOJu0YxT5FIFycesORv9wGQY9c6FFPFOvsXcpk+bef5MIq0O2FYqWDqT 4VjGrYXjG9Nm694FaCWrJbJ2Rcy0k0IfS8BJ4OwMpvpqqH22YI4cBoHEx5CC7+FndW8XUg98P2k sSUpKF3m1kxcR36GB53hlJ4ul5vZgIbSx8DwM/GSsd+gl039KlXxDO/yOMdIi+EeKKEbD2PFqOI IDQvEdGxI7WjPtymszCYM1EoDdWREyy6c5r6IkpqBpryXSIGbPYpDbNTOMMs9j3+TPgeNX+n0Yk XoofHb8n9Mm7S0S X-Gm-Gg: AR+sD104wWy0rABn94OXYTcLzd7bayuFcrWJqbZy1kcUoTbZM1p5OMb57ewrmTM2UuI CPto1QqQF+ShhVUSj9ky2cCZkwaDdR3Rnq4CKbRrJ7pVeB2JDQ/YVeZJUjOlmKtUP8XaaARkZ0s Os0IsxWQxuiwAtEkuWMnNM4c/zGP5BnEhW1IkLRgdNHPLeq1hjKJPFBYAF+zUHveKTxx+8JEzHQ MUqLIQzelibXBmzxY2UhIxU5E9m6WXGsapqSGHqHoFdmDPMbYULCmbGbWslxKMD50PTqqqKGB6s A/MG8+XlY3Uoj5c/JngEVtSuPixTDLTmANpbs7ZoqVOiXzswtZs90gYRx0ERahdIHfvZ8Oml838 i/Oiivv538VNdcrtTnZs9j++sx8nssAVJsft8BOLBjwf05UiVBmYyWgStWLtn/ayBj0Dme2tg/e JzyEHBtXeiGzhn5Vl6esTxF7EF+DJFccNa X-Received: by 2002:a17:90a:d64f:b0:38f:caa2:5721 with SMTP id 98e67ed59e1d1-3903c5dc500mr10811044a91.17.1785968720730; Wed, 05 Aug 2026 15:25:20 -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 a92af1059eb24-13fca7d3aefsm960653c88.6.2026.08.05.15.25.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2026 15:25:20 -0700 (PDT) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-c85798977dcso2246880a12.0 for ; Wed, 05 Aug 2026 15:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1785968719; x=1786573519; 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=3Youi575tAxYNiwgXr28Lc52i2LD/cKBdFtczF6a874=; b=YShYhabfw+Yx4mtVQ/WivoBAwypSAd55ZT8OaxiS80OcmBa4jvLqKC3jDwOBDldbLz Aej0rF4FsdLVioyPWiYGoTnyDMvUqvSZ7imlrjfEtwQD88ZAleAYHoGDrCkGKkBB34Lb +IaMWeWZ329L79VXXC3zrtkUEJZKS5AiuR350= X-Forwarded-Encrypted: i=1; AHgh+Rox0CpAXzbNSwZg/jLWMbXK2HhgppsJmoKH0/5zhICCA/Z1Omvln++Cx4cGKZQodMgMjTiOD3kxj4jZdho=@vger.kernel.org X-Received: by 2002:a05:6a20:728f:b0:3a2:d316:de53 with SMTP id adf61e73a8af0-3cb85c0732fmr11055865637.0.1785968718602; Wed, 05 Aug 2026 15:25:18 -0700 (PDT) X-Received: by 2002:a05:6a20:728f:b0:3a2:d316:de53 with SMTP id adf61e73a8af0-3cb85c0732fmr11055793637.0.1785968718027; Wed, 05 Aug 2026 15:25:18 -0700 (PDT) Received: from mail.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3158676f579sm18526160eec.20.2026.08.05.15.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 15:25:17 -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 v7 3/3] mmc: core: Honor keep-power-in-suspend and reset-card-at-resume for (e)MMC Date: Wed, 5 Aug 2026 18:25:00 -0400 Message-Id: <20260805222500.2567801-4-kamal.dasu@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260805222500.2567801-1-kamal.dasu@broadcom.com> References: <20260805222500.2567801-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(). 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 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 | 47 ++++++++++++++++++++++++++++++++++++++++++++= +++ include/linux/mmc/host.h | 1 + 3 files changed, 50 insertions(+) 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..62cc009f2a2b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -2157,6 +2157,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 +2244,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