All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/7] Clean up PHY MMD accessors
@ 2017-01-13 15:20 ` Russell King - ARM Linux
  0 siblings, 0 replies; 21+ messages in thread
From: Russell King - ARM Linux @ 2017-01-13 15:20 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Woojung Huh, netdev, linux-usb, linux-arm-kernel,
	Microchip Linux Driver Support

This series cleans up phylib's MMD accessors, so that we have a common
way of accessing the Clause 45 register set.

The current situation is far from ideal - we have phy_(read|write)_mmd()
which accesses Clause 45 registers over Clause 45 accesses, and we have
phy_(read|write)_mmd_indirect(), which accesses Clause 45 registers via
Clause 22 register 13/14.

Generic code uses the indirect methods to access standard Clause 45
features, and when we come to add Clause 45 PHY support to phylib, we
would need to make these conditional upon the PHY type, or duplicate
these functions.

An alternative solution is to merge these accessors together, and select
the appropriate access method depending upon the 802.3 clause that the
PHY conforms with.  The result is that we have a single set of
phy_(read|write)_mmd() accessors.

For cases which require special handling, we still allow PHY drivers to
override all MMD accesses - except rather than just overriding the
indirect accesses.  This keeps existing overrides working.

Combining the two also has another beneficial side effect - we get rid
of similar functions that take arguments in different orders.  The
old direct accessors took the phy structure, devad and register number,
whereas the indirect accessors took the phy structure, register number
and devad in that order.  Care must be taken when updating future
drivers that the argument order is correct, and the function name is
not merely replaced.

This patch set is against 4.10-rc3 at present.

 drivers/net/phy/Makefile      |   3 +-
 drivers/net/phy/bcm-phy-lib.c |  12 ++---
 drivers/net/phy/dp83867.c     |  18 +++----
 drivers/net/phy/intel-xway.c  |  26 +++++-----
 drivers/net/phy/micrel.c      |  13 +++--
 drivers/net/phy/microchip.c   |   5 +-
 drivers/net/phy/phy-core.c    | 101 ++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy.c         | 110 ++++--------------------------------------
 drivers/net/phy/phy_device.c  |   4 +-
 drivers/net/usb/lan78xx.c     |  10 ++--
 include/linux/phy.h           |  56 +++++++++------------
 11 files changed, 176 insertions(+), 182 deletions(-)
 create mode 100644 drivers/net/phy/phy-core.c

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH RFC 0/7] phylib MMD accessor cleanups
@ 2017-03-19 10:59 Russell King - ARM Linux
  2017-03-19 11:00 ` [PATCH RFC 1/7] net: phy: move phy MMD accessors to phy-core.c Russell King
  0 siblings, 1 reply; 21+ messages in thread
From: Russell King - ARM Linux @ 2017-03-19 10:59 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-usb, Microchip Linux Driver Support, netdev, Woojung Huh

Hi,

This series cleans up the phylib MMD accessors.  We have two accessors
at present, phy_(read|write)_mmd() and phy_(read|write)_mmd_indirect()

The _indirect methods access the MMD registers via a clause 22 phy,
whereas the non-_indirect methods acess via clause 45 accesses.

Current PHY-independent parts of phylib (such as EEE) access the MMD
registers via the _indirect methods, which is no good if you have a
clause 45 PHY that doesn't respond to clause 22 accesses.

In order to make these features available, we need to rework these
accessors such that they can access the MMD registers using a method
dependent on the clause that the PHY conforms with.

This series of patches does exactly that - we merge the functionality
of the indirect accesses into the clause 45 accessors, and use these
exclusively to access MMD registers.  Internally, the new clause
independent MMD accessors indirect via the PHY drivers read_mmd/write_mmd
methods if present, otherwise fall back to using clause 45 accesses if
the PHY is a clause 45 phy, or clause 22 indirect accesses if the PHY
is clause 22.

Note: confusingly, phy_read_mmd_indirect() vs phy_read_mmd() switches
the order of prtad and devad, which means that converting between the
two is not a simple matter of just replacing the function name.  Same
applies for the write methods.

 drivers/net/phy/Makefile      |   2 +-
 drivers/net/phy/bcm-phy-lib.c |  12 ++---
 drivers/net/phy/dp83867.c     |  25 +++++-----
 drivers/net/phy/intel-xway.c  |  26 +++++-----
 drivers/net/phy/micrel.c      |  13 +++--
 drivers/net/phy/microchip.c   |   5 +-
 drivers/net/phy/phy-core.c    | 101 ++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy.c         | 110 ++++--------------------------------------
 drivers/net/phy/phy_device.c  |   4 +-
 drivers/net/usb/lan78xx.c     |  10 ++--
 include/linux/phy.h           |  80 +++++++++---------------------
 11 files changed, 178 insertions(+), 210 deletions(-)

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-03-19 11:10 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 15:20 [PATCH RFC 0/7] Clean up PHY MMD accessors Russell King - ARM Linux
2017-01-13 15:20 ` Russell King - ARM Linux
2017-01-13 15:21 ` [PATCH RFC 3/7] net: lan78xx: update for phy_(read|write)_mmd_indirect() removal Russell King
2017-01-13 15:21   ` Russell King
2017-01-13 15:21 ` [PATCH RFC 4/7] net: phy: switch remaining users to phy_(read|write)_mmd() Russell King
2017-01-13 15:21   ` Russell King
2017-01-13 15:22 ` [PATCH RFC 5/7] net: phy: convert micrel to new read_mmd/write_mmd driver methods Russell King
2017-01-13 15:22   ` Russell King
     [not found] ` <20170113152059.GR14217-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2017-01-13 15:21   ` [PATCH RFC 1/7] net: phy: move phy MMD accessors to phy-core.c Russell King
2017-01-13 15:21     ` Russell King
2017-01-13 15:21   ` [PATCH RFC 2/7] net: phy: make phy_(read|write)_mmd() generic MMD accessors Russell King
2017-01-13 15:21     ` Russell King
2017-01-13 15:22   ` [PATCH RFC 6/7] net: phy: remove the indirect MMD read/write methods Russell King
2017-01-13 15:22     ` Russell King
2017-01-13 15:22   ` [PATCH RFC 7/7] net: phy: clean up mmd_phy_indirect() Russell King
2017-01-13 15:22     ` Russell King
2017-01-19 19:42 ` [PATCH RFC 0/7] Clean up PHY MMD accessors Florian Fainelli
2017-01-19 19:42   ` Florian Fainelli
2017-01-19 19:58   ` Russell King - ARM Linux
2017-01-19 19:58     ` Russell King - ARM Linux
2017-03-19 10:59 [PATCH RFC 0/7] phylib MMD accessor cleanups Russell King - ARM Linux
2017-03-19 11:00 ` [PATCH RFC 1/7] net: phy: move phy MMD accessors to phy-core.c Russell King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.