15
15
#include <linux/pci-epc.h>
16
16
#include <linux/pci-epf.h>
17
17
18
+ /**
19
+ * dw_pcie_ep_linkup - Notify EPF drivers about Link Up event
20
+ * @ep: DWC EP device
21
+ */
18
22
void dw_pcie_ep_linkup (struct dw_pcie_ep * ep )
19
23
{
20
24
struct pci_epc * epc = ep -> epc ;
@@ -23,6 +27,10 @@ void dw_pcie_ep_linkup(struct dw_pcie_ep *ep)
23
27
}
24
28
EXPORT_SYMBOL_GPL (dw_pcie_ep_linkup );
25
29
30
+ /**
31
+ * dw_pcie_ep_init_notify - Notify EPF drivers about EPC initialization complete
32
+ * @ep: DWC EP device
33
+ */
26
34
void dw_pcie_ep_init_notify (struct dw_pcie_ep * ep )
27
35
{
28
36
struct pci_epc * epc = ep -> epc ;
@@ -31,6 +39,14 @@ void dw_pcie_ep_init_notify(struct dw_pcie_ep *ep)
31
39
}
32
40
EXPORT_SYMBOL_GPL (dw_pcie_ep_init_notify );
33
41
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
+ */
34
50
struct dw_pcie_ep_func *
35
51
dw_pcie_ep_get_func_from_ep (struct dw_pcie_ep * ep , u8 func_no )
36
52
{
@@ -61,6 +77,11 @@ static void __dw_pcie_ep_reset_bar(struct dw_pcie *pci, u8 func_no,
61
77
dw_pcie_dbi_ro_wr_dis (pci );
62
78
}
63
79
80
+ /**
81
+ * dw_pcie_ep_reset_bar - Reset endpoint BAR
82
+ * @pci: DWC PCI device
83
+ * @bar: BAR number of the endpoint
84
+ */
64
85
void dw_pcie_ep_reset_bar (struct dw_pcie * pci , enum pci_barno bar )
65
86
{
66
87
u8 func_no , funcs ;
@@ -440,6 +461,13 @@ static const struct pci_epc_ops epc_ops = {
440
461
.get_features = dw_pcie_ep_get_features ,
441
462
};
442
463
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
+ */
443
471
int dw_pcie_ep_raise_intx_irq (struct dw_pcie_ep * ep , u8 func_no )
444
472
{
445
473
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)
451
479
}
452
480
EXPORT_SYMBOL_GPL (dw_pcie_ep_raise_intx_irq );
453
481
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
+ */
454
490
int dw_pcie_ep_raise_msi_irq (struct dw_pcie_ep * ep , u8 func_no ,
455
491
u8 interrupt_num )
456
492
{
@@ -500,6 +536,15 @@ int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no,
500
536
}
501
537
EXPORT_SYMBOL_GPL (dw_pcie_ep_raise_msi_irq );
502
538
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
+ */
503
548
int dw_pcie_ep_raise_msix_irq_doorbell (struct dw_pcie_ep * ep , u8 func_no ,
504
549
u16 interrupt_num )
505
550
{
@@ -519,6 +564,14 @@ int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no,
519
564
return 0 ;
520
565
}
521
566
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
+ */
522
575
int dw_pcie_ep_raise_msix_irq (struct dw_pcie_ep * ep , u8 func_no ,
523
576
u16 interrupt_num )
524
577
{
@@ -566,6 +619,13 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
566
619
return 0 ;
567
620
}
568
621
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
+ */
569
629
void dw_pcie_ep_exit (struct dw_pcie_ep * ep )
570
630
{
571
631
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)
601
661
return 0 ;
602
662
}
603
663
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
+ */
604
672
int dw_pcie_ep_init_complete (struct dw_pcie_ep * ep )
605
673
{
606
674
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)
723
791
}
724
792
EXPORT_SYMBOL_GPL (dw_pcie_ep_init_complete );
725
793
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
+ */
726
803
int dw_pcie_ep_init (struct dw_pcie_ep * ep )
727
804
{
728
805
int ret ;
0 commit comments