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=1796388623; b=UahrZQ3eIVfBULdvhDg/vmXrRjcBhZzc75J0gUJd+uDm1eG1guTUwQ9ilIKb/K9oJ8xQ yzX0b8f3SbJCBfYp9rgQamAGbh6LdcYmlThjdo49cM9WHm2pwp+LTTiMCcIBz5cg7Zoj7 HLjXz7Y3bOZ3H4k7ZZmmJNjCz6/ujP7P13EqL/h3ySqBnexDgqSyV9ma8HWrbq//346If b2Oki0SDPNzvyBGdgsPmIUaSMDoTu2mRvr4zSBUS1hkdJmVDv+MhpOt+fgLQGWk+pwX0V Qbd+V9jh3Dj/O/nrS2k8Xt4vJ5TMSNDI9ho2lEFja1sU47V/3shktfutbqxCNKRxONA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388623; 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=ecgwwnZ8p8t8uMDgrk1Dpxv+z/mE1SeiRj9q5/K/RsY=; b=PV6x3WJ3YYiIU5MUL0VVo8rxtbNyPohM/vGcY/IYi+mSpdPk4cKOjySB1uYG0CQ5NeJQ KCugrHXZBHXS6fOFN081ejj4nIiyXxFZBiArqY4Qf3ZXjkmsyqvhJSYWJNteJ2b28A6Vz Lzc7Q4bNgdOL0/9VaCCkWvbT27lxYucOoazP8QXWkR4oGPKJy5Soxw5SB7DYqxUqYtbwq SG5bpRphT5y+Dr6E6P9xGVwI1eiRvA5zbBBqHbCRQxcgRjRLOOmtywo5zr5d6Pj3vV8oG 4LYjeoy68Php/2m+CaEFN+ky71yrwFb58xHzWgzBOpNuO8rcFfpCGNl0CQZfEeJ9ksg== 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=RmJpb4NY; 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 92EE6606A322; Fri, 4 Dec 2026 12:50:23 +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=RmJpb4NY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 071951F000C2; Fri, 4 Dec 2026 12:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388623; bh=ecgwwnZ8p8t8uMDgrk1Dpxv+z/mE1SeiRj9q5/K/RsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RmJpb4NYmbgvVLSi2L5w8NzyS4D+GdS3kixsLYCzJewcE5O7CnU5NESu8CbvhMfwx OkCpZvndc7oijxUzE2n0oMp30UQxf4ackcV0HdGlKyI6Khd7qyxIN/aH5WUFOtevOa cnC5MrRcLLAuvAqJjZ5Y/377WSM/iutWMoCpLoNg= 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.1 0692/1059] mmc: jz4740: Remove the host before resetting the controller Date: Fri, 4 Dec 2026 19:03:43 +0900 Message-ID: <20261204100701.911542844@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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: Adapted to the older API: the function returns int rather than void, and timer_delete_sync() is del_timer_sync(). ] 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 eda1e2ddcaca8..a1fc48f17a9a1 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c @@ -1132,12 +1132,13 @@ static int 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