Lines Matching refs:phydev
79 int rt_phy_set_supported(struct rt_phy_device *phydev, rt_uint32_t max_speed) in rt_phy_set_supported() argument
81 phydev->supported &= RT_PHY_DEFAULT_FEATURES; in rt_phy_set_supported()
88 phydev->supported |= RT_PHY_1000BT_FEATURES; in rt_phy_set_supported()
90 phydev->supported |= RT_PHY_100BT_FEATURES; in rt_phy_set_supported()
92 phydev->supported |= RT_PHY_10BT_FEATURES; in rt_phy_set_supported()
98 int rt_phy_read(struct rt_phy_device *phydev, int devad, int regnum) in rt_phy_read() argument
100 struct mii_bus *bus = phydev->bus; in rt_phy_read()
101 if(phydev->is_c45) in rt_phy_read()
104 return bus->read_c45(bus, phydev->addr, devad, regnum); in rt_phy_read()
108 return bus->read(bus, phydev->addr, devad, regnum); in rt_phy_read()
114 int rt_phy_write(struct rt_phy_device *phydev, int devad, int regnum, rt_uint16_t val) in rt_phy_write() argument
116 struct mii_bus *bus = phydev->bus; in rt_phy_write()
117 if(phydev->is_c45) in rt_phy_write()
120 return bus->write_c45(bus, phydev->addr, devad, regnum, val); in rt_phy_write()
123 return bus->write(bus, phydev->addr, devad, regnum, val); in rt_phy_write()
129 int rt_phy_startup(struct rt_phy_device *phydev) in rt_phy_startup() argument
131 if(!phydev->drv) in rt_phy_startup()
137 if (phydev->drv->startup) in rt_phy_startup()
138 return phydev->drv->startup(phydev); in rt_phy_startup()
144 int rt_phy_config(struct rt_phy_device *phydev) in rt_phy_config() argument
146 if(!phydev->drv) in rt_phy_config()
152 if (phydev->drv->config) in rt_phy_config()
153 return phydev->drv->config(phydev); in rt_phy_config()
159 int rt_phy_shutdown(struct rt_phy_device *phydev) in rt_phy_shutdown() argument
161 if(!phydev->drv) in rt_phy_shutdown()
167 if (phydev->drv->shutdown) in rt_phy_shutdown()
168 phydev->drv->shutdown(phydev); in rt_phy_shutdown()
174 void rt_phy_mmd_start_indirect(struct rt_phy_device *phydev, int devad, int regnum) in rt_phy_mmd_start_indirect() argument
177 rt_phy_write(phydev, RT_MDIO_DEVAD_NONE, RT_MII_MMD_CTRL, devad); in rt_phy_mmd_start_indirect()
180 rt_phy_write(phydev, RT_MDIO_DEVAD_NONE, RT_MII_MMD_DATA, regnum); in rt_phy_mmd_start_indirect()
183 rt_phy_write(phydev, RT_MDIO_DEVAD_NONE, RT_MII_MMD_CTRL, in rt_phy_mmd_start_indirect()
187 int rt_phy_read_mmd(struct rt_phy_device *phydev, int devad, int regnum) in rt_phy_read_mmd() argument
189 struct rt_phy_driver *drv = phydev->drv; in rt_phy_read_mmd()
195 return drv->read_mmd(phydev, devad, regnum); in rt_phy_read_mmd()
199 return rt_phy_read(phydev, devad, regnum); in rt_phy_read_mmd()
201 rt_phy_mmd_start_indirect(phydev, devad, regnum); in rt_phy_read_mmd()
203 return rt_phy_read(phydev, RT_MDIO_DEVAD_NONE, RT_MII_MMD_DATA); in rt_phy_read_mmd()
206 int rt_phy_write_mmd(struct rt_phy_device *phydev, int devad, int regnum, rt_uint16_t val) in rt_phy_write_mmd() argument
208 struct rt_phy_driver *drv = phydev->drv; in rt_phy_write_mmd()
214 return drv->write_mmd(phydev, devad, regnum, val); in rt_phy_write_mmd()
218 return rt_phy_write(phydev, devad, regnum, val); in rt_phy_write_mmd()
220 rt_phy_mmd_start_indirect(phydev, devad, regnum); in rt_phy_write_mmd()
222 return rt_phy_write(phydev, RT_MDIO_DEVAD_NONE, RT_MII_MMD_DATA, val); in rt_phy_write_mmd()
225 int rt_phy_reset(struct rt_phy_device *phydev) in rt_phy_reset() argument
231 if (phydev->flags & RT_PHY_FLAG_BROKEN_RESET) in rt_phy_reset()
234 if (rt_phy_write(phydev, devad, RT_MII_BMCR, RT_BMCR_RESET) < 0) in rt_phy_reset()
240 reg = rt_phy_read(phydev, devad, RT_MII_BMCR); in rt_phy_reset()
243 reg = rt_phy_read(phydev, devad, RT_MII_BMCR); in rt_phy_reset()