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.

AM3354: Ethernet link detection

Part Number: AM3354

Linux 4.19 CPSW driver

Can anyone point to the code in cpsw.c/phy.c where the link detection is done of a device under cpsw's control? I do not see an interrupt, so I assume it is being polled by the phy_state_machine in phy.c....

I want to add the link detection of port 2 (second port of my switch) to work as as well as port 1 (port 1 on my 2 port switch) and port 5 (my mac/phy chip) which both work great.

I have already tried to fool the switch phy driver to report link = on, but it only works AFTER the cable is really connected - then you can remove it and it stays linked so the second port will function without port 1 having a cable plugged in.

Thanks

  • I found it. IThe driver is set to polling, and was dependant on the phy_driver .config_init, .config_aneg, .read_status, and .aneg_done entries provided in my micrel.c driver for my switch.

    This basically allows the phy to have link status even if there are no cables attached so port two can work with no cable plugged into port one of the switch.

    An ugly hack, but it provides the same hack done in an old kernel version for the same system.

  • Thanks for sharing your solution with the community.

    Best Regards,
    Yordan