mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging:rts_pstor:Fix SDIO issue
@ 2011-10-09  2:03 wei_wang
  2011-10-09  6:06 ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: wei_wang @ 2011-10-09  2:03 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel; +Cc: wwang

From: wwang <wei_wang@realsil.com.cn>

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

Signed-off-by: wwang <wei_wang@realsil.com.cn>
---
 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


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH] staging:rts_pstor:Fix SDIO issue
@ 2011-10-10  1:51 wei_wang
  2011-10-10  6:12 ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: wei_wang @ 2011-10-10  1:51 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel; +Cc: wwang

From: wwang <wei_wang@realsil.com.cn>

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

Signed-off-by: wwang <wei_wang@realsil.com.cn>
---
 drivers/staging/rts_pstor/sd.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c
index fb62eaf..ebf529a 100644
--- a/drivers/staging/rts_pstor/sd.c
+++ b/drivers/staging/rts_pstor/sd.c
@@ -3134,14 +3134,15 @@ 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)) {
-					retval = sd_change_bank_voltage(chip, SD_IO_3V3);
-					if (retval != STATUS_SUCCESS) {
-						TRACE_RET(chip, STATUS_FAIL);
-					}
+					sd_change_bank_voltage(chip, SD_IO_3V3);
+					TRACE_RET(chip, STATUS_FAIL);
 				}
 			}
 		}
@@ -3157,17 +3158,16 @@ int reset_sd_card(struct rtsx_chip *chip)
 				if (retval != STATUS_SUCCESS) {
 					TRACE_RET(chip, STATUS_FAIL);
 				}
+				retval = STATUS_FAIL;
 			}
 
-			if (!chip->sd_io) {
+			if (!chip->sd_io)
 				retval = reset_mmc(chip);
-			}
 		}
 	}
 
-	if (retval != STATUS_SUCCESS) {
+	if (retval != STATUS_SUCCESS)
 		TRACE_RET(chip, STATUS_FAIL);
-	}
 
 	retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
 	if (retval != STATUS_SUCCESS) {
-- 
1.7.7


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH] staging:rts_pstor:Fix SDIO issue
@ 2011-10-10  6:47 wei_wang
  2011-10-10  7:55 ` Dan Carpenter
  0 siblings, 1 reply; 9+ messages in thread
From: wei_wang @ 2011-10-10  6:47 UTC (permalink / raw)
  To: gregkh, devel, linux-kernel; +Cc: wwang

From: wwang <wei_wang@realsil.com.cn>

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

Signed-off-by: wwang <wei_wang@realsil.com.cn>
---
 drivers/staging/rts_pstor/sd.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c
index fb62eaf..aab6909 100644
--- a/drivers/staging/rts_pstor/sd.c
+++ b/drivers/staging/rts_pstor/sd.c
@@ -3134,41 +3134,40 @@ 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)) {
-					retval = sd_change_bank_voltage(chip, SD_IO_3V3);
-					if (retval != STATUS_SUCCESS) {
-						TRACE_RET(chip, STATUS_FAIL);
-					}
-				}
+				if (CHECK_PID(chip, 0x5209))
+					sd_change_bank_voltage(chip, SD_IO_3V3);
+
+				TRACE_RET(chip, STATUS_FAIL);
 			}
 		}
 	} else {
 		retval = reset_sd(chip);
 		if (retval != STATUS_SUCCESS) {
-			if (sd_check_err_code(chip, SD_NO_CARD)) {
+			if (sd_check_err_code(chip, SD_NO_CARD))
 				TRACE_RET(chip, STATUS_FAIL);
-			}
 
 			if (CHECK_PID(chip, 0x5209)) {
 				retval = sd_change_bank_voltage(chip, SD_IO_3V3);
-				if (retval != STATUS_SUCCESS) {
+				if (retval != STATUS_SUCCESS)
 					TRACE_RET(chip, STATUS_FAIL);
-				}
 			}
 
-			if (!chip->sd_io) {
+			if (chip->sd_io) {
+				TRACE_RET(chip, STATUS_FAIL);
+			} else {
 				retval = reset_mmc(chip);
+				if (retval != STATUS_SUCCESS)
+					TRACE_RET(chip, STATUS_FAIL);
 			}
 		}
 	}
 
-	if (retval != STATUS_SUCCESS) {
-		TRACE_RET(chip, STATUS_FAIL);
-	}
-
 	retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
 	if (retval != STATUS_SUCCESS) {
 		TRACE_RET(chip, STATUS_FAIL);
-- 
1.7.7


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-10-10  7:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-09  2:03 [PATCH] staging:rts_pstor:Fix SDIO issue wei_wang
2011-10-09  6:06 ` Dan Carpenter
2011-10-09  6:48   ` wwang
2011-10-09 13:57     ` Dan Carpenter
2011-10-10  1:51       ` wwang
2011-10-10  1:51 wei_wang
2011-10-10  6:12 ` Dan Carpenter
2011-10-10  6:47 wei_wang
2011-10-10  7:55 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®