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 ksz9031 auto-negotiation 1G Ethernet

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