[PATCH] staging:rts_pstor:Fix SDIO issue

From: wei_wang
Date: Sat Oct 08 2011 - 22:03:49 EST


From: wwang <wei_wang@xxxxxxxxxxxxxx>

Fix a bug that SDIO and SD normal card would appear simultaneously if a SDIO card inserted.

Signed-off-by: wwang <wei_wang@xxxxxxxxxxxxxx>
---
drivers/staging/rts_pstor/sd.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c
index fb62eaf..9ce63f7 100644
--- a/drivers/staging/rts_pstor/sd.c
+++ b/drivers/staging/rts_pstor/sd.c
@@ -3094,6 +3094,7 @@ int reset_sd_card(struct rtsx_chip *chip)
{
struct sd_info *sd_card = &(chip->sd_card);
int retval;
+ int reset_pass = 0;

sd_init_reg_addr(chip);

@@ -3134,7 +3135,10 @@ int reset_sd_card(struct rtsx_chip *chip)

if (chip->sd_ctl & RESET_MMC_FIRST) {
retval = reset_mmc(chip);
- if ((retval != STATUS_SUCCESS) && !sd_check_err_code(chip, SD_NO_CARD)) {
+ if (retval != STATUS_SUCCESS) {
+ if (sd_check_err_code(chip, SD_NO_CARD))
+ TRACE_RET(chip, STATUS_FAIL);
+
retval = reset_sd(chip);
if (retval != STATUS_SUCCESS) {
if (CHECK_PID(chip, 0x5209)) {
@@ -3143,7 +3147,11 @@ int reset_sd_card(struct rtsx_chip *chip)
TRACE_RET(chip, STATUS_FAIL);
}
}
+ } else {
+ reset_pass = 1;
}
+ } else {
+ reset_pass = 1;
}
} else {
retval = reset_sd(chip);
@@ -3161,13 +3169,16 @@ int reset_sd_card(struct rtsx_chip *chip)

if (!chip->sd_io) {
retval = reset_mmc(chip);
+ if (retval == STATUS_SUCCESS)
+ reset_pass = 1;
}
+ } else {
+ reset_pass = 1;
}
}

- if (retval != STATUS_SUCCESS) {
+ if (!reset_pass)
TRACE_RET(chip, STATUS_FAIL);
- }

retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
if (retval != STATUS_SUCCESS) {
--
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/