Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 764ADC433EF for ; Thu, 6 Jan 2022 10:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238185AbiAFKy5 (ORCPT ); Thu, 6 Jan 2022 05:54:57 -0500 Received: from mail-sz.amlogic.com ([211.162.65.117]:36616 "EHLO mail-sz.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238102AbiAFKy4 (ORCPT ); Thu, 6 Jan 2022 05:54:56 -0500 Received: from rd02-sz.amlogic.software (10.28.8.43) by mail-sz.amlogic.com (10.28.11.5) with Microsoft SMTP Server id 15.1.2176.2; Thu, 6 Jan 2022 18:54:55 +0800 From: Rong Chen To: Ulf Hansson , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , <1131046452@qq.com>, , , , CC: <45581586@qq.com>, Rong Chen Subject: [PATCH] mmc: meson: Fix usage of meson_mmc_post_req() Date: Thu, 6 Jan 2022 18:54:53 +0800 Message-ID: <20220106105453.3875119-1-rong.chen@amlogic.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.28.8.43] Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To ensure the DMA moves data correctly from memory to peripherals, DMA unmapping when the MMC request done with calls meson_mmc_post_req(). Signed-off-by: Rong Chen --- drivers/mmc/host/meson-gx-mmc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 8f36536cb1b6..6a9554ae4b1c 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -173,6 +173,7 @@ struct meson_host { int irq; bool vqmmc_enabled; + bool needs_pre_post_req; }; #define CMD_CFG_LENGTH_MASK GENMASK(8, 0) @@ -663,6 +664,8 @@ static void meson_mmc_request_done(struct mmc_host *mmc, struct meson_host *host = mmc_priv(mmc); host->cmd = NULL; + if (host->needs_pre_post_req) + meson_mmc_post_req(mmc, mrq, 0); mmc_request_done(host->mmc, mrq); } @@ -880,7 +883,7 @@ static int meson_mmc_validate_dram_access(struct mmc_host *mmc, struct mmc_data static void meson_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct meson_host *host = mmc_priv(mmc); - bool needs_pre_post_req = mrq->data && + host->needs_pre_post_req = mrq->data && !(mrq->data->host_cookie & SD_EMMC_PRE_REQ_DONE); /* @@ -896,22 +899,19 @@ static void meson_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) } } - if (needs_pre_post_req) { + if (host->needs_pre_post_req) { meson_mmc_get_transfer_mode(mmc, mrq); if (!meson_mmc_desc_chain_mode(mrq->data)) - needs_pre_post_req = false; + host->needs_pre_post_req = false; } - if (needs_pre_post_req) + if (host->needs_pre_post_req) meson_mmc_pre_req(mmc, mrq); /* Stop execution */ writel(0, host->regs + SD_EMMC_START); meson_mmc_start_cmd(mmc, mrq->sbc ?: mrq->cmd); - - if (needs_pre_post_req) - meson_mmc_post_req(mmc, mrq, 0); } static void meson_mmc_read_resp(struct mmc_host *mmc, struct mmc_command *cmd) base-commit: 356f3f2c5756bbb67a515760966a40fc7043cdda -- 2.25.1