88. PCIe subsystem (PCIESS)

88.1 Introduction

The PCIe subsystem includes a single lane PCIe Gen2 controller with ePTM support, a single lane PHY and a PCIe clock generator (100 MHz).

The subsystem is in the D2 (\(V_{DDCORE}\)) power domain. PCIe substate L1.1 is supported via the PCIe_CLKREQN pin. This allows the PHY PLL to be stopped (saving a lot of power).

The single lane PHY is called COMBOPHY because it is shared with a USB3DR controller. Only one protocol can be active at a time.

88.2 Main features

The subsystem includes a PCIe controller with the following features:

The following features are not supported:

The L1.1 substate (power saving mode) has an external signal called PCIe_CLKREQN (clock request, active-low).

The ePTM feature coordinates timing information across multiple PCIe devices with independent local time-bases.

The subsystem also includes a PHY with the following features:

88.3 Functional description

88.3.1 Block diagram

Figure 1065. PCIE subsystem diagram

Block diagram of the PCIE subsystem showing connections between APB bus, AXI bus (mstr, slv, dbi), USB3DR, PCIE controller with ePTM, and COMBOPHY (digital and analog sections) connected to COMBOPHY_TX1, COMBOPHY_RX1, PCIE_CLKIN, PCIE_CLKOUT, PCIE_CLKREQN, and PTM signals.

The diagram illustrates the PCIE subsystem architecture. It is divided into two main internal modules: the COMBOPHY and the PCIE controller. The COMBOPHY module is split into digital and analog sections. The digital section contains two PIPE interfaces, one of which connects to a USB3DR block. The analog section includes the COMBOPHY_TX1 and COMBOPHY_RX1 differential pairs, the PCIEREFGEN analog block, and the PCIEGLU block. The PCIE controller module includes an ePTM block and is connected to the AXI bus via mstr, slv, and dbi lines. The APB bus connects to the COMBOPHY digital section. External interfaces include COMBOPHY_TX1, COMBOPHY_RX1, PCIE_CLKIN, PCIE_CLKOUT, and PCIE_CLKREQN. Control signals such as ptm_clock_updated and ptm_responder_rdy_to_validate are also shown. A legend at the bottom defines line types: solid for Bus, thin solid for Single wire, and dashed-dotted for Differential pair. Reference identifier: MSv68386V2.

Block diagram of the PCIE subsystem showing connections between APB bus, AXI bus (mstr, slv, dbi), USB3DR, PCIE controller with ePTM, and COMBOPHY (digital and analog sections) connected to COMBOPHY_TX1, COMBOPHY_RX1, PCIE_CLKIN, PCIE_CLKOUT, PCIE_CLKREQN, and PTM signals.

The subsystem has two main modules:

The COMBOPHY must be set to PCIe mode by programming COMBOPHY_MODESEL in SYSCFG_COMBOPHYCR2. This selects the PCIE PIPE interface. The PCIE controller type (RC or EP) must be selected by programming DEVICE_TYPE in SYSCFG_PCIECR.

The PCIEGLU manages the L1.1 substate clock control pin (PCIE_CLKREQN). It also performs the basic clock gating using signals from the RCC. This signal is a shared wire between the link partners and therefore is an open-drain I/O. If needed, the pull-up can be enabled in the GPIO.

The PCIEREFGEN output clock is disabled by default and can be enabled by programming PRG_EN in SYSCFG_PCIEPRGCR.

88.3.2 ePTM

The PTM synchronization is initiated from a requester (EP) to a responder (RC).
The PCIe controller performs the timestamp update process without software intervention. The hardware generates the PTM request TLPs and responds with the PTM response and PTM ResponseD messages.

A lot of status and timestamp information is available in the PCIe standard VSEC (vendor-specific extended capability) registers PF0_PTM_RES_CAP and

PF0_PTM_REQ_CAP. Multiple timestamps including current and previous values are available.

Local PTM clock

The local PTM clock is auto-updated on a PTM context refresh, but can also be updated (or read) by software.

The local clock is clocked by core_clk (from COMBOPHY) and counts time in non-integer nanoseconds. The PCIe capability register reports the local clock granularity (range 1-254; the period of local clock in nanoseconds).

The local PTM timestamp is available as a subsystem port, which can be used to assist with time synchronization with other standards (for example Ethernet PTP).

PTM timers

The controller implements 1 μs and 100 μs timers, and a 10 ms timer is available to the requester for automatic PTM context updates.

Transmit and receive latency setup

If the Tx and Rx latency registers are not programmed, the default latency values are the same for all speeds, and are set by configuration parameters.

The latency registers can be written to at any time with more accurate values.

For the best accuracy, Tx and Rx latency values must be programmed during initialization, for each supported link speed.

System time synchronization

The ptm_local_clock value is output to trigger system timer blocks (TIM2 and TIM3). This allows an application to perform cross timestamping between different time references.

The bits 17 and 20 from ptm_local_clock are connected at device level to TIM2 and TIM3. This gives a rising edge once every 1 ms and 8 ms (approximately) when core_clk is 250 MHz. This can only be used when the PCIe link is established.

Software management

Although the PTM operates in hardware, there are some signals to direct the process and keep software informed of the status.

The ptm_external_master_time is not used, so ptm_external_master_strobe is set to zero.

If auto-updates are required (every 10 ms) then

PF0_PTM_REQ_CAP_PTM_REQ_CONTROL_OFF must be programmed in the controller. Alternatively a single update can be requested by setting

PF0_PTM_REQ_CAP_PTM_REQ_CONTROL_OFF but only if PF0_PTM_REQ_CAP_PTM_REQ_STATUS_OFF is asserted.

It is important that the software knows when the PTM context becomes invalid, and when it must be revalidated. The PTM context can be invalidated for many reasons, for example due to duplicate responses or replays, speed change, or L0 exit.

There is a PF0_PTM_REQ_CAP_PTM_REQ_STATUS_OFF register which can be checked. However two interrupts can inform the driver of significant events:

There are three other signals for error conditions:

The SYSCFG_PCIESR1 register reports the status of these signals.

The SYSCFG_PCIEPTMIRQCR register provides bits to clear most of these signals because they have been converted from pulse to level.

Situations where error interrupts can be generated must be ignored (see the controller documentation). The driver can check PTM_UPDATING status in SYSCFG_PCIESR1 to implement this.

The ptm_responder_rdy_to_validate interrupt means the driver can set a validate context by writing to the PF0_PTM_RES_CAP_PTM_RES_LOCAL_LSB_OFF registers, then setting PF0_PTM_RES_CAP_PTM_RES_STATUS_OFF to 1, which automatically asserts ptm_context_valid. This interrupt must be used when recovering from errors.

The pcie_1_ptm_clock_updated interrupt is potentially useful for system time synchronization, however it can also be ignored in the normal PTM operation.

88.4 PCIESS registers

The PCIESS registers are documented in Section 25: System configuration controller (SYSCFG).

Table 888. PCIESS register list

SYSCFG address offsetRegister name
0x6000SYSCFG_PCIECR
0x6004SYSCFG_PCIEPMEMSI CR
0x6008SYSCFG_PCIEAERRCMSICR
0x600CSYSCFG_PCIESYSRCCR
0x6010SYSCFG_PCIEPTMIRQCR
0x6080SYSCFG_PCIEPRGCR
0x6100SYSCFG_PCIESR1
0x6104SYSCFG_PCIESR2