Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2894972pxb; Tue, 24 Aug 2021 10:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+Ci45dU52T2pCLwvX5Kv9P5pnQL3SaAlx96kRkqjkDCxksZ2VMe8ZIQ1zY5qAJ3DJT+wW X-Received: by 2002:a05:6e02:2184:: with SMTP id j4mr28391526ila.30.1629824632739; Tue, 24 Aug 2021 10:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824632; cv=none; d=google.com; s=arc-20160816; b=q0A+eSFWQP9qGG1ZE0kNBEu3N7+lqjkQX0LfxI4fRQrfRTagEzUhka5K1QAADMiLNB jxwQx9pHixbWKdHecgJOld8tt463+MsyRUClqsMz/JWOnXwEh8To4Y8qULpWONXaIhg3 jsTnDs7AAO4N6o4qb/T5JvgQecN/B9p2HxPCxe1RaNedLlTxVm9Nn+Kn4id+DRoep682 6NxaCnuGkmnxn62WDC2c+bxT4/BvhDiF8gdEV0U2oNskN/N0mvYpWz4oYmUubn3ls3tj zieMGWp0A0nnFmRSOFzkLrsz+KHXGjkYGfD47Js+9AxoeKGuOBlG/MhcMC8p5vesGdzX Z05Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dbSiEaLVymJrtJfk7CedWq8giBrmGOlc6qz7BKvqri4=; b=PWHGlv1fVbQgRwOHh0Ui0uITqJImhTgwlz9PAJJzqisL4xZDRn/Mal5EVlbO0PWgQm AnnMgJHL/7Svin/A2L70YRwnTr5ki/OwDQ1JMAdTD4aE1tNcbvCSpDUuWzF+i3bbDkU3 d/HxDDHJzGLiDRf4kGmxPpvorFLL9RC/gfTv1z/G0E0wNhLO2CbbqJL80PcdAgyPD0AT TjKarMV8N85IOqhuBjRNZgNinMtN9YaDFdSNwlLnawatyoU5TZwj7bzghEdiG7QInOGH eWP65z29zwT/AZCPKxoWUlZzv7rxAFcE6k2nRQjRj/l/aFrvbNOPBBkKbI+SJnmvW1D3 GdwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AI32HafE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e101si19534181jai.50.2021.08.24.10.03.39; Tue, 24 Aug 2021 10:03:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AI32HafE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239270AbhHXRCe (ORCPT + 99 others); Tue, 24 Aug 2021 13:02:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:39380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238921AbhHXQ7N (ORCPT ); Tue, 24 Aug 2021 12:59:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 181F4613DB; Tue, 24 Aug 2021 16:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824253; bh=lHfJPFWK+t4p3YUj7fDu2kNXu+QF2QYhQZvSygoeDSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AI32HafEeEtcEX8h/ZvJ+F5iQfCOsoy6rVpGer3exxO4Qs+sxSf0nXpteLzgDHlXD dweAi4XQ8+I3Em35DnJzYElMGW0TfxpxQQSGm1F+rGYFpTn0jnfeVU9PXgNq5x3yFe +7mhuT9R1Fm0IVyIJatobDRijXV1Vqw//5yCs8CncuFGuAZg1sX0yAQjRTVFiTMALj QGWdMmIImYgy5MWTWL0caF4VkHEOUFbUhNmJ8bnLaruwBK/DRpxSp3BCDRpx8UYxeu VL8mwxOZrMT5wXRTro6ayWjHc1155QSTqeVrKmE+PXYaV/gRpudINXE8CWLztOubni fQTebcCAU48Cg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vincent Whitchurch , Jaehoon Chung , Ulf Hansson , Sasha Levin Subject: [PATCH 5.13 086/127] mmc: dw_mmc: Fix hang on data CRC error Date: Tue, 24 Aug 2021 12:55:26 -0400 Message-Id: <20210824165607.709387-87-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Whitchurch [ Upstream commit 25f8203b4be1937c4939bb98623e67dcfd7da4d1 ] When a Data CRC interrupt is received, the driver disables the DMA, then sends the stop/abort command and then waits for Data Transfer Over. However, sometimes, when a data CRC error is received in the middle of a multi-block write transfer, the Data Transfer Over interrupt is never received, and the driver hangs and never completes the request. The driver sets the BMOD.SWR bit (SDMMC_IDMAC_SWRESET) when stopping the DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed "before assertion of SWR". Do these operations in the recommended order. With this change the Data Transfer Over is always received correctly in my tests. Signed-off-by: Vincent Whitchurch Reviewed-by: Jaehoon Chung Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210630102232.16011-1-vincent.whitchurch@axis.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index d333130d1531..c3229d8c7041 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2018,8 +2018,8 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t) continue; } - dw_mci_stop_dma(host); send_stop_abort(host, data); + dw_mci_stop_dma(host); state = STATE_SENDING_STOP; break; } @@ -2043,10 +2043,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t) */ if (test_and_clear_bit(EVENT_DATA_ERROR, &host->pending_events)) { - dw_mci_stop_dma(host); if (!(host->data_status & (SDMMC_INT_DRTO | SDMMC_INT_EBE))) send_stop_abort(host, data); + dw_mci_stop_dma(host); state = STATE_DATA_ERROR; break; } @@ -2079,10 +2079,10 @@ static void dw_mci_tasklet_func(struct tasklet_struct *t) */ if (test_and_clear_bit(EVENT_DATA_ERROR, &host->pending_events)) { - dw_mci_stop_dma(host); if (!(host->data_status & (SDMMC_INT_DRTO | SDMMC_INT_EBE))) send_stop_abort(host, data); + dw_mci_stop_dma(host); state = STATE_DATA_ERROR; break; } -- 2.30.2