From: Siva Durga Prasad Paladugu Date: Fri, 13 Apr 2018 06:45:49 +0000 (+0530) Subject: mmc: Resolve the mmc build issues for other platmorms X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3f012d1732baffd958426376d0a8d74206cf56e;p=thirdparty%2Fu-boot.git mmc: Resolve the mmc build issues for other platmorms This patch resolve the build issues for mmc while building for other platforms(eg-s5p_goni). Signed-off-by: Nitin Jain Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index a30c81d5e16..73885f65dcc 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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; diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 513bb564909..064ccf85c44 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -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)