PCIE-EP mode in AGX orin

For the EP_READY_N,

Please refer to
kernel/3rdparty/canonical/linux-jammy/kernel-source/Documentation/devicetree/bindings/pci/nvidia,tegra194-pcie.txt

nvidia,pex-prsnt-gpios: Must contain a phandle to a GPIO controller followed by GPIO that is being used to support hot plug and unplug via PRSNT# pin.

Above property should be register for both RP and EP, and in the EP link up commands,

           echo 1 > controllers/141a0000.pcie_ep/start #This will drive PRSNT#/EP_READY_N as low to link up
           echo 0 > controllers/141a0000.pcie_ep/start #This will drive PRSNT#/EP_READY_N as high to link down

This is just experimental setting that we only validated on internal hardware.

I registered GPIO38(EE.05) as “nvidia,pex-prsnt” in dts. Below is the dts information.

pcie-ep@141e0000 {
power-domains = <0x03 0x10>;
iommus = <0xe4 0x08>;
nvidia,host1x = <0x101>;
pinctrl-names = “default”;
dma-coherent;
nvidia,pex-prsnt-gpios = <0xf9 0x25 0x01>;
interconnect-names = “dma-mem\0write”;
phy-names = “p2u-0\0p2u-1\0p2u-2\0p2u-3\0p2u-4\0p2u-5\0p2u-6\0p2u-7”;
nvidia,bpmp = <0x03 0x07>;
pinctrl-0 = <0x11d>;
clock-names = “core”;
interconnects = <0x51 0x2a 0x52 0x51 0x30 0x52>;
reg-names = “appl\0atu_dma\0dbi\0addr_space”;
nvidia,aspm-l0s-entrance-latency-us = <0x03>;
num-ob-windows = <0x08>;
resets = <0x03 0x0f 0x03 0x0e>;
interrupts = <0x00 0x162 0x04>;
clocks = <0x03 0xab>;
nvidia,enable-ext-refclk;
reset-gpios = <0xe7 0xc1 0x01>;
num-lanes = <0x08>;
compatible = “nvidia,tegra234-pcie-ep”;
vddio-pex-ctl-supply = <0x108>;
iommu-map-mask = <0x00>;
status = “okay”;
interrupt-names = “intr”;
phys = <0x115 0x116 0x117 0x118 0x119 0x11a 0x11b 0x11c>;
reg = <0x00 0x141e0000 0x00 0x20000 0x00 0x3e040000 0x00 0x40000 0x00 0x3e080000 0x00 0x40000 0x2e 0x40000000 0x04 0x00>;
nvidia,refclk-select-gpios = <0xe7 0xc0 0x00>;
iommu-map = <0x00 0xe4 0x08 0x1000>;
reset-names = “apb\0core”;
nvidia,aspm-pwr-on-t-us = <0x14>;
nvidia,aspm-cmrt-us = <0x3c>;
num-ib-windows = <0x02>;
};

pcie@141e0000 {
power-domains = <0x03 0x10>;
iommus = <0xe4 0x08>;
vpcie3v3-supply = <0x109>;
#address-cells = <0x03>;
dma-coherent;
nvidia,pex-prsnt-gpios = <0xf9 0x25 0x01>;
interconnect-names = “dma-mem\0write”;
phy-names = “p2u-0\0p2u-1\0p2u-2\0p2u-3\0p2u-4\0p2u-5\0p2u-6\0p2u-7”;
nvidia,bpmp = <0x03 0x07>;
bus-range = <0x00 0xff>;
clock-names = “core”;
interconnects = <0x51 0x2a 0x52 0x51 0x30 0x52>;
reg-names = “appl\0config\0atu_dma\0dbi\0ecam”;
nvidia,aspm-l0s-entrance-latency-us = <0x03>;
resets = <0x03 0x0f 0x03 0x0e>;
interrupts = <0x00 0x162 0x04 0x00 0x163 0x04>;
clocks = <0x03 0xab>;
interrupt-map = <0x00 0x00 0x00 0x00 0x01 0x00 0x162 0x04>;
#size-cells = <0x02>;
vpcie12v-supply = <0x10a>;
device_type = “pci”;
interrupt-map-mask = <0x00 0x00 0x00 0x00>;
num-lanes = <0x08>;
compatible = “nvidia,tegra234-pcie”;
vddio-pex-ctl-supply = <0x108>;
ranges = <0x43000000 0x30 0x00 0x30 0x00 0x02 0x28000000 0x2000000 0x00 0x40000000 0x32 0x28000000 0x00 0x8000000 0x1000000 0x00 0x3e100000 0x00 0x3e100000 0x00 0x100000>;
iommu-map-mask = <0x00>;
#interrupt-cells = <0x01>;
status = “disabled”;
interrupt-names = “intr\0msi”;
phys = <0x115 0x116 0x117 0x118 0x119 0x11a 0x11b 0x11c>;
num-viewport = <0x08>;
reg = <0x00 0x141e0000 0x00 0x20000 0x00 0x3e000000 0x00 0x40000 0x00 0x3e040000 0x00 0x40000 0x00 0x3e080000 0x00 0x40000 0x32 0x30000000 0x00 0x10000000>;
linux,pci-domain = <0x07>;
iommu-map = <0x00 0xe4 0x08 0x1000>;
reset-names = “apb\0core”;
nvidia,aspm-pwr-on-t-us = <0x14>;
nvidia,aspm-cmrt-us = <0x3c>;
};

If you check with the gpioinfo command, it seems to have been registered normally.

gpioinfo

line 28: “PEE.05” “nvidia,pex-prsnt” output active-low [used]

GPIO38 is still low even when I give the command below.
echo 1 > /sys/kernel/config/pci_ep/controllers/141e0000.pcie-ep/start
echo 0 > /sys/kernel/config/pci_ep/controllers/141e0000.pcie-ep/start

Is this normal?

I set GPIO38 pinmux to bidirection in the bootloader and confirmed that the prsnt pin moves high/low.

Any question still? The key point is the isolator.