From: Kunihiko Hayashi Subject: Re: net: phy: question about phy_is_internal for generic-phy Date: Fri, 09 Feb 2018 14:31:57 +0900 Message-ID: <20180209143157.11B8.4A936039@socionext.com> References: <20180208190925.0B91.4A936039@socionext.com> <20180208125144.GA6642@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Andrew Lunn Return-path: Received: from mx.socionext.com ([202.248.49.38]:25948 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbeBIFb7 (ORCPT ); Fri, 9 Feb 2018 00:31:59 -0500 In-Reply-To: <20180208125144.GA6642@lunn.ch> Sender: netdev-owner@vger.kernel.org List-ID: Hi Andrew, On Thu, 8 Feb 2018 13:51:44 +0100 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