From: Lukasz Majewski <lukma@denx.de>
Date: Wed, 1 Aug 2018 12:48:59 +0000 (+0200)
Subject: ARM: Odroid XU3: Fix the dwmci_exynos *priv data assignment for DM_MMC (sdr_timing)
X-Git-Tag: v2025.01-rc5-pxa1908~3798^2~4
X-Git-Url: http://git.dujemihanovic.xyz/img/static/login.html?a=commitdiff_plain;h=7c350a2a0fe52264d5aa55b9f7823c78dbb222d9;p=u-boot.git

ARM: Odroid XU3: Fix the dwmci_exynos *priv data assignment for DM_MMC (sdr_timing)

By convention for DM_MMC the host->priv is used to store struct udevice
*dev pointer.

Unfortunately, the legacy Exynos DW MMC code uses this field to
store pointer to dwmci_exynos_priv_data struct
Hence, we do need to get data in other way - namely by using container_of
when host pointer is present.
In this way the sdr_timing data is properly accessed.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
---

diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index 49c4f76348..cd0fa4c634 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -46,8 +46,12 @@ struct dwmci_exynos_priv_data {
  */
 static void exynos_dwmci_clksel(struct dwmci_host *host)
 {
+#ifdef CONFIG_DM_MMC
+	struct dwmci_exynos_priv_data *priv =
+		container_of(host, struct dwmci_exynos_priv_data, host);
+#else
 	struct dwmci_exynos_priv_data *priv = host->priv;
-
+#endif
 	dwmci_writel(host, DWMCI_CLKSEL, priv->sdr_timing);
 }