Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113187
b: refs/heads/master
c: d16f577
h: refs/heads/master
i:
  113185: 7c6d132
  113183: a36be9f
v: v3
  • Loading branch information
Pierre Ossman committed Oct 12, 2008
1 parent b1ed2b0 commit 5b37371
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08846698703dedae6c6915eb4b4d0a36188c5635
refs/heads/master: d16f57700475f670ca2828c150a34fa7102a05fc
52 changes: 49 additions & 3 deletions trunk/drivers/mmc/core/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,36 @@ static int sdio_enable_wide(struct mmc_card *card)
return 0;
}

/*
* Test if the card supports high-speed mode and, if so, switch to it.
*/
static int sdio_enable_hs(struct mmc_card *card)
{
int ret;
u8 speed;

if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
return 0;

if (!card->cccr.high_speed)
return 0;

ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed);
if (ret)
return ret;

speed |= SDIO_SPEED_EHS;

ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL);
if (ret)
return ret;

mmc_card_set_highspeed(card);
mmc_set_timing(card->host, MMC_TIMING_SD_HS);

return 0;
}

/*
* Host is being removed. Free up the current card.
*/
Expand Down Expand Up @@ -333,10 +363,26 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
goto remove;

/*
* No support for high-speed yet, so just set
* the card's maximum speed.
* Switch to high-speed (if supported).
*/
mmc_set_clock(host, card->cis.max_dtr);
err = sdio_enable_hs(card);
if (err)
goto remove;

/*
* Change to the card's maximum speed.
*/
if (mmc_card_highspeed(card)) {
/*
* The SDIO specification doesn't mention how
* the CIS transfer speed register relates to
* high-speed, but it seems that 50 MHz is
* mandatory.
*/
mmc_set_clock(host, 50000000);
} else {
mmc_set_clock(host, card->cis.max_dtr);
}

/*
* Switch to wider bus (if supported).
Expand Down

0 comments on commit 5b37371

Please sign in to comment.