aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorWei WANG <wei_wang@realsil.com.cn>2013-02-08 02:24:27 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-13 18:24:12 -0500
commitc3481955f6c78c8dd99921759306d7469c999ec2 (patch)
treeae65ba72e1076dd94690f16c2d03cdce56d7f34d /drivers/mmc/host
parent0cd5b6d08c7bf8b2d81eb1413ea1463cc72487b1 (diff)
mfd: rtsx: Fix issue that booting OS with SD card inserted
Realtek card reader supports both SD and MS card. According to the settings of rtsx MFD driver, SD host will be probed before MS host. If we boot/reboot Linux with SD card inserted, the resetting flow of SD card will succeed, and the following resetting flow of MS is sure to fail. Then MS upper-level driver will ask rtsx driver to turn power off. This request leads to the result that the following SD commands fail and SD card can't be accessed again. In this commit, Realtek's SD and MS host driver will check whether the card that upper driver requesting is the one existing in the slot. If not, Realtek's host driver will refuse the operation to make sure the exlusive accessing at the same time. Signed-off-by: Wei WANG <wei_wang@realsil.com.cn> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/rtsx_pci_sdmmc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index f74b5adca642..468c92303167 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -678,12 +678,19 @@ static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
678 struct mmc_command *cmd = mrq->cmd; 678 struct mmc_command *cmd = mrq->cmd;
679 struct mmc_data *data = mrq->data; 679 struct mmc_data *data = mrq->data;
680 unsigned int data_size = 0; 680 unsigned int data_size = 0;
681 int err;
681 682
682 if (host->eject) { 683 if (host->eject) {
683 cmd->error = -ENOMEDIUM; 684 cmd->error = -ENOMEDIUM;
684 goto finish; 685 goto finish;
685 } 686 }
686 687
688 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD);
689 if (err) {
690 cmd->error = err;
691 goto finish;
692 }
693
687 mutex_lock(&pcr->pcr_mutex); 694 mutex_lock(&pcr->pcr_mutex);
688 695
689 rtsx_pci_start_run(pcr); 696 rtsx_pci_start_run(pcr);
@@ -901,6 +908,9 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
901 if (host->eject) 908 if (host->eject)
902 return; 909 return;
903 910
911 if (rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD))
912 return;
913
904 mutex_lock(&pcr->pcr_mutex); 914 mutex_lock(&pcr->pcr_mutex);
905 915
906 rtsx_pci_start_run(pcr); 916 rtsx_pci_start_run(pcr);
@@ -1073,6 +1083,10 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
1073 if (host->eject) 1083 if (host->eject)
1074 return -ENOMEDIUM; 1084 return -ENOMEDIUM;
1075 1085
1086 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD);
1087 if (err)
1088 return err;
1089
1076 mutex_lock(&pcr->pcr_mutex); 1090 mutex_lock(&pcr->pcr_mutex);
1077 1091
1078 rtsx_pci_start_run(pcr); 1092 rtsx_pci_start_run(pcr);
@@ -1122,6 +1136,10 @@ static int sdmmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
1122 if (host->eject) 1136 if (host->eject)
1123 return -ENOMEDIUM; 1137 return -ENOMEDIUM;
1124 1138
1139 err = rtsx_pci_card_exclusive_check(host->pcr, RTSX_SD_CARD);
1140 if (err)
1141 return err;
1142
1125 mutex_lock(&pcr->pcr_mutex); 1143 mutex_lock(&pcr->pcr_mutex);
1126 1144
1127 rtsx_pci_start_run(pcr); 1145 rtsx_pci_start_run(pcr);