Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1237534imm; Tue, 2 Oct 2018 05:12:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV63J0C0mGxsdRrfl0DxbKb67ggGEWJQN0QRqgn8RsqEghXAS981lASCfcf4lxGgrap1MmSOZ X-Received: by 2002:a63:4107:: with SMTP id o7-v6mr14156717pga.256.1538482375185; Tue, 02 Oct 2018 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538482375; cv=none; d=google.com; s=arc-20160816; b=KiYotSHj5qIiOKF7bCIkGPh6eGCsAIXzW6IYHYKAUixl3apg6wKgb3sulxNO4o0+Pl Yf443Bp3A7fLzfWXNTMIqC1kqSbO4iPW1RMVqmgupJAH1AGB7AafI/F0BPY2qhZHeKeK sbr4bcqxFpG1/SLw/4JSJd8o5gIqa+bmEhaJkG3aGFm/9kU5I8GReYWag21J5JwYdNoB OcBkufXEIbQbK0wq6sI8rdkHGJKJ+iZ8jnkOzhrTsX3jlkKS+oYRTinit3Z8SxA2Cki/ 3waavyfNIoSZeo0pYbA07inoSErxvUBu8tLTdTA4f3mcNiDmMlomCa+1Y2nPAV/9T2Fd 5DFQ== 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=Rbf31TO7e1FDJ7s0jAQ5AkN4jirDoBM9C/320vvoEis=; b=AYja1TWTz3YUTsX0qEyf9YlLn9d1E5w+PDIjvAeVpsnUnZYPW2YmDQ6+ODrQTj8fZK d8P5k0dwGzIitY7mB5ytpzuTUhJh4tm1UZfuw+Ml3tAvvqjzbQg6Rb28Q0MZe0TPZwgX o/1J6bogr+A12sDCvRRHSe0ec/FB5HPNEiiTblOZ4uOqE7Ix4OzwakvrEmPbw872OLbG zXX+cXVlSM8hpwQnou050Yw8KOrBJkIq8wjZXlETTq1l2lSL2WFmSmKq1ZuDtJwXVA5O 4ikCHpqd+tKmssA5lA2B/h+Z+q55x6ErB80/MTGG5WjVZnMHPrdDGIyIbFzrD3W/xfJ+ OoKQ== 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 11-v6si10064147plc.224.2018.10.02.05.12.40; Tue, 02 Oct 2018 05:12:55 -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 S1728152AbeJBSxx (ORCPT + 99 others); Tue, 2 Oct 2018 14:53:53 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:50327 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727794AbeJBSxO (ORCPT ); Tue, 2 Oct 2018 14:53:14 -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 w92C8fpj013776; Tue, 2 Oct 2018 14:10:03 +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 2msxh6gsn4-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 02 Oct 2018 14:10:03 +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 18CC03A; Tue, 2 Oct 2018 12:10:03 +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 C363F2A47; Tue, 2 Oct 2018 12:10:02 +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; Tue, 2 Oct 2018 14:10:02 +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:10:02 +0200 From: Ludovic Barre To: Ulf Hansson , Rob Herring CC: Maxime Coquelin , Alexandre Torgue , , Gerald Baeza , Loic Pallardy , , , , , , Ludovic Barre Subject: [PATCH V4 19/25] mmc: mmci: add variant property to not read datacnt Date: Tue, 2 Oct 2018 14:09:21 +0200 Message-ID: <1538482167-13819-20-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 a boolean property to not read datacnt register. Needed to support the STM32 sdmmc variant. MMCIDATACNT register should be read only after the data transfer is completed. When reading after an error event the read data count value may be different from the real number of data bytes transferred. Signed-off-by: Ludovic Barre --- drivers/mmc/host/mmci.c | 8 ++++++-- drivers/mmc/host/mmci.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index e639841..969b665 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1118,8 +1118,12 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, * can be as much as a FIFO-worth of data ahead. This * matters for FIFO overruns only. */ - remain = readl(host->base + MMCIDATACNT); - success = data->blksz * data->blocks - remain; + if (!host->variant->datacnt_useless) { + remain = readl(host->base + MMCIDATACNT); + success = data->blksz * data->blocks - remain; + } else { + success = 0; + } dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ, status 0x%08x at 0x%08x\n", status_err, success); diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 4e5c6c6..33c243f 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -224,6 +224,8 @@ struct mmci_host; * @datactrl_blksz: block size in power of two * @datactrl_dpsm_enable: enable value for DPSM * @datactrl_first: true if data must be setup before send command + * @datacnt_useless: true if you could not use datacnt register to read + * remaining data * @pwrreg_powerup: power up value for MMCIPOWER register * @f_max: maximum clk frequency supported by the controller. * @signal_direction: input/out direction of bus signals can be indicated @@ -264,6 +266,7 @@ struct variant_data { unsigned int datactrl_blocksz; unsigned int datactrl_dpsm_enable; u8 datactrl_first:1; + u8 datacnt_useless:1; u8 st_sdio:1; u8 st_clkdiv:1; u8 blksz_datactrl16:1; -- 2.7.4