Skip to content

Commit 4ab9ffd

Browse files
committed
Merge tag 'mmc-v6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fixup VDD/VMMC voltage-range negotiation MMC host: - sdhci-pci: Fix memory leak by adding a missing pci_dev_put() - sdhci-pci-o2micro: Fix card detect by tuning the debounce timeout" * tag 'mmc-v6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put() mmc: sdhci-pci-o2micro: fix card detect fail issue caused by CD# debounce timeout mmc: core: properly select voltage range without power cycle
2 parents 84368d8 + 222cfa0 commit 4ab9ffd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

drivers/mmc/core/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,13 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
11341134
mmc_power_cycle(host, ocr);
11351135
} else {
11361136
bit = fls(ocr) - 1;
1137-
ocr &= 3 << bit;
1137+
/*
1138+
* The bit variable represents the highest voltage bit set in
1139+
* the OCR register.
1140+
* To keep a range of 2 values (e.g. 3.2V/3.3V and 3.3V/3.4V),
1141+
* we must shift the mask '3' with (bit - 1).
1142+
*/
1143+
ocr &= 3 << (bit - 1);
11381144
if (bit != host->ios.vdd)
11391145
dev_warn(mmc_dev(host), "exceeding card's volts\n");
11401146
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,8 @@ static int amd_probe(struct sdhci_pci_chip *chip)
17491749
}
17501750
}
17511751

1752+
pci_dev_put(smbus_dev);
1753+
17521754
if (gen == AMD_CHIPSET_BEFORE_ML || gen == AMD_CHIPSET_CZ)
17531755
chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
17541756

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)