RE: [PATCH net-next 07/14] r8152: combine PHY reset with set_speed

From: hayeswang
Date: Tue Feb 18 2014 - 21:41:59 EST


Florian Fainelli [mailto:f.fainelli@xxxxxxxxx]
> Sent: Wednesday, February 19, 2014 1:19 AM
> To: Hayes Wang
> Cc: netdev; nic_swsd@xxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; linux-usb
> Subject: Re: [PATCH net-next 07/14] r8152: combine PHY reset
> with set_speed
[...]
> > +static void rtl_phy_reset(struct r8152 *tp)
> > +{
> > + u16 data;
> > + int i;
> > +
> > + clear_bit(PHY_RESET, &tp->flags);
> > +
> > + data = r8152_mdio_read(tp, MII_BMCR);
> > +
> > + /* don't reset again before the previous one complete */
> > + if (data & BMCR_RESET)
> > + return;
> > +
> > + data |= BMCR_RESET;
> > + r8152_mdio_write(tp, MII_BMCR, data);
> > +
> > + for (i = 0; i < 50; i++) {
> > + msleep(20);
> > + if ((r8152_mdio_read(tp, MII_BMCR) &
> BMCR_RESET) == 0)
> > + break;
> > + }
> > +}
>
> If you implemented libphy in the driver you would not have to
> duplicate that and you could use "phy_init_hw()" or
> genphy_soft_reset() to perform the BMCR-based software reset.

Thanks for you suggestion. I would study about those.

Best Regards,
Hayes


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/