Skip to content

Commit 096cc0c

Browse files
Chevron Listorulf
authored andcommitted
mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout
The SD card is recognized failed sometimes when resume from suspend. Because CD# debounce time too long then card present report wrong. Finally, card is recognized failed. Signed-off-by: Chevron Li <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 39a72db commit 096cc0c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/mmc/host/sdhci-pci-o2micro.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define O2_SD_CAPS 0xE0
3333
#define O2_SD_ADMA1 0xE2
3434
#define O2_SD_ADMA2 0xE7
35+
#define O2_SD_MISC_CTRL2 0xF0
3536
#define O2_SD_INF_MOD 0xF1
3637
#define O2_SD_MISC_CTRL4 0xFC
3738
#define O2_SD_MISC_CTRL 0x1C0
@@ -877,6 +878,12 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
877878
/* Set Tuning Windows to 5 */
878879
pci_write_config_byte(chip->pdev,
879880
O2_SD_TUNING_CTRL, 0x55);
881+
//Adjust 1st and 2nd CD debounce time
882+
pci_read_config_dword(chip->pdev, O2_SD_MISC_CTRL2, &scratch_32);
883+
scratch_32 &= 0xFFE7FFFF;
884+
scratch_32 |= 0x00180000;
885+
pci_write_config_dword(chip->pdev, O2_SD_MISC_CTRL2, scratch_32);
886+
pci_write_config_dword(chip->pdev, O2_SD_DETECT_SETTING, 1);
880887
/* Lock WP */
881888
ret = pci_read_config_byte(chip->pdev,
882889
O2_SD_LOCK_WP, &scratch);

0 commit comments

Comments
 (0)