Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: tegra194: Remove unnecessary L1SS disable code

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

+5 -40
+5 -40
drivers/pci/controller/dwc/pcie-tegra194.c
··· 260 260 u32 msi_ctrl_int; 261 261 u32 num_lanes; 262 262 u32 cid; 263 - u32 cfg_link_cap_l1sub; 264 263 u32 ras_des_cap; 265 264 u32 pcie_cap_base; 266 265 u32 aspm_cmrt; ··· 474 475 return IRQ_HANDLED; 475 476 476 477 /* If EP doesn't advertise L1SS, just return */ 477 - val = dw_pcie_readl_dbi(pci, pcie->cfg_link_cap_l1sub); 478 - if (!(val & (PCI_L1SS_CAP_ASPM_L1_1 | PCI_L1SS_CAP_ASPM_L1_2))) 478 + if (!pci->l1ss_support) 479 479 return IRQ_HANDLED; 480 480 481 481 /* Check if BME is set to '1' */ ··· 606 608 }; 607 609 608 610 #if defined(CONFIG_PCIEASPM) 609 - static void disable_aspm_l11(struct tegra_pcie_dw *pcie) 610 - { 611 - u32 val; 612 - 613 - val = dw_pcie_readl_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub); 614 - val &= ~PCI_L1SS_CAP_ASPM_L1_1; 615 - dw_pcie_writel_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub, val); 616 - } 617 - 618 - static void disable_aspm_l12(struct tegra_pcie_dw *pcie) 619 - { 620 - u32 val; 621 - 622 - val = dw_pcie_readl_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub); 623 - val &= ~PCI_L1SS_CAP_ASPM_L1_2; 624 - dw_pcie_writel_dbi(&pcie->pci, pcie->cfg_link_cap_l1sub, val); 625 - } 626 - 627 611 static inline u32 event_counter_prog(struct tegra_pcie_dw *pcie, u32 event) 628 612 { 629 613 u32 val; ··· 662 682 static void init_host_aspm(struct tegra_pcie_dw *pcie) 663 683 { 664 684 struct dw_pcie *pci = &pcie->pci; 665 - u32 val; 685 + u32 l1ss, val; 666 686 667 - val = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS); 668 - pcie->cfg_link_cap_l1sub = val + PCI_L1SS_CAP; 687 + l1ss = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS); 669 688 670 689 pcie->ras_des_cap = dw_pcie_find_ext_capability(&pcie->pci, 671 690 PCI_EXT_CAP_ID_VNDR); ··· 676 697 PCIE_RAS_DES_EVENT_COUNTER_CONTROL, val); 677 698 678 699 /* Program T_cmrt and T_pwr_on values */ 679 - val = dw_pcie_readl_dbi(pci, pcie->cfg_link_cap_l1sub); 700 + val = dw_pcie_readl_dbi(pci, l1ss + PCI_L1SS_CAP); 680 701 val &= ~(PCI_L1SS_CAP_CM_RESTORE_TIME | PCI_L1SS_CAP_P_PWR_ON_VALUE); 681 702 val |= (pcie->aspm_cmrt << 8); 682 703 val |= (pcie->aspm_pwr_on_t << 19); 683 - dw_pcie_writel_dbi(pci, pcie->cfg_link_cap_l1sub, val); 704 + dw_pcie_writel_dbi(pci, l1ss + PCI_L1SS_CAP, val); 684 705 685 706 if (pcie->supports_clkreq) 686 707 pci->l1ss_support = true; ··· 708 729 aspm_state_cnt); 709 730 } 710 731 #else 711 - static inline void disable_aspm_l12(struct tegra_pcie_dw *pcie) { return; } 712 - static inline void disable_aspm_l11(struct tegra_pcie_dw *pcie) { return; } 713 732 static inline void init_host_aspm(struct tegra_pcie_dw *pcie) { return; } 714 733 static inline void init_debugfs(struct tegra_pcie_dw *pcie) { return; } 715 734 #endif ··· 910 933 config_gen3_gen4_eq_presets(pcie); 911 934 912 935 init_host_aspm(pcie); 913 - 914 - /* Disable ASPM-L1SS advertisement if there is no CLKREQ routing */ 915 - if (!pcie->supports_clkreq) { 916 - disable_aspm_l11(pcie); 917 - disable_aspm_l12(pcie); 918 - } 919 936 920 937 if (!pcie->of_data->has_l1ss_exit_fix) { 921 938 val = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF); ··· 1844 1873 config_gen3_gen4_eq_presets(pcie); 1845 1874 1846 1875 init_host_aspm(pcie); 1847 - 1848 - /* Disable ASPM-L1SS advertisement if there is no CLKREQ routing */ 1849 - if (!pcie->supports_clkreq) { 1850 - disable_aspm_l11(pcie); 1851 - disable_aspm_l12(pcie); 1852 - } 1853 1876 1854 1877 if (!pcie->of_data->has_l1ss_exit_fix) { 1855 1878 val = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF);