diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/card/block.c | 14 | ||||
-rw-r--r-- | drivers/mmc/core/cd-gpio.c | 4 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 20 | ||||
-rw-r--r-- | drivers/mmc/core/sd.c | 6 | ||||
-rw-r--r-- | drivers/mmc/core/sdio.c | 6 | ||||
-rw-r--r-- | drivers/mmc/host/atmel-mci-regs.h | 14 | ||||
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 12 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 36 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 19 | ||||
-rw-r--r-- | drivers/mmc/host/mxs-mmc.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/omap.c | 18 | ||||
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 15 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-s3c.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-spear.c | 4 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.c | 4 |
15 files changed, 97 insertions, 79 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index dd2d374dcc7a..276d21ce6bc1 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -554,7 +554,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
554 | struct mmc_request mrq = {NULL}; | 554 | struct mmc_request mrq = {NULL}; |
555 | struct mmc_command cmd = {0}; | 555 | struct mmc_command cmd = {0}; |
556 | struct mmc_data data = {0}; | 556 | struct mmc_data data = {0}; |
557 | unsigned int timeout_us; | ||
558 | 557 | ||
559 | struct scatterlist sg; | 558 | struct scatterlist sg; |
560 | 559 | ||
@@ -574,23 +573,12 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
574 | cmd.arg = 0; | 573 | cmd.arg = 0; |
575 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; | 574 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; |
576 | 575 | ||
577 | data.timeout_ns = card->csd.tacc_ns * 100; | ||
578 | data.timeout_clks = card->csd.tacc_clks * 100; | ||
579 | |||
580 | timeout_us = data.timeout_ns / 1000; | ||
581 | timeout_us += data.timeout_clks * 1000 / | ||
582 | (card->host->ios.clock / 1000); | ||
583 | |||
584 | if (timeout_us > 100000) { | ||
585 | data.timeout_ns = 100000000; | ||
586 | data.timeout_clks = 0; | ||
587 | } | ||
588 | |||
589 | data.blksz = 4; | 576 | data.blksz = 4; |
590 | data.blocks = 1; | 577 | data.blocks = 1; |
591 | data.flags = MMC_DATA_READ; | 578 | data.flags = MMC_DATA_READ; |
592 | data.sg = &sg; | 579 | data.sg = &sg; |
593 | data.sg_len = 1; | 580 | data.sg_len = 1; |
581 | mmc_set_data_timeout(&data, card); | ||
594 | 582 | ||
595 | mrq.cmd = &cmd; | 583 | mrq.cmd = &cmd; |
596 | mrq.data = &data; | 584 | mrq.data = &data; |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index f13e38deceac..8f5dc08d6598 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
@@ -50,8 +50,8 @@ int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio) | |||
50 | goto egpioreq; | 50 | goto egpioreq; |
51 | 51 | ||
52 | ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, | 52 | ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, |
53 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 53 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | |
54 | cd->label, host); | 54 | IRQF_ONESHOT, cd->label, host); |
55 | if (ret < 0) | 55 | if (ret < 0) |
56 | goto eirqreq; | 56 | goto eirqreq; |
57 | 57 | ||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2d4a4b746750..4f4489aa6bae 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -717,10 +717,6 @@ static int mmc_select_powerclass(struct mmc_card *card, | |||
717 | card->ext_csd.generic_cmd6_time); | 717 | card->ext_csd.generic_cmd6_time); |
718 | } | 718 | } |
719 | 719 | ||
720 | if (err) | ||
721 | pr_err("%s: power class selection for ext_csd_bus_width %d" | ||
722 | " failed\n", mmc_hostname(card->host), bus_width); | ||
723 | |||
724 | return err; | 720 | return err; |
725 | } | 721 | } |
726 | 722 | ||
@@ -1104,7 +1100,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1104 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; | 1100 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; |
1105 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); | 1101 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); |
1106 | if (err) | 1102 | if (err) |
1107 | goto err; | 1103 | pr_warning("%s: power class selection to bus width %d" |
1104 | " failed\n", mmc_hostname(card->host), | ||
1105 | 1 << bus_width); | ||
1108 | } | 1106 | } |
1109 | 1107 | ||
1110 | /* | 1108 | /* |
@@ -1136,7 +1134,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1136 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], | 1134 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], |
1137 | ext_csd); | 1135 | ext_csd); |
1138 | if (err) | 1136 | if (err) |
1139 | goto err; | 1137 | pr_warning("%s: power class selection to " |
1138 | "bus width %d failed\n", | ||
1139 | mmc_hostname(card->host), | ||
1140 | 1 << bus_width); | ||
1140 | 1141 | ||
1141 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1142 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1142 | EXT_CSD_BUS_WIDTH, | 1143 | EXT_CSD_BUS_WIDTH, |
@@ -1164,7 +1165,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1164 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], | 1165 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], |
1165 | ext_csd); | 1166 | ext_csd); |
1166 | if (err) | 1167 | if (err) |
1167 | goto err; | 1168 | pr_warning("%s: power class selection to " |
1169 | "bus width %d ddr %d failed\n", | ||
1170 | mmc_hostname(card->host), | ||
1171 | 1 << bus_width, ddr); | ||
1168 | 1172 | ||
1169 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1173 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1170 | EXT_CSD_BUS_WIDTH, | 1174 | EXT_CSD_BUS_WIDTH, |
@@ -1326,7 +1330,7 @@ static int mmc_suspend(struct mmc_host *host) | |||
1326 | if (!err) | 1330 | if (!err) |
1327 | mmc_card_set_sleep(host->card); | 1331 | mmc_card_set_sleep(host->card); |
1328 | } else if (!mmc_host_is_spi(host)) | 1332 | } else if (!mmc_host_is_spi(host)) |
1329 | mmc_deselect_cards(host); | 1333 | err = mmc_deselect_cards(host); |
1330 | host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); | 1334 | host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); |
1331 | mmc_release_host(host); | 1335 | mmc_release_host(host); |
1332 | 1336 | ||
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index c272c6868ecf..b2b43f624b9e 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -1075,16 +1075,18 @@ static void mmc_sd_detect(struct mmc_host *host) | |||
1075 | */ | 1075 | */ |
1076 | static int mmc_sd_suspend(struct mmc_host *host) | 1076 | static int mmc_sd_suspend(struct mmc_host *host) |
1077 | { | 1077 | { |
1078 | int err = 0; | ||
1079 | |||
1078 | BUG_ON(!host); | 1080 | BUG_ON(!host); |
1079 | BUG_ON(!host->card); | 1081 | BUG_ON(!host->card); |
1080 | 1082 | ||
1081 | mmc_claim_host(host); | 1083 | mmc_claim_host(host); |
1082 | if (!mmc_host_is_spi(host)) | 1084 | if (!mmc_host_is_spi(host)) |
1083 | mmc_deselect_cards(host); | 1085 | err = mmc_deselect_cards(host); |
1084 | host->card->state &= ~MMC_STATE_HIGHSPEED; | 1086 | host->card->state &= ~MMC_STATE_HIGHSPEED; |
1085 | mmc_release_host(host); | 1087 | mmc_release_host(host); |
1086 | 1088 | ||
1087 | return 0; | 1089 | return err; |
1088 | } | 1090 | } |
1089 | 1091 | ||
1090 | /* | 1092 | /* |
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 13d0e95380ab..41c5fd8848f4 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -218,6 +218,12 @@ static int sdio_enable_wide(struct mmc_card *card) | |||
218 | if (ret) | 218 | if (ret) |
219 | return ret; | 219 | return ret; |
220 | 220 | ||
221 | if ((ctrl & SDIO_BUS_WIDTH_MASK) == SDIO_BUS_WIDTH_RESERVED) | ||
222 | pr_warning("%s: SDIO_CCCR_IF is invalid: 0x%02x\n", | ||
223 | mmc_hostname(card->host), ctrl); | ||
224 | |||
225 | /* set as 4-bit bus width */ | ||
226 | ctrl &= ~SDIO_BUS_WIDTH_MASK; | ||
221 | ctrl |= SDIO_BUS_WIDTH_4BIT; | 227 | ctrl |= SDIO_BUS_WIDTH_4BIT; |
222 | 228 | ||
223 | ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL); | 229 | ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL); |
diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h index 787aba1682bb..ab56f7db5315 100644 --- a/drivers/mmc/host/atmel-mci-regs.h +++ b/drivers/mmc/host/atmel-mci-regs.h | |||
@@ -140,4 +140,18 @@ | |||
140 | #define atmci_writel(port,reg,value) \ | 140 | #define atmci_writel(port,reg,value) \ |
141 | __raw_writel((value), (port)->regs + reg) | 141 | __raw_writel((value), (port)->regs + reg) |
142 | 142 | ||
143 | /* | ||
144 | * Fix sconfig's burst size according to atmel MCI. We need to convert them as: | ||
145 | * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3. | ||
146 | * | ||
147 | * This can be done by finding most significant bit set. | ||
148 | */ | ||
149 | static inline unsigned int atmci_convert_chksize(unsigned int maxburst) | ||
150 | { | ||
151 | if (maxburst > 1) | ||
152 | return fls(maxburst) - 2; | ||
153 | else | ||
154 | return 0; | ||
155 | } | ||
156 | |||
143 | #endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */ | 157 | #endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */ |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 420aca642b14..f2c115e06438 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -910,6 +910,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
910 | enum dma_data_direction direction; | 910 | enum dma_data_direction direction; |
911 | enum dma_transfer_direction slave_dirn; | 911 | enum dma_transfer_direction slave_dirn; |
912 | unsigned int sglen; | 912 | unsigned int sglen; |
913 | u32 maxburst; | ||
913 | u32 iflags; | 914 | u32 iflags; |
914 | 915 | ||
915 | data->error = -EINPROGRESS; | 916 | data->error = -EINPROGRESS; |
@@ -943,17 +944,18 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
943 | if (!chan) | 944 | if (!chan) |
944 | return -ENODEV; | 945 | return -ENODEV; |
945 | 946 | ||
946 | if (host->caps.has_dma) | ||
947 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN); | ||
948 | |||
949 | if (data->flags & MMC_DATA_READ) { | 947 | if (data->flags & MMC_DATA_READ) { |
950 | direction = DMA_FROM_DEVICE; | 948 | direction = DMA_FROM_DEVICE; |
951 | host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM; | 949 | host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM; |
950 | maxburst = atmci_convert_chksize(host->dma_conf.src_maxburst); | ||
952 | } else { | 951 | } else { |
953 | direction = DMA_TO_DEVICE; | 952 | direction = DMA_TO_DEVICE; |
954 | host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV; | 953 | host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV; |
954 | maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst); | ||
955 | } | 955 | } |
956 | 956 | ||
957 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(maxburst) | ATMCI_DMAEN); | ||
958 | |||
957 | sglen = dma_map_sg(chan->device->dev, data->sg, | 959 | sglen = dma_map_sg(chan->device->dev, data->sg, |
958 | data->sg_len, direction); | 960 | data->sg_len, direction); |
959 | 961 | ||
@@ -2314,6 +2316,8 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
2314 | 2316 | ||
2315 | platform_set_drvdata(pdev, host); | 2317 | platform_set_drvdata(pdev, host); |
2316 | 2318 | ||
2319 | setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host); | ||
2320 | |||
2317 | /* We need at least one slot to succeed */ | 2321 | /* We need at least one slot to succeed */ |
2318 | nr_slots = 0; | 2322 | nr_slots = 0; |
2319 | ret = -ENODEV; | 2323 | ret = -ENODEV; |
@@ -2352,8 +2356,6 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
2352 | } | 2356 | } |
2353 | } | 2357 | } |
2354 | 2358 | ||
2355 | setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host); | ||
2356 | |||
2357 | dev_info(&pdev->dev, | 2359 | dev_info(&pdev->dev, |
2358 | "Atmel MCI controller at 0x%08lx irq %d, %u slots\n", | 2360 | "Atmel MCI controller at 0x%08lx irq %d, %u slots\n", |
2359 | host->mapbase, irq, nr_slots); | 2361 | host->mapbase, irq, nr_slots); |
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 | ||
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index f0fcce40cd8d..50ff19a62368 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -1216,12 +1216,7 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np, | |||
1216 | int bus_width = 0; | 1216 | int bus_width = 0; |
1217 | 1217 | ||
1218 | pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); | 1218 | pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); |
1219 | if (!pdata->gpio_wp) | ||
1220 | pdata->gpio_wp = -1; | ||
1221 | |||
1222 | pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); | 1219 | pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); |
1223 | if (!pdata->gpio_cd) | ||
1224 | pdata->gpio_cd = -1; | ||
1225 | 1220 | ||
1226 | if (of_get_property(np, "cd-inverted", NULL)) | 1221 | if (of_get_property(np, "cd-inverted", NULL)) |
1227 | pdata->cd_invert = true; | 1222 | pdata->cd_invert = true; |
@@ -1276,6 +1271,12 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1276 | return -EINVAL; | 1271 | return -EINVAL; |
1277 | } | 1272 | } |
1278 | 1273 | ||
1274 | if (!plat) { | ||
1275 | plat = devm_kzalloc(&dev->dev, sizeof(*plat), GFP_KERNEL); | ||
1276 | if (!plat) | ||
1277 | return -ENOMEM; | ||
1278 | } | ||
1279 | |||
1279 | if (np) | 1280 | if (np) |
1280 | mmci_dt_populate_generic_pdata(np, plat); | 1281 | mmci_dt_populate_generic_pdata(np, plat); |
1281 | 1282 | ||
@@ -1424,6 +1425,10 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1424 | writel(0, host->base + MMCIMASK1); | 1425 | writel(0, host->base + MMCIMASK1); |
1425 | writel(0xfff, host->base + MMCICLEAR); | 1426 | writel(0xfff, host->base + MMCICLEAR); |
1426 | 1427 | ||
1428 | if (plat->gpio_cd == -EPROBE_DEFER) { | ||
1429 | ret = -EPROBE_DEFER; | ||
1430 | goto err_gpio_cd; | ||
1431 | } | ||
1427 | if (gpio_is_valid(plat->gpio_cd)) { | 1432 | if (gpio_is_valid(plat->gpio_cd)) { |
1428 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); | 1433 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); |
1429 | if (ret == 0) | 1434 | if (ret == 0) |
@@ -1447,6 +1452,10 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1447 | if (ret >= 0) | 1452 | if (ret >= 0) |
1448 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); | 1453 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); |
1449 | } | 1454 | } |
1455 | if (plat->gpio_wp == -EPROBE_DEFER) { | ||
1456 | ret = -EPROBE_DEFER; | ||
1457 | goto err_gpio_wp; | ||
1458 | } | ||
1450 | if (gpio_is_valid(plat->gpio_wp)) { | 1459 | if (gpio_is_valid(plat->gpio_wp)) { |
1451 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); | 1460 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); |
1452 | if (ret == 0) | 1461 | if (ret == 0) |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 34a90266ab11..277161d279b8 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -894,8 +894,8 @@ static struct platform_driver mxs_mmc_driver = { | |||
894 | .owner = THIS_MODULE, | 894 | .owner = THIS_MODULE, |
895 | #ifdef CONFIG_PM | 895 | #ifdef CONFIG_PM |
896 | .pm = &mxs_mmc_pm_ops, | 896 | .pm = &mxs_mmc_pm_ops, |
897 | .of_match_table = mxs_mmc_dt_ids, | ||
898 | #endif | 897 | #endif |
898 | .of_match_table = mxs_mmc_dt_ids, | ||
899 | }, | 899 | }, |
900 | }; | 900 | }; |
901 | 901 | ||
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 552196c764d4..3e8dcf8d2e05 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -1300,7 +1300,7 @@ static const struct mmc_host_ops mmc_omap_ops = { | |||
1300 | .set_ios = mmc_omap_set_ios, | 1300 | .set_ios = mmc_omap_set_ios, |
1301 | }; | 1301 | }; |
1302 | 1302 | ||
1303 | static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id) | 1303 | static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id) |
1304 | { | 1304 | { |
1305 | struct mmc_omap_slot *slot = NULL; | 1305 | struct mmc_omap_slot *slot = NULL; |
1306 | struct mmc_host *mmc; | 1306 | struct mmc_host *mmc; |
@@ -1485,24 +1485,26 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev) | |||
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | host->nr_slots = pdata->nr_slots; | 1487 | host->nr_slots = pdata->nr_slots; |
1488 | host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); | ||
1489 | |||
1490 | host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); | ||
1491 | if (!host->mmc_omap_wq) | ||
1492 | goto err_plat_cleanup; | ||
1493 | |||
1488 | for (i = 0; i < pdata->nr_slots; i++) { | 1494 | for (i = 0; i < pdata->nr_slots; i++) { |
1489 | ret = mmc_omap_new_slot(host, i); | 1495 | ret = mmc_omap_new_slot(host, i); |
1490 | if (ret < 0) { | 1496 | if (ret < 0) { |
1491 | while (--i >= 0) | 1497 | while (--i >= 0) |
1492 | mmc_omap_remove_slot(host->slots[i]); | 1498 | mmc_omap_remove_slot(host->slots[i]); |
1493 | 1499 | ||
1494 | goto err_plat_cleanup; | 1500 | goto err_destroy_wq; |
1495 | } | 1501 | } |
1496 | } | 1502 | } |
1497 | 1503 | ||
1498 | host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); | ||
1499 | |||
1500 | host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); | ||
1501 | if (!host->mmc_omap_wq) | ||
1502 | goto err_plat_cleanup; | ||
1503 | |||
1504 | return 0; | 1504 | return 0; |
1505 | 1505 | ||
1506 | err_destroy_wq: | ||
1507 | destroy_workqueue(host->mmc_omap_wq); | ||
1506 | err_plat_cleanup: | 1508 | err_plat_cleanup: |
1507 | if (pdata->cleanup) | 1509 | if (pdata->cleanup) |
1508 | pdata->cleanup(&pdev->dev); | 1510 | pdata->cleanup(&pdev->dev); |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9a7a60aeb19e..389a3eedfc24 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -85,7 +85,6 @@ | |||
85 | #define BRR_ENABLE (1 << 5) | 85 | #define BRR_ENABLE (1 << 5) |
86 | #define DTO_ENABLE (1 << 20) | 86 | #define DTO_ENABLE (1 << 20) |
87 | #define INIT_STREAM (1 << 1) | 87 | #define INIT_STREAM (1 << 1) |
88 | #define ACEN_ACMD12 (1 << 2) | ||
89 | #define DP_SELECT (1 << 21) | 88 | #define DP_SELECT (1 << 21) |
90 | #define DDIR (1 << 4) | 89 | #define DDIR (1 << 4) |
91 | #define DMA_EN 0x1 | 90 | #define DMA_EN 0x1 |
@@ -117,7 +116,6 @@ | |||
117 | #define OMAP_MMC_MAX_CLOCK 52000000 | 116 | #define OMAP_MMC_MAX_CLOCK 52000000 |
118 | #define DRIVER_NAME "omap_hsmmc" | 117 | #define DRIVER_NAME "omap_hsmmc" |
119 | 118 | ||
120 | #define AUTO_CMD12 (1 << 0) /* Auto CMD12 support */ | ||
121 | /* | 119 | /* |
122 | * One controller can have multiple slots, like on some omap boards using | 120 | * One controller can have multiple slots, like on some omap boards using |
123 | * omap.c controller driver. Luckily this is not currently done on any known | 121 | * omap.c controller driver. Luckily this is not currently done on any known |
@@ -177,7 +175,6 @@ struct omap_hsmmc_host { | |||
177 | int reqs_blocked; | 175 | int reqs_blocked; |
178 | int use_reg; | 176 | int use_reg; |
179 | int req_in_progress; | 177 | int req_in_progress; |
180 | unsigned int flags; | ||
181 | struct omap_hsmmc_next next_data; | 178 | struct omap_hsmmc_next next_data; |
182 | 179 | ||
183 | struct omap_mmc_platform_data *pdata; | 180 | struct omap_mmc_platform_data *pdata; |
@@ -773,8 +770,6 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd, | |||
773 | cmdtype = 0x3; | 770 | cmdtype = 0x3; |
774 | 771 | ||
775 | cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); | 772 | cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); |
776 | if ((host->flags & AUTO_CMD12) && mmc_op_multi(cmd->opcode)) | ||
777 | cmdreg |= ACEN_ACMD12; | ||
778 | 773 | ||
779 | if (data) { | 774 | if (data) { |
780 | cmdreg |= DP_SELECT | MSBS | BCE; | 775 | cmdreg |= DP_SELECT | MSBS | BCE; |
@@ -847,14 +842,11 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data) | |||
847 | else | 842 | else |
848 | data->bytes_xfered = 0; | 843 | data->bytes_xfered = 0; |
849 | 844 | ||
850 | if (data->stop && ((!(host->flags & AUTO_CMD12)) || data->error)) { | 845 | if (!data->stop) { |
851 | omap_hsmmc_start_command(host, data->stop, NULL); | ||
852 | } else { | ||
853 | if (data->stop) | ||
854 | data->stop->resp[0] = OMAP_HSMMC_READ(host->base, | ||
855 | RSP76); | ||
856 | omap_hsmmc_request_done(host, data->mrq); | 846 | omap_hsmmc_request_done(host, data->mrq); |
847 | return; | ||
857 | } | 848 | } |
849 | omap_hsmmc_start_command(host, data->stop, NULL); | ||
858 | } | 850 | } |
859 | 851 | ||
860 | /* | 852 | /* |
@@ -1859,7 +1851,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) | |||
1859 | host->mapbase = res->start + pdata->reg_offset; | 1851 | host->mapbase = res->start + pdata->reg_offset; |
1860 | host->base = ioremap(host->mapbase, SZ_4K); | 1852 | host->base = ioremap(host->mapbase, SZ_4K); |
1861 | host->power_mode = MMC_POWER_OFF; | 1853 | host->power_mode = MMC_POWER_OFF; |
1862 | host->flags = AUTO_CMD12; | ||
1863 | host->next_data.cookie = 1; | 1854 | host->next_data.cookie = 1; |
1864 | 1855 | ||
1865 | platform_set_drvdata(pdev, host); | 1856 | platform_set_drvdata(pdev, host); |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 55a164fcaa15..a50c205ea208 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -404,7 +404,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc) | |||
404 | if (sc->ext_cd_irq && | 404 | if (sc->ext_cd_irq && |
405 | request_threaded_irq(sc->ext_cd_irq, NULL, | 405 | request_threaded_irq(sc->ext_cd_irq, NULL, |
406 | sdhci_s3c_gpio_card_detect_thread, | 406 | sdhci_s3c_gpio_card_detect_thread, |
407 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 407 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
408 | dev_name(dev), sc) == 0) { | 408 | dev_name(dev), sc) == 0) { |
409 | int status = gpio_get_value(sc->ext_cd_gpio); | 409 | int status = gpio_get_value(sc->ext_cd_gpio); |
410 | if (pdata->ext_cd_gpio_invert) | 410 | if (pdata->ext_cd_gpio_invert) |
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c index 1fe32dfa7cd4..423da8194cd8 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Support of SDHCI platform devices for spear soc family | 4 | * Support of SDHCI platform devices for spear soc family |
5 | * | 5 | * |
6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
7 | * Viresh Kumar<viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
8 | * | 8 | * |
9 | * Inspired by sdhci-pltfm.c | 9 | * Inspired by sdhci-pltfm.c |
10 | * | 10 | * |
@@ -289,5 +289,5 @@ static struct platform_driver sdhci_driver = { | |||
289 | module_platform_driver(sdhci_driver); | 289 | module_platform_driver(sdhci_driver); |
290 | 290 | ||
291 | MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); | 291 | MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); |
292 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 292 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
293 | MODULE_LICENSE("GPL v2"); | 293 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index e626732aff77..f4b8b4db3a9a 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -680,8 +680,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) | |||
680 | } | 680 | } |
681 | 681 | ||
682 | if (count >= 0xF) { | 682 | if (count >= 0xF) { |
683 | pr_warning("%s: Too large timeout 0x%x requested for CMD%d!\n", | 683 | DBG("%s: Too large timeout 0x%x requested for CMD%d!\n", |
684 | mmc_hostname(host->mmc), count, cmd->opcode); | 684 | mmc_hostname(host->mmc), count, cmd->opcode); |
685 | count = 0xE; | 685 | count = 0xE; |
686 | } | 686 | } |
687 | 687 | ||