Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187114
b: refs/heads/master
c: 516a824
h: refs/heads/master
v: v3
  • Loading branch information
Albert Herranz authored and Linus Torvalds committed Mar 12, 2010
1 parent 667a295 commit ae2a402
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 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: d0ab4a4d5094e5d17b103dc5073529a04f00a469
refs/heads/master: 516a82422209e078345d0ca54b16793d7bfd4782
1 change: 1 addition & 0 deletions trunk/drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,7 @@ void mmc_rescan(struct work_struct *work)
mmc_claim_host(host);

mmc_power_up(host);
sdio_reset(host);
mmc_go_idle(host);

mmc_send_if_cond(host, host->ocr_avail);
Expand Down
36 changes: 30 additions & 6 deletions trunk/drivers/mmc/core/sdio_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
return err;
}

int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
unsigned addr, u8 in, u8* out)
static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
unsigned addr, u8 in, u8 *out)
{
struct mmc_command cmd;
int err;

BUG_ON(!card);
BUG_ON(!host);
BUG_ON(fn > 7);

/* sanity check */
Expand All @@ -90,11 +90,11 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
cmd.arg |= in;
cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;

err = mmc_wait_for_cmd(card->host, &cmd, 0);
err = mmc_wait_for_cmd(host, &cmd, 0);
if (err)
return err;

if (mmc_host_is_spi(card->host)) {
if (mmc_host_is_spi(host)) {
/* host driver already reported errors */
} else {
if (cmd.resp[0] & R5_ERROR)
Expand All @@ -106,7 +106,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
}

if (out) {
if (mmc_host_is_spi(card->host))
if (mmc_host_is_spi(host))
*out = (cmd.resp[0] >> 8) & 0xFF;
else
*out = cmd.resp[0] & 0xFF;
Expand All @@ -115,6 +115,13 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
return 0;
}

int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
unsigned addr, u8 in, u8 *out)
{
BUG_ON(!card);
return mmc_io_rw_direct_host(card->host, write, fn, addr, in, out);
}

int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz)
{
Expand Down Expand Up @@ -182,3 +189,20 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
return 0;
}

int sdio_reset(struct mmc_host *host)
{
int ret;
u8 abort;

/* SDIO Simplified Specification V2.0, 4.4 Reset for SDIO */

ret = mmc_io_rw_direct_host(host, 0, 0, SDIO_CCCR_ABORT, 0, &abort);
if (ret)
abort = 0x08;
else
abort |= 0x08;

ret = mmc_io_rw_direct_host(host, 1, 0, SDIO_CCCR_ABORT, abort, NULL);
return ret;
}

1 change: 1 addition & 0 deletions trunk/drivers/mmc/core/sdio_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
unsigned addr, u8 in, u8* out);
int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz);
int sdio_reset(struct mmc_host *host);

#endif

0 comments on commit ae2a402

Please sign in to comment.