On Tuesday 22 April 2014, zhangfei wrote: > On 04/22/2014 10:30 PM, Arnd Bergmann wrote: > > On Tuesday 22 April 2014, zhangfei wrote: > >> On 04/22/2014 04:22 PM, Arnd Bergmann wrote: > > But it means that the hip04_mdio driver potentially won't work if connected > > to something other than a Marvell PHY. > > > > I noticed that the marvell_of_reg_init() does this at init time: > > > > saved_page = phy_read(phydev, MII_MARVELL_PHY_PAGE); > > ... /* perform init */ > > if (page_changed) > > phy_write(phydev, MII_MARVELL_PHY_PAGE, saved_page); > > > > Is this a bug? Maybe it should always set page 0 when leaving > > this function. > > > It is correct behavior return to the original page. > > First get_phy_id, then match driver according to the id, then operation > in the specific driver have the chance to run, including > marvell_of_reg_init etc. > > Just unlucky the default value of PHY_PAGE after power on is not 0. Ok, so it's actually not possible to detect this case prior to having to work around it. How about adding a DT property as a flag to tell the driver whether to set the page to zero or not? That would let the driver work with different types of PHY implementations, or skip the code if there is firmware that can already set it up to page zero. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html