Commit c6ab3008 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: phy: phylink: Provide PHY interface to mac_link_{up, down}

In preparation for having DSA transition entirely to PHYLINK, we need to pass a
PHY interface type to the mac_link_{up,down} callbacks because we may have to
make decisions on that (e.g: turn on/off RGMII interfaces etc.). We do not pass
an entire phylink_link_state because not all parameters (pause, duplex etc.) are
defined when the link is down, only link and interface are.

Update mvneta accordingly since it currently implements phylink_mac_ops.
Acked-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2166dc95
...@@ -3396,7 +3396,8 @@ static void mvneta_set_eee(struct mvneta_port *pp, bool enable) ...@@ -3396,7 +3396,8 @@ static void mvneta_set_eee(struct mvneta_port *pp, bool enable)
mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi_ctl1); mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi_ctl1);
} }
static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode) static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode,
phy_interface_t interface)
{ {
struct mvneta_port *pp = netdev_priv(ndev); struct mvneta_port *pp = netdev_priv(ndev);
u32 val; u32 val;
...@@ -3415,6 +3416,7 @@ static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode) ...@@ -3415,6 +3416,7 @@ static void mvneta_mac_link_down(struct net_device *ndev, unsigned int mode)
} }
static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode, static void mvneta_mac_link_up(struct net_device *ndev, unsigned int mode,
phy_interface_t interface,
struct phy_device *phy) struct phy_device *phy)
{ {
struct mvneta_port *pp = netdev_priv(ndev); struct mvneta_port *pp = netdev_priv(ndev);
......
...@@ -470,10 +470,12 @@ static void phylink_resolve(struct work_struct *w) ...@@ -470,10 +470,12 @@ static void phylink_resolve(struct work_struct *w)
if (link_state.link != netif_carrier_ok(ndev)) { if (link_state.link != netif_carrier_ok(ndev)) {
if (!link_state.link) { if (!link_state.link) {
netif_carrier_off(ndev); netif_carrier_off(ndev);
pl->ops->mac_link_down(ndev, pl->link_an_mode); pl->ops->mac_link_down(ndev, pl->link_an_mode,
pl->phy_state.interface);
netdev_info(ndev, "Link is Down\n"); netdev_info(ndev, "Link is Down\n");
} else { } else {
pl->ops->mac_link_up(ndev, pl->link_an_mode, pl->ops->mac_link_up(ndev, pl->link_an_mode,
pl->phy_state.interface,
pl->phydev); pl->phydev);
netif_carrier_on(ndev); netif_carrier_on(ndev);
......
...@@ -73,8 +73,10 @@ struct phylink_mac_ops { ...@@ -73,8 +73,10 @@ struct phylink_mac_ops {
void (*mac_config)(struct net_device *ndev, unsigned int mode, void (*mac_config)(struct net_device *ndev, unsigned int mode,
const struct phylink_link_state *state); const struct phylink_link_state *state);
void (*mac_an_restart)(struct net_device *ndev); void (*mac_an_restart)(struct net_device *ndev);
void (*mac_link_down)(struct net_device *ndev, unsigned int mode); void (*mac_link_down)(struct net_device *ndev, unsigned int mode,
phy_interface_t interface);
void (*mac_link_up)(struct net_device *ndev, unsigned int mode, void (*mac_link_up)(struct net_device *ndev, unsigned int mode,
phy_interface_t interface,
struct phy_device *phy); struct phy_device *phy);
}; };
...@@ -161,25 +163,31 @@ void mac_an_restart(struct net_device *ndev); ...@@ -161,25 +163,31 @@ void mac_an_restart(struct net_device *ndev);
* mac_link_down() - take the link down * mac_link_down() - take the link down
* @ndev: a pointer to a &struct net_device for the MAC. * @ndev: a pointer to a &struct net_device for the MAC.
* @mode: link autonegotiation mode * @mode: link autonegotiation mode
* @interface: link &typedef phy_interface_t mode
* *
* If @mode is not an in-band negotiation mode (as defined by * If @mode is not an in-band negotiation mode (as defined by
* phylink_autoneg_inband()), force the link down and disable any * phylink_autoneg_inband()), force the link down and disable any
* Energy Efficient Ethernet MAC configuration. * Energy Efficient Ethernet MAC configuration. Interface type
* selection must be done in mac_config().
*/ */
void mac_link_down(struct net_device *ndev, unsigned int mode); void mac_link_down(struct net_device *ndev, unsigned int mode,
phy_interface_t interface);
/** /**
* mac_link_up() - allow the link to come up * mac_link_up() - allow the link to come up
* @ndev: a pointer to a &struct net_device for the MAC. * @ndev: a pointer to a &struct net_device for the MAC.
* @mode: link autonegotiation mode * @mode: link autonegotiation mode
* @interface: link &typedef phy_interface_t mode
* @phy: any attached phy * @phy: any attached phy
* *
* If @mode is not an in-band negotiation mode (as defined by * If @mode is not an in-band negotiation mode (as defined by
* phylink_autoneg_inband()), allow the link to come up. If @phy * phylink_autoneg_inband()), allow the link to come up. If @phy
* is non-%NULL, configure Energy Efficient Ethernet by calling * is non-%NULL, configure Energy Efficient Ethernet by calling
* phy_init_eee() and perform appropriate MAC configuration for EEE. * phy_init_eee() and perform appropriate MAC configuration for EEE.
* Interface type selection must be done in mac_config().
*/ */
void mac_link_up(struct net_device *ndev, unsigned int mode, void mac_link_up(struct net_device *ndev, unsigned int mode,
phy_interface_t interface,
struct phy_device *phy); struct phy_device *phy);
#endif #endif
......
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