Verdin iMX8M Mini and PCIe switch issue

Hi,

Does the Verdin iMX8M Mini U-Boot and TorizonCore support the PI7C9X2G404 switch series?
On my custom carrier board, I am facing the following:

torizon@verdin-imx8mm-15400884:~$ dmesg | grep pci
[    1.249140] ehci-pci: EHCI PCI platform driver
[    1.668146] imx6q-pcie 33800000.pcie: PLL REF_CLK is used!.
[    1.671036] imx6q-pcie 33800000.pcie: PCIe PLL locked after 20 us.
[    1.902575] imx6q-pcie 33800000.pcie: host bridge /soc@0/pcie@33800000 ranges:
[    1.902605] imx6q-pcie 33800000.pcie:    IO 0x1ff80000..0x1ff8ffff -> 0x00000000
[    1.902620] imx6q-pcie 33800000.pcie:   MEM 0x18000000..0x1fefffff -> 0x18000000
[    2.895968] imx6q-pcie 33800000.pcie: Phy link never came up
[    2.895987] imx6q-pcie 33800000.pcie: failed to initialize host
[    2.901919] imx6q-pcie 33800000.pcie: unable to add pcie port.

The TorizonCore version is:

TorizonCore 5.7.2+build.20 verdin-imx8mm-15400884 ttymxc0

An old thread mentions something related to the PERST timing:

Is the patch now part of the mainline? Or my issue could be related to something else?

Update:

Correct me if I am wrong, but the patch is no longer applicable (and not included in the downstream).

# git branch -a
* toradex_6.6-2.0.x-imx
  remotes/origin/toradex_6.6-2.0.x-imx
root@hostname:~/toradex/linux-toradex# git log | cat
commit 558ba3740880b6e2bdf86782e9a5052047885721
Author: João Paulo Gonçalves <joao.goncalves@toradex.com>
Date:   Mon Jun 17 13:49:11 2024 -0300

    arm64: dts: freescale: imx8mm-verdin: Add Ivy carrier board
# git apply pcie_perst.patch
error: patch failed: drivers/pci/controller/dwc/pci-imx6.c:1227
error: drivers/pci/controller/dwc/pci-imx6.c: patch does not apply
cat -n drivers/pci/controller/dwc/pci-imx6.c | grep deassert_core
   916	static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie)
  1211	static u64 imx6_pcie_cpu_addr_fixup(struct dw_pcie *pcie, u64 cpu_addr)
  1212	{
  1213		unsigned int offset;
  1214		struct dw_pcie_ep *ep = &pcie->ep;
  1215		struct dw_pcie_rp *pp = &pcie->pp;
  1216		struct imx6_pcie *imx6_pcie = to_imx6_pcie(pcie);
  1217		struct resource_entry *entry;
  1218	
  1219		if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_CPU_ADDR_FIXUP))
  1220			return cpu_addr;
  1221	
  1222		if (imx6_pcie->drvdata->mode == DW_PCIE_EP_TYPE) {
  1223			offset = ep->phys_base;
  1224		} else {
  1225			entry = resource_list_first_type(&pp->bridge->windows,
  1226							 IORESOURCE_MEM);
  1227			offset = entry->res->start;
  1228		}
  1229	
  1230		return (cpu_addr + imx6_pcie->local_addr - offset);
  1231	}
  1232	
  1233	static int imx6_pcie_update_lut(struct imx6_pcie *imx6_pcie, int index,
  1234					u16 reqid, u16 mask, u8 sid)
  1235	{
  1236		struct dw_pcie *pci = imx6_pcie->pci;
  1237		struct device *dev = pci->dev;
  1238		u32 data1, data2;
  1239	
  1240		if (sid >= 64) {
  1241			dev_err(dev, "Too big stream id: %d\n", sid);
  1242			return -EINVAL;
  1243		}

The question now is: is it possible to compile the dwc/pci-imx6 driver as a module (so that I can modify, load, unload and test until I get the correct PERST waveform), without having to make a monolithic build of the whole image?

Hi @vmetodiev

Sorry for the delay, that’s a lot of information to check.

First, about the question, you need to find out which driver you need to use this switch.
Then you need to check if this driver exists and is enabled or not in the linux kernel.

zcat /proc/config.gz | grep <pci driver>

From the commit/release date, I believe this patch (2022-02-15) is already applied in TorizonCore version 5.7.0 (07/2022), so it should also be applied on version 5.7.2.

The kernel 6.6 is for BSP 7 and you mentioned you are using Torizon 5 (BSP 5, kernel 5.4). But this patch is also included in 6.6.

https://git.toradex.cn/cgit/linux-toradex.git/commit/?h=toradex_6.6-2.0.x-imx&id=a6809941c1f17f455db2cf4ca19c6d8c8746ec25

You can check this article about this.

1 Like

Hi @allan.tx ,

Thank you for your informative response. I double checked, the changes indeed are already there.