aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-14 16:46:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-14 16:46:57 -0400
commit2625b10d8c37656cf410a464ed95942b3abbd1f6 (patch)
treef02fc44aaed07dceed2566b3fdf4dc64b786cb89 /drivers/mmc/core/core.c
parent489f7ab6c18cdd64a2d444e056d60a0e722f4ad7 (diff)
parent7f72134c32eb64c77d1fb35123ba8bf815bf797c (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc: (25 commits) atmel-mci: add MCI2 register definitions atmel-mci: Integrate AT91 specific definition in header file tmio_mmc: allow compilation for ASIC3 mmc_block: do not DMA to stack sdhci: Print ADMA status and pointer on debug tmio_mmc: fix clock setup tmio_mmc: map SD control registers after enabling the MFD cell tmio_mmc: correct probe return value for num_resources != 3 tmio_mmc: don't use set_irq_type tmio_mmc: add bus_shift support MFD,mmc: tmio_mmc: make HCLK configurable mmc_spi: don't use EINVAL for possible transmission errors cb710: more cleanup for the DEBUG case. sdhci: platform driver for SDHCI mxcmmc: remove frequency workaround cb710: handle DEBUG define in Makefile cb710: add missing parenthesis cb710: fix printk format string mmc: Driver for CB710/720 memory card reader (MMC part) pxamci: add regulator support. ...
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c107
1 files changed, 62 insertions, 45 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 264911732756..d84c880fac84 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -708,7 +708,13 @@ static void mmc_power_up(struct mmc_host *host)
708 */ 708 */
709 mmc_delay(10); 709 mmc_delay(10);
710 710
711 host->ios.clock = host->f_min; 711 if (host->f_min > 400000) {
712 pr_warning("%s: Minimum clock frequency too high for "
713 "identification mode\n", mmc_hostname(host));
714 host->ios.clock = host->f_min;
715 } else
716 host->ios.clock = 400000;
717
712 host->ios.power_mode = MMC_POWER_ON; 718 host->ios.power_mode = MMC_POWER_ON;
713 mmc_set_ios(host); 719 mmc_set_ios(host);
714 720
@@ -855,61 +861,72 @@ void mmc_rescan(struct work_struct *work)
855 861
856 mmc_bus_get(host); 862 mmc_bus_get(host);
857 863
858 if (host->bus_ops == NULL) { 864 /* if there is a card registered, check whether it is still present */
859 /* 865 if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead)
860 * Only we can add a new handler, so it's safe to 866 host->bus_ops->detect(host);
861 * release the lock here. 867
862 */ 868 mmc_bus_put(host);
869
870
871 mmc_bus_get(host);
872
873 /* if there still is a card present, stop here */
874 if (host->bus_ops != NULL) {
863 mmc_bus_put(host); 875 mmc_bus_put(host);
876 goto out;
877 }
864 878
865 if (host->ops->get_cd && host->ops->get_cd(host) == 0) 879 /* detect a newly inserted card */
866 goto out;
867 880
868 mmc_claim_host(host); 881 /*
882 * Only we can add a new handler, so it's safe to
883 * release the lock here.
884 */
885 mmc_bus_put(host);
869 886
870 mmc_power_up(host); 887 if (host->ops->get_cd && host->ops->get_cd(host) == 0)
871 mmc_go_idle(host); 888 goto out;
872 889
873 mmc_send_if_cond(host, host->ocr_avail); 890 mmc_claim_host(host);
874 891
875 /* 892 mmc_power_up(host);
876 * First we search for SDIO... 893 mmc_go_idle(host);
877 */
878 err = mmc_send_io_op_cond(host, 0, &ocr);
879 if (!err) {
880 if (mmc_attach_sdio(host, ocr))
881 mmc_power_off(host);
882 goto out;
883 }
884 894
885 /* 895 mmc_send_if_cond(host, host->ocr_avail);
886 * ...then normal SD...
887 */
888 err = mmc_send_app_op_cond(host, 0, &ocr);
889 if (!err) {
890 if (mmc_attach_sd(host, ocr))
891 mmc_power_off(host);
892 goto out;
893 }
894 896
895 /* 897 /*
896 * ...and finally MMC. 898 * First we search for SDIO...
897 */ 899 */
898 err = mmc_send_op_cond(host, 0, &ocr); 900 err = mmc_send_io_op_cond(host, 0, &ocr);
899 if (!err) { 901 if (!err) {
900 if (mmc_attach_mmc(host, ocr)) 902 if (mmc_attach_sdio(host, ocr))
901 mmc_power_off(host); 903 mmc_power_off(host);
902 goto out; 904 goto out;
903 } 905 }
904 906
905 mmc_release_host(host); 907 /*
906 mmc_power_off(host); 908 * ...then normal SD...
907 } else { 909 */
908 if (host->bus_ops->detect && !host->bus_dead) 910 err = mmc_send_app_op_cond(host, 0, &ocr);
909 host->bus_ops->detect(host); 911 if (!err) {
912 if (mmc_attach_sd(host, ocr))
913 mmc_power_off(host);
914 goto out;
915 }
910 916
911 mmc_bus_put(host); 917 /*
918 * ...and finally MMC.
919 */
920 err = mmc_send_op_cond(host, 0, &ocr);
921 if (!err) {
922 if (mmc_attach_mmc(host, ocr))
923 mmc_power_off(host);
924 goto out;
912 } 925 }
926
927 mmc_release_host(host);
928 mmc_power_off(host);
929
913out: 930out:
914 if (host->caps & MMC_CAP_NEEDS_POLL) 931 if (host->caps & MMC_CAP_NEEDS_POLL)
915 mmc_schedule_delayed_work(&host->detect, HZ); 932 mmc_schedule_delayed_work(&host->detect, HZ);