]> git.sur5r.net Git - u-boot/blobdiff - drivers/mmc/rockchip_sdhci.c
Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR
[u-boot] / drivers / mmc / rockchip_sdhci.c
index bdde831ffd5a959b4646c444829ac5b86b5be64c..8868f341f3375f0bb40e220b9b914030120fd153 100644 (file)
@@ -9,14 +9,12 @@
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.h>
-#include <fdtdec.h>
-#include <libfdt.h>
+#include <linux/libfdt.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <sdhci.h>
 #include <clk.h>
 
-DECLARE_GLOBAL_DATA_PTR;
 /* 400KHz is max freq for card ID etc. Use that as min */
 #define EMMC_MIN_FREQ  400000
 
@@ -46,12 +44,11 @@ static int arasan_sdhci_probe(struct udevice *dev)
        struct dtd_rockchip_rk3399_sdhci_5_1 *dtplat = &plat->dtplat;
 
        host->name = dev->name;
-       host->ioaddr = map_sysmem(dtplat->reg[1], dtplat->reg[3]);
+       host->ioaddr = map_sysmem(dtplat->reg[0], dtplat->reg[1]);
        max_frequency = dtplat->max_frequency;
        ret = clk_get_by_index_platdata(dev, 0, dtplat->clocks, &clk);
 #else
-       max_frequency = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-                       "max-frequency", 0);
+       max_frequency = dev_read_u32_default(dev, "max-frequency", 0);
        ret = clk_get_by_index(dev, 0, &clk);
 #endif
        if (!ret) {
@@ -64,6 +61,13 @@ static int arasan_sdhci_probe(struct udevice *dev)
 
        host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD;
        host->max_clk = max_frequency;
+       /*
+        * The sdhci-driver only supports 4bit and 8bit, as sdhci_setup_cfg
+        * doesn't allow us to clear MMC_MODE_4BIT.  Consequently, we don't
+        * check for other bus-width values.
+        */
+       if (host->bus_width == 8)
+               host->host_caps |= MMC_MODE_8BIT;
 
        ret = sdhci_setup_cfg(&plat->cfg, host, 0, EMMC_MIN_FREQ);
 
@@ -83,7 +87,8 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
        struct sdhci_host *host = dev_get_priv(dev);
 
        host->name = dev->name;
-       host->ioaddr = dev_get_addr_ptr(dev);
+       host->ioaddr = dev_read_addr_ptr(dev);
+       host->bus_width = dev_read_u32_default(dev, "bus-width", 4);
 #endif
 
        return 0;