Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5851078imb; Fri, 8 Mar 2019 03:54:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxALCQ7bTz/TlQtsZIqlCXCop4V65rARWiP3bsxc4Qj7E4+iTVGSZUjIotZnxgX3MaINyKR X-Received: by 2002:aa7:8847:: with SMTP id k7mr17710250pfo.99.1552046041378; Fri, 08 Mar 2019 03:54:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552046041; cv=none; d=google.com; s=arc-20160816; b=MIGJ/LpdjhnPOmMk/8XwT3XN68LyNPlKOcF0sncyjnj9S76tpSmWMwZ6XPFHai0yuk o59dqliMg8f0xQ33gPLo9j4lc3AGdwPOGeVNKjL3nbsq7VQX4za4BdXxlJEWyCVK58A/ pMNvQTkcJMPoKEynZmJcquf8vLbi0hAhyuio136PU7Y6goQtWI9VAPyjsglyWiVStCL5 FEipvngIbM1ZyTL1i+c5SueDYj8rPfJ1Cx7Ru/KJ/vGGeNrS1ji523i1YcemzsxAWPOV M5Q0g73YOsvmnib0UPwkNCoGx+zJNz/WkGAm6BIkhg8aokWA93AJE/sZ94Bdxyk+SXll zZUQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=lbn84LSJ3dGRMYAVz+Bh7YwVDYLgxq11XOYb2A4dIyk=; b=byFrYqXUfmNfiOBAvmvAx++sjxCQHOr8Me4R9HOrW6kMndVA8GTKBpvmNyid8riYXP kXUL9BR+naHoxUKY7f4R/J19K8Hh8lgSlB123c2Jx8uA1ICJp44pHYerj+Ri692LuEE+ mz08FQifNXiZMpdqUgLuKq7FlStBmzXlSsATY5RDgpZ/rjAjFfikV7U0SRRiBDBURB8U nDudSQ1pKTZy2gT8L1kVX3lmMRJuNu9+F89c/OG2rsfrlpOXLH2KcDkzMKO/LeeEayr7 l6NfWKc98y28CgUbjAhURqVmRt6FFn5xqpOykRSYBzE7M/1zAo12tx8K968g2KOPjv5w La8g== 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h63si6116805pge.457.2019.03.08.03.53.45; Fri, 08 Mar 2019 03:54:01 -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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726387AbfCHLwC (ORCPT + 99 others); Fri, 8 Mar 2019 06:52:02 -0500 Received: from mga18.intel.com ([134.134.136.126]:65017 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726042AbfCHLwB (ORCPT ); Fri, 8 Mar 2019 06:52:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2019 03:52:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,455,1544515200"; d="scan'208";a="129913512" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.56]) ([10.237.72.56]) by fmsmga008.fm.intel.com with ESMTP; 08 Mar 2019 03:51:55 -0800 Subject: Re: [PATCH V1 02/11] mmc: sdhci: allow host to specify maximum tuning loops To: Sowjanya Komatineni , ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, riteshh@codeaurora.org Cc: thierry.reding@gmail.com, jonathanh@nvidia.com, anrao@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org References: <1551504025-3541-1-git-send-email-skomatineni@nvidia.com> <1551504025-3541-2-git-send-email-skomatineni@nvidia.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Fri, 8 Mar 2019 13:50:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <1551504025-3541-2-git-send-email-skomatineni@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/03/19 7:20 AM, Sowjanya Komatineni wrote: > 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 a hook get_max_tuning_loop_count to allow hosts > to specify maximum tuning iterations and updates execute_tuning > to use the specified maximum tuning iteration count. > > Signed-off-by: Sowjanya Komatineni > --- > drivers/mmc/host/sdhci.c | 7 +++++-- > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index a8141ff9be03..e9e919218006 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2366,12 +2366,15 @@ EXPORT_SYMBOL_GPL(sdhci_send_tuning); > static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > { > int i; > + int tuning_loop_count = MAX_TUNING_LOOP; > > + if (host->ops->get_max_tuning_loop_count) > + tuning_loop_count = host->ops->get_max_tuning_loop_count(host); I would prefer to make tuning_loop_count a sdhci_host member initialized to MAX_TUNING_LOOP in sdhci_alloc_host(). Then hook .execute_tuning e.g. host->mmc_host_ops.execute_tuning = tegra_sdhci_execute_tuning; and set up host->tuning_loop_count > /* > * 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 < tuning_loop_count; i++) { > u16 ctrl; > > sdhci_send_tuning(host, opcode); > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index 01002cba1359..c80e0d6f9b10 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -638,6 +638,7 @@ struct sdhci_ops { > unsigned int (*get_ro)(struct sdhci_host *host); > void (*reset)(struct sdhci_host *host, u8 mask); > int (*platform_execute_tuning)(struct sdhci_host *host, u32 opcode); > + int (*get_max_tuning_loop_count)(struct sdhci_host *host); > void (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); > void (*hw_reset)(struct sdhci_host *host); > void (*adma_workaround)(struct sdhci_host *host, u32 intmask); >