linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Faiz Abbas <faiz_abbas@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>,
	<linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>
Cc: <ulf.hansson@linaro.org>, <adrian.hunter@intel.com>
Subject: Re: [PATCH] mmc: sdhci-omap: Workaround errata regarding SDR104/HS200 tuning failures (i929)
Date: Fri, 30 Nov 2018 11:26:26 +0530	[thread overview]
Message-ID: <c4704766-7a58-8aa4-6bc0-b9373b15096c@ti.com> (raw)
In-Reply-To: <cb1e8e88-4c9d-741d-79cd-57b03c5e0808@ti.com>

Hi Kishon,

On 30/11/18 10:10 AM, Kishon Vijay Abraham I wrote:
> Hi Faiz,
> 
> On 30/11/18 12:35 AM, Faiz Abbas wrote:
>> Errata i929 in certain OMAP5/DRA7XX/AM57XX silicon revisions
>> (SPRZ426D - November 2014 - Revised February 2018 [1]) mentions
>> unexpected tuning pattern errors. A small failure band may be present
>> in the tuning range which may be missed by the current algorithm.
>> Furthermore, the failure bands vary with temperature leading to
>> different optimum tuning values for different temperatures.
>>
>> As suggested in the related Application Report (SPRACA9B - October 2017
>> - Revised July 2018 [2]), tuning should be done in two stages.
>> In stage 1, assign the optimum ratio in the maximum pass window for the
>> current temperature. In stage 2, if the chosen value is close to the
>> small failure band, move away from it in the appropriate direction.
>>
>> References:
>> [1] http://www.ti.com/lit/pdf/sprz426
>> [2] http://www.ti.com/lit/pdf/SPRACA9
>>
>> Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
>> ---
>>  drivers/mmc/host/Kconfig      |  2 +
>>  drivers/mmc/host/sdhci-omap.c | 90 ++++++++++++++++++++++++++++++++++-
>>  2 files changed, 91 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
>> index 1b58739d9744..6d3553f06f27 100644
>> --- a/drivers/mmc/host/Kconfig
>> +++ b/drivers/mmc/host/Kconfig
>> @@ -969,6 +969,8 @@ config MMC_SDHCI_XENON
>>  config MMC_SDHCI_OMAP
>>  	tristate "TI SDHCI Controller Support"
>>  	depends on MMC_SDHCI_PLTFM && OF
>> +	select THERMAL
>> +	select TI_SOC_THERMAL
>>  	help
>>  	  This selects the Secure Digital Host Controller Interface (SDHCI)
>>  	  support present in TI's DRA7 SOCs. The controller supports
>> diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
>> index b3cb39d0db6f..9ccce7ef3a60 100644
>> --- a/drivers/mmc/host/sdhci-omap.c
>> +++ b/drivers/mmc/host/sdhci-omap.c
>> @@ -27,6 +27,7 @@
>>  #include <linux/regulator/consumer.h>
>>  #include <linux/pinctrl/consumer.h>
>>  #include <linux/sys_soc.h>
>> +#include <linux/thermal.h>
>>  
>>  #include "sdhci-pltfm.h"
>>  
>> @@ -286,14 +287,18 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
>>  	struct sdhci_host *host = mmc_priv(mmc);
>>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>>  	struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
>> +	struct thermal_zone_device *thermal_dev;
>>  	struct device *dev = omap_host->dev;
>>  	struct mmc_ios *ios = &mmc->ios;
>>  	u32 start_window = 0, max_window = 0;
>> +	bool single_point_failure = false;
>>  	u8 cur_match, prev_match = 0;
>>  	u32 length = 0, max_len = 0;
>>  	u32 phase_delay = 0;
>> +	int temperature;
>>  	int ret = 0;
>>  	u32 reg;
>> +	int i;
>>  
>>  	/* clock tuning is not needed for upto 52MHz */
>>  	if (ios->clock <= 52000000)
>> @@ -303,6 +308,16 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode)
>>  	if (ios->timing == MMC_TIMING_UHS_SDR50 && !(reg & CAPA2_TSDR50))
>>  		return 0;
>>  
>> +	thermal_dev = thermal_zone_get_zone_by_name("cpu_thermal");
>> +	if (IS_ERR(thermal_dev)) {
>> +		dev_err(dev, "Unable to get thermal zone for tuning\n");
>> +		return PTR_ERR(thermal_dev);
>> +	}
> 
> Can't we get thermal zone once during probe?
> 

Tuning is also (ideally) supposed to happen only once per enumeration.
Also it doesn't make sense to get a thermal zone for lower speed systems
that won't do tuning.

Thanks,
Faiz

  reply	other threads:[~2018-11-30  5:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 19:05 [PATCH] mmc: sdhci-omap: Workaround errata regarding SDR104/HS200 tuning failures (i929) Faiz Abbas
2018-11-30  4:40 ` Kishon Vijay Abraham I
2018-11-30  5:56   ` Faiz Abbas [this message]
2018-12-05 13:50     ` Ulf Hansson
2018-12-10 13:25       ` Faiz Abbas
2018-12-10 13:45         ` Ulf Hansson
2018-12-10 14:07           ` Faiz Abbas
2018-12-10 15:25             ` Ulf Hansson
2018-12-10 16:45               ` Faiz Abbas
2018-12-10 16:56                 ` Ulf Hansson
2018-12-11 12:00                   ` Faiz Abbas
2018-11-30 10:44 ` Faiz Abbas
2018-12-05  9:21 ` Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4704766-7a58-8aa4-6bc0-b9373b15096c@ti.com \
    --to=faiz_abbas@ti.com \
    --cc=adrian.hunter@intel.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).