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()
52 static int lan88xx_phy_ack_interrupt(struct phy_device *phydev) in lan88xx_phy_ack_interrupt() argument
54 int rc = phy_read(phydev, LAN88XX_INT_STS); in lan88xx_phy_ack_interrupt()
59 static int lan88xx_suspend(struct phy_device *phydev) in lan88xx_suspend() argument
61 struct lan88xx_priv *priv = phydev->priv; in lan88xx_suspend()
65 genphy_suspend(phydev); in lan88xx_suspend()
70 static int lan88xx_TR_reg_set(struct phy_device *phydev, u16 regaddr, in lan88xx_TR_reg_set() argument
77 save_page = phy_save_page(phydev); in lan88xx_TR_reg_set()
79 phydev_warn(phydev, "Failed to get current page\n"); in lan88xx_TR_reg_set()
84 lan88xx_write_page(phydev, LAN88XX_EXT_PAGE_ACCESS_TR); in lan88xx_TR_reg_set()
86 ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_LOW_DATA, in lan88xx_TR_reg_set()
89 phydev_warn(phydev, "Failed to write TR low data\n"); in lan88xx_TR_reg_set()
93 ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_HIGH_DATA, in lan88xx_TR_reg_set()
96 phydev_warn(phydev, "Failed to write TR high data\n"); in lan88xx_TR_reg_set()
104 ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_CR, buf); in lan88xx_TR_reg_set()
106 phydev_warn(phydev, "Failed to write data in reg\n"); in lan88xx_TR_reg_set()
111 val = __phy_read(phydev, LAN88XX_EXT_PAGE_TR_CR); in lan88xx_TR_reg_set()
113 phydev_warn(phydev, "TR Register[0x%X] configuration failed\n", in lan88xx_TR_reg_set()
116 return phy_restore_page(phydev, save_page, ret); in lan88xx_TR_reg_set()
119 static void lan88xx_config_TR_regs(struct phy_device *phydev) in lan88xx_config_TR_regs() argument
127 err = lan88xx_TR_reg_set(phydev, 0x0F82, 0x12B00A); in lan88xx_config_TR_regs()
129 phydev_warn(phydev, "Failed to Set Register[0x0F82]\n"); in lan88xx_config_TR_regs()
135 err = lan88xx_TR_reg_set(phydev, 0x168C, 0xD2C46F); in lan88xx_config_TR_regs()
137 phydev_warn(phydev, "Failed to Set Register[0x168C]\n"); in lan88xx_config_TR_regs()
143 err = lan88xx_TR_reg_set(phydev, 0x17A2, 0x620); in lan88xx_config_TR_regs()
145 phydev_warn(phydev, "Failed to Set Register[0x17A2]\n"); in lan88xx_config_TR_regs()
152 err = lan88xx_TR_reg_set(phydev, 0x16A0, 0xEEFFDD); in lan88xx_config_TR_regs()
154 phydev_warn(phydev, "Failed to Set Register[0x16A0]\n"); in lan88xx_config_TR_regs()
160 err = lan88xx_TR_reg_set(phydev, 0x16A6, 0x071448); in lan88xx_config_TR_regs()
162 phydev_warn(phydev, "Failed to Set Register[0x16A6]\n"); in lan88xx_config_TR_regs()
168 err = lan88xx_TR_reg_set(phydev, 0x16A4, 0x13132F); in lan88xx_config_TR_regs()
170 phydev_warn(phydev, "Failed to Set Register[0x16A4]\n"); in lan88xx_config_TR_regs()
176 err = lan88xx_TR_reg_set(phydev, 0x16A8, 0x0); in lan88xx_config_TR_regs()
178 phydev_warn(phydev, "Failed to Set Register[0x16A8]\n"); in lan88xx_config_TR_regs()
185 err = lan88xx_TR_reg_set(phydev, 0x0FE8, 0x91B06C); in lan88xx_config_TR_regs()
187 phydev_warn(phydev, "Failed to Set Register[0x0FE8]\n"); in lan88xx_config_TR_regs()
194 err = lan88xx_TR_reg_set(phydev, 0x0FFC, 0xC0A028); in lan88xx_config_TR_regs()
196 phydev_warn(phydev, "Failed to Set Register[0x0FFC]\n"); in lan88xx_config_TR_regs()
203 err = lan88xx_TR_reg_set(phydev, 0x0FEA, 0x041600); in lan88xx_config_TR_regs()
205 phydev_warn(phydev, "Failed to Set Register[0x0FEA]\n"); in lan88xx_config_TR_regs()
210 err = lan88xx_TR_reg_set(phydev, 0x1686, 0x000004); in lan88xx_config_TR_regs()
212 phydev_warn(phydev, "Failed to Set Register[0x1686]\n"); in lan88xx_config_TR_regs()
215 static int lan88xx_probe(struct phy_device *phydev) in lan88xx_probe() argument
217 struct device *dev = &phydev->mdio.dev; in lan88xx_probe()
244 (void)phy_write(phydev, LAN78XX_PHY_LED_MODE_SELECT, reg); in lan88xx_probe()
250 priv->chip_id = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_ID); in lan88xx_probe()
251 priv->chip_rev = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_REV); in lan88xx_probe()
253 phydev->priv = priv; in lan88xx_probe()
258 static void lan88xx_remove(struct phy_device *phydev) in lan88xx_remove() argument
260 struct device *dev = &phydev->mdio.dev; in lan88xx_remove()
261 struct lan88xx_priv *priv = phydev->priv; in lan88xx_remove()
267 static int lan88xx_set_wol(struct phy_device *phydev, in lan88xx_set_wol() argument
270 struct lan88xx_priv *priv = phydev->priv; in lan88xx_set_wol()
277 static void lan88xx_set_mdix(struct phy_device *phydev) in lan88xx_set_mdix() argument
282 switch (phydev->mdix_ctrl) { in lan88xx_set_mdix()
296 phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, LAN88XX_EXT_PAGE_SPACE_1); in lan88xx_set_mdix()
297 buf = phy_read(phydev, LAN88XX_EXT_MODE_CTRL); in lan88xx_set_mdix()
300 phy_write(phydev, LAN88XX_EXT_MODE_CTRL, buf); in lan88xx_set_mdix()
301 phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, LAN88XX_EXT_PAGE_SPACE_0); in lan88xx_set_mdix()
304 static int lan88xx_config_init(struct phy_device *phydev) in lan88xx_config_init() argument
309 val = phy_read_mmd(phydev, MDIO_MMD_PCS, in lan88xx_config_init()
313 phy_write_mmd(phydev, MDIO_MMD_PCS, PHY_ARDENNES_MMD_DEV_3_PHY_CFG, in lan88xx_config_init()
317 lan88xx_config_TR_regs(phydev); in lan88xx_config_init()
322 static int lan88xx_config_aneg(struct phy_device *phydev) in lan88xx_config_aneg() argument
324 lan88xx_set_mdix(phydev); in lan88xx_config_aneg()
326 return genphy_config_aneg(phydev); in lan88xx_config_aneg()