[U-Boot] [UBOOT v2 08/15] mmc: sdhci: zynq: Define private structure arasan_sdhci_priv

Siva Durga Prasad Paladugu siva.durga.paladugu at xilinx.com
Mon Jan 30 11:38:25 CET 2017


Deine private structure arasan_sdhci_priv instead of sdhci_host
as private. This allows us in adding more private data  as required
for usage in driver.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
---
Changes from v1:
- None
---
 drivers/mmc/zynq_sdhci.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 69efa38..f98089e 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -22,13 +22,20 @@ struct arasan_sdhci_plat {
 	struct mmc mmc;
 };
 
+struct arasan_sdhci_priv {
+	struct sdhci_host *host;
+};
+
 static int arasan_sdhci_probe(struct udevice *dev)
 {
 	struct arasan_sdhci_plat *plat = dev_get_platdata(dev);
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
-	struct sdhci_host *host = dev_get_priv(dev);
+	struct arasan_sdhci_priv *priv = dev_get_priv(dev);
+	struct sdhci_host *host;
 	int ret;
 
+	host = priv->host;
+
 	host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
 		       SDHCI_QUIRK_BROKEN_R1B;
 
@@ -52,10 +59,14 @@ static int arasan_sdhci_probe(struct udevice *dev)
 
 static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
 {
-	struct sdhci_host *host = dev_get_priv(dev);
+	struct arasan_sdhci_priv *priv = dev_get_priv(dev);
+
+	priv->host = calloc(1, sizeof(struct sdhci_host));
+	if (priv->host == NULL)
+		return -1;
 
-	host->name = dev->name;
-	host->ioaddr = (void *)dev_get_addr(dev);
+	priv->host->name = dev->name;
+	priv->host->ioaddr = (void *)dev_get_addr(dev);
 
 	return 0;
 }
-- 
2.7.4



More information about the U-Boot mailing list