]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: Resolve the mmc build issues for other platmorms
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Fri, 13 Apr 2018 06:45:49 +0000 (12:15 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 23 Apr 2018 06:57:39 +0000 (08:57 +0200)
This patch resolve the build issues for mmc while
building for other platforms(eg-s5p_goni).

Signed-off-by: Nitin Jain <nitin.jain@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mmc/mmc.c
drivers/mmc/sdhci.c

index a30c81d5e16d208133e0ce64f15fd5554e82d049..73885f65dcc194104feaceacc261d4c3a8a415a3 100644 (file)
@@ -339,7 +339,7 @@ static int mmc_go_idle(struct mmc *mmc)
        return 0;
 }
 
-#ifndef CONFIG_DM_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 static int mmc_set_voltage(struct mmc *mmc)
 {
        int err = 0;
@@ -597,12 +597,38 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
 
 }
 
-#ifndef CONFIG_DM_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
 static void mmc_set_ios(struct mmc *mmc)
 {
        if (mmc->cfg->ops->set_ios)
                mmc->cfg->ops->set_ios(mmc);
 }
+
+static int mmc_switch_uhs(struct mmc *mmc)
+{
+       int err = 0;
+
+       if (mmc->cfg->ops->set_uhs)
+               err = mmc->cfg->ops->set_uhs(mmc);
+
+       return err;
+}
+
+static int mmc_execute_tuning(struct mmc *mmc)
+{
+       int err = 0;
+       u8 cmd;
+
+       if (mmc->cfg->ops->execute_tuning) {
+               if (IS_SD(mmc))
+                       cmd = MMC_CMD_SEND_TUNING_BLOCK;
+               else
+                       cmd = MMC_CMD_SEND_TUNING_BLOCK_HS200;
+               err = mmc->cfg->ops->execute_tuning(mmc, cmd);
+       }
+
+       return err;
+}
 #endif
 
 static void mmc_set_bus_width(struct mmc *mmc, uint width)
@@ -1345,14 +1371,6 @@ static const u8 multipliers[] = {
        80,
 };
 
-#if !CONFIG_IS_ENABLED(DM_MMC)
-static void mmc_set_ios(struct mmc *mmc)
-{
-       if (mmc->cfg->ops->set_ios)
-               mmc->cfg->ops->set_ios(mmc);
-}
-#endif
-
 void mmc_set_clock(struct mmc *mmc, uint clock)
 {
        if (clock > mmc->cfg->f_max)
@@ -1366,34 +1384,6 @@ void mmc_set_clock(struct mmc *mmc, uint clock)
        mmc_set_ios(mmc);
 }
 
-#ifndef CONFIG_DM_MMC
-static int mmc_switch_uhs(struct mmc *mmc)
-{
-       int err = 0;
-
-       if (mmc->cfg->ops->set_uhs)
-               err = mmc->cfg->ops->set_uhs(mmc);
-
-       return err;
-}
-
-static int mmc_execute_tuning(struct mmc *mmc)
-{
-       int err = 0;
-       u8 cmd;
-
-       if (mmc->cfg->ops->execute_tuning) {
-               if (IS_SD(mmc))
-                       cmd = MMC_CMD_SEND_TUNING_BLOCK;
-               else
-                       cmd = MMC_CMD_SEND_TUNING_BLOCK_HS200;
-               err = mmc->cfg->ops->execute_tuning(mmc, cmd);
-       }
-
-       return err;
-}
-#endif
-
 static int mmc_startup(struct mmc *mmc)
 {
        int err, i;
index 513bb564909b7b275b584a707239ede144ad8c1a..064ccf85c446a84d7cd3a10c9f8ed6ab5b45b6b9 100644 (file)
@@ -323,7 +323,8 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
        else
                return -ECOMM;
 }
-#ifdef CONFIG_DM_MMC
+
+#if CONFIG_IS_ENABLED(DM_MMC)
 static int sdhci_execute_tuning(struct udevice *dev, u8 opcode)
 {
        struct mmc *mmc = mmc_get_mmc_dev(dev);
@@ -379,7 +380,11 @@ static int sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
                sdhci_writew(host, data.blocks, SDHCI_BLOCK_COUNT);
                sdhci_writew(host, SDHCI_TRNS_READ, SDHCI_TRANSFER_MODE);
 
+#if CONFIG_IS_ENABLED(DM_MMC)
                sdhci_send_command(dev, &cmd, &data);
+#else
+               sdhci_send_command(mmc, &cmd, &data);
+#endif
                ctrl = sdhci_readw(host, SDHCI_HOST_CTRL2);
 
                if (cmd.cmdidx == MMC_CMD_SEND_TUNING_BLOCK)