Skip to content

Commit 3445d38

Browse files
PCI: dwc: Implement .assert_perst() for dwc glue drivers
Add .assert_perst() hook for dwc glue drivers to register with assert_perst() of pci ops, allowing for better control over the link initialization and shutdown process. Implement assert_perst() function op for dwc drivers. Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> [bhelgaas: squash dwc host support] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/20251101-tc9563-v9-3-de3429f7787a@oss.qualcomm.com Link: https://patch.msgid.link/20251101-tc9563-v9-4-de3429f7787a@oss.qualcomm.com
1 parent 01ba827 commit 3445d38

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,19 @@ void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
842842
}
843843
EXPORT_SYMBOL_GPL(dw_pcie_own_conf_map_bus);
844844

845+
static int dw_pcie_op_assert_perst(struct pci_bus *bus, bool assert)
846+
{
847+
struct dw_pcie_rp *pp = bus->sysdata;
848+
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
849+
850+
return dw_pcie_assert_perst(pci, assert);
851+
}
852+
845853
static struct pci_ops dw_pcie_ops = {
846854
.map_bus = dw_pcie_own_conf_map_bus,
847855
.read = pci_generic_config_read,
848856
.write = pci_generic_config_write,
857+
.assert_perst = dw_pcie_op_assert_perst,
849858
};
850859

851860
static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp)

drivers/pci/controller/dwc/pcie-designware.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ struct dw_pcie_ops {
485485
enum dw_pcie_ltssm (*get_ltssm)(struct dw_pcie *pcie);
486486
int (*start_link)(struct dw_pcie *pcie);
487487
void (*stop_link)(struct dw_pcie *pcie);
488+
int (*assert_perst)(struct dw_pcie *pcie, bool assert);
488489
};
489490

490491
struct debugfs_info {
@@ -787,6 +788,14 @@ static inline void dw_pcie_stop_link(struct dw_pcie *pci)
787788
pci->ops->stop_link(pci);
788789
}
789790

791+
static inline int dw_pcie_assert_perst(struct dw_pcie *pci, bool assert)
792+
{
793+
if (pci->ops && pci->ops->assert_perst)
794+
return pci->ops->assert_perst(pci, assert);
795+
796+
return 0;
797+
}
798+
790799
static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
791800
{
792801
u32 val;

0 commit comments

Comments
 (0)