From: Yangbo Lu <yangbo.lu@nxp.com>
To: <linux-mmc@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
<devicetree@vger.kernel.org>
Cc: <ulf.hansson@linaro.org>, <scott.wood@nxp.com>,
Rob Herring <robh+dt@kernel.org>, Yangbo Lu <yangbo.lu@nxp.com>
Subject: [PATCH 2/2] mmc: sdhci-pltfm: get clock through the common clk APIs
Date: Wed, 20 Apr 2016 18:20:44 +0800 [thread overview]
Message-ID: <1461147644-18041-2-git-send-email-yangbo.lu@nxp.com> (raw)
In-Reply-To: <1461147644-18041-1-git-send-email-yangbo.lu@nxp.com>
Get the sdhc clock through the common clk APIs. If the APIs fail, try
to get the clock through 'clock-frequency' property. We could remove
the clock fixup in u-boot by adding the common clk APIs support.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
drivers/mmc/host/sdhci-pltfm.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 072bb27..383fa49 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -31,6 +31,7 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/clk.h>
#ifdef CONFIG_PPC
#include <asm/machdep.h>
#endif
@@ -71,6 +72,7 @@ void sdhci_get_of_property(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct clk *sdhci_clk;
u32 bus_width;
if (of_get_property(np, "sdhci,auto-cmd12", NULL))
@@ -99,7 +101,11 @@ void sdhci_get_of_property(struct platform_device *pdev)
of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
- of_property_read_u32(np, "clock-frequency", &pltfm_host->clock);
+ sdhci_clk = of_clk_get(np, 0);
+ if (!IS_ERR(sdhci_clk))
+ pltfm_host->clock = clk_get_rate(sdhci_clk);
+ else
+ of_property_read_u32(np, "clock-frequency", &pltfm_host->clock);
if (of_find_property(np, "keep-power-in-suspend", NULL))
host->mmc->pm_caps |= MMC_PM_KEEP_POWER;
--
2.1.0.27.g96db324
next prev parent reply other threads:[~2016-04-20 10:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 10:20 [PATCH 1/2] powerpc/85xx: adapt QorIQ eSDHC to the new clocking model Yangbo Lu
2016-04-20 10:20 ` Yangbo Lu [this message]
2016-04-21 23:08 ` Scott Wood
2016-04-26 6:19 ` Yangbo Lu
2016-04-26 6:29 ` Yangbo Lu
2016-04-26 6:31 ` Scott Wood
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=1461147644-18041-2-git-send-email-yangbo.lu@nxp.com \
--to=yangbo.lu@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=scott.wood@nxp.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;
as well as URLs for NNTP newsgroup(s).