Lines Matching full:phydev

24 static int lan88xx_read_page(struct phy_device *phydev)  in lan88xx_read_page()  argument
26 return __phy_read(phydev, LAN88XX_EXT_PAGE_ACCESS); in lan88xx_read_page()
29 static int lan88xx_write_page(struct phy_device *phydev, int page) in lan88xx_write_page() argument
31 return __phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, page); in lan88xx_write_page()
34 static int lan88xx_phy_config_intr(struct phy_device *phydev) in lan88xx_phy_config_intr() argument
38 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in lan88xx_phy_config_intr()
40 rc = phy_write(phydev, LAN88XX_INT_MASK, 0x7FFF); in lan88xx_phy_config_intr()
41 rc = phy_read(phydev, LAN88XX_INT_STS); in lan88xx_phy_config_intr()
42 rc = phy_write(phydev, LAN88XX_INT_MASK, in lan88xx_phy_config_intr()
46 rc = phy_write(phydev, LAN88XX_INT_MASK, 0); in lan88xx_phy_config_intr()
51 rc = phy_read(phydev, LAN88XX_INT_STS); in lan88xx_phy_config_intr()
57 static irqreturn_t lan88xx_handle_interrupt(struct phy_device *phydev) in lan88xx_handle_interrupt() argument
61 irq_status = phy_read(phydev, LAN88XX_INT_STS); in lan88xx_handle_interrupt()
63 phy_error(phydev); in lan88xx_handle_interrupt()
70 phy_trigger_machine(phydev); in lan88xx_handle_interrupt()
75 static int lan88xx_suspend(struct phy_device *phydev) in lan88xx_suspend() argument
77 struct lan88xx_priv *priv = phydev->priv; in lan88xx_suspend()
81 genphy_suspend(phydev); in lan88xx_suspend()
86 static int lan88xx_TR_reg_set(struct phy_device *phydev, u16 regaddr, in lan88xx_TR_reg_set() argument
93 save_page = phy_save_page(phydev); in lan88xx_TR_reg_set()
95 phydev_warn(phydev, "Failed to get current page\n"); in lan88xx_TR_reg_set()
100 lan88xx_write_page(phydev, LAN88XX_EXT_PAGE_ACCESS_TR); in lan88xx_TR_reg_set()
102 ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_LOW_DATA, in lan88xx_TR_reg_set()
105 phydev_warn(phydev, "Failed to write TR low data\n"); in lan88xx_TR_reg_set()
109 ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_HIGH_DATA, in lan88xx_TR_reg_set()
112 phydev_warn(phydev, "Failed to write TR high data\n"); in lan88xx_TR_reg_set()
120 ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_CR, buf); in lan88xx_TR_reg_set()
122 phydev_warn(phydev, "Failed to write data in reg\n"); in lan88xx_TR_reg_set()
127 val = __phy_read(phydev, LAN88XX_EXT_PAGE_TR_CR); in lan88xx_TR_reg_set()
129 phydev_warn(phydev, "TR Register[0x%X] configuration failed\n", in lan88xx_TR_reg_set()
132 return phy_restore_page(phydev, save_page, ret); in lan88xx_TR_reg_set()
135 static void lan88xx_config_TR_regs(struct phy_device *phydev) in lan88xx_config_TR_regs() argument
143 err = lan88xx_TR_reg_set(phydev, 0x0F82, 0x12B00A); in lan88xx_config_TR_regs()
145 phydev_warn(phydev, "Failed to Set Register[0x0F82]\n"); in lan88xx_config_TR_regs()
151 err = lan88xx_TR_reg_set(phydev, 0x168C, 0xD2C46F); in lan88xx_config_TR_regs()
153 phydev_warn(phydev, "Failed to Set Register[0x168C]\n"); in lan88xx_config_TR_regs()
159 err = lan88xx_TR_reg_set(phydev, 0x17A2, 0x620); in lan88xx_config_TR_regs()
161 phydev_warn(phydev, "Failed to Set Register[0x17A2]\n"); in lan88xx_config_TR_regs()
168 err = lan88xx_TR_reg_set(phydev, 0x16A0, 0xEEFFDD); in lan88xx_config_TR_regs()
170 phydev_warn(phydev, "Failed to Set Register[0x16A0]\n"); in lan88xx_config_TR_regs()
176 err = lan88xx_TR_reg_set(phydev, 0x16A6, 0x071448); in lan88xx_config_TR_regs()
178 phydev_warn(phydev, "Failed to Set Register[0x16A6]\n"); in lan88xx_config_TR_regs()
184 err = lan88xx_TR_reg_set(phydev, 0x16A4, 0x13132F); in lan88xx_config_TR_regs()
186 phydev_warn(phydev, "Failed to Set Register[0x16A4]\n"); in lan88xx_config_TR_regs()
192 err = lan88xx_TR_reg_set(phydev, 0x16A8, 0x0); in lan88xx_config_TR_regs()
194 phydev_warn(phydev, "Failed to Set Register[0x16A8]\n"); in lan88xx_config_TR_regs()
201 err = lan88xx_TR_reg_set(phydev, 0x0FE8, 0x91B06C); in lan88xx_config_TR_regs()
203 phydev_warn(phydev, "Failed to Set Register[0x0FE8]\n"); in lan88xx_config_TR_regs()
210 err = lan88xx_TR_reg_set(phydev, 0x0FFC, 0xC0A028); in lan88xx_config_TR_regs()
212 phydev_warn(phydev, "Failed to Set Register[0x0FFC]\n"); in lan88xx_config_TR_regs()
219 err = lan88xx_TR_reg_set(phydev, 0x0FEA, 0x041600); in lan88xx_config_TR_regs()
221 phydev_warn(phydev, "Failed to Set Register[0x0FEA]\n"); in lan88xx_config_TR_regs()
226 err = lan88xx_TR_reg_set(phydev, 0x1686, 0x000004); in lan88xx_config_TR_regs()
228 phydev_warn(phydev, "Failed to Set Register[0x1686]\n"); in lan88xx_config_TR_regs()
231 static int lan88xx_probe(struct phy_device *phydev) in lan88xx_probe() argument
233 struct device *dev = &phydev->mdio.dev; in lan88xx_probe()
260 (void)phy_write(phydev, LAN78XX_PHY_LED_MODE_SELECT, reg); in lan88xx_probe()
266 priv->chip_id = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_ID); in lan88xx_probe()
267 priv->chip_rev = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_REV); in lan88xx_probe()
269 phydev->priv = priv; in lan88xx_probe()
274 static void lan88xx_remove(struct phy_device *phydev) in lan88xx_remove() argument
276 struct device *dev = &phydev->mdio.dev; in lan88xx_remove()
277 struct lan88xx_priv *priv = phydev->priv; in lan88xx_remove()
283 static int lan88xx_set_wol(struct phy_device *phydev, in lan88xx_set_wol() argument
286 struct lan88xx_priv *priv = phydev->priv; in lan88xx_set_wol()
293 static void lan88xx_set_mdix(struct phy_device *phydev) in lan88xx_set_mdix() argument
298 switch (phydev->mdix_ctrl) { in lan88xx_set_mdix()
312 phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, LAN88XX_EXT_PAGE_SPACE_1); in lan88xx_set_mdix()
313 buf = phy_read(phydev, LAN88XX_EXT_MODE_CTRL); in lan88xx_set_mdix()
316 phy_write(phydev, LAN88XX_EXT_MODE_CTRL, buf); in lan88xx_set_mdix()
317 phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, LAN88XX_EXT_PAGE_SPACE_0); in lan88xx_set_mdix()
320 static int lan88xx_config_init(struct phy_device *phydev) in lan88xx_config_init() argument
325 val = phy_read_mmd(phydev, MDIO_MMD_PCS, in lan88xx_config_init()
329 phy_write_mmd(phydev, MDIO_MMD_PCS, PHY_ARDENNES_MMD_DEV_3_PHY_CFG, in lan88xx_config_init()
333 lan88xx_config_TR_regs(phydev); in lan88xx_config_init()
338 static int lan88xx_config_aneg(struct phy_device *phydev) in lan88xx_config_aneg() argument
340 lan88xx_set_mdix(phydev); in lan88xx_config_aneg()
342 return genphy_config_aneg(phydev); in lan88xx_config_aneg()
345 static void lan88xx_link_change_notify(struct phy_device *phydev) in lan88xx_link_change_notify() argument
354 if (!phydev->autoneg && phydev->speed == 100) { in lan88xx_link_change_notify()
356 temp = phy_read(phydev, LAN88XX_INT_MASK); in lan88xx_link_change_notify()
358 phy_write(phydev, LAN88XX_INT_MASK, temp); in lan88xx_link_change_notify()
360 temp = phy_read(phydev, MII_BMCR); in lan88xx_link_change_notify()
362 phy_write(phydev, MII_BMCR, temp); /* set to 10 first */ in lan88xx_link_change_notify()
364 phy_write(phydev, MII_BMCR, temp); /* set to 100 later */ in lan88xx_link_change_notify()
367 temp = phy_read(phydev, LAN88XX_INT_STS); in lan88xx_link_change_notify()
370 temp = phy_read(phydev, LAN88XX_INT_MASK); in lan88xx_link_change_notify()
372 phy_write(phydev, LAN88XX_INT_MASK, temp); in lan88xx_link_change_notify()