hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mmc/core/sdio.c
....@@ -1,16 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * linux/drivers/mmc/sdio.c
34 *
45 * Copyright 2006-2007 Pierre Ossman
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or (at
9
- * your option) any later version.
106 */
117
128 #include <linux/err.h>
13
-#include <linux/module.h>
149 #include <linux/pm_runtime.h>
1510
1611 #include <linux/mmc/host.h>
....@@ -31,6 +26,48 @@
3126 #include "sd_ops.h"
3227 #include "sdio_ops.h"
3328 #include "sdio_cis.h"
29
+
30
+MMC_DEV_ATTR(vendor, "0x%04x\n", card->cis.vendor);
31
+MMC_DEV_ATTR(device, "0x%04x\n", card->cis.device);
32
+MMC_DEV_ATTR(revision, "%u.%u\n", card->major_rev, card->minor_rev);
33
+MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr);
34
+MMC_DEV_ATTR(rca, "0x%04x\n", card->rca);
35
+
36
+#define sdio_info_attr(num) \
37
+static ssize_t info##num##_show(struct device *dev, struct device_attribute *attr, char *buf) \
38
+{ \
39
+ struct mmc_card *card = mmc_dev_to_card(dev); \
40
+ \
41
+ if (num > card->num_info) \
42
+ return -ENODATA; \
43
+ if (!card->info[num-1][0]) \
44
+ return 0; \
45
+ return sprintf(buf, "%s\n", card->info[num-1]); \
46
+} \
47
+static DEVICE_ATTR_RO(info##num)
48
+
49
+sdio_info_attr(1);
50
+sdio_info_attr(2);
51
+sdio_info_attr(3);
52
+sdio_info_attr(4);
53
+
54
+static struct attribute *sdio_std_attrs[] = {
55
+ &dev_attr_vendor.attr,
56
+ &dev_attr_device.attr,
57
+ &dev_attr_revision.attr,
58
+ &dev_attr_info1.attr,
59
+ &dev_attr_info2.attr,
60
+ &dev_attr_info3.attr,
61
+ &dev_attr_info4.attr,
62
+ &dev_attr_ocr.attr,
63
+ &dev_attr_rca.attr,
64
+ NULL,
65
+};
66
+ATTRIBUTE_GROUPS(sdio_std);
67
+
68
+static struct device_type sdio_type = {
69
+ .groups = sdio_std_groups,
70
+};
3471
3572 static int sdio_read_fbr(struct sdio_func *func)
3673 {
....@@ -163,15 +200,18 @@
163200 if (mmc_host_uhs(card->host)) {
164201 if (data & SDIO_UHS_DDR50)
165202 card->sw_caps.sd3_bus_mode
166
- |= SD_MODE_UHS_DDR50;
203
+ |= SD_MODE_UHS_DDR50 | SD_MODE_UHS_SDR50
204
+ | SD_MODE_UHS_SDR25 | SD_MODE_UHS_SDR12;
167205
168206 if (data & SDIO_UHS_SDR50)
169207 card->sw_caps.sd3_bus_mode
170
- |= SD_MODE_UHS_SDR50;
208
+ |= SD_MODE_UHS_SDR50 | SD_MODE_UHS_SDR25
209
+ | SD_MODE_UHS_SDR12;
171210
172211 if (data & SDIO_UHS_SDR104)
173212 card->sw_caps.sd3_bus_mode
174
- |= SD_MODE_UHS_SDR104;
213
+ |= SD_MODE_UHS_SDR104 | SD_MODE_UHS_SDR50
214
+ | SD_MODE_UHS_SDR25 | SD_MODE_UHS_SDR12;
175215 }
176216
177217 ret = mmc_io_rw_direct(card, 0, 0,
....@@ -290,30 +330,49 @@
290330 return 0;
291331 }
292332
333
+static int sdio_disable_4bit_bus(struct mmc_card *card)
334
+{
335
+ int err;
336
+
337
+ if (card->type == MMC_TYPE_SDIO)
338
+ goto out;
339
+
340
+ if (!(card->host->caps & MMC_CAP_4_BIT_DATA))
341
+ return 0;
342
+
343
+ if (!(card->scr.bus_widths & SD_SCR_BUS_WIDTH_4))
344
+ return 0;
345
+
346
+ err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
347
+ if (err)
348
+ return err;
349
+
350
+out:
351
+ return sdio_disable_wide(card);
352
+}
353
+
293354
294355 static int sdio_enable_4bit_bus(struct mmc_card *card)
295356 {
296357 int err;
297358
359
+ err = sdio_enable_wide(card);
360
+ if (err <= 0)
361
+ return err;
298362 if (card->type == MMC_TYPE_SDIO)
299
- err = sdio_enable_wide(card);
300
- else if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
301
- (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
363
+ goto out;
364
+
365
+ if (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4) {
302366 err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
303
- if (err)
367
+ if (err) {
368
+ sdio_disable_wide(card);
304369 return err;
305
- err = sdio_enable_wide(card);
306
- if (err <= 0)
307
- mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
308
- } else
309
- return 0;
310
-
311
- if (err > 0) {
312
- mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
313
- err = 0;
370
+ }
314371 }
372
+out:
373
+ mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
315374
316
- return err;
375
+ return 0;
317376 }
318377
319378
....@@ -505,10 +564,8 @@
505564 max_rate = min_not_zero(card->quirk_max_rate,
506565 card->sw_caps.uhs_max_dtr);
507566
508
- if (bus_speed) {
509
- mmc_set_timing(card->host, timing);
510
- mmc_set_clock(card->host, max_rate);
511
- }
567
+ mmc_set_timing(card->host, timing);
568
+ mmc_set_clock(card->host, max_rate);
512569
513570 return 0;
514571 }
....@@ -548,13 +605,33 @@
548605 return err;
549606 }
550607
551
-static void mmc_sdio_resend_if_cond(struct mmc_host *host,
552
- struct mmc_card *card)
608
+static int mmc_sdio_pre_init(struct mmc_host *host, u32 ocr,
609
+ struct mmc_card *card)
553610 {
611
+ if (card)
612
+ mmc_remove_card(card);
613
+
614
+ /*
615
+ * Reset the card by performing the same steps that are taken by
616
+ * mmc_rescan_try_freq() and mmc_attach_sdio() during a "normal" probe.
617
+ *
618
+ * sdio_reset() is technically not needed. Having just powered up the
619
+ * hardware, it should already be in reset state. However, some
620
+ * platforms (such as SD8686 on OLPC) do not instantly cut power,
621
+ * meaning that a reset is required when restoring power soon after
622
+ * powering off. It is harmless in other cases.
623
+ *
624
+ * The CMD5 reset (mmc_send_io_op_cond()), according to the SDIO spec,
625
+ * is not necessary for non-removable cards. However, it is required
626
+ * for OLPC SD8686 (which expects a [CMD5,5,3,7] init sequence), and
627
+ * harmless in other situations.
628
+ *
629
+ */
630
+
554631 sdio_reset(host);
555632 mmc_go_idle(host);
556
- mmc_send_if_cond(host, host->ocr_avail);
557
- mmc_remove_card(card);
633
+ mmc_send_if_cond(host, ocr);
634
+ return mmc_send_io_op_cond(host, 0, NULL);
558635 }
559636
560637 /*
....@@ -564,7 +641,7 @@
564641 * we're trying to reinitialise.
565642 */
566643 static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
567
- struct mmc_card *oldcard, int powered_resume)
644
+ struct mmc_card *oldcard)
568645 {
569646 struct mmc_card *card;
570647 int err;
....@@ -587,25 +664,9 @@
587664 /*
588665 * Inform the card of the voltage
589666 */
590
-#ifdef CONFIG_SDIO_KEEPALIVE
591
- if (!(host->chip_alive)) {
592
- if (!powered_resume) {
593
- err = mmc_send_io_op_cond(host, ocr, &rocr);
594
- if (err) {
595
- pr_err("%s: mmc_send_io_op_cond() err=%d\n", __func__, err);
596
- goto err;
597
- }
598
- }
599
- } else {
600
- rocr = 0xa0ffff00;
601
- }
602
-#else
603
- if (!powered_resume) {
604
- err = mmc_send_io_op_cond(host, ocr, &rocr);
605
- if (err)
606
- goto err;
607
- }
608
-#endif
667
+ err = mmc_send_io_op_cond(host, ocr, &rocr);
668
+ if (err)
669
+ return err;
609670
610671 /*
611672 * For SPI, enable CRC as appropriate.
....@@ -613,17 +674,15 @@
613674 if (mmc_host_is_spi(host)) {
614675 err = mmc_spi_set_crc(host, use_spi_crc);
615676 if (err)
616
- goto err;
677
+ return err;
617678 }
618679
619680 /*
620681 * Allocate card structure.
621682 */
622
- card = mmc_alloc_card(host, NULL);
623
- if (IS_ERR(card)) {
624
- err = PTR_ERR(card);
625
- goto err;
626
- }
683
+ card = mmc_alloc_card(host, &sdio_type);
684
+ if (IS_ERR(card))
685
+ return PTR_ERR(card);
627686
628687 if ((rocr & R4_MEMORY_PRESENT) &&
629688 mmc_sd_get_cid(host, ocr & rocr, card->raw_cid, NULL) == 0) {
....@@ -631,15 +690,15 @@
631690
632691 if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
633692 memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
634
- mmc_remove_card(card);
635
- return -ENOENT;
693
+ err = -ENOENT;
694
+ goto mismatch;
636695 }
637696 } else {
638697 card->type = MMC_TYPE_SDIO;
639698
640699 if (oldcard && oldcard->type != MMC_TYPE_SDIO) {
641
- mmc_remove_card(card);
642
- return -ENOENT;
700
+ err = -ENOENT;
701
+ goto mismatch;
643702 }
644703 }
645704
....@@ -662,10 +721,10 @@
662721 * try to init uhs card. sdio_read_cccr will take over this task
663722 * to make sure which speed mode should work.
664723 */
665
- if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) {
724
+ if (rocr & ocr & R4_18V_PRESENT) {
666725 err = mmc_set_uhs_voltage(host, ocr_card);
667726 if (err == -EAGAIN) {
668
- mmc_sdio_resend_if_cond(host, card);
727
+ mmc_sdio_pre_init(host, ocr_card, card);
669728 retries--;
670729 goto try_again;
671730 } else if (err) {
....@@ -676,20 +735,10 @@
676735 /*
677736 * For native busses: set card RCA and quit open drain mode.
678737 */
679
- if (!powered_resume && !mmc_host_is_spi(host)) {
680
-#ifdef CONFIG_SDIO_KEEPALIVE
681
- if (!(host->chip_alive)) {
682
- err = mmc_send_relative_addr(host, &card->rca);
683
- if (err)
684
- goto remove;
685
- } else {
686
- card->rca = 1;
687
- }
688
-#else
738
+ if (!mmc_host_is_spi(host)) {
689739 err = mmc_send_relative_addr(host, &card->rca);
690740 if (err)
691741 goto remove;
692
-#endif
693742
694743 /*
695744 * Update oldcard with the new RCA received from the SDIO
....@@ -706,7 +755,7 @@
706755 if (!oldcard && card->type == MMC_TYPE_SD_COMBO) {
707756 err = mmc_sd_get_csd(host, card);
708757 if (err)
709
- return err;
758
+ goto remove;
710759
711760 mmc_decode_cid(card);
712761 }
....@@ -714,7 +763,7 @@
714763 /*
715764 * Select card, as all following commands rely on that.
716765 */
717
- if (!powered_resume && !mmc_host_is_spi(host)) {
766
+ if (!mmc_host_is_spi(host)) {
718767 err = mmc_select_card(card);
719768 if (err)
720769 goto remove;
....@@ -733,7 +782,12 @@
733782 mmc_set_timing(card->host, MMC_TIMING_SD_HS);
734783 }
735784
736
- goto finish;
785
+ if (oldcard)
786
+ mmc_remove_card(card);
787
+ else
788
+ host->card = card;
789
+
790
+ return 0;
737791 }
738792
739793 /*
....@@ -742,7 +796,7 @@
742796 */
743797 err = sdio_read_cccr(card, ocr);
744798 if (err) {
745
- mmc_sdio_resend_if_cond(host, card);
799
+ mmc_sdio_pre_init(host, ocr_card, card);
746800 if (ocr & R4_18V_PRESENT) {
747801 /* Retry init sequence, but without R4_18V_PRESENT. */
748802 retries = 0;
....@@ -759,13 +813,14 @@
759813 goto remove;
760814
761815 if (oldcard) {
762
- int same = (card->cis.vendor == oldcard->cis.vendor &&
763
- card->cis.device == oldcard->cis.device);
764
- mmc_remove_card(card);
765
- if (!same)
766
- return -ENOENT;
767
-
768
- card = oldcard;
816
+ if (card->cis.vendor == oldcard->cis.vendor &&
817
+ card->cis.device == oldcard->cis.device) {
818
+ mmc_remove_card(card);
819
+ card = oldcard;
820
+ } else {
821
+ err = -ENOENT;
822
+ goto mismatch;
823
+ }
769824 }
770825
771826 mmc_fixup_device(card, sdio_fixup_methods);
....@@ -826,33 +881,27 @@
826881 err = -EINVAL;
827882 goto remove;
828883 }
829
-finish:
830
- if (!oldcard)
831
- host->card = card;
884
+
885
+ host->card = card;
832886 return 0;
833887
888
+mismatch:
889
+ pr_debug("%s: Perhaps the card was replaced\n", mmc_hostname(host));
834890 remove:
835
- if (!oldcard)
891
+ if (oldcard != card)
836892 mmc_remove_card(card);
837
-
838
-err:
839893 return err;
840894 }
841895
842
-static int mmc_sdio_reinit_card(struct mmc_host *host, bool powered_resume)
896
+static int mmc_sdio_reinit_card(struct mmc_host *host)
843897 {
844898 int ret;
845899
846
- sdio_reset(host);
847
- mmc_go_idle(host);
848
- mmc_send_if_cond(host, host->card->ocr);
849
-
850
- ret = mmc_send_io_op_cond(host, 0, NULL);
900
+ ret = mmc_sdio_pre_init(host, host->card->ocr, NULL);
851901 if (ret)
852902 return ret;
853903
854
- return mmc_sdio_init_card(host, host->card->ocr, host->card,
855
- powered_resume);
904
+ return mmc_sdio_init_card(host, host->card->ocr, host->card);
856905 }
857906
858907 /*
....@@ -938,21 +987,37 @@
938987 */
939988 static int mmc_sdio_pre_suspend(struct mmc_host *host)
940989 {
941
- int i, err = 0;
990
+ int i;
942991
943992 for (i = 0; i < host->card->sdio_funcs; i++) {
944993 struct sdio_func *func = host->card->sdio_func[i];
945994 if (func && sdio_func_present(func) && func->dev.driver) {
946995 const struct dev_pm_ops *pmops = func->dev.driver->pm;
947
- if (!pmops || !pmops->suspend || !pmops->resume) {
996
+ if (!pmops || !pmops->suspend || !pmops->resume)
948997 /* force removal of entire card in that case */
949
- err = -ENOSYS;
950
- break;
951
- }
998
+ goto remove;
952999 }
9531000 }
9541001
955
- return err;
1002
+ return 0;
1003
+
1004
+remove:
1005
+ if (!mmc_card_is_removable(host)) {
1006
+ dev_warn(mmc_dev(host),
1007
+ "missing suspend/resume ops for non-removable SDIO card\n");
1008
+ /* Don't remove a non-removable card - we can't re-detect it. */
1009
+ return 0;
1010
+ }
1011
+
1012
+ /* Remove the SDIO card and let it be re-detected later on. */
1013
+ mmc_sdio_remove(host);
1014
+ mmc_claim_host(host);
1015
+ mmc_detach_bus(host);
1016
+ mmc_power_off(host);
1017
+ mmc_release_host(host);
1018
+ host->pm_flags = 0;
1019
+
1020
+ return 0;
9561021 }
9571022
9581023 /*
....@@ -960,6 +1025,8 @@
9601025 */
9611026 static int mmc_sdio_suspend(struct mmc_host *host)
9621027 {
1028
+ WARN_ON(host->sdio_irqs && !mmc_card_keep_power(host));
1029
+
9631030 /* Prevent processing of SDIO IRQs in suspended state. */
9641031 mmc_card_set_suspended(host->card);
9651032 cancel_delayed_work_sync(&host->sdio_irq_work);
....@@ -967,7 +1034,7 @@
9671034 mmc_claim_host(host);
9681035
9691036 if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host))
970
- sdio_disable_wide(host->card);
1037
+ sdio_disable_4bit_bus(host->card);
9711038
9721039 if (!mmc_card_keep_power(host)) {
9731040 mmc_power_off(host);
....@@ -988,7 +1055,11 @@
9881055 /* Basic card reinitialization. */
9891056 mmc_claim_host(host);
9901057
991
- /* Restore power if needed */
1058
+ /*
1059
+ * Restore power and reinitialize the card when needed. Note that a
1060
+ * removable card is checked from a detect work later on in the resume
1061
+ * process.
1062
+ */
9921063 if (!mmc_card_keep_power(host)) {
9931064 mmc_power_up(host, host->card->ocr);
9941065 /*
....@@ -1002,12 +1073,8 @@
10021073 pm_runtime_set_active(&host->card->dev);
10031074 pm_runtime_enable(&host->card->dev);
10041075 }
1005
- }
1006
-
1007
- /* No need to reinitialize powered-resumed nonremovable cards */
1008
- if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) {
1009
- err = mmc_sdio_reinit_card(host, mmc_card_keep_power(host));
1010
- } else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
1076
+ err = mmc_sdio_reinit_card(host);
1077
+ } else if (mmc_card_wake_sdio_irq(host)) {
10111078 /* We may have switched to 1-bit mode during suspend */
10121079 err = sdio_enable_4bit_bus(host->card);
10131080 }
....@@ -1022,7 +1089,7 @@
10221089 if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
10231090 wake_up_process(host->sdio_irq_thread);
10241091 else if (host->caps & MMC_CAP_SDIO_IRQ)
1025
- host->ops->enable_sdio_irq(host, 1);
1092
+ queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
10261093 }
10271094
10281095 out:
....@@ -1030,38 +1097,6 @@
10301097
10311098 host->pm_flags &= ~MMC_PM_KEEP_POWER;
10321099 return err;
1033
-}
1034
-
1035
-static int mmc_sdio_power_restore(struct mmc_host *host)
1036
-{
1037
- int ret;
1038
-
1039
- /*
1040
- * Reset the card by performing the same steps that are taken by
1041
- * mmc_rescan_try_freq() and mmc_attach_sdio() during a "normal" probe.
1042
- *
1043
- * sdio_reset() is technically not needed. Having just powered up the
1044
- * hardware, it should already be in reset state. However, some
1045
- * platforms (such as SD8686 on OLPC) do not instantly cut power,
1046
- * meaning that a reset is required when restoring power soon after
1047
- * powering off. It is harmless in other cases.
1048
- *
1049
- * The CMD5 reset (mmc_send_io_op_cond()), according to the SDIO spec,
1050
- * is not necessary for non-removable cards. However, it is required
1051
- * for OLPC SD8686 (which expects a [CMD5,5,3,7] init sequence), and
1052
- * harmless in other situations.
1053
- *
1054
- */
1055
-
1056
- mmc_claim_host(host);
1057
-
1058
- ret = mmc_sdio_reinit_card(host, mmc_card_keep_power(host));
1059
- if (!ret && host->sdio_irqs)
1060
- mmc_signal_sdio_irq(host);
1061
-
1062
- mmc_release_host(host);
1063
-
1064
- return ret;
10651100 }
10661101
10671102 static int mmc_sdio_runtime_suspend(struct mmc_host *host)
....@@ -1081,16 +1116,42 @@
10811116 /* Restore power and re-initialize. */
10821117 mmc_claim_host(host);
10831118 mmc_power_up(host, host->card->ocr);
1084
- ret = mmc_sdio_power_restore(host);
1119
+ ret = mmc_sdio_reinit_card(host);
10851120 mmc_release_host(host);
10861121
10871122 return ret;
10881123 }
10891124
1125
+/*
1126
+ * SDIO HW reset
1127
+ *
1128
+ * Returns 0 if the HW reset was executed synchronously, returns 1 if the HW
1129
+ * reset was asynchronously scheduled, else a negative error code.
1130
+ */
10901131 static int mmc_sdio_hw_reset(struct mmc_host *host)
10911132 {
1092
- mmc_power_cycle(host, host->card->ocr);
1093
- return mmc_sdio_power_restore(host);
1133
+ struct mmc_card *card = host->card;
1134
+
1135
+ /*
1136
+ * In case the card is shared among multiple func drivers, reset the
1137
+ * card through a rescan work. In this way it will be removed and
1138
+ * re-detected, thus all func drivers becomes informed about it.
1139
+ */
1140
+ if (atomic_read(&card->sdio_funcs_probed) > 1) {
1141
+ if (mmc_card_removed(card))
1142
+ return 1;
1143
+ host->rescan_entered = 0;
1144
+ mmc_card_set_removed(card);
1145
+ _mmc_detect_change(host, 0, false);
1146
+ return 1;
1147
+ }
1148
+
1149
+ /*
1150
+ * A single func driver has been probed, then let's skip the heavy
1151
+ * hotplug dance above and execute the reset immediately.
1152
+ */
1153
+ mmc_power_cycle(host, card->ocr);
1154
+ return mmc_sdio_reinit_card(host);
10941155 }
10951156
10961157 static int mmc_sdio_sw_reset(struct mmc_host *host)
....@@ -1102,7 +1163,7 @@
11021163 mmc_set_initial_state(host);
11031164 mmc_set_initial_signal_voltage(host);
11041165
1105
- return mmc_sdio_reinit_card(host, 0);
1166
+ return mmc_sdio_reinit_card(host);
11061167 }
11071168
11081169 static const struct mmc_bus_ops mmc_sdio_ops = {
....@@ -1130,21 +1191,9 @@
11301191
11311192 WARN_ON(!host->claimed);
11321193
1133
-#ifdef CONFIG_SDIO_KEEPALIVE
1134
- if (!(host->chip_alive)) {
1135
- err = mmc_send_io_op_cond(host, 0, &ocr);
1136
- if (err) {
1137
- pr_err("%s mmc_send_io_op_cond err: %d\n", mmc_hostname(host), err);
1138
- return err;
1139
- }
1140
- } else {
1141
- ocr = 0x20ffff00;
1142
- }
1143
-#else
11441194 err = mmc_send_io_op_cond(host, 0, &ocr);
11451195 if (err)
11461196 return err;
1147
-#endif
11481197
11491198 mmc_attach_bus(host, &mmc_sdio_ops);
11501199 if (host->ocr_avail_sdio)
....@@ -1164,7 +1213,7 @@
11641213 /*
11651214 * Detect and init the card.
11661215 */
1167
- err = mmc_sdio_init_card(host, rocr, NULL, 0);
1216
+ err = mmc_sdio_init_card(host, rocr, NULL);
11681217 if (err)
11691218 goto err;
11701219
....@@ -1215,11 +1264,6 @@
12151264 pm_runtime_enable(&card->sdio_func[i]->dev);
12161265 }
12171266
1218
-#ifdef CONFIG_SDIO_KEEPALIVE
1219
- if (host->card->sdio_func[1])
1220
- host->card->sdio_func[1]->card_alive = host->chip_alive;
1221
-#endif
1222
-
12231267 /*
12241268 * First add the card to the driver model...
12251269 */
....@@ -1264,48 +1308,3 @@
12641308 return err;
12651309 }
12661310
1267
-int sdio_reset_comm(struct mmc_card *card)
1268
-{
1269
- struct mmc_host *host = card->host;
1270
- u32 ocr;
1271
- u32 rocr;
1272
- int err;
1273
-
1274
-#ifdef CONFIG_SDIO_KEEPALIVE
1275
- if (host->chip_alive)
1276
- host->chip_alive = 0;
1277
-#endif
1278
-
1279
- printk("%s():\n", __func__);
1280
- mmc_claim_host(host);
1281
-
1282
- mmc_retune_disable(host);
1283
-
1284
- mmc_power_cycle(host, host->card->ocr);
1285
- mmc_go_idle(host);
1286
-
1287
- mmc_set_clock(host, host->f_min);
1288
-
1289
- err = mmc_send_io_op_cond(host, 0, &ocr);
1290
- if (err)
1291
- goto err;
1292
-
1293
- rocr = mmc_select_voltage(host, ocr);
1294
- if (!rocr) {
1295
- err = -EINVAL;
1296
- goto err;
1297
- }
1298
-
1299
- err = mmc_sdio_init_card(host, rocr, card, 0);
1300
- if (err)
1301
- goto err;
1302
-
1303
- mmc_release_host(host);
1304
- return 0;
1305
-err:
1306
- printk("%s: Error resetting SDIO communications (%d)\n",
1307
- mmc_hostname(host), err);
1308
- mmc_release_host(host);
1309
- return err;
1310
-}
1311
-EXPORT_SYMBOL(sdio_reset_comm);