Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2901814pxb; Tue, 24 Aug 2021 10:12:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw54mFULvHtdZm1wKML6qumOJrcfzg6lfJAC9ic1jrB0iGBhs4+a5ZRnwIlD4E/6fz12Ev8 X-Received: by 2002:a05:6638:1495:: with SMTP id j21mr35797551jak.117.1629825151129; Tue, 24 Aug 2021 10:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825151; cv=none; d=google.com; s=arc-20160816; b=N/IiToExq5Y0KSgaM2X3sQ6olu1xMMFoF596qBNfi0bvCkqBo95ltSxedWP7lJncsX Vn7ImkybkqFVSWGPFCidvGlkFCfk2hcYZ0vFd5CkAweKvfx0X1ijpbwMlJchQeVt46y7 wdNaBr7ud8hQ8bYCucuQlcfPCByMkX6zuaK8Lyc7yO7Z9s3CfnPui//MNyNuNwbr7wOE RWKCx7k9LNBqqwPG0OMbdOZvxWu257umLm0Z9HoMSXzCdAucGLnIsxlxbxYQ+dRyyTqM z9ocS8KgP2XuMNFHvpQj29ziLWyK4uo8Yq+WRnLsnYJEcXPjzpICcrPpiqllO3qoNLU/ ei5A== 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=7Kavi1/jjIXL4n5dQcVWTNxuv3tggGccKD3yFfUfJ34=; b=adB7ak2l/krNUIz0YUnDXhTTV9oz6BvyZixwnOiM+pUzcxomGtOOU/WNWgFxticwJ4 bDvYjjnL5X/DfqC3u9S8zCyEGutFKmPc8mux9rVe1MO3w3pQwUkYJjAG5QXcjlwbJn83 XA1oY+LxiVDeNDC7I/xOieKX/UkBF7in3Z4+38mt/6DWjDe1sBHkPnQN9hIdL+it72AT BVTt1pLniONM6PdtzyAAHSHwScfLGwBka+6UC/8ulhafg60BtvQ7bHxiHNzJ/ll4/iGy mCBjXHwpYnLaXxa6PSZsnLJ4N6iT8C8Y+40/tEoURjQMLsSHEo5vsZCrddDCDw4DvZQZ 5ymA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zty6pZDl; 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 t7si18084817ilf.11.2021.08.24.10.12.19; Tue, 24 Aug 2021 10:12:31 -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=Zty6pZDl; 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 S239833AbhHXRMT (ORCPT + 99 others); Tue, 24 Aug 2021 13:12:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:52374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239869AbhHXRJl (ORCPT ); Tue, 24 Aug 2021 13:09:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76C6A61A40; Tue, 24 Aug 2021 17:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824423; bh=QfMSsirnkOgIKXhFOWbGMs9yJ4DnGfbiQJ11zupn4Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zty6pZDlhtHCIGVjcl09ZCTSPVZ1JACS2TCfYDkUMqLJnLpfHv5oBtDkZeY53f3RC V4bo9cE7HiNIx3o/soQmGck6FudhGcVq5bNpjXbuE+FqViJb0+XqweBZvPQoZjhdzO preN25Sl8/k77SxKQNora9cifs1zsWv+9Fuwf5/KpB4V0IvHPvvCb8EJM/6kkxMyzm lV4Sav4dtcZnyNHUDLKxee0HtXxlXxjkyrGwhAjPGillFZ7I2zjk8Dahk2r83H+kGj NnzgMPHQrbdXYxKRoRg8zZdfYjwrolzuLnKYb2mcM5AtDs/+Ez58hhGLkeRZpbmMsA CvP+nxXTX9WgA== 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.10 73/98] mmc: dw_mmc: Fix hang on data CRC error Date: Tue, 24 Aug 2021 12:58:43 -0400 Message-Id: <20210824165908.709932-74-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+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 43c5795691fb..8b5d542e20f3 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(unsigned long priv) 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(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; } @@ -2079,10 +2079,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