diff options
author | Sangwook Lee <sangwook.lee@linaro.org> | 2011-12-07 16:02:49 +0000 |
---|---|---|
committer | Angus Ainslie <angus.ainslie@linaro.org> | 2011-12-08 10:47:48 -0700 |
commit | ae8cb140b0ff4b9437a54d2db268ba413736ba62 (patch) | |
tree | 4ae4eb3d2d590b6edacd32cce7e1f7ae30e03bea | |
parent | 9ab1eaf539a7f0f6052a7322995c240c23b1ef9a (diff) |
sdio: optimization for sdio_irq_thread3.2-samsung3
Skip fillng in CCCR_INTx cmd structure which is
called in sdio_irq_thread context
Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
-rw-r--r-- | drivers/mmc/core/sdio_irq.c | 2 | ||||
-rw-r--r-- | drivers/mmc/core/sdio_ops.c | 40 | ||||
-rw-r--r-- | drivers/mmc/core/sdio_ops.h | 1 |
3 files changed, 42 insertions, 1 deletions
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index 68f81b9ee0fb..67f782ab1f82 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -44,7 +44,7 @@ static int process_sdio_pending_irqs(struct mmc_card *card) return 1; } - ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_INTx, 0, &pending); + ret = mmc_io_rw_direct_irq(card, &pending); if (ret) { pr_debug("%s: error %d reading SDIO_CCCR_INTx\n", mmc_card_id(card), ret); diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c index b0517cc06200..c80fc32686b7 100644 --- a/drivers/mmc/core/sdio_ops.c +++ b/drivers/mmc/core/sdio_ops.c @@ -111,6 +111,46 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn, return 0; } +static struct mmc_command sdio_intx_cmd = { + .opcode = SD_IO_RW_DIRECT, + .arg = SDIO_CCCR_INTx << 9, + .flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC, +}; + +int mmc_io_rw_direct_irq(struct mmc_card *card, u8 *out) +{ + int err; + struct mmc_host *host ; + + BUG_ON(!card); + host = card->host; + BUG_ON(!host); + + err = mmc_wait_for_cmd(host, &sdio_intx_cmd, 0); + if (err) + return err; + + if (mmc_host_is_spi(host)) { + /* host driver already reported errors */ + } else { + if (sdio_intx_cmd.resp[0] & R5_ERROR) + return -EIO; + if (sdio_intx_cmd.resp[0] & R5_FUNCTION_NUMBER) + return -EINVAL; + if (sdio_intx_cmd.resp[0] & R5_OUT_OF_RANGE) + return -ERANGE; + } + + if (out) { + if (mmc_host_is_spi(host)) + *out = (sdio_intx_cmd.resp[0] >> 8) & 0xFF; + else + *out = sdio_intx_cmd.resp[0] & 0xFF; + } + + return 0; +} + int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn, unsigned addr, u8 in, u8 *out) { diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h index 12a4d3ab174c..5fe8ad667452 100644 --- a/drivers/mmc/core/sdio_ops.h +++ b/drivers/mmc/core/sdio_ops.h @@ -15,6 +15,7 @@ int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr); int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn, unsigned addr, u8 in, u8* out); +int mmc_io_rw_direct_irq(struct mmc_card *card, 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); |