Lines Matching full:mdio

3  * mdio.c: Generic support for MDIO-compatible transceivers
11 #include <linux/mdio.h>
14 MODULE_DESCRIPTION("Generic support for MDIO-compatible transceivers");
19 * mdio45_probe - probe for an MDIO (clause 45) device
20 * @mdio: MDIO interface
23 * This sets @prtad and @mmds in the MDIO interface if successful.
26 int mdio45_probe(struct mdio_if_info *mdio, int prtad) in mdio45_probe() argument
34 stat2 = mdio->mdio_read(mdio->dev, prtad, mmd, MDIO_STAT2); in mdio45_probe()
40 devs1 = mdio->mdio_read(mdio->dev, prtad, mmd, MDIO_DEVS1); in mdio45_probe()
41 devs2 = mdio->mdio_read(mdio->dev, prtad, mmd, MDIO_DEVS2); in mdio45_probe()
45 mdio->prtad = prtad; in mdio45_probe()
46 mdio->mmds = devs1 | (devs2 << 16); in mdio45_probe()
55 * mdio_set_flag - set or clear flag in an MDIO register
56 * @mdio: MDIO interface
66 int mdio_set_flag(const struct mdio_if_info *mdio, in mdio_set_flag() argument
70 int old_val = mdio->mdio_read(mdio->dev, prtad, devad, addr); in mdio_set_flag()
81 return mdio->mdio_write(mdio->dev, prtad, devad, addr, new_val); in mdio_set_flag()
87 * @mdio: MDIO interface
91 * @mmd_mask is normally @mdio->mmds, but if loopback is enabled
94 int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmd_mask) in mdio45_links_ok() argument
100 reg = mdio->mdio_read(mdio->dev, mdio->prtad, in mdio45_links_ok()
110 mdio->mdio_read(mdio->dev, mdio->prtad, in mdio45_links_ok()
114 mdio->mdio_read(mdio->dev, mdio->prtad, in mdio45_links_ok()
118 reg = mdio->mdio_read(mdio->dev, mdio->prtad, in mdio45_links_ok()
133 * @mdio: MDIO interface
137 int mdio45_nway_restart(const struct mdio_if_info *mdio) in mdio45_nway_restart() argument
139 if (!(mdio->mmds & MDIO_DEVS_AN)) in mdio45_nway_restart()
142 mdio_set_flag(mdio, mdio->prtad, MDIO_MMD_AN, MDIO_CTRL1, in mdio45_nway_restart()
148 static u32 mdio45_get_an(const struct mdio_if_info *mdio, u16 addr) in mdio45_get_an() argument
153 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_AN, addr); in mdio45_get_an()
171 * @mdio: MDIO interface
183 void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, in mdio45_ethtool_gset_npage() argument
194 ecmd->phy_address = mdio->prtad; in mdio45_ethtool_gset_npage()
196 mdio->mode_support & (MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22); in mdio45_ethtool_gset_npage()
198 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_gset_npage()
207 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_gset_npage()
234 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_gset_npage()
242 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_gset_npage()
257 if (mdio->mmds & MDIO_DEVS_AN) { in mdio45_ethtool_gset_npage()
259 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_AN, in mdio45_ethtool_gset_npage()
265 mdio45_get_an(mdio, MDIO_AN_ADVERTISE) | in mdio45_ethtool_gset_npage()
276 int an_stat = mdio->mdio_read(mdio->dev, mdio->prtad, in mdio45_ethtool_gset_npage()
283 mdio45_get_an(mdio, MDIO_AN_LPA) | npage_lpa; in mdio45_ethtool_gset_npage()
311 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_gset_npage()
324 switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_gset_npage()
343 * @mdio: MDIO interface
355 void mdio45_ethtool_ksettings_get_npage(const struct mdio_if_info *mdio, in mdio45_ethtool_ksettings_get_npage() argument
365 cmd->base.phy_address = mdio->prtad; in mdio45_ethtool_ksettings_get_npage()
367 mdio->mode_support & (MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22); in mdio45_ethtool_ksettings_get_npage()
369 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_ksettings_get_npage()
378 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_ksettings_get_npage()
405 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_ksettings_get_npage()
413 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_ksettings_get_npage()
428 if (mdio->mmds & MDIO_DEVS_AN) { in mdio45_ethtool_ksettings_get_npage()
430 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_AN, in mdio45_ethtool_ksettings_get_npage()
436 mdio45_get_an(mdio, MDIO_AN_ADVERTISE) | in mdio45_ethtool_ksettings_get_npage()
447 int an_stat = mdio->mdio_read(mdio->dev, mdio->prtad, in mdio45_ethtool_ksettings_get_npage()
455 mdio45_get_an(mdio, MDIO_AN_LPA) | npage_lpa; in mdio45_ethtool_ksettings_get_npage()
483 reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_ksettings_get_npage()
502 switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, in mdio45_ethtool_ksettings_get_npage()
520 * mdio_mii_ioctl - MII ioctl interface for MDIO (clause 22 or 45) PHYs
521 * @mdio: MDIO interface
527 int mdio_mii_ioctl(const struct mdio_if_info *mdio, in mdio_mii_ioctl() argument
536 if (mdio->prtad == MDIO_PRTAD_NONE) in mdio_mii_ioctl()
538 mii_data->phy_id = mdio->prtad; in mdio_mii_ioctl()
549 if ((mdio->mode_support & MDIO_SUPPORTS_C45) && in mdio_mii_ioctl()
553 } else if ((mdio->mode_support & MDIO_SUPPORTS_C22) && in mdio_mii_ioctl()
558 } else if ((mdio->mode_support & MDIO_EMULATE_C22) && in mdio_mii_ioctl()
559 mdio->prtad != MDIO_PRTAD_NONE && in mdio_mii_ioctl()
560 mii_data->phy_id == mdio->prtad) { in mdio_mii_ioctl()
562 prtad = mdio->prtad; in mdio_mii_ioctl()
568 devad = __ffs(mdio->mmds); in mdio_mii_ioctl()
572 if (!(mdio->mmds & MDIO_DEVS_AN)) in mdio_mii_ioctl()
588 int rc = mdio->mdio_read(mdio->dev, prtad, devad, addr); in mdio_mii_ioctl()
594 return mdio->mdio_write(mdio->dev, prtad, devad, addr, in mdio_mii_ioctl()