Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp902321ybl; Wed, 8 Jan 2020 07:46:09 -0800 (PST) X-Google-Smtp-Source: APXvYqx7RcsMYM2ESIN10FcwMblHmbt8j5LTe5bC5NUjUccC3G8vhHey+UhrXB1F07fjMIwOyvyC X-Received: by 2002:aca:3241:: with SMTP id y62mr3493656oiy.31.1578498368945; Wed, 08 Jan 2020 07:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578498368; cv=none; d=google.com; s=arc-20160816; b=ru9+BoHxgQK6b4n8Hz77VlfqfP1SWfLdDpMi1KoRJfQyKMLGa9KvoKZZfPMKnxYCz3 ytQfaSav7YVVfO0YXE/RAbvNl6dIASCg2f7PSCpsnCW6Nq0Svlo5Tw+OvDq1bAvyOGyQ 8ApiulOt/AMG/DC8u5kcR4NsjoIHq2dJ+LwqcsFbPlkQIOh7JxIB1lZeLVKezmbUclXh vEaRw46jblLCruvls8oIHj5tUwxP9VIxlFDEl/bYndx3/eahTD19+w/fGzdo85vrwTus G82bY0Vh1wRY+M1M2zpJg5Sj4hy+sezg5xw0cAJV0KLjX0Hrov356K4lUgL/YQ4g8Fqn WDIw== 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 :dkim-signature; bh=41b0Bw5apTGi3W8sULpHQq8iAC1XNiFSJMxQOGad/Is=; b=g8WytzW7XpuiROgKP0CxnmihUmSkg70U1v9G40qLEIgfqqLhi0cnpIuILskeDXstLf jxyv399D2WdC+Cv+RkVaOYaoZp3Wvpy2ArgMxnD8knjK+d2S1Qdd9ubWCpXT0POceSLq 0VvAecK0IBfGdxIZkYUuTEBRUELFd4k9aKRwXvArb560Gls6FTEL6xqxh5tQ3eSH6UPB miqgo7cdtdT0Oj1G0gTIB6ulaNfh2TmBDgL8IBJ3gMnjbi5A6k0HXSq7b1tBHgXkjSew lf4HkZWDlWkwPHWd+rV1RgG8I6QF1841U5DSkEL742fGYtV+sd83xXVh3kRIiOfnCAuB xFdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ybK9uNsr; 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=pass (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 v1si2202193otf.161.2020.01.08.07.45.56; Wed, 08 Jan 2020 07:46:08 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ybK9uNsr; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728291AbgAHObl (ORCPT + 99 others); Wed, 8 Jan 2020 09:31:41 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:52732 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728267AbgAHObi (ORCPT ); Wed, 8 Jan 2020 09:31:38 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 008EVYD1011656; Wed, 8 Jan 2020 08:31:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1578493894; bh=41b0Bw5apTGi3W8sULpHQq8iAC1XNiFSJMxQOGad/Is=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ybK9uNsrWxaCboZN+nVS9HSVUNKB+fm4eEbi9D27YqGk5Sxd3RC1U7pgPQyzES/2S cn9FS9JDjUNaVPVi819Foqv7F7T8oPGdrZnQDSj87KwL2GSKDO1pwkVI0VRYFIh7/I +kMk43830q5VFdXWnuPDHe/24PyGjvYk+t1ogn1Q= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 008EVYm2056122 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 8 Jan 2020 08:31:34 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Wed, 8 Jan 2020 08:31:34 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.1847.3 via Frontend Transport; Wed, 8 Jan 2020 08:31:34 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 008EVS9W112013; Wed, 8 Jan 2020 08:31:32 -0600 From: Faiz Abbas To: , CC: , , Subject: [PATCH 2/3] mmc: sdhci_am654: Reset Command and Data line after tuning Date: Wed, 8 Jan 2020 20:03:00 +0530 Message-ID: <20200108143301.1929-3-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20200108143301.1929-1-faiz_abbas@ti.com> References: <20200108143301.1929-1-faiz_abbas@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 The tuning data is leftover in the buffer after tuning. This can cause issues in future data commands, especially with CQHCI. Reset the command and data lines after tuning to continue from a clean state. Fixes: 41fd4caeb00b ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver") Cc: stable@vger.kernel.org Signed-off-by: Faiz Abbas --- drivers/mmc/host/sdhci_am654.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c index 2d38b1e12a7e..59c0c41b3739 100644 --- a/drivers/mmc/host/sdhci_am654.c +++ b/drivers/mmc/host/sdhci_am654.c @@ -240,6 +240,22 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg) writeb(val, host->ioaddr + reg); } +static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode) +{ + struct sdhci_host *host = mmc_priv(mmc); + int err = sdhci_execute_tuning(mmc, opcode); + + if (err) + return err; + /* + * Tuning data remains in the buffer after tuning. + * Do a command and data reset to get rid of it + */ + sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + + return 0; +} + static struct sdhci_ops sdhci_am654_ops = { .get_max_clock = sdhci_pltfm_clk_get_max_clock, .get_timeout_clock = sdhci_pltfm_clk_get_max_clock, @@ -546,6 +562,8 @@ static int sdhci_am654_probe(struct platform_device *pdev) goto pm_runtime_put; } + host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning; + ret = sdhci_am654_init(host); if (ret) goto pm_runtime_put; -- 2.19.2