Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp671815imm; Tue, 5 Jun 2018 02:29:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL1e7jbr0m8pHkwDbKPDuTR8jCjMJuvk+mSO/HN61za4XdRDP9yVuRpYcTiSpzMcBwvCbaF X-Received: by 2002:a65:60ce:: with SMTP id r14-v6mr20462718pgv.41.1528190948664; Tue, 05 Jun 2018 02:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528190948; cv=none; d=google.com; s=arc-20160816; b=WgeHpjC9T904JZXoNZfOwI0TuwLKSgBeJap8QpdiY8CMpg0khF9QP1tS2lFWpuWt/o LAKBvZ6+Xn7ar3CQ13T5yFVesQo9qb0a9CobnmlVyGBSJR4PIR+4tvnPYlDngwFpBzV7 A7u5ZA0qTnoKnX76/G04D7AxRDisqEFYoUGF/tNntyBwHygGegMQu1LKE7GQIMFimqDc GxH1SDTTULYvEjpdtTsk8Vpyqvs/jY717RVd9OOdIWXukXJgMke4IllZaTEVw7Vyzfqf t6ctCElVrWrSzuK4GhGaQ3fWzh651V5AwRVg3/PkktVxDlO6XvhpDuUN0xhdWX/KBvFc daOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=5XebJdAKk8bwnYbxzjoroT+RqA23kOVzn0NeszI0yC8=; b=rhNJUM6aPnFiZ+cxkzhgb+3tnLyUvi6qssmwlQK1jNgG3D8Vb+jlHfBWuVWq+1IDFB IZ0xgRu2vEbd6G37b2A4RzZVi/jG5FmtBepR6j815sNXaPQc/2CkHt2mPwxB1Zw+MRy6 gGdUcYKlfoW/9npumXRPX7TmAiDuKjxwQymKfvqAGKFqoAQw3W8lPn6wFwMJDacmTNQM lQELt6uVJYsqlIIH9xFXIuTO8QmVY9kD+2Ox/XHxAyYGfQvQE+lAo250ds9POqtJqc9K dHMsVPCH3GmPPrfnEC+d3dLd5vJrcjof8a7aiWIV3K51cnKmUhWELKuJTYTZmtuuzEre zacw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WbshA5hR; 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 f77-v6si16661440pff.267.2018.06.05.02.28.54; Tue, 05 Jun 2018 02:29:08 -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=WbshA5hR; 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 S1751792AbeFEJ2G (ORCPT + 99 others); Tue, 5 Jun 2018 05:28:06 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:51079 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751509AbeFEJ2E (ORCPT ); Tue, 5 Jun 2018 05:28:04 -0400 Received: by mail-wm0-f66.google.com with SMTP id e16-v6so3533951wmd.0; Tue, 05 Jun 2018 02:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5XebJdAKk8bwnYbxzjoroT+RqA23kOVzn0NeszI0yC8=; b=WbshA5hRl0v4Mofn4NaGY1c4Mc1ZzJftdHtBf2J1PgLosPvETYfCaMLkKcHiLQ5b96 YpwvEyjr+ay9w9JW8V7QD12js/tpDGtMgA/G84H0UgmdnUI1c0dy9AqAxxc5VzPC6bcj npA24SByIuxuJAolDdRn0pW+KJb6Qq1BBja1RVUT9VbuiXzuI6ZCecspuz/xrKsyQplX s4RGgmdNGJMK706uDPoug+x6Xef3kHrUty7c3AOjtfq7IRzf1AGaguSSeEbArpWY8d56 rIt5da0fmZfoJRgOgj2ZEIdl6XcEdb14jWshVsnnzXdLa0tk3Z9cfyRaj2BzYkUASFFG KklA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5XebJdAKk8bwnYbxzjoroT+RqA23kOVzn0NeszI0yC8=; b=LDGsq5muvbDhjY9T0svFLW2B+JvfWh1R8g2Y8wzb7w3vzemJdinurCWhIjWzaKbdET YDSnynhZyL5wL1eeRvEqmXNu8DIVzipy3hYJ+397YcQz+HBkvPi7LdK/hvLbKWp6zcaW PHqwtbJ3X5P6IlTJttVx3NZJmt1hYsF0sRYynYMxu4xjyzH4go8kv+GgyTLmRITXuGUf EFSMZ6qqJzAKxSXxd3RU9ZF18flWMjIEm9bVuqK3SaGkrsQyt/hqxXp8WtX+C4iMtPba A0C4JTo5WMSV/m7N7w/ysBk/01TizLYb5K9BOBHtWQBWjNKDaDzhgVgaJ1tpY4A+iqFC nrYQ== X-Gm-Message-State: APt69E2B3RRc5udCKxWEDsWG4kl9TrM5V67lXWW/KaVcfRJUPvUPJRJj 5DyJHEvyw0eb0Lu7gxQr8Lo= X-Received: by 2002:a1c:459a:: with SMTP id l26-v6mr12590832wmi.95.1528190882815; Tue, 05 Jun 2018 02:28:02 -0700 (PDT) Received: from localhost (pD9E510DD.dip0.t-ipconnect.de. [217.229.16.221]) by smtp.gmail.com with ESMTPSA id 12-v6sm1461388wmt.19.2018.06.05.02.28.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 02:28:02 -0700 (PDT) Date: Tue, 5 Jun 2018 11:28:01 +0200 From: Thierry Reding To: Aapo Vienamo Cc: Adrian Hunter , Ulf Hansson , Jonathan Hunter , linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mmc: tegra: Use sdhci_pltfm_clk_get_max_clock Message-ID: <20180605092801.GC20649@ulmo> References: <1528126540-27004-1-git-send-email-avienamo@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4jXrM3lyYWu4nBt5" Content-Disposition: inline In-Reply-To: <1528126540-27004-1-git-send-email-avienamo@nvidia.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4jXrM3lyYWu4nBt5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > Signed-off-by: Aapo Vienamo > --- > drivers/mmc/host/sdhci-tegra.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) >=20 > diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegr= a.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 sdh= ci_host *host, > sdhci_set_uhs_signaling(host, timing); > } > =20 > -static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host *host) > -{ > - struct sdhci_pltfm_host *pltfm_host =3D 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 --4jXrM3lyYWu4nBt5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlsWV54ACgkQ3SOs138+ s6HoVBAAuvqCXzBhxeGOSFkxq1u7Ieicvxs2P3mW6fTgcVl9AeQU8lGxzG3OaF7r 1dM/xq3lH7HvVWILUG2XIyH48Bvk9aFvVnIo1iZHkIsGdx5Nl4ecVhAeNapsWG3k 7LpOoU/dQ9blcyTCUAWfTpJDaAojaVpQ+HGZ9ttALzC67aUjmDHE1fg4RZXZcmId /2R9TWa0EVrPNvgqjuSawgXkriLwz75oAHtpTch+1XnCBAEGkgcUNMTkQmXulpyG /FUm/WxChXColO0F7J3lBGTkpCYiddyQ4QMt7R6aX7CpPdhpBvy5UNl4HRwpjL85 HTOhp1yC5x367h4ekVJtcspttRMJzZUbw86C7/pwa5m4Ok30Ga6zJegRodljnttT 0u44+qL3q0CyPiQ+Hl9YDrDngrD4ZFjXQ9fEl9nkJMqn97WCN90PWlw1ueKGh1aL mois1ut6lz717zbCn6og8U9gHydcpkU45YM5Ug6hcurgc8EWMug25KKxq++AX7AI 6OkTColPrLdTn1CjTJc85JLTvvRCWirtjS3nxqiezhSBr6HnNsDJ6o3bES3HcyB5 i/Q6w8IpDJDEwt/qqy9jqCtmwJP00hZHypECO9SnS8UC0Vptvw3dSJu23cEnyLe7 Cv+B3doRkF0DXMn7jSS+gJOidVO/hrRxuzWkKjkhFh+w1o5JV4I= =wHuu -----END PGP SIGNATURE----- --4jXrM3lyYWu4nBt5--