Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp809698imm; Tue, 5 Jun 2018 05:00:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJq0jfPCjBJUaugoiqigAnzCzhUr/BVZQdKa4NL8WX0aRFSHiPR/KzMuNWh/1ggN5/PfHDF X-Received: by 2002:a62:4f4f:: with SMTP id d76-v6mr24987234pfb.188.1528200010965; Tue, 05 Jun 2018 05:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528200010; cv=none; d=google.com; s=arc-20160816; b=fyaKqIoEnkfsNC7QshJec+DVbDDGNz/6hXchudXZw5cT+uzWE94JBUpk2/Fne1ewqN OinBZhnw2tpVhotC/AE8LS8skNAAO/owfJ7X3ggnZYl0E1v1xy3pW2FDT8YlwojEfrJm Fp6YlUzBmiLGH/qrnitmA5dgorTd5PdwQSXJebNZ+F2WChhLg+sKybKC4giQVdMrc7Yf pTwq6mZf/vUJLhJloLO6vu+WZl3sVicT0QfgNag6gIZ3QafLdSN+SoP7ABcHUrj0PqqK yx6Q+ZYkIejiYEs1EGFv4qxFdbEH6OO9Z3DURUSDSYjKGtafMCX1TRv9qFJK5nALxTF6 ZSNQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=+2pij8NRJuQQT2eBlYIdAEp1USSNeFU+gIvESM6Hp00=; b=Rs0dKjpjI4M6cXWcxQXZwbX3cq0l3bLwa1DZ7g1MvY+qV0MYRluA+UyjwoiOcRjc6S +2buw8Vk5jlAVEhGAbKqXGhW1zJ0J2M0CKPkxiTvvVJKkRoggYu+69FyyS3rTv36fooM mISk0G1x/AK/4m909bF6i4hwD6CxogUvhVm7U9huzwj63VpGKEdZq7TrspTmROIpcquY s0cfJg3rAyA6pJavav0pRxw6UbUVqHk+NU5s0Pka10oUZ2BA6jQwZ1jIqdycq1mnCMPx A1limK6i/BqwUckyNV1N9aFwZOp2bu4uFcYS2jFBMRWSdPGuri2PSngtQ5rehWamL3fe ljaw== 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 w65-v6si49250546pfa.18.2018.06.05.04.59.56; Tue, 05 Jun 2018 05:00: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 S1751915AbeFEL7I (ORCPT + 99 others); Tue, 5 Jun 2018 07:59:08 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:14393 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbeFEL7G (ORCPT ); Tue, 5 Jun 2018 07:59:06 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Tue, 05 Jun 2018 04:58:58 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 05 Jun 2018 04:59:05 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 05 Jun 2018 04:59:05 -0700 Received: from dhcp-10-21-25-168 (10.26.11.41) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 5 Jun 2018 11:59:01 +0000 Date: Tue, 5 Jun 2018 14:58:55 +0300 From: Aapo Vienamo To: Thierry Reding CC: Adrian Hunter , Ulf Hansson , Jonathan Hunter , , , Subject: Re: [PATCH] mmc: tegra: Use sdhci_pltfm_clk_get_max_clock Message-ID: <20180605145855.3004dae2@dhcp-10-21-25-168> In-Reply-To: <20180605092801.GC20649@ulmo> References: <1528126540-27004-1-git-send-email-avienamo@nvidia.com> <20180605092801.GC20649@ulmo> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.26.11.41] 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 On Tue, 5 Jun 2018 11:28:01 +0200 Thierry Reding wrote: > On Mon, Jun 04, 2018 at 06:35:40PM +0300, Aapo Vienamo wrote: > > 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; > > -} > > sdhci_pltfm_clk_get_max_clock() returns the current frequency of the > clock, which may not be an accurate maximum. > > Also, even if we don't support DDR modes now, we may want to enable them > in the future, at which point we'll need to move to something similar to > the above again, albeit maybe with some of the issues that you mentioned > fixed. > > I wonder if we have access to the target mode in this function, because > it seems to me like we'd need to take that into account when determining > the maximum clock rate. Or perhaps the double-rate aspect is already > dealt with in other parts of the MMC subsystem, so the value we should > return here may not even need to take the mode into account. I don't think that's possible. The callback is only called during probe from sdhci_setup_host() via sdhci_add_host(). Handling DDR50 properly might require adding a new SDHCI quirk bit. > All of the above said, it is true that we don't enable DDR modes as of > now, and this patch seems like it shouldn't break anything either, so: > > Acked-by: Thierry Reding > > I also gave this a brief run on Jetson TK1 and things seem to work fine, > so: > > Tested-by: Thierry Reding