Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp512037ybl; Thu, 22 Aug 2019 00:09:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc6crVnpln6NZXbwFIYaiKHxlud5oElHJF1iiJgy/a7abd8fxNH8CP95jXZBC/Sm6UIe6s X-Received: by 2002:a17:90a:374a:: with SMTP id u68mr3971624pjb.4.1566457782982; Thu, 22 Aug 2019 00:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566457782; cv=none; d=google.com; s=arc-20160816; b=cxJgwxqIjxGBnokiXWwMjmi/TFcHNIXG2XIoqhOusHVTCfgOfrw3LrEx51Ee0tjmSe iQEIFgCZVUIA48qfNlhAIXaQCg/CjoB2G24dX4vgRlQjg2jvtGyA42I+Fm0OW/VbreNx IzQ4GhH0UQDW0njj61jB9ycB3tmlSxT/ZfM75I+0sa4mpy4Auy183xNUcgWDli5qFygS oLN7sRGnFqowjWMpWl/L+0KD2yA/M5Yo/F9VBbNdItsSAfP5Nw5MVUM8xBiHhpGOEsL1 xOCtqKcpdfHDntMwESmCDRdViRyNcf5zszPXKj75aWs+CVp3J1+ZMBvCH+24mQGSbv+u RZTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ke0cPZXGFr+5GuA+3m7Pz9thwRA4reKhRqhkBK6NQXM=; b=K4lTGugE8TiB4tWMbEQGOYrpICQUZ/odRPJ+J/JW5ArjbunIBhC6Tt0qinQHajXVYJ 31Q9ujASxmLFWJH+bA71dzPmwLpgWP5Ot4PtvX6Mlcw6v5/YY2EFjlf+BQXHc0v4Msrh NFJ80hawclcOLsPDorhw13tEfcZBEDOXedSY5YZEQp4DSy9cAkCMmVdMja9ahZmtAw7f XOK3LgljxjTrCGFcRuiSXgBzxECyDZ6W0vVlKFWU6A6T0lIrZmcU1GDf8cbIYeAVwPhD RZbQx3egUAREsFca5m5U/BTAgANYTwzV6PsYZVtrzwrmpbTPClSfBIFACUiFKcvzqXgl WlSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14si18074704pfk.149.2019.08.22.00.09.27; Thu, 22 Aug 2019 00:09:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731797AbfHVGrw (ORCPT + 99 others); Thu, 22 Aug 2019 02:47:52 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:36606 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730847AbfHVGrw (ORCPT ); Thu, 22 Aug 2019 02:47:52 -0400 X-UUID: d10dbf6d7c35481eab53d1268eb088cf-20190822 X-UUID: d10dbf6d7c35481eab53d1268eb088cf-20190822 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1283895172; Thu, 22 Aug 2019 14:47:48 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 22 Aug 2019 14:47:42 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 22 Aug 2019 14:47:42 +0800 From: Chaotian Jing To: Ulf Hansson CC: Chaotian Jing , Matthias Brugger , , , , , Subject: [PATCH 1/2] mmc: mediatek: fix controller busy when plug out SD Date: Thu, 22 Aug 2019 14:47:40 +0800 Message-ID: <20190822064741.11196-2-chaotian.jing@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190822064741.11196-1-chaotian.jing@mediatek.com> References: <20190822064741.11196-1-chaotian.jing@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when plug out SD card, may get data CRC error, the MMC core will issue CMD13 to get card status, then CMD13 timeout(due to card plug out) will trigger CMD19 tuning, first CMD19 timeout has not call msdc_reset_hw() and cause the next CMD19 gets controller busy. Signed-off-by: Chaotian Jing --- drivers/mmc/host/mtk-sd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 33f4b6387ef7..5cc422e5db69 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -1071,11 +1071,13 @@ static bool msdc_cmd_done(struct msdc_host *host, int events, } if (!sbc_error && !(events & MSDC_INT_CMDRDY)) { - if (cmd->opcode != MMC_SEND_TUNING_BLOCK && - cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200) + if (events & MSDC_INT_CMDTMO || + (cmd->opcode != MMC_SEND_TUNING_BLOCK && + cmd->opcode != MMC_SEND_TUNING_BLOCK_HS200)) /* * should not clear fifo/interrupt as the tune data - * may have alreay come. + * may have alreay come when cmd19/cmd21 gets response + * CRC error. */ msdc_reset_hw(host); if (events & MSDC_INT_RSPCRCERR) { -- 2.18.0