Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3318157imc; Wed, 13 Mar 2019 14:47:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqx27LODDnLkQhGXRnET6RWVvpXUgXLMzk0KaXIt70GPDf/t4NuikHenkRijh4LRwNutA1Ua X-Received: by 2002:a63:e050:: with SMTP id n16mr41960554pgj.210.1552513621779; Wed, 13 Mar 2019 14:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552513621; cv=none; d=google.com; s=arc-20160816; b=ZOOwl/NhX/9K9IGI/wFBHiDTh++Cu484rus3h7nROxIdhaasI5Ofl/Xi/BXaf4YeNv rB+fk6MRmmDL++wmLqd0YT+6G3+kQvciBFqkxQBLJej0s5YWyeMUPituCf4d/MX5iv0q Wi/EyuWh620avkOaXvuURpPe/SBLSmaEIDRT6jI6+pRYY0g+Dy/ZGN+W+zsiIH+xsN+Y S/q+U5aJDHhIsc/8EughQ+njl6WGeii7ZGNAkVxi9YUe3MLIL4Eew5fclDo47gBO5YmM K9152jq+8Z+RpU91Vwu+0qZKzIIPKM3t21+1N+s4Otx686t0xlwJopKI61bqLBTkyJ6P n5ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=QW+qvi1XMAJOuUTjk+X0lOvp6QOHlS0K7vDz+5MBqBI=; b=VWo5V0DZ335TXrTGIBcKUq/0izcENIBOy0Ix2Pqk8qaXFPZqT2TOfo8IqM/0O5O2BB /FZmDuyFlBaIUOBZgrtAbQ5UWRsYv7TA8b9rk/gejL3cpiBTtotUNMTinen3rLr4bBnv Bsxo/wWCozHmyt5jIcBAo0nVY4YAzqIghjeezbLIgxeFXs/W4KtHPmTjGw0C1XMfAxHh CVC/thRYgGE2qt2LNjRzGF/SiDT7uZ05tzvReurwQj2JeGWGWz7ygql6Y50RlArNHKB0 TqO21kKSs7i8YbUkA0IQLJmKp2bs1SqAjv+bPrjH3fGkK46snc/tcyGmHZJ1xi931qQT S6YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="qjCiAu/N"; 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=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si10795578pgs.207.2019.03.13.14.46.31; Wed, 13 Mar 2019 14:47:01 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b="qjCiAu/N"; 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=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727489AbfCMVp5 (ORCPT + 99 others); Wed, 13 Mar 2019 17:45:57 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:19108 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726861AbfCMVp4 (ORCPT ); Wed, 13 Mar 2019 17:45:56 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 13 Mar 2019 14:45:54 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 13 Mar 2019 14:45:55 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 13 Mar 2019 14:45:55 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 13 Mar 2019 21:45:55 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 13 Mar 2019 21:45:55 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.103.74]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Wed, 13 Mar 2019 14:45:55 -0700 From: Sowjanya Komatineni To: , , , , CC: , , , , , , , Subject: [PATCH V3 02/10] mmc: sdhci: allow host to specify maximum tuning loops Date: Wed, 13 Mar 2019 14:45:44 -0700 Message-ID: <1552513552-23423-2-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552513552-23423-1-git-send-email-skomatineni@nvidia.com> References: <1552513552-23423-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1552513554; bh=QW+qvi1XMAJOuUTjk+X0lOvp6QOHlS0K7vDz+5MBqBI=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=qjCiAu/NdrlJzRvytmACxFQh1FaedVk33MdoFsPqbOV+uf4x+ztirvnPSDY/ObkTz cDom2Kk2687ayBHW0SCuPou8WvSeechWpWwpFq1VTAf6FxQbjb801RsGV4OfSUJjm7 PrPLuAiKmun85u3UOsmzmkIWOK5dclfOVY6821qXJurFzlq16AFaSk9M+X1Kk4QVLG k/44rbf6ObUo9fpGdlkSaDWrsGCTlCyAQKc6LN5H4W1rcMcYGihAw+qXMtHbeE831E NylWfl738UCGHhPJ+XXXeiekUow+pBAPG2wtwPZSg4Q6TYjKvggjWqWkb4mq7M6xW2 x4UoWDZdDFmhA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As per the Host Controller Standard Specification Version 4.20, limitation of tuning iteration count is removed as PLL locking time can be longer than UHS-1 tuning due to larger PVT fluctuation and it will result in increase of tuning iteration to complete the tuning. This patch creates sdhci_host member tuning_loop_count to allow hosts to specify maximum tuning iterations and also updates execute_tuning to use this specified maximum tuning iteration count. Default tuning_loop_count is set to same as existing loop count of MAX_TUNING_LOOP which is 40 iterations. Tested-by: Jon Hunter Signed-off-by: Sowjanya Komatineni --- drivers/mmc/host/sdhci.c | 5 +++-- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a8141ff9be03..bbc0e0bb7128 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2369,9 +2369,9 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) /* * Issue opcode repeatedly till Execute Tuning is set to 0 or the number - * of loops reaches 40 times. + * of loops reaches tuning loop count. */ - for (i = 0; i < MAX_TUNING_LOOP; i++) { + for (i = 0; i < host->tuning_loop_count; i++) { u16 ctrl; sdhci_send_tuning(host, opcode); @@ -3494,6 +3494,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev, host->cqe_err_ier = SDHCI_CQE_INT_ERR_MASK; host->tuning_delay = -1; + host->tuning_loop_count = MAX_TUNING_LOOP; host->sdma_boundary = SDHCI_DEFAULT_BOUNDARY_ARG; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 01002cba1359..57bb3e3dca89 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -596,6 +596,7 @@ struct sdhci_host { #define SDHCI_TUNING_MODE_3 2 /* Delay (ms) between tuning commands */ int tuning_delay; + int tuning_loop_count; /* Host SDMA buffer boundary. */ u32 sdma_boundary; -- 2.7.4