From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH v3 net-next 1/3] lan78xx: Lan7801 Support for Fixed PHY Date: Thu, 26 Apr 2018 10:24:39 -0700 Message-ID: References: <20180426171114.19753-1-raghuramchary.jallipalli@microchip.com> <20180426171114.19753-2-raghuramchary.jallipalli@microchip.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, unglinuxdriver@microchip.com, woojung.huh@microchip.com To: Raghuram Chary J , davem@davemloft.net Return-path: Received: from mail-pf0-f196.google.com ([209.85.192.196]:37502 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753282AbeDZRYn (ORCPT ); Thu, 26 Apr 2018 13:24:43 -0400 Received: by mail-pf0-f196.google.com with SMTP id p6so18910464pfn.4 for ; Thu, 26 Apr 2018 10:24:43 -0700 (PDT) In-Reply-To: <20180426171114.19753-2-raghuramchary.jallipalli@microchip.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 04/26/2018 10:11 AM, Raghuram Chary J wrote: > Adding Fixed PHY support to the lan78xx driver. > > Signed-off-by: Raghuram Chary J > --- > v0->v1: > * Remove driver version #define > * Modify netdev_info to netdev_dbg > * Move lan7801 specific to new routine and add switch case > * Minor cleanup > > v1->v2: > * Removed fixedphy variable and used phy_is_pseudo_fixed_link() check. > v2->v3: > * Revert driver version, debug statment changes for separate patch. > * Modify lan7801 specific routine with return type struct phy_device. > --- > drivers/net/usb/Kconfig | 1 + > drivers/net/usb/lan78xx.c | 103 ++++++++++++++++++++++++++++++++-------------- > 2 files changed, 74 insertions(+), 30 deletions(-) > > diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig > index f28bd74ac275..418b0904cecb 100644 > --- a/drivers/net/usb/Kconfig > +++ b/drivers/net/usb/Kconfig > @@ -111,6 +111,7 @@ config USB_LAN78XX > select MII > select PHYLIB > select MICROCHIP_PHY > + select FIXED_PHY > help > This option adds support for Microchip LAN78XX based USB 2 > & USB 3 10/100/1000 Ethernet adapters. > diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c > index 0867f7275852..ef169d73fadc 100644 > --- a/drivers/net/usb/lan78xx.c > +++ b/drivers/net/usb/lan78xx.c > @@ -36,7 +36,7 @@ > #include > #include > #include > -#include > +#include > #include "lan78xx.h" > > #define DRIVER_AUTHOR "WOOJUNG HUH " > @@ -2003,52 +2003,90 @@ static int ksz9031rnx_fixup(struct phy_device *phydev) > return 1; > } > > -static int lan78xx_phy_init(struct lan78xx_net *dev) > +static struct phy_device *lan7801_phy_init(struct phy_device *phydev, > + struct lan78xx_net *dev) This is confusing, why cannot you just pass a struct lan78xx_net reference and return a phy_device reference in turn if either: - phy_find_first() succeeds, or - you registered a fixed PHY device? To get there, just restructure how lan78xx_phy_init() does things by moving the phy_find_first() under the switch()/case for ID_REV_CHIP_ID_7800_ and ID_REV_CHIP_ID_7850_ and then you can have lan7801_phy_init() do the phy_find_first(). Or better just merge lan78xx_phy_init() with lan7801_phy_init() maybe? -- Florian