summaryrefslogtreecommitdiff
path: root/drivers/mmc/arm_pl180_mmci.c
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2017-10-23 11:57:32 +0300
committerTom Rini <trini@konsulko.com>2017-11-17 15:44:13 +0300
commit9035bb7432d33014fd131390c635e634aaacd4d0 (patch)
tree66b5194de4f48cf3e29e2adb1578f455f86afd8c /drivers/mmc/arm_pl180_mmci.c
parent3c0dbed232bd17a7bed773f545420460a3ac183a (diff)
downloadu-boot-9035bb7432d33014fd131390c635e634aaacd4d0.tar.xz
mmc: arm_pl180_mmci: add bus_width DT property support
Allow to get "bus-width" property from device tree Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'drivers/mmc/arm_pl180_mmci.c')
-rw-r--r--drivers/mmc/arm_pl180_mmci.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index b3c1f0ddcb..fd57b55848 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -408,6 +408,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct mmc *mmc = &pdata->mmc;
struct pl180_mmc_host *host = mmc->priv;
+ u32 bus_width;
int ret;
strcpy(host->name, "MMC");
@@ -421,6 +422,21 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
host->clock_max = dev_read_u32_default(dev, "max-frequency",
MMC_CLOCK_MAX);
host->version2 = dev_get_driver_data(dev);
+
+ bus_width = dev_read_u32_default(dev, "bus-width", 1);
+ switch (bus_width) {
+ case 8:
+ host->caps |= MMC_MODE_8BIT;
+ /* Hosts capable of 8-bit transfers can also do 4 bits */
+ case 4:
+ host->caps |= MMC_MODE_4BIT;
+ break;
+ case 1:
+ break;
+ default:
+ dev_err(dev, "Invalid bus-width value %u\n", bus_width);
+ }
+
ret = arm_pl180_mmci_init(host, &mmc);
if (ret) {
dev_err(dev, "arm_pl180_mmci init failed\n");