[PATCH v2] net: phy: add driver for MotorComm PHY

Sascha Hauer sha at pengutronix.de
Thu Jun 8 23:15:21 PDT 2023


On Thu, Jun 08, 2023 at 12:48:47PM +0200, Yegor Yefremov wrote:
> Hi Sascha,
> 
> On Tue, Jun 6, 2023 at 11:58 AM Sascha Hauer <sha at pengutronix.de> wrote:
> >
> > Hi Yegor,
> >
> > On Tue, Jun 06, 2023 at 10:21:39AM +0200, Yegor Yefremov wrote:
> > > Hi Sascha,
> > >
> > >
> > > > +       ret = phy_modify(phydev, YT8511_PAGE, YT8511_DELAY_FE_TX_EN, fe);
> > > > +       if (ret < 0)
> > > > +               goto err_restore_page;
> > > > +
> > > > +       /* leave pll enabled in sleep */
> > > > +       ret = phy_write(phydev, YT8511_PAGE_SELECT, YT8511_EXT_SLEEP_CTRL);
> > > > +       if (ret < 0)
> > > > +               goto err_restore_page;
> > > > +
> > > > +       ret = phy_modify(phydev, YT8511_PAGE, 0, YT8511_PLLON_SLP);
> > > > +       if (ret < 0)
> > > > +               goto err_restore_page;
> > > > +
> > > > +err_restore_page:
> > > > +       return phy_restore_page(phydev, oldpage, ret);
> > >
> > > As for this approach, it is also used by some other drivers in the Linux kernel:
> > >
> > > drivers/net/phy/realtek.c
> > > drivers/net/phy/icplus.c
> >
> > It's ok like this. I didn't realize phy_restore_page() takes ret as
> > argument and returns it.
> 
> The driver doesn't use a phy_id_mask for now and it causes problems
> that unknown PHY will be assigned to MotorComm. What mask should I
> use? 0xfffffff or 0x00000fff?

It is PHY_ID_MATCH_EXACT() in the kernel, so should be 0xffffffff.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list