All of lore.kernel.org
 help / color / mirror / Atom feed
* net: phy: question about phy_is_internal for generic-phy
@ 2018-02-08 10:09 Kunihiko Hayashi
  2018-02-08 12:51 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Kunihiko Hayashi @ 2018-02-08 10:09 UTC (permalink / raw)
  To: netdev

Hello,

Is there a way to specify "phy is internal" to generic phy driver,
that is, to make phy_is_internal() function available?

I found "phy-is-integrated" DT property in
Documentation/devicetree/bindings/net/phy.txt, however, it seems
that the property is no effect for generic phy. And I think that
the meaning of "integrated" is slightly different from "internal".

---
Best Regards,
Kunihiko Hayashi

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

* Re: net: phy: question about phy_is_internal for generic-phy
  2018-02-08 10:09 net: phy: question about phy_is_internal for generic-phy Kunihiko Hayashi
@ 2018-02-08 12:51 ` Andrew Lunn
  2018-02-09  5:31   ` Kunihiko Hayashi
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2018-02-08 12:51 UTC (permalink / raw)
  To: Kunihiko Hayashi; +Cc: netdev

On Thu, Feb 08, 2018 at 07:09:25PM +0900, Kunihiko Hayashi wrote:
> Hello,
> 
> Is there a way to specify "phy is internal" to generic phy driver,
> that is, to make phy_is_internal() function available?
> 
> I found "phy-is-integrated" DT property in
> Documentation/devicetree/bindings/net/phy.txt, however, it seems
> that the property is no effect for generic phy. And I think that
> the meaning of "integrated" is slightly different from "internal".

Hi Kunihiko

Could you explain the bigger picture. Why do you need this?

Thanks
	Andrew



 

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

* Re: net: phy: question about phy_is_internal for generic-phy
  2018-02-08 12:51 ` Andrew Lunn
@ 2018-02-09  5:31   ` Kunihiko Hayashi
  2018-02-09 14:59     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Kunihiko Hayashi @ 2018-02-09  5:31 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

Hi Andrew,

On Thu, 8 Feb 2018 13:51:44 +0100 <andrew@lunn.ch> wrote:

> On Thu, Feb 08, 2018 at 07:09:25PM +0900, Kunihiko Hayashi wrote:
> > Hello,
> > 
> > Is there a way to specify "phy is internal" to generic phy driver,
> > that is, to make phy_is_internal() function available?
> > 
> > I found "phy-is-integrated" DT property in
> > Documentation/devicetree/bindings/net/phy.txt, however, it seems
> > that the property is no effect for generic phy. And I think that
> > the meaning of "integrated" is slightly different from "internal".
> 
> Hi Kunihiko
> 
> Could you explain the bigger picture. Why do you need this?


There are some SoCs that have a built-in phy, and sometimes
these SoCs can choose to use built-in phy or external phy.

In our case, MAC driver needs to set a register to choose whether
to use them. This choice depends on the board implemented on the SoC.
And this built-in phy can be driven with generic phy driver.

If 'struct phy_driver' of a phy driver has the flag with
PHY_IS_INTERNAL, phy_is_internal() returns true,
and the MAC driver can decide a value of the register using it.

drivers/net/phy/phy_device.c:

	if (phydrv->flags & PHY_IS_INTERNAL)
        	phydev->is_internal = true;

include/linux/phy.h:

	static inline bool phy_is_internal(struct phy_device *phydev)
	{
	        return phydev->is_internal;
	}

Although I can write a new driver with PHY_IS_INTERNAL, or
add a new property to the MAC driver,
I'd like to use generic phy driver if possible.

However, it seems that the generic phy driver doesn't have the way
to express built-in phy with/without even DT.

How can I handle such built-in phy?

Thank you,

---
Best Regards,
Kunihiko Hayashi

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

* Re: net: phy: question about phy_is_internal for generic-phy
  2018-02-09  5:31   ` Kunihiko Hayashi
@ 2018-02-09 14:59     ` Andrew Lunn
  2018-02-13  5:15       ` Kunihiko Hayashi
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2018-02-09 14:59 UTC (permalink / raw)
  To: Kunihiko Hayashi; +Cc: netdev

> There are some SoCs that have a built-in phy, and sometimes
> these SoCs can choose to use built-in phy or external phy.

O.K. This is the same use case we had at the end of last year.

How are the MDIO busses arranged? Is there an internal MDIO bus and an
external MDIO bus? How do you change between the internal and the
external? Or is it one bus, with the two PHYs having different
addresses?

For the hardware in question last year, an MDIO MUX was implemented.
The MAC has a phy-handle pointing to either the internal PHY on the
internal MDIO bus, or the external PHY on the external MDIO bus. The
MDIO MUX layer would then set the register to select between the two.

https://patchwork.kernel.org/patch/10025279/

	Andrew

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

* Re: net: phy: question about phy_is_internal for generic-phy
  2018-02-09 14:59     ` Andrew Lunn
@ 2018-02-13  5:15       ` Kunihiko Hayashi
  0 siblings, 0 replies; 5+ messages in thread
From: Kunihiko Hayashi @ 2018-02-13  5:15 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

Hi Andrew,
Thank you for your advice.

On Fri, 9 Feb 2018 15:59:54 +0100 <andrew@lunn.ch> wrote:

> > There are some SoCs that have a built-in phy, and sometimes
> > these SoCs can choose to use built-in phy or external phy.
> 
> O.K. This is the same use case we had at the end of last year.
> 
> How are the MDIO busses arranged? Is there an internal MDIO bus and an
> external MDIO bus? How do you change between the internal and the
> external? Or is it one bus, with the two PHYs having different
> addresses?
> 
> For the hardware in question last year, an MDIO MUX was implemented.
> The MAC has a phy-handle pointing to either the internal PHY on the
> internal MDIO bus, or the external PHY on the external MDIO bus. The
> MDIO MUX layer would then set the register to select between the two.
> 
> https://patchwork.kernel.org/patch/10025279/

I've checked our hardware configuration.
There are internal and external MDIO buses, and the register selects
between them. I'll consider to apply MDIO MUX layer to our MAC driver
rather than phy_is_internal of generic-phy.

Thank you,

---
Best Regards,
Kunihiko Hayashi

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

end of thread, other threads:[~2018-02-13  5:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 10:09 net: phy: question about phy_is_internal for generic-phy Kunihiko Hayashi
2018-02-08 12:51 ` Andrew Lunn
2018-02-09  5:31   ` Kunihiko Hayashi
2018-02-09 14:59     ` Andrew Lunn
2018-02-13  5:15       ` Kunihiko Hayashi

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.