aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c5
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c9
-rw-r--r--drivers/mmc/core/core.c187
-rw-r--r--drivers/mmc/core/host.c1
-rw-r--r--drivers/mmc/core/host.h1
-rw-r--r--drivers/mmc/host/davinci_mmc.c4
-rw-r--r--drivers/mmc/host/omap_hsmmc.c15
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/host.h46
9 files changed, 27 insertions, 242 deletions
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index aa37179d776c..3cdabd39f97c 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -109,7 +109,7 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
109 .max_width = 8, 109 .max_width = 8,
110 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 110 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
111 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 111 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
112 MMC_CAP_DISABLE | MMC_CAP_ERASE), 112 MMC_CAP_ERASE),
113 .cd_type = S3C_SDHCI_CD_PERMANENT, 113 .cd_type = S3C_SDHCI_CD_PERMANENT,
114 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 114 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
115}; 115};
@@ -148,8 +148,7 @@ static struct platform_device emmc_fixed_voltage = {
148static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = { 148static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
149 .max_width = 4, 149 .max_width = 4,
150 .host_caps = MMC_CAP_4_BIT_DATA | 150 .host_caps = MMC_CAP_4_BIT_DATA |
151 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 151 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
152 MMC_CAP_DISABLE,
153 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */ 152 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
154 .ext_cd_gpio_invert = 1, 153 .ext_cd_gpio_invert = 1,
155 .cd_type = S3C_SDHCI_CD_GPIO, 154 .cd_type = S3C_SDHCI_CD_GPIO,
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index b2d495b31094..87e3dcf714b5 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -736,8 +736,7 @@ static struct platform_device universal_gpio_keys = {
736static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { 736static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
737 .max_width = 8, 737 .max_width = 8,
738 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 738 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
739 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 739 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
740 MMC_CAP_DISABLE),
741 .cd_type = S3C_SDHCI_CD_PERMANENT, 740 .cd_type = S3C_SDHCI_CD_PERMANENT,
742 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 741 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
743}; 742};
@@ -775,8 +774,7 @@ static struct platform_device mmc0_fixed_voltage = {
775static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = { 774static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
776 .max_width = 4, 775 .max_width = 4,
777 .host_caps = MMC_CAP_4_BIT_DATA | 776 .host_caps = MMC_CAP_4_BIT_DATA |
778 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 777 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
779 MMC_CAP_DISABLE,
780 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */ 778 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
781 .ext_cd_gpio_invert = 1, 779 .ext_cd_gpio_invert = 1,
782 .cd_type = S3C_SDHCI_CD_GPIO, 780 .cd_type = S3C_SDHCI_CD_GPIO,
@@ -787,8 +785,7 @@ static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
787static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = { 785static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
788 .max_width = 4, 786 .max_width = 4,
789 .host_caps = MMC_CAP_4_BIT_DATA | 787 .host_caps = MMC_CAP_4_BIT_DATA |
790 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 788 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
791 MMC_CAP_DISABLE,
792 .cd_type = S3C_SDHCI_CD_EXTERNAL, 789 .cd_type = S3C_SDHCI_CD_EXTERNAL,
793}; 790};
794 791
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 436409f7f7bd..9b56674ddc2a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -605,105 +605,6 @@ unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz)
605EXPORT_SYMBOL(mmc_align_data_size); 605EXPORT_SYMBOL(mmc_align_data_size);
606 606
607/** 607/**
608 * mmc_host_enable - enable a host.
609 * @host: mmc host to enable
610 *
611 * Hosts that support power saving can use the 'enable' and 'disable'
612 * methods to exit and enter power saving states. For more information
613 * see comments for struct mmc_host_ops.
614 */
615int mmc_host_enable(struct mmc_host *host)
616{
617 if (!(host->caps & MMC_CAP_DISABLE))
618 return 0;
619
620 if (host->en_dis_recurs)
621 return 0;
622
623 if (host->nesting_cnt++)
624 return 0;
625
626 cancel_delayed_work_sync(&host->disable);
627
628 if (host->enabled)
629 return 0;
630
631 if (host->ops->enable) {
632 int err;
633
634 host->en_dis_recurs = 1;
635 mmc_host_clk_hold(host);
636 err = host->ops->enable(host);
637 mmc_host_clk_release(host);
638 host->en_dis_recurs = 0;
639
640 if (err) {
641 pr_debug("%s: enable error %d\n",
642 mmc_hostname(host), err);
643 return err;
644 }
645 }
646 host->enabled = 1;
647 return 0;
648}
649EXPORT_SYMBOL(mmc_host_enable);
650
651static int mmc_host_do_disable(struct mmc_host *host, int lazy)
652{
653 if (host->ops->disable) {
654 int err;
655
656 host->en_dis_recurs = 1;
657 mmc_host_clk_hold(host);
658 err = host->ops->disable(host, lazy);
659 mmc_host_clk_release(host);
660 host->en_dis_recurs = 0;
661
662 if (err < 0) {
663 pr_debug("%s: disable error %d\n",
664 mmc_hostname(host), err);
665 return err;
666 }
667 if (err > 0) {
668 unsigned long delay = msecs_to_jiffies(err);
669
670 mmc_schedule_delayed_work(&host->disable, delay);
671 }
672 }
673 host->enabled = 0;
674 return 0;
675}
676
677/**
678 * mmc_host_disable - disable a host.
679 * @host: mmc host to disable
680 *
681 * Hosts that support power saving can use the 'enable' and 'disable'
682 * methods to exit and enter power saving states. For more information
683 * see comments for struct mmc_host_ops.
684 */
685int mmc_host_disable(struct mmc_host *host)
686{
687 int err;
688
689 if (!(host->caps & MMC_CAP_DISABLE))
690 return 0;
691
692 if (host->en_dis_recurs)
693 return 0;
694
695 if (--host->nesting_cnt)
696 return 0;
697
698 if (!host->enabled)
699 return 0;
700
701 err = mmc_host_do_disable(host, 0);
702 return err;
703}
704EXPORT_SYMBOL(mmc_host_disable);
705
706/**
707 * __mmc_claim_host - exclusively claim a host 608 * __mmc_claim_host - exclusively claim a host
708 * @host: mmc host to claim 609 * @host: mmc host to claim
709 * @abort: whether or not the operation should be aborted 610 * @abort: whether or not the operation should be aborted
@@ -741,8 +642,8 @@ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort)
741 wake_up(&host->wq); 642 wake_up(&host->wq);
742 spin_unlock_irqrestore(&host->lock, flags); 643 spin_unlock_irqrestore(&host->lock, flags);
743 remove_wait_queue(&host->wq, &wait); 644 remove_wait_queue(&host->wq, &wait);
744 if (!stop) 645 if (host->ops->enable && !stop && host->claim_cnt == 1)
745 mmc_host_enable(host); 646 host->ops->enable(host);
746 return stop; 647 return stop;
747} 648}
748 649
@@ -767,21 +668,28 @@ int mmc_try_claim_host(struct mmc_host *host)
767 claimed_host = 1; 668 claimed_host = 1;
768 } 669 }
769 spin_unlock_irqrestore(&host->lock, flags); 670 spin_unlock_irqrestore(&host->lock, flags);
671 if (host->ops->enable && claimed_host && host->claim_cnt == 1)
672 host->ops->enable(host);
770 return claimed_host; 673 return claimed_host;
771} 674}
772EXPORT_SYMBOL(mmc_try_claim_host); 675EXPORT_SYMBOL(mmc_try_claim_host);
773 676
774/** 677/**
775 * mmc_do_release_host - release a claimed host 678 * mmc_release_host - release a host
776 * @host: mmc host to release 679 * @host: mmc host to release
777 * 680 *
778 * If you successfully claimed a host, this function will 681 * Release a MMC host, allowing others to claim the host
779 * release it again. 682 * for their operations.
780 */ 683 */
781void mmc_do_release_host(struct mmc_host *host) 684void mmc_release_host(struct mmc_host *host)
782{ 685{
783 unsigned long flags; 686 unsigned long flags;
784 687
688 WARN_ON(!host->claimed);
689
690 if (host->ops->disable && host->claim_cnt == 1)
691 host->ops->disable(host);
692
785 spin_lock_irqsave(&host->lock, flags); 693 spin_lock_irqsave(&host->lock, flags);
786 if (--host->claim_cnt) { 694 if (--host->claim_cnt) {
787 /* Release for nested claim */ 695 /* Release for nested claim */
@@ -793,67 +701,6 @@ void mmc_do_release_host(struct mmc_host *host)
793 wake_up(&host->wq); 701 wake_up(&host->wq);
794 } 702 }
795} 703}
796EXPORT_SYMBOL(mmc_do_release_host);
797
798void mmc_host_deeper_disable(struct work_struct *work)
799{
800 struct mmc_host *host =
801 container_of(work, struct mmc_host, disable.work);
802
803 /* If the host is claimed then we do not want to disable it anymore */
804 if (!mmc_try_claim_host(host))
805 return;
806 mmc_host_do_disable(host, 1);
807 mmc_do_release_host(host);
808}
809
810/**
811 * mmc_host_lazy_disable - lazily disable a host.
812 * @host: mmc host to disable
813 *
814 * Hosts that support power saving can use the 'enable' and 'disable'
815 * methods to exit and enter power saving states. For more information
816 * see comments for struct mmc_host_ops.
817 */
818int mmc_host_lazy_disable(struct mmc_host *host)
819{
820 if (!(host->caps & MMC_CAP_DISABLE))
821 return 0;
822
823 if (host->en_dis_recurs)
824 return 0;
825
826 if (--host->nesting_cnt)
827 return 0;
828
829 if (!host->enabled)
830 return 0;
831
832 if (host->disable_delay) {
833 mmc_schedule_delayed_work(&host->disable,
834 msecs_to_jiffies(host->disable_delay));
835 return 0;
836 } else
837 return mmc_host_do_disable(host, 1);
838}
839EXPORT_SYMBOL(mmc_host_lazy_disable);
840
841/**
842 * mmc_release_host - release a host
843 * @host: mmc host to release
844 *
845 * Release a MMC host, allowing others to claim the host
846 * for their operations.
847 */
848void mmc_release_host(struct mmc_host *host)
849{
850 WARN_ON(!host->claimed);
851
852 mmc_host_lazy_disable(host);
853
854 mmc_do_release_host(host);
855}
856
857EXPORT_SYMBOL(mmc_release_host); 704EXPORT_SYMBOL(mmc_release_host);
858 705
859/* 706/*
@@ -2227,8 +2074,6 @@ void mmc_stop_host(struct mmc_host *host)
2227 spin_unlock_irqrestore(&host->lock, flags); 2074 spin_unlock_irqrestore(&host->lock, flags);
2228#endif 2075#endif
2229 2076
2230 if (host->caps & MMC_CAP_DISABLE)
2231 cancel_delayed_work(&host->disable);
2232 cancel_delayed_work_sync(&host->detect); 2077 cancel_delayed_work_sync(&host->detect);
2233 mmc_flush_scheduled_work(); 2078 mmc_flush_scheduled_work();
2234 2079
@@ -2423,13 +2268,11 @@ int mmc_suspend_host(struct mmc_host *host)
2423{ 2268{
2424 int err = 0; 2269 int err = 0;
2425 2270
2426 if (host->caps & MMC_CAP_DISABLE)
2427 cancel_delayed_work(&host->disable);
2428 cancel_delayed_work(&host->detect); 2271 cancel_delayed_work(&host->detect);
2429 mmc_flush_scheduled_work(); 2272 mmc_flush_scheduled_work();
2430 if (mmc_try_claim_host(host)) { 2273 if (mmc_try_claim_host(host)) {
2431 err = mmc_cache_ctrl(host, 0); 2274 err = mmc_cache_ctrl(host, 0);
2432 mmc_do_release_host(host); 2275 mmc_release_host(host);
2433 } else { 2276 } else {
2434 err = -EBUSY; 2277 err = -EBUSY;
2435 } 2278 }
@@ -2450,7 +2293,7 @@ int mmc_suspend_host(struct mmc_host *host)
2450 if (host->bus_ops->suspend) { 2293 if (host->bus_ops->suspend) {
2451 err = host->bus_ops->suspend(host); 2294 err = host->bus_ops->suspend(host);
2452 } 2295 }
2453 mmc_do_release_host(host); 2296 mmc_release_host(host);
2454 2297
2455 if (err == -ENOSYS || !host->bus_ops->resume) { 2298 if (err == -ENOSYS || !host->bus_ops->resume) {
2456 /* 2299 /*
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index c3704e293a7b..91c84c7a1829 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -330,7 +330,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
330 spin_lock_init(&host->lock); 330 spin_lock_init(&host->lock);
331 init_waitqueue_head(&host->wq); 331 init_waitqueue_head(&host->wq);
332 INIT_DELAYED_WORK(&host->detect, mmc_rescan); 332 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
333 INIT_DELAYED_WORK_DEFERRABLE(&host->disable, mmc_host_deeper_disable);
334#ifdef CONFIG_PM 333#ifdef CONFIG_PM
335 host->pm_notify.notifier_call = mmc_pm_notify; 334 host->pm_notify.notifier_call = mmc_pm_notify;
336#endif 335#endif
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 08a7852ade44..f2ab9e578126 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -14,7 +14,6 @@
14 14
15int mmc_register_host_class(void); 15int mmc_register_host_class(void);
16void mmc_unregister_host_class(void); 16void mmc_unregister_host_class(void);
17void mmc_host_deeper_disable(struct work_struct *work);
18 17
19#endif 18#endif
20 19
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 64a8325a4a8a..8de9c9bdba0b 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1418,17 +1418,14 @@ static int davinci_mmcsd_suspend(struct device *dev)
1418 struct mmc_davinci_host *host = platform_get_drvdata(pdev); 1418 struct mmc_davinci_host *host = platform_get_drvdata(pdev);
1419 int ret; 1419 int ret;
1420 1420
1421 mmc_host_enable(host->mmc);
1422 ret = mmc_suspend_host(host->mmc); 1421 ret = mmc_suspend_host(host->mmc);
1423 if (!ret) { 1422 if (!ret) {
1424 writel(0, host->base + DAVINCI_MMCIM); 1423 writel(0, host->base + DAVINCI_MMCIM);
1425 mmc_davinci_reset_ctrl(host, 1); 1424 mmc_davinci_reset_ctrl(host, 1);
1426 mmc_host_disable(host->mmc);
1427 clk_disable(host->clk); 1425 clk_disable(host->clk);
1428 host->suspended = 1; 1426 host->suspended = 1;
1429 } else { 1427 } else {
1430 host->suspended = 0; 1428 host->suspended = 0;
1431 mmc_host_disable(host->mmc);
1432 } 1429 }
1433 1430
1434 return ret; 1431 return ret;
@@ -1444,7 +1441,6 @@ static int davinci_mmcsd_resume(struct device *dev)
1444 return 0; 1441 return 0;
1445 1442
1446 clk_enable(host->clk); 1443 clk_enable(host->clk);
1447 mmc_host_enable(host->mmc);
1448 1444
1449 mmc_davinci_reset_ctrl(host, 0); 1445 mmc_davinci_reset_ctrl(host, 0);
1450 ret = mmc_resume_host(host->mmc); 1446 ret = mmc_resume_host(host->mmc);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index e5501704b2db..98adf0c51e05 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -167,7 +167,6 @@ struct omap_hsmmc_host {
167 int got_dbclk; 167 int got_dbclk;
168 int response_busy; 168 int response_busy;
169 int context_loss; 169 int context_loss;
170 int dpm_state;
171 int vdd; 170 int vdd;
172 int protect_card; 171 int protect_card;
173 int reqs_blocked; 172 int reqs_blocked;
@@ -1619,7 +1618,7 @@ static int omap_hsmmc_enable_fclk(struct mmc_host *mmc)
1619 return 0; 1618 return 0;
1620} 1619}
1621 1620
1622static int omap_hsmmc_disable_fclk(struct mmc_host *mmc, int lazy) 1621static int omap_hsmmc_disable_fclk(struct mmc_host *mmc)
1623{ 1622{
1624 struct omap_hsmmc_host *host = mmc_priv(mmc); 1623 struct omap_hsmmc_host *host = mmc_priv(mmc);
1625 1624
@@ -1653,15 +1652,8 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data)
1653 if (host->pdata->get_context_loss_count) 1652 if (host->pdata->get_context_loss_count)
1654 context_loss = host->pdata->get_context_loss_count(host->dev); 1653 context_loss = host->pdata->get_context_loss_count(host->dev);
1655 1654
1656 seq_printf(s, "mmc%d:\n" 1655 seq_printf(s, "mmc%d:\n ctx_loss:\t%d:%d\n\nregs:\n",
1657 " enabled:\t%d\n" 1656 mmc->index, host->context_loss, context_loss);
1658 " dpm_state:\t%d\n"
1659 " nesting_cnt:\t%d\n"
1660 " ctx_loss:\t%d:%d\n"
1661 "\nregs:\n",
1662 mmc->index, mmc->enabled ? 1 : 0,
1663 host->dpm_state, mmc->nesting_cnt,
1664 host->context_loss, context_loss);
1665 1657
1666 if (host->suspended) { 1658 if (host->suspended) {
1667 seq_printf(s, "host suspended, can't read registers\n"); 1659 seq_printf(s, "host suspended, can't read registers\n");
@@ -1800,7 +1792,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
1800 1792
1801 omap_hsmmc_context_save(host); 1793 omap_hsmmc_context_save(host);
1802 1794
1803 mmc->caps |= MMC_CAP_DISABLE;
1804 if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) { 1795 if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
1805 dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n"); 1796 dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n");
1806 mmc->caps2 |= MMC_CAP2_NO_MULTI_READ; 1797 mmc->caps2 |= MMC_CAP2_NO_MULTI_READ;
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 87a976cc5654..2bfa589764de 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -175,7 +175,6 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
175 175
176extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 176extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
177extern void mmc_release_host(struct mmc_host *host); 177extern void mmc_release_host(struct mmc_host *host);
178extern void mmc_do_release_host(struct mmc_host *host);
179extern int mmc_try_claim_host(struct mmc_host *host); 178extern int mmc_try_claim_host(struct mmc_host *host);
180 179
181extern int mmc_flush_cache(struct mmc_card *); 180extern int mmc_flush_cache(struct mmc_card *);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index d1d3743fde90..e05bd241c676 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -80,34 +80,11 @@ struct mmc_ios {
80 80
81struct mmc_host_ops { 81struct mmc_host_ops {
82 /* 82 /*
83 * Hosts that support power saving can use the 'enable' and 'disable' 83 * 'enable' is called when the host is claimed and 'disable' is called
84 * methods to exit and enter power saving states. 'enable' is called 84 * when the host is released. 'enable' and 'disable' are deprecated.
85 * when the host is claimed and 'disable' is called (or scheduled with
86 * a delay) when the host is released. The 'disable' is scheduled if
87 * the disable delay set by 'mmc_set_disable_delay()' is non-zero,
88 * otherwise 'disable' is called immediately. 'disable' may be
89 * scheduled repeatedly, to permit ever greater power saving at the
90 * expense of ever greater latency to re-enable. Rescheduling is
91 * determined by the return value of the 'disable' method. A positive
92 * value gives the delay in milliseconds.
93 *
94 * In the case where a host function (like set_ios) may be called
95 * with or without the host claimed, enabling and disabling can be
96 * done directly and will nest correctly. Call 'mmc_host_enable()' and
97 * 'mmc_host_lazy_disable()' for this purpose, but note that these
98 * functions must be paired.
99 *
100 * Alternatively, 'mmc_host_enable()' may be paired with
101 * 'mmc_host_disable()' which calls 'disable' immediately. In this
102 * case the 'disable' method will be called with 'lazy' set to 0.
103 * This is mainly useful for error paths.
104 *
105 * Because lazy disable may be called from a work queue, the 'disable'
106 * method must claim the host when 'lazy' != 0, which will work
107 * correctly because recursion is detected and handled.
108 */ 85 */
109 int (*enable)(struct mmc_host *host); 86 int (*enable)(struct mmc_host *host);
110 int (*disable)(struct mmc_host *host, int lazy); 87 int (*disable)(struct mmc_host *host);
111 /* 88 /*
112 * It is optional for the host to implement pre_req and post_req in 89 * It is optional for the host to implement pre_req and post_req in
113 * order to support double buffering of requests (prepare one 90 * order to support double buffering of requests (prepare one
@@ -218,7 +195,7 @@ struct mmc_host {
218#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 195#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
219#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 196#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
220#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 197#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
221#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ 198
222#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 199#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
223#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 200#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
224#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 201#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -301,13 +278,7 @@ struct mmc_host {
301 unsigned int removed:1; /* host is being removed */ 278 unsigned int removed:1; /* host is being removed */
302#endif 279#endif
303 280
304 /* Only used with MMC_CAP_DISABLE */
305 int enabled; /* host is enabled */
306 int rescan_disable; /* disable card detection */ 281 int rescan_disable; /* disable card detection */
307 int nesting_cnt; /* "enable" nesting count */
308 int en_dis_recurs; /* detect recursion */
309 unsigned int disable_delay; /* disable delay in msecs */
310 struct delayed_work disable; /* disabling work */
311 282
312 struct mmc_card *card; /* device attached to this host */ 283 struct mmc_card *card; /* device attached to this host */
313 284
@@ -407,17 +378,8 @@ int mmc_card_awake(struct mmc_host *host);
407int mmc_card_sleep(struct mmc_host *host); 378int mmc_card_sleep(struct mmc_host *host);
408int mmc_card_can_sleep(struct mmc_host *host); 379int mmc_card_can_sleep(struct mmc_host *host);
409 380
410int mmc_host_enable(struct mmc_host *host);
411int mmc_host_disable(struct mmc_host *host);
412int mmc_host_lazy_disable(struct mmc_host *host);
413int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 381int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
414 382
415static inline void mmc_set_disable_delay(struct mmc_host *host,
416 unsigned int disable_delay)
417{
418 host->disable_delay = disable_delay;
419}
420
421/* Module parameter */ 383/* Module parameter */
422extern bool mmc_assume_removable; 384extern bool mmc_assume_removable;
423 385