diff options
author | Micky Ching <micky_ching@realsil.com.cn> | 2015-01-13 22:09:11 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-21 07:56:55 -0500 |
commit | b22217f966f585b69c823e0f525ee044e13d7976 (patch) | |
tree | 2e438853d20f99b6bd50ab307b62a05e4a090a63 /drivers/mmc | |
parent | 3e7cf90213e789bdc13f2638cc9d8b9993d5491e (diff) |
mmc: rtsx: finish request if no card exist
Return error-code directly if no card exist, this can
make card remove faster.
Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/rtsx_pci_sdmmc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 26c6a7c09c0a..b435806dd9f3 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c | |||
@@ -100,6 +100,11 @@ static void sd_print_debug_regs(struct realtek_pci_sdmmc *host) | |||
100 | #define sd_print_debug_regs(host) | 100 | #define sd_print_debug_regs(host) |
101 | #endif /* DEBUG */ | 101 | #endif /* DEBUG */ |
102 | 102 | ||
103 | static inline int sd_get_cd_int(struct realtek_pci_sdmmc *host) | ||
104 | { | ||
105 | return rtsx_pci_readl(host->pcr, RTSX_BIPR) & SD_EXIST; | ||
106 | } | ||
107 | |||
103 | static void sd_cmd_set_sd_cmd(struct rtsx_pcr *pcr, struct mmc_command *cmd) | 108 | static void sd_cmd_set_sd_cmd(struct rtsx_pcr *pcr, struct mmc_command *cmd) |
104 | { | 109 | { |
105 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_CMD0, 0xFF, | 110 | rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD_CMD0, 0xFF, |
@@ -798,7 +803,7 @@ static void sd_request(struct work_struct *work) | |||
798 | unsigned int data_size = 0; | 803 | unsigned int data_size = 0; |
799 | int err; | 804 | int err; |
800 | 805 | ||
801 | if (host->eject) { | 806 | if (host->eject || !sd_get_cd_int(host)) { |
802 | cmd->error = -ENOMEDIUM; | 807 | cmd->error = -ENOMEDIUM; |
803 | goto finish; | 808 | goto finish; |
804 | } | 809 | } |
@@ -1116,7 +1121,7 @@ static int sdmmc_get_cd(struct mmc_host *mmc) | |||
1116 | u32 val; | 1121 | u32 val; |
1117 | 1122 | ||
1118 | if (host->eject) | 1123 | if (host->eject) |
1119 | return -ENOMEDIUM; | 1124 | return cd; |
1120 | 1125 | ||
1121 | mutex_lock(&pcr->pcr_mutex); | 1126 | mutex_lock(&pcr->pcr_mutex); |
1122 | 1127 | ||