Lines Matching refs:phydev
83 static int vsc824x_add_skew(struct phy_device *phydev) in vsc824x_add_skew() argument
88 extcon = phy_read(phydev, MII_VSC8244_EXT_CON1); in vsc824x_add_skew()
99 err = phy_write(phydev, MII_VSC8244_EXT_CON1, extcon); in vsc824x_add_skew()
104 static int vsc824x_config_init(struct phy_device *phydev) in vsc824x_config_init() argument
108 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, in vsc824x_config_init()
113 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc824x_config_init()
114 err = vsc824x_add_skew(phydev); in vsc824x_config_init()
121 static int vsc73xx_read_page(struct phy_device *phydev) in vsc73xx_read_page() argument
123 return __phy_read(phydev, VSC73XX_EXT_PAGE_ACCESS); in vsc73xx_read_page()
126 static int vsc73xx_write_page(struct phy_device *phydev, int page) in vsc73xx_write_page() argument
128 return __phy_write(phydev, VSC73XX_EXT_PAGE_ACCESS, page); in vsc73xx_write_page()
131 static void vsc73xx_config_init(struct phy_device *phydev) in vsc73xx_config_init() argument
134 phy_write(phydev, 0x1f, 0x2a30); in vsc73xx_config_init()
135 phy_modify(phydev, 0x0c, 0x0300, 0x0200); in vsc73xx_config_init()
136 phy_write(phydev, 0x1f, 0x0000); in vsc73xx_config_init()
139 phy_modify(phydev, MII_TPISTATUS, 0xff00, 0x0061); in vsc73xx_config_init()
142 static int vsc738x_config_init(struct phy_device *phydev) in vsc738x_config_init() argument
150 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
151 phy_modify(phydev, 0x08, 0x0200, 0x0200); in vsc738x_config_init()
152 phy_write(phydev, 0x1f, 0x52b5); in vsc738x_config_init()
153 phy_write(phydev, 0x10, 0xb68a); in vsc738x_config_init()
154 phy_modify(phydev, 0x12, 0xff07, 0x0003); in vsc738x_config_init()
155 phy_modify(phydev, 0x11, 0x00ff, 0x00a2); in vsc738x_config_init()
156 phy_write(phydev, 0x10, 0x968a); in vsc738x_config_init()
157 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
158 phy_modify(phydev, 0x08, 0x0200, 0x0000); in vsc738x_config_init()
159 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
162 rev = phy_read(phydev, MII_PHYSID2); in vsc738x_config_init()
167 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
168 phy_modify(phydev, 0x08, 0x0200, 0x0200); in vsc738x_config_init()
169 phy_write(phydev, 0x1f, 0x52b5); in vsc738x_config_init()
170 phy_write(phydev, 0x12, 0x0000); in vsc738x_config_init()
171 phy_write(phydev, 0x11, 0x0689); in vsc738x_config_init()
172 phy_write(phydev, 0x10, 0x8f92); in vsc738x_config_init()
173 phy_write(phydev, 0x1f, 0x52b5); in vsc738x_config_init()
174 phy_write(phydev, 0x12, 0x0000); in vsc738x_config_init()
175 phy_write(phydev, 0x11, 0x0e35); in vsc738x_config_init()
176 phy_write(phydev, 0x10, 0x9786); in vsc738x_config_init()
177 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
178 phy_modify(phydev, 0x08, 0x0200, 0x0000); in vsc738x_config_init()
179 phy_write(phydev, 0x17, 0xff80); in vsc738x_config_init()
180 phy_write(phydev, 0x17, 0x0000); in vsc738x_config_init()
183 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
184 phy_write(phydev, 0x12, 0x0048); in vsc738x_config_init()
187 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
188 phy_write(phydev, 0x14, 0x6600); in vsc738x_config_init()
189 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
190 phy_write(phydev, 0x18, 0xa24e); in vsc738x_config_init()
192 phy_write(phydev, 0x1f, 0x2a30); in vsc738x_config_init()
193 phy_modify(phydev, 0x16, 0x0fc0, 0x0240); in vsc738x_config_init()
194 phy_modify(phydev, 0x14, 0x6000, 0x4000); in vsc738x_config_init()
198 phy_write(phydev, 0x1f, 0x0001); in vsc738x_config_init()
199 phy_modify(phydev, 0x14, 0xe000, 0x6000); in vsc738x_config_init()
200 phy_write(phydev, 0x1f, 0x0000); in vsc738x_config_init()
203 vsc73xx_config_init(phydev); in vsc738x_config_init()
208 static int vsc739x_config_init(struct phy_device *phydev) in vsc739x_config_init() argument
215 phy_write(phydev, 0x1f, 0x2a30); in vsc739x_config_init()
216 phy_modify(phydev, 0x08, 0x0200, 0x0200); in vsc739x_config_init()
217 phy_write(phydev, 0x1f, 0x52b5); in vsc739x_config_init()
218 phy_write(phydev, 0x10, 0xb68a); in vsc739x_config_init()
219 phy_modify(phydev, 0x12, 0xff07, 0x0003); in vsc739x_config_init()
220 phy_modify(phydev, 0x11, 0x00ff, 0x00a2); in vsc739x_config_init()
221 phy_write(phydev, 0x10, 0x968a); in vsc739x_config_init()
222 phy_write(phydev, 0x1f, 0x2a30); in vsc739x_config_init()
223 phy_modify(phydev, 0x08, 0x0200, 0x0000); in vsc739x_config_init()
224 phy_write(phydev, 0x1f, 0x0000); in vsc739x_config_init()
226 phy_write(phydev, 0x1f, 0x0000); in vsc739x_config_init()
227 phy_write(phydev, 0x12, 0x0048); in vsc739x_config_init()
228 phy_write(phydev, 0x1f, 0x2a30); in vsc739x_config_init()
229 phy_modify(phydev, 0x16, 0x0fc0, 0x0240); in vsc739x_config_init()
230 phy_modify(phydev, 0x14, 0x6000, 0x4000); in vsc739x_config_init()
231 phy_write(phydev, 0x1f, 0x0001); in vsc739x_config_init()
232 phy_modify(phydev, 0x14, 0xe000, 0x6000); in vsc739x_config_init()
233 phy_write(phydev, 0x1f, 0x0000); in vsc739x_config_init()
235 vsc73xx_config_init(phydev); in vsc739x_config_init()
240 static int vsc73xx_config_aneg(struct phy_device *phydev) in vsc73xx_config_aneg() argument
254 static int vsc8601_add_skew(struct phy_device *phydev) in vsc8601_add_skew() argument
258 ret = phy_read(phydev, MII_VSC8601_EPHY_CTL); in vsc8601_add_skew()
263 return phy_write(phydev, MII_VSC8601_EPHY_CTL, ret); in vsc8601_add_skew()
266 static int vsc8601_config_init(struct phy_device *phydev) in vsc8601_config_init() argument
270 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in vsc8601_config_init()
271 ret = vsc8601_add_skew(phydev); in vsc8601_config_init()
279 static int vsc82xx_config_intr(struct phy_device *phydev) in vsc82xx_config_intr() argument
283 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in vsc82xx_config_intr()
287 err = phy_write(phydev, MII_VSC8244_IMASK, in vsc82xx_config_intr()
288 (phydev->drv->phy_id == PHY_ID_VSC8234 || in vsc82xx_config_intr()
289 phydev->drv->phy_id == PHY_ID_VSC8244 || in vsc82xx_config_intr()
290 phydev->drv->phy_id == PHY_ID_VSC8572 || in vsc82xx_config_intr()
291 phydev->drv->phy_id == PHY_ID_VSC8601) ? in vsc82xx_config_intr()
298 err = phy_read(phydev, MII_VSC8244_ISTAT); in vsc82xx_config_intr()
303 err = phy_write(phydev, MII_VSC8244_IMASK, 0); in vsc82xx_config_intr()
309 static irqreturn_t vsc82xx_handle_interrupt(struct phy_device *phydev) in vsc82xx_handle_interrupt() argument
313 if (phydev->drv->phy_id == PHY_ID_VSC8244 || in vsc82xx_handle_interrupt()
314 phydev->drv->phy_id == PHY_ID_VSC8572 || in vsc82xx_handle_interrupt()
315 phydev->drv->phy_id == PHY_ID_VSC8601) in vsc82xx_handle_interrupt()
320 irq_status = phy_read(phydev, MII_VSC8244_ISTAT); in vsc82xx_handle_interrupt()
322 phy_error(phydev); in vsc82xx_handle_interrupt()
329 phy_trigger_machine(phydev); in vsc82xx_handle_interrupt()
334 static int vsc8221_config_init(struct phy_device *phydev) in vsc8221_config_init() argument
338 err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, in vsc8221_config_init()
353 static int vsc82x4_config_autocross_enable(struct phy_device *phydev) in vsc82x4_config_autocross_enable() argument
357 if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed > SPEED_100) in vsc82x4_config_autocross_enable()
361 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x52b5); in vsc82x4_config_autocross_enable()
363 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_18E, 0x0012); in vsc82x4_config_autocross_enable()
365 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_17E, 0x2803); in vsc82x4_config_autocross_enable()
367 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_16E, 0x87fa); in vsc82x4_config_autocross_enable()
370 ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000); in vsc82x4_config_autocross_enable()
372 phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000); in vsc82x4_config_autocross_enable()
385 static int vsc82x4_config_aneg(struct phy_device *phydev) in vsc82x4_config_aneg() argument
392 if (phydev->autoneg != AUTONEG_ENABLE && phydev->speed <= SPEED_100) { in vsc82x4_config_aneg()
393 ret = genphy_setup_forced(phydev); in vsc82x4_config_aneg()
398 return vsc82x4_config_autocross_enable(phydev); in vsc82x4_config_aneg()
401 return genphy_config_aneg(phydev); in vsc82x4_config_aneg()