Skip to content

Commit 46cb27f

Browse files
jamesequinlankwilczynski
authored andcommitted
PCI: brcmstb: Use bridge reset if available
The 7712 SoC has a bridge reset which can be described in the device tree. Use it if present. Otherwise, continue to use the legacy method to reset the bridge. Link: https://lore.kernel.org/linux-pci/20240815225731.40276-6-james.quinlan@broadcom.com Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com> [kwilczynski: commit log, refactored function brcm_pcie_bridge_sw_init_set_generic()] Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Stanimir Varbanov <svarbanov@suse.de>
1 parent 64706ba commit 46cb27f

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

drivers/pci/controller/pcie-brcmstb.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ struct brcm_pcie {
265265
enum pcie_type type;
266266
struct reset_control *rescal;
267267
struct reset_control *perst_reset;
268+
struct reset_control *bridge_reset;
268269
int num_memc;
269270
u64 memc_size[PCIE_BRCM_MAX_MEMC];
270271
u32 hw_rev;
@@ -732,9 +733,18 @@ static void __iomem *brcm7425_pcie_map_bus(struct pci_bus *bus,
732733

733734
static void brcm_pcie_bridge_sw_init_set_generic(struct brcm_pcie *pcie, u32 val)
734735
{
735-
u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK;
736+
u32 tmp, mask = RGR1_SW_INIT_1_INIT_GENERIC_MASK;
736737
u32 shift = RGR1_SW_INIT_1_INIT_GENERIC_SHIFT;
737738

739+
if (pcie->bridge_reset) {
740+
if (val)
741+
reset_control_assert(pcie->bridge_reset);
742+
else
743+
reset_control_deassert(pcie->bridge_reset);
744+
745+
return;
746+
}
747+
738748
tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie));
739749
tmp = (tmp & ~mask) | ((val << shift) & mask);
740750
writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie));
@@ -1621,10 +1631,16 @@ static int brcm_pcie_probe(struct platform_device *pdev)
16211631
if (IS_ERR(pcie->perst_reset))
16221632
return PTR_ERR(pcie->perst_reset);
16231633

1634+
pcie->bridge_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "bridge");
1635+
if (IS_ERR(pcie->bridge_reset))
1636+
return PTR_ERR(pcie->bridge_reset);
1637+
16241638
ret = clk_prepare_enable(pcie->clk);
16251639
if (ret)
16261640
return dev_err_probe(&pdev->dev, ret, "could not enable clock\n");
16271641

1642+
pcie->bridge_sw_init_set(pcie, 0);
1643+
16281644
ret = reset_control_reset(pcie->rescal);
16291645
if (ret) {
16301646
clk_disable_unprepare(pcie->clk);

0 commit comments

Comments
 (0)