Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2452770pxt; Mon, 9 Aug 2021 00:27:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZLDTtKPF7VQDRAtHff4HxExR7exb1IwbS0VDFwF4h2FgU7n97X6oCa1Y4CqjOAaCRf/5s X-Received: by 2002:a02:5dc5:: with SMTP id w188mr21910395jaa.86.1628494059430; Mon, 09 Aug 2021 00:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628494059; cv=none; d=google.com; s=arc-20160816; b=Evac1umtQsscULyH/XpwmPDu80XAYeb+0Q0HbKooS/a86yDECMVOoQCBho3mGAMH8O rUF80nl6Ozw/M983OStw98TFuua9nNIYagb8hYHrZd6i2py6lKApcNsh3kAnAhqyOWS/ k3D7pPkbyVwDUlFDGs4S+D7p7gC21rqug7dJESXEYCCZ2YvfW9Hrxby27eRoIBEyLTE4 HSmgzgSqolaAXsZa/IoM4XonRjNsHKb5ts6+ooGtPnrDuULPhA4T6LPrq3DMqJDOh1NB xdrYPie2waj1+BddhFtP7WIwV/ax4zo53Yh4295GHFZsZgLI20zLU9gnI2V4NYDZOQ71 Ad6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=eWVEmzshf2RMffS9eAHgW4WNbuxU4sIVWqG1Gu+A2sc=; b=Cbez2mz3a8/eY3tRKba+Co6VxSU9B3TSFgDw3BN5r6xP+PqETiQdTaD10kkjd2EkGY 3bvIKhBnCh5X8oplE6gr/iXZQgaOG28mMKS64wn0wXEh/SseyV1+WEhER5Or4SUInkOe F23ppZPB35JNhqOFcCnOR0wRCKRQgStnpgn3H2mrjc5QloX5sXYfgWJZQxWDuwbMqu2n dv6eCAvGAkfBPISeGT5dotuTxyccOYsKERZcJ+6iTT1YDO5S1Tmlxxzp+qinjRUGXE8a ofKPsb9l/baeTZoVZBbsYZITOFL3+wgh+7aFevFcIry5FAVVhdqXQWubOnpQJMDZySCk iRQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y5si16900589ilb.113.2021.08.09.00.27.28; Mon, 09 Aug 2021 00:27:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbhHIH0C (ORCPT + 99 others); Mon, 9 Aug 2021 03:26:02 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:55490 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232094AbhHIHZ7 (ORCPT ); Mon, 9 Aug 2021 03:25:59 -0400 X-UUID: 2574f97aa48d4b3da3cff3efa9822d64-20210809 X-UUID: 2574f97aa48d4b3da3cff3efa9822d64-20210809 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 664108739; Mon, 09 Aug 2021 15:25:29 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 9 Aug 2021 15:25:28 +0800 Received: from localhost.localdomain (10.15.20.246) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 9 Aug 2021 15:25:27 +0800 From: Derong Liu To: Chaotian Jing , Ulf Hansson , Matthias Brugger CC: , , , , , Peng Zhou , Derong Liu Subject: [PATCH v2] mmc: mediatek: add wait dma stop done flow Date: Mon, 9 Aug 2021 15:23:16 +0800 Message-ID: <20210809072315.1127-1-derong.liu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We found this issue on a 5G platform, during CMDQ error handling, if DMA status is active when it call msdc_reset_hw, it means mmc host hw reset and DMA transfer will be parallel, mmc host may access sram region unexpectedly. According to the programming guide of mtk mmc host,it needs to wait for dma stop done after set dma stop. This change should be applied to all SoCs. Signed-off-by: Derong Liu --- drivers/mmc/host/mtk-sd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 4dfc246c5f95..1dfd2842471b 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -2339,6 +2339,8 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery) if (recovery) { sdr_set_field(host->base + MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); + while (readl(host->base + MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) + cpu_relax(); msdc_reset_hw(host); } } -- 2.18.0