diff options
Diffstat (limited to 'drivers/mci/omap_hsmmc.c')
-rw-r--r-- | drivers/mci/omap_hsmmc.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c index cbc69e4083..4e809bae4f 100644 --- a/drivers/mci/omap_hsmmc.c +++ b/drivers/mci/omap_hsmmc.c @@ -316,13 +316,16 @@ static int mmc_read_data(struct omap_hsmmc *hsmmc, char *buf, unsigned int size) do { mmc_stat = readl(&mmc_base->stat); if (is_timeout(start, SECOND)) { - dev_dbg(hsmmc->dev, "timedout waiting for status!\n"); + dev_err(hsmmc->dev, "timedout waiting for status!\n"); return -ETIMEDOUT; } } while (mmc_stat == 0); - if ((mmc_stat & ERRI_MASK) != 0) - return 1; + if ((mmc_stat & ERRI_MASK) != 0) { + dev_err(hsmmc->dev, "Error while reading data. status: 0x%08x\n", + mmc_stat); + return -EIO; + } if (mmc_stat & BRR_MASK) { unsigned int k; @@ -349,7 +352,6 @@ static int mmc_read_data(struct omap_hsmmc *hsmmc, char *buf, unsigned int size) return 0; } -#ifdef CONFIG_MCI_WRITE static int mmc_write_data(struct omap_hsmmc *hsmmc, const char *buf, unsigned int size) { struct hsmmc *mmc_base = hsmmc->base; @@ -373,8 +375,11 @@ static int mmc_write_data(struct omap_hsmmc *hsmmc, const char *buf, unsigned in } } while (mmc_stat == 0); - if ((mmc_stat & ERRI_MASK) != 0) - return 1; + if ((mmc_stat & ERRI_MASK) != 0) { + dev_err(hsmmc->dev, "Error while reading data. status: 0x%08x\n", + mmc_stat); + return -EIO; + } if (mmc_stat & BWR_MASK) { unsigned int k; @@ -400,7 +405,6 @@ static int mmc_write_data(struct omap_hsmmc *hsmmc, const char *buf, unsigned in } return 0; } -#endif static int mmc_send_cmd(struct mci_host *mci, struct mci_cmd *cmd, struct mci_data *data) @@ -511,13 +515,18 @@ static int mmc_send_cmd(struct mci_host *mci, struct mci_cmd *cmd, } } - if (data && (data->flags & MMC_DATA_READ)) - mmc_read_data(hsmmc, data->dest, data->blocksize * data->blocks); -#ifdef CONFIG_MCI_WRITE - else if (data && (data->flags & MMC_DATA_WRITE)) - mmc_write_data(hsmmc, data->src, data->blocksize * data->blocks); -#endif - return 0; + if (!data) + return 0; + + if (data->flags & MMC_DATA_READ) + return mmc_read_data(hsmmc, data->dest, + data->blocksize * data->blocks); + + if (IS_ENABLED(CONFIG_MCI_WRITE)) + return mmc_write_data(hsmmc, data->src, + data->blocksize * data->blocks); + + return -ENOSYS; } static void mmc_set_ios(struct mci_host *mci, struct mci_ios *ios) @@ -625,12 +634,6 @@ static int omap_mmc_probe(struct device_d *dev) hsmmc->mci.devname = pdata->devname; } - if (dev->device_node) { - const char *alias = of_alias_get(dev->device_node); - if (alias) - hsmmc->mci.devname = xstrdup(alias); - } - mci_of_parse(&hsmmc->mci); dev->priv = hsmmc; |