PCIe Driver

In industrial scenarios, to form a SoC+FPGA design, PCIe expansion network cards or PCIe EP devices (connected to FPGA via PCIe) are required. FPGA is used for data collection and may have real-time requirements for communication with SoC. JH-7110 includes two PCIe 2.0 hosts, and a single PCIe 2.0 theoretically supports a maximum speed of 500MB/s, with a wide range of industrial applications. Therefore, StarFive ported PCIe drivers to the RTOS side and connected PCIe network cards to verify the PCIe drivers on the RTOS.
Tip: At present, the driver only supports PCIe bus single device, but does not support the multi-device driver under PCIe connected to switch.
The PCIe1 on VisionFive 2 uses an M.2 Key interface, which can be extended to a PCIe interface through a patch cord. PCIe can be verified by connecting to an RTL816X series PCIe network card, and the RTL816X driver is also supported on the RTOS. In the following demo, it can be seen that the RT-Thread supports dual gigabit network cards of GMAC1 and RTL8161 for JH-7110.
Figure 1. PCIe Driver
The following figure shows the PCIe driver initialization printing and RTL8161 network card initialization process. After PCIe initialization, it will scan devices on the PCI bus and be able to scan network card devices. After matching the ID, the RTL8161 network card driver will perform initialization and apply for MSI interrupt. As shown in the figure below, the GE network card has been initialized and registered, and the IP address has been successfully applied and PCIe network card can work normally.
Figure 2. Initialization Process
At the same time, both network cards can get IP address and access the network.
  • Get IP address:
    Figure 3. Get IP Address
  • Access the network:
    Figure 4. Access the Network