Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1239177imm; Tue, 2 Oct 2018 05:14:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV61RD6smtJXGPl+gyagNXFx7oT694M/Y6wWugcH05kb+vv64EkqayiQ5pEgyjzkpSRhJ5sWz X-Received: by 2002:a62:9b9a:: with SMTP id e26-v6mr16402101pfk.181.1538482460009; Tue, 02 Oct 2018 05:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538482459; cv=none; d=google.com; s=arc-20160816; b=oOfa1b097+o+kOdMYTocBWAwcGxrqWsWPjwdNQgBuV88PRlwKny7+GAMiMbPs2WK73 EZwnygQff6O4lhcQahhXOEoD2w1c8XF65gHUTAMv8wjn4LXIeUyFsktI8K5yCvulMsp7 GdfrSP3o0B1GBXCTfsJFtdmt2lhZ4FSfGlm6gK4C+K6sTPxJS4I4CjXyU3p6SHyUV9ZP QIz3w67Why1rAAjdn5c0USzNU0ulyUiz+0QdTjoC1C6s8pGzwQChJXoTt8at6HtaL13P YHTp4ck4MDkdbHpQXW5DUYDbAV+t9UWGLqfATwBjN8dDzfop+PSrknyc3IBe4HFp28CA qRBw== 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=grjok4+DhXqsJ6wUM+IRTRztU5E5VHEmqRji65PqnRg=; b=foDXrcJF1pvk8+p3q243veCc6Xjy8des7QNhi7xv8G8/1JMScxhZ71c3dqCvGHTa0b CpuEWPMd+V38lXambBdd8G385WrRdV0zGSq6NOYDR9fUDvNBHG0rsVO9vH8hHjUSJ5rH BJ7Q+ce7lQuCn0OU+fcPfCSiDInSF4PegPJRT5YfYJ59TL/OuT9TpVPffZ03A5Q4c73t dZwitp0Q7Q8RTBfk4xcINQIXDZjyNZtBVMKv7uFG38VZmLdxPNOdOSw8KzW37kY/43qe eThSZv56MekKr3VudjyZf2pR/aecVLyMa1yOaHUGBNC6dkYokVrmmjHY+A9L48m72WEY sCLQ== 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 y20-v6si3375092pgl.125.2018.10.02.05.14.05; Tue, 02 Oct 2018 05:14:19 -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 S1728314AbeJBSzE (ORCPT + 99 others); Tue, 2 Oct 2018 14:55:04 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:53947 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727582AbeJBSxE (ORCPT ); Tue, 2 Oct 2018 14:53:04 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w92C8fpe013776; Tue, 2 Oct 2018 14:09:53 +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 2msxh6gskv-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 02 Oct 2018 14:09:53 +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 E000F31; Tue, 2 Oct 2018 12:09:52 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C2BD12A3B; Tue, 2 Oct 2018 12:09:52 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 2 Oct 2018 14:09:52 +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; Tue, 2 Oct 2018 14:09:52 +0200 From: Ludovic Barre To: Ulf Hansson , Rob Herring CC: Maxime Coquelin , Alexandre Torgue , , Gerald Baeza , Loic Pallardy , , , , , , Ludovic Barre Subject: [PATCH V4 10/25] mmc: mmci: add dma_error callback Date: Tue, 2 Oct 2018 14:09:12 +0200 Message-ID: <1538482167-13819-11-git-send-email-ludovic.Barre@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482167-13819-1-git-send-email-ludovic.Barre@st.com> References: <1538482167-13819-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-10-02_03:,, 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 adds dma_error callback at mmci_host_ops to allow to call specific variant. Signed-off-by: Ludovic Barre --- drivers/mmc/host/mmci.c | 25 +++++++++++++++---------- drivers/mmc/host/mmci.h | 2 ++ drivers/mmc/host/mmci_qcom_dml.c | 1 + 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index d8e7b6a..1835d77 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -461,6 +461,15 @@ void mmci_dma_finalize(struct mmci_host *host, struct mmc_data *data) host->ops->dma_finalize(host, data); } +void mmci_dma_error(struct mmci_host *host) +{ + if (!host->use_dma) + return; + + if (host->ops && host->ops->dma_error) + host->ops->dma_error(host); +} + static void mmci_request_end(struct mmci_host *host, struct mmc_request *mrq) { @@ -625,11 +634,11 @@ 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) +void mmci_dmae_error(struct mmci_host *host) { struct mmci_dmae_priv *dmae = host->dma_priv; - if (!host->use_dma || !dma_inprogress(host)) + if (!dma_inprogress(host)) return; dev_err(mmc_dev(host->mmc), "error during DMA transfer!\n"); @@ -666,7 +675,7 @@ void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data) * contiguous buffers. On TX, we'll get a FIFO underrun error. */ if (status & MCI_RXDATAAVLBLMASK) { - mmci_dma_data_error(host); + mmci_dma_error(host); if (!data->error) data->error = -EIO; } else if (!data->host_cookie) { @@ -847,13 +856,9 @@ static struct mmci_host_ops mmci_variant_ops = { .dma_release = mmci_dmae_release, .dma_start = mmci_dmae_start, .dma_finalize = mmci_dmae_finalize, + .dma_error = mmci_dmae_error, }; #else -/* Blank functions if the DMA engine is not available */ -static inline void mmci_dma_data_error(struct mmci_host *host) -{ -} - static struct mmci_host_ops mmci_variant_ops = {}; #endif @@ -1031,7 +1036,7 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, u32 remain, success; /* Terminate the DMA transfer */ - mmci_dma_data_error(host); + mmci_dma_error(host); /* * Calculate how far we are into the transfer. Note that @@ -1177,7 +1182,7 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, if ((!sbc && !cmd->data) || cmd->error) { if (host->data) { /* Terminate the DMA transfer */ - mmci_dma_data_error(host); + mmci_dma_error(host); mmci_stop_data(host); } diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index fcdb69d..2c9e679 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -282,6 +282,7 @@ struct mmci_host_ops { void (*dma_release)(struct mmci_host *host); int (*dma_start)(struct mmci_host *host, unsigned int *datactrl); void (*dma_finalize)(struct mmci_host *host, struct mmc_data *data); + void (*dma_error)(struct mmci_host *host); }; struct mmci_host { @@ -345,3 +346,4 @@ int mmci_dmae_setup(struct mmci_host *host); void mmci_dmae_release(struct mmci_host *host); int mmci_dmae_start(struct mmci_host *host, unsigned int *datactrl); void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data); +void mmci_dmae_error(struct mmci_host *host); diff --git a/drivers/mmc/host/mmci_qcom_dml.c b/drivers/mmc/host/mmci_qcom_dml.c index 9725762..a669190 100644 --- a/drivers/mmc/host/mmci_qcom_dml.c +++ b/drivers/mmc/host/mmci_qcom_dml.c @@ -190,6 +190,7 @@ static struct mmci_host_ops qcom_variant_ops = { .dma_release = mmci_dmae_release, .dma_start = mmci_dmae_start, .dma_finalize = mmci_dmae_finalize, + .dma_error = mmci_dmae_error, }; void qcom_variant_init(struct mmci_host *host) -- 2.7.4