Commit c8fb89a7 authored by Sean Anderson's avatar Sean Anderson Committed by David S. Miller

net: phylink: Convert some users of mdiobus_* to mdiodev_*

This refactors the phylink pcs helper functions to use mdiobus_* instead
of mdiodev_*.
Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0ebecb26
...@@ -2542,12 +2542,10 @@ EXPORT_SYMBOL_GPL(phylink_decode_usxgmii_word); ...@@ -2542,12 +2542,10 @@ EXPORT_SYMBOL_GPL(phylink_decode_usxgmii_word);
void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs, void phylink_mii_c22_pcs_get_state(struct mdio_device *pcs,
struct phylink_link_state *state) struct phylink_link_state *state)
{ {
struct mii_bus *bus = pcs->bus;
int addr = pcs->addr;
int bmsr, lpa; int bmsr, lpa;
bmsr = mdiobus_read(bus, addr, MII_BMSR); bmsr = mdiodev_read(pcs, MII_BMSR);
lpa = mdiobus_read(bus, addr, MII_LPA); lpa = mdiodev_read(pcs, MII_LPA);
if (bmsr < 0 || lpa < 0) { if (bmsr < 0 || lpa < 0) {
state->link = false; state->link = false;
return; return;
...@@ -2603,8 +2601,6 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, ...@@ -2603,8 +2601,6 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
phy_interface_t interface, phy_interface_t interface,
const unsigned long *advertising) const unsigned long *advertising)
{ {
struct mii_bus *bus = pcs->bus;
int addr = pcs->addr;
u16 adv; u16 adv;
switch (interface) { switch (interface) {
...@@ -2618,12 +2614,10 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs, ...@@ -2618,12 +2614,10 @@ int phylink_mii_c22_pcs_set_advertisement(struct mdio_device *pcs,
advertising)) advertising))
adv |= ADVERTISE_1000XPSE_ASYM; adv |= ADVERTISE_1000XPSE_ASYM;
return mdiobus_modify_changed(bus, addr, MII_ADVERTISE, return mdiodev_modify_changed(pcs, MII_ADVERTISE, 0xffff, adv);
0xffff, adv);
case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_SGMII:
return mdiobus_modify_changed(bus, addr, MII_ADVERTISE, return mdiodev_modify_changed(pcs, MII_ADVERTISE, 0xffff, 0x0001);
0xffff, 0x0001);
default: default:
/* Nothing to do for other modes */ /* Nothing to do for other modes */
...@@ -2666,8 +2660,7 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode, ...@@ -2666,8 +2660,7 @@ int phylink_mii_c22_pcs_config(struct mdio_device *pcs, unsigned int mode,
else else
bmcr = 0; bmcr = 0;
ret = mdiobus_modify(pcs->bus, pcs->addr, MII_BMCR, ret = mdiodev_modify(pcs, MII_BMCR, BMCR_ANENABLE | BMCR_ISOLATE, bmcr);
BMCR_ANENABLE | BMCR_ISOLATE, bmcr);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2688,14 +2681,12 @@ EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_config); ...@@ -2688,14 +2681,12 @@ EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_config);
*/ */
void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs) void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs)
{ {
struct mii_bus *bus = pcs->bus; int val = mdiodev_read(pcs, MII_BMCR);
int val, addr = pcs->addr;
val = mdiobus_read(bus, addr, MII_BMCR);
if (val >= 0) { if (val >= 0) {
val |= BMCR_ANRESTART; val |= BMCR_ANRESTART;
mdiobus_write(bus, addr, MII_BMCR, val); mdiodev_write(pcs, MII_BMCR, val);
} }
} }
EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_an_restart); EXPORT_SYMBOL_GPL(phylink_mii_c22_pcs_an_restart);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment