1 --- a/drivers/mmc/host/sdhci.c
2 +++ b/drivers/mmc/host/sdhci.c
4 * Controller doesn't count down when in single block mode.
7 - blocks = (data->error == MMC_ERR_NONE) ? 0 : 1;
8 + blocks = (data->error == 0) ? 0 : 1;
10 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
11 data->bytes_xfered = data->blksz * (data->blocks - blocks);
13 - if ((data->error == MMC_ERR_NONE) && blocks) {
14 + if (!data->error && blocks) {
15 printk(KERN_ERR "%s: Controller signalled completion even "
16 "though there were blocks left.\n",
17 mmc_hostname(host->mmc));
18 - data->error = MMC_ERR_FAILED;
24 * The controller needs a reset of internal state machines
25 * upon error conditions.
27 - if (data->error != MMC_ERR_NONE) {
29 sdhci_reset(host, SDHCI_RESET_CMD);
30 sdhci_reset(host, SDHCI_RESET_DATA);
33 printk(KERN_ERR "%s: Controller never released "
34 "inhibit bit(s).\n", mmc_hostname(host->mmc));
36 - cmd->error = MMC_ERR_FAILED;
38 tasklet_schedule(&host->finish_tasklet);
42 if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) {
43 printk(KERN_ERR "%s: Unsupported response type!\n",
44 mmc_hostname(host->mmc));
45 - cmd->error = MMC_ERR_INVALID;
46 + cmd->error = -EINVAL;
47 tasklet_schedule(&host->finish_tasklet);
54 - host->cmd->error = MMC_ERR_NONE;
55 + host->cmd->error = 0;
57 if (host->data && host->data_early)
58 sdhci_finish_data(host);
62 if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) {
63 - host->mrq->cmd->error = MMC_ERR_TIMEOUT;
64 + host->mrq->cmd->error = -ENOMEDIUM;
65 tasklet_schedule(&host->finish_tasklet);
67 sdhci_send_command(host, mrq->cmd);
69 sdhci_reset(host, SDHCI_RESET_CMD);
70 sdhci_reset(host, SDHCI_RESET_DATA);
72 - host->mrq->cmd->error = MMC_ERR_FAILED;
73 + host->mrq->cmd->error = -ENOMEDIUM;
74 tasklet_schedule(&host->finish_tasklet);
78 * The controller needs a reset of internal state machines
79 * upon error conditions.
81 - if ((mrq->cmd->error != MMC_ERR_NONE) ||
82 - (mrq->data && ((mrq->data->error != MMC_ERR_NONE) ||
83 - (mrq->data->stop && (mrq->data->stop->error != MMC_ERR_NONE))))) {
84 + if (mrq->cmd->error ||
85 + (mrq->data && (mrq->data->error ||
86 + (mrq->data->stop && mrq->data->stop->error)))) {
88 /* Some controllers need this kick or reset won't work here */
89 if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) {
94 - host->data->error = MMC_ERR_TIMEOUT;
95 + host->data->error = -ETIMEDOUT;
96 sdhci_finish_data(host);
99 - host->cmd->error = MMC_ERR_TIMEOUT;
100 + host->cmd->error = -ETIMEDOUT;
102 - host->mrq->cmd->error = MMC_ERR_TIMEOUT;
103 + host->mrq->cmd->error = -ETIMEDOUT;
105 tasklet_schedule(&host->finish_tasklet);
107 @@ -941,13 +941,12 @@
110 if (intmask & SDHCI_INT_TIMEOUT)
111 - host->cmd->error = MMC_ERR_TIMEOUT;
112 - else if (intmask & SDHCI_INT_CRC)
113 - host->cmd->error = MMC_ERR_BADCRC;
114 - else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX))
115 - host->cmd->error = MMC_ERR_FAILED;
116 + host->cmd->error = -ETIMEDOUT;
117 + else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT |
119 + host->cmd->error = -EILSEQ;
121 - if (host->cmd->error != MMC_ERR_NONE)
122 + if (host->cmd->error)
123 tasklet_schedule(&host->finish_tasklet);
124 else if (intmask & SDHCI_INT_RESPONSE)
125 sdhci_finish_command(host);
126 @@ -974,13 +973,11 @@
129 if (intmask & SDHCI_INT_DATA_TIMEOUT)
130 - host->data->error = MMC_ERR_TIMEOUT;
131 - else if (intmask & SDHCI_INT_DATA_CRC)
132 - host->data->error = MMC_ERR_BADCRC;
133 - else if (intmask & SDHCI_INT_DATA_END_BIT)
134 - host->data->error = MMC_ERR_FAILED;
135 + host->data->error = -ETIMEDOUT;
136 + else if (intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_END_BIT))
137 + host->data->error = -EILSEQ;
139 - if (host->data->error != MMC_ERR_NONE)
140 + if (host->data->error)
141 sdhci_finish_data(host);
143 if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL))
144 @@ -1312,7 +1309,7 @@
145 mmc->ops = &sdhci_ops;
146 mmc->f_min = host->max_clk / 256;
147 mmc->f_max = host->max_clk;
148 - mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE | MMC_CAP_BYTEBLOCK;
149 + mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE;
151 if (caps & SDHCI_CAN_DO_HISPD)
152 mmc->caps |= MMC_CAP_SD_HIGHSPEED;