aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/davinci_mmc.c
diff options
context:
space:
mode:
authorIdo Yariv <ido@wizery.com>2012-03-11 17:39:59 -0400
committerChris Ball <cjb@laptop.org>2012-03-27 12:20:11 -0400
commitee698f503442741ca394d55c77b61c9080537686 (patch)
treeca5e2fe1ce47f1a7789050e469c2c0504bbea297 /drivers/mmc/host/davinci_mmc.c
parentbe7b5622e608189894c2c440c3fb0138f122071f (diff)
mmc: davinci: Poll status for small size transfers
For small size non-dma sdio transactions, it is sometimes better to poll the mmc host and avoid interrupts altogether. Polling lowers the number of interrupts and context switches. Tests have shown that for small transactions, only a few polling iterations are needed, so this is worth while. Signed-off-by: Ido Yariv <ido@wizery.com> Tested-by: Rajashekhara, Sudhakar <sudhakar.raj@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/davinci_mmc.c')
-rw-r--r--drivers/mmc/host/davinci_mmc.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 1e076fb06ac..c1f3673ae1e 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -160,6 +160,16 @@ module_param(rw_threshold, uint, S_IRUGO);
160MODULE_PARM_DESC(rw_threshold, 160MODULE_PARM_DESC(rw_threshold,
161 "Read/Write threshold. Default = 32"); 161 "Read/Write threshold. Default = 32");
162 162
163static unsigned poll_threshold = 128;
164module_param(poll_threshold, uint, S_IRUGO);
165MODULE_PARM_DESC(poll_threshold,
166 "Polling transaction size threshold. Default = 128");
167
168static unsigned poll_loopcount = 32;
169module_param(poll_loopcount, uint, S_IRUGO);
170MODULE_PARM_DESC(poll_loopcount,
171 "Maximum polling loop count. Default = 32");
172
163static unsigned __initdata use_dma = 1; 173static unsigned __initdata use_dma = 1;
164module_param(use_dma, uint, 0); 174module_param(use_dma, uint, 0);
165MODULE_PARM_DESC(use_dma, "Whether to use DMA or not. Default = 1"); 175MODULE_PARM_DESC(use_dma, "Whether to use DMA or not. Default = 1");
@@ -193,6 +203,7 @@ struct mmc_davinci_host {
193 bool use_dma; 203 bool use_dma;
194 bool do_dma; 204 bool do_dma;
195 bool sdio_int; 205 bool sdio_int;
206 bool active_request;
196 207
197 /* Scatterlist DMA uses one or more parameter RAM entries: 208 /* Scatterlist DMA uses one or more parameter RAM entries:
198 * the main one (associated with rxdma or txdma) plus zero or 209 * the main one (associated with rxdma or txdma) plus zero or
@@ -219,6 +230,7 @@ struct mmc_davinci_host {
219#endif 230#endif
220}; 231};
221 232
233static irqreturn_t mmc_davinci_irq(int irq, void *dev_id);
222 234
223/* PIO only */ 235/* PIO only */
224static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host) 236static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host)
@@ -376,7 +388,20 @@ static void mmc_davinci_start_command(struct mmc_davinci_host *host,
376 388
377 writel(cmd->arg, host->base + DAVINCI_MMCARGHL); 389 writel(cmd->arg, host->base + DAVINCI_MMCARGHL);
378 writel(cmd_reg, host->base + DAVINCI_MMCCMD); 390 writel(cmd_reg, host->base + DAVINCI_MMCCMD);
379 writel(im_val, host->base + DAVINCI_MMCIM); 391
392 host->active_request = true;
393
394 if (!host->do_dma && host->bytes_left <= poll_threshold) {
395 u32 count = poll_loopcount;
396
397 while (host->active_request && count--) {
398 mmc_davinci_irq(0, host);
399 cpu_relax();
400 }
401 }
402
403 if (host->active_request)
404 writel(im_val, host->base + DAVINCI_MMCIM);
380} 405}
381 406
382/*----------------------------------------------------------------------*/ 407/*----------------------------------------------------------------------*/
@@ -915,6 +940,7 @@ mmc_davinci_xfer_done(struct mmc_davinci_host *host, struct mmc_data *data)
915 if (!data->stop || (host->cmd && host->cmd->error)) { 940 if (!data->stop || (host->cmd && host->cmd->error)) {
916 mmc_request_done(host->mmc, data->mrq); 941 mmc_request_done(host->mmc, data->mrq);
917 writel(0, host->base + DAVINCI_MMCIM); 942 writel(0, host->base + DAVINCI_MMCIM);
943 host->active_request = false;
918 } else 944 } else
919 mmc_davinci_start_command(host, data->stop); 945 mmc_davinci_start_command(host, data->stop);
920} 946}
@@ -942,6 +968,7 @@ static void mmc_davinci_cmd_done(struct mmc_davinci_host *host,
942 cmd->mrq->cmd->retries = 0; 968 cmd->mrq->cmd->retries = 0;
943 mmc_request_done(host->mmc, cmd->mrq); 969 mmc_request_done(host->mmc, cmd->mrq);
944 writel(0, host->base + DAVINCI_MMCIM); 970 writel(0, host->base + DAVINCI_MMCIM);
971 host->active_request = false;
945 } 972 }
946} 973}
947 974