Messages in this thread | | | From | Peter Geis <> | Date | Tue, 11 May 2021 18:56:31 -0400 | Subject | Re: [PATCH] net: phy: add driver for Motorcomm yt8511 phy |
| |
On Tue, May 11, 2021 at 5:56 PM Russell King - ARM Linux admin <linux@armlinux.org.uk> wrote: > > Hi, > > On Tue, May 11, 2021 at 05:46:06PM -0400, Peter Geis wrote: > > +static int yt8511_config_init(struct phy_device *phydev) > > +{ > > + int ret, val, oldpage; > > + > > + /* set clock mode to 125mhz */ > > + oldpage = phy_select_page(phydev, YT8511_EXT_CLK_GATE); > > + if (oldpage < 0) > > + goto err_restore_page; > > + > > + val = __phy_read(phydev, YT8511_PAGE); > > + val |= (YT8511_CLK_125M); > > + ret = __phy_write(phydev, YT8511_PAGE, val); > > Please consider __phy_modify(), and handle any error it returns.
Hey that's really neat, thanks!
> > > + > > + /* disable auto sleep */ > > + ret = __phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL); > > Please consider handling a failure to write here.
Will do.
> > > + val = __phy_read(phydev, YT8511_PAGE); > > + val &= (~BIT(15)); > > + ret = __phy_write(phydev, YT8511_PAGE, val); > > Also a use for __phy_modify(). > > > + > > +err_restore_page: > > + return phy_restore_page(phydev, oldpage, ret); > > +} > > + > > +static struct phy_driver motorcomm_phy_drvs[] = { > > + { > > + PHY_ID_MATCH_EXACT(PHY_ID_YT8511), > > + .name = "YT8511 Gigabit Ethernet", > > + .config_init = &yt8511_config_init, > > Please drop the '&' here, it's unnecessary.
Will do, thank you.
> > Thanks. > > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
| |