netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Sam Lewis <sam.vr.lewis@gmail.com>
Cc: Steve Glendinning <steve.glendinning@shawell.net>,
	UNGLinuxDriver@microchip.com, netdev@vger.kernel.org
Subject: Re: PROBLEM: smsc95xx loses config on link down/up
Date: Tue, 3 Dec 2019 14:27:30 +0100	[thread overview]
Message-ID: <20191203132730.GC1234@lunn.ch> (raw)
In-Reply-To: <CA+ZLECv7AcQSa1VZeeiOFJ43Vh=nfn_ptMB6XwXsfbRSz9VJ6A@mail.gmail.com>

> Basically it looks as though doing a BMCR_RESET does, in fact, reset
> every PHY R/W register bit except for those marked as "Not Affected by
> Software Reset" (NASR). This means it will reset, to the default
> value:
> 
> - Autonegotiation
> - Speed
> - Duplex
> - Auto MDIX
> - Energy Detect Power-Down
> - Auto Negotiation Advertisement
> - PHY Identification (although I don't know why you'd change this?)
> - Power down
> - Loopback
> 
> I tested this by checking the value of the BMCR register before and
> after doing a BMCR_RESET and it did reset the BMCR register to its
> default values.

O.K, not what we want.

So there are two different paths here you can follow:

1) Moving the reset out of open and into bind.
2) Re-write the driver to make use of the core phylib support.

1) is probably the quick and simple solution, but watch out for
suspend/resume.

2) is more work, but brings the driver into line with other MAC
drivers. phylib would then program the PHY, maybe via PHY driver. It
would do this during open, using state information. So it should
correctly handle state change while the interface is down, or
suspended etc.

The USB-ethernet drivers lan78xx and ax88172a both use phylib.  They
can give you ideas how this should work.

drivers/net/phy/smsc.c might be a good basis for a PHY driver, but it
looks like you will need to extend it for MDIX, etc.

      Andrew

      reply	other threads:[~2019-12-03 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28  7:19 PROBLEM: smsc95xx loses config on link down/up Sam Lewis
2019-12-02 13:46 ` Andrew Lunn
2019-12-03  6:19   ` Sam Lewis
2019-12-03 13:27     ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203132730.GC1234@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=netdev@vger.kernel.org \
    --cc=sam.vr.lewis@gmail.com \
    --cc=steve.glendinning@shawell.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).