aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/msm_sdcc.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 68bce6460d96..874de6a1e4e7 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -43,7 +43,6 @@
43#include <mach/dma.h> 43#include <mach/dma.h>
44#include <mach/htc_pwrsink.h> 44#include <mach/htc_pwrsink.h>
45 45
46
47#include "msm_sdcc.h" 46#include "msm_sdcc.h"
48 47
49#define DRIVER_NAME "msm-sdcc" 48#define DRIVER_NAME "msm-sdcc"
@@ -58,8 +57,6 @@ static unsigned int msmsdcc_sdioirq;
58#define PIO_SPINMAX 30 57#define PIO_SPINMAX 30
59#define CMD_SPINMAX 20 58#define CMD_SPINMAX 20
60 59
61
62
63static void 60static void
64msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd, 61msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd,
65 u32 c); 62 u32 c);
@@ -98,16 +95,17 @@ msmsdcc_stop_data(struct msmsdcc_host *host)
98 95
99uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host) 96uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host)
100{ 97{
101 if (host->pdev_id == 1) 98 switch (host->pdev_id) {
99 case 1:
102 return MSM_SDC1_PHYS + MMCIFIFO; 100 return MSM_SDC1_PHYS + MMCIFIFO;
103 else if (host->pdev_id == 2) 101 case 2:
104 return MSM_SDC2_PHYS + MMCIFIFO; 102 return MSM_SDC2_PHYS + MMCIFIFO;
105 else if (host->pdev_id == 3) 103 case 3:
106 return MSM_SDC3_PHYS + MMCIFIFO; 104 return MSM_SDC3_PHYS + MMCIFIFO;
107 else if (host->pdev_id == 4) 105 case 4:
108 return MSM_SDC4_PHYS + MMCIFIFO; 106 return MSM_SDC4_PHYS + MMCIFIFO;
109 else 107 }
110 BUG(); 108 BUG();
111 return 0; 109 return 0;
112} 110}
113 111
@@ -156,8 +154,8 @@ msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd,
156 struct scatterlist *sg = host->dma.sg; 154 struct scatterlist *sg = host->dma.sg;
157 int i; 155 int i;
158 156
159 for (i = 0; i < host->dma.num_ents; i++, sg++) 157 for (i = 0; i < host->dma.num_ents; i++)
160 flush_dcache_page(sg_page(sg)); 158 flush_dcache_page(sg_page(sg++));
161 } 159 }
162 160
163 host->dma.sg = NULL; 161 host->dma.sg = NULL;
@@ -222,15 +220,20 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data)
222 220
223 nc = host->dma.nc; 221 nc = host->dma.nc;
224 222
225 if (host->pdev_id == 1) 223 switch (host->pdev_id) {
224 case 1:
226 crci = MSMSDCC_CRCI_SDC1; 225 crci = MSMSDCC_CRCI_SDC1;
227 else if (host->pdev_id == 2) 226 break;
227 case 2:
228 crci = MSMSDCC_CRCI_SDC2; 228 crci = MSMSDCC_CRCI_SDC2;
229 else if (host->pdev_id == 3) 229 break;
230 case 3:
230 crci = MSMSDCC_CRCI_SDC3; 231 crci = MSMSDCC_CRCI_SDC3;
231 else if (host->pdev_id == 4) 232 break;
233 case 4:
232 crci = MSMSDCC_CRCI_SDC4; 234 crci = MSMSDCC_CRCI_SDC4;
233 else { 235 break;
236 default:
234 host->dma.sg = NULL; 237 host->dma.sg = NULL;
235 host->dma.num_ents = 0; 238 host->dma.num_ents = 0;
236 return -ENOENT; 239 return -ENOENT;
@@ -244,7 +247,7 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data)
244 host->curr.user_pages = 0; 247 host->curr.user_pages = 0;
245 248
246 n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, 249 n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg,
247 host->dma.num_ents, host->dma.dir); 250 host->dma.num_ents, host->dma.dir);
248 251
249 if (n != host->dma.num_ents) { 252 if (n != host->dma.num_ents) {
250 pr_err("%s: Unable to map in all sg elements\n", 253 pr_err("%s: Unable to map in all sg elements\n",
@@ -318,7 +321,7 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data)
318 memset(&host->pio, 0, sizeof(host->pio)); 321 memset(&host->pio, 0, sizeof(host->pio));
319 322
320 clks = (unsigned long long)data->timeout_ns * host->clk_rate; 323 clks = (unsigned long long)data->timeout_ns * host->clk_rate;
321 do_div(clks, 1000000000UL); 324 do_div(clks, NSEC_PER_SEC);
322 timeout = data->timeout_clks + (unsigned int)clks; 325 timeout = data->timeout_clks + (unsigned int)clks;
323 writel(timeout, base + MMCIDATATIMER); 326 writel(timeout, base + MMCIDATATIMER);
324 327
@@ -371,9 +374,9 @@ msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd, u32 c)
371 c |= MCI_CPSM_RESPONSE; 374 c |= MCI_CPSM_RESPONSE;
372 } 375 }
373 376
374 if ((((cmd->opcode == 17) || (cmd->opcode == 18)) || 377 if (cmd->opcode == 17 || cmd->opcode == 18 ||
375 ((cmd->opcode == 24) || (cmd->opcode == 25))) || 378 cmd->opcode == 24 || cmd->opcode == 25 ||
376 (cmd->opcode == 53)) 379 cmd->opcode == 53)
377 c |= MCI_CSPM_DATCMD; 380 c |= MCI_CSPM_DATCMD;
378 381
379 if (cmd == cmd->mrq->stop) 382 if (cmd == cmd->mrq->stop)