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

Revert "PCI: brcmstb: Add control of subdevice voltage regulators"

This reverts commit 93e41f3fca3d4a0f927b784012338c37f80a8a80.

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-3-helgaas@kernel.org
Reported-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+5 -78
+5 -78
drivers/pci/controller/pcie-brcmstb.c
··· 196 196 static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val); 197 197 static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val); 198 198 static inline void brcm_pcie_perst_set_generic(struct brcm_pcie *pcie, u32 val); 199 - static int brcm_pcie_linkup(struct brcm_pcie *pcie); 200 - static int brcm_pcie_add_bus(struct pci_bus *bus); 201 199 202 200 enum { 203 201 RGR1_SW_INIT_1, ··· 329 331 u32 hw_rev; 330 332 void (*perst_set)(struct brcm_pcie *pcie, u32 val); 331 333 void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); 332 - bool refusal_mode; 333 - struct subdev_regulators *sr; 334 334 }; 335 335 336 336 static inline bool is_bmips(const struct brcm_pcie *pcie) ··· 493 497 dev_err(dev, "failed to enable regulators for downstream device\n"); 494 498 return ret; 495 499 } 496 - 497 - return 0; 498 - } 499 - 500 - static int brcm_pcie_add_bus(struct pci_bus *bus) 501 - { 502 - struct device *dev = &bus->dev; 503 - struct brcm_pcie *pcie = (struct brcm_pcie *) bus->sysdata; 504 - int ret; 505 - 506 - if (!dev->of_node || !bus->parent || !pci_is_root_bus(bus->parent)) 507 - return 0; 508 - 509 - ret = pci_subdev_regulators_add_bus(bus); 510 - if (ret) 511 - return ret; 512 - 513 - /* Grab the regulators for suspend/resume */ 514 - pcie->sr = bus->dev.driver_data; 515 - 516 - /* 517 - * If we have failed linkup there is no point to return an error as 518 - * currently it will cause a WARNING() from pci_alloc_child_bus(). 519 - * We return 0 and turn on the "refusal_mode" so that any further 520 - * accesses to the pci_dev just get 0xffffffff 521 - */ 522 - if (brcm_pcie_linkup(pcie) != 0) 523 - pcie->refusal_mode = true; 524 500 525 501 return 0; 526 502 } ··· 825 857 /* Accesses to the RC go right to the RC registers if slot==0 */ 826 858 if (pci_is_root_bus(bus)) 827 859 return PCI_SLOT(devfn) ? NULL : base + where; 828 - if (pcie->refusal_mode) { 829 - /* 830 - * At this point we do not have link. There will be a CPU 831 - * abort -- a quirk with this controller --if Linux tries 832 - * to read any config-space registers besides those 833 - * targeting the host bridge. To prevent this we hijack 834 - * the address to point to a safe access that will return 835 - * 0xffffffff. 836 - */ 837 - writel(0xffffffff, base + PCIE_MISC_RC_BAR2_CONFIG_HI); 838 - return base + PCIE_MISC_RC_BAR2_CONFIG_HI + (where & 0x3); 839 - } 840 860 841 861 /* For devices, write to the config space index register */ 842 862 idx = PCIE_ECAM_OFFSET(bus->number, devfn, 0); ··· 853 897 .map_bus = brcm_pcie_map_conf, 854 898 .read = pci_generic_config_read, 855 899 .write = pci_generic_config_write, 856 - .add_bus = brcm_pcie_add_bus, 900 + .add_bus = pci_subdev_regulators_add_bus, 857 901 .remove_bus = pci_subdev_regulators_remove_bus, 858 902 }; 859 903 ··· 1326 1370 return ret; 1327 1371 } 1328 1372 1329 - if (pcie->sr) { 1330 - ret = regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); 1331 - if (ret) { 1332 - dev_err(dev, "Could not turn off regulators\n"); 1333 - reset_control_reset(pcie->rescal); 1334 - return ret; 1335 - } 1336 - } 1337 1373 clk_disable_unprepare(pcie->clk); 1338 1374 1339 1375 return 0; ··· 1343 1395 if (ret) 1344 1396 return ret; 1345 1397 1346 - if (pcie->sr) { 1347 - ret = regulator_bulk_enable(pcie->sr->num_supplies, pcie->sr->supplies); 1348 - if (ret) { 1349 - dev_err(dev, "Could not turn on regulators\n"); 1350 - goto err_disable_clk; 1351 - } 1352 - } 1353 - 1354 1398 ret = reset_control_reset(pcie->rescal); 1355 1399 if (ret) 1356 - goto err_regulator; 1400 + goto err_disable_clk; 1357 1401 1358 1402 ret = brcm_phy_start(pcie); 1359 1403 if (ret) ··· 1377 1437 1378 1438 err_reset: 1379 1439 reset_control_rearm(pcie->rescal); 1380 - err_regulator: 1381 - if (pcie->sr) 1382 - regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); 1383 1440 err_disable_clk: 1384 1441 clk_disable_unprepare(pcie->clk); 1385 1442 return ret; ··· 1508 1571 1509 1572 platform_set_drvdata(pdev, pcie); 1510 1573 1511 - ret = pci_host_probe(bridge); 1512 - if (!ret && !brcm_pcie_link_up(pcie)) 1513 - ret = -ENODEV; 1514 - 1515 - if (ret) { 1516 - brcm_pcie_remove(pdev); 1517 - return ret; 1518 - } 1519 - 1520 - return 0; 1521 - 1574 + return pci_host_probe(bridge); 1522 1575 fail: 1523 1576 __brcm_pcie_remove(pcie); 1524 1577 return ret; ··· 1517 1590 MODULE_DEVICE_TABLE(of, brcm_pcie_match); 1518 1591 1519 1592 static const struct dev_pm_ops brcm_pcie_pm_ops = { 1520 - .suspend_noirq = brcm_pcie_suspend, 1521 - .resume_noirq = brcm_pcie_resume, 1593 + .suspend = brcm_pcie_suspend, 1594 + .resume = brcm_pcie_resume, 1522 1595 }; 1523 1596 1524 1597 static struct platform_driver brcm_pcie_driver = {