diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-02-02 07:23:12 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-02-02 07:23:12 -0500 |
commit | e92251762d02a46177d4105d1744041e3f8bc465 (patch) | |
tree | 4696c14854b2a5f3982a613fed63e01d941727f3 /drivers/mmc/au1xmmc.c | |
parent | a6df590dd8b7644c8e298e3b13442bcd6ceeb739 (diff) |
[MMC] Add MMC command type flags
Some hosts need to know the command type, so pass it via a set of
flags in cmd->flags.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/au1xmmc.c')
-rw-r--r-- | drivers/mmc/au1xmmc.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index aaf04638054e..227c39a7c1b4 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c | |||
@@ -194,7 +194,7 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait, | |||
194 | 194 | ||
195 | u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT); | 195 | u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT); |
196 | 196 | ||
197 | switch(cmd->flags) { | 197 | switch (mmc_rsp_type(cmd->flags)) { |
198 | case MMC_RSP_R1: | 198 | case MMC_RSP_R1: |
199 | mmccmd |= SD_CMD_RT_1; | 199 | mmccmd |= SD_CMD_RT_1; |
200 | break; | 200 | break; |
@@ -483,34 +483,35 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status) | |||
483 | cmd = mrq->cmd; | 483 | cmd = mrq->cmd; |
484 | cmd->error = MMC_ERR_NONE; | 484 | cmd->error = MMC_ERR_NONE; |
485 | 485 | ||
486 | if ((cmd->flags & MMC_RSP_MASK) == MMC_RSP_SHORT) { | 486 | if (cmd->flags & MMC_RSP_PRESENT) { |
487 | 487 | if (cmd->flags & MMC_RSP_136) { | |
488 | /* Techincally, we should be getting all 48 bits of the response | 488 | u32 r[4]; |
489 | * (SD_RESP1 + SD_RESP2), but because our response omits the CRC, | 489 | int i; |
490 | * our data ends up being shifted 8 bits to the right. In this case, | 490 | |
491 | * that means that the OSR data starts at bit 31, so we can just | 491 | r[0] = au_readl(host->iobase + SD_RESP3); |
492 | * read RESP0 and return that | 492 | r[1] = au_readl(host->iobase + SD_RESP2); |
493 | */ | 493 | r[2] = au_readl(host->iobase + SD_RESP1); |
494 | 494 | r[3] = au_readl(host->iobase + SD_RESP0); | |
495 | cmd->resp[0] = au_readl(host->iobase + SD_RESP0); | 495 | |
496 | } | 496 | /* The CRC is omitted from the response, so really |
497 | else if ((cmd->flags & MMC_RSP_MASK) == MMC_RSP_LONG) { | 497 | * we only got 120 bytes, but the engine expects |
498 | u32 r[4]; | 498 | * 128 bits, so we have to shift things up |
499 | int i; | 499 | */ |
500 | 500 | ||
501 | r[0] = au_readl(host->iobase + SD_RESP3); | 501 | for(i = 0; i < 4; i++) { |
502 | r[1] = au_readl(host->iobase + SD_RESP2); | 502 | cmd->resp[i] = (r[i] & 0x00FFFFFF) << 8; |
503 | r[2] = au_readl(host->iobase + SD_RESP1); | 503 | if (i != 3) |
504 | r[3] = au_readl(host->iobase + SD_RESP0); | 504 | cmd->resp[i] |= (r[i + 1] & 0xFF000000) >> 24; |
505 | 505 | } | |
506 | /* The CRC is omitted from the response, so really we only got | 506 | } else { |
507 | * 120 bytes, but the engine expects 128 bits, so we have to shift | 507 | /* Techincally, we should be getting all 48 bits of |
508 | * things up | 508 | * the response (SD_RESP1 + SD_RESP2), but because |
509 | */ | 509 | * our response omits the CRC, our data ends up |
510 | 510 | * being shifted 8 bits to the right. In this case, | |
511 | for(i = 0; i < 4; i++) { | 511 | * that means that the OSR data starts at bit 31, |
512 | cmd->resp[i] = (r[i] & 0x00FFFFFF) << 8; | 512 | * so we can just read RESP0 and return that |
513 | if (i != 3) cmd->resp[i] |= (r[i + 1] & 0xFF000000) >> 24; | 513 | */ |
514 | cmd->resp[0] = au_readl(host->iobase + SD_RESP0); | ||
514 | } | 515 | } |
515 | } | 516 | } |
516 | 517 | ||