SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
This section aims to describe only the basic steps that must be followed by PCIe application software in order for a PCIe RC or EP type device to initialize, establish PCIe connectivity and interact with devices on the PCIe fabric. For this reason, it focuses on settings of the PCIe controllers wrapper registers (and not on PCI/PCIe standard and non-standard (PL) registers), through which PCIe application interacts with PCIe devices.
RC and/or EP Initialization Step(1) | Register/Bit Field/Programming Model | Value |
---|---|---|
1. Initialize the DPLL_PCIe_REF (clock source, dividers, power dependencies) in PRCM | Refer to Section 26.4.5 | |
2. Assert a local software main reset to the PCIe_SS1,2 controllers | PRCM.RM_PCIESS_RSTCTRL[0] RST_LOCAL_PCIE1 PRCM.RM_PCIESS_RSTCTRL[1] RST_LOCAL_PCIE2 | 0b1 |
3. Poll main reset completion status for the PCIe_SS1,2 controllers | PRCM.RM_PCIESS_RSTST[0] RST_LOCAL_PCIE1 PRCM.RM_PCIESS_RSTST[1] RST_LOCAL_PCIE2 | =0b1 |
4. Perform tuning of the PCIe PHY | Refer to Section 26.4.5 | |
IF: required operation mode for PCIe controller is “RC” | Software Test Condition | |
5. Select RC type | PCIECTRL_TI_CONF_DEVICE_TYPE[3:0] TYPE | 0x4 (default) |
6. Poll to insure a fundamental reset has completed | PCIECTRL_TI_CONF_DEVICE_TYPE[3:0] TYPE | =0x4 |
7. Make sure LTSSM_EN is kept by RC’s software at value 0b0 | PCIECTRL_TI_CONF_DEVICE_CMD[0] LTSSM_EN | 0b0 |
8. Initialize RC PCIe controller’s core registers. | See Table 24-513 | |
9. Clear the IRQ main status register in case raw status is not clear (to avoid spurious interrupts) | PCIECTRL_TI_CONF_IRQSTATUS_MAIN[31:0] | 0xFFFFFFFF |
10. First time enable PCIe main interrupts. Depends on which PCIe protocol events and error events will be handled by application. | PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN [14:0] | 0x- |
11. Clear the IRQ msi status register in case raw status is not clear (to avoid spurious interrupts) | PCIECTRL_TI_CONF_IRQSTATUS_MSI[31:0] | 0xFFFFFFFF |
12. [optional step] Enable INTx (x=A,B,C,D) interrupts reception (generated from legacy EPs to RC) but disable MSI interrupts reception at the same time. OR Enable the MSI interrupts reception (MSI interrupts are generated to RC from PCIe EPs only) but disable the INTx interrupts reception at the same time | PCIECTRL_TI_CONF_IRQENABLE_SET_MSI [3:0] INTx_EN | 0x- |
PCIECTRL_TI_CONF_IRQENABLE_CLR_MSI [4] MSI_EN | 0b1 | |
PCIECTRL_TI_CONF_IRQENABLE_SET_MSI [4] MSI_EN | 0b1 | |
PCIECTRL_TI_CONF_IRQENABLE_CLR_MSI [3:0] INTx_EN | 0xF | |
ELSE IF: required operation mode for PCIe controller is “PCIe EP” | ||
5. Select “PCIe EP” type | PCIECTRL_TI_CONF_DEVICE_TYPE[3:0] TYPE | 0x0 |
6. Poll to insure fundamental reset has completed | PCIECTRL_TI_CONF_DEVICE_TYPE[3:0] TYPE | =0x0 |
7. Make sure LTSSM_EN is kept by EP’s software at value 0b0 | PCIECTRL_TI_CONF_DEVICE_CMD[0] LTSSM_EN | 0b0 |
8. Initialize EP PCIe controller’s core registers | See Table 24-512 | |
9. Clear the IRQ main status register in case raw status is not clear (to avoid spurious interrupts) | PCIECTRL_TI_CONF_IRQSTATUS_MAIN[31:0] | 0xFFFFFFFF |
10. First time enable –PCIe main interrupts. Depends on which PCIe protocol events and error events will be handled by application. | PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN [14:0] | 0x- |
11. Clear the IRQ msi status register in case raw status is not clear (to avoid spurious interrupts) | PCIECTRL_TI_CONF_IRQSTATUS_MSI[31:0] | 0xFFFFFFFF |
12. Disable both INTx (x=A,B,C,D) and MSI interrupts reception. | PCIECTRL_TI_CONF_IRQENABLE_CLR_MSI [4:0] | 0x1F |
ELSE: | ||
5. Select “PCI Legacy EP ” type | PCIECTRL_TI_CONF_DEVICE_TYPE[3:0] TYPE | 0x1 |
6. Poll to insure fundamental reset has completed | PCIECTRL_TI_CONF_DEVICE_TYPE[3:0] TYPE | =0x1 |
7. Make sure LTSSM_EN is kept by EP’s software at value 0b0 | PCIECTRL_TI_CONF_DEVICE_CMD[0] LTSSM_EN | 0b0 |
8. Initialize EP controller local registers via DIF CS/CS2 accesses | See Table 24-512 | |
9. Clear the IRQ main status register in case raw status is not clear (to avoid spurious interrupts) | PCIECTRL_TI_CONF_IRQSTATUS_MAIN[31:0] | 0xFFFFFFFF |
10. First time enable PCIe main interrupts. Depends on which PCIe protocol events and error events will be handled by application. | PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN [14:0] | 0x- |
11. Clear the IRQ main status register in case raw status is not clear (to avoid spurious interrupts) | PCIECTRL_TI_CONF_IRQSTATUS_MSI[31:0] | 0xFFFFFFFF |
12. Disable both INTx (x=A,B,C,D) and MSI interrupts reception | PCIECTRL_TI_CONF_IRQENABLE_CLR_MSI [4:0] | 0x1F |
ENDIF | ||
13. PCIe (RC/EP) controller enables the link. It is supposed that all active EPs attached on the PCIe fabric synchronously enable their LTSSM engine with the RC. | PCIECTRL_TI_CONF_DEVICE_CMD[0] LTSSM_EN | 0b1 |
14. Local CPU polls until the PCIe Controller link is up (that is, brought into L0- power state) | PCIECTRL_TI_CONF_PHY_CS[16] LINK_UP | =0b1 |
15. If PCIECTRL_TI_CONF_IRQSTATUS_MAIN[3] LINK_UP_EVT has been enabled in step (10), this means it should be cleared | PCIECTRL_TI_CONF_IRQSTATUS_MAIN[12] LINK_UP_EVT | 0b1 |
16. RC host starts link training sequence, negotiation with EPs, enumeration of the EPs, and initializes the descriptors per each of the discovered EP functions. Example: RC Initializes the MSI message vectors table per each of the EPs. RC maps the EPs global PCIe Memory per each EP function appropriately initializing the BARn registers MSB part. | ||
17. [RC only] IF: an EP is a requester, the RC remotely enables its BME bit via an ECAM access to the EP’s command /status register. | PCIe_SS1_EP_CFG_PCIe. PCIECTRL_EP_PCIEWIRE_STATUS_COMMAND_REGISTER[2] BUSMASTER_EN | 0b1 |
18. [RC only] IF: an EP is a completer, the RC remotely enables its MSE (for Mem transfers) or ISE bits (for legacy I/O transfers) via an ECAM access to the EP’s command/status register. | PCIe_SS1_EP_CFG_PCIe. PCIECTRL_EP_PCIEWIRE_STATUS_COMMAND_REGISTER[1] MEM_SPACE_EN OR PCIe_SS1_EP_CFG_PCIe. PCIECTRL_EP_PCIEWIRE_STATUS_COMMAND_REGISTER[0] IO_SPACE_EN | 0b1 |
19. [EP only] Before EP’s application generates a request (that is, requester EP), the EP application must insure that its local BME_EVT status has already been asserted to 0b1 by the RC host controller. | PCIECTRL_TI_CONF_IRQSTATUS_MAIN[13] BME_EVT_MSG OR PCIECTRL_TI_CONF_IRQSTATUS_RAW_MAIN[13] BME_EVT_MSG | =0b1 |
The EP must locally clear the BME interrupt, writing BME_EVT_MSG flag to 0b1 (Wr1toClr). | Wr1ToClr PCIECTRL_TI_CONF_IRQSTATUS_MAIN[13] BME_EVT_MSG | 0b1 |
20. [RC only] Before RC application initiates a request to an completer EP function with a Memory type BAR, the RC must check that EP’s MEM_SPACE_EN flag has already been asserted by the RC host. This is done via an ECAM remote access by RC to EP’s command/status register. [EP Only] The EP’s CPU is notified about remote MEM_SPACE_EN flag assertion in a dedicated bit that can be enabled to generate an interrupt. The interrupt flag is cleared via writing to 0b1 (Wr1ToClr). | PCIe_SS1,2_EP_CFG_PCIe. PCIECTRL_EP_PCIEWIRE_STATUS_COMMAND_REGISTER[1] MEM_SPACE_EN | =0b1 |
The EP application may receive an interrupt (if enabled – see step 10) indicated in the PCIECTRL_TI_CONF_IRQSTATUS_MAIN[14] MSE_EVT_MSG. Or poll this in PCIECTRL_TI_CONF_IRQSTATUS_RAW_MAIN[14] MSE_EVT_MSG. | 0b1 | |
20. [RC only] Before RC application initiates a request to a completer EP function with an I/O type BAR, the RC must check that EP’s IO_SPACE_EN flag has already been asserted by the RC host. This is done via an ECAM remote read access by RC to EP’s command/status register. | PCIe_SS1,2_EP_CFG_PCIe. PCIECTRL_EP_PCIEWIRE_STATUS_COMMAND_REGISTER[0] IO_SPACE_EN | =0b1 |
[EP Only] Unlike Mem type EPs, there is no interrupt event to notify the EP about its ISE flag being asserted by the RC. So, to be aware of an incoming transaction, I/O legacy EP must poll local IO_SPACE_EN flag until its asserted by RC to 0b1. | PCIECTRL_EP_DBICS_STATUS_COMMAND_REGISTER[0] IO_SPACE_EN | =0b1 |
[EP Only] 21. IF IO_SPACE_EN bit has been set to ‘1’ for a legacy EP, user must force the legacy EP master port out-of-standby (before first transaction). There is no automatical standby generation for I/O transfers. | PCIECTRL_TI_CONF_SYSCONFIG[5:4] STANDBYMODE | 0x1 |
8.1 Initialize PCI standard configuration header registers via corresponding DIF CS/CS2 accesses. Example: BAR MASK0 – BAR MASK5 (that must be entirely initialized by the EP, and LSB part of the BAR0 – BAR5 registers) | For more details on these settings, refer to the PCI Express Base 3.0 Specification, revision 1.0 | |
8.2 Initialize the RC PCIe capability registers via corresponding DIF CS/CS2 accesses. | For more details on these settings, refer to the PCI Express Base 3.0 Specification, revision 1.0 | |
8.3 Initialize the RC PCIe Port Logic registers. Example: iATU settings of internal local address ranges, link settings – link powers, timings, and so forth |
RC must enable write operation to be able to configure its own PCIe standard and PL registers. | PCIECTRL_PL_DBI_RO_WR_EN[0] CX_DBI_RO_WR_EN | 0b1 |
8. 1 Initialize RC PCI standard configuration header registers via corresponding DIF CS/CS2 accesses. (Example: RC BAR 0,1 and BAR MASK0,1 registers.) | For more details on these settings, refer to the PCI Express Base 3.0 Specification, revision 1.0 | |
8.2 Initialize the RC PCIe capability registers via corresponding DIF CS/CS2 accesses. | For more details on these settings, refer to the PCI Express Base 3.0 Specification, revision 1.0 | |
8.3 Initialize the RC PCIe Port Logic registers. Example: iATU settings of internal local address ranges, link settings – link power, timings, and so forth Prepare the MSI vectors, Setup of the MSI, others. | ||
Disable write operation in RC PCIe standard and PL registers. | PCIECTRL_PL_DBI_RO_WR_EN[0] CX_DBI_RO_WR_EN | 0b0 |
When the PCIe_SS1 controller is configured to operate in two lane mode, by default lane 0 is mapped to the PCIe1_PHY (device PCIe PHY port 0), and lane 1 is mapped to the PCIe2_PHY (device PCIe PHY port 1). The PCIe_SS1_TI_CONF wrapper located software control - PCIECTRL_TI_CONF_PHY_CS[0] REVERSE_LANES allows user software to swap mapping of the PCIe_SS1 controller lane 0 and lane 1 on the two device PCIe PHY ports (swapping the RX and TX paths simultaneously with polarity of an individual lane unchanged). Note that the identical control is not functional in the PCIe_SS2_TI_CONF, because the PCIe_SS2 can operate in a single lane mode only, and (if selected) its lane 0 is always mapped to the PCIe PHY port 1 (that is, PCIe2_PHY).