Lines Matching defs:phydev

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