Message ID | 1543299551-1965-1-git-send-email-siva.durga.paladugu@xilinx.com |
---|---|
State | Accepted |
Commit | c256d3f7c591d6dbde0dedd9dfac696bd9c8376e |
Delegated to: | Michal Simek |
Headers | show |
Series | [U-Boot,1/2] net: phy: Move fixed link code to separate routine | expand |
Hi Joe, On 27. 11. 18 7:19, Siva Durga Prasad Paladugu wrote: > This patch moves fixed-link functionality code to a separate > routine inorder to make it more modular and cleaner. > > Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > --- > drivers/net/phy/phy.c | 34 +++++++++++++++++++++++++++------- > 1 file changed, 27 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c > index e837eb7..3cb2785 100644 > --- a/drivers/net/phy/phy.c > +++ b/drivers/net/phy/phy.c > @@ -875,18 +875,18 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) > debug("%s connected to %s\n", dev->name, phydev->drv->name); > } > > +#ifdef CONFIG_PHY_FIXED > #ifdef CONFIG_DM_ETH > -struct phy_device *phy_connect(struct mii_dev *bus, int addr, > - struct udevice *dev, > - phy_interface_t interface) > +static struct phy_device *phy_connect_fixed(struct mii_dev *bus, > + struct udevice *dev, > + phy_interface_t interface) > #else > -struct phy_device *phy_connect(struct mii_dev *bus, int addr, > - struct eth_device *dev, > - phy_interface_t interface) > +static struct phy_device *phy_connect_fixed(struct mii_dev *bus, > + struct eth_device *dev, > + phy_interface_t interface) > #endif > { > struct phy_device *phydev = NULL; > -#ifdef CONFIG_PHY_FIXED > int sn; > const char *name; > > @@ -900,7 +900,27 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, > } > sn = fdt_next_subnode(gd->fdt_blob, sn); > } > + > + return phydev; > +} > #endif > + > +#ifdef CONFIG_DM_ETH > +struct phy_device *phy_connect(struct mii_dev *bus, int addr, > + struct udevice *dev, > + phy_interface_t interface) > +#else > +struct phy_device *phy_connect(struct mii_dev *bus, int addr, > + struct eth_device *dev, > + phy_interface_t interface) > +#endif > +{ > + struct phy_device *phydev = NULL; > + > +#ifdef CONFIG_PHY_FIXED > + phydev = phy_connect_fixed(bus, dev, interface); > +#endif > + > if (!phydev) > phydev = phy_find_by_mask(bus, 1 << addr, interface); > > can you please take a look at this? Unfortunately there are no IDs to check that's why we had to do it in this way. I would like to get this to v2019.01. Thanks, Michal
On Tue, Nov 27, 2018 at 12:20 AM Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> wrote: > > This patch moves fixed-link functionality code to a separate > routine inorder to make it more modular and cleaner. > > Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> > Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e837eb7..3cb2785 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -875,18 +875,18 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) debug("%s connected to %s\n", dev->name, phydev->drv->name); } +#ifdef CONFIG_PHY_FIXED #ifdef CONFIG_DM_ETH -struct phy_device *phy_connect(struct mii_dev *bus, int addr, - struct udevice *dev, - phy_interface_t interface) +static struct phy_device *phy_connect_fixed(struct mii_dev *bus, + struct udevice *dev, + phy_interface_t interface) #else -struct phy_device *phy_connect(struct mii_dev *bus, int addr, - struct eth_device *dev, - phy_interface_t interface) +static struct phy_device *phy_connect_fixed(struct mii_dev *bus, + struct eth_device *dev, + phy_interface_t interface) #endif { struct phy_device *phydev = NULL; -#ifdef CONFIG_PHY_FIXED int sn; const char *name; @@ -900,7 +900,27 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, } sn = fdt_next_subnode(gd->fdt_blob, sn); } + + return phydev; +} #endif + +#ifdef CONFIG_DM_ETH +struct phy_device *phy_connect(struct mii_dev *bus, int addr, + struct udevice *dev, + phy_interface_t interface) +#else +struct phy_device *phy_connect(struct mii_dev *bus, int addr, + struct eth_device *dev, + phy_interface_t interface) +#endif +{ + struct phy_device *phydev = NULL; + +#ifdef CONFIG_PHY_FIXED + phydev = phy_connect_fixed(bus, dev, interface); +#endif + if (!phydev) phydev = phy_find_by_mask(bus, 1 << addr, interface);