mmc: sdhci: fix driver type B and D handling in sdhci_do_set_ios()
authorPetri Gynther <pgynther@google.com>
Wed, 20 May 2015 21:35:00 +0000 (14:35 -0700)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 1 Jun 2015 07:07:09 +0000 (09:07 +0200)
sdhci_do_set_ios() doesn't currently program SDHCI_HOST_CONTROL2
register correctly when host->preset_enabled == false.

Add code to handle the missing cases MMC_SET_DRIVER_TYPE_B and
MMC_SET_DRIVER_TYPE_D.

Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci.c

index 58c1770e879d6b73bc9edafa634e0af849f818a8..b35ec79e72052a52a861757f6877a2e7db132b4e 100644 (file)
@@ -1514,8 +1514,17 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
                        ctrl_2 &= ~SDHCI_CTRL_DRV_TYPE_MASK;
                        if (ios->drv_type == MMC_SET_DRIVER_TYPE_A)
                                ctrl_2 |= SDHCI_CTRL_DRV_TYPE_A;
+                       else if (ios->drv_type == MMC_SET_DRIVER_TYPE_B)
+                               ctrl_2 |= SDHCI_CTRL_DRV_TYPE_B;
                        else if (ios->drv_type == MMC_SET_DRIVER_TYPE_C)
                                ctrl_2 |= SDHCI_CTRL_DRV_TYPE_C;
+                       else if (ios->drv_type == MMC_SET_DRIVER_TYPE_D)
+                               ctrl_2 |= SDHCI_CTRL_DRV_TYPE_D;
+                       else {
+                               pr_warn("%s: invalid driver type, default to "
+                                       "driver type B\n", mmc_hostname(mmc));
+                               ctrl_2 |= SDHCI_CTRL_DRV_TYPE_B;
+                       }
 
                        sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
                } else {