Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp441659imm; Fri, 21 Sep 2018 02:52:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZP5+X+iHb55BQyyIOeAAyblNdPQysG/2gVgRufH9aruLskY+RmAX8KNon2UN2aJxTu2KXn X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr43930289plp.159.1537523520148; Fri, 21 Sep 2018 02:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537523520; cv=none; d=google.com; s=arc-20160816; b=ALGB5vp00YxDcjX+bk1hci31l+bLHHCtgBdymmfvpocNoVKcvmG+bX8OqZfmrdjCiS sKbgctBg9pYj/BOnuw+bQsnUGgcyIR7HAeA18ikMMqh4dQlU6gZc6nvwHiDO7NAqOGPn Y3TzQm7gF+vkL8NsBLcX4OgT4vzma8SAgHQV2E3izHKfnXERrm1z71tQ92GWw4LSi7ba MhHvHIlBPFlSJQZ1C52COVb/xhq+i3xQa2VLPUBxpNZcsLwJSSBBXfxDcTbDuLOgu92D gW3rZiGYCQCzLKCQu/Q4sZU7Bd2Xb2qlZpyp97e1vZO/zeTB4J6dGrdp76yjmbXfgSLF G4LA== 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=ktKs8WTzxH7zVXC75ViU+X6wMYZf9AueIVfmj8QKDJY=; b=oyNr99TUw8WlCzdj8cPTwA7zes3DNOL8hHZsTLK2D9vXro+P2pPjDOMpdcDAuzvPsZ WZcxnBo8Y1OWNoc7YO0E1AwfZ/sQzfzVQAxHUsWBFm5AzGa3veDOPduadEvaGMMpTtCO 84eAv54sys103LyZjkSUqRxKfVhZFx8VvnGOnPg1UhBeIMHajLbhmdC9wvkPuykTVPVT 6iDqxJsP9nL7ZijxZ6EsASDVWefV6og1i2FSukZ1UDg6AMYDYmMrui9gnH4DGdHSuYX9 PlualOw8eSmVkrgEbeGK14MdaJp9y9rTtrLrpsYKVIqyapHvAIv0TS7h5q+Q0qrtbv+L TEXQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8-v6si25342794pfh.353.2018.09.21.02.51.44; Fri, 21 Sep 2018 02:52:00 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389663AbeIUPhi (ORCPT + 99 others); Fri, 21 Sep 2018 11:37:38 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:43247 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389313AbeIUPfQ (ORCPT ); Fri, 21 Sep 2018 11:35:16 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w8L9jK4I001508; Fri, 21 Sep 2018 11:46:31 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2mmkn0u882-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 21 Sep 2018 11:46:31 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9473E31; Fri, 21 Sep 2018 09:46:30 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 67CFD2AC3; Fri, 21 Sep 2018 09:46:30 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 21 Sep 2018 11:46:30 +0200 Received: from lmecxl0923.lme.st.com (10.48.0.237) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 21 Sep 2018 11:46:30 +0200 From: Ludovic Barre To: Ulf Hansson , Rob Herring CC: Maxime Coquelin , Alexandre Torgue , , Gerald Baeza , Loic Pallardy , , , , , , Ludovic Barre Subject: [PATCH V2 01/27] mmc: mmci: internalize dma map/unmap into mmci dma functions Date: Fri, 21 Sep 2018 11:45:55 +0200 Message-ID: <1537523181-14578-2-git-send-email-ludovic.Barre@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537523181-14578-1-git-send-email-ludovic.Barre@st.com> References: <1537523181-14578-1-git-send-email-ludovic.Barre@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.48.0.237] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-21_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ludovic Barre This patch internalizes the management of dma map/unmap into mmci dma interfaces. This allows to simplify and prepare the next dma callbacks for mmci host ops. mmci_dma_unmap was called in mmci_data_irq & mmci_cmd_irq functions and can be integrated in mmci_dma_data_error. Signed-off-by: Ludovic Barre --- drivers/mmc/host/mmci.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 1841d250..bf0bb07 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -482,16 +482,6 @@ static inline void mmci_dma_release(struct mmci_host *host) host->dma_rx_channel = host->dma_tx_channel = NULL; } -static void mmci_dma_data_error(struct mmci_host *host) -{ - dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); - dmaengine_terminate_all(host->dma_current); - host->dma_in_progress = false; - host->dma_current = NULL; - host->dma_desc_current = NULL; - host->data->host_cookie = 0; -} - static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) { struct dma_chan *chan; @@ -505,6 +495,18 @@ static void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) mmc_get_dma_dir(data)); } +static void mmci_dma_data_error(struct mmci_host *host) +{ + dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); + dmaengine_terminate_all(host->dma_current); + host->dma_in_progress = false; + host->dma_current = NULL; + host->dma_desc_current = NULL; + host->data->host_cookie = 0; + + mmci_dma_unmap(host, host->data); +} + static void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) { u32 status; @@ -528,10 +530,9 @@ static void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) mmci_dma_data_error(host); if (!data->error) data->error = -EIO; - } - - if (!data->host_cookie) + } else if (!data->host_cookie) { mmci_dma_unmap(host, data); + } /* * Use of DMA with scatter-gather is impossible. @@ -742,10 +743,6 @@ static inline void mmci_dma_release(struct mmci_host *host) { } -static inline void mmci_dma_unmap(struct mmci_host *host, struct mmc_data *data) -{ -} - static inline void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) { @@ -906,10 +903,8 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, u32 remain, success; /* Terminate the DMA transfer */ - if (dma_inprogress(host)) { + if (dma_inprogress(host)) mmci_dma_data_error(host); - mmci_dma_unmap(host, data); - } /* * Calculate how far we are into the transfer. Note that @@ -1055,10 +1050,9 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, if ((!sbc && !cmd->data) || cmd->error) { if (host->data) { /* Terminate the DMA transfer */ - if (dma_inprogress(host)) { + if (dma_inprogress(host)) mmci_dma_data_error(host); - mmci_dma_unmap(host, host->data); - } + mmci_stop_data(host); } mmci_request_end(host, host->mrq); -- 2.7.4