Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3751891imm; Mon, 4 Jun 2018 08:42:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKSKQnmImAa9FnJJYaT5hOP1XBYaov1zjdA9ITHCBUy2uAFosKxfgm66tARrnyeRTD+tLSn X-Received: by 2002:a17:902:7406:: with SMTP id g6-v6mr21959917pll.90.1528126930708; Mon, 04 Jun 2018 08:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528126930; cv=none; d=google.com; s=arc-20160816; b=xVt9qrx5hFbhyeYgWk+DSTZB5PD1+Z9vYD5hFDkU2Yba8KtDjqiN4ONE528Ys0XGgM PW/cAcq4kVXEqnRthhmfKLpawOp2tPLnp/Rpbcqw2xR2yLOW63YKpLfmL0POzWDX+tiU ffN0+qf8Npbs39Jjx4U3dEqLdvUgxEzBvdS9aQbc0LzOtlvIrJahPP3oOVecUjrFab/k LZVtp/t279cwgRUA605zjbVYGD+pipM8VX57ojhlx/+LMgrdqMqy1zGxUSDEMVhvZXdW ZfYCdT3j0b4i6WEctGFU8ve9wYQgsKEAR8lrGJKAA6CNoksrYeQvrOu1WdXPRjl38gPk vnMg== 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=zbz7v9jtwCFiUEkGXneft1yu6CuhFVPS6kMKlk1OxWE=; b=rhBq4gc26nS6tmAyW5HGeB6FctoGBDqeDQ80dZa1kvbIEfSzQPZ4lFQu42hb8QH9eL pnGNgZgsO0zFGjxKBhhG6vAFT7UhiUqyTK3dD3lmt9f6ItgEqCioJbs66BnzpmVbakXB fSFXHBMwAN76mHSk0vMFboEEXARK/al8uclO/Zrt8ss/pjqG7q8DT105BX9TAMLLCbwr wkAR+zyvfTY1D8iV9T10csQ76cS10vyqeWtJKhG4uUyUWE9pEITsEU3g3yV+UHvS/n9S 4+vo+T0r9yvPxHIHpT+SRCSEnEsy//38laU9tQHJehC0xrPLSCxbaNjkDD7xZg0Eq4Vm 8lfw== 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 s65-v6si11178153pfe.290.2018.06.04.08.41.56; Mon, 04 Jun 2018 08:42:10 -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 S1751396AbeFDPlA (ORCPT + 99 others); Mon, 4 Jun 2018 11:41:00 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:1636 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153AbeFDPjx (ORCPT ); Mon, 4 Jun 2018 11:39:53 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Mon, 04 Jun 2018 08:39:46 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 04 Jun 2018 08:39:57 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 04 Jun 2018 08:39:57 -0700 Received: from dhcp-10-21-25-168.Nvidia.com (10.21.25.201) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 4 Jun 2018 15:39:50 +0000 From: Aapo Vienamo To: Adrian Hunter , Ulf Hansson , Thierry Reding , Jonathan Hunter , , CC: , Aapo Vienamo Subject: [PATCH] mmc: tegra: Use sdhci_pltfm_clk_get_max_clock Date: Mon, 4 Jun 2018 18:35:40 +0300 Message-ID: <1528126540-27004-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 X-Originating-IP: [10.21.25.201] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To HQMAIL101.nvidia.com (172.20.187.10) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sdhci get_max_clock callback is set to sdhci_pltfm_clk_get_max_clock and tegra_sdhci_get_max_clock is removed. It appears that the shdci-tegra specific callback was originally introduced due to the requirement that the host clock has to be twice the bus clock on DDR50 mode. As far as I can tell the only effect the removal has on DDR50 mode is in cases where the parent clock is unable to supply the requested clock rate, causing the DDR50 mode to run at a lower frequency. Currently the DDR50 mode isn't enabled on any of the SoCs and would also require configuring the SDHCI clock divider register to function properly. The problem with tegra_sdhci_get_max_clock is that it divides the clock rate by two and thus artificially limits the maximum frequency of faster signaling modes which don't have the host-bus frequency ratio requirement of DDR50 such as SDR104 and HS200. Furthermore, the call to clk_round_rate() may return an error which isn't handled by tegra_sdhci_get_max_clock. Signed-off-by: Aapo Vienamo --- drivers/mmc/host/sdhci-tegra.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 970d38f6..c8745b5 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -234,17 +234,6 @@ 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); - - /* - * DDR modes require the host to run at double the card frequency, so - * the maximum rate we can support is half of the module input clock. - */ - return clk_round_rate(pltfm_host->clk, UINT_MAX) / 2; -} - static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap) { u32 reg; @@ -309,7 +298,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 = tegra_sdhci_get_max_clock, + .get_max_clock = sdhci_pltfm_clk_get_max_clock, }; static const struct sdhci_pltfm_data sdhci_tegra20_pdata = { @@ -357,7 +346,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 = tegra_sdhci_get_max_clock, + .get_max_clock = sdhci_pltfm_clk_get_max_clock, }; static const struct sdhci_pltfm_data sdhci_tegra114_pdata = { -- 2.7.4