mmc: omap: fix for bus width which improves SD card's peformance.
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / host / omap_hsmmc.c
index b032828c61263028963bd412a7455546d5e86ce7..a0c8515cb3b9809230b0d59b789fa6f77661a5c2 100644 (file)
@@ -2096,10 +2096,23 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
        mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
                     MMC_CAP_WAIT_WHILE_BUSY;
 
-       if (mmc_slot(host).wires >= 8)
+       switch (mmc_slot(host).wires) {
+       case 8:
                mmc->caps |= MMC_CAP_8_BIT_DATA;
-       else if (mmc_slot(host).wires >= 4)
+               /* Fall through */
+       case 4:
                mmc->caps |= MMC_CAP_4_BIT_DATA;
+               break;
+       case 1:
+               /* Nothing to crib here */
+       case 0:
+               /* Assuming nothing was given by board, Core use's 1-Bit */
+               break;
+       default:
+               /* Completely unexpected.. Core goes with 1-Bit Width */
+               dev_crit(mmc_dev(host->mmc), "Invalid width %d\n used!"
+                       "using 1 instead\n", mmc_slot(host).wires);
+       }
 
        if (mmc_slot(host).nonremovable)
                mmc->caps |= MMC_CAP_NONREMOVABLE;