summaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc.c
diff options
context:
space:
mode:
authorƁukasz Majewski <l.majewski@samsung.com>2012-03-12 22:07:18 +0000
committerAndy Fleming <afleming@freescale.com>2012-05-08 18:02:21 -0500
commit62722036410b7887a04cf6705effb3122fb9b549 (patch)
tree85ff614d4d3deb0cb6ea676ae0dd869c1797e2bb /drivers/mmc/mmc.c
parent0a6deb3251a68b5be640ab1b848ca67e906b75ce (diff)
mmc:fix: Set mmc width according to MMC host capabilities
This patch sets the MMC width according to the MMC host capabilities. It turned out, that there are some targets (e.g. GONI), which are able to read data from SPI only at 4 bit mode. This patch restricts the width number according to the MMC host. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Andy Fleming <afleming@gmail.com>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r--drivers/mmc/mmc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 596732e80e..aebe578ff6 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1199,7 +1199,9 @@ int mmc_startup(struct mmc *mmc)
else
mmc_set_clock(mmc, 25000000);
} else {
- for (width = EXT_CSD_BUS_WIDTH_8; width >= 0; width--) {
+ width = ((mmc->host_caps & MMC_MODE_MASK_WIDTH_BITS) >>
+ MMC_MODE_WIDTH_BITS_SHIFT);
+ for (; width >= 0; width--) {
/* Set the card to use 4 bit*/
err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_BUS_WIDTH, width);