Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3651549imu; Mon, 10 Dec 2018 05:49:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/VdTd7Yfs/fbus47fF0QEQZwWe60OdB8D0VV52CmFuGg9y9JyV4YX6X1wgyvKXKXOH5oaja X-Received: by 2002:a62:184e:: with SMTP id 75mr12205802pfy.28.1544449751973; Mon, 10 Dec 2018 05:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544449751; cv=none; d=google.com; s=arc-20160816; b=xq6yAsQoLJ303hDxO6D4hF55wZL3rSYHn7wBo83hK8WQrEUSd129pifYv2de+z4YTU VSDYvf2QD+UHEo5ZT0n+caHLbSPsY5J+250ScN4sYsH0jpiwBB5tRO3JSkmEZANjkzqI rch69h62sZiBCdRbLjd9IINslvNhMiul4OS0yqrUCEXLtEA5lpCWukKT3mqZp4O+xxWO IFYrCFP4Z82qqA2ZcBTM3aao95EcZvfv6NWHfjnZ9l9EUcWHrQXbStb5dsqz5I9rY6Ot PWmVvKiSe2df47EOyH6+NlGbNoSPyiqqR0UOF4X6ilayCFZdzMG1L4h7PaBudaolUlIJ 73Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6TV7ajHQsygfOEecGhhDayNdG27ntonuMDY16Zvsb7Y=; b=EOxnVXQRlnP7bbQBjWfHb/98ViYqYduP57fWRXD6O0jqGpQDrK87qhyPra1qDhaK2N Ul/utErBhdrhOQhaTy9e+nED6nx12txVw/spuLC1ZdxAjgXeZmsC7OlfNB3o1isx/RfV llQQveoCMMbU38GECESkFDfHhgIE+aiyut95Rv1qfzf2h8+hvYTdELNvIM/KsSzO67Hd PvS/AYPBZw1CyBFpSlrYZ1m2aUrvw25N9f9AOFGhqJ7bK88hOz+JS6vtaCuAv/Q8UIcZ dbR3P1ixdyN4LgAHTbIuK1Lmg9J0Q/GoAzvXX3mPwZVxAR9LJjvD9wEZoF0+8ex8VKjj cTFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kVJ7XqYj; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o61si10375171pld.246.2018.12.10.05.48.56; Mon, 10 Dec 2018 05:49:11 -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=@linaro.org header.s=google header.b=kVJ7XqYj; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727727AbeLJNqL (ORCPT + 99 others); Mon, 10 Dec 2018 08:46:11 -0500 Received: from mail-vs1-f67.google.com ([209.85.217.67]:40197 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbeLJNqL (ORCPT ); Mon, 10 Dec 2018 08:46:11 -0500 Received: by mail-vs1-f67.google.com with SMTP id z3so6637160vsf.7 for ; Mon, 10 Dec 2018 05:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6TV7ajHQsygfOEecGhhDayNdG27ntonuMDY16Zvsb7Y=; b=kVJ7XqYjbPzhe2StSThCmPfqPBL03g0MUjvMYVBniCbzwc5mUvQ810PdHdSOmRmoDD 9FUzmufzbOlWlj/gFACKiqSR8HAJEbgMb/GW+Q8VbyStpNNXci/oF8nRdzvKKzm3k3N2 XxM4X33iAoWw6vZH8/UUnfEfrPal7uAuluKNQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6TV7ajHQsygfOEecGhhDayNdG27ntonuMDY16Zvsb7Y=; b=Qp/vwZqAtC+kg7yomqKYPEoCACDfm79QOWZ+Qwuq6qfZvOe25yw1K04kFsmB2cT5an nFWDeJLr/0jXZRSG1PKWSBypRucqlgPTEPXB9zVaG4du7K5ZeKOBlTTNJTIN630QR28S QK1p9+iipGr8pTUM0d38lJrHX8aJC+oAjHx/f8xBlmXb43DXcq9SmJ47c+YNrVDwCPV4 PWsSeApzrxipLeE1EtjKd/gEy70SNlRJ2xTPap36LvU/avNJRy4m0rwuZS+yUVhAkBDb tZCroVu3cNQuAB3tfjh8Hp/7fhDTTbSeUMvSZyRBHL9RyhKezzOqoQiq4gB5txenjq33 JVeg== X-Gm-Message-State: AA+aEWYhhznRd0+CiO5b+vHiZREI1DkwIFZMN4ARukN7ok51rlP3w4jM SYuzl4Ub7U87PbV3fMgTnFQya0elo2P06jt3JOyQIw== X-Received: by 2002:a67:b245:: with SMTP id s5mr5452247vsh.200.1544449569692; Mon, 10 Dec 2018 05:46:09 -0800 (PST) MIME-Version: 1.0 References: <20181129190503.6040-1-faiz_abbas@ti.com> In-Reply-To: From: Ulf Hansson Date: Mon, 10 Dec 2018 14:45:33 +0100 Message-ID: Subject: Re: [PATCH] mmc: sdhci-omap: Workaround errata regarding SDR104/HS200 tuning failures (i929) To: Faiz Abbas Cc: Kishon , Linux Kernel Mailing List , "linux-mmc@vger.kernel.org" , Adrian Hunter Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Dec 2018 at 14:23, Faiz Abbas wrote: > > Hi Uffe, > > On 05/12/18 7:20 PM, Ulf Hansson wrote: > > On Fri, 30 Nov 2018 at 06:53, Faiz Abbas wrote: > >> > >> 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 > >>>> --- > >>>> 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 > >>>> #include > >>>> #include > >>>> +#include > >>>> > >>>> #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. > > > > Currently sdhci-omap calls pm_runtime_get_sync() during probe, and > > then keeps the host device runtime resumed until ->remove() is called > > on it. I assume you are going to change that, at some point!? > > > > In other words, what will happen to the host device when it becomes > > runtime suspended? Is re-tuning needed when it gets runtime resumed, > > which is the case for many other sdhci variants? > > There are no plans to support runtime_suspend()/resume() any time in the > near future. If its ok with you, I would like to get this patch in > without any changes. We can change it in case a need for > runtime_suspend()/_resume() does arise. Right, I am okay with that. Due to recent changes to sdhci-omap $subject patch doesn't apply, can you please rebase!? Additionally, I realized that we should fold in patch updating the DT doc for sdhci-omap, adding the property for the thermal zone. I regards to that, I am wondering if "cpu_thermal", is really the correct name of the zone. The point is, I am guessing the zone could change along with the SoCs/platforms. Kind regards Uffe