return 0;
}
-#ifndef CONFIG_DM_MMC
+#if !CONFIG_IS_ENABLED(DM_MMC)
static int mmc_set_voltage(struct mmc *mmc)
{
int err = 0;
}
-#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)
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)
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;
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);
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)