@@ -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);
@@ -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 */
@@ -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)
@@ -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
@@ -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 */