netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFD PATCH] netdev/phy/of: Augment device tree bindings for PHYs to specify IEEE802.3-2005 Section 45 addressing.
@ 2011-09-30 23:09 David Daney
       [not found] ` <1317424182-29252-1-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2011-09-30 23:09 UTC (permalink / raw)
  To: devicetree-discuss, grant.likely, linux-kernel, netdev, davem; +Cc: David Daney

Many 10 gigabit Ethernet PHY devices are interfaced to the MDIO bus
using a protocol called IEEE802.3-2005 Section 45.  Where as PHYS for
1G, 100M and 10M usually use IEEE802.3-2005 Section 22.  These two
protocols can be present on the same MDIO bus.

If we look at the Linux PHY probing code in drivers/of/of_mdio.c and
drivers/net/phy/phy_device.c, we have the situation where we need to
read the PHY registers to get the PHY ID out so that we can use this
to bind to a compatible driver.  However we can only read these
registers if we know the proper MDIO bus protocol to use.

My idea is as follows:

o Add an optional property "mdio-clause-45" to the PHY's device tree
  node to indicate that clause 45 addressing is used.

o When calling get_phy_id() we will set MII_ADDR_C45 in the address
  if we know that clause 45 addressing is required for the PHY.
  get_phy_id() will then use the proper bus protocol and register
  numbers to read PHY ID based on MII_ADDR_C45.

o of_mdiobus_register() will signal MII_ADDR_C45 for PHYs tagged with
  "mdio-clause-45"

o Existing PHYs without "mdio-clause-45" are unaffected.

o If no specific driver for the probed PHY ID is present, we can still
  communicate with the PHY and perhaps use a generic 10G phy driver.
  If the MDIO bus protocol were just to depend on the "compatible"
  property, then we could not use generic drivers for unknown PHY IDs

Comments/other ideas welcome.

Thanks,

Signed-off-by: David Daney <david.daney@cavium.com>
---
 Documentation/devicetree/bindings/net/phy.txt |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/phy.txt b/Documentation/devicetree/bindings/net/phy.txt
index bb8c742..69fd948 100644
--- a/Documentation/devicetree/bindings/net/phy.txt
+++ b/Documentation/devicetree/bindings/net/phy.txt
@@ -14,6 +14,11 @@ Required properties:
  - linux,phandle :  phandle for this node; likely referenced by an
    ethernet controller node.
 
+Optional properties:
+
+ - mdio-clause-45 : Optional.  If present, IEEE802.3-2005 Section 45
+   protocol is used for register access (usually for 10G PHYs).
+
 Example:
 
 ethernet-phy@0 {
-- 
1.7.2.3

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

* Re: [RFD PATCH] netdev/phy/of: Augment device tree bindings for PHYs to specify IEEE802.3-2005 Section 45 addressing.
       [not found] ` <1317424182-29252-1-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
@ 2011-10-02  2:59   ` Andy Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Fleming @ 2011-10-02  2:59 UTC (permalink / raw)
  To: David Daney
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org


[-- Attachment #1.1: Type: text/plain, Size: 3541 bytes --]

On Friday, September 30, 2011, David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org> wrote:
> Many 10 gigabit Ethernet PHY devices are interfaced to the MDIO bus
> using a protocol called IEEE802.3-2005 Section 45.  Where as PHYS for
> 1G, 100M and 10M usually use IEEE802.3-2005 Section 22.  These two
> protocols can be present on the same MDIO bus.
>
> If we look at the Linux PHY probing code in drivers/of/of_mdio.c and
> drivers/net/phy/phy_device.c, we have the situation where we need to
> read the PHY registers to get the PHY ID out so that we can use this
> to bind to a compatible driver.  However we can only read these
> registers if we know the proper MDIO bus protocol to use.
>
> My idea is as follows:
>
> o Add an optional property "mdio-clause-45" to the PHY's device tree
>  node to indicate that clause 45 addressing is used.
>
> o When calling get_phy_id() we will set MII_ADDR_C45 in the address
>  if we know that clause 45 addressing is required for the PHY.
>  get_phy_id() will then use the proper bus protocol and register
>  numbers to read PHY ID based on MII_ADDR_C45.
>
> o of_mdiobus_register() will signal MII_ADDR_C45 for PHYs tagged with
>  "mdio-clause-45"
>
> o Existing PHYs without "mdio-clause-45" are unaffected.
>
> o If no specific driver for the probed PHY ID is present, we can still
>  communicate with the PHY and perhaps use a generic 10G phy driver.
>  If the MDIO bus protocol were just to depend on the "compatible"
>  property, then we could not use generic drivers for unknown PHY IDs
>
> Comments/other ideas welcome.


About a year ago, I  submitted some patches to deal with the Clause 45
stuff. I'm currently working on updating them and fixing the issues raised
during the review. My preferred solution is actually to modify all of the
mdio drivers to support an additional argument which will either be
MDIO_DEVAD_NONE, or an actual device address. IMHO, it makes the interface
more communicative.

I had a mechanism in place in my patches which, I believe, should have
properly noted whether a PHY at a given address was operating under clause
45 rather than clause 22. I also had a generic driver (The last issues
remaining with my patches are related to how the generic driver operates; my
original driver was a stub which worked fine for my particular PHY, but
assumed too much about the PHY state).

However, I think that the idea of a different compatible property for 10g
PHYs could be useful, anyway.

>
> Thanks,
>
> Signed-off-by: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/net/phy.txt |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/phy.txt
b/Documentation/devicetree/bindings/net/phy.txt
> index bb8c742..69fd948 100644
> --- a/Documentation/devicetree/bindings/net/phy.txt
> +++ b/Documentation/devicetree/bindings/net/phy.txt
> @@ -14,6 +14,11 @@ Required properties:
>  - linux,phandle :  phandle for this node; likely referenced by an
>    ethernet controller node.
>
> +Optional properties:
> +
> + - mdio-clause-45 : Optional.  If present, IEEE802.3-2005 Section 45
> +   protocol is used for register access (usually for 10G PHYs).
> +
>  Example:
>
>  ethernet-phy@0 {
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[-- Attachment #1.2: Type: text/html, Size: 4328 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

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

end of thread, other threads:[~2011-10-02  2:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 23:09 [RFD PATCH] netdev/phy/of: Augment device tree bindings for PHYs to specify IEEE802.3-2005 Section 45 addressing David Daney
     [not found] ` <1317424182-29252-1-git-send-email-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2011-10-02  2:59   ` Andy Fleming

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).