aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2012-02-29 02:17:21 -0500
committerChris Ball <cjb@laptop.org>2012-03-27 12:20:03 -0400
commit907d2e7cc7ebba4ab398422a7f0435e1802be65b (patch)
tree40e51b724bf01a9a507c83c2f1152ec67d5c9a7e /drivers/mmc
parent4b1a61705a563edb951b8fd9734bcb14286a7888 (diff)
mmc: start removing enable / disable API
Most parts of the enable / disable API are no longer used and can be removed. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Tested-by: Venkatraman S <svenkatr@ti.com> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-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
5 files changed, 18 insertions, 190 deletions
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;