Skip to content

Commit 2914977

Browse files
bjorn-helgaasgregkh
authored andcommitted
PCI: tegra194: Remove unnecessary L1SS disable code
[ Upstream commit 07c99ea ] The DWC core clears the L1 Substates Supported bits unless the driver sets the "dw_pcie.l1ss_support" flag. The tegra194 init_host_aspm() sets "dw_pcie.l1ss_support" if the platform has the "supports-clkreq" DT property. If "supports-clkreq" is absent, "dw_pcie.l1ss_support" is not set, and the DWC core will clear the L1 Substates Supported bits. The tegra194 code to clear the L1 Substates Supported bits is unnecessary, so remove it. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20251118214312.2598220-3-helgaas@kernel.org Stable-dep-of: f59df1d ("PCI: tegra194: Disable L1.2 capability of Tegra234 EP") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9daf2a8 commit 2914977

1 file changed

Lines changed: 5 additions & 40 deletions

File tree

drivers/pci/controller/dwc/pcie-tegra194.c

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ struct tegra_pcie_dw {
263263
u32 msi_ctrl_int;
264264
u32 num_lanes;
265265
u32 cid;
266-
u32 cfg_link_cap_l1sub;
267266
u32 ras_des_cap;
268267
u32 pcie_cap_base;
269268
u32 aspm_cmrt;
@@ -478,8 +477,7 @@ static irqreturn_t tegra_pcie_ep_irq_thread(int irq, void *arg)
478477
return IRQ_HANDLED;
479478

480479
/* If EP doesn't advertise L1SS, just return */
481-
val = dw_pcie_readl_dbi(pci, pcie->cfg_link_cap_l1sub);
482-
if (!(val & (PCI_L1SS_CAP_ASPM_L1_1 | PCI_L1SS_CAP_ASPM_L1_2)))
480+
if (!pci->l1ss_support)
483481
return IRQ_HANDLED;
484482

485483
/* Check if BME is set to '1' */
@@ -602,24 +600,6 @@ static struct pci_ops tegra_pci_ops = {
602600
};
603601

604602
#if defined(CONFIG_PCIEASPM)
605-
static void disable_aspm_l11(struct tegra_pcie_dw *pcie)
606-
{
607-
u32 val;
608-
609-
val = dw_pcie_readl_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub);
610-
val &= ~PCI_L1SS_CAP_ASPM_L1_1;
611-
dw_pcie_writel_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub, val);
612-
}
613-
614-
static void disable_aspm_l12(struct tegra_pcie_dw *pcie)
615-
{
616-
u32 val;
617-
618-
val = dw_pcie_readl_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub);
619-
val &= ~PCI_L1SS_CAP_ASPM_L1_2;
620-
dw_pcie_writel_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub, val);
621-
}
622-
623603
static inline u32 event_counter_prog(struct tegra_pcie_dw *pcie, u32 event)
624604
{
625605
u32 val;
@@ -676,10 +656,9 @@ static int aspm_state_cnt(struct seq_file *s, void *data)
676656
static void init_host_aspm(struct tegra_pcie_dw *pcie)
677657
{
678658
struct dw_pcie *pci = &pcie->pci;
679-
u32 val;
659+
u32 l1ss, val;
680660

681-
val = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS);
682-
pcie->cfg_link_cap_l1sub = val + PCI_L1SS_CAP;
661+
l1ss = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS);
683662

684663
pcie->ras_des_cap = dw_pcie_find_ext_capability(&pcie->pci,
685664
PCI_EXT_CAP_ID_VNDR);
@@ -691,11 +670,11 @@ static void init_host_aspm(struct tegra_pcie_dw *pcie)
691670
PCIE_RAS_DES_EVENT_COUNTER_CONTROL, val);
692671

693672
/* Program T_cmrt and T_pwr_on values */
694-
val = dw_pcie_readl_dbi(pci, pcie->cfg_link_cap_l1sub);
673+
val = dw_pcie_readl_dbi(pci, l1ss + PCI_L1SS_CAP);
695674
val &= ~(PCI_L1SS_CAP_CM_RESTORE_TIME | PCI_L1SS_CAP_P_PWR_ON_VALUE);
696675
val |= (pcie->aspm_cmrt << 8);
697676
val |= (pcie->aspm_pwr_on_t << 19);
698-
dw_pcie_writel_dbi(pci, pcie->cfg_link_cap_l1sub, val);
677+
dw_pcie_writel_dbi(pci, l1ss + PCI_L1SS_CAP, val);
699678

700679
if (pcie->supports_clkreq)
701680
pci->l1ss_support = true;
@@ -723,8 +702,6 @@ static void init_debugfs(struct tegra_pcie_dw *pcie)
723702
aspm_state_cnt);
724703
}
725704
#else
726-
static inline void disable_aspm_l12(struct tegra_pcie_dw *pcie) { return; }
727-
static inline void disable_aspm_l11(struct tegra_pcie_dw *pcie) { return; }
728705
static inline void init_host_aspm(struct tegra_pcie_dw *pcie) { return; }
729706
static inline void init_debugfs(struct tegra_pcie_dw *pcie) { return; }
730707
#endif
@@ -928,12 +905,6 @@ static int tegra_pcie_dw_host_init(struct dw_pcie_rp *pp)
928905

929906
init_host_aspm(pcie);
930907

931-
/* Disable ASPM-L1SS advertisement if there is no CLKREQ routing */
932-
if (!pcie->supports_clkreq) {
933-
disable_aspm_l11(pcie);
934-
disable_aspm_l12(pcie);
935-
}
936-
937908
if (!pcie->of_data->has_l1ss_exit_fix) {
938909
val = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF);
939910
val &= ~GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL;
@@ -1848,12 +1819,6 @@ static void pex_ep_event_pex_rst_deassert(struct tegra_pcie_dw *pcie)
18481819

18491820
init_host_aspm(pcie);
18501821

1851-
/* Disable ASPM-L1SS advertisement if there is no CLKREQ routing */
1852-
if (!pcie->supports_clkreq) {
1853-
disable_aspm_l11(pcie);
1854-
disable_aspm_l12(pcie);
1855-
}
1856-
18571822
if (!pcie->of_data->has_l1ss_exit_fix) {
18581823
val = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF);
18591824
val &= ~GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL;

0 commit comments

Comments
 (0)