OSDN Git Service

Merge branch 'phylib-consolidation'
authorDavid S. Miller <davem@davemloft.net>
Thu, 19 Dec 2019 20:52:34 +0000 (12:52 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Dec 2019 20:52:34 +0000 (12:52 -0800)
commitd8e419da048e45a8258b9721e85232dbb25ac618
treef5bd92bb1f6cab36652323fe5d0ee9629b8586c4
parenta1ec57c020201ba29608a5a3588832d07de1a518
parentb5abac2d2d17ce1b30c267dd72fb91c8bc21bee1
Merge branch 'phylib-consolidation'

Russell King says:

====================
phylib consolidation

Over the last few releases, there has been a push to clean up and
consolidate the phylib code. Some cases have been missed, and this
series catches those cases.

1. Remove redundant .aneg_done initialisers; calling genphy_aneg_done()
   for clause 22 PHYs is the default when .aneg_done is not set.

2. Some PHY drivers manually set phydev->pause and phydev->asym_pause,
   but we have a helper for this - phy_resolve_aneg_pause(), introduced
   in 2d880b8709c0 ("net: phy: extract pause mode").  Use this in the
   lxt, marvell and uPD60620 drivers.

   Incidentally, this brings up the question whether marvell fiber mode
   is correctly interpreting and advertising the pause parameters.

3. Add a genphy_check_and_restart_aneg() helper, which complements the
   clause 45 version of this. This will be useful for PHY drivers that
   open code this logic (e.g. marvell.c)

4. Add a genphy_read_status_fixed() helper to read the fixed-mode
   status from a clause 22 PHY.  lxt and marvell both contain copies
   of this code, so convert them over.

5. Arrange marvell driver to use genphy_read_lpa() for copper mode.
   This needs some rearrangement of the code in
   marvell_read_status_page_an(), but preserves using the PHY specific
   status register to derive the current negotiation results.

6. Simplify the marvell driver so we can use the
   genphy_read_status_fixed() helper directly rather than
   marvell_read_status_page_fixed().

7. Use positive logic in the marvell driver to determine the link
   state, and get rid of the REGISTER_LINK_STATUS definition; we
   already have a definition for this.

8. The marvell driver reads the PHY specific status register multiple
   times when determining the status: once in marvell_update_link()
   and again in marvell_read_status_page_an(). This is a waste;
   rearrange to read the status register once, and pass its value into
   marvell_read_status_page_an().  We preserve using
   genphy_update_link() for the copper side.

9. The marvell driver was using private clause 37 definitions, but we
   have clause 37 definitions in uapi/linux/mii.h. Use the generic
   definitions.

10. Switch the marvell driver to use phy_modify_changed() to modify
    the fiber advertisement.

11. Switch the marvell driver to use genphy_check_and_restart_aneg()
    introduced above rather than open-coding this functionality.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>