diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/sdhci.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 877226e2ffae..445788159647 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -270,16 +270,13 @@ static void sdhci_transfer_pio(struct sdhci_host *host) | |||
270 | 270 | ||
271 | static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) | 271 | static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) |
272 | { | 272 | { |
273 | u16 mode; | ||
274 | u8 count; | 273 | u8 count; |
275 | unsigned target_timeout, current_timeout; | 274 | unsigned target_timeout, current_timeout; |
276 | 275 | ||
277 | WARN_ON(host->data); | 276 | WARN_ON(host->data); |
278 | 277 | ||
279 | if (data == NULL) { | 278 | if (data == NULL) |
280 | writew(0, host->ioaddr + SDHCI_TRANSFER_MODE); | ||
281 | return; | 279 | return; |
282 | } | ||
283 | 280 | ||
284 | DBG("blksz %04x blks %04x flags %08x\n", | 281 | DBG("blksz %04x blks %04x flags %08x\n", |
285 | data->blksz, data->blocks, data->flags); | 282 | data->blksz, data->blocks, data->flags); |
@@ -317,19 +314,6 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) | |||
317 | 314 | ||
318 | writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL); | 315 | writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL); |
319 | 316 | ||
320 | mode = SDHCI_TRNS_BLK_CNT_EN; | ||
321 | if (data->blocks > 1) | ||
322 | mode |= SDHCI_TRNS_MULTI; | ||
323 | if (data->flags & MMC_DATA_READ) | ||
324 | mode |= SDHCI_TRNS_READ; | ||
325 | if (host->flags & SDHCI_USE_DMA) | ||
326 | mode |= SDHCI_TRNS_DMA; | ||
327 | |||
328 | writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); | ||
329 | |||
330 | writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE); | ||
331 | writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT); | ||
332 | |||
333 | if (host->flags & SDHCI_USE_DMA) { | 317 | if (host->flags & SDHCI_USE_DMA) { |
334 | int count; | 318 | int count; |
335 | 319 | ||
@@ -347,6 +331,30 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) | |||
347 | host->offset = 0; | 331 | host->offset = 0; |
348 | host->remain = host->cur_sg->length; | 332 | host->remain = host->cur_sg->length; |
349 | } | 333 | } |
334 | |||
335 | writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE); | ||
336 | writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT); | ||
337 | } | ||
338 | |||
339 | static void sdhci_set_transfer_mode(struct sdhci_host *host, | ||
340 | struct mmc_data *data) | ||
341 | { | ||
342 | u16 mode; | ||
343 | |||
344 | WARN_ON(host->data); | ||
345 | |||
346 | if (data == NULL) | ||
347 | return; | ||
348 | |||
349 | mode = SDHCI_TRNS_BLK_CNT_EN; | ||
350 | if (data->blocks > 1) | ||
351 | mode |= SDHCI_TRNS_MULTI; | ||
352 | if (data->flags & MMC_DATA_READ) | ||
353 | mode |= SDHCI_TRNS_READ; | ||
354 | if (host->flags & SDHCI_USE_DMA) | ||
355 | mode |= SDHCI_TRNS_DMA; | ||
356 | |||
357 | writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); | ||
350 | } | 358 | } |
351 | 359 | ||
352 | static void sdhci_finish_data(struct sdhci_host *host) | 360 | static void sdhci_finish_data(struct sdhci_host *host) |
@@ -447,6 +455,8 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | |||
447 | 455 | ||
448 | writel(cmd->arg, host->ioaddr + SDHCI_ARGUMENT); | 456 | writel(cmd->arg, host->ioaddr + SDHCI_ARGUMENT); |
449 | 457 | ||
458 | sdhci_set_transfer_mode(host, cmd->data); | ||
459 | |||
450 | if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { | 460 | if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { |
451 | printk(KERN_ERR "%s: Unsupported response type! " | 461 | printk(KERN_ERR "%s: Unsupported response type! " |
452 | "Please report this to " BUGMAIL ".\n", | 462 | "Please report this to " BUGMAIL ".\n", |