Lines Matching refs:phydev
73 static int rtl8211f_phy_extread(struct phy_device *phydev, int addr, in rtl8211f_phy_extread() argument
76 int oldpage = phy_read(phydev, MDIO_DEVAD_NONE, in rtl8211f_phy_extread()
80 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, devaddr); in rtl8211f_phy_extread()
81 val = phy_read(phydev, MDIO_DEVAD_NONE, regnum); in rtl8211f_phy_extread()
82 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, oldpage); in rtl8211f_phy_extread()
87 static int rtl8211f_phy_extwrite(struct phy_device *phydev, int addr, in rtl8211f_phy_extwrite() argument
90 int oldpage = phy_read(phydev, MDIO_DEVAD_NONE, in rtl8211f_phy_extwrite()
93 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, devaddr); in rtl8211f_phy_extwrite()
94 phy_write(phydev, MDIO_DEVAD_NONE, regnum, val); in rtl8211f_phy_extwrite()
95 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, oldpage); in rtl8211f_phy_extwrite()
100 static int rtl8211b_probe(struct phy_device *phydev) in rtl8211b_probe() argument
103 phydev->flags |= PHY_RTL8211x_FORCE_MASTER; in rtl8211b_probe()
109 static int rtl8211e_probe(struct phy_device *phydev) in rtl8211e_probe() argument
112 phydev->flags |= PHY_RTL8211E_PINE64_GIGABIT_FIX; in rtl8211e_probe()
118 static int rtl8211f_probe(struct phy_device *phydev) in rtl8211f_probe() argument
121 phydev->flags |= PHY_RTL8211F_FORCE_EEE_RXC_ON; in rtl8211f_probe()
127 static int rtl8210f_probe(struct phy_device *phydev) in rtl8210f_probe() argument
130 phydev->flags |= PHY_RTL8201F_S700_RMII_TIMINGS; in rtl8210f_probe()
137 static int rtl8211x_config(struct phy_device *phydev) in rtl8211x_config() argument
139 phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET); in rtl8211x_config()
144 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER, in rtl8211x_config()
147 if (phydev->flags & PHY_RTL8211x_FORCE_MASTER) { in rtl8211x_config()
150 reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_CTRL1000); in rtl8211x_config()
155 phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, reg); in rtl8211x_config()
157 if (phydev->flags & PHY_RTL8211E_PINE64_GIGABIT_FIX) { in rtl8211x_config()
160 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, in rtl8211x_config()
162 phy_write(phydev, MDIO_DEVAD_NONE, in rtl8211x_config()
164 reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211E_CONFREG); in rtl8211x_config()
169 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211E_CONFREG, reg); in rtl8211x_config()
170 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, in rtl8211x_config()
174 phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_INER); in rtl8211x_config()
176 genphy_config_aneg(phydev); in rtl8211x_config()
182 static int rtl8201f_config(struct phy_device *phydev) in rtl8201f_config() argument
186 if (phydev->flags & PHY_RTL8201F_S700_RMII_TIMINGS) { in rtl8201f_config()
187 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, in rtl8201f_config()
189 reg = phy_read(phydev, MDIO_DEVAD_NONE, RTL8201F_RMSR); in rtl8201f_config()
194 phy_write(phydev, MDIO_DEVAD_NONE, RTL8201F_RMSR, reg); in rtl8201f_config()
195 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, in rtl8201f_config()
199 genphy_config_aneg(phydev); in rtl8201f_config()
204 static int rtl8211f_config(struct phy_device *phydev) in rtl8211f_config() argument
208 if (phydev->flags & PHY_RTL8211F_FORCE_EEE_RXC_ON) { in rtl8211f_config()
211 reg = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1); in rtl8211f_config()
213 phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1, reg); in rtl8211f_config()
216 phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET); in rtl8211f_config()
218 phy_write(phydev, MDIO_DEVAD_NONE, in rtl8211f_config()
220 reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x11); in rtl8211f_config()
223 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in rtl8211f_config()
224 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in rtl8211f_config()
229 phy_write(phydev, MDIO_DEVAD_NONE, 0x11, reg); in rtl8211f_config()
232 reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x15); in rtl8211f_config()
233 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in rtl8211f_config()
234 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in rtl8211f_config()
238 phy_write(phydev, MDIO_DEVAD_NONE, 0x15, reg); in rtl8211f_config()
241 phy_write(phydev, MDIO_DEVAD_NONE, in rtl8211f_config()
245 phy_write(phydev, MDIO_DEVAD_NONE, in rtl8211f_config()
247 phy_write(phydev, MDIO_DEVAD_NONE, 0x10, 0x617f); in rtl8211f_config()
248 phy_write(phydev, MDIO_DEVAD_NONE, in rtl8211f_config()
251 genphy_config_aneg(phydev); in rtl8211f_config()
256 static int rtl8211x_parse_status(struct phy_device *phydev) in rtl8211x_parse_status() argument
261 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211x_PHY_STATUS); in rtl8211x_parse_status()
267 phydev->link = 1; in rtl8211x_parse_status()
273 phydev->link = 0; in rtl8211x_parse_status()
280 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, in rtl8211x_parse_status()
287 phydev->link = 1; in rtl8211x_parse_status()
289 phydev->link = 0; in rtl8211x_parse_status()
293 phydev->duplex = DUPLEX_FULL; in rtl8211x_parse_status()
295 phydev->duplex = DUPLEX_HALF; in rtl8211x_parse_status()
301 phydev->speed = SPEED_1000; in rtl8211x_parse_status()
304 phydev->speed = SPEED_100; in rtl8211x_parse_status()
307 phydev->speed = SPEED_10; in rtl8211x_parse_status()
313 static int rtl8211f_parse_status(struct phy_device *phydev) in rtl8211f_parse_status() argument
319 phy_write(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PAGE_SELECT, 0xa43); in rtl8211f_parse_status()
320 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_RTL8211F_PHY_STATUS); in rtl8211f_parse_status()
322 phydev->link = 1; in rtl8211f_parse_status()
326 phydev->link = 0; in rtl8211f_parse_status()
333 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, in rtl8211f_parse_status()
338 phydev->duplex = DUPLEX_FULL; in rtl8211f_parse_status()
340 phydev->duplex = DUPLEX_HALF; in rtl8211f_parse_status()
346 phydev->speed = SPEED_1000; in rtl8211f_parse_status()
349 phydev->speed = SPEED_100; in rtl8211f_parse_status()
352 phydev->speed = SPEED_10; in rtl8211f_parse_status()
358 static int rtl8211x_startup(struct phy_device *phydev) in rtl8211x_startup() argument
363 ret = genphy_update_link(phydev); in rtl8211x_startup()
367 return rtl8211x_parse_status(phydev); in rtl8211x_startup()
370 static int rtl8211e_startup(struct phy_device *phydev) in rtl8211e_startup() argument
374 ret = genphy_update_link(phydev); in rtl8211e_startup()
378 return genphy_parse_link(phydev); in rtl8211e_startup()
381 static int rtl8211f_startup(struct phy_device *phydev) in rtl8211f_startup() argument
386 ret = genphy_update_link(phydev); in rtl8211f_startup()
391 return rtl8211f_parse_status(phydev); in rtl8211f_startup()