diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/dw_mmc-pci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/dw_mmc-pltfm.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/mvsdio.c | 92 | ||||
-rw-r--r-- | drivers/mmc/host/rtsx_pci_sdmmc.c | 30 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci-acpi.c | 6 | ||||
-rw-r--r-- | drivers/mmc/host/wmt-sdmmc.c | 4 |
6 files changed, 42 insertions, 94 deletions
diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c index 8ee0f74f9374..083fcd29c9c6 100644 --- a/drivers/mmc/host/dw_mmc-pci.c +++ b/drivers/mmc/host/dw_mmc-pci.c | |||
@@ -134,7 +134,7 @@ static struct pci_driver dw_mci_pci_driver = { | |||
134 | .name = "dw_mmc_pci", | 134 | .name = "dw_mmc_pci", |
135 | .id_table = dw_mci_pci_id, | 135 | .id_table = dw_mci_pci_id, |
136 | .probe = dw_mci_pci_probe, | 136 | .probe = dw_mci_pci_probe, |
137 | .remove = __devexit_p(dw_mci_pci_remove), | 137 | .remove = dw_mci_pci_remove, |
138 | .driver = { | 138 | .driver = { |
139 | .pm = &dw_mci_pci_pmops | 139 | .pm = &dw_mci_pci_pmops |
140 | }, | 140 | }, |
diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 222036c9e053..5e1fb1d2c422 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c | |||
@@ -120,7 +120,7 @@ MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match); | |||
120 | 120 | ||
121 | static struct platform_driver dw_mci_pltfm_driver = { | 121 | static struct platform_driver dw_mci_pltfm_driver = { |
122 | .probe = dw_mci_pltfm_probe, | 122 | .probe = dw_mci_pltfm_probe, |
123 | .remove = __devexit_p(dw_mci_pltfm_remove), | 123 | .remove = dw_mci_pltfm_remove, |
124 | .driver = { | 124 | .driver = { |
125 | .name = "dw_mmc", | 125 | .name = "dw_mmc", |
126 | .of_match_table = of_match_ptr(dw_mci_pltfm_match), | 126 | .of_match_table = of_match_ptr(dw_mci_pltfm_match), |
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index de4c20b3936c..f8dd36102949 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c | |||
@@ -50,8 +50,6 @@ struct mvsd_host { | |||
50 | struct timer_list timer; | 50 | struct timer_list timer; |
51 | struct mmc_host *mmc; | 51 | struct mmc_host *mmc; |
52 | struct device *dev; | 52 | struct device *dev; |
53 | struct resource *res; | ||
54 | int irq; | ||
55 | struct clk *clk; | 53 | struct clk *clk; |
56 | int gpio_card_detect; | 54 | int gpio_card_detect; |
57 | int gpio_write_protect; | 55 | int gpio_write_protect; |
@@ -718,10 +716,6 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
718 | if (!r || irq < 0 || !mvsd_data) | 716 | if (!r || irq < 0 || !mvsd_data) |
719 | return -ENXIO; | 717 | return -ENXIO; |
720 | 718 | ||
721 | r = request_mem_region(r->start, SZ_1K, DRIVER_NAME); | ||
722 | if (!r) | ||
723 | return -EBUSY; | ||
724 | |||
725 | mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev); | 719 | mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev); |
726 | if (!mmc) { | 720 | if (!mmc) { |
727 | ret = -ENOMEM; | 721 | ret = -ENOMEM; |
@@ -731,8 +725,8 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
731 | host = mmc_priv(mmc); | 725 | host = mmc_priv(mmc); |
732 | host->mmc = mmc; | 726 | host->mmc = mmc; |
733 | host->dev = &pdev->dev; | 727 | host->dev = &pdev->dev; |
734 | host->res = r; | ||
735 | host->base_clock = mvsd_data->clock / 2; | 728 | host->base_clock = mvsd_data->clock / 2; |
729 | host->clk = ERR_PTR(-EINVAL); | ||
736 | 730 | ||
737 | mmc->ops = &mvsd_ops; | 731 | mmc->ops = &mvsd_ops; |
738 | 732 | ||
@@ -752,7 +746,7 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
752 | 746 | ||
753 | spin_lock_init(&host->lock); | 747 | spin_lock_init(&host->lock); |
754 | 748 | ||
755 | host->base = ioremap(r->start, SZ_4K); | 749 | host->base = devm_request_and_ioremap(&pdev->dev, r); |
756 | if (!host->base) { | 750 | if (!host->base) { |
757 | ret = -ENOMEM; | 751 | ret = -ENOMEM; |
758 | goto out; | 752 | goto out; |
@@ -765,44 +759,45 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
765 | 759 | ||
766 | mvsd_power_down(host); | 760 | mvsd_power_down(host); |
767 | 761 | ||
768 | ret = request_irq(irq, mvsd_irq, 0, DRIVER_NAME, host); | 762 | ret = devm_request_irq(&pdev->dev, irq, mvsd_irq, 0, DRIVER_NAME, host); |
769 | if (ret) { | 763 | if (ret) { |
770 | pr_err("%s: cannot assign irq %d\n", DRIVER_NAME, irq); | 764 | pr_err("%s: cannot assign irq %d\n", DRIVER_NAME, irq); |
771 | goto out; | 765 | goto out; |
772 | } else | 766 | } |
773 | host->irq = irq; | ||
774 | 767 | ||
775 | /* Not all platforms can gate the clock, so it is not | 768 | /* Not all platforms can gate the clock, so it is not |
776 | an error if the clock does not exists. */ | 769 | an error if the clock does not exists. */ |
777 | host->clk = clk_get(&pdev->dev, NULL); | 770 | host->clk = devm_clk_get(&pdev->dev, NULL); |
778 | if (!IS_ERR(host->clk)) { | 771 | if (!IS_ERR(host->clk)) |
779 | clk_prepare_enable(host->clk); | 772 | clk_prepare_enable(host->clk); |
780 | } | ||
781 | 773 | ||
782 | if (mvsd_data->gpio_card_detect) { | 774 | if (mvsd_data->gpio_card_detect) { |
783 | ret = gpio_request(mvsd_data->gpio_card_detect, | 775 | ret = devm_gpio_request_one(&pdev->dev, |
784 | DRIVER_NAME " cd"); | 776 | mvsd_data->gpio_card_detect, |
777 | GPIOF_IN, DRIVER_NAME " cd"); | ||
785 | if (ret == 0) { | 778 | if (ret == 0) { |
786 | gpio_direction_input(mvsd_data->gpio_card_detect); | ||
787 | irq = gpio_to_irq(mvsd_data->gpio_card_detect); | 779 | irq = gpio_to_irq(mvsd_data->gpio_card_detect); |
788 | ret = request_irq(irq, mvsd_card_detect_irq, | 780 | ret = devm_request_irq(&pdev->dev, irq, |
789 | IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, | 781 | mvsd_card_detect_irq, |
790 | DRIVER_NAME " cd", host); | 782 | IRQ_TYPE_EDGE_RISING | |
783 | IRQ_TYPE_EDGE_FALLING, | ||
784 | DRIVER_NAME " cd", host); | ||
791 | if (ret == 0) | 785 | if (ret == 0) |
792 | host->gpio_card_detect = | 786 | host->gpio_card_detect = |
793 | mvsd_data->gpio_card_detect; | 787 | mvsd_data->gpio_card_detect; |
794 | else | 788 | else |
795 | gpio_free(mvsd_data->gpio_card_detect); | 789 | devm_gpio_free(&pdev->dev, |
790 | mvsd_data->gpio_card_detect); | ||
796 | } | 791 | } |
797 | } | 792 | } |
798 | if (!host->gpio_card_detect) | 793 | if (!host->gpio_card_detect) |
799 | mmc->caps |= MMC_CAP_NEEDS_POLL; | 794 | mmc->caps |= MMC_CAP_NEEDS_POLL; |
800 | 795 | ||
801 | if (mvsd_data->gpio_write_protect) { | 796 | if (mvsd_data->gpio_write_protect) { |
802 | ret = gpio_request(mvsd_data->gpio_write_protect, | 797 | ret = devm_gpio_request_one(&pdev->dev, |
803 | DRIVER_NAME " wp"); | 798 | mvsd_data->gpio_write_protect, |
799 | GPIOF_IN, DRIVER_NAME " wp"); | ||
804 | if (ret == 0) { | 800 | if (ret == 0) { |
805 | gpio_direction_input(mvsd_data->gpio_write_protect); | ||
806 | host->gpio_write_protect = | 801 | host->gpio_write_protect = |
807 | mvsd_data->gpio_write_protect; | 802 | mvsd_data->gpio_write_protect; |
808 | } | 803 | } |
@@ -824,26 +819,11 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
824 | return 0; | 819 | return 0; |
825 | 820 | ||
826 | out: | 821 | out: |
827 | if (host) { | 822 | if (mmc) { |
828 | if (host->irq) | 823 | if (!IS_ERR(host->clk)) |
829 | free_irq(host->irq, host); | ||
830 | if (host->gpio_card_detect) { | ||
831 | free_irq(gpio_to_irq(host->gpio_card_detect), host); | ||
832 | gpio_free(host->gpio_card_detect); | ||
833 | } | ||
834 | if (host->gpio_write_protect) | ||
835 | gpio_free(host->gpio_write_protect); | ||
836 | if (host->base) | ||
837 | iounmap(host->base); | ||
838 | } | ||
839 | if (r) | ||
840 | release_resource(r); | ||
841 | if (mmc) | ||
842 | if (!IS_ERR_OR_NULL(host->clk)) { | ||
843 | clk_disable_unprepare(host->clk); | 824 | clk_disable_unprepare(host->clk); |
844 | clk_put(host->clk); | ||
845 | } | ||
846 | mmc_free_host(mmc); | 825 | mmc_free_host(mmc); |
826 | } | ||
847 | 827 | ||
848 | return ret; | 828 | return ret; |
849 | } | 829 | } |
@@ -852,28 +832,16 @@ static int __exit mvsd_remove(struct platform_device *pdev) | |||
852 | { | 832 | { |
853 | struct mmc_host *mmc = platform_get_drvdata(pdev); | 833 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
854 | 834 | ||
855 | if (mmc) { | 835 | struct mvsd_host *host = mmc_priv(mmc); |
856 | struct mvsd_host *host = mmc_priv(mmc); | ||
857 | 836 | ||
858 | if (host->gpio_card_detect) { | 837 | mmc_remove_host(mmc); |
859 | free_irq(gpio_to_irq(host->gpio_card_detect), host); | 838 | del_timer_sync(&host->timer); |
860 | gpio_free(host->gpio_card_detect); | 839 | mvsd_power_down(host); |
861 | } | 840 | |
862 | mmc_remove_host(mmc); | 841 | if (!IS_ERR(host->clk)) |
863 | free_irq(host->irq, host); | 842 | clk_disable_unprepare(host->clk); |
864 | if (host->gpio_write_protect) | 843 | mmc_free_host(mmc); |
865 | gpio_free(host->gpio_write_protect); | ||
866 | del_timer_sync(&host->timer); | ||
867 | mvsd_power_down(host); | ||
868 | iounmap(host->base); | ||
869 | release_resource(host->res); | ||
870 | 844 | ||
871 | if (!IS_ERR(host->clk)) { | ||
872 | clk_disable_unprepare(host->clk); | ||
873 | clk_put(host->clk); | ||
874 | } | ||
875 | mmc_free_host(mmc); | ||
876 | } | ||
877 | platform_set_drvdata(pdev, NULL); | 845 | platform_set_drvdata(pdev, NULL); |
878 | return 0; | 846 | return 0; |
879 | } | 847 | } |
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 571915dfb218..f74b5adca642 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c | |||
@@ -1060,26 +1060,6 @@ static int sd_wait_voltage_stable_2(struct realtek_pci_sdmmc *host) | |||
1060 | return 0; | 1060 | return 0; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage) | ||
1064 | { | ||
1065 | struct rtsx_pcr *pcr = host->pcr; | ||
1066 | int err; | ||
1067 | |||
1068 | if (voltage == SD_IO_3V3) { | ||
1069 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); | ||
1070 | if (err < 0) | ||
1071 | return err; | ||
1072 | } else if (voltage == SD_IO_1V8) { | ||
1073 | err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); | ||
1074 | if (err < 0) | ||
1075 | return err; | ||
1076 | } else { | ||
1077 | return -EINVAL; | ||
1078 | } | ||
1079 | |||
1080 | return 0; | ||
1081 | } | ||
1082 | |||
1083 | static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | 1063 | static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) |
1084 | { | 1064 | { |
1085 | struct realtek_pci_sdmmc *host = mmc_priv(mmc); | 1065 | struct realtek_pci_sdmmc *host = mmc_priv(mmc); |
@@ -1098,11 +1078,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1098 | rtsx_pci_start_run(pcr); | 1078 | rtsx_pci_start_run(pcr); |
1099 | 1079 | ||
1100 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) | 1080 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) |
1101 | voltage = SD_IO_3V3; | 1081 | voltage = OUTPUT_3V3; |
1102 | else | 1082 | else |
1103 | voltage = SD_IO_1V8; | 1083 | voltage = OUTPUT_1V8; |
1104 | 1084 | ||
1105 | if (voltage == SD_IO_1V8) { | 1085 | if (voltage == OUTPUT_1V8) { |
1106 | err = rtsx_pci_write_register(pcr, | 1086 | err = rtsx_pci_write_register(pcr, |
1107 | SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); | 1087 | SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); |
1108 | if (err < 0) | 1088 | if (err < 0) |
@@ -1113,11 +1093,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1113 | goto out; | 1093 | goto out; |
1114 | } | 1094 | } |
1115 | 1095 | ||
1116 | err = sd_change_bank_voltage(host, voltage); | 1096 | err = rtsx_pci_switch_output_voltage(pcr, voltage); |
1117 | if (err < 0) | 1097 | if (err < 0) |
1118 | goto out; | 1098 | goto out; |
1119 | 1099 | ||
1120 | if (voltage == SD_IO_1V8) { | 1100 | if (voltage == OUTPUT_1V8) { |
1121 | err = sd_wait_voltage_stable_2(host); | 1101 | err = sd_wait_voltage_stable_2(host); |
1122 | if (err < 0) | 1102 | if (err < 0) |
1123 | goto out; | 1103 | goto out; |
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 12b0a78497f6..2592dddbd965 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c | |||
@@ -111,7 +111,7 @@ static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid) | |||
111 | return NULL; | 111 | return NULL; |
112 | } | 112 | } |
113 | 113 | ||
114 | static int __devinit sdhci_acpi_probe(struct platform_device *pdev) | 114 | static int sdhci_acpi_probe(struct platform_device *pdev) |
115 | { | 115 | { |
116 | struct device *dev = &pdev->dev; | 116 | struct device *dev = &pdev->dev; |
117 | acpi_handle handle = ACPI_HANDLE(dev); | 117 | acpi_handle handle = ACPI_HANDLE(dev); |
@@ -214,7 +214,7 @@ err_free: | |||
214 | return err; | 214 | return err; |
215 | } | 215 | } |
216 | 216 | ||
217 | static int __devexit sdhci_acpi_remove(struct platform_device *pdev) | 217 | static int sdhci_acpi_remove(struct platform_device *pdev) |
218 | { | 218 | { |
219 | struct sdhci_acpi_host *c = platform_get_drvdata(pdev); | 219 | struct sdhci_acpi_host *c = platform_get_drvdata(pdev); |
220 | struct device *dev = &pdev->dev; | 220 | struct device *dev = &pdev->dev; |
@@ -302,7 +302,7 @@ static struct platform_driver sdhci_acpi_driver = { | |||
302 | .pm = &sdhci_acpi_pm_ops, | 302 | .pm = &sdhci_acpi_pm_ops, |
303 | }, | 303 | }, |
304 | .probe = sdhci_acpi_probe, | 304 | .probe = sdhci_acpi_probe, |
305 | .remove = __devexit_p(sdhci_acpi_remove), | 305 | .remove = sdhci_acpi_remove, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | module_platform_driver(sdhci_acpi_driver); | 308 | module_platform_driver(sdhci_acpi_driver); |
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index 5ba4605e4f80..154f0e8e931c 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c | |||
@@ -766,7 +766,7 @@ static struct of_device_id wmt_mci_dt_ids[] = { | |||
766 | { /* Sentinel */ }, | 766 | { /* Sentinel */ }, |
767 | }; | 767 | }; |
768 | 768 | ||
769 | static int __devinit wmt_mci_probe(struct platform_device *pdev) | 769 | static int wmt_mci_probe(struct platform_device *pdev) |
770 | { | 770 | { |
771 | struct mmc_host *mmc; | 771 | struct mmc_host *mmc; |
772 | struct wmt_mci_priv *priv; | 772 | struct wmt_mci_priv *priv; |
@@ -892,7 +892,7 @@ fail1: | |||
892 | return ret; | 892 | return ret; |
893 | } | 893 | } |
894 | 894 | ||
895 | static int __devexit wmt_mci_remove(struct platform_device *pdev) | 895 | static int wmt_mci_remove(struct platform_device *pdev) |
896 | { | 896 | { |
897 | struct mmc_host *mmc; | 897 | struct mmc_host *mmc; |
898 | struct wmt_mci_priv *priv; | 898 | struct wmt_mci_priv *priv; |