From: r65037@freescale.com (Richard Zhu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] sdhci-1: sdhci driver modifications when support FSL eSDHC
Date: Fri, 24 Sep 2010 11:54:24 +0800 [thread overview]
Message-ID: <1285300467-5158-2-git-send-email-r65037@freescale.com> (raw)
In-Reply-To: <1285300467-5158-1-git-send-email-r65037@freescale.com>
Add host's own get_ro func to support the controller that used it's own WP mechanism
Some controllers maybe have their exceptional WP mechanism in the different HW design
when implement the get_ro, add one get_ro api to supported them.
Signed-off-by: Richard Zhu <r65037@freescale.com>
---
drivers/mmc/host/sdhci-pltfm.c | 24 ++++++++++++++++++++++--
drivers/mmc/host/sdhci-pltfm.h | 7 +++++++
drivers/mmc/host/sdhci.c | 3 +++
drivers/mmc/host/sdhci.h | 1 +
include/linux/sdhci-pltfm.h | 2 ++
5 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e045e3c..202a6bf 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -54,12 +54,24 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
{
struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
const struct platform_device_id *platid = platform_get_device_id(pdev);
+ struct sdhci_pltfm_data *dpdata = (void *)platid->driver_data;
struct sdhci_host *host;
+ struct sdhci_pltfm_host *pltfm_host;
struct resource *iomem;
int ret;
if (!pdata && platid && platid->driver_data)
pdata = (void *)platid->driver_data;
+ else {
+ if (!pdata->ops)
+ pdata->ops = dpdata->ops;
+ if (pdata->quirks == 0)
+ pdata->quirks = dpdata->quirks;
+ if (!pdata->init)
+ pdata->init = dpdata->init;
+ if (!pdata->exit)
+ pdata->exit= dpdata->exit;
+ }
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iomem) {
@@ -72,15 +84,20 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
"experience problems.\n");
if (pdev->dev.parent)
- host = sdhci_alloc_host(pdev->dev.parent, 0);
+ host = sdhci_alloc_host(pdev->dev.parent,
+ sizeof(struct sdhci_pltfm_host));
else
- host = sdhci_alloc_host(&pdev->dev, 0);
+ host = sdhci_alloc_host(&pdev->dev,
+ sizeof(struct sdhci_pltfm_host));
if (IS_ERR(host)) {
ret = PTR_ERR(host);
goto err;
}
+ pltfm_host = sdhci_priv(host);
+ pltfm_host->wp_gpio = pdata->wp_gpio;
+
host->hw_name = "platform";
if (pdata && pdata->ops)
host->ops = pdata->ops;
@@ -161,6 +178,9 @@ static const struct platform_device_id sdhci_pltfm_ids[] = {
#ifdef CONFIG_MMC_SDHCI_CNS3XXX
{ "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata },
#endif
+#ifdef CONFIG_MMC_SDHCI_IMX
+ { "imx-sdhci", (kernel_ulong_t)&sdhci_imx_pdata },
+#endif
{ },
};
MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 900f329..2df8cac 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -13,6 +13,13 @@
#include <linux/sdhci-pltfm.h>
+struct sdhci_pltfm_host {
+ struct clk *clk;
+ u32 scratchpad; /* to handle quirks across io-accessor calls */
+ u32 wp_gpio; /* GPIO pin number that used as the Write Protect */
+};
+
extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
+extern struct sdhci_pltfm_data sdhci_imx_pdata;
#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7855121..10e5931 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1208,6 +1208,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
host = mmc_priv(mmc);
+ if (host->ops->get_ro)
+ return host->ops->get_ro(host);
+
spin_lock_irqsave(&host->lock, flags);
if (host->flags & SDHCI_DEVICE_DEAD)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 036cfae..e765cc6 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -321,6 +321,7 @@ struct sdhci_ops {
unsigned int (*get_max_clock)(struct sdhci_host *host);
unsigned int (*get_min_clock)(struct sdhci_host *host);
unsigned int (*get_timeout_clock)(struct sdhci_host *host);
+ unsigned int (*get_ro)(struct sdhci_host *host);
};
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h
index 0239bd7..da83e76 100644
--- a/include/linux/sdhci-pltfm.h
+++ b/include/linux/sdhci-pltfm.h
@@ -30,6 +30,8 @@ struct sdhci_pltfm_data {
unsigned int quirks;
int (*init)(struct sdhci_host *host);
void (*exit)(struct sdhci_host *host);
+ unsigned int wp_gpio; /* GPIO pin num that used as the Write Protect */
+ unsigned int caps; /* Board specified max bus width */
};
#endif /* _SDHCI_PLTFM_H */
--
1.7.0
next prev parent reply other threads:[~2010-09-24 3:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-24 3:54 [4-0] serial patches that enable the eSDHC on iMX51 Richard Zhu
2010-09-24 3:54 ` Richard Zhu [this message]
2010-09-24 3:54 ` [PATCH 2/4] esdhc-2 mx51: Modify the MSL codes when upstreaming fsl esdhc driver Richard Zhu
2010-09-24 3:54 ` [PATCH 3/4] esdhc-3 esdhc: fsl esdhc driver based on sdhci driver Richard Zhu
2010-09-24 3:54 ` [PATCH 4/4] esdhc-4 mx51: enable fsl esdhc driver Richard Zhu
2010-09-24 3:57 ` Zhu Richard-R65037
2010-09-29 14:28 ` [PATCH 2/4] esdhc-2 mx51: Modify the MSL codes when upstreaming " Uwe Kleine-König
-- strict thread matches above, loose matches on Subject: below --
2010-09-24 3:43 [4-0] Serial patchs that upstream fsl i.MX MX51 sdhci driver Richard Zhu
2010-09-24 3:43 ` [PATCH 1/4] sdhci-1: sdhci driver modifications when support FSL eSDHC Richard Zhu
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=1285300467-5158-2-git-send-email-r65037@freescale.com \
--to=r65037@freescale.com \
--cc=linux-arm-kernel@lists.infradead.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).