aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-08-07 21:36:20 -0400
committerTom Rini <trini@konsulko.com>2018-08-07 21:36:20 -0400
commitfc82e7684ba31a1a6ef721e7d750f37117906a70 (patch)
treeb8ebeb9450162362a4f93194d44d3219f1b99a58 /drivers/mmc
parentb1aad8dbe28415695b290726199681ced969c118 (diff)
parent972d8576d225c5fa8187ba09306fd439967ca7d8 (diff)
downloadu-boot-fc82e7684ba31a1a6ef721e7d750f37117906a70.zip
u-boot-fc82e7684ba31a1a6ef721e7d750f37117906a70.tar.gz
u-boot-fc82e7684ba31a1a6ef721e7d750f37117906a70.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-samsung
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/exynos_dw_mmc.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index 865fdf4..435ccac 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);
}
@@ -146,17 +150,11 @@ static int do_dwmci_init(struct dwmci_host *host)
}
static int exynos_dwmci_get_config(const void *blob, int node,
- struct dwmci_host *host)
+ struct dwmci_host *host,
+ struct dwmci_exynos_priv_data *priv)
{
int err = 0;
u32 base, timing[3];
- struct dwmci_exynos_priv_data *priv;
-
- priv = malloc(sizeof(struct dwmci_exynos_priv_data));
- if (!priv) {
- pr_err("dwmci_exynos_priv_data malloc fail!\n");
- return -ENOMEM;
- }
/* Extract device id for each mmc channel */
host->dev_id = pinmux_decode_periph_id(blob, node);
@@ -167,7 +165,6 @@ static int exynos_dwmci_get_config(const void *blob, int node,
if (host->dev_index > 4) {
printf("DWMMC%d: Can't get the dev index\n", host->dev_index);
- free(priv);
return -EINVAL;
}
@@ -178,7 +175,6 @@ static int exynos_dwmci_get_config(const void *blob, int node,
base = fdtdec_get_addr(blob, node, "reg");
if (!base) {
printf("DWMMC%d: Can't get base address\n", host->dev_index);
- free(priv);
return -EINVAL;
}
host->ioaddr = (void *)base;
@@ -188,7 +184,6 @@ static int exynos_dwmci_get_config(const void *blob, int node,
if (err) {
printf("DWMMC%d: Can't get sdr-timings for devider\n",
host->dev_index);
- free(priv);
return -EINVAL;
}
@@ -208,14 +203,13 @@ static int exynos_dwmci_get_config(const void *blob, int node,
host->bus_hz = fdtdec_get_int(blob, node, "bus_hz", 0);
host->div = fdtdec_get_int(blob, node, "div", 0);
- host->priv = priv;
-
return 0;
}
static int exynos_dwmci_process_node(const void *blob,
int node_list[], int count)
{
+ struct dwmci_exynos_priv_data *priv;
struct dwmci_host *host;
int i, node, err;
@@ -224,11 +218,20 @@ static int exynos_dwmci_process_node(const void *blob,
if (node <= 0)
continue;
host = &dwmci_host[i];
- err = exynos_dwmci_get_config(blob, node, host);
+
+ priv = malloc(sizeof(struct dwmci_exynos_priv_data));
+ if (!priv) {
+ pr_err("dwmci_exynos_priv_data malloc fail!\n");
+ return -ENOMEM;
+ }
+
+ err = exynos_dwmci_get_config(blob, node, host, priv);
if (err) {
printf("%s: failed to decode dev %d\n", __func__, i);
+ free(priv);
return err;
}
+ host->priv = priv;
do_dwmci_init(host);
}
@@ -266,7 +269,8 @@ static int exynos_dwmmc_probe(struct udevice *dev)
struct dwmci_host *host = &priv->host;
int err;
- err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
+ err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host,
+ priv);
if (err)
return err;
err = do_dwmci_init(host);
@@ -291,6 +295,7 @@ static int exynos_dwmmc_bind(struct udevice *dev)
static const struct udevice_id exynos_dwmmc_ids[] = {
{ .compatible = "samsung,exynos4412-dw-mshc" },
+ { .compatible = "samsung,exynos-dwmmc" },
{ }
};