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.

AM335X: Gigabit Ethernet KSZ9031 auto negotiation

Other Parts Discussed in Thread: AM5728

We are facing issue with micrel ksz9031 when interface with am335x ti sitara processor.
rgmii phy settings and issues below

device tree skew value is listed below

phy0: ethernet-phy@0 {
               comptaible = "micrel,ksz9031";
               device_type = "ethernet-phy";
                rxc-skew-ps = <1500>;
                rxdv-skew-ps = <60>;
                rxd0-skew-ps = <60>;
                rxd1-skew-ps = <0>;
                rxd2-skew-ps = <60>;
                rxd3-skew-ps = <0>;


                txc-skew-ps = <1860>;
                txen-skew-ps = <0>;
                txd0-skew-ps = <0>;
                txd1-skew-ps = <0>;
                txd2-skew-ps = <0>;
                txd3-skew-ps = <0>;

 reg = <0>;


we calculated from as below

                Device tree val  
  in mils in metre speed in m/s delay skew final skew   DELAY 1.38NS  
Tclk 1191 3.03E-002 1.89E+008 1.60060317460317E-010 0 0   1860  
Tcntl 1174.56 2.98E-002 1.89E+008 1.57850919799731E-010 2.20939766058689E-012 2.2ps   0  
TD0 1173.08 2.98E-002 1.89E+008 1.57652019495746E-010 -2.40829796457166E-012 -2.44ps   0  
TD1 1158.48 2.94E-002 1.89E+008 1.55689902290636E-010 -4.37041516968098E-012 -4.37ps   0  
TD2 1191.03 3.03E-002 1.89E+008 1.60064345818744E-010 4.02835842653473E-015 0   0  
TD3 1181.3 3.00E-002 1.89E+008 1.58756715376806E-010 -1.303602083511E-012 -1.3ps   0  
                   
                   
                   
  in mils in metre speed in m/s delay skew final skew   Delay 1.8  
Rclk 935.94 2.38E-002 1.89E+008 1.25782412698413E-010 0 0   1500  
Rcntl 996.79 2.53E-002 1.89E+008 1.33960136857354E-010 -8.17772415894107E-012 -8.2ps   60  
RD0 943.93 2.40E-002 1.89E+008 1.26856199715807E-010 1.0737870173947E-012 1.3ps   60  
RD1 654.42 1.66E-002 1.89E+008 8.79485065404999E-011 -3.78339061579128E-011 -37ps   0  
RD2 1040.79 2.64E-002 1.89E+008 1.39873362119082E-010 1.40909494206696E-011 14ps   60  
RD3 593.91 1.51E-002 1.89E+008 7.98164740789293E-011 -4.59659386194835E-011 -46ps   0  



We have 10/100 mbs working fine with or without setting these skew values. But when we try with 1G we are continuously getting Link up and Link down message and not having it properly auto-negotiated to 1G

I can see there the Rx clock and Tx clock setting properly to 125 MHz but the next second both these clk's returns to 25 Mhz. Can you assist why this auto-negotiation link up and link down is happening continuously.

I've already applied the patch https://lkml.org/lkml/2015/6/5/767  in my driver for link stability. And also tried with different hub.

the kernel log from am335x cpsw driver cpsw.c below

[   45.680192] _cpsw_adjust_link slave_num 0
[   45.684772] PHY mac_control 20 speed 1000
[   45.688802] PHY mac_control != slave->mac_control REG Set
[   45.694296] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

[   47.699988]  _cpsw_adjust_link slave_num 0
[   47.704563] PHY link down
[   47.707198] PHY mac_control != slave->mac_control REG Set
[   47.712682] cpsw 4a100000.ethernet eth0: Link is Down
[   47.717762] CPSW STOPPING CARRIER 

[   49.720130] cpsw_adjust_link slave_num 0
[   49.724706] PHY mac_control 20 speed 1000
[   49.728736] PHY mac_control != slave->mac_control REG Set
[   49.734306] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx


[   51.740004]  _cpsw_adjust_link slave_num 0
[   51.744578] PHY link down
[   51.747212] PHY mac_control != slave->mac_control REG Set
[   51.752696] cpsw 4a100000.ethernet eth0: Link is Down
[   51.757777] CPSW STOPPING CARRIER 

This is a continuous message.
Please let us know how we can solve this issue.


regards
nilesh

  • Hi,

    Please post kernel version.
  • we are using linux-4.1.13+gitAUTOINC+8dc66170d9-g8dc6617 downloded from ti.

    The problem we are facing is

    phy->link becomes zero, after auto-negotiation to 1G.this is a continuous loop trying to set the device in 1G mode

    but 100 and 10 Mbs works fine.phy->link stays at one when we set network to 10/100Mbs .

    Regards

    nilesh

  • The PHY controls the auto negotiation, the CPSW driver is reacting to the PHY reporting constantly a changed link state. Is the device that is connected to the PHY reporting that the link is going up and down?

    Aceesing the PHY extended mode registers might show information. Also does Micrel have a forum that might explain why the PHY link state is changing?
  • I checked the Micrel registers (IEEE Defined Registers register 1h 1.2 Link status bit) 1 = Link is up, 0 = Link is down
    This bit is continuously toggling at 1G mode. if I put it into 100 Mbs or 10 Mbs by ethtool it says link is up bit 1 and no more toggling in it.

    I have no idea why this behavior is happening in 1G mode only.So is the issue lying in between cpsw and micrel-phy or the phy and external hub

    where should the problem lay?

    Thanks and regards
    nilesh
  • The link status is managed by the PHY, in this case it appears that the problem is between the PHY and the external device since the PHY cannot maintain the link between itself and the device it is connected to. You mention a hub, do you mean a switch? Could you post the type of external device you are attaching to?

    Have you tried a direct connect with a PC to see if the PC side is seeing the same link status issue? 

  • Thanks you for reply.

    I tried with multiple hubs,it don't auto-negotiate to 1G mode.

    presently i am using this http://www.dlink.com.au/home-solutions/8-port-gigabit-desktop-switch

    I also connected to PC after trial it automatically auto-negotiate's to 100Mbs only, not to 1G.

    The PC and hub, I am using, supports 1G and proven working in those modes.

    When i forcefully make device in 1G mode by ethtool it says link is down. 

    Tx and Rx clk shows in oscilloscope it is 125Mhz.

    Is there any reason why micrel ksz9031 link is down in 1G ? Plz help

    regards

    nilesh

  • Hi,
    we are also facing the same issue. Have you solved the problem?
  • Hi,

    We are also facing the same problem. have you solved the issue?
  • I know this is an old post, however, I ran into the same problem and was able to resolve it so I thought I would share the problem and the fix.

    Symptom: Gigabit auto negotiation link goes up and down forever and doesn't ever link. However, if you manually set the link speed to 100Mb or 10Mb everything works fine.

    Cause: This problem relates to a dirty power supply on the 1.2V (DVDDL pins) rail of the KSZ9031 when using the LDO pin to drive an external FET as seen in the AM5728 reference design and the beagle board X15. If you look at the difference between the AM5728 reference design and the X15 you will notice that the X15 has quite a few more decoupling caps on the DVDDL lines of both KSZ9031's. If you made a custom board based on the TI reference design, chances are you are having this same issue.

    Resolution / Testing: Put a big electrolytic cap on before and after the FET, something like 100uF. Do not try to load an operating system or boot. Just power up the board while plugged into a Gigabit router / switch / hub. You should get your link LED's to come up and stay up. Once you have verified that this is your issue, you can take a closer look at adding some more filtering caps to your design.

    Good luck.