diff options
Diffstat (limited to 'drivers/mmc/host/dw_mmc.c')
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 9bbf45f8c538..1ca5e72ceb65 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host) | |||
418 | p->des3 = host->sg_dma; | 418 | p->des3 = host->sg_dma; |
419 | p->des0 = IDMAC_DES0_ER; | 419 | p->des0 = IDMAC_DES0_ER; |
420 | 420 | ||
421 | mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET); | ||
422 | |||
421 | /* Mask out interrupts - get Tx & Rx complete only */ | 423 | /* Mask out interrupts - get Tx & Rx complete only */ |
422 | mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI | | 424 | mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI | |
423 | SDMMC_IDMAC_INT_TI); | 425 | SDMMC_IDMAC_INT_TI); |
@@ -615,14 +617,15 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot) | |||
615 | u32 div; | 617 | u32 div; |
616 | 618 | ||
617 | if (slot->clock != host->current_speed) { | 619 | if (slot->clock != host->current_speed) { |
618 | if (host->bus_hz % slot->clock) | 620 | div = host->bus_hz / slot->clock; |
621 | if (host->bus_hz % slot->clock && host->bus_hz > slot->clock) | ||
619 | /* | 622 | /* |
620 | * move the + 1 after the divide to prevent | 623 | * move the + 1 after the divide to prevent |
621 | * over-clocking the card. | 624 | * over-clocking the card. |
622 | */ | 625 | */ |
623 | div = ((host->bus_hz / slot->clock) >> 1) + 1; | 626 | div += 1; |
624 | else | 627 | |
625 | div = (host->bus_hz / slot->clock) >> 1; | 628 | div = (host->bus_hz != slot->clock) ? DIV_ROUND_UP(div, 2) : 0; |
626 | 629 | ||
627 | dev_info(&slot->mmc->class_dev, | 630 | dev_info(&slot->mmc->class_dev, |
628 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" | 631 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" |
@@ -939,8 +942,8 @@ static void dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd | |||
939 | mdelay(20); | 942 | mdelay(20); |
940 | 943 | ||
941 | if (cmd->data) { | 944 | if (cmd->data) { |
942 | host->data = NULL; | ||
943 | dw_mci_stop_dma(host); | 945 | dw_mci_stop_dma(host); |
946 | host->data = NULL; | ||
944 | } | 947 | } |
945 | } | 948 | } |
946 | } | 949 | } |
@@ -1623,7 +1626,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) | |||
1623 | if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) { | 1626 | if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) { |
1624 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI); | 1627 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI); |
1625 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI); | 1628 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI); |
1626 | set_bit(EVENT_DATA_COMPLETE, &host->pending_events); | ||
1627 | host->dma_ops->complete(host); | 1629 | host->dma_ops->complete(host); |
1628 | } | 1630 | } |
1629 | #endif | 1631 | #endif |
@@ -1725,7 +1727,8 @@ static void dw_mci_work_routine_card(struct work_struct *work) | |||
1725 | 1727 | ||
1726 | #ifdef CONFIG_MMC_DW_IDMAC | 1728 | #ifdef CONFIG_MMC_DW_IDMAC |
1727 | ctrl = mci_readl(host, BMOD); | 1729 | ctrl = mci_readl(host, BMOD); |
1728 | ctrl |= 0x01; /* Software reset of DMA */ | 1730 | /* Software reset of DMA */ |
1731 | ctrl |= SDMMC_IDMAC_SWRESET; | ||
1729 | mci_writel(host, BMOD, ctrl); | 1732 | mci_writel(host, BMOD, ctrl); |
1730 | #endif | 1733 | #endif |
1731 | 1734 | ||
@@ -1950,10 +1953,6 @@ int dw_mci_probe(struct dw_mci *host) | |||
1950 | spin_lock_init(&host->lock); | 1953 | spin_lock_init(&host->lock); |
1951 | INIT_LIST_HEAD(&host->queue); | 1954 | INIT_LIST_HEAD(&host->queue); |
1952 | 1955 | ||
1953 | |||
1954 | host->dma_ops = host->pdata->dma_ops; | ||
1955 | dw_mci_init_dma(host); | ||
1956 | |||
1957 | /* | 1956 | /* |
1958 | * Get the host data width - this assumes that HCON has been set with | 1957 | * Get the host data width - this assumes that HCON has been set with |
1959 | * the correct values. | 1958 | * the correct values. |
@@ -1981,10 +1980,11 @@ int dw_mci_probe(struct dw_mci *host) | |||
1981 | } | 1980 | } |
1982 | 1981 | ||
1983 | /* Reset all blocks */ | 1982 | /* Reset all blocks */ |
1984 | if (!mci_wait_reset(&host->dev, host)) { | 1983 | if (!mci_wait_reset(&host->dev, host)) |
1985 | ret = -ENODEV; | 1984 | return -ENODEV; |
1986 | goto err_dmaunmap; | 1985 | |
1987 | } | 1986 | host->dma_ops = host->pdata->dma_ops; |
1987 | dw_mci_init_dma(host); | ||
1988 | 1988 | ||
1989 | /* Clear the interrupts for the host controller */ | 1989 | /* Clear the interrupts for the host controller */ |
1990 | mci_writel(host, RINTSTS, 0xFFFFFFFF); | 1990 | mci_writel(host, RINTSTS, 0xFFFFFFFF); |
@@ -2170,14 +2170,14 @@ int dw_mci_resume(struct dw_mci *host) | |||
2170 | if (host->vmmc) | 2170 | if (host->vmmc) |
2171 | regulator_enable(host->vmmc); | 2171 | regulator_enable(host->vmmc); |
2172 | 2172 | ||
2173 | if (host->dma_ops->init) | ||
2174 | host->dma_ops->init(host); | ||
2175 | |||
2176 | if (!mci_wait_reset(&host->dev, host)) { | 2173 | if (!mci_wait_reset(&host->dev, host)) { |
2177 | ret = -ENODEV; | 2174 | ret = -ENODEV; |
2178 | return ret; | 2175 | return ret; |
2179 | } | 2176 | } |
2180 | 2177 | ||
2178 | if (host->dma_ops->init) | ||
2179 | host->dma_ops->init(host); | ||
2180 | |||
2181 | /* Restore the old value at FIFOTH register */ | 2181 | /* Restore the old value at FIFOTH register */ |
2182 | mci_writel(host, FIFOTH, host->fifoth_val); | 2182 | mci_writel(host, FIFOTH, host->fifoth_val); |
2183 | 2183 | ||