Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: ulf.hansson@linaro.org, afenkart@gmail.com, tony@atomide.com,
	linux-mmc@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, nsekhar@ti.com
Cc: neilb@suse.de, kishon@ti.com
Subject: [PATCH v2 05/11] mmc: host: omap_hsmmc: set clk rate to the max frequency
Date: Tue, 25 Aug 2015 14:35:36 +0530	[thread overview]
Message-ID: <1440493542-26150-6-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1440493542-26150-1-git-send-email-kishon@ti.com>

Set the clock rate of the functional clock to the max frequency
that is passed to the driver either using pdata or dt.

Also remove unnecessary setting of host->fclk to NULL.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7dac486..60c1ac2 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2149,6 +2149,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	struct omap_hsmmc_host *host = NULL;
 	struct resource *res;
 	int ret, irq;
+	unsigned int freq;
 	const struct of_device_id *match;
 	dma_cap_mask_t mask;
 	unsigned tx_req, rx_req;
@@ -2229,10 +2230,20 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	host->fclk = devm_clk_get(&pdev->dev, "fck");
 	if (IS_ERR(host->fclk)) {
 		ret = PTR_ERR(host->fclk);
-		host->fclk = NULL;
 		goto err1;
 	}
 
+	freq = clk_get_rate(host->fclk);
+	if (freq > mmc->f_max) {
+		mmc->f_max = freq;
+	} else {
+		ret = clk_set_rate(host->fclk, mmc->f_max);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to set clock to %d\n", mmc->f_max);
+			goto err1;
+		}
+	}
+
 	if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
 		dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n");
 		omap_hsmmc_ops.multi_io_quirk = omap_hsmmc_multi_io_quirk;
-- 
1.7.9.5

  parent reply	other threads:[~2015-08-25  9:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25  9:05 [PATCH v2 00/11] omap_hsmmc: voltage switching and tuning Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 01/11] mmc: host: omap_hsmmc: Support vmmc_aux to switch to 1.8v Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 02/11] mmc: host: omap_hsmmc: separate setting voltage capabilities from bus power Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 03/11] mmc: host: omap_hsmmc: program HCTL based on signal_voltage set by mmc core Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 04/11] mmc: host: omap_hsmmc: add voltage switch support for UHS SD card Kishon Vijay Abraham I
2015-08-25  9:05 ` Kishon Vijay Abraham I [this message]
2015-08-25  9:05 ` [PATCH v2 06/11] mmc: host: omap_hsmmc: set timing in the UHSMS field Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 07/11] mmc: host: omap_hsmmc: add tuning support Kishon Vijay Abraham I
2015-08-25 14:12   ` Ulf Hansson
2015-08-25  9:05 ` [PATCH v2 08/11] mmc: host: omap_hsmmc: Workaround for errata id i802 Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 09/11] mmc: host: omap_hsmmc: Allow io voltage switch even for fixed vdd Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 10/11] mmc: host: omap_hsmmc: remove incorrect voltage switch sequence Kishon Vijay Abraham I
2015-08-25  9:05 ` [PATCH v2 11/11] mmc: host: omap_hsmmc: add software timer when timeout greater than hardware capablility Kishon Vijay Abraham I

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440493542-26150-6-git-send-email-kishon@ti.com \
    --to=kishon@ti.com \
    --cc=afenkart@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=nsekhar@ti.com \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox