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

Revert "PCI: brcmstb: Split brcm_pcie_setup() into two funcs"

This reverts commit 830aa6f29f07a4e2f1a947dfa72b3ccddb46dd21.

This is part of a revert of the following commits:

11ed8b8624b8 ("PCI: brcmstb: Do not turn off WOL regulators on suspend")
93e41f3fca3d ("PCI: brcmstb: Add control of subdevice voltage regulators")
67211aadcb4b ("PCI: brcmstb: Add mechanism to turn on subdev regulators")
830aa6f29f07 ("PCI: brcmstb: Split brcm_pcie_setup() into two funcs")

Cyril reported that 830aa6f29f07 ("PCI: brcmstb: Split brcm_pcie_setup()
into two funcs"), which appeared in v5.17-rc1, broke booting on the
Raspberry Pi Compute Module 4. Apparently 830aa6f29f07 panics with an
Asynchronous SError Interrupt, and after further commits here is a black
screen on HDMI and no output on the serial console.

This does not seem to affect the Raspberry Pi 4 B.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=215925
Link: https://lore.kernel.org/r/20220511201856.808690-5-helgaas@kernel.org
Reported-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+26 -39
+26 -39
drivers/pci/controller/pcie-brcmstb.c
··· 926 926 927 927 static int brcm_pcie_setup(struct brcm_pcie *pcie) 928 928 { 929 + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); 929 930 u64 rc_bar2_offset, rc_bar2_size; 930 931 void __iomem *base = pcie->base; 931 - int ret, memc; 932 + struct device *dev = pcie->dev; 933 + struct resource_entry *entry; 934 + bool ssc_good = false; 935 + struct resource *res; 936 + int num_out_wins = 0; 937 + u16 nlw, cls, lnksta; 938 + int i, ret, memc; 932 939 u32 tmp, burst, aspm_support; 933 940 934 941 /* Reset the bridge */ ··· 1025 1018 if (pcie->gen) 1026 1019 brcm_pcie_set_gen(pcie, pcie->gen); 1027 1020 1028 - /* Don't advertise L0s capability if 'aspm-no-l0s' */ 1029 - aspm_support = PCIE_LINK_STATE_L1; 1030 - if (!of_property_read_bool(pcie->np, "aspm-no-l0s")) 1031 - aspm_support |= PCIE_LINK_STATE_L0S; 1032 - tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); 1033 - u32p_replace_bits(&tmp, aspm_support, 1034 - PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK); 1035 - writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); 1036 - 1037 - /* 1038 - * For config space accesses on the RC, show the right class for 1039 - * a PCIe-PCIe bridge (the default setting is to be EP mode). 1040 - */ 1041 - tmp = readl(base + PCIE_RC_CFG_PRIV1_ID_VAL3); 1042 - u32p_replace_bits(&tmp, 0x060400, 1043 - PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK); 1044 - writel(tmp, base + PCIE_RC_CFG_PRIV1_ID_VAL3); 1045 - 1046 - return 0; 1047 - } 1048 - 1049 - static int brcm_pcie_linkup(struct brcm_pcie *pcie) 1050 - { 1051 - struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); 1052 - struct device *dev = pcie->dev; 1053 - void __iomem *base = pcie->base; 1054 - struct resource_entry *entry; 1055 - struct resource *res; 1056 - int num_out_wins = 0; 1057 - u16 nlw, cls, lnksta; 1058 - bool ssc_good = false; 1059 - u32 tmp; 1060 - int ret, i; 1061 - 1062 1021 /* Unassert the fundamental reset */ 1063 1022 pcie->perst_set(pcie, 0); 1064 1023 ··· 1074 1101 resource_size(res)); 1075 1102 num_out_wins++; 1076 1103 } 1104 + 1105 + /* Don't advertise L0s capability if 'aspm-no-l0s' */ 1106 + aspm_support = PCIE_LINK_STATE_L1; 1107 + if (!of_property_read_bool(pcie->np, "aspm-no-l0s")) 1108 + aspm_support |= PCIE_LINK_STATE_L0S; 1109 + tmp = readl(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); 1110 + u32p_replace_bits(&tmp, aspm_support, 1111 + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK); 1112 + writel(tmp, base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY); 1113 + 1114 + /* 1115 + * For config space accesses on the RC, show the right class for 1116 + * a PCIe-PCIe bridge (the default setting is to be EP mode). 1117 + */ 1118 + tmp = readl(base + PCIE_RC_CFG_PRIV1_ID_VAL3); 1119 + u32p_replace_bits(&tmp, 0x060400, 1120 + PCIE_RC_CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK); 1121 + writel(tmp, base + PCIE_RC_CFG_PRIV1_ID_VAL3); 1077 1122 1078 1123 if (pcie->ssc) { 1079 1124 ret = brcm_pcie_set_ssc(pcie); ··· 1278 1287 udelay(100); 1279 1288 1280 1289 ret = brcm_pcie_setup(pcie); 1281 - if (ret) 1282 - goto err_reset; 1283 - 1284 - ret = brcm_pcie_linkup(pcie); 1285 1290 if (ret) 1286 1291 goto err_reset; 1287 1292