Lines Matching refs:phydev

94 static int ip175c_config_init(struct phy_device *phydev)  in ip175c_config_init()  argument
102 err = mdiobus_write(phydev->mdio.bus, 30, 0, 0x175c); in ip175c_config_init()
107 err = mdiobus_read(phydev->mdio.bus, 30, 0); in ip175c_config_init()
113 err = mdiobus_write(phydev->mdio.bus, 29, 31, 0x175c); in ip175c_config_init()
118 err = mdiobus_write(phydev->mdio.bus, 29, 22, 0x420); in ip175c_config_init()
124 err = mdiobus_write(phydev->mdio.bus, i, in ip175c_config_init()
131 err = mdiobus_read(phydev->mdio.bus, i, MII_BMCR); in ip175c_config_init()
138 if (phydev->mdio.addr != 4) { in ip175c_config_init()
139 phydev->state = PHY_RUNNING; in ip175c_config_init()
140 phydev->speed = SPEED_100; in ip175c_config_init()
141 phydev->duplex = DUPLEX_FULL; in ip175c_config_init()
142 phydev->link = 1; in ip175c_config_init()
143 netif_carrier_on(phydev->attached_dev); in ip175c_config_init()
149 static int ip1001_config_init(struct phy_device *phydev) in ip1001_config_init() argument
154 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2); in ip1001_config_init()
158 c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c); in ip1001_config_init()
162 if (phy_interface_is_rgmii(phydev)) { in ip1001_config_init()
164 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); in ip1001_config_init()
170 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) in ip1001_config_init()
172 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in ip1001_config_init()
174 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in ip1001_config_init()
177 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); in ip1001_config_init()
185 static int ip175c_read_status(struct phy_device *phydev) in ip175c_read_status() argument
187 if (phydev->mdio.addr == 4) /* WAN port */ in ip175c_read_status()
188 genphy_read_status(phydev); in ip175c_read_status()
191 phydev->irq = PHY_MAC_INTERRUPT; in ip175c_read_status()
196 static int ip175c_config_aneg(struct phy_device *phydev) in ip175c_config_aneg() argument
198 if (phydev->mdio.addr == 4) /* WAN port */ in ip175c_config_aneg()
199 genphy_config_aneg(phydev); in ip175c_config_aneg()
204 static int ip101a_g_probe(struct phy_device *phydev) in ip101a_g_probe() argument
206 struct device *dev = &phydev->mdio.dev; in ip101a_g_probe()
230 phydev->priv = priv; in ip101a_g_probe()
235 static int ip101a_g_config_intr_pin(struct phy_device *phydev) in ip101a_g_config_intr_pin() argument
237 struct ip101a_g_phy_priv *priv = phydev->priv; in ip101a_g_config_intr_pin()
240 oldpage = phy_select_page(phydev, IP101G_DEFAULT_PAGE); in ip101a_g_config_intr_pin()
247 err = __phy_modify(phydev, IP101G_DIGITAL_IO_SPEC_CTRL, in ip101a_g_config_intr_pin()
254 err = __phy_modify(phydev, IP101G_DIGITAL_IO_SPEC_CTRL, in ip101a_g_config_intr_pin()
273 return phy_restore_page(phydev, oldpage, err); in ip101a_g_config_intr_pin()
276 static int ip101a_config_init(struct phy_device *phydev) in ip101a_config_init() argument
281 ret = phy_set_bits(phydev, IP10XX_SPEC_CTRL_STATUS, IP101A_G_APS_ON); in ip101a_config_init()
285 return ip101a_g_config_intr_pin(phydev); in ip101a_config_init()
288 static int ip101g_config_init(struct phy_device *phydev) in ip101g_config_init() argument
293 ret = phy_modify_paged(phydev, 1, IP101G_P1_CNT_CTRL, in ip101g_config_init()
299 ret = phy_modify_paged(phydev, 8, IP101G_P8_CNT_CTRL, in ip101g_config_init()
304 return ip101a_g_config_intr_pin(phydev); in ip101g_config_init()
307 static int ip101a_g_read_status(struct phy_device *phydev) in ip101a_g_read_status() argument
311 ret = genphy_read_status(phydev); in ip101a_g_read_status()
315 oldpage = phy_select_page(phydev, IP101G_DEFAULT_PAGE); in ip101a_g_read_status()
319 ret = __phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); in ip101a_g_read_status()
324 ret = __phy_read(phydev, IP101A_G_PHY_SPEC_CTRL); in ip101a_g_read_status()
331 phydev->mdix_ctrl = ETH_TP_MDI_X; in ip101a_g_read_status()
333 phydev->mdix_ctrl = ETH_TP_MDI; in ip101a_g_read_status()
335 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in ip101a_g_read_status()
339 phydev->mdix = ETH_TP_MDI_X; in ip101a_g_read_status()
341 phydev->mdix = ETH_TP_MDI; in ip101a_g_read_status()
346 return phy_restore_page(phydev, oldpage, ret); in ip101a_g_read_status()
349 static int ip101a_g_config_mdix(struct phy_device *phydev) in ip101a_g_config_mdix() argument
355 switch (phydev->mdix_ctrl) { in ip101a_g_config_mdix()
369 oldpage = phy_select_page(phydev, IP101G_DEFAULT_PAGE); in ip101a_g_config_mdix()
373 ret = __phy_modify(phydev, IP10XX_SPEC_CTRL_STATUS, in ip101a_g_config_mdix()
378 ret = __phy_modify(phydev, IP101A_G_PHY_SPEC_CTRL, in ip101a_g_config_mdix()
382 return phy_restore_page(phydev, oldpage, ret); in ip101a_g_config_mdix()
385 static int ip101a_g_config_aneg(struct phy_device *phydev) in ip101a_g_config_aneg() argument
389 ret = ip101a_g_config_mdix(phydev); in ip101a_g_config_aneg()
393 return genphy_config_aneg(phydev); in ip101a_g_config_aneg()
396 static int ip101a_g_ack_interrupt(struct phy_device *phydev) in ip101a_g_ack_interrupt() argument
400 err = phy_read_paged(phydev, IP101G_DEFAULT_PAGE, in ip101a_g_ack_interrupt()
408 static int ip101a_g_config_intr(struct phy_device *phydev) in ip101a_g_config_intr() argument
413 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in ip101a_g_config_intr()
414 err = ip101a_g_ack_interrupt(phydev); in ip101a_g_config_intr()
420 err = phy_write_paged(phydev, IP101G_DEFAULT_PAGE, in ip101a_g_config_intr()
424 err = phy_write_paged(phydev, IP101G_DEFAULT_PAGE, in ip101a_g_config_intr()
429 err = ip101a_g_ack_interrupt(phydev); in ip101a_g_config_intr()
435 static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev) in ip101a_g_handle_interrupt() argument
439 irq_status = phy_read_paged(phydev, IP101G_DEFAULT_PAGE, in ip101a_g_handle_interrupt()
442 phy_error(phydev); in ip101a_g_handle_interrupt()
451 phy_trigger_machine(phydev); in ip101a_g_handle_interrupt()
459 static int ip101a_read_page(struct phy_device *phydev) in ip101a_read_page() argument
464 static int ip101a_write_page(struct phy_device *phydev, int page) in ip101a_write_page() argument
471 static int ip101g_read_page(struct phy_device *phydev) in ip101g_read_page() argument
473 return __phy_read(phydev, IP101G_PAGE_CONTROL); in ip101g_read_page()
476 static int ip101g_write_page(struct phy_device *phydev, int page) in ip101g_write_page() argument
478 return __phy_write(phydev, IP101G_PAGE_CONTROL, page); in ip101g_write_page()
481 static int ip101a_g_has_page_register(struct phy_device *phydev) in ip101a_g_has_page_register() argument
485 oldval = phy_read(phydev, IP101G_PAGE_CONTROL); in ip101a_g_has_page_register()
489 ret = phy_write(phydev, IP101G_PAGE_CONTROL, 0xffff); in ip101a_g_has_page_register()
493 val = phy_read(phydev, IP101G_PAGE_CONTROL); in ip101a_g_has_page_register()
497 ret = phy_write(phydev, IP101G_PAGE_CONTROL, oldval); in ip101a_g_has_page_register()
504 static int ip101a_g_match_phy_device(struct phy_device *phydev, bool ip101a) in ip101a_g_match_phy_device() argument
508 if (phydev->phy_id != IP101A_PHY_ID) in ip101a_g_match_phy_device()
516 ret = ip101a_g_has_page_register(phydev); in ip101a_g_match_phy_device()
523 static int ip101a_match_phy_device(struct phy_device *phydev) in ip101a_match_phy_device() argument
525 return ip101a_g_match_phy_device(phydev, true); in ip101a_match_phy_device()
528 static int ip101g_match_phy_device(struct phy_device *phydev) in ip101g_match_phy_device() argument
530 return ip101a_g_match_phy_device(phydev, false); in ip101g_match_phy_device()
533 static int ip101g_get_sset_count(struct phy_device *phydev) in ip101g_get_sset_count() argument
538 static void ip101g_get_strings(struct phy_device *phydev, u8 *data) in ip101g_get_strings() argument
547 static u64 ip101g_get_stat(struct phy_device *phydev, int i) in ip101g_get_stat() argument
550 struct ip101a_g_phy_priv *priv = phydev->priv; in ip101g_get_stat()
554 val = phy_read_paged(phydev, stat.page, IP101G_CNT_REG); in ip101g_get_stat()
565 static void ip101g_get_stats(struct phy_device *phydev, in ip101g_get_stats() argument
571 data[i] = ip101g_get_stat(phydev, i); in ip101g_get_stats()