Subject: Re: [PATCH net-next 1/1] net: dsa: microchip: Add Microchip KSZ8895 DSA driver

From: Pavel Machek <[email-masked]>
Date: Thu, 14 Dec 2017 22:12:20 +0100

Hi!

Thanks for the support.

> > root@miro:~# mii-tool lan3
> > lan3: negotiated 1000baseT-HD flow-control, link ok
> > 
> > But IIRC the switch is 100mbit? And dmesg does get it right. Its just
> > mii-tool that is confused.
> > 
> > Link detection seems to work
> > 
> > root@miro:/sys/bus/spi/devices/spi2.0# mii-tool lan1
> > lan1: negotiated 1000baseT-HD flow-control, link ok
> > root@miro:/sys/bus/spi/devices/spi2.0# mii-tool lan1
> > lan1: no link
> > 
> > (But that really should be 100baseT, not 1000baseT).
> 
> ethtool lan3 should also report the correct setting.

Yes, after port is configured, ethtool produces right results:

 Speed: 100Mb/s
 Duplex: Full

Before that, it looks rather confusing:

root@miro:~# ethtool lan2
root@miro:~# ethtool lan2
Settings for lan2:
...
	Speed: Unknown!
	Duplex: Unknown! (255)
	    
> > Is there register dump available somewhere? I was using
> > /sys/bus/spi/devices/spi32766.0/registers but this does not seem to be
> > available.
> 
> There is a patch to add that functionality.  It is very simple and I will send it
> to you later.  Without that it is hard to debug the DSA driver if there is
> something wrong.

That would be nice :-).

> I also have a simple utility to communicate with that registers file to read/write
> register individually.  Is there a standard Linux utility for that
> function?

I don't think standard utility exists. Binary file which can be
written by userspace shoudl be enough.

> >      p04_rx: 660
> >      p04_rx_hi: 0
> >      p04_rx_undersize: 0
> >      p04_rx_fragments: 20
> 
> This indicates a problem with the MAC.  Are you using a MII or RMII version?

I do have:
                mac0: ethernet@800f0000 {
	                       phy-mode = "rmii";
	                       pinctrl-names = "default";
			       ...
	       }

> >      p04_tx_hi: 0
> >      p04_tx_late_col: 0
> >      p04_tx_pause: 0
> >      p04_tx_bcast: 0
> >      p04_tx_mcast: 3

> This indicates the host port tried to send frames to the MAC.
> >      tx_total_col: 0
> >      tx_exc_col: 0
> >      tx_single_col: 0
> >      tx_mult_col: 0
> >      rx_discards: 0
> >      tx_discards: 0
> 
> They just reported frames are received from the port.  Because of problem with
> the host port there is no transmission coming from the host port.

I disabled second ethernet port in the dts so it could not interfere
with testing, butno change.

Is there any way to debug the host port problems? I do have

   spi@0 {
        compatible = "microchip,ksz8895";
	...
 	ports {
 		port@4 {
 			reg = <4>;
 			label = "cpu";
 			ethernet = <&mac0>;
 			fixed-link {
 			    speed = <100>;
 			    full-duplex;
 			    };
 		};
        };
 };

On one side, and

 mac0: ethernet@800f0000 {
       phy-mode = "rmii";
       status = "okay";
       fixed-link {
       		  speed = <100>;
 		  full-duplex;
   };
 };

on the other...

Thanks,
									Pavel
 
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html