- if (data->flags & MMC_DATA_READ) {
- writew((u16)(GLAMO_FB_SIZE + (RESSIZE(host->mem_data) / 2)),
- host->base + GLAMO_REG_MMC_WDATADS1);
- writew((u16)((GLAMO_FB_SIZE +
- (RESSIZE(host->mem_data) / 2)) >> 16),
- host->base + GLAMO_REG_MMC_WDATADS2);
- } else {
- writew((u16)GLAMO_FB_SIZE, host->base +
- GLAMO_REG_MMC_RDATADS1);
- writew((u16)(GLAMO_FB_SIZE >> 16), host->base +
- GLAMO_REG_MMC_RDATADS2);
+ udelay(5);
+ do
+ status = readw(host->mmio_base + GLAMO_REG_MMC_RB_STAT1);
+ while (((((status >> 15) & 1) != (host->request_counter & 1)) ||
+ (!(status & (GLAMO_STAT1_MMC_RB_RRDY |
+ GLAMO_STAT1_MMC_RTOUT |
+ GLAMO_STAT1_MMC_DTOUT |
+ GLAMO_STAT1_MMC_BWERR |
+ GLAMO_STAT1_MMC_BRERR)))) && (timeout--));
+
+ if ((status & (GLAMO_STAT1_MMC_RTOUT |
+ GLAMO_STAT1_MMC_DTOUT)) ||
+ (timeout == 0)) {
+ cmd->error = -ETIMEDOUT;
+ } else if (status & (GLAMO_STAT1_MMC_BWERR |
+ GLAMO_STAT1_MMC_BRERR)) {
+ cmd->error = -EILSEQ;
+ }
+
+ if (cmd->flags & MMC_RSP_PRESENT) {
+ if (cmd->flags & MMC_RSP_136) {
+ cmd->resp[3] = readw(®_resp[0]) |
+ (readw(®_resp[1]) << 16);
+ cmd->resp[2] = readw(®_resp[2]) |
+ (readw(®_resp[3]) << 16);
+ cmd->resp[1] = readw(®_resp[4]) |
+ (readw(®_resp[5]) << 16);
+ cmd->resp[0] = readw(®_resp[6]) |
+ (readw(®_resp[7]) << 16);
+ } else {
+ cmd->resp[0] = (readw(®_resp[0]) >> 8) |
+ (readw(®_resp[1]) << 8) |
+ ((readw(®_resp[2])) << 24);
+ }