diff options
42 files changed, 336 insertions, 335 deletions
diff --git a/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt index bd9be0b5bc20..b7943f3f9995 100644 --- a/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt +++ b/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt | |||
@@ -19,6 +19,9 @@ Optional properties: | |||
19 | "bus-width = <1>" property. | 19 | "bus-width = <1>" property. |
20 | - sdhci,auto-cmd12: specifies that a controller can only handle auto | 20 | - sdhci,auto-cmd12: specifies that a controller can only handle auto |
21 | CMD12. | 21 | CMD12. |
22 | - voltage-ranges : two cells are required, first cell specifies minimum | ||
23 | slot voltage (mV), second cell specifies maximum slot voltage (mV). | ||
24 | Several ranges could be specified. | ||
22 | 25 | ||
23 | Example: | 26 | Example: |
24 | 27 | ||
@@ -29,4 +32,5 @@ sdhci@2e000 { | |||
29 | interrupt-parent = <&ipic>; | 32 | interrupt-parent = <&ipic>; |
30 | /* Filled in by U-Boot */ | 33 | /* Filled in by U-Boot */ |
31 | clock-frequency = <0>; | 34 | clock-frequency = <0>; |
35 | voltage-ranges = <3300 3300>; | ||
32 | }; | 36 | }; |
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c index 64f2e50e19ca..6bc1c181581d 100644 --- a/arch/arm/mach-ep93xx/vision_ep9307.c +++ b/arch/arm/mach-ep93xx/vision_ep9307.c | |||
@@ -224,62 +224,15 @@ static struct ep93xx_spi_chip_ops vision_spi_flash_hw = { | |||
224 | #define VISION_SPI_MMC_WP EP93XX_GPIO_LINE_F(0) | 224 | #define VISION_SPI_MMC_WP EP93XX_GPIO_LINE_F(0) |
225 | #define VISION_SPI_MMC_CD EP93XX_GPIO_LINE_EGPIO15 | 225 | #define VISION_SPI_MMC_CD EP93XX_GPIO_LINE_EGPIO15 |
226 | 226 | ||
227 | static struct gpio vision_spi_mmc_gpios[] = { | ||
228 | { VISION_SPI_MMC_WP, GPIOF_DIR_IN, "mmc_spi:wp" }, | ||
229 | { VISION_SPI_MMC_CD, GPIOF_DIR_IN, "mmc_spi:cd" }, | ||
230 | }; | ||
231 | |||
232 | static int vision_spi_mmc_init(struct device *pdev, | ||
233 | irqreturn_t (*func)(int, void *), void *pdata) | ||
234 | { | ||
235 | int err; | ||
236 | |||
237 | err = gpio_request_array(vision_spi_mmc_gpios, | ||
238 | ARRAY_SIZE(vision_spi_mmc_gpios)); | ||
239 | if (err) | ||
240 | return err; | ||
241 | |||
242 | err = gpio_set_debounce(VISION_SPI_MMC_CD, 1); | ||
243 | if (err) | ||
244 | goto exit_err; | ||
245 | |||
246 | err = request_irq(gpio_to_irq(VISION_SPI_MMC_CD), func, | ||
247 | IRQ_TYPE_EDGE_BOTH, "mmc_spi:cd", pdata); | ||
248 | if (err) | ||
249 | goto exit_err; | ||
250 | |||
251 | return 0; | ||
252 | |||
253 | exit_err: | ||
254 | gpio_free_array(vision_spi_mmc_gpios, ARRAY_SIZE(vision_spi_mmc_gpios)); | ||
255 | return err; | ||
256 | |||
257 | } | ||
258 | |||
259 | static void vision_spi_mmc_exit(struct device *pdev, void *pdata) | ||
260 | { | ||
261 | free_irq(gpio_to_irq(VISION_SPI_MMC_CD), pdata); | ||
262 | gpio_free_array(vision_spi_mmc_gpios, ARRAY_SIZE(vision_spi_mmc_gpios)); | ||
263 | } | ||
264 | |||
265 | static int vision_spi_mmc_get_ro(struct device *pdev) | ||
266 | { | ||
267 | return !!gpio_get_value(VISION_SPI_MMC_WP); | ||
268 | } | ||
269 | |||
270 | static int vision_spi_mmc_get_cd(struct device *pdev) | ||
271 | { | ||
272 | return !gpio_get_value(VISION_SPI_MMC_CD); | ||
273 | } | ||
274 | |||
275 | static struct mmc_spi_platform_data vision_spi_mmc_data = { | 227 | static struct mmc_spi_platform_data vision_spi_mmc_data = { |
276 | .init = vision_spi_mmc_init, | ||
277 | .exit = vision_spi_mmc_exit, | ||
278 | .get_ro = vision_spi_mmc_get_ro, | ||
279 | .get_cd = vision_spi_mmc_get_cd, | ||
280 | .detect_delay = 100, | 228 | .detect_delay = 100, |
281 | .powerup_msecs = 100, | 229 | .powerup_msecs = 100, |
282 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 230 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
231 | .flags = MMC_SPI_USE_CD_GPIO | MMC_SPI_USE_RO_GPIO, | ||
232 | .cd_gpio = VISION_SPI_MMC_CD, | ||
233 | .cd_debounce = 1, | ||
234 | .ro_gpio = VISION_SPI_MMC_WP, | ||
235 | .caps2 = MMC_CAP2_RO_ACTIVE_HIGH, | ||
283 | }; | 236 | }; |
284 | 237 | ||
285 | static int vision_spi_mmc_hw_setup(struct spi_device *spi) | 238 | static int vision_spi_mmc_hw_setup(struct spi_device *spi) |
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 65dd81baa7f6..1fa8be409771 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -600,37 +600,13 @@ static struct platform_device sdhi0_power = { | |||
600 | }, | 600 | }, |
601 | }; | 601 | }; |
602 | 602 | ||
603 | static void sdhi0_set_pwr(struct platform_device *pdev, int state) | ||
604 | { | ||
605 | static int power_gpio = -EINVAL; | ||
606 | |||
607 | if (power_gpio < 0) { | ||
608 | int ret = gpio_request(GPIO_PTB6, NULL); | ||
609 | if (!ret) { | ||
610 | power_gpio = GPIO_PTB6; | ||
611 | gpio_direction_output(power_gpio, 0); | ||
612 | } | ||
613 | } | ||
614 | |||
615 | /* | ||
616 | * Toggle the GPIO regardless, whether we managed to grab it above or | ||
617 | * the fixed regulator driver did. | ||
618 | */ | ||
619 | gpio_set_value(GPIO_PTB6, state); | ||
620 | } | ||
621 | |||
622 | static int sdhi0_get_cd(struct platform_device *pdev) | ||
623 | { | ||
624 | return !gpio_get_value(GPIO_PTY7); | ||
625 | } | ||
626 | |||
627 | static struct sh_mobile_sdhi_info sdhi0_info = { | 603 | static struct sh_mobile_sdhi_info sdhi0_info = { |
628 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | 604 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
629 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | 605 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
630 | .set_pwr = sdhi0_set_pwr, | ||
631 | .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | | 606 | .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | |
632 | MMC_CAP_NEEDS_POLL, | 607 | MMC_CAP_NEEDS_POLL, |
633 | .get_cd = sdhi0_get_cd, | 608 | .tmio_flags = TMIO_MMC_USE_GPIO_CD, |
609 | .cd_gpio = GPIO_PTY7, | ||
634 | }; | 610 | }; |
635 | 611 | ||
636 | static struct resource sdhi0_resources[] = { | 612 | static struct resource sdhi0_resources[] = { |
@@ -656,39 +632,15 @@ static struct platform_device sdhi0_device = { | |||
656 | }, | 632 | }, |
657 | }; | 633 | }; |
658 | 634 | ||
659 | static void cn12_set_pwr(struct platform_device *pdev, int state) | ||
660 | { | ||
661 | static int power_gpio = -EINVAL; | ||
662 | |||
663 | if (power_gpio < 0) { | ||
664 | int ret = gpio_request(GPIO_PTB7, NULL); | ||
665 | if (!ret) { | ||
666 | power_gpio = GPIO_PTB7; | ||
667 | gpio_direction_output(power_gpio, 0); | ||
668 | } | ||
669 | } | ||
670 | |||
671 | /* | ||
672 | * Toggle the GPIO regardless, whether we managed to grab it above or | ||
673 | * the fixed regulator driver did. | ||
674 | */ | ||
675 | gpio_set_value(GPIO_PTB7, state); | ||
676 | } | ||
677 | |||
678 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | 635 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
679 | /* SDHI1 */ | 636 | /* SDHI1 */ |
680 | static int sdhi1_get_cd(struct platform_device *pdev) | ||
681 | { | ||
682 | return !gpio_get_value(GPIO_PTW7); | ||
683 | } | ||
684 | |||
685 | static struct sh_mobile_sdhi_info sdhi1_info = { | 637 | static struct sh_mobile_sdhi_info sdhi1_info = { |
686 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, | 638 | .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, |
687 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, | 639 | .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, |
688 | .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | | 640 | .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | |
689 | MMC_CAP_NEEDS_POLL, | 641 | MMC_CAP_NEEDS_POLL, |
690 | .set_pwr = cn12_set_pwr, | 642 | .tmio_flags = TMIO_MMC_USE_GPIO_CD, |
691 | .get_cd = sdhi1_get_cd, | 643 | .cd_gpio = GPIO_PTW7, |
692 | }; | 644 | }; |
693 | 645 | ||
694 | static struct resource sdhi1_resources[] = { | 646 | static struct resource sdhi1_resources[] = { |
@@ -718,27 +670,19 @@ static struct platform_device sdhi1_device = { | |||
718 | #else | 670 | #else |
719 | 671 | ||
720 | /* MMC SPI */ | 672 | /* MMC SPI */ |
721 | static int mmc_spi_get_ro(struct device *dev) | ||
722 | { | ||
723 | return gpio_get_value(GPIO_PTY6); | ||
724 | } | ||
725 | |||
726 | static int mmc_spi_get_cd(struct device *dev) | ||
727 | { | ||
728 | return !gpio_get_value(GPIO_PTY7); | ||
729 | } | ||
730 | |||
731 | static void mmc_spi_setpower(struct device *dev, unsigned int maskval) | 673 | static void mmc_spi_setpower(struct device *dev, unsigned int maskval) |
732 | { | 674 | { |
733 | gpio_set_value(GPIO_PTB6, maskval ? 1 : 0); | 675 | gpio_set_value(GPIO_PTB6, maskval ? 1 : 0); |
734 | } | 676 | } |
735 | 677 | ||
736 | static struct mmc_spi_platform_data mmc_spi_info = { | 678 | static struct mmc_spi_platform_data mmc_spi_info = { |
737 | .get_ro = mmc_spi_get_ro, | ||
738 | .get_cd = mmc_spi_get_cd, | ||
739 | .caps = MMC_CAP_NEEDS_POLL, | 679 | .caps = MMC_CAP_NEEDS_POLL, |
680 | .caps2 = MMC_CAP2_RO_ACTIVE_HIGH, | ||
740 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */ | 681 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */ |
741 | .setpower = mmc_spi_setpower, | 682 | .setpower = mmc_spi_setpower, |
683 | .flags = MMC_SPI_USE_CD_GPIO | MMC_SPI_USE_RO_GPIO, | ||
684 | .cd_gpio = GPIO_PTY7, | ||
685 | .ro_gpio = GPIO_PTY6, | ||
742 | }; | 686 | }; |
743 | 687 | ||
744 | static struct spi_board_info spi_bus[] = { | 688 | static struct spi_board_info spi_bus[] = { |
@@ -998,11 +942,6 @@ static struct platform_device vou_device = { | |||
998 | 942 | ||
999 | #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) | 943 | #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) |
1000 | /* SH_MMCIF */ | 944 | /* SH_MMCIF */ |
1001 | static void mmcif_down_pwr(struct platform_device *pdev) | ||
1002 | { | ||
1003 | cn12_set_pwr(pdev, 0); | ||
1004 | } | ||
1005 | |||
1006 | static struct resource sh_mmcif_resources[] = { | 945 | static struct resource sh_mmcif_resources[] = { |
1007 | [0] = { | 946 | [0] = { |
1008 | .name = "SH_MMCIF", | 947 | .name = "SH_MMCIF", |
@@ -1023,8 +962,6 @@ static struct resource sh_mmcif_resources[] = { | |||
1023 | }; | 962 | }; |
1024 | 963 | ||
1025 | static struct sh_mmcif_plat_data sh_mmcif_plat = { | 964 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
1026 | .set_pwr = cn12_set_pwr, | ||
1027 | .down_pwr = mmcif_down_pwr, | ||
1028 | .sup_pclk = 0, /* SH7724: Max Pclk/2 */ | 965 | .sup_pclk = 0, /* SH7724: Max Pclk/2 */ |
1029 | .caps = MMC_CAP_4_BIT_DATA | | 966 | .caps = MMC_CAP_4_BIT_DATA | |
1030 | MMC_CAP_8_BIT_DATA | | 967 | MMC_CAP_8_BIT_DATA | |
@@ -1341,10 +1278,6 @@ static int __init arch_setup(void) | |||
1341 | gpio_direction_input(GPIO_PTR6); | 1278 | gpio_direction_input(GPIO_PTR6); |
1342 | 1279 | ||
1343 | /* SD-card slot CN11 */ | 1280 | /* SD-card slot CN11 */ |
1344 | /* Card-detect, used on CN11, either with SDHI0 or with SPI */ | ||
1345 | gpio_request(GPIO_PTY7, NULL); | ||
1346 | gpio_direction_input(GPIO_PTY7); | ||
1347 | |||
1348 | #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) | 1281 | #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) |
1349 | /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ | 1282 | /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ |
1350 | gpio_request(GPIO_FN_SDHI0WP, NULL); | 1283 | gpio_request(GPIO_FN_SDHI0WP, NULL); |
@@ -1363,8 +1296,6 @@ static int __init arch_setup(void) | |||
1363 | gpio_direction_output(GPIO_PTM4, 1); /* active low CS */ | 1296 | gpio_direction_output(GPIO_PTM4, 1); /* active low CS */ |
1364 | gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */ | 1297 | gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */ |
1365 | gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */ | 1298 | gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */ |
1366 | gpio_request(GPIO_PTY6, NULL); /* write protect */ | ||
1367 | gpio_direction_input(GPIO_PTY6); | ||
1368 | 1299 | ||
1369 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); | 1300 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); |
1370 | #endif | 1301 | #endif |
@@ -1394,10 +1325,6 @@ static int __init arch_setup(void) | |||
1394 | gpio_request(GPIO_FN_SDHI1D1, NULL); | 1325 | gpio_request(GPIO_FN_SDHI1D1, NULL); |
1395 | gpio_request(GPIO_FN_SDHI1D0, NULL); | 1326 | gpio_request(GPIO_FN_SDHI1D0, NULL); |
1396 | 1327 | ||
1397 | /* Card-detect, used on CN12 with SDHI1 */ | ||
1398 | gpio_request(GPIO_PTW7, NULL); | ||
1399 | gpio_direction_input(GPIO_PTW7); | ||
1400 | |||
1401 | cn12_enabled = true; | 1328 | cn12_enabled = true; |
1402 | #endif | 1329 | #endif |
1403 | 1330 | ||
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index cd0b7f4a1ff2..1a3163f1407e 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -812,7 +812,7 @@ static int mmc_blk_cmd_error(struct request *req, const char *name, int error, | |||
812 | * Otherwise we don't understand what happened, so abort. | 812 | * Otherwise we don't understand what happened, so abort. |
813 | */ | 813 | */ |
814 | static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req, | 814 | static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req, |
815 | struct mmc_blk_request *brq, int *ecc_err) | 815 | struct mmc_blk_request *brq, int *ecc_err, int *gen_err) |
816 | { | 816 | { |
817 | bool prev_cmd_status_valid = true; | 817 | bool prev_cmd_status_valid = true; |
818 | u32 status, stop_status = 0; | 818 | u32 status, stop_status = 0; |
@@ -850,6 +850,16 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req, | |||
850 | (brq->cmd.resp[0] & R1_CARD_ECC_FAILED)) | 850 | (brq->cmd.resp[0] & R1_CARD_ECC_FAILED)) |
851 | *ecc_err = 1; | 851 | *ecc_err = 1; |
852 | 852 | ||
853 | /* Flag General errors */ | ||
854 | if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) | ||
855 | if ((status & R1_ERROR) || | ||
856 | (brq->stop.resp[0] & R1_ERROR)) { | ||
857 | pr_err("%s: %s: general error sending stop or status command, stop cmd response %#x, card status %#x\n", | ||
858 | req->rq_disk->disk_name, __func__, | ||
859 | brq->stop.resp[0], status); | ||
860 | *gen_err = 1; | ||
861 | } | ||
862 | |||
853 | /* | 863 | /* |
854 | * Check the current card state. If it is in some data transfer | 864 | * Check the current card state. If it is in some data transfer |
855 | * mode, tell it to stop (and hopefully transition back to TRAN.) | 865 | * mode, tell it to stop (and hopefully transition back to TRAN.) |
@@ -869,6 +879,13 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req, | |||
869 | return ERR_ABORT; | 879 | return ERR_ABORT; |
870 | if (stop_status & R1_CARD_ECC_FAILED) | 880 | if (stop_status & R1_CARD_ECC_FAILED) |
871 | *ecc_err = 1; | 881 | *ecc_err = 1; |
882 | if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) | ||
883 | if (stop_status & R1_ERROR) { | ||
884 | pr_err("%s: %s: general error sending stop command, stop cmd response %#x\n", | ||
885 | req->rq_disk->disk_name, __func__, | ||
886 | stop_status); | ||
887 | *gen_err = 1; | ||
888 | } | ||
872 | } | 889 | } |
873 | 890 | ||
874 | /* Check for set block count errors */ | 891 | /* Check for set block count errors */ |
@@ -1097,7 +1114,7 @@ static int mmc_blk_err_check(struct mmc_card *card, | |||
1097 | mmc_active); | 1114 | mmc_active); |
1098 | struct mmc_blk_request *brq = &mq_mrq->brq; | 1115 | struct mmc_blk_request *brq = &mq_mrq->brq; |
1099 | struct request *req = mq_mrq->req; | 1116 | struct request *req = mq_mrq->req; |
1100 | int ecc_err = 0; | 1117 | int ecc_err = 0, gen_err = 0; |
1101 | 1118 | ||
1102 | /* | 1119 | /* |
1103 | * sbc.error indicates a problem with the set block count | 1120 | * sbc.error indicates a problem with the set block count |
@@ -1111,7 +1128,7 @@ static int mmc_blk_err_check(struct mmc_card *card, | |||
1111 | */ | 1128 | */ |
1112 | if (brq->sbc.error || brq->cmd.error || brq->stop.error || | 1129 | if (brq->sbc.error || brq->cmd.error || brq->stop.error || |
1113 | brq->data.error) { | 1130 | brq->data.error) { |
1114 | switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err)) { | 1131 | switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) { |
1115 | case ERR_RETRY: | 1132 | case ERR_RETRY: |
1116 | return MMC_BLK_RETRY; | 1133 | return MMC_BLK_RETRY; |
1117 | case ERR_ABORT: | 1134 | case ERR_ABORT: |
@@ -1143,6 +1160,14 @@ static int mmc_blk_err_check(struct mmc_card *card, | |||
1143 | u32 status; | 1160 | u32 status; |
1144 | unsigned long timeout; | 1161 | unsigned long timeout; |
1145 | 1162 | ||
1163 | /* Check stop command response */ | ||
1164 | if (brq->stop.resp[0] & R1_ERROR) { | ||
1165 | pr_err("%s: %s: general error sending stop command, stop cmd response %#x\n", | ||
1166 | req->rq_disk->disk_name, __func__, | ||
1167 | brq->stop.resp[0]); | ||
1168 | gen_err = 1; | ||
1169 | } | ||
1170 | |||
1146 | timeout = jiffies + msecs_to_jiffies(MMC_BLK_TIMEOUT_MS); | 1171 | timeout = jiffies + msecs_to_jiffies(MMC_BLK_TIMEOUT_MS); |
1147 | do { | 1172 | do { |
1148 | int err = get_card_status(card, &status, 5); | 1173 | int err = get_card_status(card, &status, 5); |
@@ -1152,6 +1177,13 @@ static int mmc_blk_err_check(struct mmc_card *card, | |||
1152 | return MMC_BLK_CMD_ERR; | 1177 | return MMC_BLK_CMD_ERR; |
1153 | } | 1178 | } |
1154 | 1179 | ||
1180 | if (status & R1_ERROR) { | ||
1181 | pr_err("%s: %s: general error sending status command, card status %#x\n", | ||
1182 | req->rq_disk->disk_name, __func__, | ||
1183 | status); | ||
1184 | gen_err = 1; | ||
1185 | } | ||
1186 | |||
1155 | /* Timeout if the device never becomes ready for data | 1187 | /* Timeout if the device never becomes ready for data |
1156 | * and never leaves the program state. | 1188 | * and never leaves the program state. |
1157 | */ | 1189 | */ |
@@ -1171,6 +1203,13 @@ static int mmc_blk_err_check(struct mmc_card *card, | |||
1171 | (R1_CURRENT_STATE(status) == R1_STATE_PRG)); | 1203 | (R1_CURRENT_STATE(status) == R1_STATE_PRG)); |
1172 | } | 1204 | } |
1173 | 1205 | ||
1206 | /* if general error occurs, retry the write operation. */ | ||
1207 | if (gen_err) { | ||
1208 | pr_warn("%s: retrying write for general error\n", | ||
1209 | req->rq_disk->disk_name); | ||
1210 | return MMC_BLK_RETRY; | ||
1211 | } | ||
1212 | |||
1174 | if (brq->data.error) { | 1213 | if (brq->data.error) { |
1175 | pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n", | 1214 | pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n", |
1176 | req->rq_disk->disk_name, brq->data.error, | 1215 | req->rq_disk->disk_name, brq->data.error, |
@@ -2191,10 +2230,10 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md) | |||
2191 | * is freeing the queue that stops new requests | 2230 | * is freeing the queue that stops new requests |
2192 | * from being accepted. | 2231 | * from being accepted. |
2193 | */ | 2232 | */ |
2233 | card = md->queue.card; | ||
2194 | mmc_cleanup_queue(&md->queue); | 2234 | mmc_cleanup_queue(&md->queue); |
2195 | if (md->flags & MMC_BLK_PACKED_CMD) | 2235 | if (md->flags & MMC_BLK_PACKED_CMD) |
2196 | mmc_packed_clean(&md->queue); | 2236 | mmc_packed_clean(&md->queue); |
2197 | card = md->queue.card; | ||
2198 | if (md->disk->flags & GENHD_FL_UP) { | 2237 | if (md->disk->flags & GENHD_FL_UP) { |
2199 | device_remove_file(disk_to_dev(md->disk), &md->force_ro); | 2238 | device_remove_file(disk_to_dev(md->disk), &md->force_ro); |
2200 | if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) && | 2239 | if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) && |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index a69df5216274..0c0fc52d42c5 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -2849,18 +2849,12 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, | |||
2849 | struct seq_file *sf = (struct seq_file *)file->private_data; | 2849 | struct seq_file *sf = (struct seq_file *)file->private_data; |
2850 | struct mmc_card *card = (struct mmc_card *)sf->private; | 2850 | struct mmc_card *card = (struct mmc_card *)sf->private; |
2851 | struct mmc_test_card *test; | 2851 | struct mmc_test_card *test; |
2852 | char lbuf[12]; | ||
2853 | long testcase; | 2852 | long testcase; |
2853 | int ret; | ||
2854 | 2854 | ||
2855 | if (count >= sizeof(lbuf)) | 2855 | ret = kstrtol_from_user(buf, count, 10, &testcase); |
2856 | return -EINVAL; | 2856 | if (ret) |
2857 | 2857 | return ret; | |
2858 | if (copy_from_user(lbuf, buf, count)) | ||
2859 | return -EFAULT; | ||
2860 | lbuf[count] = '\0'; | ||
2861 | |||
2862 | if (strict_strtol(lbuf, 10, &testcase)) | ||
2863 | return -EINVAL; | ||
2864 | 2858 | ||
2865 | test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); | 2859 | test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); |
2866 | if (!test) | 2860 | if (!test) |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5d088551196b..bf18b6bfce48 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/fault-inject.h> | 27 | #include <linux/fault-inject.h> |
28 | #include <linux/random.h> | 28 | #include <linux/random.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/of.h> | ||
30 | 31 | ||
31 | #include <linux/mmc/card.h> | 32 | #include <linux/mmc/card.h> |
32 | #include <linux/mmc/host.h> | 33 | #include <linux/mmc/host.h> |
@@ -1196,6 +1197,49 @@ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max) | |||
1196 | } | 1197 | } |
1197 | EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); | 1198 | EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); |
1198 | 1199 | ||
1200 | #ifdef CONFIG_OF | ||
1201 | |||
1202 | /** | ||
1203 | * mmc_of_parse_voltage - return mask of supported voltages | ||
1204 | * @np: The device node need to be parsed. | ||
1205 | * @mask: mask of voltages available for MMC/SD/SDIO | ||
1206 | * | ||
1207 | * 1. Return zero on success. | ||
1208 | * 2. Return negative errno: voltage-range is invalid. | ||
1209 | */ | ||
1210 | int mmc_of_parse_voltage(struct device_node *np, u32 *mask) | ||
1211 | { | ||
1212 | const u32 *voltage_ranges; | ||
1213 | int num_ranges, i; | ||
1214 | |||
1215 | voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); | ||
1216 | num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; | ||
1217 | if (!voltage_ranges || !num_ranges) { | ||
1218 | pr_info("%s: voltage-ranges unspecified\n", np->full_name); | ||
1219 | return -EINVAL; | ||
1220 | } | ||
1221 | |||
1222 | for (i = 0; i < num_ranges; i++) { | ||
1223 | const int j = i * 2; | ||
1224 | u32 ocr_mask; | ||
1225 | |||
1226 | ocr_mask = mmc_vddrange_to_ocrmask( | ||
1227 | be32_to_cpu(voltage_ranges[j]), | ||
1228 | be32_to_cpu(voltage_ranges[j + 1])); | ||
1229 | if (!ocr_mask) { | ||
1230 | pr_err("%s: voltage-range #%d is invalid\n", | ||
1231 | np->full_name, i); | ||
1232 | return -EINVAL; | ||
1233 | } | ||
1234 | *mask |= ocr_mask; | ||
1235 | } | ||
1236 | |||
1237 | return 0; | ||
1238 | } | ||
1239 | EXPORT_SYMBOL(mmc_of_parse_voltage); | ||
1240 | |||
1241 | #endif /* CONFIG_OF */ | ||
1242 | |||
1199 | #ifdef CONFIG_REGULATOR | 1243 | #ifdef CONFIG_REGULATOR |
1200 | 1244 | ||
1201 | /** | 1245 | /** |
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 6fb6f77450cb..49bc403e31f0 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -374,7 +374,7 @@ int mmc_of_parse(struct mmc_host *host) | |||
374 | if (!(flags & OF_GPIO_ACTIVE_LOW)) | 374 | if (!(flags & OF_GPIO_ACTIVE_LOW)) |
375 | gpio_inv_cd = true; | 375 | gpio_inv_cd = true; |
376 | 376 | ||
377 | ret = mmc_gpio_request_cd(host, gpio); | 377 | ret = mmc_gpio_request_cd(host, gpio, 0); |
378 | if (ret < 0) { | 378 | if (ret < 0) { |
379 | dev_err(host->parent, | 379 | dev_err(host->parent, |
380 | "Failed to request CD GPIO #%d: %d!\n", | 380 | "Failed to request CD GPIO #%d: %d!\n", |
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 837fc7386e23..ef183483d5b6 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c | |||
@@ -531,6 +531,7 @@ mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode, | |||
531 | 531 | ||
532 | data.sg = &sg; | 532 | data.sg = &sg; |
533 | data.sg_len = 1; | 533 | data.sg_len = 1; |
534 | mmc_set_data_timeout(&data, card); | ||
534 | sg_init_one(&sg, data_buf, len); | 535 | sg_init_one(&sg, data_buf, len); |
535 | mmc_wait_for_req(host, &mrq); | 536 | mmc_wait_for_req(host, &mrq); |
536 | err = 0; | 537 | err = 0; |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 176d125f5b57..5e8823dc3ef6 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -215,7 +215,7 @@ static int mmc_decode_scr(struct mmc_card *card) | |||
215 | static int mmc_read_ssr(struct mmc_card *card) | 215 | static int mmc_read_ssr(struct mmc_card *card) |
216 | { | 216 | { |
217 | unsigned int au, es, et, eo; | 217 | unsigned int au, es, et, eo; |
218 | int err, i; | 218 | int err, i, max_au; |
219 | u32 *ssr; | 219 | u32 *ssr; |
220 | 220 | ||
221 | if (!(card->csd.cmdclass & CCC_APP_SPEC)) { | 221 | if (!(card->csd.cmdclass & CCC_APP_SPEC)) { |
@@ -239,12 +239,15 @@ static int mmc_read_ssr(struct mmc_card *card) | |||
239 | for (i = 0; i < 16; i++) | 239 | for (i = 0; i < 16; i++) |
240 | ssr[i] = be32_to_cpu(ssr[i]); | 240 | ssr[i] = be32_to_cpu(ssr[i]); |
241 | 241 | ||
242 | /* SD3.0 increases max AU size to 64MB (0xF) from 4MB (0x9) */ | ||
243 | max_au = card->scr.sda_spec3 ? 0xF : 0x9; | ||
244 | |||
242 | /* | 245 | /* |
243 | * UNSTUFF_BITS only works with four u32s so we have to offset the | 246 | * UNSTUFF_BITS only works with four u32s so we have to offset the |
244 | * bitfield positions accordingly. | 247 | * bitfield positions accordingly. |
245 | */ | 248 | */ |
246 | au = UNSTUFF_BITS(ssr, 428 - 384, 4); | 249 | au = UNSTUFF_BITS(ssr, 428 - 384, 4); |
247 | if (au > 0 && au <= 9) { | 250 | if (au > 0 && au <= max_au) { |
248 | card->ssr.au = 1 << (au + 4); | 251 | card->ssr.au = 1 << (au + 4); |
249 | es = UNSTUFF_BITS(ssr, 408 - 384, 16); | 252 | es = UNSTUFF_BITS(ssr, 408 - 384, 16); |
250 | et = UNSTUFF_BITS(ssr, 402 - 384, 6); | 253 | et = UNSTUFF_BITS(ssr, 402 - 384, 6); |
@@ -942,13 +945,13 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
942 | if (!mmc_host_is_spi(host)) { | 945 | if (!mmc_host_is_spi(host)) { |
943 | err = mmc_send_relative_addr(host, &card->rca); | 946 | err = mmc_send_relative_addr(host, &card->rca); |
944 | if (err) | 947 | if (err) |
945 | return err; | 948 | goto free_card; |
946 | } | 949 | } |
947 | 950 | ||
948 | if (!oldcard) { | 951 | if (!oldcard) { |
949 | err = mmc_sd_get_csd(host, card); | 952 | err = mmc_sd_get_csd(host, card); |
950 | if (err) | 953 | if (err) |
951 | return err; | 954 | goto free_card; |
952 | 955 | ||
953 | mmc_decode_cid(card); | 956 | mmc_decode_cid(card); |
954 | } | 957 | } |
@@ -959,7 +962,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
959 | if (!mmc_host_is_spi(host)) { | 962 | if (!mmc_host_is_spi(host)) { |
960 | err = mmc_select_card(card); | 963 | err = mmc_select_card(card); |
961 | if (err) | 964 | if (err) |
962 | return err; | 965 | goto free_card; |
963 | } | 966 | } |
964 | 967 | ||
965 | err = mmc_sd_setup_card(host, card, oldcard != NULL); | 968 | err = mmc_sd_setup_card(host, card, oldcard != NULL); |
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 324235105519..46596b71a32f 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c | |||
@@ -135,6 +135,7 @@ EXPORT_SYMBOL(mmc_gpio_request_ro); | |||
135 | * mmc_gpio_request_cd - request a gpio for card-detection | 135 | * mmc_gpio_request_cd - request a gpio for card-detection |
136 | * @host: mmc host | 136 | * @host: mmc host |
137 | * @gpio: gpio number requested | 137 | * @gpio: gpio number requested |
138 | * @debounce: debounce time in microseconds | ||
138 | * | 139 | * |
139 | * As devm_* managed functions are used in mmc_gpio_request_cd(), client | 140 | * As devm_* managed functions are used in mmc_gpio_request_cd(), client |
140 | * drivers do not need to explicitly call mmc_gpio_free_cd() for freeing up, | 141 | * drivers do not need to explicitly call mmc_gpio_free_cd() for freeing up, |
@@ -143,9 +144,14 @@ EXPORT_SYMBOL(mmc_gpio_request_ro); | |||
143 | * switching for card-detection, they are responsible for calling | 144 | * switching for card-detection, they are responsible for calling |
144 | * mmc_gpio_request_cd() and mmc_gpio_free_cd() as a pair on their own. | 145 | * mmc_gpio_request_cd() and mmc_gpio_free_cd() as a pair on their own. |
145 | * | 146 | * |
147 | * If GPIO debouncing is desired, set the debounce parameter to a non-zero | ||
148 | * value. The caller is responsible for ensuring that the GPIO driver associated | ||
149 | * with the GPIO supports debouncing, otherwise an error will be returned. | ||
150 | * | ||
146 | * Returns zero on success, else an error. | 151 | * Returns zero on success, else an error. |
147 | */ | 152 | */ |
148 | int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio) | 153 | int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, |
154 | unsigned int debounce) | ||
149 | { | 155 | { |
150 | struct mmc_gpio *ctx; | 156 | struct mmc_gpio *ctx; |
151 | int irq = gpio_to_irq(gpio); | 157 | int irq = gpio_to_irq(gpio); |
@@ -167,6 +173,12 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio) | |||
167 | */ | 173 | */ |
168 | return ret; | 174 | return ret; |
169 | 175 | ||
176 | if (debounce) { | ||
177 | ret = gpio_set_debounce(gpio, debounce); | ||
178 | if (ret < 0) | ||
179 | return ret; | ||
180 | } | ||
181 | |||
170 | /* | 182 | /* |
171 | * Even if gpio_to_irq() returns a valid IRQ number, the platform might | 183 | * Even if gpio_to_irq() returns a valid IRQ number, the platform might |
172 | * still prefer to poll, e.g., because that IRQ number is already used | 184 | * still prefer to poll, e.g., because that IRQ number is already used |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 8a4c066787d7..b7fd5ab80a48 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -284,11 +284,11 @@ config MMC_OMAP | |||
284 | 284 | ||
285 | config MMC_OMAP_HS | 285 | config MMC_OMAP_HS |
286 | tristate "TI OMAP High Speed Multimedia Card Interface support" | 286 | tristate "TI OMAP High Speed Multimedia Card Interface support" |
287 | depends on SOC_OMAP2430 || ARCH_OMAP3 || ARCH_OMAP4 | 287 | depends on ARCH_OMAP2PLUS || COMPILE_TEST |
288 | help | 288 | help |
289 | This selects the TI OMAP High Speed Multimedia card Interface. | 289 | This selects the TI OMAP High Speed Multimedia card Interface. |
290 | If you have an OMAP2430 or OMAP3 board or OMAP4 board with a | 290 | If you have an omap2plus board with a Multimedia Card slot, |
291 | Multimedia Card slot, say Y or M here. | 291 | say Y or M here. |
292 | 292 | ||
293 | If unsure, say N. | 293 | If unsure, say N. |
294 | 294 | ||
@@ -530,7 +530,7 @@ config SDH_BFIN_MISSING_CMD_PULLUP_WORKAROUND | |||
530 | 530 | ||
531 | config MMC_DW | 531 | config MMC_DW |
532 | tristate "Synopsys DesignWare Memory Card Interface" | 532 | tristate "Synopsys DesignWare Memory Card Interface" |
533 | depends on ARM | 533 | depends on ARC || ARM |
534 | help | 534 | help |
535 | This selects support for the Synopsys DesignWare Mobile Storage IP | 535 | This selects support for the Synopsys DesignWare Mobile Storage IP |
536 | block, this provides host support for SD and MMC interfaces, in both | 536 | block, this provides host support for SD and MMC interfaces, in both |
@@ -569,7 +569,7 @@ config MMC_DW_EXYNOS | |||
569 | 569 | ||
570 | config MMC_DW_SOCFPGA | 570 | config MMC_DW_SOCFPGA |
571 | tristate "SOCFPGA specific extensions for Synopsys DW Memory Card Interface" | 571 | tristate "SOCFPGA specific extensions for Synopsys DW Memory Card Interface" |
572 | depends on MMC_DW | 572 | depends on MMC_DW && MFD_SYSCON |
573 | select MMC_DW_PLTFM | 573 | select MMC_DW_PLTFM |
574 | help | 574 | help |
575 | This selects support for Altera SoCFPGA specific extensions to the | 575 | This selects support for Altera SoCFPGA specific extensions to the |
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index d422e2167e19..c41d0c364509 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile | |||
@@ -52,8 +52,6 @@ obj-$(CONFIG_MMC_WMT) += wmt-sdmmc.o | |||
52 | 52 | ||
53 | obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o | 53 | obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o |
54 | 54 | ||
55 | obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o | ||
56 | |||
57 | obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o | 55 | obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o |
58 | obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o | 56 | obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o |
59 | obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o | 57 | obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index bdb84da74952..69e438ee043e 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -378,6 +378,8 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
378 | { | 378 | { |
379 | struct atmel_mci *host = s->private; | 379 | struct atmel_mci *host = s->private; |
380 | u32 *buf; | 380 | u32 *buf; |
381 | int ret = 0; | ||
382 | |||
381 | 383 | ||
382 | buf = kmalloc(ATMCI_REGS_SIZE, GFP_KERNEL); | 384 | buf = kmalloc(ATMCI_REGS_SIZE, GFP_KERNEL); |
383 | if (!buf) | 385 | if (!buf) |
@@ -388,12 +390,16 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
388 | * not disabling interrupts, so IMR and SR may not be | 390 | * not disabling interrupts, so IMR and SR may not be |
389 | * consistent. | 391 | * consistent. |
390 | */ | 392 | */ |
393 | ret = clk_prepare_enable(host->mck); | ||
394 | if (ret) | ||
395 | goto out; | ||
396 | |||
391 | spin_lock_bh(&host->lock); | 397 | spin_lock_bh(&host->lock); |
392 | clk_enable(host->mck); | ||
393 | memcpy_fromio(buf, host->regs, ATMCI_REGS_SIZE); | 398 | memcpy_fromio(buf, host->regs, ATMCI_REGS_SIZE); |
394 | clk_disable(host->mck); | ||
395 | spin_unlock_bh(&host->lock); | 399 | spin_unlock_bh(&host->lock); |
396 | 400 | ||
401 | clk_disable_unprepare(host->mck); | ||
402 | |||
397 | seq_printf(s, "MR:\t0x%08x%s%s ", | 403 | seq_printf(s, "MR:\t0x%08x%s%s ", |
398 | buf[ATMCI_MR / 4], | 404 | buf[ATMCI_MR / 4], |
399 | buf[ATMCI_MR / 4] & ATMCI_MR_RDPROOF ? " RDPROOF" : "", | 405 | buf[ATMCI_MR / 4] & ATMCI_MR_RDPROOF ? " RDPROOF" : "", |
@@ -442,9 +448,10 @@ static int atmci_regs_show(struct seq_file *s, void *v) | |||
442 | val & ATMCI_CFG_LSYNC ? " LSYNC" : ""); | 448 | val & ATMCI_CFG_LSYNC ? " LSYNC" : ""); |
443 | } | 449 | } |
444 | 450 | ||
451 | out: | ||
445 | kfree(buf); | 452 | kfree(buf); |
446 | 453 | ||
447 | return 0; | 454 | return ret; |
448 | } | 455 | } |
449 | 456 | ||
450 | static int atmci_regs_open(struct inode *inode, struct file *file) | 457 | static int atmci_regs_open(struct inode *inode, struct file *file) |
@@ -1262,6 +1269,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1262 | struct atmel_mci_slot *slot = mmc_priv(mmc); | 1269 | struct atmel_mci_slot *slot = mmc_priv(mmc); |
1263 | struct atmel_mci *host = slot->host; | 1270 | struct atmel_mci *host = slot->host; |
1264 | unsigned int i; | 1271 | unsigned int i; |
1272 | bool unprepare_clk; | ||
1265 | 1273 | ||
1266 | slot->sdc_reg &= ~ATMCI_SDCBUS_MASK; | 1274 | slot->sdc_reg &= ~ATMCI_SDCBUS_MASK; |
1267 | switch (ios->bus_width) { | 1275 | switch (ios->bus_width) { |
@@ -1277,9 +1285,13 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1277 | unsigned int clock_min = ~0U; | 1285 | unsigned int clock_min = ~0U; |
1278 | u32 clkdiv; | 1286 | u32 clkdiv; |
1279 | 1287 | ||
1288 | clk_prepare(host->mck); | ||
1289 | unprepare_clk = true; | ||
1290 | |||
1280 | spin_lock_bh(&host->lock); | 1291 | spin_lock_bh(&host->lock); |
1281 | if (!host->mode_reg) { | 1292 | if (!host->mode_reg) { |
1282 | clk_enable(host->mck); | 1293 | clk_enable(host->mck); |
1294 | unprepare_clk = false; | ||
1283 | atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST); | 1295 | atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST); |
1284 | atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN); | 1296 | atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN); |
1285 | if (host->caps.has_cfg_reg) | 1297 | if (host->caps.has_cfg_reg) |
@@ -1347,6 +1359,8 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1347 | } else { | 1359 | } else { |
1348 | bool any_slot_active = false; | 1360 | bool any_slot_active = false; |
1349 | 1361 | ||
1362 | unprepare_clk = false; | ||
1363 | |||
1350 | spin_lock_bh(&host->lock); | 1364 | spin_lock_bh(&host->lock); |
1351 | slot->clock = 0; | 1365 | slot->clock = 0; |
1352 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { | 1366 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { |
@@ -1360,12 +1374,16 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1360 | if (host->mode_reg) { | 1374 | if (host->mode_reg) { |
1361 | atmci_readl(host, ATMCI_MR); | 1375 | atmci_readl(host, ATMCI_MR); |
1362 | clk_disable(host->mck); | 1376 | clk_disable(host->mck); |
1377 | unprepare_clk = true; | ||
1363 | } | 1378 | } |
1364 | host->mode_reg = 0; | 1379 | host->mode_reg = 0; |
1365 | } | 1380 | } |
1366 | spin_unlock_bh(&host->lock); | 1381 | spin_unlock_bh(&host->lock); |
1367 | } | 1382 | } |
1368 | 1383 | ||
1384 | if (unprepare_clk) | ||
1385 | clk_unprepare(host->mck); | ||
1386 | |||
1369 | switch (ios->power_mode) { | 1387 | switch (ios->power_mode) { |
1370 | case MMC_POWER_UP: | 1388 | case MMC_POWER_UP: |
1371 | set_bit(ATMCI_CARD_NEED_INIT, &slot->flags); | 1389 | set_bit(ATMCI_CARD_NEED_INIT, &slot->flags); |
@@ -2376,10 +2394,12 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
2376 | if (!host->regs) | 2394 | if (!host->regs) |
2377 | goto err_ioremap; | 2395 | goto err_ioremap; |
2378 | 2396 | ||
2379 | clk_enable(host->mck); | 2397 | ret = clk_prepare_enable(host->mck); |
2398 | if (ret) | ||
2399 | goto err_request_irq; | ||
2380 | atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST); | 2400 | atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST); |
2381 | host->bus_hz = clk_get_rate(host->mck); | 2401 | host->bus_hz = clk_get_rate(host->mck); |
2382 | clk_disable(host->mck); | 2402 | clk_disable_unprepare(host->mck); |
2383 | 2403 | ||
2384 | host->mapbase = regs->start; | 2404 | host->mapbase = regs->start; |
2385 | 2405 | ||
@@ -2482,11 +2502,11 @@ static int __exit atmci_remove(struct platform_device *pdev) | |||
2482 | atmci_cleanup_slot(host->slot[i], i); | 2502 | atmci_cleanup_slot(host->slot[i], i); |
2483 | } | 2503 | } |
2484 | 2504 | ||
2485 | clk_enable(host->mck); | 2505 | clk_prepare_enable(host->mck); |
2486 | atmci_writel(host, ATMCI_IDR, ~0UL); | 2506 | atmci_writel(host, ATMCI_IDR, ~0UL); |
2487 | atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS); | 2507 | atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIDIS); |
2488 | atmci_readl(host, ATMCI_SR); | 2508 | atmci_readl(host, ATMCI_SR); |
2489 | clk_disable(host->mck); | 2509 | clk_disable_unprepare(host->mck); |
2490 | 2510 | ||
2491 | if (host->dma.chan) | 2511 | if (host->dma.chan) |
2492 | dma_release_channel(host->dma.chan); | 2512 | dma_release_channel(host->dma.chan); |
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c index 866edef2e820..6a1fa2110a05 100644 --- a/drivers/mmc/host/dw_mmc-exynos.c +++ b/drivers/mmc/host/dw_mmc-exynos.c | |||
@@ -39,6 +39,7 @@ enum dw_mci_exynos_type { | |||
39 | DW_MCI_TYPE_EXYNOS4210, | 39 | DW_MCI_TYPE_EXYNOS4210, |
40 | DW_MCI_TYPE_EXYNOS4412, | 40 | DW_MCI_TYPE_EXYNOS4412, |
41 | DW_MCI_TYPE_EXYNOS5250, | 41 | DW_MCI_TYPE_EXYNOS5250, |
42 | DW_MCI_TYPE_EXYNOS5420, | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | /* Exynos implementation specific driver private data */ | 45 | /* Exynos implementation specific driver private data */ |
@@ -62,6 +63,9 @@ static struct dw_mci_exynos_compatible { | |||
62 | }, { | 63 | }, { |
63 | .compatible = "samsung,exynos5250-dw-mshc", | 64 | .compatible = "samsung,exynos5250-dw-mshc", |
64 | .ctrl_type = DW_MCI_TYPE_EXYNOS5250, | 65 | .ctrl_type = DW_MCI_TYPE_EXYNOS5250, |
66 | }, { | ||
67 | .compatible = "samsung,exynos5420-dw-mshc", | ||
68 | .ctrl_type = DW_MCI_TYPE_EXYNOS5420, | ||
65 | }, | 69 | }, |
66 | }; | 70 | }; |
67 | 71 | ||
@@ -90,7 +94,8 @@ static int dw_mci_exynos_setup_clock(struct dw_mci *host) | |||
90 | { | 94 | { |
91 | struct dw_mci_exynos_priv_data *priv = host->priv; | 95 | struct dw_mci_exynos_priv_data *priv = host->priv; |
92 | 96 | ||
93 | if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5250) | 97 | if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS5250 || |
98 | priv->ctrl_type == DW_MCI_TYPE_EXYNOS5420) | ||
94 | host->bus_hz /= (priv->ciu_div + 1); | 99 | host->bus_hz /= (priv->ciu_div + 1); |
95 | else if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS4412) | 100 | else if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS4412) |
96 | host->bus_hz /= EXYNOS4412_FIXED_CIU_CLK_DIV; | 101 | host->bus_hz /= EXYNOS4412_FIXED_CIU_CLK_DIV; |
@@ -173,6 +178,8 @@ static const struct of_device_id dw_mci_exynos_match[] = { | |||
173 | .data = &exynos_drv_data, }, | 178 | .data = &exynos_drv_data, }, |
174 | { .compatible = "samsung,exynos5250-dw-mshc", | 179 | { .compatible = "samsung,exynos5250-dw-mshc", |
175 | .data = &exynos_drv_data, }, | 180 | .data = &exynos_drv_data, }, |
181 | { .compatible = "samsung,exynos5420-dw-mshc", | ||
182 | .data = &exynos_drv_data, }, | ||
176 | {}, | 183 | {}, |
177 | }; | 184 | }; |
178 | MODULE_DEVICE_TABLE(of, dw_mci_exynos_match); | 185 | MODULE_DEVICE_TABLE(of, dw_mci_exynos_match); |
diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c index b456b0c35231..f70546a3a7cc 100644 --- a/drivers/mmc/host/dw_mmc-pci.c +++ b/drivers/mmc/host/dw_mmc-pci.c | |||
@@ -59,7 +59,9 @@ static int dw_mci_pci_probe(struct pci_dev *pdev, | |||
59 | if (ret) | 59 | if (ret) |
60 | return ret; | 60 | return ret; |
61 | 61 | ||
62 | host->regs = pcim_iomap_table(pdev)[0]; | 62 | host->regs = pcim_iomap_table(pdev)[PCI_BAR_NO]; |
63 | |||
64 | pci_set_master(pdev); | ||
63 | 65 | ||
64 | ret = dw_mci_probe(host); | 66 | ret = dw_mci_probe(host); |
65 | if (ret) | 67 | if (ret) |
diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index ee525565aa77..20897529ea5e 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | 24 | ||
25 | #include "dw_mmc.h" | 25 | #include "dw_mmc.h" |
26 | #include "dw_mmc-pltfm.h" | ||
26 | 27 | ||
27 | static void dw_mci_rockchip_prepare_command(struct dw_mci *host, u32 *cmdr) | 28 | static void dw_mci_rockchip_prepare_command(struct dw_mci *host, u32 *cmdr) |
28 | { | 29 | { |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 542407363dd2..018f365e5ae4 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -1601,18 +1601,17 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) | |||
1601 | 1601 | ||
1602 | pending = mci_readl(host, MINTSTS); /* read-only mask reg */ | 1602 | pending = mci_readl(host, MINTSTS); /* read-only mask reg */ |
1603 | 1603 | ||
1604 | if (pending) { | 1604 | /* |
1605 | 1605 | * DTO fix - version 2.10a and below, and only if internal DMA | |
1606 | /* | 1606 | * is configured. |
1607 | * DTO fix - version 2.10a and below, and only if internal DMA | 1607 | */ |
1608 | * is configured. | 1608 | if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) { |
1609 | */ | 1609 | if (!pending && |
1610 | if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) { | 1610 | ((mci_readl(host, STATUS) >> 17) & 0x1fff)) |
1611 | if (!pending && | 1611 | pending |= SDMMC_INT_DATA_OVER; |
1612 | ((mci_readl(host, STATUS) >> 17) & 0x1fff)) | 1612 | } |
1613 | pending |= SDMMC_INT_DATA_OVER; | ||
1614 | } | ||
1615 | 1613 | ||
1614 | if (pending) { | ||
1616 | if (pending & DW_MCI_CMD_ERROR_FLAGS) { | 1615 | if (pending & DW_MCI_CMD_ERROR_FLAGS) { |
1617 | mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS); | 1616 | mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS); |
1618 | host->cmd_status = pending; | 1617 | host->cmd_status = pending; |
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c index 0308c9f1cf52..66516339e3a0 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c | |||
@@ -713,7 +713,7 @@ static int jz4740_mmc_request_gpios(struct mmc_host *mmc, | |||
713 | mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | 713 | mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; |
714 | 714 | ||
715 | if (gpio_is_valid(pdata->gpio_card_detect)) { | 715 | if (gpio_is_valid(pdata->gpio_card_detect)) { |
716 | ret = mmc_gpio_request_cd(mmc, pdata->gpio_card_detect); | 716 | ret = mmc_gpio_request_cd(mmc, pdata->gpio_card_detect, 0); |
717 | if (ret) | 717 | if (ret) |
718 | return ret; | 718 | return ret; |
719 | } | 719 | } |
@@ -783,9 +783,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev) | |||
783 | 783 | ||
784 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 784 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
785 | host->base = devm_ioremap_resource(&pdev->dev, res); | 785 | host->base = devm_ioremap_resource(&pdev->dev, res); |
786 | if (!host->base) { | 786 | if (IS_ERR(host->base)) { |
787 | ret = -EBUSY; | 787 | ret = PTR_ERR(host->base); |
788 | dev_err(&pdev->dev, "Failed to ioremap base memory\n"); | ||
789 | goto err_free_host; | 788 | goto err_free_host; |
790 | } | 789 | } |
791 | 790 | ||
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 74145d1d51f5..0a87e5691341 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/mmc/host.h> | 37 | #include <linux/mmc/host.h> |
38 | #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ | 38 | #include <linux/mmc/mmc.h> /* for R1_SPI_* bit values */ |
39 | #include <linux/mmc/slot-gpio.h> | ||
39 | 40 | ||
40 | #include <linux/spi/spi.h> | 41 | #include <linux/spi/spi.h> |
41 | #include <linux/spi/mmc_spi.h> | 42 | #include <linux/spi/mmc_spi.h> |
@@ -1272,33 +1273,11 @@ static void mmc_spi_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1272 | } | 1273 | } |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | static int mmc_spi_get_ro(struct mmc_host *mmc) | ||
1276 | { | ||
1277 | struct mmc_spi_host *host = mmc_priv(mmc); | ||
1278 | |||
1279 | if (host->pdata && host->pdata->get_ro) | ||
1280 | return !!host->pdata->get_ro(mmc->parent); | ||
1281 | /* | ||
1282 | * Board doesn't support read only detection; let the mmc core | ||
1283 | * decide what to do. | ||
1284 | */ | ||
1285 | return -ENOSYS; | ||
1286 | } | ||
1287 | |||
1288 | static int mmc_spi_get_cd(struct mmc_host *mmc) | ||
1289 | { | ||
1290 | struct mmc_spi_host *host = mmc_priv(mmc); | ||
1291 | |||
1292 | if (host->pdata && host->pdata->get_cd) | ||
1293 | return !!host->pdata->get_cd(mmc->parent); | ||
1294 | return -ENOSYS; | ||
1295 | } | ||
1296 | |||
1297 | static const struct mmc_host_ops mmc_spi_ops = { | 1276 | static const struct mmc_host_ops mmc_spi_ops = { |
1298 | .request = mmc_spi_request, | 1277 | .request = mmc_spi_request, |
1299 | .set_ios = mmc_spi_set_ios, | 1278 | .set_ios = mmc_spi_set_ios, |
1300 | .get_ro = mmc_spi_get_ro, | 1279 | .get_ro = mmc_gpio_get_ro, |
1301 | .get_cd = mmc_spi_get_cd, | 1280 | .get_cd = mmc_gpio_get_cd, |
1302 | }; | 1281 | }; |
1303 | 1282 | ||
1304 | 1283 | ||
@@ -1324,6 +1303,7 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
1324 | struct mmc_host *mmc; | 1303 | struct mmc_host *mmc; |
1325 | struct mmc_spi_host *host; | 1304 | struct mmc_spi_host *host; |
1326 | int status; | 1305 | int status; |
1306 | bool has_ro = false; | ||
1327 | 1307 | ||
1328 | /* We rely on full duplex transfers, mostly to reduce | 1308 | /* We rely on full duplex transfers, mostly to reduce |
1329 | * per-transfer overheads (by making fewer transfers). | 1309 | * per-transfer overheads (by making fewer transfers). |
@@ -1448,18 +1428,33 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
1448 | } | 1428 | } |
1449 | 1429 | ||
1450 | /* pass platform capabilities, if any */ | 1430 | /* pass platform capabilities, if any */ |
1451 | if (host->pdata) | 1431 | if (host->pdata) { |
1452 | mmc->caps |= host->pdata->caps; | 1432 | mmc->caps |= host->pdata->caps; |
1433 | mmc->caps2 |= host->pdata->caps2; | ||
1434 | } | ||
1453 | 1435 | ||
1454 | status = mmc_add_host(mmc); | 1436 | status = mmc_add_host(mmc); |
1455 | if (status != 0) | 1437 | if (status != 0) |
1456 | goto fail_add_host; | 1438 | goto fail_add_host; |
1457 | 1439 | ||
1440 | if (host->pdata && host->pdata->flags & MMC_SPI_USE_CD_GPIO) { | ||
1441 | status = mmc_gpio_request_cd(mmc, host->pdata->cd_gpio, | ||
1442 | host->pdata->cd_debounce); | ||
1443 | if (status != 0) | ||
1444 | goto fail_add_host; | ||
1445 | } | ||
1446 | |||
1447 | if (host->pdata && host->pdata->flags & MMC_SPI_USE_RO_GPIO) { | ||
1448 | has_ro = true; | ||
1449 | status = mmc_gpio_request_ro(mmc, host->pdata->ro_gpio); | ||
1450 | if (status != 0) | ||
1451 | goto fail_add_host; | ||
1452 | } | ||
1453 | |||
1458 | dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", | 1454 | dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", |
1459 | dev_name(&mmc->class_dev), | 1455 | dev_name(&mmc->class_dev), |
1460 | host->dma_dev ? "" : ", no DMA", | 1456 | host->dma_dev ? "" : ", no DMA", |
1461 | (host->pdata && host->pdata->get_ro) | 1457 | has_ro ? "" : ", no WP", |
1462 | ? "" : ", no WP", | ||
1463 | (host->pdata && host->pdata->setpower) | 1458 | (host->pdata && host->pdata->setpower) |
1464 | ? "" : ", no poweroff", | 1459 | ? "" : ", no poweroff", |
1465 | (mmc->caps & MMC_CAP_NEEDS_POLL) | 1460 | (mmc->caps & MMC_CAP_NEEDS_POLL) |
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 4ddd83f98658..06c5b0b28ebc 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c | |||
@@ -757,7 +757,8 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
757 | if (mvsd_data->gpio_card_detect && | 757 | if (mvsd_data->gpio_card_detect && |
758 | gpio_is_valid(mvsd_data->gpio_card_detect)) { | 758 | gpio_is_valid(mvsd_data->gpio_card_detect)) { |
759 | ret = mmc_gpio_request_cd(mmc, | 759 | ret = mmc_gpio_request_cd(mmc, |
760 | mvsd_data->gpio_card_detect); | 760 | mvsd_data->gpio_card_detect, |
761 | 0); | ||
761 | if (ret) | 762 | if (ret) |
762 | goto out; | 763 | goto out; |
763 | } else { | 764 | } else { |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index f38d75f46f78..e1fa3ef735e0 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -102,12 +102,15 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc) | |||
102 | BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted; | 102 | BM_SSP_STATUS_CARD_DETECT) ^ host->cd_inverted; |
103 | } | 103 | } |
104 | 104 | ||
105 | static void mxs_mmc_reset(struct mxs_mmc_host *host) | 105 | static int mxs_mmc_reset(struct mxs_mmc_host *host) |
106 | { | 106 | { |
107 | struct mxs_ssp *ssp = &host->ssp; | 107 | struct mxs_ssp *ssp = &host->ssp; |
108 | u32 ctrl0, ctrl1; | 108 | u32 ctrl0, ctrl1; |
109 | int ret; | ||
109 | 110 | ||
110 | stmp_reset_block(ssp->base); | 111 | ret = stmp_reset_block(ssp->base); |
112 | if (ret) | ||
113 | return ret; | ||
111 | 114 | ||
112 | ctrl0 = BM_SSP_CTRL0_IGNORE_CRC; | 115 | ctrl0 = BM_SSP_CTRL0_IGNORE_CRC; |
113 | ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) | | 116 | ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) | |
@@ -132,6 +135,7 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host) | |||
132 | 135 | ||
133 | writel(ctrl0, ssp->base + HW_SSP_CTRL0); | 136 | writel(ctrl0, ssp->base + HW_SSP_CTRL0); |
134 | writel(ctrl1, ssp->base + HW_SSP_CTRL1(ssp)); | 137 | writel(ctrl1, ssp->base + HW_SSP_CTRL1(ssp)); |
138 | return 0; | ||
135 | } | 139 | } |
136 | 140 | ||
137 | static void mxs_mmc_start_cmd(struct mxs_mmc_host *host, | 141 | static void mxs_mmc_start_cmd(struct mxs_mmc_host *host, |
@@ -618,21 +622,25 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
618 | } | 622 | } |
619 | } | 623 | } |
620 | 624 | ||
621 | ssp->clk = clk_get(&pdev->dev, NULL); | 625 | ssp->clk = devm_clk_get(&pdev->dev, NULL); |
622 | if (IS_ERR(ssp->clk)) { | 626 | if (IS_ERR(ssp->clk)) { |
623 | ret = PTR_ERR(ssp->clk); | 627 | ret = PTR_ERR(ssp->clk); |
624 | goto out_mmc_free; | 628 | goto out_mmc_free; |
625 | } | 629 | } |
626 | clk_prepare_enable(ssp->clk); | 630 | clk_prepare_enable(ssp->clk); |
627 | 631 | ||
628 | mxs_mmc_reset(host); | 632 | ret = mxs_mmc_reset(host); |
633 | if (ret) { | ||
634 | dev_err(&pdev->dev, "Failed to reset mmc: %d\n", ret); | ||
635 | goto out_clk_disable; | ||
636 | } | ||
629 | 637 | ||
630 | ssp->dmach = dma_request_slave_channel(&pdev->dev, "rx-tx"); | 638 | ssp->dmach = dma_request_slave_channel(&pdev->dev, "rx-tx"); |
631 | if (!ssp->dmach) { | 639 | if (!ssp->dmach) { |
632 | dev_err(mmc_dev(host->mmc), | 640 | dev_err(mmc_dev(host->mmc), |
633 | "%s: failed to request dma\n", __func__); | 641 | "%s: failed to request dma\n", __func__); |
634 | ret = -ENODEV; | 642 | ret = -ENODEV; |
635 | goto out_clk_put; | 643 | goto out_clk_disable; |
636 | } | 644 | } |
637 | 645 | ||
638 | /* set mmc core parameters */ | 646 | /* set mmc core parameters */ |
@@ -685,9 +693,8 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
685 | out_free_dma: | 693 | out_free_dma: |
686 | if (ssp->dmach) | 694 | if (ssp->dmach) |
687 | dma_release_channel(ssp->dmach); | 695 | dma_release_channel(ssp->dmach); |
688 | out_clk_put: | 696 | out_clk_disable: |
689 | clk_disable_unprepare(ssp->clk); | 697 | clk_disable_unprepare(ssp->clk); |
690 | clk_put(ssp->clk); | ||
691 | out_mmc_free: | 698 | out_mmc_free: |
692 | mmc_free_host(mmc); | 699 | mmc_free_host(mmc); |
693 | return ret; | 700 | return ret; |
@@ -705,7 +712,6 @@ static int mxs_mmc_remove(struct platform_device *pdev) | |||
705 | dma_release_channel(ssp->dmach); | 712 | dma_release_channel(ssp->dmach); |
706 | 713 | ||
707 | clk_disable_unprepare(ssp->clk); | 714 | clk_disable_unprepare(ssp->clk); |
708 | clk_put(ssp->clk); | ||
709 | 715 | ||
710 | mmc_free_host(mmc); | 716 | mmc_free_host(mmc); |
711 | 717 | ||
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index d720b5e05b9c..6e218fb1a669 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c | |||
@@ -50,25 +50,6 @@ static struct of_mmc_spi *to_of_mmc_spi(struct device *dev) | |||
50 | return container_of(dev->platform_data, struct of_mmc_spi, pdata); | 50 | return container_of(dev->platform_data, struct of_mmc_spi, pdata); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int of_mmc_spi_read_gpio(struct device *dev, int gpio_num) | ||
54 | { | ||
55 | struct of_mmc_spi *oms = to_of_mmc_spi(dev); | ||
56 | bool active_low = oms->alow_gpios[gpio_num]; | ||
57 | bool value = gpio_get_value(oms->gpios[gpio_num]); | ||
58 | |||
59 | return active_low ^ value; | ||
60 | } | ||
61 | |||
62 | static int of_mmc_spi_get_cd(struct device *dev) | ||
63 | { | ||
64 | return of_mmc_spi_read_gpio(dev, CD_GPIO); | ||
65 | } | ||
66 | |||
67 | static int of_mmc_spi_get_ro(struct device *dev) | ||
68 | { | ||
69 | return of_mmc_spi_read_gpio(dev, WP_GPIO); | ||
70 | } | ||
71 | |||
72 | static int of_mmc_spi_init(struct device *dev, | 53 | static int of_mmc_spi_init(struct device *dev, |
73 | irqreturn_t (*irqhandler)(int, void *), void *mmc) | 54 | irqreturn_t (*irqhandler)(int, void *), void *mmc) |
74 | { | 55 | { |
@@ -130,20 +111,22 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) | |||
130 | if (!gpio_is_valid(oms->gpios[i])) | 111 | if (!gpio_is_valid(oms->gpios[i])) |
131 | continue; | 112 | continue; |
132 | 113 | ||
133 | ret = gpio_request(oms->gpios[i], dev_name(dev)); | ||
134 | if (ret < 0) { | ||
135 | oms->gpios[i] = -EINVAL; | ||
136 | continue; | ||
137 | } | ||
138 | |||
139 | if (gpio_flags & OF_GPIO_ACTIVE_LOW) | 114 | if (gpio_flags & OF_GPIO_ACTIVE_LOW) |
140 | oms->alow_gpios[i] = true; | 115 | oms->alow_gpios[i] = true; |
141 | } | 116 | } |
142 | 117 | ||
143 | if (gpio_is_valid(oms->gpios[CD_GPIO])) | 118 | if (gpio_is_valid(oms->gpios[CD_GPIO])) { |
144 | oms->pdata.get_cd = of_mmc_spi_get_cd; | 119 | oms->pdata.cd_gpio = oms->gpios[CD_GPIO]; |
145 | if (gpio_is_valid(oms->gpios[WP_GPIO])) | 120 | oms->pdata.flags |= MMC_SPI_USE_CD_GPIO; |
146 | oms->pdata.get_ro = of_mmc_spi_get_ro; | 121 | if (!oms->alow_gpios[CD_GPIO]) |
122 | oms->pdata.caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; | ||
123 | } | ||
124 | if (gpio_is_valid(oms->gpios[WP_GPIO])) { | ||
125 | oms->pdata.ro_gpio = oms->gpios[WP_GPIO]; | ||
126 | oms->pdata.flags |= MMC_SPI_USE_RO_GPIO; | ||
127 | if (!oms->alow_gpios[WP_GPIO]) | ||
128 | oms->pdata.caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | ||
129 | } | ||
147 | 130 | ||
148 | oms->detect_irq = irq_of_parse_and_map(np, 0); | 131 | oms->detect_irq = irq_of_parse_and_map(np, 0); |
149 | if (oms->detect_irq != 0) { | 132 | if (oms->detect_irq != 0) { |
@@ -166,15 +149,10 @@ void mmc_spi_put_pdata(struct spi_device *spi) | |||
166 | struct device *dev = &spi->dev; | 149 | struct device *dev = &spi->dev; |
167 | struct device_node *np = dev->of_node; | 150 | struct device_node *np = dev->of_node; |
168 | struct of_mmc_spi *oms = to_of_mmc_spi(dev); | 151 | struct of_mmc_spi *oms = to_of_mmc_spi(dev); |
169 | int i; | ||
170 | 152 | ||
171 | if (!dev->platform_data || !np) | 153 | if (!dev->platform_data || !np) |
172 | return; | 154 | return; |
173 | 155 | ||
174 | for (i = 0; i < ARRAY_SIZE(oms->gpios); i++) { | ||
175 | if (gpio_is_valid(oms->gpios[i])) | ||
176 | gpio_free(oms->gpios[i]); | ||
177 | } | ||
178 | kfree(oms); | 156 | kfree(oms); |
179 | dev->platform_data = NULL; | 157 | dev->platform_data = NULL; |
180 | } | 158 | } |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 1865321465c4..6ac63df645c4 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/debugfs.h> | 21 | #include <linux/debugfs.h> |
22 | #include <linux/dmaengine.h> | 22 | #include <linux/dmaengine.h> |
23 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
24 | #include <linux/sizes.h> | ||
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
@@ -1041,6 +1042,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status) | |||
1041 | } | 1042 | } |
1042 | } | 1043 | } |
1043 | 1044 | ||
1045 | OMAP_HSMMC_WRITE(host->base, STAT, status); | ||
1044 | if (end_cmd || ((status & CC_EN) && host->cmd)) | 1046 | if (end_cmd || ((status & CC_EN) && host->cmd)) |
1045 | omap_hsmmc_cmd_done(host, host->cmd); | 1047 | omap_hsmmc_cmd_done(host, host->cmd); |
1046 | if ((end_trans || (status & TC_EN)) && host->mrq) | 1048 | if ((end_trans || (status & TC_EN)) && host->mrq) |
@@ -1060,7 +1062,6 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id) | |||
1060 | omap_hsmmc_do_irq(host, status); | 1062 | omap_hsmmc_do_irq(host, status); |
1061 | 1063 | ||
1062 | /* Flush posted write */ | 1064 | /* Flush posted write */ |
1063 | OMAP_HSMMC_WRITE(host->base, STAT, status); | ||
1064 | status = OMAP_HSMMC_READ(host->base, STAT); | 1065 | status = OMAP_HSMMC_READ(host->base, STAT); |
1065 | } | 1066 | } |
1066 | 1067 | ||
diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c index 0584a1c788b8..36fa2df04660 100644 --- a/drivers/mmc/host/sdhci-bcm2835.c +++ b/drivers/mmc/host/sdhci-bcm2835.c | |||
@@ -119,7 +119,7 @@ static u8 bcm2835_sdhci_readb(struct sdhci_host *host, int reg) | |||
119 | return byte; | 119 | return byte; |
120 | } | 120 | } |
121 | 121 | ||
122 | unsigned int bcm2835_sdhci_get_min_clock(struct sdhci_host *host) | 122 | static unsigned int bcm2835_sdhci_get_min_clock(struct sdhci_host *host) |
123 | { | 123 | { |
124 | return MIN_FREQ; | 124 | return MIN_FREQ; |
125 | } | 125 | } |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 1dd5ba858754..abc8cf01e6e3 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -616,7 +616,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
616 | /* card_detect */ | 616 | /* card_detect */ |
617 | switch (boarddata->cd_type) { | 617 | switch (boarddata->cd_type) { |
618 | case ESDHC_CD_GPIO: | 618 | case ESDHC_CD_GPIO: |
619 | err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio); | 619 | err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0); |
620 | if (err) { | 620 | if (err) { |
621 | dev_err(mmc_dev(host->mmc), | 621 | dev_err(mmc_dev(host->mmc), |
622 | "failed to request card-detect gpio!\n"); | 622 | "failed to request card-detect gpio!\n"); |
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 15039e2d1c12..e328252ebf2a 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c | |||
@@ -316,6 +316,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) | |||
316 | 316 | ||
317 | /* call to generic mmc_of_parse to support additional capabilities */ | 317 | /* call to generic mmc_of_parse to support additional capabilities */ |
318 | mmc_of_parse(host->mmc); | 318 | mmc_of_parse(host->mmc); |
319 | mmc_of_parse_voltage(np, &host->ocr_mask); | ||
319 | 320 | ||
320 | ret = sdhci_add_host(host); | 321 | ret = sdhci_add_host(host); |
321 | if (ret) | 322 | if (ret) |
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index bf99359a3a90..793dacd3b841 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
@@ -278,7 +278,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
278 | host->mmc->pm_caps |= pdata->pm_caps; | 278 | host->mmc->pm_caps |= pdata->pm_caps; |
279 | 279 | ||
280 | if (gpio_is_valid(pdata->ext_cd_gpio)) { | 280 | if (gpio_is_valid(pdata->ext_cd_gpio)) { |
281 | ret = mmc_gpio_request_cd(host->mmc, pdata->ext_cd_gpio); | 281 | ret = mmc_gpio_request_cd(host->mmc, pdata->ext_cd_gpio, |
282 | 0); | ||
282 | if (ret) { | 283 | if (ret) { |
283 | dev_err(mmc_dev(host->mmc), | 284 | dev_err(mmc_dev(host->mmc), |
284 | "failed to allocate card detect gpio\n"); | 285 | "failed to allocate card detect gpio\n"); |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 926aaf6acc67..6debda952155 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -296,9 +296,12 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) | |||
296 | unsigned long timeout; | 296 | unsigned long timeout; |
297 | u16 clk = 0; | 297 | u16 clk = 0; |
298 | 298 | ||
299 | /* don't bother if the clock is going off */ | 299 | /* If the clock is going off, set to 0 at clock control register */ |
300 | if (clock == 0) | 300 | if (clock == 0) { |
301 | sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL); | ||
302 | host->clock = clock; | ||
301 | return; | 303 | return; |
304 | } | ||
302 | 305 | ||
303 | sdhci_s3c_set_clock(host, clock); | 306 | sdhci_s3c_set_clock(host, clock); |
304 | 307 | ||
@@ -608,6 +611,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev) | |||
608 | host->hw_name = "samsung-hsmmc"; | 611 | host->hw_name = "samsung-hsmmc"; |
609 | host->ops = &sdhci_s3c_ops; | 612 | host->ops = &sdhci_s3c_ops; |
610 | host->quirks = 0; | 613 | host->quirks = 0; |
614 | host->quirks2 = 0; | ||
611 | host->irq = irq; | 615 | host->irq = irq; |
612 | 616 | ||
613 | /* Setup quirks for the controller */ | 617 | /* Setup quirks for the controller */ |
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c index 62a4a835acc6..696122c1b468 100644 --- a/drivers/mmc/host/sdhci-sirf.c +++ b/drivers/mmc/host/sdhci-sirf.c | |||
@@ -84,7 +84,7 @@ static int sdhci_sirf_probe(struct platform_device *pdev) | |||
84 | * gets setup in sdhci_add_host() and we oops. | 84 | * gets setup in sdhci_add_host() and we oops. |
85 | */ | 85 | */ |
86 | if (gpio_is_valid(priv->gpio_cd)) { | 86 | if (gpio_is_valid(priv->gpio_cd)) { |
87 | ret = mmc_gpio_request_cd(host->mmc, priv->gpio_cd); | 87 | ret = mmc_gpio_request_cd(host->mmc, priv->gpio_cd, 0); |
88 | if (ret) { | 88 | if (ret) { |
89 | dev_err(&pdev->dev, "card detect irq request failed: %d\n", | 89 | dev_err(&pdev->dev, "card detect irq request failed: %d\n", |
90 | ret); | 90 | ret); |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index dd2c083c434d..7a7fb4f0d5a4 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -3119,6 +3119,9 @@ int sdhci_add_host(struct sdhci_host *host) | |||
3119 | SDHCI_MAX_CURRENT_MULTIPLIER; | 3119 | SDHCI_MAX_CURRENT_MULTIPLIER; |
3120 | } | 3120 | } |
3121 | 3121 | ||
3122 | if (host->ocr_mask) | ||
3123 | ocr_avail = host->ocr_mask; | ||
3124 | |||
3122 | mmc->ocr_avail = ocr_avail; | 3125 | mmc->ocr_avail = ocr_avail; |
3123 | mmc->ocr_avail_sdio = ocr_avail; | 3126 | mmc->ocr_avail_sdio = ocr_avail; |
3124 | if (host->ocr_avail_sdio) | 3127 | if (host->ocr_avail_sdio) |
@@ -3213,6 +3216,8 @@ int sdhci_add_host(struct sdhci_host *host) | |||
3213 | host->tuning_timer.function = sdhci_tuning_timer; | 3216 | host->tuning_timer.function = sdhci_tuning_timer; |
3214 | } | 3217 | } |
3215 | 3218 | ||
3219 | sdhci_init(host, 0); | ||
3220 | |||
3216 | ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, | 3221 | ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, |
3217 | mmc_hostname(mmc), host); | 3222 | mmc_hostname(mmc), host); |
3218 | if (ret) { | 3223 | if (ret) { |
@@ -3221,8 +3226,6 @@ int sdhci_add_host(struct sdhci_host *host) | |||
3221 | goto untasklet; | 3226 | goto untasklet; |
3222 | } | 3227 | } |
3223 | 3228 | ||
3224 | sdhci_init(host, 0); | ||
3225 | |||
3226 | #ifdef CONFIG_MMC_DEBUG | 3229 | #ifdef CONFIG_MMC_DEBUG |
3227 | sdhci_dumpregs(host); | 3230 | sdhci_dumpregs(host); |
3228 | #endif | 3231 | #endif |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 6706b5e3b974..36629a024aa1 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/platform_device.h> | 61 | #include <linux/platform_device.h> |
62 | #include <linux/pm_qos.h> | 62 | #include <linux/pm_qos.h> |
63 | #include <linux/pm_runtime.h> | 63 | #include <linux/pm_runtime.h> |
64 | #include <linux/sh_dma.h> | ||
64 | #include <linux/spinlock.h> | 65 | #include <linux/spinlock.h> |
65 | #include <linux/module.h> | 66 | #include <linux/module.h> |
66 | 67 | ||
@@ -133,6 +134,8 @@ | |||
133 | INT_BUFWEN | INT_CMD12DRE | INT_BUFRE | \ | 134 | INT_BUFWEN | INT_CMD12DRE | INT_BUFRE | \ |
134 | INT_DTRANE | INT_CMD12RBE | INT_CMD12CRE) | 135 | INT_DTRANE | INT_CMD12RBE | INT_CMD12CRE) |
135 | 136 | ||
137 | #define INT_CCS (INT_CCSTO | INT_CCSRCV | INT_CCSDE) | ||
138 | |||
136 | /* CE_INT_MASK */ | 139 | /* CE_INT_MASK */ |
137 | #define MASK_ALL 0x00000000 | 140 | #define MASK_ALL 0x00000000 |
138 | #define MASK_MCCSDE (1 << 29) | 141 | #define MASK_MCCSDE (1 << 29) |
@@ -161,7 +164,7 @@ | |||
161 | 164 | ||
162 | #define MASK_START_CMD (MASK_MCMDVIO | MASK_MBUFVIO | MASK_MWDATERR | \ | 165 | #define MASK_START_CMD (MASK_MCMDVIO | MASK_MBUFVIO | MASK_MWDATERR | \ |
163 | MASK_MRDATERR | MASK_MRIDXERR | MASK_MRSPERR | \ | 166 | MASK_MRDATERR | MASK_MRIDXERR | MASK_MRSPERR | \ |
164 | MASK_MCCSTO | MASK_MCRCSTO | MASK_MWDATTO | \ | 167 | MASK_MCRCSTO | MASK_MWDATTO | \ |
165 | MASK_MRDATTO | MASK_MRBSYTO | MASK_MRSPTO) | 168 | MASK_MRDATTO | MASK_MRBSYTO | MASK_MRSPTO) |
166 | 169 | ||
167 | #define MASK_CLEAN (INT_ERR_STS | MASK_MRBSYE | MASK_MCRSPE | \ | 170 | #define MASK_CLEAN (INT_ERR_STS | MASK_MRBSYE | MASK_MCRSPE | \ |
@@ -243,6 +246,8 @@ struct sh_mmcif_host { | |||
243 | int sg_blkidx; | 246 | int sg_blkidx; |
244 | bool power; | 247 | bool power; |
245 | bool card_present; | 248 | bool card_present; |
249 | bool ccs_enable; /* Command Completion Signal support */ | ||
250 | bool clk_ctrl2_enable; | ||
246 | struct mutex thread_lock; | 251 | struct mutex thread_lock; |
247 | 252 | ||
248 | /* DMA support */ | 253 | /* DMA support */ |
@@ -386,25 +391,29 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, | |||
386 | 391 | ||
387 | host->dma_active = false; | 392 | host->dma_active = false; |
388 | 393 | ||
389 | if (!pdata) | 394 | if (pdata) { |
390 | return; | 395 | if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0) |
391 | 396 | return; | |
392 | if (pdata->slave_id_tx <= 0 || pdata->slave_id_rx <= 0) | 397 | } else if (!host->pd->dev.of_node) { |
393 | return; | 398 | return; |
399 | } | ||
394 | 400 | ||
395 | /* We can only either use DMA for both Tx and Rx or not use it at all */ | 401 | /* We can only either use DMA for both Tx and Rx or not use it at all */ |
396 | dma_cap_zero(mask); | 402 | dma_cap_zero(mask); |
397 | dma_cap_set(DMA_SLAVE, mask); | 403 | dma_cap_set(DMA_SLAVE, mask); |
398 | 404 | ||
399 | host->chan_tx = dma_request_channel(mask, shdma_chan_filter, | 405 | host->chan_tx = dma_request_slave_channel_compat(mask, shdma_chan_filter, |
400 | (void *)pdata->slave_id_tx); | 406 | pdata ? (void *)pdata->slave_id_tx : NULL, |
407 | &host->pd->dev, "tx"); | ||
401 | dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__, | 408 | dev_dbg(&host->pd->dev, "%s: TX: got channel %p\n", __func__, |
402 | host->chan_tx); | 409 | host->chan_tx); |
403 | 410 | ||
404 | if (!host->chan_tx) | 411 | if (!host->chan_tx) |
405 | return; | 412 | return; |
406 | 413 | ||
407 | cfg.slave_id = pdata->slave_id_tx; | 414 | /* In the OF case the driver will get the slave ID from the DT */ |
415 | if (pdata) | ||
416 | cfg.slave_id = pdata->slave_id_tx; | ||
408 | cfg.direction = DMA_MEM_TO_DEV; | 417 | cfg.direction = DMA_MEM_TO_DEV; |
409 | cfg.dst_addr = res->start + MMCIF_CE_DATA; | 418 | cfg.dst_addr = res->start + MMCIF_CE_DATA; |
410 | cfg.src_addr = 0; | 419 | cfg.src_addr = 0; |
@@ -412,15 +421,17 @@ static void sh_mmcif_request_dma(struct sh_mmcif_host *host, | |||
412 | if (ret < 0) | 421 | if (ret < 0) |
413 | goto ecfgtx; | 422 | goto ecfgtx; |
414 | 423 | ||
415 | host->chan_rx = dma_request_channel(mask, shdma_chan_filter, | 424 | host->chan_rx = dma_request_slave_channel_compat(mask, shdma_chan_filter, |
416 | (void *)pdata->slave_id_rx); | 425 | pdata ? (void *)pdata->slave_id_rx : NULL, |
426 | &host->pd->dev, "rx"); | ||
417 | dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__, | 427 | dev_dbg(&host->pd->dev, "%s: RX: got channel %p\n", __func__, |
418 | host->chan_rx); | 428 | host->chan_rx); |
419 | 429 | ||
420 | if (!host->chan_rx) | 430 | if (!host->chan_rx) |
421 | goto erqrx; | 431 | goto erqrx; |
422 | 432 | ||
423 | cfg.slave_id = pdata->slave_id_rx; | 433 | if (pdata) |
434 | cfg.slave_id = pdata->slave_id_rx; | ||
424 | cfg.direction = DMA_DEV_TO_MEM; | 435 | cfg.direction = DMA_DEV_TO_MEM; |
425 | cfg.dst_addr = 0; | 436 | cfg.dst_addr = 0; |
426 | cfg.src_addr = res->start + MMCIF_CE_DATA; | 437 | cfg.src_addr = res->start + MMCIF_CE_DATA; |
@@ -485,8 +496,12 @@ static void sh_mmcif_sync_reset(struct sh_mmcif_host *host) | |||
485 | 496 | ||
486 | sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_ON); | 497 | sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_ON); |
487 | sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF); | 498 | sh_mmcif_writel(host->addr, MMCIF_CE_VERSION, SOFT_RST_OFF); |
499 | if (host->ccs_enable) | ||
500 | tmp |= SCCSTO_29; | ||
501 | if (host->clk_ctrl2_enable) | ||
502 | sh_mmcif_writel(host->addr, MMCIF_CE_CLK_CTRL2, 0x0F0F0000); | ||
488 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp | | 503 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, tmp | |
489 | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29 | SCCSTO_29); | 504 | SRSPTO_256 | SRBSYTO_29 | SRWDTO_29); |
490 | /* byte swap on */ | 505 | /* byte swap on */ |
491 | sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP); | 506 | sh_mmcif_bitset(host, MMCIF_CE_BUF_ACC, BUF_ACC_ATYP); |
492 | } | 507 | } |
@@ -866,6 +881,9 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host, | |||
866 | break; | 881 | break; |
867 | } | 882 | } |
868 | 883 | ||
884 | if (host->ccs_enable) | ||
885 | mask |= MASK_MCCSTO; | ||
886 | |||
869 | if (mrq->data) { | 887 | if (mrq->data) { |
870 | sh_mmcif_writel(host->addr, MMCIF_CE_BLOCK_SET, 0); | 888 | sh_mmcif_writel(host->addr, MMCIF_CE_BLOCK_SET, 0); |
871 | sh_mmcif_writel(host->addr, MMCIF_CE_BLOCK_SET, | 889 | sh_mmcif_writel(host->addr, MMCIF_CE_BLOCK_SET, |
@@ -873,7 +891,10 @@ static void sh_mmcif_start_cmd(struct sh_mmcif_host *host, | |||
873 | } | 891 | } |
874 | opc = sh_mmcif_set_cmd(host, mrq); | 892 | opc = sh_mmcif_set_cmd(host, mrq); |
875 | 893 | ||
876 | sh_mmcif_writel(host->addr, MMCIF_CE_INT, 0xD80430C0); | 894 | if (host->ccs_enable) |
895 | sh_mmcif_writel(host->addr, MMCIF_CE_INT, 0xD80430C0); | ||
896 | else | ||
897 | sh_mmcif_writel(host->addr, MMCIF_CE_INT, 0xD80430C0 | INT_CCS); | ||
877 | sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, mask); | 898 | sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, mask); |
878 | /* set arg */ | 899 | /* set arg */ |
879 | sh_mmcif_writel(host->addr, MMCIF_CE_ARG, cmd->arg); | 900 | sh_mmcif_writel(host->addr, MMCIF_CE_ARG, cmd->arg); |
@@ -956,11 +977,8 @@ static int sh_mmcif_clk_update(struct sh_mmcif_host *host) | |||
956 | 977 | ||
957 | static void sh_mmcif_set_power(struct sh_mmcif_host *host, struct mmc_ios *ios) | 978 | static void sh_mmcif_set_power(struct sh_mmcif_host *host, struct mmc_ios *ios) |
958 | { | 979 | { |
959 | struct sh_mmcif_plat_data *pd = host->pd->dev.platform_data; | ||
960 | struct mmc_host *mmc = host->mmc; | 980 | struct mmc_host *mmc = host->mmc; |
961 | 981 | ||
962 | if (pd && pd->set_pwr) | ||
963 | pd->set_pwr(host->pd, ios->power_mode != MMC_POWER_OFF); | ||
964 | if (!IS_ERR(mmc->supply.vmmc)) | 982 | if (!IS_ERR(mmc->supply.vmmc)) |
965 | /* Errors ignored... */ | 983 | /* Errors ignored... */ |
966 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, | 984 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, |
@@ -1241,11 +1259,14 @@ static irqreturn_t sh_mmcif_irqt(int irq, void *dev_id) | |||
1241 | static irqreturn_t sh_mmcif_intr(int irq, void *dev_id) | 1259 | static irqreturn_t sh_mmcif_intr(int irq, void *dev_id) |
1242 | { | 1260 | { |
1243 | struct sh_mmcif_host *host = dev_id; | 1261 | struct sh_mmcif_host *host = dev_id; |
1244 | u32 state; | 1262 | u32 state, mask; |
1245 | 1263 | ||
1246 | state = sh_mmcif_readl(host->addr, MMCIF_CE_INT); | 1264 | state = sh_mmcif_readl(host->addr, MMCIF_CE_INT); |
1247 | sh_mmcif_writel(host->addr, MMCIF_CE_INT, | 1265 | mask = sh_mmcif_readl(host->addr, MMCIF_CE_INT_MASK); |
1248 | ~(state & sh_mmcif_readl(host->addr, MMCIF_CE_INT_MASK))); | 1266 | if (host->ccs_enable) |
1267 | sh_mmcif_writel(host->addr, MMCIF_CE_INT, ~(state & mask)); | ||
1268 | else | ||
1269 | sh_mmcif_writel(host->addr, MMCIF_CE_INT, INT_CCS | ~(state & mask)); | ||
1249 | sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state & MASK_CLEAN); | 1270 | sh_mmcif_bitclr(host, MMCIF_CE_INT_MASK, state & MASK_CLEAN); |
1250 | 1271 | ||
1251 | if (state & ~MASK_CLEAN) | 1272 | if (state & ~MASK_CLEAN) |
@@ -1379,6 +1400,8 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
1379 | host->mmc = mmc; | 1400 | host->mmc = mmc; |
1380 | host->addr = reg; | 1401 | host->addr = reg; |
1381 | host->timeout = msecs_to_jiffies(1000); | 1402 | host->timeout = msecs_to_jiffies(1000); |
1403 | host->ccs_enable = !pd || !pd->ccs_unsupported; | ||
1404 | host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present; | ||
1382 | 1405 | ||
1383 | host->pd = pdev; | 1406 | host->pd = pdev; |
1384 | 1407 | ||
@@ -1436,7 +1459,7 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
1436 | } | 1459 | } |
1437 | 1460 | ||
1438 | if (pd && pd->use_cd_gpio) { | 1461 | if (pd && pd->use_cd_gpio) { |
1439 | ret = mmc_gpio_request_cd(mmc, pd->cd_gpio); | 1462 | ret = mmc_gpio_request_cd(mmc, pd->cd_gpio, 0); |
1440 | if (ret < 0) | 1463 | if (ret < 0) |
1441 | goto erqcd; | 1464 | goto erqcd; |
1442 | } | 1465 | } |
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index ebea749297c2..87ed3fb5149a 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
@@ -70,20 +70,6 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev) | |||
70 | clk_disable(priv->clk); | 70 | clk_disable(priv->clk); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void sh_mobile_sdhi_set_pwr(struct platform_device *pdev, int state) | ||
74 | { | ||
75 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | ||
76 | |||
77 | p->set_pwr(pdev, state); | ||
78 | } | ||
79 | |||
80 | static int sh_mobile_sdhi_get_cd(struct platform_device *pdev) | ||
81 | { | ||
82 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | ||
83 | |||
84 | return p->get_cd(pdev); | ||
85 | } | ||
86 | |||
87 | static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host) | 73 | static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host) |
88 | { | 74 | { |
89 | int timeout = 1000; | 75 | int timeout = 1000; |
@@ -129,7 +115,12 @@ static const struct sh_mobile_sdhi_ops sdhi_ops = { | |||
129 | static const struct of_device_id sh_mobile_sdhi_of_match[] = { | 115 | static const struct of_device_id sh_mobile_sdhi_of_match[] = { |
130 | { .compatible = "renesas,shmobile-sdhi" }, | 116 | { .compatible = "renesas,shmobile-sdhi" }, |
131 | { .compatible = "renesas,sh7372-sdhi" }, | 117 | { .compatible = "renesas,sh7372-sdhi" }, |
118 | { .compatible = "renesas,sh73a0-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | ||
119 | { .compatible = "renesas,r8a73a4-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | ||
132 | { .compatible = "renesas,r8a7740-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 120 | { .compatible = "renesas,r8a7740-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, |
121 | { .compatible = "renesas,r8a7778-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | ||
122 | { .compatible = "renesas,r8a7779-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | ||
123 | { .compatible = "renesas,r8a7790-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | ||
133 | {}, | 124 | {}, |
134 | }; | 125 | }; |
135 | MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match); | 126 | MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match); |
@@ -180,10 +171,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
180 | mmc_data->capabilities |= p->tmio_caps; | 171 | mmc_data->capabilities |= p->tmio_caps; |
181 | mmc_data->capabilities2 |= p->tmio_caps2; | 172 | mmc_data->capabilities2 |= p->tmio_caps2; |
182 | mmc_data->cd_gpio = p->cd_gpio; | 173 | mmc_data->cd_gpio = p->cd_gpio; |
183 | if (p->set_pwr) | ||
184 | mmc_data->set_pwr = sh_mobile_sdhi_set_pwr; | ||
185 | if (p->get_cd) | ||
186 | mmc_data->get_cd = sh_mobile_sdhi_get_cd; | ||
187 | 174 | ||
188 | if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) { | 175 | if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) { |
189 | /* | 176 | /* |
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index 47bdb8fa341b..65edb4a62452 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c | |||
@@ -104,6 +104,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host) | |||
104 | pio: | 104 | pio: |
105 | if (!desc) { | 105 | if (!desc) { |
106 | /* DMA failed, fall back to PIO */ | 106 | /* DMA failed, fall back to PIO */ |
107 | tmio_mmc_enable_dma(host, false); | ||
107 | if (ret >= 0) | 108 | if (ret >= 0) |
108 | ret = -EIO; | 109 | ret = -EIO; |
109 | host->chan_rx = NULL; | 110 | host->chan_rx = NULL; |
@@ -116,7 +117,6 @@ pio: | |||
116 | } | 117 | } |
117 | dev_warn(&host->pdev->dev, | 118 | dev_warn(&host->pdev->dev, |
118 | "DMA failed: %d, falling back to PIO\n", ret); | 119 | "DMA failed: %d, falling back to PIO\n", ret); |
119 | tmio_mmc_enable_dma(host, false); | ||
120 | } | 120 | } |
121 | 121 | ||
122 | dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__, | 122 | dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__, |
@@ -185,6 +185,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host) | |||
185 | pio: | 185 | pio: |
186 | if (!desc) { | 186 | if (!desc) { |
187 | /* DMA failed, fall back to PIO */ | 187 | /* DMA failed, fall back to PIO */ |
188 | tmio_mmc_enable_dma(host, false); | ||
188 | if (ret >= 0) | 189 | if (ret >= 0) |
189 | ret = -EIO; | 190 | ret = -EIO; |
190 | host->chan_tx = NULL; | 191 | host->chan_tx = NULL; |
@@ -197,7 +198,6 @@ pio: | |||
197 | } | 198 | } |
198 | dev_warn(&host->pdev->dev, | 199 | dev_warn(&host->pdev->dev, |
199 | "DMA failed: %d, falling back to PIO\n", ret); | 200 | "DMA failed: %d, falling back to PIO\n", ret); |
200 | tmio_mmc_enable_dma(host, false); | ||
201 | } | 201 | } |
202 | 202 | ||
203 | dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__, | 203 | dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__, |
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index b72edb72f7d2..b3802256f954 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c | |||
@@ -795,9 +795,13 @@ static void tmio_mmc_power_on(struct tmio_mmc_host *host, unsigned short vdd) | |||
795 | * omap_hsmmc.c driver does. | 795 | * omap_hsmmc.c driver does. |
796 | */ | 796 | */ |
797 | if (!IS_ERR(mmc->supply.vqmmc) && !ret) { | 797 | if (!IS_ERR(mmc->supply.vqmmc) && !ret) { |
798 | regulator_enable(mmc->supply.vqmmc); | 798 | ret = regulator_enable(mmc->supply.vqmmc); |
799 | udelay(200); | 799 | udelay(200); |
800 | } | 800 | } |
801 | |||
802 | if (ret < 0) | ||
803 | dev_dbg(&host->pdev->dev, "Regulators failed to power up: %d\n", | ||
804 | ret); | ||
801 | } | 805 | } |
802 | 806 | ||
803 | static void tmio_mmc_power_off(struct tmio_mmc_host *host) | 807 | static void tmio_mmc_power_off(struct tmio_mmc_host *host) |
@@ -932,25 +936,11 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) | |||
932 | (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); | 936 | (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); |
933 | } | 937 | } |
934 | 938 | ||
935 | static int tmio_mmc_get_cd(struct mmc_host *mmc) | ||
936 | { | ||
937 | struct tmio_mmc_host *host = mmc_priv(mmc); | ||
938 | struct tmio_mmc_data *pdata = host->pdata; | ||
939 | int ret = mmc_gpio_get_cd(mmc); | ||
940 | if (ret >= 0) | ||
941 | return ret; | ||
942 | |||
943 | if (!pdata->get_cd) | ||
944 | return -ENOSYS; | ||
945 | else | ||
946 | return pdata->get_cd(host->pdev); | ||
947 | } | ||
948 | |||
949 | static const struct mmc_host_ops tmio_mmc_ops = { | 939 | static const struct mmc_host_ops tmio_mmc_ops = { |
950 | .request = tmio_mmc_request, | 940 | .request = tmio_mmc_request, |
951 | .set_ios = tmio_mmc_set_ios, | 941 | .set_ios = tmio_mmc_set_ios, |
952 | .get_ro = tmio_mmc_get_ro, | 942 | .get_ro = tmio_mmc_get_ro, |
953 | .get_cd = tmio_mmc_get_cd, | 943 | .get_cd = mmc_gpio_get_cd, |
954 | .enable_sdio_irq = tmio_mmc_enable_sdio_irq, | 944 | .enable_sdio_irq = tmio_mmc_enable_sdio_irq, |
955 | }; | 945 | }; |
956 | 946 | ||
@@ -1106,7 +1096,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host, | |||
1106 | dev_pm_qos_expose_latency_limit(&pdev->dev, 100); | 1096 | dev_pm_qos_expose_latency_limit(&pdev->dev, 100); |
1107 | 1097 | ||
1108 | if (pdata->flags & TMIO_MMC_USE_GPIO_CD) { | 1098 | if (pdata->flags & TMIO_MMC_USE_GPIO_CD) { |
1109 | ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio); | 1099 | ret = mmc_gpio_request_cd(mmc, pdata->cd_gpio, 0); |
1110 | if (ret < 0) { | 1100 | if (ret < 0) { |
1111 | tmio_mmc_host_remove(_host); | 1101 | tmio_mmc_host_remove(_host); |
1112 | return ret; | 1102 | return ret; |
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c index cb9f361c03ab..e9028ad05ffb 100644 --- a/drivers/mmc/host/vub300.c +++ b/drivers/mmc/host/vub300.c | |||
@@ -2079,7 +2079,7 @@ static void vub300_enable_sdio_irq(struct mmc_host *mmc, int enable) | |||
2079 | kref_put(&vub300->kref, vub300_delete); | 2079 | kref_put(&vub300->kref, vub300_delete); |
2080 | } | 2080 | } |
2081 | 2081 | ||
2082 | void vub300_init_card(struct mmc_host *mmc, struct mmc_card *card) | 2082 | static void vub300_init_card(struct mmc_host *mmc, struct mmc_card *card) |
2083 | { /* NOT irq */ | 2083 | { /* NOT irq */ |
2084 | struct vub300_mmc_host *vub300 = mmc_priv(mmc); | 2084 | struct vub300_mmc_host *vub300 = mmc_priv(mmc); |
2085 | dev_info(&vub300->udev->dev, "NO host QUIRKS for this card\n"); | 2085 | dev_info(&vub300->udev->dev, "NO host QUIRKS for this card\n"); |
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index ce3511326f80..b22883d60500 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
@@ -108,7 +108,6 @@ struct tmio_mmc_data { | |||
108 | unsigned int cd_gpio; | 108 | unsigned int cd_gpio; |
109 | void (*set_pwr)(struct platform_device *host, int state); | 109 | void (*set_pwr)(struct platform_device *host, int state); |
110 | void (*set_clk_div)(struct platform_device *host, int state); | 110 | void (*set_clk_div)(struct platform_device *host, int state); |
111 | int (*get_cd)(struct platform_device *host); | ||
112 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); | 111 | int (*write16_hook)(struct tmio_mmc_host *host, int addr); |
113 | /* clock management callbacks */ | 112 | /* clock management callbacks */ |
114 | int (*clk_enable)(struct platform_device *pdev, unsigned int *f); | 113 | int (*clk_enable)(struct platform_device *pdev, unsigned int *f); |
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 443243b241d5..da51bec578c3 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
@@ -208,6 +208,8 @@ static inline void mmc_claim_host(struct mmc_host *host) | |||
208 | __mmc_claim_host(host, NULL); | 208 | __mmc_claim_host(host, NULL); |
209 | } | 209 | } |
210 | 210 | ||
211 | struct device_node; | ||
211 | extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); | 212 | extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); |
213 | extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask); | ||
212 | 214 | ||
213 | #endif /* LINUX_MMC_CORE_H */ | 215 | #endif /* LINUX_MMC_CORE_H */ |
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index e3c6a74d980a..3e781b8c0be7 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h | |||
@@ -171,6 +171,7 @@ struct sdhci_host { | |||
171 | unsigned int ocr_avail_sdio; /* OCR bit masks */ | 171 | unsigned int ocr_avail_sdio; /* OCR bit masks */ |
172 | unsigned int ocr_avail_sd; | 172 | unsigned int ocr_avail_sd; |
173 | unsigned int ocr_avail_mmc; | 173 | unsigned int ocr_avail_mmc; |
174 | u32 ocr_mask; /* available voltages */ | ||
174 | 175 | ||
175 | wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ | 176 | wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ |
176 | unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ | 177 | unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ |
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index e7d5dd67bb74..ccd8fb2cad52 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/sh_dma.h> | ||
20 | 19 | ||
21 | /* | 20 | /* |
22 | * MMCIF : CE_CLK_CTRL [19:16] | 21 | * MMCIF : CE_CLK_CTRL [19:16] |
@@ -33,12 +32,12 @@ | |||
33 | */ | 32 | */ |
34 | 33 | ||
35 | struct sh_mmcif_plat_data { | 34 | struct sh_mmcif_plat_data { |
36 | void (*set_pwr)(struct platform_device *pdev, int state); | ||
37 | void (*down_pwr)(struct platform_device *pdev); | ||
38 | int (*get_cd)(struct platform_device *pdef); | 35 | int (*get_cd)(struct platform_device *pdef); |
39 | unsigned int slave_id_tx; /* embedded slave_id_[tr]x */ | 36 | unsigned int slave_id_tx; /* embedded slave_id_[tr]x */ |
40 | unsigned int slave_id_rx; | 37 | unsigned int slave_id_rx; |
41 | bool use_cd_gpio : 1; | 38 | bool use_cd_gpio : 1; |
39 | bool ccs_unsupported : 1; | ||
40 | bool clk_ctrl2_present : 1; | ||
42 | unsigned int cd_gpio; | 41 | unsigned int cd_gpio; |
43 | u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ | 42 | u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ |
44 | unsigned long caps; | 43 | unsigned long caps; |
@@ -62,6 +61,7 @@ struct sh_mmcif_plat_data { | |||
62 | #define MMCIF_CE_INT_MASK 0x00000044 | 61 | #define MMCIF_CE_INT_MASK 0x00000044 |
63 | #define MMCIF_CE_HOST_STS1 0x00000048 | 62 | #define MMCIF_CE_HOST_STS1 0x00000048 |
64 | #define MMCIF_CE_HOST_STS2 0x0000004C | 63 | #define MMCIF_CE_HOST_STS2 0x0000004C |
64 | #define MMCIF_CE_CLK_CTRL2 0x00000070 | ||
65 | #define MMCIF_CE_VERSION 0x0000007C | 65 | #define MMCIF_CE_VERSION 0x0000007C |
66 | 66 | ||
67 | /* CE_BUF_ACC */ | 67 | /* CE_BUF_ACC */ |
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h index b76bcf0621f6..68927ae50845 100644 --- a/include/linux/mmc/sh_mobile_sdhi.h +++ b/include/linux/mmc/sh_mobile_sdhi.h | |||
@@ -25,8 +25,6 @@ struct sh_mobile_sdhi_info { | |||
25 | unsigned long tmio_caps2; | 25 | unsigned long tmio_caps2; |
26 | u32 tmio_ocr_mask; /* available MMC voltages */ | 26 | u32 tmio_ocr_mask; /* available MMC voltages */ |
27 | unsigned int cd_gpio; | 27 | unsigned int cd_gpio; |
28 | void (*set_pwr)(struct platform_device *pdev, int state); | ||
29 | int (*get_cd)(struct platform_device *pdev); | ||
30 | 28 | ||
31 | /* callbacks for board specific setup code */ | 29 | /* callbacks for board specific setup code */ |
32 | int (*init)(struct platform_device *pdev, | 30 | int (*init)(struct platform_device *pdev, |
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 7d88d27bfafa..b0c73e4cacea 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h | |||
@@ -18,7 +18,8 @@ int mmc_gpio_request_ro(struct mmc_host *host, unsigned int gpio); | |||
18 | void mmc_gpio_free_ro(struct mmc_host *host); | 18 | void mmc_gpio_free_ro(struct mmc_host *host); |
19 | 19 | ||
20 | int mmc_gpio_get_cd(struct mmc_host *host); | 20 | int mmc_gpio_get_cd(struct mmc_host *host); |
21 | int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio); | 21 | int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio, |
22 | unsigned int debounce); | ||
22 | void mmc_gpio_free_cd(struct mmc_host *host); | 23 | void mmc_gpio_free_cd(struct mmc_host *host); |
23 | 24 | ||
24 | #endif | 25 | #endif |
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index 32be8dbdf191..274bc0fa00af 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
@@ -7,6 +7,11 @@ | |||
7 | struct device; | 7 | struct device; |
8 | struct mmc_host; | 8 | struct mmc_host; |
9 | 9 | ||
10 | #define MMC_SPI_USE_CD_GPIO (1 << 0) | ||
11 | #define MMC_SPI_USE_RO_GPIO (1 << 1) | ||
12 | #define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2) | ||
13 | #define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3) | ||
14 | |||
10 | /* Put this in platform_data of a device being used to manage an MMC/SD | 15 | /* Put this in platform_data of a device being used to manage an MMC/SD |
11 | * card slot. (Modeled after PXA mmc glue; see that for usage examples.) | 16 | * card slot. (Modeled after PXA mmc glue; see that for usage examples.) |
12 | * | 17 | * |
@@ -21,17 +26,19 @@ struct mmc_spi_platform_data { | |||
21 | void *); | 26 | void *); |
22 | void (*exit)(struct device *, void *); | 27 | void (*exit)(struct device *, void *); |
23 | 28 | ||
24 | /* sense switch on sd cards */ | ||
25 | int (*get_ro)(struct device *); | ||
26 | |||
27 | /* | 29 | /* |
28 | * If board does not use CD interrupts, driver can optimize polling | 30 | * Card Detect and Read Only GPIOs. To enable debouncing on the card |
29 | * using this function. | 31 | * detect GPIO, set the cd_debounce to the debounce time in |
32 | * microseconds. | ||
30 | */ | 33 | */ |
31 | int (*get_cd)(struct device *); | 34 | unsigned int flags; |
35 | unsigned int cd_gpio; | ||
36 | unsigned int cd_debounce; | ||
37 | unsigned int ro_gpio; | ||
32 | 38 | ||
33 | /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ | 39 | /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ |
34 | unsigned long caps; | 40 | unsigned long caps; |
41 | unsigned long caps2; | ||
35 | 42 | ||
36 | /* how long to debounce card detect, in msecs */ | 43 | /* how long to debounce card detect, in msecs */ |
37 | u16 detect_delay; | 44 | u16 detect_delay; |