Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp809777imm; Tue, 5 Jun 2018 05:00:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIIlNpPVsPuysQugsIC7TOR5FLVhHZKR5rnMnFFf1JbCMdaOA0w6lcj1BdI67DnfM4+hIqs X-Received: by 2002:a17:902:6686:: with SMTP id e6-v6mr25898825plk.35.1528200014958; Tue, 05 Jun 2018 05:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528200014; cv=none; d=google.com; s=arc-20160816; b=OKHBJoLTN2i6z8CWZCyvZCu9YUE4aBQqS8QxDkfCawfVPKQyDyJWIaQPipZdYnLLU4 g+rZa7BTHaHDhpZuOCWO3UOnEdSodYRes+sFondSyrA6T48YErKbPyrksO/bHL7tsGV9 SzOBvOqfmxERENd0n/s5hQzcOyu8m69cXhmsJTWyFDQidGFEkajRN3kFNdQYctkqpOok 3apSVuTy5NNoSZCklEyyf2eORV4tJBvVyFKrXd2EWAVAGkmd6milJhIwrFxw+iU3uhuS 0KB02zBvmrpBMAfUL7pBSa9Rskh8oP0pTWqrF8lQeQu0tMZNxpdCyxJY/8hSjqFH57hC ujmQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=UPzBZSburWb1DLyofEjPEEx8TUT3Y7FXjQQmhrCAvF4=; b=U6ufBpRGG50Qni3+3LhL0HHArm4PpfAloq5Cu2d6Yr75UqqvBNytszfi4VKe7NaK/H Cs2Jc3/ZrXQ9v2B2M0GcdWhOssXkguaWDXmRNP8JQm9TEGiHbFbtCxgu2a0m9RWoVlsC rCI2si5N5bRVtY08C0n077QrPpmUcrXKrYbm4r89nNZHIrlIZEJ5QvBdaUGsezjrmD8C vVGNqwHDNAu+kvnXFzeBgdxCz1Ejy/XMzUosz5i/jddiFEPgC/dBcYS6jFSji28Ft8oy uYhAi7Qy94T4dcb0hW9Ltoj3BSjTSmLVO6S93XDaftwzUBaPDkI0lDxmPZ7B+3M6GkzA AGMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FIAAjPhX; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b74-v6si23135198pfb.189.2018.06.05.05.00.00; Tue, 05 Jun 2018 05:00:14 -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=@gmail.com header.s=20161025 header.b=FIAAjPhX; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751884AbeFEL6t (ORCPT + 99 others); Tue, 5 Jun 2018 07:58:49 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:46920 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653AbeFEL6r (ORCPT ); Tue, 5 Jun 2018 07:58:47 -0400 Received: by mail-qt0-f196.google.com with SMTP id h5-v6so1996618qtm.13; Tue, 05 Jun 2018 04:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UPzBZSburWb1DLyofEjPEEx8TUT3Y7FXjQQmhrCAvF4=; b=FIAAjPhXy+lsTzXo0+H/+mb0PRsqivIH8qzG+fm8rFSVIEpztcRyU2LwcVK8cKyzYX qV/pvt4iplY6vVqAkfp1feaMQHuaZ+M3LFhZuDVRPEdQAsVBQ6sev/GExUl1fcoxSY12 B/L3bOy2F5D7T2+pG6acdFZEdNHza3p3HW9GJR5ZyblE9rqRqaeoWQuOHsafMwx1Txx8 4hDR2KeZ/GaJSR9RYYlxD9xWxXi5ZHUpq08ci9NYDQy78HT4z77zC5sqDKVmPc6Aihxl kY5XJllYdWYP7xzIWy2IJ9L95WTeMM30y5w/rDLnBVkai3Q8lVPA/OaIpPqmrww5R/Cc Ko6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UPzBZSburWb1DLyofEjPEEx8TUT3Y7FXjQQmhrCAvF4=; b=TErPtkbDhCoyEG/jjEP3ut1lpIuU/GP/2fM3BzuTGWWFh6QZX1xGPjzv5cLao6smIM cMgJhMlhi6bSEzSpJ3iiFwtx+1Hv7hsS/OTp4AJPYZxWYWRiB6wdic3BjuUjDpATPDLp /GNeoyG5sAVm7xBGhum4M4pP/l35+COJFhmmoWdRCKa9J/zt78qFPUuUXJK70iXhm4z/ 9LCTfd0TApna5x1+EaWe/7zKyxu+g350cxPnrMOlAVExbnrdJqH4LbrQ1/qmoI5SkhFA YxY7ZcBRwF4JETA4fcKLhHRZNQCRiZXrllm39ffQNd00XIbuGUnRswfyHYuTcfkiRPPX 0ntA== X-Gm-Message-State: APt69E121ZZMNGVuE7iPoRjTm4LudTSHAuo51z0XGILQviKRUtrtlQff QHbya1tiyOtNONdcian0iMks+i+Gqms= X-Received: by 2002:ac8:2507:: with SMTP id 7-v6mr24359212qtm.359.1528199926667; Tue, 05 Jun 2018 04:58:46 -0700 (PDT) Received: from [192.168.44.96] (147.sub-174-226-12.myvzw.com. [174.226.12.147]) by smtp.gmail.com with ESMTPSA id l73-v6sm21962207qkl.78.2018.06.05.04.58.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jun 2018 04:58:46 -0700 (PDT) Subject: Re: [PATCH] mmc: tegra: Use sdhci_pltfm_clk_get_max_clock To: Thierry Reding , Aapo Vienamo Cc: Adrian Hunter , Ulf Hansson , Jonathan Hunter , linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1528126540-27004-1-git-send-email-avienamo@nvidia.com> <20180605092801.GC20649@ulmo> From: Peter Geis Message-ID: <13e3239e-3cd5-70ab-ba37-94a938ba5acd@gmail.com> Date: Tue, 5 Jun 2018 07:58:43 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180605092801.GC20649@ulmo> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/2018 05:28 AM, 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. > > 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 > I am currently testing this in my Ouya project, to see if it makes a difference in my eMMC stability above 30Mhz. As a drop in replacement it works. I'll be cranking up the speed later.