]> git.sur5r.net Git - u-boot/blobdiff - drivers/mmc/s5p_sdhci.c
Merge branch 'master' of git://git.denx.de/u-boot-sh
[u-boot] / drivers / mmc / s5p_sdhci.c
index ac737e0f0f26f0c03f35258237ad8361a30068df..591a3bce0849f1b9302d4c7c8bd1ad69dedfc466 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2012 SAMSUNG Electronics
  * Jaehoon Chung <jh80.chung@samsung.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -10,7 +9,7 @@
 #include <malloc.h>
 #include <sdhci.h>
 #include <fdtdec.h>
-#include <libfdt.h>
+#include <linux/libfdt.h>
 #include <asm/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/clk.h>
@@ -73,6 +72,17 @@ static void s5p_sdhci_set_control_reg(struct sdhci_host *host)
        sdhci_writel(host, ctrl, SDHCI_CONTROL2);
 }
 
+static void s5p_set_clock(struct sdhci_host *host, u32 div)
+{
+       /* ToDo : Use the Clock Framework */
+       set_mmc_clk(host->index, div);
+}
+
+static const struct sdhci_ops s5p_sdhci_ops = {
+       .set_clock      = &s5p_set_clock,
+       .set_control_reg = &s5p_sdhci_set_control_reg,
+};
+
 static int s5p_sdhci_core_init(struct sdhci_host *host)
 {
        host->name = S5P_NAME;
@@ -80,16 +90,15 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
        host->quirks = SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_VOLTAGE |
                SDHCI_QUIRK_32BIT_DMA_ADDR |
                SDHCI_QUIRK_WAIT_SEND_CMD | SDHCI_QUIRK_USE_WIDE8;
+       host->max_clk = 52000000;
        host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
-
-       host->set_control_reg = &s5p_sdhci_set_control_reg;
-       host->set_clock = set_mmc_clk;
+       host->ops = &s5p_sdhci_ops;
 
        if (host->bus_width == 8)
                host->host_caps |= MMC_MODE_8BIT;
 
 #ifndef CONFIG_BLK
-       return add_sdhci(host, 52000000, 400000);
+       return add_sdhci(host, 0, 400000);
 #else
        return 0;
 #endif
@@ -174,10 +183,10 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host)
        }
        host->ioaddr = (void *)base;
 
-       gpio_request_by_name_nodev(blob, node, "pwr-gpios", 0, &host->pwr_gpio,
-                                  GPIOD_IS_OUT);
-       gpio_request_by_name_nodev(blob, node, "cd-gpios", 0, &host->cd_gpio,
-                                  GPIOD_IS_IN);
+       gpio_request_by_name_nodev(offset_to_ofnode(node), "pwr-gpios", 0,
+                                  &host->pwr_gpio, GPIOD_IS_OUT);
+       gpio_request_by_name_nodev(offset_to_ofnode(node), "cd-gpios", 0,
+                                  &host->cd_gpio, GPIOD_IS_IN);
 
        return 0;
 }
@@ -237,7 +246,7 @@ static int s5p_sdhci_probe(struct udevice *dev)
        struct sdhci_host *host = dev_get_priv(dev);
        int ret;
 
-       ret = sdhci_get_config(gd->fdt_blob, dev->of_offset, host);
+       ret = sdhci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
        if (ret)
                return ret;
 
@@ -245,7 +254,7 @@ static int s5p_sdhci_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       ret = sdhci_setup_cfg(&plat->cfg, host, 52000000, 400000);
+       ret = sdhci_setup_cfg(&plat->cfg, host, 0, 400000);
        if (ret)
                return ret;