From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385885; b=BnqhsMoZNUZ77OEAuTlzL96j+zVRhukfNsptd8+rIzm38n5cJgCgMeUHuZZcUJfJ9uqt f8Qr0TZmOcVDHlv/iuWYZxdOVyIXp3Hdp6sjhDSbJ7pd9xV3XO7+Bo85UOpts0t7yBSZc SzKkgXF6hROf+lOpBaXxrUmQFUCDHbkwUJIElqHw84XYuGUSlTPf15EVdg70dSCwGe+kc W5lNfw235cybKMlqTQ2KmH/9WAQ3HOGiP0eJcZOiJstV1g0jtt405i/kBjqL496jiXrp8 cBBshB/vcrGK+zGKXYdVu+iLzwEL/okVif1kpCYeT/yhKzLwTwRQ029hyoVlc1RhOEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385885; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=scy8o/cUOE1e57EkS4sYilABCGiqpiKHPFje5Ijj9hM=; b=RFGLeTCAD1So2qlhNm541wWZO/pzAUfmHFC0r+PMrwNKDqtRDtqEdqXUanQNgC/mzgmr 2a7IW8xGW+N7cRj7qTTI8zpgpSZCDj6hGlZgj2HKIxsJEhKQww+KIukvJzhmbbZmTTG4y 87PJtV6ApRwa3Ip9U/iUNet0QEPZ7r3Oo9IpuYkUAk1H/mYYuSneXzP2V5L3MEz7W2PEF P/1M4vU/5y/sbag6yOUMpV8yIqSXiuODgXnqZJ9L6TVNWhs2obtPdm6LGD4z09OfYa/Tj D/Dk/ie7QtEvV0S/2BNLF8vZZjhld+nLmYeIbAs//djQxxrjQ/6zCTKtAGiCD74hm6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=qsjtMoUw; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 131FA606A32C; Fri, 4 Dec 2026 12:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=qsjtMoUw Received: by smtp.kernel.org (Postfix) with ESMTPSA id E41591F00897; Fri, 4 Dec 2026 12:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385884; bh=scy8o/cUOE1e57EkS4sYilABCGiqpiKHPFje5Ijj9hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qsjtMoUw5SWcK/p0oDjwZ4tFv8PUNDAmYGBlEqrqisKEj+Fd3Qjgys2JBT/eOjwiW 2UP5X60gvthG18Ya0eZp2HjegCbk7mYlsDvlfUR5UZCKRrSbAb+5uhjLLBJC+B8EJt 0YhkNUrHh6N7B4nyfwsEwUOfr7A+NBo7SBqL56sc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Olivier Louvignes , Ulf Hansson , Sasha Levin Subject: [PATCH 6.6 0734/1167] mmc: jz4740: Remove the host before resetting the controller Date: Fri, 4 Dec 2026 19:02:41 +0900 Message-ID: <20261204100721.190196030@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Olivier Louvignes [ Upstream commit 6b8b1e8827837bf4cf1f87219038fddae9e81b0b ] jz4740_mmc_remove() masks every interrupt and resets the controller before mmc_remove_host(), which removes the card and lets the card's driver send its last commands. Those commands then run on a controller that was just reset, and can wait out the driver's 5 s request timeout. With an SDIO card that cost 5 s on every unbind: on a HiBy R1 (Ingenic X1600, a BCM43430A1 driven by brcmfmac), the CMD52 that sdio_release_irq() sends from brcmfmac's remove waited 5.1 s. The command had finished (END_CMD_RES set in MSC_STAT), but MSC_IMASK read 0xffffffff although the request had unmasked END_CMD_RES. MSC_STAT can still show IS_RESETTING after jz4740_mmc_reset() returns, so the reset most likely completed after that write and undid it. Remove the host first, then quiesce the controller, as other host drivers do. On the R1, unbinding the Wi-Fi's MSC now takes 0.65 s. Fixes: 61bfbdb85687 ("MMC: Add support for the controller on JZ4740 SoCs.") Cc: stable@vger.kernel.org Signed-off-by: Olivier Louvignes Signed-off-by: Ulf Hansson [ sashal: changed timer_delete_sync() to del_timer_sync() for the older timer API ] Signed-off-by: Sasha Levin --- drivers/mmc/host/jz4740_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c index f379ce5b582d4..46e5b3b16ccc3 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c @@ -1167,12 +1167,13 @@ static void jz4740_mmc_remove(struct platform_device *pdev) { struct jz4740_mmc_host *host = platform_get_drvdata(pdev); + /* The card's driver may still send commands as it goes */ + mmc_remove_host(host->mmc); + del_timer_sync(&host->timeout_timer); jz4740_mmc_set_irq_enabled(host, 0xff, false); jz4740_mmc_reset(host); - mmc_remove_host(host->mmc); - free_irq(host->irq, host); if (host->use_dma) -- 2.53.0