aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2009-09-22 19:44:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:33 -0400
commit9feae246963c648b212abad0f0eb8938de5f5fe5 (patch)
treefefcc438ab0b8e502c35950e588664ab07ddc439 /drivers/mmc/core
parent319a3f1429c91147058ac26c5f5bac8ec1730bc6 (diff)
mmc: add MMC_CAP_NONREMOVABLE host capability
eMMC's are not removable, so unsafe resume is OK always. To permit this a new host capability MMC_CAP_NONREMOVABLE has been added and suspend / resume updated accordingly. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Acked-by: Matt Fleming <matt@console-pimps.org> Cc: Ian Molton <ian@mnementh.co.uk> Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com> Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com> Cc: Denis Karpov <ext-denis.2.karpov@nokia.com> Cc: Pierre Ossman <pierre@ossman.eu> Cc: Philip Langdale <philipl@overt.org> Cc: "Madhusudhan" <madhu.cr@ti.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/mmc.c41
-rw-r--r--drivers/mmc/core/sd.c41
2 files changed, 68 insertions, 14 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 2fb9d5f271e..995db1853a8 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -507,8 +507,6 @@ static void mmc_detect(struct mmc_host *host)
507 } 507 }
508} 508}
509 509
510#ifdef CONFIG_MMC_UNSAFE_RESUME
511
512/* 510/*
513 * Suspend callback from host. 511 * Suspend callback from host.
514 */ 512 */
@@ -551,20 +549,49 @@ static void mmc_resume(struct mmc_host *host)
551 549
552} 550}
553 551
554#else 552#ifdef CONFIG_MMC_UNSAFE_RESUME
555 553
556#define mmc_suspend NULL 554static const struct mmc_bus_ops mmc_ops = {
557#define mmc_resume NULL 555 .remove = mmc_remove,
556 .detect = mmc_detect,
557 .suspend = mmc_suspend,
558 .resume = mmc_resume,
559};
558 560
559#endif 561static void mmc_attach_bus_ops(struct mmc_host *host)
562{
563 mmc_attach_bus(host, &mmc_ops);
564}
565
566#else
560 567
561static const struct mmc_bus_ops mmc_ops = { 568static const struct mmc_bus_ops mmc_ops = {
562 .remove = mmc_remove, 569 .remove = mmc_remove,
563 .detect = mmc_detect, 570 .detect = mmc_detect,
571 .suspend = NULL,
572 .resume = NULL,
573};
574
575static const struct mmc_bus_ops mmc_ops_unsafe = {
576 .remove = mmc_remove,
577 .detect = mmc_detect,
564 .suspend = mmc_suspend, 578 .suspend = mmc_suspend,
565 .resume = mmc_resume, 579 .resume = mmc_resume,
566}; 580};
567 581
582static void mmc_attach_bus_ops(struct mmc_host *host)
583{
584 const struct mmc_bus_ops *bus_ops;
585
586 if (host->caps & MMC_CAP_NONREMOVABLE)
587 bus_ops = &mmc_ops_unsafe;
588 else
589 bus_ops = &mmc_ops;
590 mmc_attach_bus(host, bus_ops);
591}
592
593#endif
594
568/* 595/*
569 * Starting point for MMC card init. 596 * Starting point for MMC card init.
570 */ 597 */
@@ -575,7 +602,7 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
575 BUG_ON(!host); 602 BUG_ON(!host);
576 WARN_ON(!host->claimed); 603 WARN_ON(!host->claimed);
577 604
578 mmc_attach_bus(host, &mmc_ops); 605 mmc_attach_bus_ops(host);
579 606
580 /* 607 /*
581 * We need to get OCR a different way for SPI. 608 * We need to get OCR a different way for SPI.
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 7ad646fe077..92fa9dceca7 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -561,8 +561,6 @@ static void mmc_sd_detect(struct mmc_host *host)
561 } 561 }
562} 562}
563 563
564#ifdef CONFIG_MMC_UNSAFE_RESUME
565
566/* 564/*
567 * Suspend callback from host. 565 * Suspend callback from host.
568 */ 566 */
@@ -605,20 +603,49 @@ static void mmc_sd_resume(struct mmc_host *host)
605 603
606} 604}
607 605
608#else 606#ifdef CONFIG_MMC_UNSAFE_RESUME
609 607
610#define mmc_sd_suspend NULL 608static const struct mmc_bus_ops mmc_sd_ops = {
611#define mmc_sd_resume NULL 609 .remove = mmc_sd_remove,
610 .detect = mmc_sd_detect,
611 .suspend = mmc_sd_suspend,
612 .resume = mmc_sd_resume,
613};
612 614
613#endif 615static void mmc_sd_attach_bus_ops(struct mmc_host *host)
616{
617 mmc_attach_bus(host, &mmc_sd_ops);
618}
619
620#else
614 621
615static const struct mmc_bus_ops mmc_sd_ops = { 622static const struct mmc_bus_ops mmc_sd_ops = {
616 .remove = mmc_sd_remove, 623 .remove = mmc_sd_remove,
617 .detect = mmc_sd_detect, 624 .detect = mmc_sd_detect,
625 .suspend = NULL,
626 .resume = NULL,
627};
628
629static const struct mmc_bus_ops mmc_sd_ops_unsafe = {
630 .remove = mmc_sd_remove,
631 .detect = mmc_sd_detect,
618 .suspend = mmc_sd_suspend, 632 .suspend = mmc_sd_suspend,
619 .resume = mmc_sd_resume, 633 .resume = mmc_sd_resume,
620}; 634};
621 635
636static void mmc_sd_attach_bus_ops(struct mmc_host *host)
637{
638 const struct mmc_bus_ops *bus_ops;
639
640 if (host->caps & MMC_CAP_NONREMOVABLE)
641 bus_ops = &mmc_sd_ops_unsafe;
642 else
643 bus_ops = &mmc_sd_ops;
644 mmc_attach_bus(host, bus_ops);
645}
646
647#endif
648
622/* 649/*
623 * Starting point for SD card init. 650 * Starting point for SD card init.
624 */ 651 */
@@ -629,7 +656,7 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
629 BUG_ON(!host); 656 BUG_ON(!host);
630 WARN_ON(!host->claimed); 657 WARN_ON(!host->claimed);
631 658
632 mmc_attach_bus(host, &mmc_sd_ops); 659 mmc_sd_attach_bus_ops(host);
633 660
634 /* 661 /*
635 * We need to get OCR a different way for SPI. 662 * We need to get OCR a different way for SPI.