mmc: Add new API call 'sdio_reset_comm' for resetting communication with an SDIO device

Change-Id: I955f6c753235ae65014d6ea34c9e660e92277971
Signed-off-by: San Mehat <san@android.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
San Mehat
2008-05-15 09:15:37 -07:00
committed by Tao Huang
parent b7928dccbf
commit eccf203ed1
2 changed files with 43 additions and 0 deletions

View File

@@ -81,6 +81,8 @@ int mmc_attach_mmc(struct mmc_host *host);
int mmc_attach_sd(struct mmc_host *host);
int mmc_attach_sdio(struct mmc_host *host);
int sdio_reset_comm(struct mmc_card *card);
/* Module parameters */
extern bool use_spi_crc;

View File

@@ -10,6 +10,7 @@
*/
#include <linux/err.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/mmc/host.h>
@@ -1210,3 +1211,43 @@ err:
return err;
}
int sdio_reset_comm(struct mmc_card *card)
{
struct mmc_host *host = card->host;
u32 ocr;
u32 rocr;
int err;
printk("%s():\n", __func__);
mmc_claim_host(host);
mmc_retune_disable(host);
mmc_power_cycle(host, host->card->ocr);
mmc_go_idle(host);
mmc_set_clock(host, host->f_min);
err = mmc_send_io_op_cond(host, 0, &ocr);
if (err)
goto err;
rocr = mmc_select_voltage(host, ocr);
if (!rocr) {
err = -EINVAL;
goto err;
}
err = mmc_sdio_init_card(host, rocr, card, 0);
if (err)
goto err;
mmc_release_host(host);
return 0;
err:
printk("%s: Error resetting SDIO communications (%d)\n",
mmc_hostname(host), err);
mmc_release_host(host);
return err;
}
EXPORT_SYMBOL(sdio_reset_comm);