Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1836499imu; Wed, 21 Nov 2018 02:44:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/VNg0PRfyba9s2e+vyibWXWD/IomNZe+mHh/jGSEsIitrU0HErME3HlvEab0iHyM9NDfiQ5 X-Received: by 2002:a17:902:f01:: with SMTP id 1mr2757545ply.143.1542797058294; Wed, 21 Nov 2018 02:44:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542797058; cv=none; d=google.com; s=arc-20160816; b=QpupS1bzR/1DxnI9XPIKA2mUP9KMxXU2bfY0Zzd7Qvkh+Ap1n9fwdr+DCrklTftCvD 79znaEWGMkJqAA1F6p5Xv7hVbVlgdSXxhw4Yx0MScGSugZ1azZio5e9zHHNEq7c3rtUa DMEs1OA8RJuVFU5IkWalxTQJlZlhxuCfKAlsKohYfUcddWxdeL8pfrxhMBUxudfITDrf 0s6lAkY5C1oEmzv94QtyKRXywephvPo9ik9ZL9XJlaMqYVo/4W4uDSGVE2EAMGdGrDLn r3R/ugfxiTslgar8V3mIaj3jXfUIeZKs+7RJjKdeAmIhTd3+mSWmq2UUlxfIrQiw6N3n n2GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=womonwYaav8Oj4dkuEphAcvgfIF2mf0DSxSPeDjdVIQ=; b=NmxexYoSY7C24FRTIsFzj39WQP0mBA06BCoD9qx7BPMSatC/jsDVU5XaD4R/4FBvFQ 3IUmTB5aJCWg3ZMBieQ8/0RPx2kHCzxOTDWZy8CwdxeRaTrNvPeOFBFo5glQkdcTixIt zorvkenNJMyOFKj43SYBy4uzc/8m9u81Awcqp4dJz36TBS1kGoV3i9H/BVeHmOalzUrb ndSg2AahZSx6YMBrcCgnMbcmh/3RizujUU6ceO/8Mybkmu4Qw83PECIRfZ2OSTvSqnHJ Bfazo/vH2ZmY7kMwE62mVfkjZ+BxiLxzJ8lJxhwhpjusPQMve2LD33bRWRuLr7TMFPGp 8uoA== 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v190si6301379pfv.8.2018.11.21.02.44.03; Wed, 21 Nov 2018 02:44:18 -0800 (PST) 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729688AbeKUVFO (ORCPT + 99 others); Wed, 21 Nov 2018 16:05:14 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:45634 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726001AbeKUVFN (ORCPT ); Wed, 21 Nov 2018 16:05:13 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id wALAVJZA113317; Wed, 21 Nov 2018 04:31:19 -0600 Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wALAVII2070881 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 21 Nov 2018 04:31:19 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 21 Nov 2018 04:31:18 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 21 Nov 2018 04:31:18 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wALAVECd025951; Wed, 21 Nov 2018 04:31:17 -0600 From: Faiz Abbas To: , CC: , , , Subject: [PATCH v2 1/3] mmc: sdhci-omap: Fix DCRC error handling during tuning Date: Wed, 21 Nov 2018 16:03:55 +0530 Message-ID: <20181121103357.3448-2-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121103357.3448-1-faiz_abbas@ti.com> References: <20181121103357.3448-1-faiz_abbas@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 7d33c3581536 ("mmc: sdhci-omap: Workaround for Errata i802") disabled DCRC interrupts during tuning. This write to the interrupt enable register gets overwritten in sdhci_prepare_data() and the interrupt is not in fact disabled. Fix this by disabling the interrupt in the host->ier variable. Fixes: 7d33c3581536 ("mmc: sdhci-omap: Workaround for Errata i802") Cc: Signed-off-by: Faiz Abbas --- drivers/mmc/host/sdhci-omap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 88347ce78f23..d264391616f9 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -288,9 +288,9 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) struct device *dev = omap_host->dev; struct mmc_ios *ios = &mmc->ios; u32 start_window = 0, max_window = 0; + bool dcrc_was_enabled = false; u8 cur_match, prev_match = 0; u32 length = 0, max_len = 0; - u32 ier = host->ier; u32 phase_delay = 0; int ret = 0; u32 reg; @@ -317,9 +317,10 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) * during the tuning procedure. So disable it during the * tuning procedure. */ - ier &= ~SDHCI_INT_DATA_CRC; - sdhci_writel(host, ier, SDHCI_INT_ENABLE); - sdhci_writel(host, ier, SDHCI_SIGNAL_ENABLE); + if (host->ier & SDHCI_INT_DATA_CRC) { + host->ier &= ~SDHCI_INT_DATA_CRC; + dcrc_was_enabled = true; + } while (phase_delay <= MAX_PHASE_DELAY) { sdhci_omap_set_dll(omap_host, phase_delay); @@ -366,6 +367,9 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) ret: sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + /* Reenable forbidden interrupt */ + if (dcrc_was_enabled) + host->ier |= SDHCI_INT_DATA_CRC; sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); return ret; -- 2.19.1