This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM4376: prueth did't work on custom board

Part Number: AM4376
Other Parts Discussed in Thread: TLK105L, , AM4372

Tool/software: Linux

Our custom board based on the AM4376 as a network adapter uses a PHY TLK105L connected to the module PRU-ICSS.
Wiring PHY to the CPU has been borrowed from the design board AM437x-IDK-EVM as well as part of DeviceTree.
For the past two weeks, we tried in vain to start the adapter, but without success.

So, what we have?
SDK – 03.02.00.05
CPSW – not used in kernel config settings
PRUETH, REMOTEPROC, RPMSG, PRU_RPROC – used as modules in kernel config settings
TI-PRUSS firmware we used same version as used in SDK 03.02
PHY uses default configuration (PHYADDR = 0х01).
*_CLK - signals checked by oscilloscope

DeviceTree:

When we inspect prueth driver source code we found need to have property compatibility with the IDK-EVM board, so we added the following code in our DT:

compatible = "ti,am437x-idk-evm","ti,am4372","ti,am43"; /* ti,am437x-idk-evm - for loading TI-PRUSS firmware */

Also we added pinmuxing the same as on IDK board and other important parts look like:
 

pruss1_eth {
    compatible = "ti,am4372-prueth";
    pruss = <&pruss1>;
    sram = <&ocmcram_nocache>;
    interrupt-parent = <&pruss1_intc>;

    pinctrl-0 = <&pruss1_eth_default>;
    pinctrl-names = "default";

    pruss1_emac0: ethernet-mii0 {
        phy-handle = <&pruss1_eth0_phy>;
        phy-mode = "mii";
        interrupts = <20>, <22>;
    interrupt-names = "rx", "tx";
    /* Filled in by bootloader */
    local-mac-address = [00 00 00 00 00 00];
};

&pruss1_mdio {
    pinctrl-0 = <&pruss1_mdio_default>;
    pinctrl-names = "default";
    status = "okay";

    reset-gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
    reset-delay-us = <2>;<->/* PHY datasheet states 1uS min */

    pruss1_eth0_phy: ethernet-phy@0 {
        compatible = "ethernet-phy-id2000.a210";
        reg = <1>;
    };
};

DEBUG LOG_LEVEL=5.

PRUSS1 successfully starts as demonstrated this portion of the log:
[    5.947389] ti-pruss 54400000.pruss: creating PRU cores and other child platform devices
[    5.996855]  remoteproc0: 54434000.pru0 is available
[    6.048258]  remoteproc0: Note: remoteproc is still under development and considered experimental.
[    6.101832]  remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[    6.132115] pru-rproc 54434000.pru0: PRU rproc node /ocp/pruss_wrapper@54426000/pruss@54400000/pru0@54434000 probed successfully
[    6.162941]  remoteproc1: 54438000.pru1 is available
[    6.167941]  remoteproc1: Note: remoteproc is still under development and considered experimental.
[    6.231940]  remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
[    6.262041] pru-rproc 54438000.pru1: PRU rproc node /ocp/pruss_wrapper@54426000/pruss@54400000/pru1@54438000 probed successfully

PRUSS_MDIO also starts without errors and we have log messages about it:
[    6.452744] davinci_mdio 54432400.mdio: GPIO lookup for consumer reset
[    6.459316] davinci_mdio 54432400.mdio: using device tree for GPIO lookup
[    6.522226] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/ocp/pruss_wrapper@54426000/pruss@500[0]' - status (0)
[    6.643179] davinci_mdio 54432400.mdio: davinci mdio revision 1.6
[    6.649305] libphy: 54432400.mdio: probed
[    6.740488] davinci_mdio 54432400.mdio: phy[1]: device 54432400.mdio:01, driver TI TLK10X 10/100 Mbps PHY

But ... when Linux attempts loading PRUETH driver before loading PRUSS core
It's strange and generate log message:
[    5.922416] prueth pruss1_eth: unable to get pruss handle
[    5.947389] ti-pruss 54400000.pruss: creating PRU cores and other child platform devices

After OS start we reload module from console
# rmmod -f prueth && sleep 1 && modprobe prueth
and now have another type of message:
[  978.682339] prueth pruss1_eth: couldn't connect to phy /ocp/pruss_wrapper@54426000/pruss@54400000/mdio@54432400/
[  978.693990] prueth pruss1_eth: netdev init ethernet-mii0 failed: -19
[  978.700403] prueth pruss1_eth: no ethernet-mii1 node

Network stack works fine because we have worked WLAN and USB RNDIS gadget
# ls /sys/class/net
lo     usb0   wlan0

We examined contents of the site and this forum but did not find the answers.

First at all, because source code of TI-PRUSS Ethernet firmware not accessible, we must know what firmware works on boards other than the IDK!

If it's works than, since we no longer have ideas "why this does not work", appeal to you for help.

Thank you.

  • Hi Sergii,

    Yes, TI-PRUSS Ethernet firmware (am437x-pru0/1-prueth-fw.elf) should work for AM437x custom board based on AM437x IDK.

    See if the below e2e threads will be in help:

    e2e.ti.com/.../529948
    e2e.ti.com/.../565356
    e2e.ti.com/.../557233
    e2e.ti.com/.../525741

    Regards,
    Pavel
  • First of all, thanks for your reply.

    Yes, of course I've seen this threads. Unfortunately, they do not contain the answers for me.
    First thread stopped at "prueth pruss_eth: netdev init ethernet-mii1 failed: -19". Which seen as the same problem as mine but thread stopped and therefore it couldn' know whether to solve the problem.
    Second thread stopped at "The pr2_mii1_txd0 ~ pr2_mii1_txd3 pin can not detect any level changing. It always low level. " So there also no answer.
    Third thread about DT without property compatible with "IDK-EVM" board = isn't our case.
    Fourth thread has status "Answered" but also not interesting for me - there was a problem in the wrong path for the firmware.

    So, none of this thread did not help me.

    I think the question should be divided into two:
    1) Software defect
    2) Hardware defect

    Given the amount of researched information, I have tried almost everything that could be found on the forum. But something that is left)))
    To my great regret, I personally do not have access to AM437X-IDK-EVM (only SK-EVM, GP-EVM we have) and I can't compare the signals, kernel logs, etc IDK board with our custom board.

    So, please help me. First, we assume that the problem is in the software part

    1) Where can I see that the ethernet firmware is successfully loaded into the PRU and ready to work?
    2) What are the possible problems with IRQ, DMA? Is it enough terms that stated in file "am4372.dtsi"
    3) What is the possible problem of the loading prueth driver before pru_rproc? And how it fixit?

  • We do not provide the source code for the PRU Ethernet firmwares.

    I would suggest you to get AM437x IDK and compare the logs between this board and your custom board. Can you describe what differences you have between your board and AM437x IDK. The link to the IDK is below:
    www.ti.com/.../tmdsidk437x


    Enable also debug mode in the prueth.c driver to see all the messages. See also the below thread:
    e2e.ti.com/.../561775

    We have also one known issue with prueth:
    processors.wiki.ti.com/.../Processor_SDK_Linux_Kernel_Release_Notes

    Regards,
    Pavel
  • Thanks again for your reply and especially for reminding me of the list "Knowing issues".

    But back to the ethernet
    1) Yes, we know what TI do not provide the source code for the PRU Ethernet firmwares.
    2) Diff between our custom board and AM437x IDK
    - we don't use CPSW and kernel config options didn't contain TI CPSW options
    - Davinci MDIO build in kernel, remoteproc, prueth as modules
    - we have 1 PRU Ethernet port connected to PHY TLK105L which has default address 0x01
    - pin mux setup:

    PRUSS MDIO
    C24 pr1_mdio_mdclk
    D24 pr1_mdio_data
    GPIO5[12] used as pin for reset PHY

    at DT described as

    pruss1_mdio_default: pruss1_mdio_default {
    		pinctrl-single,pins = <
    			0x274 ( PIN_OUTPUT        | MUX_MODE8 ) 	/* (C24) xdma_event_intr1.pr1_mdio_mdclk */
    			0x270 ( PIN_INPUT_PULLUP  | MUX_MODE8 )	/* (D24) xdma_event_intr0.pr1_mdio_data */
    			0x248 ( PIN_INPUT_PULLUP  | MUX_MODE7 )	/* (E25) gpio5_12.gpio5[12] */
    		>;
    	};
    &pruss1_mdio {
    	pinctrl-0 = <&pruss1_mdio_default>;
    	pinctrl-names = "default";
    	status = "okay";
    
    	reset-gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
    	reset-delay-us = <2>;	/* PHY datasheet states 1uS min */
    
    	pruss1_eth0_phy: ethernet-phy@0 {
    		compatible = "ethernet-phy-id2000.a210";
    		reg = <1>;
    	};
    };

    PRU Ethernet port
    B22 pr1_mii_mt0_clk
    A21 pr1_mii0_txen
    B20 pr1_mii0_txd0
    A20 pr1_mii0_txd1
    C21 pr1_mii0_txd2
    B21 pr1_mii0_txd3
    C17 pr1_mii_mr0_clk
    D17 pr1_mii0_rxdv
    D19 pr1_mii0_rxer
    B18 pr1_mii0_rxd0
    A18 pr1_mii0_rxd1
    B19 pr1_mii0_rxd2
    A19 pr1_mii0_rxd3
    G20 pr1_mii0_crs
    D25 pr1_mii0_col
    C19 pr1_mii0_rxlink

    at DT described as

    	pruss1_eth_default: pruss1_eth_default {
    		pinctrl-single,pins = <
    			0xa0  ( PIN_INPUT  | MUX_MODE2 ) /* (B22) dss_data0.pr1_mii_mt0_clk */
    			0xb4  ( PIN_OUTPUT | MUX_MODE2 ) /* (B20) dss_data5.pr1_mii0_txd0 */
    			0xb0  ( PIN_OUTPUT | MUX_MODE2 ) /* (A20) dss_data4.pr1_mii0_txd1 */
    			0xac  ( PIN_OUTPUT | MUX_MODE2 ) /* (C21) dss_data3.pr1_mii0_txd2 */
    			0xa8  ( PIN_OUTPUT | MUX_MODE2 ) /* (B21) dss_data2.pr1_mii0_txd3 */
    			0xcc  ( PIN_INPUT  | MUX_MODE5 ) /* (B18) dss_data11.pr1_mii0_rxd0 */
    			0xc8  ( PIN_INPUT  | MUX_MODE5 ) /* (A18) dss_data10.pr1_mii0_rxd1 */
    			0xc4  ( PIN_INPUT  | MUX_MODE5 ) /* (B19) dss_data9.pr1_mii0_rxd2 */
    			0xc0  ( PIN_INPUT  | MUX_MODE5 ) /* (A19) dss_data8.pr1_mii0_rxd3 */
    			0xa4  ( PIN_OUTPUT | MUX_MODE2 ) /* (A21) dss_data1.pr1_mii0_txen */
    			0xd8  ( PIN_INPUT  | MUX_MODE5 ) /* (C17) dss_data14.pr1_mii_mr0_clk */
    			0xdc  ( PIN_INPUT  | MUX_MODE5 ) /* (D17) dss_data15.pr1_mii0_rxdv */
    			0xd4  ( PIN_INPUT  | MUX_MODE5 ) /* (D19) dss_data13.pr1_mii0_rxer */
    			0xd0  ( PIN_INPUT  | MUX_MODE5 ) /* (C19) dss_data12.pr1_mii0_rxlink */
    			0x240 ( PIN_INPUT  | MUX_MODE5 ) /* (G20) gpio5_10.pr1_mii0_crs */
    			0x238 ( PIN_INPUT  | MUX_MODE5 ) /* (D25) gpio5_8.pr1_mii0_col */
    		>;
    	};

    - when board started reset signal recieved PHY - link LED responds to a LAN cable connection and seeing signals on RTX pins of PHY
    - also whe checked signals on *CLK pins

    Software & Tools part:
    TI Linux kernel & U-Boot from latest SDK version 03.02.00.05
    Buildroot 2016.08.1 as build system
    gcc 5.3 2006.02 by linaro

  • So, no help from TI ... but we are making progress and have moved a little to solve our problem. Maybe it's useful info for someone.

    What we did:

    1. We compared design of our сustom board with AM437X-IDK-EVM from TI and MYB-C437X-PRU from MYIR Tech.

    2. Revised recommendation to the PHY TLK105L

    3. Applied some solutions from 1, 2.

    After these steps, we have achieved a certain result. More precisely the result we had, but we did not know how to relate to that data.

    We changed PHYADDR for testing purposes to 0x00 and commented string in DT compatible = "ethernet-phy-id2000.a210"; leaving only this

    pruss1_eth0_phy: ethernet-phy@0 {
       reg = <0>;
    };

    dmesg says

    [xxxx] davinci_mdio 54432400.mdio: davinci mdio revision 1.6
    [xxxx] libphy: 54432400.mdio: probed
    [xxxx] davinci_mdio 54432400.mdio: phy[0]: device 54432400.mdio:00, driver TI TLK10X 10/100 Mbps PHY

    which mean Davinci MDIO bus worked and properly founded PHY on bus and appropriate driver. So, go to the next level
    After "modprobe prueth" now we have next log message "prueth pruss1_eth: no ethernet-mii1 node" and that's all.
    So we decided to search for the reason in the prueth driver. We added DEBUG macro and some additional debug info to the driver.
    After adding debugging code and explore the source code driver, we have found the reason.
    It consists in that the current version (0.2) prueth driver is designed to use only two ports (for AM437X family proccessors)!
    If you use 1 port after the message "no ethernet-mii0 node" or "no ethernet-mii1 node" initialization terminated.

    Commented out and changing some of the driver's code now we have a network device as eth0

    Log after starting the module has become such a

    [xxxxx] prueth pruss1_eth: port 1: using MAC addr from DT: a0: f6: fd: xx: xx: xx
    [xxxxx] prueth pruss1_eth: TI PRU ethernet driver initialized

    and then execute the command "ifconfig eth0 up" we have log messages such a

    [xxxxx] remoteproc0: powering up 54434000.pru0
    [xxxxx] remoteproc0: Booting fw image ti-pruss/am437x-pru0-prueth-fw.elf, size 4754
    [xxxxx] ti-pruss 54400000.pruss: configured system_events = 0x0000060000500000 intr_channels = 0x00000095 host_intr = 0x00000115
    [xxxxx] remoteproc0: remote processor 54434000.pru0 is now up
    [xxxxx] net eth0: started
    [xxxxx] eth0: Link is Up - 100Mbps/Full - flow control rx/tx

    Unfortunately we now have a new problem - the device does not receive an address by DHCP protocol or after explicitly setting the address, don't send or receive any packets. But that's another issue for another day.

  • Sergii Khalo said:
    Unfortunately we now have a new problem - the device does not receive an address by DHCP protocol or after explicitly setting the address, don't send or receive any packets. But that's another issue for another day.

    This problem was solved. It was a hardware bug

    Now last issue module prueth loaded before pru_rproc started
    Temporary solution - rmmod prueth and then modprobe prueth
    We using mdev as device manager
    In my opinion best solution - change driver's source code.  NODEV to PROBE_DEFER in some parts of source code