aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap_hsmmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 14c58caac99..a4dd43f117f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -997,7 +997,8 @@ static int omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host,
997} 997}
998 998
999static void set_data_timeout(struct omap_hsmmc_host *host, 999static void set_data_timeout(struct omap_hsmmc_host *host,
1000 struct mmc_request *req) 1000 unsigned int timeout_ns,
1001 unsigned int timeout_clks)
1001{ 1002{
1002 unsigned int timeout, cycle_ns; 1003 unsigned int timeout, cycle_ns;
1003 uint32_t reg, clkd, dto = 0; 1004 uint32_t reg, clkd, dto = 0;
@@ -1008,8 +1009,8 @@ static void set_data_timeout(struct omap_hsmmc_host *host,
1008 clkd = 1; 1009 clkd = 1;
1009 1010
1010 cycle_ns = 1000000000 / (clk_get_rate(host->fclk) / clkd); 1011 cycle_ns = 1000000000 / (clk_get_rate(host->fclk) / clkd);
1011 timeout = req->data->timeout_ns / cycle_ns; 1012 timeout = timeout_ns / cycle_ns;
1012 timeout += req->data->timeout_clks; 1013 timeout += timeout_clks;
1013 if (timeout) { 1014 if (timeout) {
1014 while ((timeout & 0x80000000) == 0) { 1015 while ((timeout & 0x80000000) == 0) {
1015 dto += 1; 1016 dto += 1;
@@ -1043,12 +1044,18 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req)
1043 1044
1044 if (req->data == NULL) { 1045 if (req->data == NULL) {
1045 OMAP_HSMMC_WRITE(host->base, BLK, 0); 1046 OMAP_HSMMC_WRITE(host->base, BLK, 0);
1047 /*
1048 * Set an arbitrary 100ms data timeout for commands with
1049 * busy signal.
1050 */
1051 if (req->cmd->flags & MMC_RSP_BUSY)
1052 set_data_timeout(host, 100000000U, 0);
1046 return 0; 1053 return 0;
1047 } 1054 }
1048 1055
1049 OMAP_HSMMC_WRITE(host->base, BLK, (req->data->blksz) 1056 OMAP_HSMMC_WRITE(host->base, BLK, (req->data->blksz)
1050 | (req->data->blocks << 16)); 1057 | (req->data->blocks << 16));
1051 set_data_timeout(host, req); 1058 set_data_timeout(host, req->data->timeout_ns, req->data->timeout_clks);
1052 1059
1053 if (host->use_dma) { 1060 if (host->use_dma) {
1054 ret = omap_hsmmc_start_dma_transfer(host, req); 1061 ret = omap_hsmmc_start_dma_transfer(host, req);