Skip to content

Commit f9b17ff

Browse files
bjorn-helgaasUlf Hansson
authored andcommitted
mmc: sdhci-pci-gli: Use pci_set_power_state(), not direct PMCSR writes
d713379 ("mmc: sdhci-pci-gli: A workaround to allow GL9750 to enter ASPM L1.2") and 36ed2fd ("mmc: sdhci-pci-gli: A workaround to allow GL9755 to enter ASPM L1.2") added writes to the Control register in the Power Management Capability to put the device in D3hot and back to D0. Use the pci_set_power_state() interface instead because these are generic operations that don't need to be driver-specific. Also, the PCI spec requires some delays after these power transitions, and pci_set_power_state() takes care of those, while d713379 and 36ed2fd did not. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Ben Chuang <ben.chuang@genesyslogic.com.tw> Link: https://lore.kernel.org/r/20240327214831.1544595-3-helgaas@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 951b7cc commit f9b17ff

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

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

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
#define GLI_9750_WT_EN_ON 0x1
2626
#define GLI_9750_WT_EN_OFF 0x0
2727

28-
#define PCI_GLI_9750_PM_CTRL 0xFC
29-
#define PCI_GLI_9750_PM_STATE GENMASK(1, 0)
30-
3128
#define SDHCI_GLI_9750_CFG2 0x848
3229
#define SDHCI_GLI_9750_CFG2_L1DLY GENMASK(28, 24)
3330
#define GLI_9750_CFG2_L1DLY_VALUE 0x1F
@@ -149,9 +146,6 @@
149146
#define PCI_GLI_9755_MISC 0x78
150147
#define PCI_GLI_9755_MISC_SSC_OFF BIT(26)
151148

152-
#define PCI_GLI_9755_PM_CTRL 0xFC
153-
#define PCI_GLI_9755_PM_STATE GENMASK(1, 0)
154-
155149
#define SDHCI_GLI_9767_GM_BURST_SIZE 0x510
156150
#define SDHCI_GLI_9767_GM_BURST_SIZE_AXI_ALWAYS_SET BIT(8)
157151

@@ -556,11 +550,8 @@ static void gl9750_hw_setting(struct sdhci_host *host)
556550
sdhci_writel(host, value, SDHCI_GLI_9750_CFG2);
557551

558552
/* toggle PM state to allow GL9750 to enter ASPM L1.2 */
559-
pci_read_config_dword(pdev, PCI_GLI_9750_PM_CTRL, &value);
560-
value |= PCI_GLI_9750_PM_STATE;
561-
pci_write_config_dword(pdev, PCI_GLI_9750_PM_CTRL, value);
562-
value &= ~PCI_GLI_9750_PM_STATE;
563-
pci_write_config_dword(pdev, PCI_GLI_9750_PM_CTRL, value);
553+
pci_set_power_state(pdev, PCI_D3hot);
554+
pci_set_power_state(pdev, PCI_D0);
564555

565556
/* mask the replay timer timeout of AER */
566557
aer = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
@@ -774,11 +765,8 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot)
774765
pci_write_config_dword(pdev, PCI_GLI_9755_CFG2, value);
775766

776767
/* toggle PM state to allow GL9755 to enter ASPM L1.2 */
777-
pci_read_config_dword(pdev, PCI_GLI_9755_PM_CTRL, &value);
778-
value |= PCI_GLI_9755_PM_STATE;
779-
pci_write_config_dword(pdev, PCI_GLI_9755_PM_CTRL, value);
780-
value &= ~PCI_GLI_9755_PM_STATE;
781-
pci_write_config_dword(pdev, PCI_GLI_9755_PM_CTRL, value);
768+
pci_set_power_state(pdev, PCI_D3hot);
769+
pci_set_power_state(pdev, PCI_D0);
782770

783771
/* mask the replay timer timeout of AER */
784772
aer = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);

0 commit comments

Comments
 (0)