Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5853252imb; Fri, 8 Mar 2019 03:57:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwcsPLn/IHvQ4qsl+wXh+K9hhFxthlw3bAYQokCQacB2EHrW0dbskR8KyGdyAD1e3fJt2g5 X-Received: by 2002:a63:1cd:: with SMTP id 196mr16503416pgb.58.1552046263957; Fri, 08 Mar 2019 03:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552046263; cv=none; d=google.com; s=arc-20160816; b=qo51Ww5p+rPvlu6A+blw+0QH55Ww1ERInN3syFBPk+g41OOda4WD0Jlc7P9xumBVT/ T6WQJ+zT8LMylIuYbonH/lQm9TBtvZub4r/sfa1bColJu4nWi8E8Yqqq9YBlbFTju9ps vvoNUTEkN8bNhGwdNOoekR19sg7vFWSCkLIkPrKTcNVrwxYMcjSRbRkcL9bDVD6VFqZv U7gcwT9Zh4WknTXcTdbJ7J7zAMvNZSE+noDpmSOH+KLm9zdunezeiKtMsDukd88Dc2jZ ll8rTsk5EsArPRAuCsKEcpxitjCxOqFimGZfJ/MEIBpApunUHbzwKJ+WrnYS5kWR027+ HCxA== 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=y5W39o9enwlvlgMfmGGpOSVIxq+09rWYig8L4HJFzBg=; b=jkms3U5mQbfHAOhh8wp61Knc79/R9yKU1YHaAFTkTX6zGor/X3f7S79LXJbUagf/AC raEP16NTlISOoWX3sXRZF2T0tWAzIz8S0wBeoOpfE40pIHhvKU1+r8kXqZAzVU+sgY/l 5/uOEvz5rqAJ1fWYvssmWOolbWFwvYR/BXeTP9Kqm7WZwQQ15KGcJEbG+6qlxhT0+glh MIKk/cqkoIWsvZuAggltQ0H+FNw6c7O5oktBWCy5PS6J/XE+AX+5vVlcaxUT7wu3aSDm u+zdXwVGdLuQIDMC8uURLay52s/fR3jTedeLJECyg9GYvmCSY1d28Bf3lsETwsTLZNct IuJA== 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 70si7193468ple.294.2019.03.08.03.57.28; Fri, 08 Mar 2019 03:57:43 -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 S1726490AbfCHL4t (ORCPT + 99 others); Fri, 8 Mar 2019 06:56:49 -0500 Received: from mga14.intel.com ([192.55.52.115]:1168 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbfCHL4s (ORCPT ); Fri, 8 Mar 2019 06:56:48 -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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2019 03:56:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,455,1544515200"; d="scan'208";a="129914297" 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:56:42 -0800 Subject: Re: [PATCH V1 03/11] mmc: sdhci: add support for post tuning process 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-3-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:55:11 +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-3-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: > This patch adds support for post tuning process needed for some hosts > to perform after successful completion of HW tuning. > > Signed-off-by: Sowjanya Komatineni > --- > drivers/mmc/host/sdhci.c | 6 +++++- > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index e9e919218006..976d4d1e2400 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2392,8 +2392,12 @@ static int __sdhci_execute_tuning(struct sdhci_host *host, u32 opcode) > > ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); > if (!(ctrl & SDHCI_CTRL_EXEC_TUNING)) { > - if (ctrl & SDHCI_CTRL_TUNED_CLK) > + if (ctrl & SDHCI_CTRL_TUNED_CLK) { > + if (host->ops->post_tuning) > + host->ops->post_tuning(host); > return 0; /* Success! */ I think you can hook .execute_tuning and just check if the return value is zero before doing post tuning. i.e. something like: host->mmc_host_ops.execute_tuning = tegra_sdhci_execute_tuning; int tegra_sdhci_execute_tuning(blah) { int err; err = sdhci_execute_tuning(blah); if (!err) tegra_sdhci_post_tuning(host); } > + } > + > break; > } > > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index c80e0d6f9b10..236d67778645 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -639,6 +639,7 @@ struct sdhci_ops { > 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 (*post_tuning)(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); >