Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2920183pxb; Tue, 24 Aug 2021 10:37:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb7D9CyLs99lux6oPnK4/9gay1l2kjvZiL9rJ3l5czbJHTY+3yCGxWTr+Y8PwtNlcKZaw9 X-Received: by 2002:a05:6e02:dcb:: with SMTP id l11mr27281120ilj.169.1629826630950; Tue, 24 Aug 2021 10:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826630; cv=none; d=google.com; s=arc-20160816; b=Y+JYdlJGO04o792fHhU4u2sSW6qN5B64anL8563P842PMHJ6TySl1wbhhwc/ntjWDX sgZt5dJlt01D9PPFonyq5eP3UWrZYpHRD/mb3Ud9I5HLFWJi1IRzVzeLKJjrCBeTyMyS dXb4VQckQ4QLGLK2Eu+qTHAMjYN56z1dqC3v/8yfrLycAalCA80qfkcQ1aXCV2mdFjZ0 NXKQJrhaHfLzMfrB7LSDrTDc4i81UStbkAEwYQ/43oEbSvl62VdNE+KGIbCPslqqH+EN YfmixzTUpUr6SnhLx0AGbWN3vrzTKZEiZ3CbBrJsakpOriMXOl7PpzBL+cLMI3Sgpgse JVjA== 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=QyiluC2P6QundNsi+C24xpHFA+q1wPxbGNP1VZdjTPk=; b=a5BKTeq/Zy6oii4SmHVcL6eMHUSTiSL/qJzT97FfgEfaJBA0Wvt1ALdoy6oNEb+39J JZt1gwH4VBQqyHUBgyPH0xdt6MO1XwIsx/9/9UhzusfFWYrJJslVvk8jN/8A8kcubaDl 2SN3ntmJgVVdI0EJ7UxVvgPV9yeED8/MgsaG8U0T7t7eOQ/RbaZT3LqctKCmqeUP7c7G dEphXjoaDjIWrs0bd9KjDUSSubC5kxJcSXFbE7NbUJueD3TX47rhO2YDVAb793My3Ux3 2luJw/2ij0TEhq9wqst47t7N7+iPme6qlQ8gAV/RGSygC/lZgcJN5bMJi7J056yXUzWR t1Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K7srGjEi; 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 t1si17680385jao.24.2021.08.24.10.36.59; Tue, 24 Aug 2021 10:37:10 -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=K7srGjEi; 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 S240884AbhHXRg6 (ORCPT + 99 others); Tue, 24 Aug 2021 13:36:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:36772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241635AbhHXRbp (ORCPT ); Tue, 24 Aug 2021 13:31:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 453F761B96; Tue, 24 Aug 2021 17:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824753; bh=oVLv5XqnepR4wcevdVsJ4IsJ/Y6XAJQam7Vejlf2kJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7srGjEiDUqwtjElX2n1/tXJQDVu+kssHazc6OZArUOojYtFxA92Jf83CoM+VhPie yJfjLnryaLA+RItG3Ufa61aO30N022aMIPgYV6cOqA3WZWAdt97tguWMQ8GDItfj6k UYKyAHRSvgiUc4fWVzIotrQmDUvsCjriZy2ksrtfvqNLCHRtkGxJe6/VtDOsYKUfDN OtzOS6PadzlIOiZTABn6gmR5AfLvtTa2NZOQ8JtlRCujT+xqug28ibtqDPicaclWeL Sq2ovd+Pw6v30sGEl7EhImGlSM6FRepGwyYKnZq3vNho8g0f58e/xOlLYgHSwcChdC IwxYdzsUGS+5A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vincent Whitchurch , Jaehoon Chung , Ulf Hansson , Sasha Levin Subject: [PATCH 4.14 56/64] mmc: dw_mmc: Fix hang on data CRC error Date: Tue, 24 Aug 2021 13:04:49 -0400 Message-Id: <20210824170457.710623-57-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170457.710623-1-sashal@kernel.org> References: <20210824170457.710623-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.245-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.245-rc1 X-KernelTest-Deadline: 2021-08-26T17:04+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 32001d43e453..bd994a8fce14 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2051,8 +2051,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; } @@ -2076,10 +2076,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; } @@ -2112,10 +2112,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