Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2907200pxb; Tue, 24 Aug 2021 10:19:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylBNFB+hk+yycIjwJePHwfKEjtIJe++XFJCt5PDFIBw/HTVBKzxuG9KxZdWv/so9Sw9a2M X-Received: by 2002:a05:6402:214d:: with SMTP id bq13mr43833788edb.263.1629825584878; Tue, 24 Aug 2021 10:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825584; cv=none; d=google.com; s=arc-20160816; b=D/pfPIFNIkRq87nc7FwjgqXVf4WYNpX+K+IQksiUguTPmbeKnMvygYexVjK3y1VVvh O5jzJP/fLFdJ06oaGd65OIQtVuqLdBsau1X/80Jt0ncQdslrpxLcsq3yMXiUJKO/QaQO pXmMWphbmFhmRbCkvDblgwjWF8yL8Hbx1/eaylNe/Z8mOCfcWMvn+iJ06HJEB6RJQ52g soSmz+p0Tz0B1QqBcLhS/xTYUtnUrRfMkMG6YltTdhcKz0k9sFCL3PUUmQIrr3+r4/SO C5E+yg/RyrcdBcGCrWXqZkSStmeUMMzJRDiYogVwrswkfpW8Xoed8M1N/gn2Dc4wdA3f KzuA== 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=eMcNqkIu0aBttJlHwLv+i/WDZ0EFuuGedvwkpq+o1Ns=; b=aUo505c/SyeFcYVEBKTITnlZrwtIvvWEo59tAmrjJbFib2cbX3O9gFijmyDAnNI6Mc /rfFavBU/xjdKISvJvOa+lSsXDICTIG9xYFdTAh2604njOvbiBK+j05AqJsk8S48+0TQ u/+sNl4013lrymAzrlDTZnOWTMH/zXoBhkrTa45TliHdwwpqCSi5Ey8v+M/ke7cmvp3I vPpZKRcu1+p2PUcd/p9GjGKrqI0bbGCffvwPu8efnrqDWuEsWzJt05Og9yTj1VKn4v++ m2R7KV/am7dwVxwqI7XtORoBmuPkmqn8Z6f3yGxQBdTRkvj/ThaBlBfw9W6DZZFbJSoh 216Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sYJceqbW; 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 k14si6240262eds.379.2021.08.24.10.19.21; Tue, 24 Aug 2021 10:19:44 -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=sYJceqbW; 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 S238685AbhHXRSe (ORCPT + 99 others); Tue, 24 Aug 2021 13:18:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239869AbhHXRQZ (ORCPT ); Tue, 24 Aug 2021 13:16:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C59761ABA; Tue, 24 Aug 2021 17:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824514; bh=O5HzXeKbZqXP1QiRD4iUirzXsP6jVjs5v7mFHjcSywE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sYJceqbWZ+K98bf+D0OT86pDRxcvHaSUJx7iUf7RiRJ+5wiFPbKGHMpwDneq8Ajc1 xh8k7rMxykGerNkMv4orFYdoeIDKQB76nlnzPIg3WKDTFkjX+mjFYBuaYF74e3hJUZ TWCFBidQYPSvkrtIpnUOeeeFcKvflFHcKjr12/6GAyDZC866eYwCiasvtDSf2kLZKF sKuUFu0/pMpsAV1+zFhC3M6ejjoknk/BxFNJsQIKDInBKVsLBFQELKrCEMm5M5ufCp YtRmoMTcyN06AGjNHmX/65QNbObmBmMn9x1W4EHQ8SFmrPOYQG0fKcYR2HiRSXpInq V7u7j1FAcgIjg== 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.4 46/61] mmc: dw_mmc: Fix hang on data CRC error Date: Tue, 24 Aug 2021 13:00:51 -0400 Message-Id: <20210824170106.710221-47-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170106.710221-1-sashal@kernel.org> References: <20210824170106.710221-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.143-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.143-rc1 X-KernelTest-Deadline: 2021-08-26T17:01+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 79c55c7b4afd..6ace82028667 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2017,8 +2017,8 @@ static void dw_mci_tasklet_func(unsigned long priv) continue; } - dw_mci_stop_dma(host); send_stop_abort(host, data); + dw_mci_stop_dma(host); state = STATE_SENDING_STOP; break; } @@ -2042,10 +2042,10 @@ static void dw_mci_tasklet_func(unsigned long priv) */ 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; } @@ -2078,10 +2078,10 @@ static void dw_mci_tasklet_func(unsigned long priv) */ 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