]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: dsa: Move mv88e6172 support into mv88e6352 family driver
authorAndrew Lunn <andrew@lunn.ch>
Tue, 5 May 2015 23:09:50 +0000 (01:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 May 2015 20:05:53 +0000 (16:05 -0400)
The mv88e6172 is part of the mv88e6352 family of devices. Move support
for it out of the mv88e6171 driver into the mv88e6352, which results
in some simplifications to the code.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/Kconfig
drivers/net/dsa/mv88e6171.c
drivers/net/dsa/mv88e6352.c

index 18550c7ebe6f1beb225ba9c56717d14aacf45896..d96f2e24e6a99f653fdc5349a46518ba98bfea53 100644 (file)
@@ -37,22 +37,22 @@ config NET_DSA_MV88E6123_61_65
          ethernet switch chips.
 
 config NET_DSA_MV88E6171
-       tristate "Marvell 88E6171/6172 ethernet switch chip support"
+       tristate "Marvell 88E6171 ethernet switch chip support"
        depends on NET_DSA
        select NET_DSA_MV88E6XXX
        select NET_DSA_TAG_EDSA
        ---help---
-         This enables support for the Marvell 88E6171/6172 ethernet switch
+         This enables support for the Marvell 88E6171 ethernet switch
          chips.
 
 config NET_DSA_MV88E6352
-       tristate "Marvell 88E6176/88E6352 ethernet switch chip support"
+       tristate "Marvell 88E6172/88E6176/88E6352 ethernet switch chip support"
        depends on NET_DSA
        select NET_DSA_MV88E6XXX
        select NET_DSA_TAG_EDSA
        ---help---
-         This enables support for the Marvell 88E6176 and 88E6352 ethernet
-         switch chips.
+         This enables support for the Marvell 88E6172, 88E6176 and 88E6352
+         ethernet switch chips.
 
 config NET_DSA_BCM_SF2
        tristate "Broadcom Starfighter 2 Ethernet switch support"
index 56fad84aded64bf8d0a5a1f7ce03646ac47e42fb..132783cc8aea2cafd71c3fa0d9d428819e1ef22f 100644 (file)
@@ -1,4 +1,4 @@
-/* net/dsa/mv88e6171.c - Marvell 88e6171/8826172 switch chip support
+/* net/dsa/mv88e6171.c - Marvell 88e6171 switch chip support
  * Copyright (c) 2008-2009 Marvell Semiconductor
  * Copyright (c) 2014 Claudio Leite <leitec@staticky.com>
  *
@@ -29,8 +29,6 @@ static char *mv88e6171_probe(struct device *host_dev, int sw_addr)
        if (ret >= 0) {
                if ((ret & 0xfff0) == PORT_SWITCH_ID_6171)
                        return "Marvell 88E6171";
-               if ((ret & 0xfff0) == PORT_SWITCH_ID_6172)
-                       return "Marvell 88E6172";
        }
 
        return NULL;
@@ -40,6 +38,7 @@ static int mv88e6171_setup_global(struct dsa_switch *ds)
 {
        u32 upstream_port = dsa_upstream_port(ds);
        int ret;
+       u32 reg;
 
        ret = mv88e6xxx_setup_global(ds);
        if (ret)
@@ -55,24 +54,11 @@ static int mv88e6171_setup_global(struct dsa_switch *ds)
         * port as the port to which ingress and egress monitor frames
         * are to be sent.
         */
-       if (REG_READ(REG_PORT(0), PORT_SWITCH_ID) == PORT_SWITCH_ID_6171)
-               REG_WRITE(REG_GLOBAL, GLOBAL_MONITOR_CONTROL,
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT |
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT |
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_ARP_SHIFT |
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_MIRROR_SHIFT);
-       else
-               REG_WRITE(REG_GLOBAL, GLOBAL_MONITOR_CONTROL,
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT |
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT |
-                         upstream_port <<
-                         GLOBAL_MONITOR_CONTROL_ARP_SHIFT);
+       reg = upstream_port << GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT |
+               upstream_port << GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT |
+               upstream_port << GLOBAL_MONITOR_CONTROL_ARP_SHIFT |
+               upstream_port << GLOBAL_MONITOR_CONTROL_MIRROR_SHIFT;
+       REG_WRITE(REG_GLOBAL, GLOBAL_MONITOR_CONTROL, reg);
 
        /* Disable remote management for now, and set the switch's
         * DSA device number.
@@ -104,28 +90,6 @@ static int mv88e6171_setup(struct dsa_switch *ds)
        return mv88e6xxx_setup_ports(ds);
 }
 
-static int mv88e6171_get_eee(struct dsa_switch *ds, int port,
-                            struct ethtool_eee *e)
-{
-       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
-
-       if (ps->id == PORT_SWITCH_ID_6172)
-               return mv88e6xxx_get_eee(ds, port, e);
-
-       return -EOPNOTSUPP;
-}
-
-static int mv88e6171_set_eee(struct dsa_switch *ds, int port,
-                            struct phy_device *phydev, struct ethtool_eee *e)
-{
-       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
-
-       if (ps->id == PORT_SWITCH_ID_6172)
-               return mv88e6xxx_set_eee(ds, port, phydev, e);
-
-       return -EOPNOTSUPP;
-}
-
 struct dsa_switch_driver mv88e6171_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_EDSA,
        .priv_size              = sizeof(struct mv88e6xxx_priv_state),
@@ -138,8 +102,6 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
        .get_strings            = mv88e6xxx_get_strings,
        .get_ethtool_stats      = mv88e6xxx_get_ethtool_stats,
        .get_sset_count         = mv88e6xxx_get_sset_count,
-       .set_eee                = mv88e6171_set_eee,
-       .get_eee                = mv88e6171_get_eee,
 #ifdef CONFIG_NET_DSA_HWMON
        .get_temp               = mv88e6xxx_get_temp,
 #endif
@@ -154,4 +116,3 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
 };
 
 MODULE_ALIAS("platform:mv88e6171");
-MODULE_ALIAS("platform:mv88e6172");
index e9aca7f7945e3482bbcaceca2d2c7ef168afa077..632815c10a401f7bd873e077a262528b73ceed7d 100644 (file)
@@ -32,6 +32,8 @@ static char *mv88e6352_probe(struct device *host_dev, int sw_addr)
 
        ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), PORT_SWITCH_ID);
        if (ret >= 0) {
+               if ((ret & 0xfff0) == PORT_SWITCH_ID_6172)
+                       return "Marvell 88E6172";
                if ((ret & 0xfff0) == PORT_SWITCH_ID_6176)
                        return "Marvell 88E6176";
                if (ret == PORT_SWITCH_ID_6352_A0)
@@ -393,3 +395,4 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
 };
 
 MODULE_ALIAS("platform:mv88e6352");
+MODULE_ALIAS("platform:mv88e6172");