]> www.infradead.org Git - users/willy/linux.git/commitdiff
net: dsa: microchip: split adjust_link() in phylink_mac_link_{up|down}()
authorCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
Thu, 2 Jul 2020 15:17:23 +0000 (18:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 5 Jul 2020 00:59:08 +0000 (17:59 -0700)
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>
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_common.h

index 47d65b77caf77415b730f0ce3ca3b62332e0b2e0..862306a9db2cafa48bb2bc73b8305c47c56e9bad 100644 (file)
@@ -1111,7 +1111,8 @@ static const struct dsa_switch_ops ksz8795_switch_ops = {
        .setup                  = ksz8795_setup,
        .phy_read               = ksz_phy_read16,
        .phy_write              = ksz_phy_write16,
-       .adjust_link            = ksz_adjust_link,
+       .phylink_mac_link_down  = ksz_mac_link_down,
+       .phylink_mac_link_up    = ksz_mac_link_up,
        .port_enable            = ksz_enable_port,
        .port_disable           = ksz_disable_port,
        .get_strings            = ksz8795_get_strings,
index 9a51b8a4de5d1432a58537dcda4654932e7cc2dc..9e4bdd950194114650a5529965c1b3dc11996f51 100644 (file)
@@ -1399,7 +1399,8 @@ static const struct dsa_switch_ops ksz9477_switch_ops = {
        .setup                  = ksz9477_setup,
        .phy_read               = ksz9477_phy_read16,
        .phy_write              = ksz9477_phy_write16,
-       .adjust_link            = ksz_adjust_link,
+       .phylink_mac_link_down  = ksz_mac_link_down,
+       .phylink_mac_link_up    = ksz_mac_link_up,
        .port_enable            = ksz_enable_port,
        .port_disable           = ksz_disable_port,
        .get_strings            = ksz9477_get_strings,
index fd1d6676ae4fdaced0ec3989ae381ab06983e8e1..55ceaf00ece17925ab1bb5faf31f2203b21a13c2 100644 (file)
@@ -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)
 {
index f2c9bb68fd3306669ee79a9f4f4ce1dc9f15ffb4..c0224dd0cf8a56206ae89913c4300f0991c9d82c 100644 (file)
@@ -159,8 +159,11 @@ void ksz_init_mib_timer(struct ksz_device *dev);
 
 int ksz_phy_read16(struct dsa_switch *ds, int addr, int reg);
 int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val);
-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);
+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);
 int ksz_sset_count(struct dsa_switch *ds, int port, int sset);
 void ksz_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *buf);
 int ksz_port_bridge_join(struct dsa_switch *ds, int port,