- /*
- * we must spin until response is ready or timed out
- * -- we don't get interrupts unless there is a bulk rx
- */
- do
- status = readw(host->base + GLAMO_REG_MMC_RB_STAT1);
- while (((((status >> 15) & 1) != (host->ccnt & 1)) ||
- (!(status & (GLAMO_STAT1_MMC_RB_RRDY |
- GLAMO_STAT1_MMC_RTOUT |
- GLAMO_STAT1_MMC_DTOUT |
- GLAMO_STAT1_MMC_BWERR |
- GLAMO_STAT1_MMC_BRERR)))) && (insanity_timeout--));
-
- if (insanity_timeout < 0)
- dev_info(&host->pdev->dev, "command timeout, continuing\n");
-
- if (status & (GLAMO_STAT1_MMC_RTOUT |
- GLAMO_STAT1_MMC_DTOUT))
- cmd->error = -ETIMEDOUT;
- if (status & (GLAMO_STAT1_MMC_BWERR |
- GLAMO_STAT1_MMC_BRERR))
- cmd->error = -EILSEQ;
-
- if (host->cmd_is_stop)
- goto bail;
-
- if (cmd->error) {
- dev_info(&host->pdev->dev, "Error after cmd: 0x%x\n", status);
- goto done;
- }
- /*
- * mangle the response registers in two different exciting
- * undocumented ways discovered by trial and error
- */
- if (mmc_resp_type(cmd) == MMC_RSP_R2)
- /* grab the response */
- for (n = 0; n < 8; n++) /* super mangle power 1 */
- pu16[n ^ 6] = readw(®_resp[n]);
- else
- for (n = 0; n < 3; n++) /* super mangle power 2 */
- pu16[n] = (readw(®_resp[n]) >> 8) |
- (readw(®_resp[n + 1]) << 8);