diff options
-rw-r--r-- | drivers/mmc/host/mvsdio.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index f8dd36102949..c6dc8fd696ab 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/mmc/host.h> | 24 | #include <linux/mmc/host.h> |
25 | #include <linux/mmc/slot-gpio.h> | ||
25 | 26 | ||
26 | #include <asm/sizes.h> | 27 | #include <asm/sizes.h> |
27 | #include <asm/unaligned.h> | 28 | #include <asm/unaligned.h> |
@@ -52,7 +53,6 @@ struct mvsd_host { | |||
52 | struct device *dev; | 53 | struct device *dev; |
53 | struct clk *clk; | 54 | struct clk *clk; |
54 | int gpio_card_detect; | 55 | int gpio_card_detect; |
55 | int gpio_write_protect; | ||
56 | }; | 56 | }; |
57 | 57 | ||
58 | #define mvsd_write(offs, val) writel(val, iobase + (offs)) | 58 | #define mvsd_write(offs, val) writel(val, iobase + (offs)) |
@@ -564,20 +564,6 @@ static void mvsd_enable_sdio_irq(struct mmc_host *mmc, int enable) | |||
564 | spin_unlock_irqrestore(&host->lock, flags); | 564 | spin_unlock_irqrestore(&host->lock, flags); |
565 | } | 565 | } |
566 | 566 | ||
567 | static int mvsd_get_ro(struct mmc_host *mmc) | ||
568 | { | ||
569 | struct mvsd_host *host = mmc_priv(mmc); | ||
570 | |||
571 | if (host->gpio_write_protect) | ||
572 | return gpio_get_value(host->gpio_write_protect); | ||
573 | |||
574 | /* | ||
575 | * Board doesn't support read only detection; let the mmc core | ||
576 | * decide what to do. | ||
577 | */ | ||
578 | return -ENOSYS; | ||
579 | } | ||
580 | |||
581 | static void mvsd_power_up(struct mvsd_host *host) | 567 | static void mvsd_power_up(struct mvsd_host *host) |
582 | { | 568 | { |
583 | void __iomem *iobase = host->base; | 569 | void __iomem *iobase = host->base; |
@@ -674,7 +660,7 @@ static void mvsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
674 | 660 | ||
675 | static const struct mmc_host_ops mvsd_ops = { | 661 | static const struct mmc_host_ops mvsd_ops = { |
676 | .request = mvsd_request, | 662 | .request = mvsd_request, |
677 | .get_ro = mvsd_get_ro, | 663 | .get_ro = mmc_gpio_get_ro, |
678 | .set_ios = mvsd_set_ios, | 664 | .set_ios = mvsd_set_ios, |
679 | .enable_sdio_irq = mvsd_enable_sdio_irq, | 665 | .enable_sdio_irq = mvsd_enable_sdio_irq, |
680 | }; | 666 | }; |
@@ -793,15 +779,7 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
793 | if (!host->gpio_card_detect) | 779 | if (!host->gpio_card_detect) |
794 | mmc->caps |= MMC_CAP_NEEDS_POLL; | 780 | mmc->caps |= MMC_CAP_NEEDS_POLL; |
795 | 781 | ||
796 | if (mvsd_data->gpio_write_protect) { | 782 | mmc_gpio_request_ro(mmc, mvsd_data->gpio_write_protect); |
797 | ret = devm_gpio_request_one(&pdev->dev, | ||
798 | mvsd_data->gpio_write_protect, | ||
799 | GPIOF_IN, DRIVER_NAME " wp"); | ||
800 | if (ret == 0) { | ||
801 | host->gpio_write_protect = | ||
802 | mvsd_data->gpio_write_protect; | ||
803 | } | ||
804 | } | ||
805 | 783 | ||
806 | setup_timer(&host->timer, mvsd_timeout_timer, (unsigned long)host); | 784 | setup_timer(&host->timer, mvsd_timeout_timer, (unsigned long)host); |
807 | platform_set_drvdata(pdev, mmc); | 785 | platform_set_drvdata(pdev, mmc); |
@@ -820,6 +798,7 @@ static int __init mvsd_probe(struct platform_device *pdev) | |||
820 | 798 | ||
821 | out: | 799 | out: |
822 | if (mmc) { | 800 | if (mmc) { |
801 | mmc_gpio_free_ro(mmc); | ||
823 | if (!IS_ERR(host->clk)) | 802 | if (!IS_ERR(host->clk)) |
824 | clk_disable_unprepare(host->clk); | 803 | clk_disable_unprepare(host->clk); |
825 | mmc_free_host(mmc); | 804 | mmc_free_host(mmc); |
@@ -834,6 +813,7 @@ static int __exit mvsd_remove(struct platform_device *pdev) | |||
834 | 813 | ||
835 | struct mvsd_host *host = mmc_priv(mmc); | 814 | struct mvsd_host *host = mmc_priv(mmc); |
836 | 815 | ||
816 | mmc_gpio_free_ro(mmc); | ||
837 | mmc_remove_host(mmc); | 817 | mmc_remove_host(mmc); |
838 | del_timer_sync(&host->timer); | 818 | del_timer_sync(&host->timer); |
839 | mvsd_power_down(host); | 819 | mvsd_power_down(host); |