public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Liu <kliu5@marvell.com>
To: linux-mmc@vger.kernel.org, Chris Ball <cjb@laptop.org>,
	Jerry Huang <Chang-Ming.Huang@freescale.com>,
	Chunhe Lan <Chunhe.Lan@freescale.com>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Sujit Reddy Thumma <sthumma@codeaurora.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Aaron Lu <aaron.lu@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Wei WANG <wei_wang@realsil.com.cn>,
	Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Philip Rakity <prakity@nvidia.com>,
	Shawn Guo <shawn.guo@linaro.org>,
	Johan Rudholm <johan.rudholm@stericsson.com>,
	Girish K S <girish.shivananjappa@linaro.org>,
	Haijun Zhang <Haijun.Zhang@freescale.com>,
	Zhangfei Gao <zhangfei.gao@gmail.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Chao Xie <cxie4@marvell.com>, Kevin Liu <keyuan.liu@gmail.com>,
	Kevin Liu <kliu5@marvell.com>
Subject: [PATCH v2 1/2] mmc: sdhci-pltfm: add calling mmc_of_parse in sdhci_pltfm_register
Date: Fri,  8 Mar 2013 23:07:42 +0800	[thread overview]
Message-ID: <1362755263-6832-1-git-send-email-kliu5@marvell.com> (raw)

commit 6c56e7a0 provide a function mmc_of_parse for standard MMC
device-tree binding parser centrally. So just call it with
sdhci_get_of_property together in sdhci_pltfm_register.

Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
 drivers/mmc/host/sdhci-pltfm.c |   56 +++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e605509..0c5eb6a 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -71,42 +71,43 @@ void sdhci_get_of_property(struct platform_device *pdev)
 	u32 bus_width;
 	int size;
 
-	if (of_device_is_available(np)) {
-		if (of_get_property(np, "sdhci,auto-cmd12", NULL))
-			host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
+	if (!of_device_is_available(np))
+		return;
 
-		if (of_get_property(np, "sdhci,1-bit-only", NULL) ||
-		    (of_property_read_u32(np, "bus-width", &bus_width) == 0 &&
-		    bus_width == 1))
-			host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
+	if (of_get_property(np, "sdhci,auto-cmd12", NULL))
+		host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
 
-		if (sdhci_of_wp_inverted(np))
-			host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
+	if (of_get_property(np, "sdhci,1-bit-only", NULL) ||
+		(of_property_read_u32(np, "bus-width", &bus_width) == 0 &&
+		bus_width == 1))
+		host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
 
-		if (of_get_property(np, "broken-cd", NULL))
-			host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
+	if (sdhci_of_wp_inverted(np))
+		host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
 
-		if (of_get_property(np, "no-1-8-v", NULL))
-			host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
+	if (of_get_property(np, "broken-cd", NULL))
+		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
-		if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
-			host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
+	if (of_get_property(np, "no-1-8-v", NULL))
+		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 
-		if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
-		    of_device_is_compatible(np, "fsl,p1010-esdhc") ||
-		    of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
-			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+	if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
+		host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
 
-		clk = of_get_property(np, "clock-frequency", &size);
-		if (clk && size == sizeof(*clk) && *clk)
-			pltfm_host->clock = be32_to_cpup(clk);
+	if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
+			of_device_is_compatible(np, "fsl,p1010-esdhc") ||
+			of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
+		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 
-		if (of_find_property(np, "keep-power-in-suspend", NULL))
-			host->mmc->pm_caps |= MMC_PM_KEEP_POWER;
+	clk = of_get_property(np, "clock-frequency", &size);
+	if (clk && size == sizeof(*clk) && *clk)
+		pltfm_host->clock = be32_to_cpup(clk);
 
-		if (of_find_property(np, "enable-sdio-wakeup", NULL))
-			host->mmc->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
-	}
+	if (of_find_property(np, "keep-power-in-suspend", NULL))
+		host->mmc->pm_caps |= MMC_PM_KEEP_POWER;
+
+	if (of_find_property(np, "enable-sdio-wakeup", NULL))
+		host->mmc->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
 }
 #else
 void sdhci_get_of_property(struct platform_device *pdev) {}
@@ -212,6 +213,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
+	mmc_of_parse(host->mmc);
 	sdhci_get_of_property(pdev);
 
 	ret = sdhci_add_host(host);
-- 
1.7.9.5


             reply	other threads:[~2013-03-08 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-08 15:07 Kevin Liu [this message]
2013-03-08 15:07 ` [PATCH 2/2] mmc: sdhci-pltfm: add function in sdhci_ops to parse dt property Kevin Liu
2013-03-08 20:17 ` [PATCH v2 1/2] mmc: sdhci-pltfm: add calling mmc_of_parse in sdhci_pltfm_register Stephen Warren
2013-03-09  1:30   ` Chris Ball
2013-03-09  4:24   ` Kevin Liu
2013-03-11 15:53     ` Stephen Warren

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=1362755263-6832-1-git-send-email-kliu5@marvell.com \
    --to=kliu5@marvell.com \
    --cc=Chang-Ming.Huang@freescale.com \
    --cc=Chunhe.Lan@freescale.com \
    --cc=Haijun.Zhang@freescale.com \
    --cc=aaron.lu@intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=cjb@laptop.org \
    --cc=cxie4@marvell.com \
    --cc=fabio.estevam@freescale.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=girish.shivananjappa@linaro.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=johan.rudholm@stericsson.com \
    --cc=keyuan.liu@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=prakity@nvidia.com \
    --cc=shawn.guo@linaro.org \
    --cc=sthumma@codeaurora.org \
    --cc=swarren@wwwdotorg.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wei_wang@realsil.com.cn \
    --cc=zhangfei.gao@gmail.com \
    /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