Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp781699imm; Fri, 13 Jul 2018 06:18:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc3TVMxxiX7bWXzOk4wIVZCFPCDN3qfU7YxeHtz2vyddVsfMwkPSIpBnPfJbQL2moQxbUQE X-Received: by 2002:aa7:8713:: with SMTP id b19-v6mr7054798pfo.151.1531487923732; Fri, 13 Jul 2018 06:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531487923; cv=none; d=google.com; s=arc-20160816; b=v1fATHaS51JPlwATywS4iFXuVtPukhQzEELEO3cschd397SpsyPk5JEEGhhB4DJIQh qZGWCZim2Jq1VaiFV1amInjefVWIlgdEowUAo/7kYJaUy7FbcUijCICFJFGNogl1XgxJ BFZNffo8i7wYUgqKKrUQ1x2ONNuFFNKzZn0SdSDqrTZhCv/v9AeelR2VgSEplzMQwirK iZoWxGwnUKjiWboJ7Vh3cvA8VrUC5XWtYpozrnDyl42CaIiWKOLNrCYDdvWDZFkk5XnP JyDUC9Oir4L50j02RSyVobRre1yAaT1hlSd/OU/47MNGCDmyU3wmNgR6uXLXw7qhxLx5 HWuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=kemVyLOvh4Y7Ds9DAv+yk5bhhOz2GzXVubcyJlyGiQI=; b=mQd8JMOplcr0oEp9IfM7D+m1Bs1P+OE3DpcaUZ5fmYNm5aN4ApmKJTZhjpJYa9LHUp wHLgMXLmY4Uom/KbOPTzbp27In2HhHaftSF9pCTMt0ctkVqM3LHloGWBdQ5KqzQ0EsXP taGvD+jq7wYZuUGbWXsfYbsGgS41l3784gve5c6qSEiltPRHlRy3gto+xUVDrymGOqMM smm1LdlBrY+kU1GZ9JeV19e1sSCMJ2l+Bkb8J3D1BvbCPHsrba+b4Z5urD3sX1wjFE/U uzhQ0hhEFnXRgJAYrN+tAHkg3eV3fKwnJflTOEqLn0q3FEL5xEB/oNj15oHqqWcSwUb+ /58g== 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si27230488pfb.131.2018.07.13.06.18.26; Fri, 13 Jul 2018 06:18: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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729735AbeGMNc2 (ORCPT + 99 others); Fri, 13 Jul 2018 09:32:28 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:18837 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729623AbeGMNc2 (ORCPT ); Fri, 13 Jul 2018 09:32:28 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Fri, 13 Jul 2018 06:17:04 -0700 Received: from HQMAIL103.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 13 Jul 2018 06:17:50 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 13 Jul 2018 06:17:50 -0700 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 13 Jul 2018 13:17:49 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2 via Frontend Transport; Fri, 13 Jul 2018 13:17:49 +0000 Received: from dhcp-10-21-25-168.Nvidia.com (Not Verified[10.21.25.201]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 13 Jul 2018 06:17:49 -0700 From: Aapo Vienamo To: Ulf Hansson , Adrian Hunter , Thierry Reding , Jonathan Hunter , Marcel Ziswiler CC: , , , Aapo Vienamo Subject: [PATCH] mmc: tegra: Add and use tegra_sdhci_get_max_clock() Date: Fri, 13 Jul 2018 16:17:45 +0300 Message-ID: <1531487865-17427-1-git-send-email-avienamo@nvidia.com> X-Mailer: git-send-email 2.7.4 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement and use tegra_sdhci_get_max_clock() which returns the true maximum host clock rate. The issue with tegra_sdhci_get_max_clock() is that it returns the current clock rate of the host instead of the maximum one, which can lead to unnecessarily small clock rates. This differs from the previous implementation of tegra_sdhci_get_max_clock() in that it doesn't divide the result by two. Signed-off-by: Aapo Vienamo --- drivers/mmc/host/sdhci-tegra.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 28b98e2..ddf00166 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -235,6 +235,13 @@ static void tegra_sdhci_set_uhs_signaling(struct sdhci_host *host, sdhci_set_uhs_signaling(host, timing); } +static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host *host) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + + return clk_round_rate(pltfm_host->clk, UINT_MAX); +} + static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap) { u32 reg; @@ -299,7 +306,7 @@ static const struct sdhci_ops tegra_sdhci_ops = { .platform_execute_tuning = tegra_sdhci_execute_tuning, .set_uhs_signaling = tegra_sdhci_set_uhs_signaling, .voltage_switch = tegra_sdhci_voltage_switch, - .get_max_clock = sdhci_pltfm_clk_get_max_clock, + .get_max_clock = tegra_sdhci_get_max_clock, }; static const struct sdhci_pltfm_data sdhci_tegra20_pdata = { @@ -356,7 +363,7 @@ static const struct sdhci_ops tegra114_sdhci_ops = { .platform_execute_tuning = tegra_sdhci_execute_tuning, .set_uhs_signaling = tegra_sdhci_set_uhs_signaling, .voltage_switch = tegra_sdhci_voltage_switch, - .get_max_clock = sdhci_pltfm_clk_get_max_clock, + .get_max_clock = tegra_sdhci_get_max_clock, }; static const struct sdhci_pltfm_data sdhci_tegra114_pdata = { -- 2.7.4