summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/microchip/ksz_common.c
diff options
context:
space:
mode:
authorCodrin Ciubotariu <codrin.ciubotariu@microchip.com>2020-07-02 18:17:23 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-04 17:59:08 -0700
commit143a102e3090532a624d25429b79284caa59ce9f (patch)
tree66c2d6033f09b30e7fafc1e61cdcee1bbc8af5e0 /drivers/net/dsa/microchip/ksz_common.c
parentbdd2ed272151d89f8dc81a5a4046e3f8273b970d (diff)
downloadlinux-143a102e3090532a624d25429b79284caa59ce9f.tar.bz2
net: dsa: microchip: split adjust_link() in phylink_mac_link_{up|down}()
The DSA subsystem moved to phylink and adjust_link() became deprecated in the process. This patch removes adjust_link from the KSZ DSA switches and adds phylink_mac_link_up() and phylink_mac_link_down(). Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com> Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/microchip/ksz_common.c')
-rw-r--r--drivers/net/dsa/microchip/ksz_common.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index fd1d6676ae4f..55ceaf00ece1 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -135,26 +135,34 @@ int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)
}
EXPORT_SYMBOL_GPL(ksz_phy_write16);
-void ksz_adjust_link(struct dsa_switch *ds, int port,
- struct phy_device *phydev)
+void ksz_mac_link_down(struct dsa_switch *ds, int port, unsigned int mode,
+ phy_interface_t interface)
{
struct ksz_device *dev = ds->priv;
struct ksz_port *p = &dev->ports[port];
/* Read all MIB counters when the link is going down. */
- if (!phydev->link) {
- p->read = true;
- schedule_delayed_work(&dev->mib_read, 0);
- }
+ p->read = true;
+ schedule_delayed_work(&dev->mib_read, 0);
+
+ mutex_lock(&dev->dev_mutex);
+ dev->live_ports &= ~(1 << port);
+ mutex_unlock(&dev->dev_mutex);
+}
+EXPORT_SYMBOL_GPL(ksz_mac_link_down);
+
+void ksz_mac_link_up(struct dsa_switch *ds, int port, unsigned int mode,
+ phy_interface_t interface, struct phy_device *phydev,
+ int speed, int duplex, bool tx_pause, bool rx_pause)
+{
+ struct ksz_device *dev = ds->priv;
+
+ /* Remember which port is connected and active. */
mutex_lock(&dev->dev_mutex);
- if (!phydev->link)
- dev->live_ports &= ~(1 << port);
- else
- /* Remember which port is connected and active. */
- dev->live_ports |= (1 << port) & dev->on_ports;
+ dev->live_ports |= (1 << port) & dev->on_ports;
mutex_unlock(&dev->dev_mutex);
}
-EXPORT_SYMBOL_GPL(ksz_adjust_link);
+EXPORT_SYMBOL_GPL(ksz_mac_link_up);
int ksz_sset_count(struct dsa_switch *ds, int port, int sset)
{