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

Revert "PCI: brcmstb: Do not turn off WOL regulators on suspend"

This reverts commit 11ed8b8624b8085f706864b4addcd304b1e4fc38.

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

+9 -44
+9 -44
drivers/pci/controller/pcie-brcmstb.c
··· 333 333 void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val); 334 334 bool refusal_mode; 335 335 struct subdev_regulators *sr; 336 - bool ep_wakeup_capable; 337 336 }; 338 337 339 338 static inline bool is_bmips(const struct brcm_pcie *pcie) ··· 1350 1351 pcie->bridge_sw_init_set(pcie, 1); 1351 1352 } 1352 1353 1353 - static int pci_dev_may_wakeup(struct pci_dev *dev, void *data) 1354 - { 1355 - bool *ret = data; 1356 - 1357 - if (device_may_wakeup(&dev->dev)) { 1358 - *ret = true; 1359 - dev_info(&dev->dev, "disable cancelled for wake-up device\n"); 1360 - } 1361 - return (int) *ret; 1362 - } 1363 - 1364 1354 static int brcm_pcie_suspend(struct device *dev) 1365 1355 { 1366 1356 struct brcm_pcie *pcie = dev_get_drvdata(dev); 1367 - struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); 1368 1357 int ret; 1369 1358 1370 1359 brcm_pcie_turn_off(pcie); ··· 1371 1384 } 1372 1385 1373 1386 if (pcie->sr) { 1374 - /* 1375 - * Now turn off the regulators, but if at least one 1376 - * downstream device is enabled as a wake-up source, do not 1377 - * turn off regulators. 1378 - */ 1379 - pcie->ep_wakeup_capable = false; 1380 - pci_walk_bus(bridge->bus, pci_dev_may_wakeup, 1381 - &pcie->ep_wakeup_capable); 1382 - if (!pcie->ep_wakeup_capable) { 1383 - ret = regulator_bulk_disable(pcie->sr->num_supplies, 1384 - pcie->sr->supplies); 1385 - if (ret) { 1386 - dev_err(dev, "Could not turn off regulators\n"); 1387 - reset_control_reset(pcie->rescal); 1388 - return ret; 1389 - } 1387 + ret = regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies); 1388 + if (ret) { 1389 + dev_err(dev, "Could not turn off regulators\n"); 1390 + reset_control_reset(pcie->rescal); 1391 + return ret; 1390 1392 } 1391 1393 } 1392 1394 clk_disable_unprepare(pcie->clk); ··· 1396 1420 return ret; 1397 1421 1398 1422 if (pcie->sr) { 1399 - if (pcie->ep_wakeup_capable) { 1400 - /* 1401 - * We are resuming from a suspend. In the suspend we 1402 - * did not disable the power supplies, so there is 1403 - * no need to enable them (and falsely increase their 1404 - * usage count). 1405 - */ 1406 - pcie->ep_wakeup_capable = false; 1407 - } else { 1408 - ret = regulator_bulk_enable(pcie->sr->num_supplies, 1409 - pcie->sr->supplies); 1410 - if (ret) { 1411 - dev_err(dev, "Could not turn on regulators\n"); 1412 - goto err_disable_clk; 1413 - } 1423 + ret = regulator_bulk_enable(pcie->sr->num_supplies, pcie->sr->supplies); 1424 + if (ret) { 1425 + dev_err(dev, "Could not turn on regulators\n"); 1426 + goto err_disable_clk; 1414 1427 } 1415 1428 } 1416 1429