Interfacing RM500Q-GL quectel modem on RZG2N custome board using PCIE interface

Hi Renesas Team,
I hope this message finds you well.
We are working on a custom board design based on the RZG2N, where we are interfacing the RM500Q-GL Quectel modem via the PCIe interface. We have integrated the pcie-mhi driver provided by Quectel into our kernel and successfully loaded the pci_mhi.ko module.
We have enabled the following entries in the r8a774b1-hihope-rzg2n-ex.dts file:
&pciec0 {
status = "okay";
};
&pciec1 {
status = "okay";
};
Despite this, the lspci command does not list any PCI devices, indicating that the PCIe interface is not detecting the modem. We would greatly appreciate your guidance on what might be missing or how we can successfully bring up the PCIe interface on the RZG2N to interface with the modem.
I have been unable to find detailed documentation on enabling the PCIe interface on the RZG2N, so any assistance or pointers to relevant resources would be invaluable.
PCIe Hardware setting.
 In RZ/G2N boot Mode setting is taken care MD12 is made Zero.
  • We are testing Both the PCIe 0 and PCIe 1 interface on RZ/G2N, Both PCIe interface is not working.
  • Tested the PCIe clock on ( PCIE_REFCLK_M/P to PCIe model) and (PCIE_CLK_P/M on RZ/G2N) 100MHZ clock is coming correctly.
Thank you in advance for your support.
Thanks and Regards,
Nagaraja
  • Hi Nagaraja,

    It's good to hear that you have successfully integrated it into your Yocto build.

    I am currently working with the Quectel RM520N module and have received the PCI MHI driver from Quectel. However, I am having difficulty integrating it into my Yocto build.

    Could you please provide guide with the steps required to include the kernel module in my Yocto build?

    Thank you for your assistance.

    Best Regards,

    Suresh

  • By default, the PCIe driver should be enabled in the default Renesas BSP.

    https://github.com/renesas-rz/rz_linux-cip/blob/rzv2h-5.10-cip17/arch/arm64/configs/defconfig#L105

    CONFIG_PCIE_RCAR_HOST=y
    CONFIG_PCIE_RCAR_EP=y

    So if you enabled it in your Device Tree, it should be OK.

  • Hi,

    I had a quick look at Quectel's "RM500Q-GL Hardware Design" document, and found the following:

    - Turn on the RM500Q-GL module by setting the module's FULL_CARD_POWER_OFF# signal to HIGH (for example, by using the host CPU's GPIO).

    - Use AT commands to switch the PCIe operating mode (endpoint mode / root complex mode).

    Just to confirm, you performed the initial settings described in the RM500Q-GL manual to make the RM500Q-GL module's PCIe interface operational (for example, as mentioned above), and then tested it, right?

    BR

  • Hi Chris/egret,

    Thanks for the reply , Yes we enabled in the kernel

    CONFIG_PCIE_RCAR_HOST=y
    CONFIG_PCIE_RCAR_EP=y.

    And Also Done: Modem setings to work in PCIE mode like below

    AT+QCFG="data_interface",1,1 //Set network port communication through PCIe interface, and
                                                         diagnostic port through PCIe interface.

    AT+QCFG="pcie/mode",1        //RC Mode:

    In the kernel debug we are getting below error:

    [    0.133274] gpio-370 (usb1-reset): hogged as output/low
    [    0.133463] gpio_rcar e6055400.gpio: driving 32 GPIOs
    [    0.133770] gpio_rcar e6055800.gpio: driving 4 GPIOs
    [    0.135466] rcar-pcie fe000000.pcie: host bridge /soc/pcie@fe000000 ranges:
    [    0.135492] rcar-pcie fe000000.pcie: Parsing ranges property...
    [    0.135509] rcar-pcie fe000000.pcie:       IO 0x00fe100000..0x00fe1fffff -> 0x0000000000
    [    0.135534] rcar-pcie fe000000.pcie:      MEM 0x00fe200000..0x00fe3fffff -> 0x00fe200000
    [    0.135554] rcar-pcie fe000000.pcie:      MEM 0x0030000000..0x0037ffffff -> 0x0030000000
    [    0.135570] rcar-pcie fe000000.pcie:      MEM 0x0038000000..0x003fffffff -> 0x0038000000
    [    0.135585] rcar-pcie fe000000.pcie: Parsing dma-ranges property...
    [    0.135596] rcar-pcie fe000000.pcie:   IB MEM 0x0040000000..0x00bfffffff -> 0x0040000000
    [    0.199776] rcar-pcie fe000000.pcie: PCIe link down
    [    0.200014] rcar-pcie ee800000.pcie: host bridge /soc/pcie@ee800000 ranges:
    [    0.200029] rcar-pcie ee800000.pcie: Parsing ranges property...
    [    0.200044] rcar-pcie ee800000.pcie:       IO 0x00ee900000..0x00ee9fffff -> 0x0000000000
    [    0.200066] rcar-pcie ee800000.pcie:      MEM 0x00eea00000..0x00eebfffff -> 0x00eea00000
    [    0.200085] rcar-pcie ee800000.pcie:      MEM 0x00c0000000..0x00c7ffffff -> 0x00c0000000
    [    0.200100] rcar-pcie ee800000.pcie:      MEM 0x00c8000000..0x00cfffffff -> 0x00c8000000
    [    0.200111] rcar-pcie ee800000.pcie: Parsing dma-ranges property...
    [    0.200145] rcar-pcie ee800000.pcie:   IB MEM 0x0040000000..0x00bfffffff -> 0x0040000000
    [    0.267751] rcar-pcie ee800000.pcie: PCIe link down
    [    0.304727] SuperH (H)SCI(F) driver initialized.

    My dts entries is as below:

    &pciec1 {
            status = "okay";
    };
    &pciec0_ep {
            status = "okay";

    }.

    And I followed the instruction given in the :

    https://github.com/renesas-rz/rzg2-pcie-endpoint.

    root@hihope-rzg2n:~# ls /sys/class/pci_epc/
    fe000000.pcie-ep
    root@hihope-rzg2n:~# ls /sys/bus/pci-epf/drivers
    pci_epf_test
    root@hihope-rzg2n:~# mount -t configfs none /sys/kernel/config
    mount: /sys/kernel/config: none already mounted or mount point busy.
    root@hihope-rzg2n:~# cd /sys/kernel/config/pci_ep
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# mkdir functions/pci_epf_test/func1
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# ls functions/pci_epf_test/func1/
    baseclass_code  cache_line_size  deviceid  interrupt_pin  msi_interrupts  msix_interrupts  progif_code  revid  subclass_code  subsys_id  subsys_vendor_id  vendorid
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# cd /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/
    root@hihope-rzg2n:/sys/kernel/config/pci_ep/functions/pci_epf_test/func1# cat vendorid
    0xffff
    root@hihope-rzg2n:/sys/kernel/config/pci_ep/functions/pci_epf_test/func1# cat interrupt_pin
    0x0001
    root@hihope-rzg2n:/sys/kernel/config/pci_ep/functions/pci_epf_test/func1# ls
    baseclass_code  cache_line_size  deviceid  interrupt_pin  msi_interrupts  msix_interrupts  progif_code  revid  subclass_code  subsys_id  subsys_vendor_id  vendorid
    root@hihope-rzg2n:/sys/kernel/config/pci_ep/functions/pci_epf_test/func1# cd /sys/kernel/config/pci_ep
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# echo 0x1912 > functions/pci_epf_test/func1/vendorid
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# echo 0x002b > functions/pci_epf_test/func1/deviceid # RZ/G2N
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# echo 16 > functions/pci_epf_test/func1/msi_interrupts
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# cd /sys/kernel/config/pci_ep
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# ln -s functions/pci_epf_test/func1/ controllers/fe000000.pcie_ep/
    ln: target `controllers/fe000000.pcie_ep/' is not a directory: No such file or directory
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# ln -s functions/pci_epf_test/func1/ controllers/fe000000.pcie-ep/
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# cd /sys/kernel/config/pci_ep
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# echo 1 > controllers/fe000000.pcie_ep/start
    -sh: controllers/fe000000.pcie_ep/start: No such file or directory
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# echo 1 > controllers/fe000000.pcie-ep/     
    func1/ start  
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# echo 1 > controllers/fe000000.pcie-ep/start
    root@hihope-rzg2n:/sys/kernel/config/pci_ep# lspci -vvxx
    root@hihope-rzg2n:/sys/kernel/config/pci_ep#

    SO lspci -vvxx is not showing any device attached to PCI.

    Please guide us what are we missing here.

    Thanks for your time and guidance.Please help how can we go about it.

    BR,

    Nagaraja

  • Hi egret/chris,
    Yes we enabled this option in kernel menuconfig.
    CONFIG_PCIE_RCAR_HOST=y
    CONFIG_PCIE_RCAR_EP=y
    And we configure the modem to work in pcie/ep mode like below.
    AT+QCFG="data_interface"                                          
    +QCFG: "data_interface",1,0                                        
                                                                       
    OK
    AT+QCFG="pcie/mode"
    +QCFG: "pcie/mode",0

    OK

    I Followed the  procedure given in the link.
    And got the responce shown in the attached screen shot.
    It clearly not showing any device attached to PCI even though we are connected RM500Q-GL module to PCI  interface.
    My kernel debug message showing as below:
        0.133339] gpio_rcar e6055800.gpio: driving 4 GPIOs
    [    0.135070] rcar-pcie fe000000.pcie: host bridge /soc/pcie@fe000000 ranges:
    [    0.135113] rcar-pcie fe000000.pcie:       IO 0x00fe100000..0x00fe1fffff -> 0x0000000000
    [    0.135136] rcar-pcie fe000000.pcie:      MEM 0x00fe200000..0x00fe3fffff -> 0x00fe200000
    [    0.135156] rcar-pcie fe000000.pcie:      MEM 0x0030000000..0x0037ffffff -> 0x0030000000
    [    0.135171] rcar-pcie fe000000.pcie:      MEM 0x0038000000..0x003fffffff -> 0x0038000000
    [    0.135193] rcar-pcie fe000000.pcie:   IB MEM 0x0040000000..0x00bfffffff -> 0x0040000000
    [    0.203711] rcar-pcie fe000000.pcie: PCIe link down
    [    0.203958] rcar-pcie ee800000.pcie: host bridge /soc/pcie@ee800000 ranges:
    [    0.203989] rcar-pcie ee800000.pcie:       IO 0x00ee900000..0x00ee9fffff -> 0x0000000000
    [    0.204011] rcar-pcie ee800000.pcie:      MEM 0x00eea00000..0x00eebfffff -> 0x00eea00000
    [    0.204029] rcar-pcie ee800000.pcie:      MEM 0x00c0000000..0x00c7ffffff -> 0x00c0000000
    [    0.204044] rcar-pcie ee800000.pcie:      MEM 0x00c8000000..0x00cfffffff -> 0x00c8000000
    [    0.204089] rcar-pcie ee800000.pcie:   IB MEM 0x0040000000..0x00bfffffff -> 0x0040000000
    [    0.271699] rcar-pcie ee800000.pcie: PCIe link down
    [    0.309037] SuperH (H)SCI(F) driver initialized.
    Please guide us what am i missing here and how do I go about interface RM500Q-GL Module in RZG2N custom made board.
    Thanks and Regards,
    Nagaraja
  • Hi,

    I think that the PCIe of the RM500Q-GL module is not working for some reason.

    As you may know, "PCIe link down" means that the connection between the RM500Q-GL module and the custom board has been lost. Some of common causes are:

    1. Power-saving modes (like L0s and L1 states)
    2. Outdated or corrupted driver
    3. PCIe module not seated properly in the slot
    4. PCIe module or custom board failure
    5. unexpected power loss or device removal

    2. to 5. aside, what about 1.?
    As I wrote in my previous comment, the RM500Q-GL module may need to be woken up by the FULL_CARD_POWER_OFF# signal.

    By the way, what is the OC of your RM500Q-GL module?

    • RM500QGLAB-M20-SGASA
    • RM500QGLAP-M20-SGASA
    • RM500QGLPA-M20-SGASA

    BR

  • Hi egret,

     Thanks for the reply, we are using RM500QGLAB-M20-SGASA, and the Kernel version is 5.10.158 from renesas 3.0.3-SDK. We have checked the common causes that you mensnioned above and look fine

    We tested , FULL_CARD_POWER_OFF# signal.

    Reset singnal is high and reference clock is 100MHZ

    Thanks and Regards,

    Nagaraja

  • Hi,

    Reading some Quectel forum threads, it seems like this module has some quirks.

    RM500Q-GL - PCIe interface not working
    RM500Q-GL not enumerated
    RM500Q-GL PCIe efuse

    I think it's hard to get advice from people familiar with the RM500Q-GL quirks on this forum, so a good first step would be to search/ask for solutions on Quectel forums to detect your module..

    You may have already done this...

    BR