Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2129426

Browse files
committed
Revert "PCI: brcmstb: Add control of subdevice voltage regulators"
This reverts commit 93e41f3. This is part of a revert of the following commits: 11ed8b8 ("PCI: brcmstb: Do not turn off WOL regulators on suspend") 93e41f3 ("PCI: brcmstb: Add control of subdevice voltage regulators") 67211aa ("PCI: brcmstb: Add mechanism to turn on subdev regulators") 830aa6f ("PCI: brcmstb: Split brcm_pcie_setup() into two funcs") Cyril reported that 830aa6f ("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 830aa6f 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/[email protected] Reported-by: Cyril Brulebois <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 7894025 commit 2129426

File tree

1 file changed

+5
-78
lines changed

1 file changed

+5
-78
lines changed

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 5 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ static inline void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie,
196196
static inline void brcm_pcie_perst_set_4908(struct brcm_pcie *pcie, u32 val);
197197
static inline void brcm_pcie_perst_set_7278(struct brcm_pcie *pcie, u32 val);
198198
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);
201199

202200
enum {
203201
RGR1_SW_INIT_1,
@@ -331,8 +329,6 @@ struct brcm_pcie {
331329
u32 hw_rev;
332330
void (*perst_set)(struct brcm_pcie *pcie, u32 val);
333331
void (*bridge_sw_init_set)(struct brcm_pcie *pcie, u32 val);
334-
bool refusal_mode;
335-
struct subdev_regulators *sr;
336332
};
337333

338334
static inline bool is_bmips(const struct brcm_pcie *pcie)
@@ -501,34 +497,6 @@ static int pci_subdev_regulators_add_bus(struct pci_bus *bus)
501497
return 0;
502498
}
503499

504-
static int brcm_pcie_add_bus(struct pci_bus *bus)
505-
{
506-
struct device *dev = &bus->dev;
507-
struct brcm_pcie *pcie = (struct brcm_pcie *) bus->sysdata;
508-
int ret;
509-
510-
if (!dev->of_node || !bus->parent || !pci_is_root_bus(bus->parent))
511-
return 0;
512-
513-
ret = pci_subdev_regulators_add_bus(bus);
514-
if (ret)
515-
return ret;
516-
517-
/* Grab the regulators for suspend/resume */
518-
pcie->sr = bus->dev.driver_data;
519-
520-
/*
521-
* If we have failed linkup there is no point to return an error as
522-
* currently it will cause a WARNING() from pci_alloc_child_bus().
523-
* We return 0 and turn on the "refusal_mode" so that any further
524-
* accesses to the pci_dev just get 0xffffffff
525-
*/
526-
if (brcm_pcie_linkup(pcie) != 0)
527-
pcie->refusal_mode = true;
528-
529-
return 0;
530-
}
531-
532500
static void pci_subdev_regulators_remove_bus(struct pci_bus *bus)
533501
{
534502
struct device *dev = &bus->dev;
@@ -857,18 +825,6 @@ static void __iomem *brcm_pcie_map_conf(struct pci_bus *bus, unsigned int devfn,
857825
/* Accesses to the RC go right to the RC registers if slot==0 */
858826
if (pci_is_root_bus(bus))
859827
return PCI_SLOT(devfn) ? NULL : base + where;
860-
if (pcie->refusal_mode) {
861-
/*
862-
* At this point we do not have link. There will be a CPU
863-
* abort -- a quirk with this controller --if Linux tries
864-
* to read any config-space registers besides those
865-
* targeting the host bridge. To prevent this we hijack
866-
* the address to point to a safe access that will return
867-
* 0xffffffff.
868-
*/
869-
writel(0xffffffff, base + PCIE_MISC_RC_BAR2_CONFIG_HI);
870-
return base + PCIE_MISC_RC_BAR2_CONFIG_HI + (where & 0x3);
871-
}
872828

873829
/* For devices, write to the config space index register */
874830
idx = PCIE_ECAM_OFFSET(bus->number, devfn, 0);
@@ -897,7 +853,7 @@ static struct pci_ops brcm_pcie_ops = {
897853
.map_bus = brcm_pcie_map_conf,
898854
.read = pci_generic_config_read,
899855
.write = pci_generic_config_write,
900-
.add_bus = brcm_pcie_add_bus,
856+
.add_bus = pci_subdev_regulators_add_bus,
901857
.remove_bus = pci_subdev_regulators_remove_bus,
902858
};
903859

@@ -1370,14 +1326,6 @@ static int brcm_pcie_suspend(struct device *dev)
13701326
return ret;
13711327
}
13721328

1373-
if (pcie->sr) {
1374-
ret = regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies);
1375-
if (ret) {
1376-
dev_err(dev, "Could not turn off regulators\n");
1377-
reset_control_reset(pcie->rescal);
1378-
return ret;
1379-
}
1380-
}
13811329
clk_disable_unprepare(pcie->clk);
13821330

13831331
return 0;
@@ -1395,17 +1343,9 @@ static int brcm_pcie_resume(struct device *dev)
13951343
if (ret)
13961344
return ret;
13971345

1398-
if (pcie->sr) {
1399-
ret = regulator_bulk_enable(pcie->sr->num_supplies, pcie->sr->supplies);
1400-
if (ret) {
1401-
dev_err(dev, "Could not turn on regulators\n");
1402-
goto err_disable_clk;
1403-
}
1404-
}
1405-
14061346
ret = reset_control_reset(pcie->rescal);
14071347
if (ret)
1408-
goto err_regulator;
1348+
goto err_disable_clk;
14091349

14101350
ret = brcm_phy_start(pcie);
14111351
if (ret)
@@ -1437,9 +1377,6 @@ static int brcm_pcie_resume(struct device *dev)
14371377

14381378
err_reset:
14391379
reset_control_rearm(pcie->rescal);
1440-
err_regulator:
1441-
if (pcie->sr)
1442-
regulator_bulk_disable(pcie->sr->num_supplies, pcie->sr->supplies);
14431380
err_disable_clk:
14441381
clk_disable_unprepare(pcie->clk);
14451382
return ret;
@@ -1571,17 +1508,7 @@ static int brcm_pcie_probe(struct platform_device *pdev)
15711508

15721509
platform_set_drvdata(pdev, pcie);
15731510

1574-
ret = pci_host_probe(bridge);
1575-
if (!ret && !brcm_pcie_link_up(pcie))
1576-
ret = -ENODEV;
1577-
1578-
if (ret) {
1579-
brcm_pcie_remove(pdev);
1580-
return ret;
1581-
}
1582-
1583-
return 0;
1584-
1511+
return pci_host_probe(bridge);
15851512
fail:
15861513
__brcm_pcie_remove(pcie);
15871514
return ret;
@@ -1590,8 +1517,8 @@ static int brcm_pcie_probe(struct platform_device *pdev)
15901517
MODULE_DEVICE_TABLE(of, brcm_pcie_match);
15911518

15921519
static const struct dev_pm_ops brcm_pcie_pm_ops = {
1593-
.suspend_noirq = brcm_pcie_suspend,
1594-
.resume_noirq = brcm_pcie_resume,
1520+
.suspend = brcm_pcie_suspend,
1521+
.resume = brcm_pcie_resume,
15951522
};
15961523

15971524
static struct platform_driver brcm_pcie_driver = {

0 commit comments

Comments
 (0)