Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp684144ybi; Fri, 14 Jun 2019 01:28:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjVgmnx8C87P80adLYw506ai2A48MGzX9Xb78OQRo/yIQVsw/rBPC3yjLvzCdViMrS5/pZ X-Received: by 2002:a17:902:a506:: with SMTP id s6mr17457956plq.87.1560500923369; Fri, 14 Jun 2019 01:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560500923; cv=none; d=google.com; s=arc-20160816; b=RyE/p+mhWQ/3tP8q8A6PgC9AQaipvTs9FDM5/4nC9EHU3o4hrX3ROAPCwtlfWXpq4t WmPk5pIj2asToE6fMOvpCr8FvhIMynenSQ4O/sTA7UwR6K/+oN15XrJwL8qB84g9Lfvy PQCzksz07OvDBxIf3jFOZeHT3cyClDXky0dg0Q5lSoU+8VhpwhA5DJ6uB27syymiczmj 4qPoEbWZdNkp91/8YJZsZ8/KuIofXdHrTpranHOEhm0T+44Y/s8w+RPrMD83IAHSMVxe Op/h1d2OBeZhthYRYwixuK07yKc1IWbSqFUbgF29/qcgE4M/6ZhlOIG2yUbI5CK9JYy3 paaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=aHlZX9lG2fmE4XUqUYQ27pAYiP9U4VU08VPNaugTcNQ=; b=ofISIblwf2evAj9vzqkaot2FGXubAPxLMZcjaaLl2N/xNrtg5wCmmxIfyfKQpAUhlW VEExqpd3Kn3A6U71rPfC/EE+Rrw6jFkC3yptudf79D8vcht1Rf5sq1chydNG4kyN2edT L+FTBaKg3EsezFMs6Z7nJeIqtu3QRXPe2iBUInCvidGuQ7BDweDO8zevjv8gNDpY3wyM Yv6gPQCFM+ZY4I99b2GCIZBLK7T5mnY8W89OqjcYlbGB+bjwFokdQmDRAJJ305IPGrI1 n5j+zz8qz6rmR04WEtBfE/QMSnr207WUyPgpiNch0j6bpQ631zL++lPyi0p9Q/OBLWJf F48g== 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k38si1937907pgm.500.2019.06.14.01.28.27; Fri, 14 Jun 2019 01:28:43 -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; 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726447AbfFNI2J (ORCPT + 99 others); Fri, 14 Jun 2019 04:28:09 -0400 Received: from inva020.nxp.com ([92.121.34.13]:39342 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbfFNI2J (ORCPT ); Fri, 14 Jun 2019 04:28:09 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8DC081A05D5; Fri, 14 Jun 2019 10:28:07 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CD31D1A05E6; Fri, 14 Jun 2019 10:28:03 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id D0D94402A0; Fri, 14 Jun 2019 16:27:58 +0800 (SGT) From: Yinbo Zhu To: Adrian Hunter , Ulf Hansson Cc: yinbo.zhu@nxp.com, xiaobo.xie@nxp.com, jiafei.pan@nxp.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, yangbo.lu@nxp.com Subject: [PATCH v1] mmc: sdhci-of-esdhc: set the sd clock divisor value above 3 Date: Fri, 14 Jun 2019 16:29:53 +0800 Message-Id: <20190614082954.39648-1-yinbo.zhu@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangbo Lu This patch is to set the sd clock divisor value above 3 in tuning mode Signed-off-by: Yinbo Zhu Signed-off-by: Yangbo Lu --- drivers/mmc/host/sdhci-of-esdhc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index d4ec0a959a75..c4af026c3fba 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -824,9 +824,17 @@ static int esdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); bool hs400_tuning; + unsigned int clk; u32 val; int ret; + /* For tuning mode, the sd clock divisor value + * must be larger than 3 according to reference manual. + */ + clk = esdhc->peripheral_clock / 3; + if (host->clock > clk) + esdhc_of_set_clock(host, clk); + if (esdhc->quirk_limited_clk_division && host->flags & SDHCI_HS400_TUNING) esdhc_of_set_clock(host, host->clock); -- 2.17.1