Power & Source of Big Ideas

PCI-E 1x device connection to Neo4

Moderators: chensy, FATechsupport

Hello,
I would like to connect external PCI-E 1x device (Realtek 8111C GbE network card) to Neo4 GPIO1 slot for some testing purposes using short wires or making pcb adapter.
It is easy to find RX0 / TX0 / Clock pairs as well as 3V3 / GND power supply on Neo4 GPIO1 connector.

The question is about following pins exists on network card (PCI-E 1x pinout):
- Pin A1 - PRSNT#1 Hot plug presence detect
- Pin A11 - PWRGD (PERST#) Power Good
- Pin B11 - WAKE# Link Reactivation
- Pin B17 - PRSNT#2 Hotplug detect
1) Where is corresponding pins on Neo4 side?
2) Which pins of these four are mandatory to make GbE card correctly connected to Neo4?
I was finally able to enable Realtek RTL8111F PCIE x1 GbE network card utilizing Nanopi-Neo4 GPIO 40 pin slot. It seems to be working as expected. Armbian Focal / kernel 5.6.14

IMG_20200605_202615.jpg
IMG_20200605_202615.jpg (118.7 KiB) Viewed 5339 times


Only 8(9) wires used:
PCI-E TX0n/TX0p - 1 pair
PCI-E RX0n/RX0p - 1 pair
PCIE_REF_CLKP/CLKN - 1 pair
GND, 3V3_SYS - connected to 3v3 and 3v3 AUX on realtek card.
I guess separate 3v3 voltage regulator should be used instead of engaging 3V3_SYS pin.

Patching dtbs was required in my particular case:

Code: Select all

--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi   2020-06-05 20:23:07.690753634 +0300
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi   2020-06-05 20:23:58.906751560 +0300
@@ -550,8 +550,8 @@
 
 &pcie0 {
    ep-gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_HIGH>;
-   max-link-speed = <2>;
-   num-lanes = <2>;
+   max-link-speed = <1>;
+   num-lanes = <1>;
    vpcie0v9-supply = <&vcca0v9_s3>;
    vpcie1v8-supply = <&vcca1v8_s3>;
    status = "okay";


Setting num-lanes = <1> was not really necessary but max-link-speed = <1> was mandatory, otherwise kernel panics during pcie probe. I am not sure was it software issue or something else like impedance mismatching.

Code: Select all

pi@nanopineo4:~$ uname -a
Linux nanopineo4 5.6.14+ #55 SMP PREEMPT Wed Jun 3 06:13:21 EEST 2020 aarch64 aarch64 aarch64 GNU/Linux


Code: Select all

pi@nanopineo4:~$ sudo lspci -v
00:00.0 PCI bridge: Fuzhou Rockchip Electronics Co., Ltd RK3399 PCI Express Root Port (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0, IRQ 242
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        I/O behind bridge: 00000000-00000fff [size=4K]
        Memory behind bridge: fa000000-fa0fffff [size=1M]
        Prefetchable memory behind bridge: 00000000-000fffff [size=1M]
        Capabilities: [80] Power Management version 3
        Capabilities: [90] MSI: Enable+ Count=1/1 Maskable+ 64bit+
        Capabilities: [b0] MSI-X: Enable- Count=1 Masked-
        Capabilities: [c0] Express Root Port (Slot+), MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [274] Transaction Processing Hints
        Kernel driver in use: pcieport
lspci: Unable to load libkmod resources: error -12

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 09)
        Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
        Flags: bus master, fast devsel, latency 0, IRQ 243
        I/O ports at <unassigned> [disabled]
        Memory at fa004000 (64-bit, prefetchable) [size=4K]
        Memory at fa000000 (64-bit, prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 01-00-00-00-68-4c-e0-00
        Kernel driver in use: r8168
It was definitely bad idea to use 3V3_SYS as PCIE card power supply. So i connected 5V to external 3V3 LDO and used it as realtek card power supply.

I was able to boot with Armbian 20.05.2 Focal / 5.4.43 and PCIE card seems to be working.
Seems like my setup has some problems with PCIE soft reset, engaging pci express device reset pin with additional wire solved this issue.

Device tree changes for my setup:

Code: Select all

&pcie0 {
   ep-gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
   max-link-speed = <1>;
   num-lanes = <1>;
   ....


Default DTS ep-gpios referenced to gpio2 PA4 which is not connected anywhere on the Neo4/M4 board according to schematic.
I used gpio1 PA4 instead (pin 15 GPIO1_A4(3V) on 40-pin GPIO header) and wired it to #PERST (reset) pin on realtek PCI-Express card.

I am not sure that forcing to PCI-E 1x speed is necessary for any setup, sometimes it boots with x2 configuration.

Is anyone interested in this information at all? :)

Who is online

In total there are 33 users online :: 0 registered, 0 hidden and 33 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 33 guests