PCI: dwc: Add ->get_features() callback function to dw_pcie_ep_ops
authorKishon Vijay Abraham I <kishon@ti.com>
Mon, 14 Jan 2019 11:15:00 +0000 (16:45 +0530)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 14 Feb 2019 16:09:14 +0000 (16:09 +0000)
Each platform using Designware PCIe core can support different set of
endpoint features. Add a new callback function ->get_features() in
dw_pcie_ep_ops so that each platform using Designware PCIe core can
advertise its supported features to the endpoint function driver.

Tested-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/pci/controller/dwc/pcie-designware-ep.c
drivers/pci/controller/dwc/pcie-designware.h

index a543c45..7a2925a 100644 (file)
@@ -355,6 +355,17 @@ static int dw_pcie_ep_start(struct pci_epc *epc)
        return pci->ops->start_link(pci);
 }
 
+static const struct pci_epc_features*
+dw_pcie_ep_get_features(struct pci_epc *epc, u8 func_no)
+{
+       struct dw_pcie_ep *ep = epc_get_drvdata(epc);
+
+       if (!ep->ops->get_features)
+               return NULL;
+
+       return ep->ops->get_features(ep);
+}
+
 static const struct pci_epc_ops epc_ops = {
        .write_header           = dw_pcie_ep_write_header,
        .set_bar                = dw_pcie_ep_set_bar,
@@ -368,6 +379,7 @@ static const struct pci_epc_ops epc_ops = {
        .raise_irq              = dw_pcie_ep_raise_irq,
        .start                  = dw_pcie_ep_start,
        .stop                   = dw_pcie_ep_stop,
+       .get_features           = dw_pcie_ep_get_features,
 };
 
 int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no)
index 9943d8c..1f56e6a 100644 (file)
@@ -192,6 +192,7 @@ struct dw_pcie_ep_ops {
        void    (*ep_init)(struct dw_pcie_ep *ep);
        int     (*raise_irq)(struct dw_pcie_ep *ep, u8 func_no,
                             enum pci_epc_irq_type type, u16 interrupt_num);
+       const struct pci_epc_features* (*get_features)(struct dw_pcie_ep *ep);
 };
 
 struct dw_pcie_ep {