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

Revert "PCI: brcmstb: Add mechanism to turn on subdev regulators"

This reverts commit 67211aadcb4b968d0fdc57bc27240fa71500c2d4.

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

-76
-76
drivers/pci/controller/pcie-brcmstb.c
··· 24 24 #include <linux/pci.h> 25 25 #include <linux/pci-ecam.h> 26 26 #include <linux/printk.h> 27 - #include <linux/regulator/consumer.h> 28 27 #include <linux/reset.h> 29 28 #include <linux/sizes.h> 30 29 #include <linux/slab.h> ··· 283 284 .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, 284 285 }; 285 286 286 - struct subdev_regulators { 287 - unsigned int num_supplies; 288 - struct regulator_bulk_data supplies[]; 289 - }; 290 - 291 - static int pci_subdev_regulators_add_bus(struct pci_bus *bus); 292 - static void pci_subdev_regulators_remove_bus(struct pci_bus *bus); 293 - 294 287 struct brcm_msi { 295 288 struct device *dev; 296 289 void __iomem *base; ··· 434 443 pll = FIELD_GET(SSC_STATUS_PLL_LOCK_MASK, tmp); 435 444 436 445 return ssc && pll ? 0 : -EIO; 437 - } 438 - 439 - static void *alloc_subdev_regulators(struct device *dev) 440 - { 441 - static const char * const supplies[] = { 442 - "vpcie3v3", 443 - "vpcie3v3aux", 444 - "vpcie12v", 445 - }; 446 - const size_t size = sizeof(struct subdev_regulators) 447 - + sizeof(struct regulator_bulk_data) * ARRAY_SIZE(supplies); 448 - struct subdev_regulators *sr; 449 - int i; 450 - 451 - sr = devm_kzalloc(dev, size, GFP_KERNEL); 452 - if (sr) { 453 - sr->num_supplies = ARRAY_SIZE(supplies); 454 - for (i = 0; i < ARRAY_SIZE(supplies); i++) 455 - sr->supplies[i].supply = supplies[i]; 456 - } 457 - 458 - return sr; 459 - } 460 - 461 - static int pci_subdev_regulators_add_bus(struct pci_bus *bus) 462 - { 463 - struct device *dev = &bus->dev; 464 - struct subdev_regulators *sr; 465 - int ret; 466 - 467 - if (!dev->of_node || !bus->parent || !pci_is_root_bus(bus->parent)) 468 - return 0; 469 - 470 - if (dev->driver_data) 471 - dev_err(dev, "dev.driver_data unexpectedly non-NULL\n"); 472 - 473 - sr = alloc_subdev_regulators(dev); 474 - if (!sr) 475 - return -ENOMEM; 476 - 477 - dev->driver_data = sr; 478 - ret = regulator_bulk_get(dev, sr->num_supplies, sr->supplies); 479 - if (ret) 480 - return ret; 481 - 482 - ret = regulator_bulk_enable(sr->num_supplies, sr->supplies); 483 - if (ret) { 484 - dev_err(dev, "failed to enable regulators for downstream device\n"); 485 - return ret; 486 - } 487 - 488 - return 0; 489 - } 490 - 491 - static void pci_subdev_regulators_remove_bus(struct pci_bus *bus) 492 - { 493 - struct device *dev = &bus->dev; 494 - struct subdev_regulators *sr = dev->driver_data; 495 - 496 - if (!sr || !bus->parent || !pci_is_root_bus(bus->parent)) 497 - return; 498 - 499 - if (regulator_bulk_disable(sr->num_supplies, sr->supplies)) 500 - dev_err(dev, "failed to disable regulators for downstream device\n"); 501 - dev->driver_data = NULL; 502 446 } 503 447 504 448 /* Limits operation to a specific generation (1, 2, or 3) */ ··· 779 853 .map_bus = brcm_pcie_map_conf, 780 854 .read = pci_generic_config_read, 781 855 .write = pci_generic_config_write, 782 - .add_bus = pci_subdev_regulators_add_bus, 783 - .remove_bus = pci_subdev_regulators_remove_bus, 784 856 }; 785 857 786 858 static struct pci_ops brcm_pcie_ops32 = {