Skip to content

Commit d9ed644

Browse files
Kornel Dulębastorulf
authored andcommitted
mmc: sdhci-pci-gli: Disable LPM during initialization
To address IO performance commit f9e5b33 ("mmc: host: Improve I/O read/write performance for GL9763E") limited LPM negotiation to runtime suspend state. The problem is that it only flips the switch in the runtime PM resume/suspend logic. Disable LPM negotiation in gl9763e_add_host. This helps in two ways: 1. It was found that the LPM switch stays in the same position after warm reboot. Having it set in init helps with consistency. 2. Disabling LPM during the first runtime resume leaves us susceptible to the performance issue in the time window between boot and the first runtime suspend. Fixes: f9e5b33 ("mmc: host: Improve I/O read/write performance for GL9763E") Cc: [email protected] Signed-off-by: Kornel Dulęba <[email protected]> Reviewed-by: Sven van Ashbrook <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 1de1b77 commit d9ed644

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

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

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,32 @@ static void gl9763e_hs400_enhanced_strobe(struct mmc_host *mmc,
11891189
sdhci_writel(host, val, SDHCI_GLI_9763E_HS400_ES_REG);
11901190
}
11911191

1192+
static void gl9763e_set_low_power_negotiation(struct sdhci_pci_slot *slot,
1193+
bool enable)
1194+
{
1195+
struct pci_dev *pdev = slot->chip->pdev;
1196+
u32 value;
1197+
1198+
pci_read_config_dword(pdev, PCIE_GLI_9763E_VHS, &value);
1199+
value &= ~GLI_9763E_VHS_REV;
1200+
value |= FIELD_PREP(GLI_9763E_VHS_REV, GLI_9763E_VHS_REV_W);
1201+
pci_write_config_dword(pdev, PCIE_GLI_9763E_VHS, value);
1202+
1203+
pci_read_config_dword(pdev, PCIE_GLI_9763E_CFG, &value);
1204+
1205+
if (enable)
1206+
value &= ~GLI_9763E_CFG_LPSN_DIS;
1207+
else
1208+
value |= GLI_9763E_CFG_LPSN_DIS;
1209+
1210+
pci_write_config_dword(pdev, PCIE_GLI_9763E_CFG, value);
1211+
1212+
pci_read_config_dword(pdev, PCIE_GLI_9763E_VHS, &value);
1213+
value &= ~GLI_9763E_VHS_REV;
1214+
value |= FIELD_PREP(GLI_9763E_VHS_REV, GLI_9763E_VHS_REV_R);
1215+
pci_write_config_dword(pdev, PCIE_GLI_9763E_VHS, value);
1216+
}
1217+
11921218
static void sdhci_set_gl9763e_signaling(struct sdhci_host *host,
11931219
unsigned int timing)
11941220
{
@@ -1297,6 +1323,9 @@ static int gl9763e_add_host(struct sdhci_pci_slot *slot)
12971323
if (ret)
12981324
goto cleanup;
12991325

1326+
/* Disable LPM negotiation to avoid entering L1 state. */
1327+
gl9763e_set_low_power_negotiation(slot, false);
1328+
13001329
return 0;
13011330

13021331
cleanup:
@@ -1340,31 +1369,6 @@ static void gli_set_gl9763e(struct sdhci_pci_slot *slot)
13401369
}
13411370

13421371
#ifdef CONFIG_PM
1343-
static void gl9763e_set_low_power_negotiation(struct sdhci_pci_slot *slot, bool enable)
1344-
{
1345-
struct pci_dev *pdev = slot->chip->pdev;
1346-
u32 value;
1347-
1348-
pci_read_config_dword(pdev, PCIE_GLI_9763E_VHS, &value);
1349-
value &= ~GLI_9763E_VHS_REV;
1350-
value |= FIELD_PREP(GLI_9763E_VHS_REV, GLI_9763E_VHS_REV_W);
1351-
pci_write_config_dword(pdev, PCIE_GLI_9763E_VHS, value);
1352-
1353-
pci_read_config_dword(pdev, PCIE_GLI_9763E_CFG, &value);
1354-
1355-
if (enable)
1356-
value &= ~GLI_9763E_CFG_LPSN_DIS;
1357-
else
1358-
value |= GLI_9763E_CFG_LPSN_DIS;
1359-
1360-
pci_write_config_dword(pdev, PCIE_GLI_9763E_CFG, value);
1361-
1362-
pci_read_config_dword(pdev, PCIE_GLI_9763E_VHS, &value);
1363-
value &= ~GLI_9763E_VHS_REV;
1364-
value |= FIELD_PREP(GLI_9763E_VHS_REV, GLI_9763E_VHS_REV_R);
1365-
pci_write_config_dword(pdev, PCIE_GLI_9763E_VHS, value);
1366-
}
1367-
13681372
static int gl9763e_runtime_suspend(struct sdhci_pci_chip *chip)
13691373
{
13701374
struct sdhci_pci_slot *slot = chip->slots[0];

0 commit comments

Comments
 (0)