OSDN Git Service

mmc: core: Simplify by adding mmc_execute_tuning()
[uclinux-h8/linux.git] / drivers / mmc / core / core.c
index 2cdb06e..dc9eb01 100644 (file)
@@ -1077,6 +1077,30 @@ void mmc_set_ungated(struct mmc_host *host)
 }
 #endif
 
+int mmc_execute_tuning(struct mmc_card *card)
+{
+       struct mmc_host *host = card->host;
+       u32 opcode;
+       int err;
+
+       if (!host->ops->execute_tuning)
+               return 0;
+
+       if (mmc_card_mmc(card))
+               opcode = MMC_SEND_TUNING_BLOCK_HS200;
+       else
+               opcode = MMC_SEND_TUNING_BLOCK;
+
+       mmc_host_clk_hold(host);
+       err = host->ops->execute_tuning(host, opcode);
+       mmc_host_clk_release(host);
+
+       if (err)
+               pr_err("%s: tuning execution failed\n", mmc_hostname(host));
+
+       return err;
+}
+
 /*
  * Change the bus mode (open drain/push-pull) of a host.
  */