]> git.sur5r.net Git - u-boot/blobdiff - drivers/mmc/rockchip_sdhci.c
Merge branch 'master' of git://git.denx.de/u-boot-spi
[u-boot] / drivers / mmc / rockchip_sdhci.c
index 0f31dfc3fd16dc599c3024a605af4b875fa47e1e..cb623d589b497ee3057aa53e47f3c1c6de72f58f 100644 (file)
@@ -1,21 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2016 Fuzhou Rockchip Electronics Co., Ltd
  *
  * Rockchip SD Host Controller Interface
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.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
 
@@ -62,6 +60,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);
 
@@ -82,6 +87,7 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
 
        host->name = dev->name;
        host->ioaddr = dev_read_addr_ptr(dev);
+       host->bus_width = dev_read_u32_default(dev, "bus-width", 4);
 #endif
 
        return 0;