aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2010-10-15 06:20:59 -0400
committerChris Ball <cjb@laptop.org>2010-10-23 09:11:21 -0400
commit4b711cb13843f5082e82970dd1e8031383134a65 (patch)
tree7d893ce601b08ac630a14ecb5c5e7fe854968ba0
parent9ffca8300abe4bd7260b77b2f82afb01384faabc (diff)
mmc: sdhci-pltfm: Add structure for host-specific data
We need to carry some information per host, e.g. the clock. Add a structure for it and initialize it in the generic part. Also improve the check for a parent. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Richard Röjfors <richard.rojfors.ext@mocean-labs.com> Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r--drivers/mmc/host/sdhci-pltfm.c10
-rw-r--r--drivers/mmc/host/sdhci-pltfm.h7
2 files changed, 14 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 4f126de5f49..730fdf54ecb 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -55,6 +55,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
55 struct sdhci_pltfm_data *pdata = pdev->dev.platform_data; 55 struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
56 const struct platform_device_id *platid = platform_get_device_id(pdev); 56 const struct platform_device_id *platid = platform_get_device_id(pdev);
57 struct sdhci_host *host; 57 struct sdhci_host *host;
58 struct sdhci_pltfm_host *pltfm_host;
58 struct resource *iomem; 59 struct resource *iomem;
59 int ret; 60 int ret;
60 61
@@ -71,16 +72,19 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
71 dev_err(&pdev->dev, "Invalid iomem size. You may " 72 dev_err(&pdev->dev, "Invalid iomem size. You may "
72 "experience problems.\n"); 73 "experience problems.\n");
73 74
74 if (pdev->dev.parent) 75 /* Some PCI-based MFD need the parent here */
75 host = sdhci_alloc_host(pdev->dev.parent, 0); 76 if (pdev->dev.parent != &platform_bus)
77 host = sdhci_alloc_host(pdev->dev.parent, sizeof(*pltfm_host));
76 else 78 else
77 host = sdhci_alloc_host(&pdev->dev, 0); 79 host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
78 80
79 if (IS_ERR(host)) { 81 if (IS_ERR(host)) {
80 ret = PTR_ERR(host); 82 ret = PTR_ERR(host);
81 goto err; 83 goto err;
82 } 84 }
83 85
86 pltfm_host = sdhci_priv(host);
87
84 host->hw_name = "platform"; 88 host->hw_name = "platform";
85 if (pdata && pdata->ops) 89 if (pdata && pdata->ops)
86 host->ops = pdata->ops; 90 host->ops = pdata->ops;
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 900f32902f7..93a031973f6 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -11,8 +11,15 @@
11#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H 11#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
12#define _DRIVERS_MMC_SDHCI_PLTFM_H 12#define _DRIVERS_MMC_SDHCI_PLTFM_H
13 13
14#include <linux/clk.h>
15#include <linux/types.h>
14#include <linux/sdhci-pltfm.h> 16#include <linux/sdhci-pltfm.h>
15 17
18struct sdhci_pltfm_host {
19 struct clk *clk;
20 u32 scratchpad; /* to handle quirks across io-accessor calls */
21};
22
16extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata; 23extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata;
17 24
18#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ 25#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */