diff options
Diffstat (limited to 'drivers/mfd/rtsx_pcr.c')
-rw-r--r-- | drivers/mfd/rtsx_pcr.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 30f7ca89a0e6..81b9c2c2e0f1 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -63,6 +63,18 @@ static const struct pci_device_id rtsx_pci_ids[] = { | |||
63 | 63 | ||
64 | MODULE_DEVICE_TABLE(pci, rtsx_pci_ids); | 64 | MODULE_DEVICE_TABLE(pci, rtsx_pci_ids); |
65 | 65 | ||
66 | static inline void rtsx_pci_enable_aspm(struct rtsx_pcr *pcr) | ||
67 | { | ||
68 | rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL, | ||
69 | 0xFC, pcr->aspm_en); | ||
70 | } | ||
71 | |||
72 | static inline void rtsx_pci_disable_aspm(struct rtsx_pcr *pcr) | ||
73 | { | ||
74 | rtsx_pci_update_cfg_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL, | ||
75 | 0xFC, 0); | ||
76 | } | ||
77 | |||
66 | void rtsx_pci_start_run(struct rtsx_pcr *pcr) | 78 | void rtsx_pci_start_run(struct rtsx_pcr *pcr) |
67 | { | 79 | { |
68 | /* If pci device removed, don't queue idle work any more */ | 80 | /* If pci device removed, don't queue idle work any more */ |
@@ -75,7 +87,7 @@ void rtsx_pci_start_run(struct rtsx_pcr *pcr) | |||
75 | pcr->ops->enable_auto_blink(pcr); | 87 | pcr->ops->enable_auto_blink(pcr); |
76 | 88 | ||
77 | if (pcr->aspm_en) | 89 | if (pcr->aspm_en) |
78 | rtsx_pci_write_config_byte(pcr, LCTLR, 0); | 90 | rtsx_pci_disable_aspm(pcr); |
79 | } | 91 | } |
80 | 92 | ||
81 | mod_delayed_work(system_wq, &pcr->idle_work, msecs_to_jiffies(200)); | 93 | mod_delayed_work(system_wq, &pcr->idle_work, msecs_to_jiffies(200)); |
@@ -942,7 +954,7 @@ static void rtsx_pci_idle_work(struct work_struct *work) | |||
942 | pcr->ops->turn_off_led(pcr); | 954 | pcr->ops->turn_off_led(pcr); |
943 | 955 | ||
944 | if (pcr->aspm_en) | 956 | if (pcr->aspm_en) |
945 | rtsx_pci_write_config_byte(pcr, LCTLR, pcr->aspm_en); | 957 | rtsx_pci_enable_aspm(pcr); |
946 | 958 | ||
947 | mutex_unlock(&pcr->pcr_mutex); | 959 | mutex_unlock(&pcr->pcr_mutex); |
948 | } | 960 | } |
@@ -968,6 +980,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | |||
968 | { | 980 | { |
969 | int err; | 981 | int err; |
970 | 982 | ||
983 | pcr->pcie_cap = pci_find_capability(pcr->pci, PCI_CAP_ID_EXP); | ||
971 | rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr); | 984 | rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr); |
972 | 985 | ||
973 | rtsx_pci_enable_bus_int(pcr); | 986 | rtsx_pci_enable_bus_int(pcr); |
@@ -980,6 +993,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | |||
980 | /* Wait SSC power stable */ | 993 | /* Wait SSC power stable */ |
981 | udelay(200); | 994 | udelay(200); |
982 | 995 | ||
996 | rtsx_pci_disable_aspm(pcr); | ||
983 | if (pcr->ops->optimize_phy) { | 997 | if (pcr->ops->optimize_phy) { |
984 | err = pcr->ops->optimize_phy(pcr); | 998 | err = pcr->ops->optimize_phy(pcr); |
985 | if (err < 0) | 999 | if (err < 0) |
@@ -1028,10 +1042,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | |||
1028 | if (err < 0) | 1042 | if (err < 0) |
1029 | return err; | 1043 | return err; |
1030 | 1044 | ||
1031 | rtsx_pci_write_config_byte(pcr, LCTLR, 0); | ||
1032 | |||
1033 | /* Enable clk_request_n to enable clock power management */ | 1045 | /* Enable clk_request_n to enable clock power management */ |
1034 | rtsx_pci_write_config_byte(pcr, 0x81, 1); | 1046 | rtsx_pci_write_config_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL + 1, 1); |
1035 | /* Enter L1 when host tx idle */ | 1047 | /* Enter L1 when host tx idle */ |
1036 | rtsx_pci_write_config_byte(pcr, 0x70F, 0x5B); | 1048 | rtsx_pci_write_config_byte(pcr, 0x70F, 0x5B); |
1037 | 1049 | ||