aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/dsa/mv88e6123_61_65.c31
-rw-r--r--drivers/net/dsa/mv88e6171.c70
-rw-r--r--drivers/net/dsa/mv88e6352.c39
-rw-r--r--drivers/net/dsa/mv88e6xxx.c479
-rw-r--r--drivers/net/dsa/mv88e6xxx.h46
-rw-r--r--include/net/dsa.h6
-rw-r--r--net/dsa/slave.c102
7 files changed, 679 insertions, 94 deletions
diff --git a/drivers/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c
index e9c736e1cef3..2d7e1ffe9fdc 100644
--- a/drivers/net/dsa/mv88e6123_61_65.c
+++ b/drivers/net/dsa/mv88e6123_61_65.c
@@ -222,28 +222,6 @@ static int mv88e6123_61_65_setup_port(struct dsa_switch *ds, int p)
222 val |= 0x000c; 222 val |= 0x000c;
223 REG_WRITE(addr, 0x04, val); 223 REG_WRITE(addr, 0x04, val);
224 224
225 /* Port Control 1: disable trunking. Also, if this is the
226 * CPU port, enable learn messages to be sent to this port.
227 */
228 REG_WRITE(addr, 0x05, dsa_is_cpu_port(ds, p) ? 0x8000 : 0x0000);
229
230 /* Port based VLAN map: give each port its own address
231 * database, allow the CPU port to talk to each of the 'real'
232 * ports, and allow each of the 'real' ports to only talk to
233 * the upstream port.
234 */
235 val = (p & 0xf) << 12;
236 if (dsa_is_cpu_port(ds, p))
237 val |= ds->phys_port_mask;
238 else
239 val |= 1 << dsa_upstream_port(ds);
240 REG_WRITE(addr, 0x06, val);
241
242 /* Default VLAN ID and priority: don't set a default VLAN
243 * ID, and set the default packet priority to zero.
244 */
245 REG_WRITE(addr, 0x07, 0x0000);
246
247 /* Port Control 2: don't force a good FCS, set the maximum 225 /* Port Control 2: don't force a good FCS, set the maximum
248 * frame size to 10240 bytes, don't let the switch add or 226 * frame size to 10240 bytes, don't let the switch add or
249 * strip 802.1q tags, don't discard tagged or untagged frames 227 * strip 802.1q tags, don't discard tagged or untagged frames
@@ -288,18 +266,17 @@ static int mv88e6123_61_65_setup_port(struct dsa_switch *ds, int p)
288 */ 266 */
289 REG_WRITE(addr, 0x19, 0x7654); 267 REG_WRITE(addr, 0x19, 0x7654);
290 268
291 return 0; 269 return mv88e6xxx_setup_port_common(ds, p);
292} 270}
293 271
294static int mv88e6123_61_65_setup(struct dsa_switch *ds) 272static int mv88e6123_61_65_setup(struct dsa_switch *ds)
295{ 273{
296 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
297 int i; 274 int i;
298 int ret; 275 int ret;
299 276
300 mutex_init(&ps->smi_mutex); 277 ret = mv88e6xxx_setup_common(ds);
301 mutex_init(&ps->stats_mutex); 278 if (ret < 0)
302 mutex_init(&ps->phy_mutex); 279 return ret;
303 280
304 ret = mv88e6123_61_65_switch_reset(ds); 281 ret = mv88e6123_61_65_switch_reset(ds);
305 if (ret < 0) 282 if (ret < 0)
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index 9808c860a797..18cfead83dc9 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -17,6 +17,10 @@
17#include <net/dsa.h> 17#include <net/dsa.h>
18#include "mv88e6xxx.h" 18#include "mv88e6xxx.h"
19 19
20/* Switch product IDs */
21#define ID_6171 0x1710
22#define ID_6172 0x1720
23
20static char *mv88e6171_probe(struct device *host_dev, int sw_addr) 24static char *mv88e6171_probe(struct device *host_dev, int sw_addr)
21{ 25{
22 struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev); 26 struct mii_bus *bus = dsa_host_dev_to_mii_bus(host_dev);
@@ -27,9 +31,9 @@ static char *mv88e6171_probe(struct device *host_dev, int sw_addr)
27 31
28 ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03); 32 ret = __mv88e6xxx_reg_read(bus, sw_addr, REG_PORT(0), 0x03);
29 if (ret >= 0) { 33 if (ret >= 0) {
30 if ((ret & 0xfff0) == 0x1710) 34 if ((ret & 0xfff0) == ID_6171)
31 return "Marvell 88E6171"; 35 return "Marvell 88E6171";
32 if ((ret & 0xfff0) == 0x1720) 36 if ((ret & 0xfff0) == ID_6172)
33 return "Marvell 88E6172"; 37 return "Marvell 88E6172";
34 } 38 }
35 39
@@ -221,28 +225,6 @@ static int mv88e6171_setup_port(struct dsa_switch *ds, int p)
221 val |= 0x000c; 225 val |= 0x000c;
222 REG_WRITE(addr, 0x04, val); 226 REG_WRITE(addr, 0x04, val);
223 227
224 /* Port Control 1: disable trunking. Also, if this is the
225 * CPU port, enable learn messages to be sent to this port.
226 */
227 REG_WRITE(addr, 0x05, dsa_is_cpu_port(ds, p) ? 0x8000 : 0x0000);
228
229 /* Port based VLAN map: give each port its own address
230 * database, allow the CPU port to talk to each of the 'real'
231 * ports, and allow each of the 'real' ports to only talk to
232 * the upstream port.
233 */
234 val = (p & 0xf) << 12;
235 if (dsa_is_cpu_port(ds, p))
236 val |= ds->phys_port_mask;
237 else
238 val |= 1 << dsa_upstream_port(ds);
239 REG_WRITE(addr, 0x06, val);
240
241 /* Default VLAN ID and priority: don't set a default VLAN
242 * ID, and set the default packet priority to zero.
243 */
244 REG_WRITE(addr, 0x07, 0x0000);
245
246 /* Port Control 2: don't force a good FCS, set the maximum 228 /* Port Control 2: don't force a good FCS, set the maximum
247 * frame size to 10240 bytes, don't let the switch add or 229 * frame size to 10240 bytes, don't let the switch add or
248 * strip 802.1q tags, don't discard tagged or untagged frames 230 * strip 802.1q tags, don't discard tagged or untagged frames
@@ -287,17 +269,17 @@ static int mv88e6171_setup_port(struct dsa_switch *ds, int p)
287 */ 269 */
288 REG_WRITE(addr, 0x19, 0x7654); 270 REG_WRITE(addr, 0x19, 0x7654);
289 271
290 return 0; 272 return mv88e6xxx_setup_port_common(ds, p);
291} 273}
292 274
293static int mv88e6171_setup(struct dsa_switch *ds) 275static int mv88e6171_setup(struct dsa_switch *ds)
294{ 276{
295 struct mv88e6xxx_priv_state *ps = (void *)(ds + 1);
296 int i; 277 int i;
297 int ret; 278 int ret;
298 279
299 mutex_init(&ps->smi_mutex); 280 ret = mv88e6xxx_setup_common(ds);
300 mutex_init(&ps->stats_mutex); 281 if (ret < 0)
282 return ret;
301 283
302 ret = mv88e6171_switch_reset(ds); 284 ret = mv88e6171_switch_reset(ds);
303 if (ret < 0) 285 if (ret < 0)
@@ -318,8 +300,6 @@ static int mv88e6171_setup(struct dsa_switch *ds)
318 return ret; 300 return ret;
319 } 301 }
320 302
321 mutex_init(&ps->phy_mutex);
322
323 return 0; 303 return 0;
324} 304}
325 305
@@ -410,6 +390,28 @@ static int mv88e6171_get_sset_count(struct dsa_switch *ds)
410 return ARRAY_SIZE(mv88e6171_hw_stats); 390 return ARRAY_SIZE(mv88e6171_hw_stats);
411} 391}
412 392
393static int mv88e6171_get_eee(struct dsa_switch *ds, int port,
394 struct ethtool_eee *e)
395{
396 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
397
398 if (ps->id == ID_6172)
399 return mv88e6xxx_get_eee(ds, port, e);
400
401 return -EOPNOTSUPP;
402}
403
404static int mv88e6171_set_eee(struct dsa_switch *ds, int port,
405 struct phy_device *phydev, struct ethtool_eee *e)
406{
407 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
408
409 if (ps->id == ID_6172)
410 return mv88e6xxx_set_eee(ds, port, phydev, e);
411
412 return -EOPNOTSUPP;
413}