Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2198029ybp; Thu, 10 Oct 2019 03:53:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQK7KM+Wvu4b4StPNQXNCfw0XrQFVAtQKhZH8MLW6IyEyZAzE2FV0hlh/THLfCx+BqHvJA X-Received: by 2002:a05:6402:17a6:: with SMTP id j6mr7253739edy.99.1570704798089; Thu, 10 Oct 2019 03:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570704798; cv=none; d=google.com; s=arc-20160816; b=txf2UonSJQxdi+jTqXZiTZqLId6QtRx5Cr36NZYesq+WTny7fAohMjjCQfO9mD1lrC Ug0WT8abXsnSFxhgeUGKPrEIrlRX59LWeU6bngnKjoUKd3s+DO9VaNk0IkmhtDv10liA Y+sh4EVqs/d4lEefLzu5viU+QSjca45IcDH5+K7r3EEwbMC57DDFpYijDZMY+szSkrQi ZvR3uj1ujs+eB1552fOUsqMxAsvY/DfpjSqGF1nsukewi1BN1H2FAs56N7Nde40+oSJN LxNNEkul9dmB7DI/H7kvhK4A0dQTcVlr+gWyjsR/x6o7sLPZ66FjWLUCOLLpznrhdqxY lj0w== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XliUJLuFlKaXm7moRyemAIXwBCYUezk8mD1oOP4tL/4=; b=u9/MVenVBwVKa7D60FawfBUkBiLJxTL320kFe58pmNbKs65M+XL7Iwiql8DLHjM4pU bJaKMYbhL5/mTPV8BqHAqg5djFR4hZe/nR+LuCEfSJKzyYOR8vj0kbVelFkSJr8j8bWO dyQzK34sA3bjlQOzhpiP2vQnVK+LQ+9eEKrDf1E6JWdKqqqUWq0wchqmn/szBShfs8KH t1TS0+4hWQiidZ8B48qt1STQoEw42NfGWuBcopRrZV/FjfM4CB1+y9xQqyomsQREasQ8 3np2ODB6o2dxxhlcTXuQ5uzlLHH780nLPCSIIDmPTEffFrMTMIgALFbI/BLrDxrF2A3i +wqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VWoUIcV5; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k63si3416555edc.347.2019.10.10.03.52.55; Thu, 10 Oct 2019 03:53:18 -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=@ti.com header.s=ti-com-17Q1 header.b=VWoUIcV5; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733183AbfJJKvz (ORCPT + 99 others); Thu, 10 Oct 2019 06:51:55 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:53748 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbfJJKvy (ORCPT ); Thu, 10 Oct 2019 06:51:54 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9AAppY3025712; Thu, 10 Oct 2019 05:51:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1570704711; bh=XliUJLuFlKaXm7moRyemAIXwBCYUezk8mD1oOP4tL/4=; h=From:To:CC:Subject:Date; b=VWoUIcV5P1Q0lX2rGonFyGrhv6XlFshYs58FpzK97RH28zdf4vVZqIeoBpUWGcq6c 9JltJReyowpcs8/UgWVeMJewMVSxAq0mpLEilPcrVY9365Zs8LOLMSCvEpIl/1bJYb yxfMRyPcWQK7XAK16Hv5u17pFBQAmi0OvMPA+YDo= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9AApoqG125211 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Oct 2019 05:51:51 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 10 Oct 2019 05:51:50 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 10 Oct 2019 05:51:47 -0500 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9AApmvE122351; Thu, 10 Oct 2019 05:51:49 -0500 From: Faiz Abbas To: , CC: , , , Subject: [PATCH] mmc: sdhci-omap: Fix Tuning procedure for temperatures < -20C Date: Thu, 10 Oct 2019 16:22:30 +0530 Message-ID: <20191010105230.16736-1-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the App note[1] detailing the tuning algorithm, for temperatures < -20C, the initial tuning value should be min(largest value in LPW - 24, ceil(13/16 ratio of LPW)). The largest value in LPW is (max_window + 4 * (max_len - 1)) and not (max_window + 4 * max_len) itself. Fix this implementation. [1] http://www.ti.com/lit/an/spraca9b/spraca9b.pdf Fixes: 961de0a856e3 ("mmc: sdhci-omap: Workaround errata regarding SDR104/HS200 tuning failures (i929)") Cc: stable@vger.kernel.org Signed-off-by: Faiz Abbas --- drivers/mmc/host/sdhci-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 41c2677c587f..083e7e053c95 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -372,7 +372,7 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) * on temperature */ if (temperature < -20000) - phase_delay = min(max_window + 4 * max_len - 24, + phase_delay = min(max_window + 4 * (max_len - 1) - 24, max_window + DIV_ROUND_UP(13 * max_len, 16) * 4); else if (temperature < 20000) -- 2.19.2