From patchwork Wed Aug 28 18:55:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VGFtw6FzIFN6xbFjcw==?= X-Patchwork-Id: 11119673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A81D11399 for ; Wed, 28 Aug 2019 19:01:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 859FA22CF5 for ; Wed, 28 Aug 2019 19:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbfH1TBx (ORCPT ); Wed, 28 Aug 2019 15:01:53 -0400 Received: from hera.iit.uni-miskolc.hu ([193.6.5.4]:43628 "EHLO hera.iit.uni-miskolc.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726617AbfH1TBw (ORCPT ); Wed, 28 Aug 2019 15:01:52 -0400 X-Greylist: delayed 338 seconds by postgrey-1.27 at vger.kernel.org; Wed, 28 Aug 2019 15:01:50 EDT Received: from localhost (localhost [127.0.0.1]) by hera.iit.uni-miskolc.hu (Postfix) with ESMTP id 2D963126; Wed, 28 Aug 2019 20:56:10 +0200 (CEST) X-Virus-Scanned: Kamavis at iit.uni-miskolc.hu Received: from hera.iit.uni-miskolc.hu ([127.0.0.1]) by localhost (hera.iit.uni-miskolc.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2IDgBeCV0yyp; Wed, 28 Aug 2019 20:56:01 +0200 (CEST) Received: from titan.hitronhub.home (unknown [IPv6:2a02:8109:a180:54c:226:9eff:fe30:2af8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: szucst@iit.uni-miskolc.hu) by hera.iit.uni-miskolc.hu (Postfix) with ESMTPSA id 9121C125; Wed, 28 Aug 2019 20:56:00 +0200 (CEST) From: =?utf-8?b?VGFtw6FzIFN6xbFjcw==?= To: Wolfram Sang , Ulf Hansson , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?b?VGFtw6FzIFN6xbFjcw==?= Subject: [PATCH] mmc: sdhi: fill in actual_clock Date: Wed, 28 Aug 2019 20:55:18 +0200 Message-Id: <20190828185518.4340-1-tszucs@protonmail.ch> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Save set clock in mmc_host actual_clock enabling exporting it via debugfs. This will indicate the precise SD clock in I/O settings rather than only the sometimes misleading requested clock. Signed-off-by: Tamás Szűcs --- drivers/mmc/host/renesas_sdhi_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 64d3b5fb7fe5..ae842d0b59f9 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -124,7 +124,7 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host, { struct renesas_sdhi *priv = host_to_priv(host); unsigned int freq, diff, best_freq = 0, diff_min = ~0; - int i, ret; + int i; /* tested only on R-Car Gen2+ currently; may work for others */ if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) @@ -153,9 +153,11 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host, } } - ret = clk_set_rate(priv->clk, best_freq); + host->mmc->actual_clock = + clk_set_rate(priv->clk, best_freq) == 0 ? + best_freq : clk_get_rate(priv->clk); - return ret == 0 ? best_freq : clk_get_rate(priv->clk); + return host->mmc->actual_clock; } static void renesas_sdhi_set_clock(struct tmio_mmc_host *host,