1515#include <linux/pci-epc.h>
1616#include <linux/pci-epf.h>
1717
18+ /**
19+ * dw_pcie_ep_linkup - Notify EPF drivers about Link Up event
20+ * @ep: DWC EP device
21+ */
1822void dw_pcie_ep_linkup (struct dw_pcie_ep * ep )
1923{
2024 struct pci_epc * epc = ep -> epc ;
@@ -23,6 +27,10 @@ void dw_pcie_ep_linkup(struct dw_pcie_ep *ep)
2327}
2428EXPORT_SYMBOL_GPL (dw_pcie_ep_linkup );
2529
30+ /**
31+ * dw_pcie_ep_init_notify - Notify EPF drivers about EPC initialization complete
32+ * @ep: DWC EP device
33+ */
2634void dw_pcie_ep_init_notify (struct dw_pcie_ep * ep )
2735{
2836 struct pci_epc * epc = ep -> epc ;
@@ -31,6 +39,14 @@ void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep)
3139}
3240EXPORT_SYMBOL_GPL (dw_pcie_ep_init_notify );
3341
42+ /**
43+ * dw_pcie_ep_get_func_from_ep - Get the struct dw_pcie_ep_func corresponding to
44+ * the endpoint function
45+ * @ep: DWC EP device
46+ * @func_no: Function number of the endpoint device
47+ *
48+ * Return: struct dw_pcie_ep_func if success, NULL otherwise.
49+ */
3450struct dw_pcie_ep_func *
3551dw_pcie_ep_get_func_from_ep (struct dw_pcie_ep * ep , u8 func_no )
3652{
@@ -61,6 +77,11 @@ static void __dw_pcie_ep_reset_bar(struct dw_pcie *pci, u8 func_no,
6177 dw_pcie_dbi_ro_wr_dis (pci );
6278}
6379
80+ /**
81+ * dw_pcie_ep_reset_bar - Reset endpoint BAR
82+ * @pci: DWC PCI device
83+ * @bar: BAR number of the endpoint
84+ */
6485void dw_pcie_ep_reset_bar (struct dw_pcie * pci , enum pci_barno bar )
6586{
6687 u8 func_no , funcs ;
@@ -440,6 +461,13 @@ static const struct pci_epc_ops epc_ops = {
440461 .get_features = dw_pcie_ep_get_features ,
441462};
442463
464+ /**
465+ * dw_pcie_ep_raise_intx_irq - Raise INTx IRQ to the host
466+ * @ep: DWC EP device
467+ * @func_no: Function number of the endpoint
468+ *
469+ * Return: 0 if success, errono otherwise.
470+ */
443471int dw_pcie_ep_raise_intx_irq (struct dw_pcie_ep * ep , u8 func_no )
444472{
445473 struct dw_pcie * pci = to_dw_pcie_from_ep (ep );
@@ -451,6 +479,14 @@ int dw_pcie_ep_raise_intx_irq(struct dw_pcie_ep *ep, u8 func_no)
451479}
452480EXPORT_SYMBOL_GPL (dw_pcie_ep_raise_intx_irq );
453481
482+ /**
483+ * dw_pcie_ep_raise_msi_irq - Raise MSI IRQ to the host
484+ * @ep: DWC EP device
485+ * @func_no: Function number of the endpoint
486+ * @interrupt_num: Interrupt number to be raised
487+ *
488+ * Return: 0 if success, errono otherwise.
489+ */
454490int dw_pcie_ep_raise_msi_irq (struct dw_pcie_ep * ep , u8 func_no ,
455491 u8 interrupt_num )
456492{
@@ -500,6 +536,15 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
500536}
501537EXPORT_SYMBOL_GPL (dw_pcie_ep_raise_msi_irq );
502538
539+ /**
540+ * dw_pcie_ep_raise_msix_irq_doorbell - Raise MSI-X to the host using Doorbell
541+ * method
542+ * @ep: DWC EP device
543+ * @func_no: Function number of the endpoint device
544+ * @interrupt_num: Interrupt number to be raised
545+ *
546+ * Return: 0 if success, errno otherwise.
547+ */
503548int dw_pcie_ep_raise_msix_irq_doorbell (struct dw_pcie_ep * ep , u8 func_no ,
504549 u16 interrupt_num )
505550{
@@ -519,6 +564,14 @@ int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no,
519564 return 0 ;
520565}
521566
567+ /**
568+ * dw_pcie_ep_raise_msix_irq - Raise MSI-X to the host
569+ * @ep: DWC EP device
570+ * @func_no: Function number of the endpoint device
571+ * @interrupt_num: Interrupt number to be raised
572+ *
573+ * Return: 0 if success, errno otherwise.
574+ */
522575int dw_pcie_ep_raise_msix_irq (struct dw_pcie_ep * ep , u8 func_no ,
523576 u16 interrupt_num )
524577{
@@ -566,6 +619,13 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
566619 return 0 ;
567620}
568621
622+ /**
623+ * dw_pcie_ep_exit - Deinitialize the endpoint device
624+ * @ep: DWC EP device
625+ *
626+ * Deinitialize the endpoint device. EPC device is not destroyed since that will
627+ * be taken care by Devres.
628+ */
569629void dw_pcie_ep_exit (struct dw_pcie_ep * ep )
570630{
571631 struct dw_pcie * pci = to_dw_pcie_from_ep (ep );
@@ -601,6 +661,14 @@ static unsigned int dw_pcie_ep_find_ext_capability(struct dw_pcie *pci, int cap)
601661 return 0 ;
602662}
603663
664+ /**
665+ * dw_pcie_ep_init_complete - Complete DWC EP initialization
666+ * @ep: DWC EP device
667+ *
668+ * Complete the initialization of the registers (CSRs) specific to DWC EP. This
669+ * API should be called only when the endpoint receives an active refclk (either
670+ * from host or generated locally).
671+ */
604672int dw_pcie_ep_init_complete (struct dw_pcie_ep * ep )
605673{
606674 struct dw_pcie * pci = to_dw_pcie_from_ep (ep );
@@ -723,6 +791,15 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)
723791}
724792EXPORT_SYMBOL_GPL (dw_pcie_ep_init_complete );
725793
794+ /**
795+ * dw_pcie_ep_init - Initialize the endpoint device
796+ * @ep: DWC EP device
797+ *
798+ * Initialize the endpoint device. Allocate resources and create the EPC
799+ * device with the endpoint framework.
800+ *
801+ * Return: 0 if success, errno otherwise.
802+ */
726803int dw_pcie_ep_init (struct dw_pcie_ep * ep )
727804{
728805 int ret ;
0 commit comments