diff -pNaur linux-omap-2.6-orig/drivers/mmc/omap.c linux-omap-2.6/drivers/mmc/omap.c --- linux-omap-2.6-orig/drivers/mmc/omap.c 2006-03-22 17:44:41.000000000 +0000 +++ linux-omap-2.6/drivers/mmc/omap.c 2006-03-22 21:34:36.000000000 +0000 @@ -185,39 +185,38 @@ mmc_omap_start_command(struct mmc_omap_h host->hw_bus_mode = host->bus_mode; } - if (!(cmd->flags & MMC_RSP_PRESENT)) - resptype = 0; /* Resp 0 */ - - if (cmd->flags & MMC_RSP_136) - resptype = 2; /* Resp 2 */ - else { - if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) - resptype = 3; /* Resp 3 */ - else - resptype = 1; /* Resp 1, Resp 1b */ + switch (mmc_resp_type(cmd)) { + case MMC_RSP_NONE: + /* Response type 0 */ + break; + case MMC_RSP_R1: + case MMC_RSP_R1B: + resptype = 1; + break; + case MMC_RSP_R2: + resptype = 2; + break; + case MMC_RSP_R3: + resptype = 3; + break; + case MMC_RSP_R6: + resptype = 6; + break; } - /* Protocol layer does not provide command type, but our hardware - * needs it! - * any data transfer means adtc type (but that information is not - * in command structure, so we flagged it into host struct.) - * However, telling bc, bcr and ac apart based on response is - * not foolproof: - * CMD0 = bc = resp0 CMD15 = ac = resp0 - * CMD2 = bcr = resp2 CMD10 = ac = resp2 - * - * Resolve to best guess with some exception testing: - * resp0 -> bc, except CMD15 = ac - * rest are ac, except if opendrain - */ - if (host->data) { + switch (cmd->flags & MMC_CMD_MASK) { + case MMC_CMD_AC: + cmdtype = OMAP_MMC_CMDTYPE_AC; + break; + case MMC_CMD_ADTC: cmdtype = OMAP_MMC_CMDTYPE_ADTC; - } else if (resptype == 0 && cmd->opcode != 15) { + break; + case MMC_CMD_BC: cmdtype = OMAP_MMC_CMDTYPE_BC; - } else if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) { + break; + case MMC_CMD_BCR: cmdtype = OMAP_MMC_CMDTYPE_BCR; - } else { - cmdtype = OMAP_MMC_CMDTYPE_AC; + break; } cmdreg = cmd->opcode | (resptype << 8) | (cmdtype << 12);